/* Shared category and article composition. Existing content and feature guards remain authoritative. */
.editorial-category{--category-veil:rgba(15,12,9,.86);position:relative;isolation:isolate}
html[data-theme="light"] .editorial-category{--category-veil:rgba(247,241,231,.9)}
.editorial-category .portal-page{max-width:1200px;padding:36px 24px 80px;margin:auto}
.editorial-category .category-hero{position:relative;isolation:isolate;min-height:300px;display:flex;flex-direction:column;justify-content:center;align-items:flex-start;background:none;border:0;border-radius:0;padding:36px 24px;margin:0 0 16px;overflow:visible}
.editorial-category .category-hero h1{font:700 clamp(2.2rem,5vw,4.5rem)/1.1 Georgia,serif;margin:12px 0 20px;max-width:22ch;color:var(--gdb-text)}
.editorial-category .category-hero p{max-width:55ch;font-size:1.1rem;color:var(--gdb-text)}
.editorial-category .portal-search{position:relative;margin:0 0 30px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:12px;padding:0;background:none;border:0;box-shadow:none;max-width:none}
.editorial-category .portal-search label{display:grid;gap:9px;min-width:0;font-weight:600}
.editorial-category .portal-search input{width:100%;box-sizing:border-box;min-width:0;min-height:50px;padding:12px 14px 12px 44px;background-color:var(--gdb-surface);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23b98427' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 5 5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:14px center;border:1px solid var(--gdb-border);border-radius:10px;color:var(--gdb-text)}
.editorial-category .portal-search button{min-height:50px;padding:12px 28px;background:var(--gdb-gold);color:#17120d;border:0;border-radius:10px;font-weight:700}
.editorial-category .editorial-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.editorial-category .editorial-result-group{grid-column:1/-1;margin:12px 0 0}
.editorial-category .editorial-result{min-width:0;margin:0;border:1px solid var(--gdb-border);border-radius:17px;background:var(--gdb-surface);box-shadow:0 8px 24px #00000012;overflow:hidden}
.editorial-category .editorial-result-link{display:grid;grid-template-columns:132px minmax(0,1fr) 34px;gap:18px;padding:18px;height:100%;box-sizing:border-box;align-items:start;text-decoration:none}
.editorial-category .editorial-thumbnail{width:132px;height:176px;aspect-ratio:3/4;border-radius:10px;overflow:hidden;background:var(--gdb-surface-2)}
.editorial-category .editorial-thumbnail img{display:block;width:100%;height:100%;object-fit:cover;object-position:center}
.editorial-category .editorial-result-copy{min-width:0}.editorial-category .editorial-result-copy h2{font-size:1.08rem;line-height:1.35;margin:8px 0;color:var(--gdb-text);overflow-wrap:anywhere}
.editorial-category .editorial-result-copy small{color:var(--gdb-gold-dark)}html[data-theme="dark"] .editorial-result-copy small{color:var(--gdb-gold-light)}
.editorial-category .editorial-result-copy p{line-height:1.5;font-size:.95rem;margin:0;color:var(--gdb-text-secondary);display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
.editorial-card-arrow{width:32px;height:32px;border:1px solid var(--gdb-gold-dark);border-radius:50%;display:grid;place-items:center;box-sizing:border-box;padding:0;line-height:1;color:var(--gdb-gold-dark);font-size:1.4rem}
.editorial-category .editorial-card-arrow svg{display:block;width:18px;height:18px}
.editorial-result-link:hover .editorial-card-arrow{background:var(--gdb-gold);color:#17120d}
/* Large photographic article hero; dictionary covers reserve a separate right-hand region because they commonly contain lettering. */
html .editorial-page .editorial-hero{position:relative;display:block;min-height:0;padding:36px 0;margin-bottom:24px;isolation:isolate}
html .editorial-page .editorial-hero.has-cover{padding-top:36px}
html .editorial-page .editorial-hero-image{top:-22px;bottom:0;left:calc((100% - 100vw)/2);right:auto;width:100vw;max-width:none;height:calc(100% + 22px);min-height:0;object-fit:cover;object-position:70% center;mask-image:linear-gradient(#000 75%,transparent);z-index:-2}
html .editorial-page .editorial-hero::after{top:-22px;bottom:0;left:calc((100% - 100vw)/2);right:auto;width:100vw;height:auto;background:linear-gradient(90deg,var(--gdb-bg) 10%,rgba(15,12,9,.84) 42%,transparent 85%);mask-image:linear-gradient(#000 75%,transparent);z-index:-1}
html[data-theme="light"] .editorial-page .editorial-hero::after{background:linear-gradient(90deg,var(--gdb-bg) 10%,rgba(247,241,231,.93) 42%,rgba(247,241,231,.12) 85%)}
html .editorial-page .editorial-hero-content{padding:18px 0;max-width:64%;position:relative}
.editorial-page .editorial-hero h1{font-size:clamp(2rem,3.6vw,3.5rem);max-width:23ch;line-height:1.12}


.editorial-top-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:18px}
.editorial-top-controls button{min-height:44px;min-width:44px}
.editorial-reading-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:24px;align-items:start}
.editorial-reading-layout:not(:has(.editorial-index:not([hidden]))):not(:has(.editorial-suggestions)){grid-template-columns:minmax(0,1fr)}
html .editorial-page .editorial-reading{max-width:none;width:100%;min-width:0;box-sizing:border-box;margin:0;padding:30px;background:var(--gdb-surface);border:1px solid var(--gdb-border);box-shadow:none}
.editorial-index{position:sticky;top:88px;border:1px solid var(--gdb-border);border-radius:14px;padding:18px;background:var(--gdb-surface)}
.editorial-index summary{font-weight:700;cursor:pointer;min-height:44px;display:flex;align-items:center;gap:8px}.editorial-index summary::before{content:'☷';color:var(--gdb-gold-dark);font-size:1.4rem}
.editorial-index ol{padding-left:22px;margin:10px 0 0}.editorial-index li{padding:5px 0;line-height:1.4}.editorial-index a{color:var(--gdb-text);text-decoration:none}.editorial-index a:hover{color:var(--gdb-gold-dark)}
.editorial-section-heading{scroll-margin-top:100px;display:flex;align-items:baseline;gap:14px}.editorial-section-heading[data-section-number]::before{content:attr(data-section-number);font:700 1.05rem/36px system-ui;min-width:36px;text-align:center;border-radius:50%;background:var(--gdb-gold);color:#17120d}
.editorial-body p[id]{scroll-margin-top:100px}.editorial-definition,.editorial-body blockquote{border:1px solid var(--gdb-border);border-left:3px solid var(--gdb-gold-dark);border-radius:12px;background:var(--gdb-gold-soft);padding:18px 22px;margin:22px 0}
.editorial-definition h2{font-size:1.1rem;margin-top:0}.editorial-body :is(h2,h3){font-family:Georgia,serif;line-height:1.25}
html .editorial-access{position:static;transform:none;height:auto;max-width:none;margin:0 0 12px}.editorial-access a{width:auto}
@media(max-width:1023px){.editorial-reading-layout{display:block}.editorial-index{position:static;margin-bottom:16px}.editorial-category .editorial-result-link{grid-template-columns:96px minmax(0,1fr) 30px;gap:12px;padding:14px}.editorial-category .editorial-thumbnail{width:96px;height:140px}}
@media(max-width:767px){.editorial-category .portal-page{padding:20px 16px 95px}.editorial-category .category-hero{min-height:245px;padding:22px 0}.editorial-category .category-hero h1{font-size:2.4rem}.editorial-category .category-hero p{font-size:1rem}.editorial-category .editorial-results{grid-template-columns:1fr}.editorial-category .portal-search{gap:8px}.editorial-category .portal-search button{padding:10px 16px}.editorial-category .editorial-result-link{grid-template-columns:82px minmax(0,1fr) 28px;gap:12px}.editorial-category .editorial-thumbnail{width:82px;height:126px}.editorial-card-arrow{width:26px;height:26px}.editorial-category .editorial-result-copy h2{font-size:.95rem}.editorial-category .editorial-result-copy small{font-size:.74rem}.editorial-category .editorial-result-copy p{font-size:.85rem;-webkit-line-clamp:3}
html .editorial-page .editorial-hero.has-cover{padding-top:20px}html .editorial-page .editorial-hero{padding-bottom:10px}html .editorial-page .editorial-hero-image,html .editorial-page .editorial-cover-text .editorial-hero-image{width:100vw;top:-10px;bottom:0;left:calc((100% - 100vw)/2);right:auto;height:calc(100% + 10px);min-height:0;object-fit:cover;object-position:65% top;mask-image:linear-gradient(#000 65%,transparent)}html .editorial-page .editorial-hero::after{display:block;top:-10px;bottom:0;left:calc((100% - 100vw)/2);right:auto}html .editorial-page .editorial-hero-content,html .editorial-page .editorial-cover-text .editorial-hero-content{max-width:100%;padding:10px 0}.editorial-page .editorial-hero h1{font-size:2rem}.editorial-page .editorial-byline{flex-direction:row;flex-wrap:wrap;gap:8px 16px}html .editorial-page .editorial-reading{padding:22px 17px}.editorial-index{padding:10px 14px}.editorial-section-heading{gap:10px}.editorial-section-heading[data-section-number]::before{min-width:30px;line-height:30px}.editorial-body{font-size:1rem}}

body.editorial-category:not(.home-page) .dictionary-page>.portal-search:has(label:first-child:last-of-type){grid-template-columns:minmax(0,1fr) auto;gap:8px}
body.editorial-category:not(.home-page) .dictionary-page>.portal-search button{width:auto}

/* Unified article rhythm and real related-content rail. */
html .editorial-page .editorial-hero{padding-block:20px 12px;margin-bottom:18px}
html .editorial-page .editorial-hero.has-cover{padding-top:20px}
html .editorial-page .editorial-hero-content{padding-block:12px 4px}
.editorial-top-controls{width:100%;gap:8px;margin-top:16px;position:relative;display:flex;align-items:center;flex-wrap:wrap}
html .editorial-top-controls .editorial-access{margin:0 0 0 auto;display:block}
.editorial-top-controls .editorial-access a{min-height:44px;box-sizing:border-box;padding:8px 12px;display:flex;align-items:center}
.editorial-top-controls>button{width:44px;height:44px;display:grid;place-items:center;padding:0;flex:none}
.editorial-reading-layout{row-gap:18px;grid-template-rows:auto 1fr}
.editorial-reading-layout:has(.editorial-suggestions){grid-template-columns:240px minmax(0,1fr)}
.editorial-reading-layout>.editorial-reading{grid-column:2;grid-row:1/span 2}
.editorial-reading-layout:not(:has(.editorial-index:not([hidden]))):not(:has(.editorial-suggestions))>.editorial-reading{grid-column:1}
.editorial-index{position:static;grid-column:1;grid-row:1}
.editorial-suggestions{grid-column:1;grid-row:2;min-width:0;padding:18px;border:1px solid var(--gdb-border);border-radius:14px;background:var(--gdb-surface)}
.editorial-suggestions h2{font-size:1.1rem;margin:0 0 14px}
.editorial-suggestions ul{list-style:none;padding:0;margin:0}.editorial-suggestions li+li{border-top:1px solid var(--gdb-border);margin-top:12px;padding-top:12px}
.editorial-suggestions a{font-weight:650;line-height:1.4;display:block;overflow-wrap:break-word;word-break:normal}.editorial-suggestions p{font-size:.86rem;line-height:1.45;color:var(--gdb-text-secondary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:7px 0 0}
.editorial-page .editorial-body>:first-child{margin-top:0}
.editorial-category .editorial-result{align-self:stretch}.editorial-category .editorial-result-link{position:relative;grid-template-columns:132px minmax(0,1fr);padding-right:58px;min-height:212px}
.editorial-category .editorial-card-arrow{position:absolute;right:16px;top:18px}
@media(max-width:1023px){.editorial-reading-layout:has(.editorial-suggestions){display:flex;flex-direction:column;gap:16px}.editorial-reading-layout>:is(.editorial-index,.editorial-reading,.editorial-suggestions){width:100%;box-sizing:border-box}.editorial-suggestions{order:3}.editorial-index{margin-bottom:0}.editorial-category .editorial-result-link{grid-template-columns:96px minmax(0,1fr);padding-right:48px}}
@media(max-width:767px){
html .editorial-page .editorial-hero::after{background:linear-gradient(90deg,rgba(15,12,9,.94),rgba(15,12,9,.76)),linear-gradient(0deg,var(--gdb-bg),transparent)}
html[data-theme="light"] .editorial-page .editorial-hero::after{background:linear-gradient(90deg,rgba(247,241,231,.96),rgba(247,241,231,.82)),linear-gradient(0deg,var(--gdb-bg),transparent)}
.editorial-top-controls{gap:5px}.editorial-top-controls .editorial-access a{font-size:.8rem;padding:8px}
.editorial-category .editorial-result-link{grid-template-columns:82px minmax(0,1fr);padding-right:44px;min-height:154px}.editorial-category .editorial-card-arrow{right:10px;top:14px}
.editorial-page .editorial-detail{padding-bottom:calc(90px + env(safe-area-inset-bottom))}
}

/* Keep the extended photographic backdrop behind, not over, catalog cards. */
.editorial-category .editorial-catalog{position:relative;isolation:isolate}
.editorial-category .editorial-catalog .category-hero{isolation:auto;background:transparent!important;box-shadow:none;border:0;border-radius:0}

/* One thematic backdrop for each catalog, including the dictionary. */
body.editorial-category .editorial-catalog::before{content:"";position:absolute;z-index:-1;pointer-events:none;top:0;left:calc((100% - 100vw)/2);width:100vw;height:clamp(520px,72vh,760px);background-image:linear-gradient(0deg,var(--gdb-bg) 0%,transparent 65%),linear-gradient(90deg,var(--category-veil),transparent),var(--catalog-art);background-size:cover;background-position:center;transform:none}
@media(max-width:767px){body.editorial-category .editorial-catalog::before{height:600px;background-position:65% top}}

/* Reading size is known before paint; paragraph tools do not affect typography. */
html .editorial-page [data-font-css] .editorial-body{font-size:clamp(12px,calc(clamp(16.64px,1.5vw,18.08px) + var(--reading-offset,0px)),40px)}
html .editorial-page [data-font-css] .editorial-body :is(p,li,blockquote){font-size:inherit}

/* Only History and Dictionary: balanced cover placement. */
.editorial-catalog:has(.portal-search:is([action="/historia"],[action="/dicionario"])) .editorial-thumbnail{align-self:center}
@media(max-width:767px){
 .editorial-catalog:has(.portal-search:is([action="/historia"],[action="/dicionario"])) .editorial-result-link{grid-template-columns:minmax(0,1fr);padding:14px}
 .editorial-catalog:has(.portal-search:is([action="/historia"],[action="/dicionario"])) .editorial-thumbnail{width:100%;height:auto;aspect-ratio:16/9}
 .editorial-catalog:has(.portal-search:is([action="/historia"],[action="/dicionario"])) .editorial-result-copy{padding-right:30px}
 .editorial-catalog:has(.portal-search:is([action="/historia"],[action="/dicionario"])) .editorial-card-arrow{top:auto;bottom:14px}
}

/* Article footer only; catalog and other reader controls stay unchanged. */
.editorial-page .editorial-footer-metrics{gap:8px;align-items:center}
.editorial-page .editorial-footer-metrics>span:first-child{margin-right:auto}
.editorial-page .editorial-footer-metrics>button{flex:0 0 auto;min-height:44px;padding:8px 10px}
.editorial-page .editorial-footer-metrics>.metrics-status:empty{display:none}
.editorial-page .editorial-relations ul{display:flex;flex-wrap:wrap;gap:8px;list-style:none;padding:0;margin:12px 0}
.editorial-page .editorial-relations li{max-width:100%;margin:0;padding:6px 10px;border:1px solid var(--gdb-border-neutral);border-radius:6px;background:var(--gdb-surface-2);overflow-wrap:anywhere;font-size:.9em}
.editorial-reading-layout>.editorial-rail{grid-column:1;grid-row:1 / 3;min-width:0;display:grid;gap:16px;align-self:start}
.editorial-rail:has(.editorial-index[hidden]):not(:has(.editorial-suggestions)){display:none}
@media(min-width:1024px){.editorial-reading-layout>.editorial-rail{position:sticky;top:88px;max-height:calc(100dvh - 112px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.editorial-rail>.editorial-index{position:static}.editorial-rail>.editorial-suggestions{grid-row:auto}}
@media(max-width:1023px){.editorial-reading-layout>.editorial-rail{position:static;width:100%;max-height:none;overflow:visible}}
