
@import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700;800;900&display=swap");

:root{
  --bg:#f4efe5;
  --paper:#fbfaf7;
  --paper-2:#f1ebdf;
  --paper-3:#ebe3d3;
  --text:#122347;
  --muted:#667089;
  --line:#d7cab3;
  --line-2:#e4dac9;
  --dark:#0f2147;
  --accent:#97d700;
  --accent-soft:rgba(151,215,0,.24);
  --shadow:0 16px 36px rgba(18,35,71,0.08);
  --radius:30px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  background:linear-gradient(180deg,#f4efe5 0%,#f7f3eb 100%);
  color:var(--text);
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.wrap{max-width:1440px;margin:0 auto;padding:0 28px}
.site-header{
  position:sticky;top:0;z-index:30;
  background:rgba(244,239,229,.96);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--line);
}
.header-grid{
  display:grid;grid-template-columns:1fr auto;gap:20px;align-items:end;padding:18px 0;
}
.brand-col h1{margin:0;font-size:4rem;line-height:.95;letter-spacing:0}
.header-copy{max-width:680px;margin-top:10px;font-size:1.1rem;line-height:1.45;color:#51607f}
.eyebrow{font-size:.82rem;letter-spacing:.36em;text-transform:uppercase;color:#7b8397}
.nav{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.nav button{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:13px 18px;
  border-radius:999px;
  font-size:1.05rem;
  cursor:pointer;
  transition:.2s ease;
}
.nav button.active,.nav button:hover{background:var(--dark);color:#fff;border-color:var(--dark)}
.main-stack{padding:34px 0 40px}
.section{display:none}
.section.active{display:block}
.panel{
  background:rgba(251,250,247,.98);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:30px;
}
.subpanel{background:var(--paper-2)}
.hero-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:24px}
.hero-panel h2{font-size:3.6rem;line-height:1.02;letter-spacing:0;max-width:900px}
.lead{margin-top:18px;font-size:1.2rem;line-height:1.72;color:#394765}
.small-lead{max-width:980px}
.stats{margin-top:28px;display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.stat{
  background:var(--paper-2);
  border:1px solid var(--line-2);
  border-radius:8px;
  padding:18px 18px 16px;
}
.stat-value{font-size:2rem;font-weight:800;letter-spacing:0}
.stat-label{margin-top:6px;font-size:.96rem;color:#58647d}
.accent-panel{background:linear-gradient(160deg,#11244b 0%,#0f1d3c 100%);color:#fff;border-color:#13254f}
.accent-panel .eyebrow{color:#d6def0}
.capabilities{display:grid;gap:12px;margin-top:18px}
.cap{padding:15px 16px;border:1px solid rgba(255,255,255,.14);border-radius:8px;line-height:1.5;background:rgba(255,255,255,.03)}
.hero-actions,.map-actions,.expo-controls,.word-btns,.sidebar-actions{display:flex;gap:12px;flex-wrap:wrap}
.hero-actions{margin-top:26px}
.primary-btn,.secondary-btn,.ghost-btn{
  border:none;border-radius:18px;padding:13px 18px;font-size:1rem;cursor:pointer;transition:.2s ease
}
.primary-btn{background:var(--accent);color:#172343;font-weight:700}
.primary-btn:hover{filter:brightness(1.05)}
.secondary-btn,.ghost-btn{background:#fff;color:var(--text);border:1px solid var(--line)}
.secondary-btn:hover,.ghost-btn:hover{border-color:#7a879f}
.secondary-btn.small{padding:10px 14px;font-size:.92rem}
.field-label{display:block;font-size:.9rem;color:#5d6881;margin:10px 0 8px}
.field-label.inline{margin:0 0 6px}
.select,.search{
  width:100%;
  border:1px solid var(--line);
  background:#fff;
  border-radius:18px;
  padding:13px 15px;
  font-size:1rem;
  outline:none;
}
.search{background:var(--paper)}
.select:focus,.search:focus{border-color:#7c88a0}
.compact-select{max-width:280px}
.counter{font-size:1rem;color:#5a6985}
.reader-layout{display:grid;grid-template-columns:440px minmax(0,1fr);gap:24px}
.reader-sidebar{position:sticky;top:106px;height:calc(100vh - 138px);overflow:hidden;display:flex;flex-direction:column;min-height:0}
.reader-top{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}
.article-list{margin-top:16px;overflow:auto;display:grid;gap:12px;padding-right:8px;min-height:0;flex:1 1 auto;overscroll-behavior:contain}
.article-item{
  display:block;width:100%;text-align:left;border:1px solid var(--line);background:#fff;border-radius:8px;padding:16px;cursor:pointer;transition:.2s ease;overflow:visible
}
.article-item:hover{border-color:#77839b;transform:translateY(-1px)}
.article-item.active{background:var(--dark);border-color:var(--dark);color:#fff}
.small-id{font-size:.76rem;letter-spacing:.18em;text-transform:uppercase;opacity:.72}
.article-item h3{font-size:1.16rem;line-height:1.2;margin:10px 0 8px}
.mini-meta{font-size:.9rem;opacity:.8}
.mini-excerpt{margin-top:10px;font-size:.94rem;line-height:1.55}
.reader-main{min-width:0}
.reader-hero{display:flex;justify-content:space-between;gap:18px;flex-wrap:wrap}
.reader-hero h2{font-size:3rem;line-height:1.03;letter-spacing:0;margin:8px 0 0}
.subtitle{margin-top:10px;font-size:1.18rem;color:#55637d;max-width:880px}
.meta{margin-top:12px;font-size:.98rem;color:#6c7790}
.reader-grid{margin-top:26px;display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:22px;align-items:start}
.article-text-wrap{background:#fff;border:1px solid var(--line-2);border-radius:8px;padding:26px;max-height:min(72vh, 840px);overflow:auto;overscroll-behavior:contain}
.article-text{font-size:1.08rem;line-height:1.92;color:#243250;white-space:pre-wrap}
.article-side{display:grid;gap:14px;align-content:start;max-height:min(72vh, 840px);overflow:auto;padding-right:8px;overscroll-behavior:contain}
.mini-panel{background:var(--paper-2);border:1px solid var(--line-2);border-radius:8px;padding:20px}
.reader-badges,.chip-wrap,.active-words{display:flex;gap:10px;flex-wrap:wrap}
.badge,.chip{
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  padding:8px 13px;
  font-size:.96rem;
}
.route-list{list-style:none;padding:0;margin:14px 0 0;display:grid;gap:10px}
.route-list li{display:flex;gap:10px}
.step-dot{
  width:26px;height:26px;border-radius:999px;background:var(--dark);color:#fff;display:flex;align-items:center;justify-content:center;font-size:.78rem;flex:0 0 auto
}
.summary-block{display:grid;gap:10px;font-size:1rem;line-height:1.5}
.expo-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:24px}
.expo-stage{position:relative;overflow:hidden;min-height:560px;background:#003478;color:#fff;border-color:#003478}
.expo-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;flex-wrap:wrap}
.expo-head h2{font-size:3rem;margin-top:8px}
.expo-progress-wrap{margin-top:22px;height:8px;background:rgba(255,255,255,.12);border-radius:999px;overflow:hidden}
.expo-progress{height:100%;width:0%;background:linear-gradient(90deg,#f1c45a,#fff2c9);transition:width .2s linear}
.expo-word-wrap{position:relative;margin-top:38px;min-height:170px;display:flex;align-items:center}
.expo-word{font-size:7rem;font-weight:800;line-height:.95;letter-spacing:0;position:relative;z-index:2;max-width:1000px}
.halo{position:absolute;border-radius:999px;filter:blur(10px);opacity:.26}
.halo-a{width:280px;height:280px;right:2%;top:-10%;background:#f2c860}
.halo-b{width:160px;height:160px;left:8%;bottom:0;background:#3359d8}
.expo-quote{margin-top:16px;font-size:1.42rem;line-height:1.7;max-width:1000px;color:#edf2ff;border-left:3px solid rgba(255,255,255,.22);padding-left:18px}
.expo-meta{margin-top:18px;font-size:1rem;color:#d3ddf6}
.expo-controls{margin-top:28px}
.expo-side .small-note{margin-top:14px;color:#394765;line-height:1.7}
.map-copy-panel{padding-bottom:24px}
.map-topline{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap;align-items:flex-end}
.map-topline h2{font-size:3.2rem;line-height:1.02;letter-spacing:0;margin:10px 0 0}
.atlas-panel{margin-top:18px;padding:22px 22px 26px}
.atlas-toolbar{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;flex-wrap:wrap}
.atlas-toolbar h3{margin-top:8px;font-size:1.55rem}
.toolbar-note{font-size:1rem;color:#5d6881}
.atlas-frame-wrap{margin-top:18px;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#fff}
.atlas-frame{display:block;width:100%;border:0}
.atlas-frame.tall{height:76vh;min-height:760px}
.map-context-row{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:18px;margin-top:18px}
.context-card.large h3{font-size:1.9rem;margin:8px 0 12px}
.map-context{font-size:1.06rem;line-height:1.75;color:#40506d}
.instruction-list{display:grid;gap:12px;margin-top:12px}
.instruction{background:#fff;border:1px solid var(--line);border-radius:8px;padding:16px;font-size:1rem;line-height:1.56}
.word-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;margin-top:18px;align-items:end}
.word-dashboard{display:grid;grid-template-columns:1.12fr .88fr;gap:18px;margin-top:18px}
.trend-chart,.theme-trend{width:100%;height:auto;display:block;background:#fff;border:1px solid var(--line);border-radius:8px;padding:10px}
.legend{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.legend-item{display:flex;gap:8px;align-items:center;font-size:.95rem}
.legend-swatch{width:12px;height:12px;border-radius:999px}
.metric-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.metric{background:#fff;border:1px solid var(--line);border-radius:8px;padding:16px}
.metric .value{font-size:2rem;font-weight:800;letter-spacing:0}
.metric .label{margin-top:6px;color:#5e6880}
.divider{height:1px;background:var(--line);margin:16px 0}
.collocation-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.collocation-item{background:#fff;border:1px solid var(--line);border-radius:18px;padding:12px 14px;display:flex;justify-content:space-between;gap:10px}
.word-results-grid,.theme-bottom{display:grid;grid-template-columns:1.08fr .92fr;gap:18px;margin-top:18px}
.concordance-list,.word-article-list,.theme-article-grid{display:grid;gap:12px}
.concordance-item,.theme-article,.word-article{background:#fff;border:1px solid var(--line);border-radius:8px;padding:16px}
.concordance-item mark{background:var(--accent-soft);padding:0 2px;border-radius:4px}
.word-article h4,.theme-article h4{margin:0 0 8px;font-size:1.1rem}
.theme-top{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;flex-wrap:wrap}
.theme-tabs{display:flex;gap:10px;flex-wrap:wrap;max-width:700px;justify-content:flex-end}
.theme-tab{
  border:1px solid var(--line);background:#fff;border-radius:999px;padding:10px 14px;cursor:pointer;font-size:.95rem;transition:.2s
}
.theme-tab.active,.theme-tab:hover{background:var(--dark);color:#fff;border-color:var(--dark)}
.theme-stage{display:grid;grid-template-columns:1.02fr .98fr;gap:18px;margin-top:22px}
.theme-story h3{font-size:2rem;margin:8px 0 0}
.theme-description{margin-top:12px;font-size:1.05rem;line-height:1.7;color:#42506b}
.metric-grid.compact{grid-template-columns:repeat(2,1fr);margin-top:18px}
.bubble-stage{
  position:relative;min-height:320px;border-radius:8px;background:#fff;overflow:hidden
}
.bubble-stage.interactive .bubble{cursor:pointer}
.bubble{
  position:absolute;display:flex;align-items:center;justify-content:center;border-radius:999px;
  background:linear-gradient(135deg,rgba(211,155,40,.18),rgba(16,34,75,.08));
  border:1px solid rgba(211,155,40,.4);
  color:var(--dark);text-align:center;padding:10px;transition:transform .2s ease, box-shadow .2s ease
}
.bubble:hover,.bubble.active{transform:scale(1.07);box-shadow:0 10px 24px rgba(16,34,75,.12)}
.place-bars{display:grid;gap:12px}
.place-bar{display:grid;grid-template-columns:140px 1fr 52px;gap:12px;align-items:center}
.place-bar .track{height:12px;background:#fff;border:1px solid var(--line);border-radius:999px;overflow:hidden}
.place-bar .fill{height:100%;background:linear-gradient(90deg,var(--dark),var(--accent))}
.keyword-focus{margin-top:14px;background:#fff;border:1px solid var(--line);border-radius:8px;padding:16px;line-height:1.65;color:#42506b;min-height:110px}
.history-cards.modern{
  margin-top:22px;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:16px;
}
.history-card{
  background:linear-gradient(180deg,#fff,#f6f1e8);
  border:1px solid var(--line);
  border-radius:8px;
  padding:18px;
  display:grid;
  gap:12px;
}
.history-step{
  width:38px;height:38px;border-radius:999px;background:var(--dark);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700
}
.history-year{font-size:2rem;font-weight:800;letter-spacing:0}
.history-card h3{font-size:1.45rem;line-height:1.15}
.history-card p{font-size:1rem;line-height:1.68;color:#40506d}
.method-panel{background:linear-gradient(180deg,#122347,#0e1d3c);color:#fff;border-color:#142b5f}
.method-panel .eyebrow{color:#d5dff0}
.method-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-top:22px}
.method-card{border:1px solid rgba(255,255,255,.12);border-radius:8px;padding:18px;background:rgba(255,255,255,.04)}
.method-card p{color:#dde4f4;line-height:1.65}
@media (max-width: 1320px){
  .brand-col h1{font-size:3.4rem}
  .reader-layout{grid-template-columns:400px minmax(0,1fr)}
}
@media (max-width: 1180px){
  .hero-grid,.expo-layout,.reader-layout,.reader-grid,.word-dashboard,.word-results-grid,.theme-stage,.theme-bottom,.map-context-row,.method-grid{grid-template-columns:1fr}
  .reader-sidebar{position:static;height:auto}
  .atlas-frame.tall{height:66vh;min-height:640px}
}
@media (max-width: 780px){
  .wrap{padding:0 16px}
  .header-grid{grid-template-columns:1fr;align-items:start}
  .brand-col h1{font-size:2.8rem}
  .hero-panel h2,.map-topline h2,.expo-head h2{font-size:2.4rem}
  .reader-hero h2{font-size:2.2rem}
  .stats{grid-template-columns:repeat(2,1fr)}
  .metric-grid,.metric-grid.compact,.collocation-grid{grid-template-columns:1fr}
  .atlas-frame.tall{height:58vh;min-height:520px}
  .expo-word{font-size:4.2rem}
}


.expo-integrated-top{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;flex-wrap:wrap}
.expo-integrated-top h2{font-size:3.2rem;line-height:1.02;letter-spacing:0;margin:10px 0 0}
.expo-integrated-actions{display:flex;gap:12px;flex-wrap:wrap}
.expo-frame-wrap{margin-top:18px}
.expo-frame{height:86vh;min-height:900px}
@media (max-width: 1180px){.expo-frame{height:72vh;min-height:760px}}
@media (max-width: 780px){.expo-integrated-top h2{font-size:2.4rem}.expo-frame{height:68vh;min-height:620px}}


/* --- Expo integrato compatto --- */
.expo-section-compact{
  padding:24px;
}
.expo-section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.expo-section-head h2{
  margin:8px 0 0;
  font-size:2.5rem;
  line-height:1.02;
  letter-spacing:0;
}
.expo-intro{
  max-width:780px;
  margin-top:10px;
  font-size:1rem;
  line-height:1.6;
}
.expo-integrated-actions.compact{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.expo-embed-shell{
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden;
  background:linear-gradient(180deg,#e9dfcd,#f7f2ea);
  padding:14px;
}
.expo-frame-compact{
  display:block;
  width:100%;
  height:min(72vh, 760px);
  min-height:620px;
  border:0;
  border-radius:0;
  background:#0e2148;
}

@media (max-width: 900px){
  .expo-section-head h2{
    font-size:2rem;
  }
  .expo-frame-compact{
    height:68vh;
    min-height:540px;
  }
}


/* --- Tema potenziato --- */
.theme-network{width:100%;height:100%;display:block}
.theme-node{cursor:pointer;transition:transform .18s ease}
.theme-node.active circle{stroke:#10224b;stroke-width:2.4}
.graph-tooltip{
  position:absolute;
  pointer-events:none;
  background:#10224b;
  color:#fff;
  border-radius:12px;
  padding:8px 10px;
  font-size:.86rem;
  line-height:1.35;
  box-shadow:0 8px 18px rgba(16,34,75,.18);
  transform:translate(-50%, -110%);
  opacity:0;
  transition:opacity .12s ease;
  white-space:nowrap;
  z-index:5;
}
.graph-tooltip.show{opacity:1}
.place-bar{
  border:0;
  background:transparent;
  padding:0;
  cursor:pointer;
}
.place-bar .place-name{text-align:left}
.place-bar .fill{
  transition:width .7s cubic-bezier(.2,.8,.2,1), filter .2s ease;
}
.place-bar.active .fill,
.place-bar:hover .fill{
  filter:brightness(1.08);
}
.theme-article-actions{margin-top:12px;display:flex;justify-content:flex-start}
.keyword-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
}
.keyword-chip .chip-count{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  border-radius:999px;
  background:rgba(16,34,75,.08);
  font-size:.8rem;
  padding:0 6px;
}
.keyword-chip:hover{
  border-color:#10224b;
}


/* --- Affinamenti layout temi v11 --- */
.theme-network{
  width:100%;
  height:auto;
  min-height:360px;
  display:block;
}
.bubble-stage.interactive{
  min-height:380px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.theme-node text{
  pointer-events:none;
}
#theme-trend{
  width:100%;
  height:auto;
  min-height:240px;
}


/* --- Temi v12: rete e asse X --- */
.bubble-stage.interactive{
  min-height:460px;
  padding:12px;
}
.theme-network{
  width:100%;
  height:auto;
  min-height:420px;
  display:block;
}
#theme-trend{
  width:100%;
  height:auto;
  min-height:280px;
}


/* --- Temi v13: font più grandi e grafici più leggibili --- */
.bubble-stage.interactive{
  min-height:560px;
  padding:8px 10px 14px;
}
.theme-network{
  width:100%;
  height:auto;
  min-height:520px;
  display:block;
}
.theme-node text{
  pointer-events:none;
  letter-spacing:0;
}
#theme-trend{
  width:100%;
  height:auto;
  min-height:320px;
}


/* --- Heritage Lab visual system --- */
:root{
  --hl-blue:#003478;
  --hl-green:#97d700;
  --hl-charcoal:#3b3834;
  --hl-cream:#faf7ef;
  --hl-paper:#ffffff;
  --hl-soft:#f4f4f4;
  --hl-line:#ededed;
  --hl-text:#212121;
  --hl-muted:#595959;
  --bg:var(--hl-cream);
  --paper:var(--hl-paper);
  --paper-2:var(--hl-soft);
  --paper-3:#ece8dc;
  --text:var(--hl-text);
  --muted:var(--hl-muted);
  --line:var(--hl-line);
  --line-2:#dedbd4;
  --dark:var(--hl-blue);
  --accent:var(--hl-green);
  --accent-soft:rgba(151,215,0,.24);
  --shadow:0 14px 34px rgba(0,52,120,.08);
  --radius:8px;
}

*,
*::before,
*::after{
  min-width:0;
}

html{
  background:var(--hl-cream);
}

body{
  overflow-x:hidden;
  background:var(--hl-cream);
  color:var(--hl-text);
  font-family:"Work Sans", Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size:18px;
  line-height:1.5;
}

img,
svg,
iframe{
  max-width:100%;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-col h1,
.hero-panel h2,
.reader-hero h2,
.map-topline h2,
.expo-section-head h2,
.expo-integrated-top h2,
.expo-word,
.history-year{
  letter-spacing:0;
}

.wrap{
  width:min(100%, 1500px);
  max-width:none;
  padding-inline:clamp(16px, 3vw, 40px);
}

.site-header{
  background:var(--hl-charcoal);
  border-bottom:0;
  color:var(--hl-cream);
}

.header-grid{
  grid-template-columns:minmax(340px, 460px) minmax(0, 1fr);
  align-items:center;
  gap:clamp(10px, 1.5vw, 20px);
  padding-block:9px;
}

.brand-col{
  display:grid;
  grid-template-columns:48px minmax(0, 1fr);
  grid-template-areas:
    "logo eyebrow"
    "logo title"
    "logo copy";
  column-gap:12px;
  row-gap:3px;
  align-items:center;
}

.heritage-logo{
  grid-area:logo;
  align-self:center;
  display:inline-flex;
  width:46px;
  height:46px;
}

.heritage-logo img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}

.brand-col .eyebrow{
  grid-area:eyebrow;
}

.brand-col h1{
  grid-area:title;
  color:#fff;
  font-size:clamp(1.25rem, 1.55vw, 1.65rem);
  font-weight:900;
  line-height:1;
  white-space:nowrap;
}

.header-copy{
  grid-area:copy;
  max-width:300px;
  color:rgba(250,247,239,.82);
  font-size:.68rem;
  line-height:1.22;
  margin:0;
}

.eyebrow{
  color:var(--hl-blue);
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.32em;
}

.site-header .eyebrow{
  color:var(--hl-green);
  font-size:.64rem;
  letter-spacing:.28em;
}

.nav{
  gap:6px;
  flex-wrap:nowrap;
  min-width:0;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scrollbar-width:none;
  white-space:nowrap;
}

.nav::-webkit-scrollbar{
  display:none;
}

.nav button,
.primary-btn,
.secondary-btn,
.ghost-btn,
.theme-tab,
button.chip{
  border-radius:4px;
  font-family:inherit;
  font-size:.88rem;
  font-weight:600;
  line-height:1.15;
  min-height:44px;
  padding:13px 14px;
  text-transform:uppercase;
}

.nav button{
  background:transparent;
  border:1px solid rgba(250,247,239,.28);
  color:var(--hl-cream);
  flex:0 0 auto;
  font-size:clamp(.62rem, .74vw, .72rem);
  white-space:nowrap;
}

.site-header .nav button{
  min-height:36px;
  padding:10px clamp(8px, .8vw, 11px);
}

.nav button.active,
.nav button:hover{
  background:var(--hl-green);
  border-color:var(--hl-green);
  color:var(--hl-blue);
}

.main-stack{
  padding-block:clamp(22px, 4vw, 54px);
}

.panel,
.stat,
.article-item,
.mini-panel,
.badge,
.chip,
.instruction,
.metric,
.collocation-item,
.concordance-item,
.theme-article,
.word-article,
.history-card,
.method-card,
.keyword-focus,
.trend-chart,
.theme-trend,
.bubble-stage{
  border-radius:8px;
}

.panel{
  background:var(--hl-paper);
  border:1px solid var(--hl-line);
  box-shadow:var(--shadow);
  padding:clamp(22px, 3vw, 42px);
}

.subpanel,
.mini-panel,
.stat{
  background:var(--hl-soft);
}

.hero-grid{
  gap:24px;
}

.home-stack{
  display:grid;
  gap:24px;
}

.hero-panel h2{
  color:var(--hl-blue);
  font-size:clamp(2.25rem, 5vw, 4.65rem);
  font-weight:900;
  line-height:.98;
}

.lead{
  color:var(--hl-text);
  font-size:clamp(1rem, 1.4vw, 1.18rem);
}

.accent-panel,
.method-panel{
  background:var(--hl-blue);
  border-color:var(--hl-blue);
  color:#fff;
}

.accent-panel .eyebrow,
.method-panel .eyebrow{
  color:var(--hl-green);
}

.cap{
  background:rgba(255,255,255,.07);
  border-color:rgba(255,255,255,.18);
  border-radius:8px;
}

.corpus-story-panel{
  align-items:start;
  display:grid;
  gap:clamp(18px, 3vw, 34px);
  grid-template-columns:minmax(0, .92fr) minmax(420px, 1.08fr);
}

.corpus-story-copy h2{
  color:var(--hl-blue);
  font-size:clamp(2rem, 3.9vw, 3.85rem);
  font-weight:900;
  line-height:1;
  margin:10px 0 18px;
}

.corpus-story-copy p{
  color:var(--hl-text);
  font-size:clamp(1rem, 1.3vw, 1.14rem);
  line-height:1.76;
  margin:0 0 1em;
  text-align:justify;
  text-wrap:pretty;
  hyphens:auto;
}

.corpus-story-facts{
  display:grid;
  gap:10px;
  grid-template-columns:repeat(3,minmax(0,1fr));
  margin:20px 0 18px;
}

.corpus-story-facts div{
  background:var(--hl-soft);
  border:1px solid var(--hl-line);
  border-left:5px solid var(--hl-green);
  border-radius:8px;
  padding:13px 14px;
}

.corpus-story-facts strong{
  color:var(--hl-blue);
  display:block;
  font-size:clamp(1.18rem, 1.7vw, 1.55rem);
  font-weight:900;
  line-height:1;
}

.corpus-story-facts span{
  color:var(--hl-muted);
  display:block;
  font-size:.82rem;
  line-height:1.25;
  margin-top:7px;
}

.corpus-source-link{
  align-items:center;
  background:var(--hl-green);
  border:1px solid var(--hl-green);
  border-radius:4px;
  color:var(--hl-blue);
  display:inline-flex;
  font-size:.84rem;
  font-weight:900;
  min-height:42px;
  padding:10px 13px;
  text-decoration:none;
  text-transform:uppercase;
}

.corpus-image-grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.corpus-image{
  background:var(--hl-soft);
  border:1px solid var(--hl-line);
  border-radius:8px;
  margin:0;
  overflow:hidden;
}

.corpus-image-wide{
  grid-column:1 / -1;
}

.corpus-image img{
  aspect-ratio:4 / 3;
  display:block;
  height:100%;
  object-fit:cover;
  width:100%;
}

.corpus-image-wide img{
  aspect-ratio:16 / 9;
}

.corpus-image figcaption{
  color:var(--hl-muted);
  font-size:.82rem;
  line-height:1.35;
  padding:9px 11px 11px;
}

.capabilities-panel{
  width:100%;
}

.primary-btn{
  background:var(--hl-green);
  color:var(--hl-blue);
  border:1px solid var(--hl-green);
}

.primary-btn:hover{
  background:var(--hl-blue);
  border-color:var(--hl-blue);
  color:#fff;
  filter:none;
  transform:translateY(-3px);
}

.secondary-btn,
.ghost-btn{
  background:#fff;
  color:var(--hl-blue);
  border:1px solid var(--hl-blue);
}

.secondary-btn:hover,
.ghost-btn:hover{
  background:var(--hl-blue);
  color:#fff;
  border-color:var(--hl-blue);
  transform:translateY(-3px);
}

.select,
.search{
  border-color:#d7d7d7;
  border-radius:4px;
  background:#fff;
  color:var(--hl-text);
}

.select:focus,
.search:focus{
  border-color:var(--hl-blue);
  box-shadow:0 0 0 3px rgba(0,52,120,.12);
}

.article-item:hover,
.theme-tab:hover,
.keyword-chip:hover{
  border-color:var(--hl-blue);
  transform:translateY(-2px);
}

.article-item.active,
.theme-tab.active{
  background:var(--hl-blue);
  border-color:var(--hl-blue);
  color:#fff;
}

.reader-layout{
  grid-template-columns:minmax(320px, 420px) minmax(0,1fr);
}

.reader-sidebar{
  top:96px;
  height:calc(100vh - 128px);
  min-height:0;
}

.reader-sidebar,
.reader-main,
.reader-grid,
.article-list,
.article-item,
.article-text-wrap,
.article-side{
  scrollbar-color:rgba(0,52,120,.55) rgba(0,0,0,.06);
  scrollbar-width:thin;
}

.article-list{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}

.article-list::-webkit-scrollbar,
.article-text-wrap::-webkit-scrollbar,
.article-side::-webkit-scrollbar{
  width:8px;
}

.article-list::-webkit-scrollbar-track,
.article-text-wrap::-webkit-scrollbar-track,
.article-side::-webkit-scrollbar-track{
  background:rgba(0,0,0,.045);
  border-radius:999px;
}

.article-list::-webkit-scrollbar-thumb,
.article-text-wrap::-webkit-scrollbar-thumb,
.article-side::-webkit-scrollbar-thumb{
  background:rgba(0,52,120,.55);
  border-radius:999px;
}

.article-item{
  max-height:none;
  overflow:visible;
}

.article-item.active{
  overflow:visible;
}

.article-side{
  max-height:min(72vh, 840px);
  overflow:auto;
}

.reader-hero h2,
.map-topline h2,
.theme-story h3,
.context-card.large h3{
  color:var(--hl-blue);
  font-weight:900;
}

.article-text-wrap{
  background:#fff;
  border-color:var(--hl-line);
  border-radius:8px;
  max-height:min(72vh, 840px);
}

.step-dot,
.history-step{
  background:var(--hl-green);
  color:var(--hl-blue);
}

.atlas-panel{
  padding:clamp(14px, 2vw, 24px);
}

.atlas-frame-wrap{
  border-color:var(--hl-line);
  border-radius:8px;
}

.atlas-frame.tall{
  height:clamp(640px, 76vh, 900px);
  min-height:0;
}

#map .map-copy-panel{
  padding:clamp(20px, 2.2vw, 30px);
}

#map .map-topline{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:end;
}

#map .map-topline h2{
  font-size:clamp(2.2rem, 3.6vw, 3.45rem);
}

#map .lead{
  margin-top:12px;
  line-height:1.48;
}

#map .map-actions{
  justify-content:flex-end;
}

.map-context-row{
  grid-template-columns:minmax(0,1fr) minmax(280px, 360px);
}

.place-bar .fill{
  background:linear-gradient(90deg,var(--hl-blue),var(--hl-green));
}

.bubble-stage{
  background:#fff;
  border:1px solid var(--hl-line);
}

.bubble{
  background:#fff;
  border-color:var(--hl-green);
  color:var(--hl-blue);
}

.theme-node.active circle{
  stroke:var(--hl-green);
}

.graph-tooltip{
  background:var(--hl-blue);
  border-radius:4px;
}

.method-panel{
  background:#fff;
  border-color:var(--hl-line);
  color:var(--hl-text);
}

.method-panel .eyebrow{
  color:var(--hl-blue);
}

.method-panel h2{
  color:var(--hl-blue);
  font-size:clamp(2.2rem, 4vw, 4.1rem);
  font-weight:900;
  line-height:1;
  margin-bottom:16px;
}

.method-lead{
  max-width:1120px;
  color:var(--hl-text);
  font-size:clamp(1rem, 1.35vw, 1.2rem);
  line-height:1.68;
}

.method-lead strong{
  color:var(--hl-blue);
}

.method-resource-links{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:22px 0 4px;
}

.method-resource-links a,
.method-resource-links button{
  align-items:center;
  background:#fff;
  border:1px solid var(--hl-blue);
  border-radius:4px;
  color:var(--hl-blue);
  cursor:pointer;
  display:inline-flex;
  font-size:.9rem;
  font-weight:800;
  font-family:inherit;
  justify-content:center;
  min-height:44px;
  padding:11px 14px;
  text-decoration:none;
  text-transform:uppercase;
}

.method-resource-links a:hover,
.method-resource-links button:hover{
  background:var(--hl-blue);
  color:#fff;
}

.corpus-drawer-backdrop{
  background:rgba(20,19,17,.46);
  inset:0;
  opacity:0;
  pointer-events:none;
  position:fixed;
  transition:opacity .2s ease;
  z-index:1000;
}

.corpus-drawer-backdrop.is-open{
  opacity:1;
  pointer-events:auto;
}

.corpus-drawer{
  background:var(--hl-cream);
  border-left:1px solid var(--hl-line);
  box-shadow:-18px 0 40px rgba(0,0,0,.18);
  display:flex;
  flex-direction:column;
  height:100dvh;
  margin-left:auto;
  max-width:100vw;
  overflow:hidden;
  padding:clamp(16px,2.2vw,28px);
  transform:translateX(100%);
  transition:transform .24s ease;
  width:min(1500px, 100vw);
}

.corpus-drawer-backdrop.is-open .corpus-drawer{
  transform:translateX(0);
}

.corpus-drawer-head{
  align-items:flex-start;
  border-bottom:1px solid var(--hl-line);
  display:flex;
  gap:18px;
  justify-content:space-between;
  padding-bottom:14px;
}

.corpus-drawer-head .eyebrow{
  color:var(--hl-green);
}

.corpus-drawer-head h2{
  color:var(--hl-blue);
  font-size:clamp(1.8rem,3.2vw,3.1rem);
  font-weight:900;
  line-height:1;
  margin:8px 0 10px;
}

.corpus-drawer-head p{
  color:var(--hl-muted);
  line-height:1.55;
  margin:0;
  max-width:680px;
}

.corpus-close{
  background:#fff;
  border:1px solid var(--hl-blue);
  border-radius:4px;
  color:var(--hl-blue);
  cursor:pointer;
  flex:0 0 auto;
  font:inherit;
  font-size:.82rem;
  font-weight:900;
  min-height:40px;
  padding:9px 12px;
  text-transform:uppercase;
}

.corpus-close:hover{
  background:var(--hl-blue);
  color:#fff;
}

.corpus-filter-grid label,
.gazetteer-filter-grid label{
  color:var(--hl-blue);
  display:block;
  font-size:.72rem;
  font-weight:900;
  letter-spacing:.22em;
  margin-bottom:7px;
  text-transform:uppercase;
}

.corpus-filter-grid input,
.corpus-filter-grid select,
.gazetteer-filter-grid input,
.gazetteer-filter-grid select{
  background:#fff;
  border:1px solid #d7d2c8;
  border-radius:5px;
  color:var(--hl-text);
  font:inherit;
  min-height:46px;
  padding:10px 12px;
  width:100%;
}

.corpus-actions a,
.corpus-actions button,
.corpus-downloads a,
.corpus-downloads button{
  align-items:center;
  background:var(--hl-green);
  border:1px solid var(--hl-green);
  border-radius:5px;
  color:var(--hl-blue);
  cursor:pointer;
  display:inline-flex;
  font:inherit;
  font-size:.84rem;
  font-weight:900;
  justify-content:center;
  min-height:46px;
  padding:10px 14px;
  text-decoration:none;
  text-transform:uppercase;
}

.corpus-library{
  display:flex;
  flex:1;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
  padding-top:18px;
}

.corpus-actions{
  align-items:center;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-start;
}

.corpus-actions button{
  background:#fff;
  border-color:var(--hl-blue);
}

.corpus-drawer-stats{
  display:grid;
  gap:10px;
  grid-template-columns:repeat(3,minmax(0,1fr));
  margin:12px 0;
}

.corpus-stat{
  background:#fff;
  border:1px solid var(--hl-line);
  border-left:5px solid var(--hl-green);
  border-radius:6px;
  padding:10px 12px;
}

.corpus-stat strong{
  color:var(--hl-blue);
  display:block;
  font-size:1.42rem;
  font-weight:900;
  line-height:1;
}

.corpus-stat span{
  color:var(--hl-muted);
  display:block;
  font-size:.85rem;
  margin-top:6px;
}

.corpus-filter-grid{
  background:#fff;
  border:1px solid var(--hl-line);
  border-radius:6px;
  display:grid;
  gap:10px;
  grid-template-columns:minmax(260px,1.2fr) minmax(240px,1fr) minmax(150px,.65fr) minmax(120px,.45fr);
  padding:12px;
}

.gazetteer-drawer{
  max-width:1500px;
  width:min(1500px, calc(100vw - 18px));
}

.gazetteer-drawer .corpus-drawer-head{
  padding-bottom:10px;
}

.gazetteer-drawer .corpus-drawer-head h2{
  font-size:clamp(1.85rem,3vw,2.8rem);
  margin-bottom:6px;
}

.gazetteer-drawer .corpus-drawer-head p:not(.eyebrow){
  line-height:1.35;
  max-width:900px;
}

.gazetteer-drawer .corpus-drawer-stats{
  margin:10px 0;
}

.gazetteer-drawer .corpus-stat{
  padding:8px 10px;
}

.gazetteer-drawer .corpus-stat strong{
  font-size:1.28rem;
}

.gazetteer-library{
  display:flex;
  flex:1;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
  padding-top:10px;
}

.gazetteer-filter-grid{
  background:#fff;
  border:1px solid var(--hl-line);
  border-radius:6px;
  display:grid;
  gap:10px;
  grid-template-columns:minmax(260px,1.25fr) minmax(220px,1fr) minmax(130px,.62fr) minmax(140px,.68fr) 130px 140px;
  padding:12px;
}

.gazetteer-results-layout{
  display:grid;
  flex:1;
  gap:14px;
  grid-template-columns:minmax(0,1fr) minmax(320px,420px);
  min-height:0;
  overflow:hidden;
}

.gazetteer-library .corpus-result-note{
  margin:6px 0 8px;
}

.gazetteer-results-main{
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
}

.gazetteer-table-wrap{
  flex:1;
  min-height:0;
  overflow:auto;
}

.gazetteer-table{
  min-width:940px;
}

.gazetteer-table th:nth-child(6),
.gazetteer-table th:nth-child(7),
.gazetteer-table td:nth-child(6),
.gazetteer-table td:nth-child(7){
  text-align:right;
}

.gazetteer-place-button{
  appearance:none;
  background:transparent;
  border:0;
  color:var(--hl-blue);
  cursor:pointer;
  font:inherit;
  font-weight:900;
  padding:0;
  text-align:left;
}

.gazetteer-place-button:hover{
  text-decoration:underline;
}

.gazetteer-table tr.is-selected{
  background:#f2f8df;
}

.gazetteer-coord{
  color:var(--hl-muted);
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}

.gazetteer-load-more{
  align-self:center;
  background:#fff;
  border:1px solid var(--hl-blue);
  border-radius:5px;
  color:var(--hl-blue);
  cursor:pointer;
  font:inherit;
  font-size:.84rem;
  font-weight:900;
  margin-top:8px;
  min-height:40px;
  padding:9px 13px;
  text-transform:uppercase;
}

.gazetteer-load-more:hover{
  background:var(--hl-blue);
  color:#fff;
}

.gazetteer-detail{
  background:#fff;
  border:1px solid var(--hl-line);
  border-radius:6px;
  max-height:100%;
  min-height:0;
  overflow:auto;
  padding:16px;
}

.gazetteer-detail h3{
  color:var(--hl-blue);
  font-size:clamp(1.6rem,2.4vw,2.2rem);
  font-weight:900;
  line-height:1.05;
  margin:8px 0 10px;
}

.gazetteer-meta-grid{
  display:grid;
  gap:8px;
  grid-template-columns:1fr 1fr;
  margin:12px 0;
}

.gazetteer-meta{
  border:1px solid var(--hl-line);
  border-radius:5px;
  padding:9px;
}

.gazetteer-meta span{
  color:var(--hl-muted);
  display:block;
  font-size:.72rem;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.gazetteer-meta strong{
  color:var(--hl-text);
  display:block;
  font-size:.95rem;
  margin-top:3px;
  overflow-wrap:anywhere;
}

.gazetteer-detail-title{
  color:var(--hl-blue);
  font-size:.76rem;
  font-weight:900;
  letter-spacing:.24em;
  margin:16px 0 8px;
  text-transform:uppercase;
}

.gazetteer-pill-list{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.gazetteer-pill{
  border:1px solid var(--hl-line);
  border-radius:999px;
  color:var(--hl-text);
  display:inline-flex;
  font-size:.86rem;
  padding:6px 9px;
}

.gazetteer-excerpt{
  color:var(--hl-text);
  font-size:.95rem;
  line-height:1.5;
}

.gazetteer-map-link{
  align-items:center;
  background:var(--hl-green);
  border:1px solid var(--hl-green);
  border-radius:5px;
  color:var(--hl-blue);
  display:inline-flex;
  font-size:.82rem;
  font-weight:900;
  min-height:38px;
  padding:8px 11px;
  text-decoration:none;
  text-transform:uppercase;
}

.corpus-result-note{
  color:var(--hl-muted);
  font-size:.92rem;
  margin:10px 0;
}

.corpus-results-layout{
  display:grid;
  flex:1;
  gap:14px;
  grid-template-columns:minmax(0,1fr) minmax(280px,360px);
  min-height:0;
  overflow:hidden;
}

.corpus-results-main{
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  overflow:hidden;
}

.corpus-table-wrap{
  background:#fff;
  border:1px solid var(--hl-line);
  border-radius:6px;
  flex:1;
  min-height:0;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

.corpus-table{
  border-collapse:collapse;
  font-size:clamp(.88rem, .86vw, .98rem);
  min-width:840px;
  table-layout:fixed;
  width:100%;
}

.corpus-table th,
.corpus-table td{
  border-bottom:1px solid var(--hl-line);
  padding:10px 9px;
  text-align:left;
  vertical-align:top;
}

.corpus-table th{
  background:#fff;
  color:var(--hl-blue);
  font-size:.68rem;
  font-weight:900;
  letter-spacing:.18em;
  position:sticky;
  text-transform:uppercase;
  top:0;
  z-index:1;
}

.corpus-table th:nth-child(1),
.corpus-table td:nth-child(1){
  width:clamp(88px, 8vw, 118px);
}

.corpus-table th:nth-child(3),
.corpus-table td:nth-child(3){
  width:clamp(112px, 12vw, 170px);
}

.corpus-table th:nth-child(4),
.corpus-table td:nth-child(4){
  width:clamp(88px, 8vw, 120px);
}

.corpus-table th:nth-child(5),
.corpus-table td:nth-child(5){
  width:clamp(150px, 16vw, 240px);
}

.corpus-table td:first-child{
  color:var(--hl-blue);
  font-weight:900;
  white-space:nowrap;
}

.corpus-table tr.is-selected{
  background:#f2f8df;
}

.corpus-title{
  color:var(--hl-text);
  font-weight:900;
}

.corpus-title-button{
  appearance:none;
  background:transparent;
  border:0;
  color:var(--hl-blue);
  cursor:pointer;
  display:inline-block;
  font:inherit;
  font-weight:900;
  padding:0;
  text-align:left;
  text-decoration:none;
  overflow-wrap:normal;
  word-break:normal;
}

.corpus-title-button:hover{
  text-decoration:underline;
}

.corpus-subtitle{
  color:var(--hl-muted);
  display:-webkit-box;
  font-size:.82rem;
  line-height:1.35;
  margin-top:4px;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

.corpus-downloads{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  max-width:100%;
  white-space:normal;
}

.corpus-downloads a,
.corpus-downloads button{
  background:#fff;
  border-color:var(--hl-blue);
  color:var(--hl-blue);
  font-size:.72rem;
  min-height:34px;
  padding:7px 8px;
}

.corpus-downloads button{
  border:1px solid var(--hl-blue);
}

.corpus-downloads .pdf{
  background:var(--hl-blue);
  color:#fff;
}

.corpus-preview{
  background:#fff;
  border:1px solid var(--hl-line);
  border-left:5px solid var(--hl-green);
  border-radius:6px;
  display:flex;
  flex-direction:column;
  max-height:100%;
  min-height:0;
  min-width:0;
  overflow:hidden;
}

.corpus-preview > p,
.corpus-preview > h3{
  margin-left:16px;
  margin-right:16px;
}

.corpus-preview > .eyebrow{
  margin-top:16px;
}

.corpus-preview h3{
  color:var(--hl-blue);
  font-size:clamp(1.55rem,2.2vw,2.25rem);
  font-weight:900;
  line-height:1.05;
  margin-bottom:8px;
  margin-top:8px;
}

.corpus-preview-head{
  border-bottom:1px solid var(--hl-line);
  padding:16px;
}

.corpus-preview-head .eyebrow{
  color:var(--hl-green);
  margin:0 0 8px;
}

.corpus-preview-subtitle{
  color:var(--hl-muted);
  font-size:.98rem;
  line-height:1.35;
  margin:0 0 12px;
}

.corpus-preview-meta,
.corpus-preview-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.corpus-preview-meta span{
  border:1px solid var(--hl-line);
  border-radius:999px;
  color:var(--hl-muted);
  font-size:.78rem;
  font-weight:800;
  padding:5px 8px;
}

.corpus-preview-actions{
  margin-top:12px;
}

.corpus-preview-actions a,
.corpus-preview-actions button{
  align-items:center;
  background:#fff;
  border:1px solid var(--hl-blue);
  border-radius:5px;
  color:var(--hl-blue);
  cursor:pointer;
  display:inline-flex;
  font:inherit;
  font-size:.78rem;
  font-weight:900;
  min-height:34px;
  padding:7px 10px;
  text-decoration:none;
  text-transform:uppercase;
}

.corpus-preview-actions button{
  background:var(--hl-green);
  border-color:var(--hl-green);
}

.corpus-preview-actions a.pdf,
.corpus-preview-actions button.pdf{
  background:var(--hl-blue);
  color:#fff;
}

.corpus-preview-text{
  color:var(--hl-text);
  flex:1;
  font-size:.98rem;
  line-height:1.7;
  overflow:auto;
  padding:16px;
  text-align:justify;
}

.corpus-preview-text p{
  margin:0 0 1em;
}

body.corpus-drawer-open,
body.gazetteer-drawer-open{
  overflow:hidden;
}

@media (max-width: 1100px){
  .corpus-drawer{
    overflow-x:hidden;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }

  .corpus-library{
    flex:0 0 auto;
    min-height:auto;
    overflow:visible;
  }

  .corpus-results-layout{
    flex:0 0 auto;
    grid-template-columns:1fr;
    min-height:auto;
    overflow:visible;
    padding-right:4px;
  }

  .corpus-results-main{
    flex:0 0 auto;
    min-height:0;
    overflow:visible;
  }

  .corpus-table-wrap{
    flex:0 0 auto;
    max-height:min(48vh, 560px);
  }

  .corpus-preview{
    flex:0 0 auto;
    max-height:none;
    min-height:auto;
    overflow:visible;
  }

  .corpus-preview-text{
    flex:0 0 auto;
    max-height:min(44vh, 520px);
  }
}

@media (max-width: 760px){
  .corpus-drawer{
    padding:16px;
    width:100vw;
  }

  .corpus-drawer-head{
    flex-direction:column;
  }

  .corpus-filter-grid,
  .gazetteer-filter-grid,
  .corpus-drawer-stats,
  .corpus-results-layout{
    grid-template-columns:1fr;
  }

  .corpus-table{
    min-width:760px;
  }

  .corpus-actions{
    align-items:stretch;
    flex-direction:column;
  }

  .gazetteer-results-layout{
    grid-template-columns:1fr;
  }

  .gazetteer-detail{
    max-height:none;
  }
}

.method-panel code{
  border:1px solid rgba(0,52,120,.12);
  border-radius:4px;
  background:#f6f8fb;
  color:var(--hl-blue);
  font-size:.9em;
  padding:2px 5px;
  overflow-wrap:anywhere;
}

.method-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:26px 0;
}

.method-kpi{
  border:1px solid var(--hl-line);
  border-left:5px solid var(--hl-green);
  border-radius:8px;
  background:var(--hl-soft);
  padding:18px;
}

.method-kpi strong{
  display:block;
  color:var(--hl-blue);
  font-size:clamp(2rem, 3vw, 3rem);
  font-weight:900;
  line-height:1;
}

.method-kpi span{
  display:block;
  margin-top:10px;
  color:var(--hl-text);
  font-size:.95rem;
  line-height:1.45;
}

.method-grid.method-grid-detailed{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:22px;
}

.method-card,
.method-output{
  background:#fff;
  border:1px solid var(--hl-line);
  border-radius:8px;
  color:var(--hl-text);
  overflow-wrap:anywhere;
}

.method-card{
  padding:20px;
}

.method-card h3,
.method-output h3,
.method-step h3{
  color:var(--hl-blue);
  font-size:1.08rem;
  line-height:1.2;
  margin:0 0 10px;
}

.method-card p,
.method-output p,
.method-step p{
  color:var(--hl-text);
  line-height:1.62;
  margin:0;
}

.method-sequence{
  counter-reset:method-step;
  display:grid;
  gap:14px;
  margin-top:28px;
}

.method-step{
  display:grid;
  grid-template-columns:44px minmax(0,1fr);
  gap:0 14px;
  border-top:1px solid var(--hl-line);
  padding-top:18px;
}

.method-step::before{
  align-items:center;
  background:var(--hl-green);
  border-radius:999px;
  color:var(--hl-blue);
  content:counter(method-step);
  counter-increment:method-step;
  display:flex;
  font-weight:900;
  grid-row:1 / span 2;
  height:36px;
  justify-content:center;
  width:36px;
}

.method-output-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-top:28px;
}

.method-output{
  background:var(--hl-soft);
  padding:18px;
}

@media (max-width: 1180px){
  .method-kpis,
  .method-output-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 780px){
  .method-grid.method-grid-detailed,
  .method-kpis,
  .method-output-grid{
    grid-template-columns:1fr;
  }

  .method-panel h2{
    font-size:2.25rem;
  }

  .method-step{
    grid-template-columns:38px minmax(0,1fr);
  }
}

/* Expo embedded view */
#expo.section.active{
  display:block;
}

.expo-section-compact{
  background:transparent;
  border:0;
  box-shadow:none;
  padding:0;
}

.expo-section-head{
  background:#fff;
  border:1px solid var(--hl-line);
  border-bottom:4px solid var(--hl-green);
  border-radius:8px 8px 0 0;
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:end;
  gap:18px;
  margin-bottom:0;
  padding:clamp(18px, 3vw, 30px);
}

body:has(#expo.section.active) .main-stack{
  padding-block:clamp(8px, 1.2vh, 14px);
}

body:has(#expo.section.active) .expo-section-head{
  align-items:center;
  gap:16px;
  padding:clamp(10px, 1.4vw, 16px) clamp(14px, 2vw, 22px);
}

.expo-section-head h2{
  color:var(--hl-blue);
  font-size:clamp(2rem, 4vw, 4.1rem);
  font-weight:900;
}

body:has(#expo.section.active) .expo-section-head h2{
  font-size:clamp(1.65rem, 2.2vw, 2.4rem);
}

.expo-intro{
  max-width:700px;
  color:var(--hl-text);
}

body:has(#expo.section.active) .expo-intro{
  max-width:760px;
  font-size:clamp(.92rem, 1.05vw, 1rem);
  line-height:1.25;
  margin-top:4px;
}

.expo-integrated-actions.compact{
  align-items:center;
}

body:has(#expo.section.active) .expo-integrated-actions.compact{
  flex-wrap:nowrap;
  justify-content:flex-end;
}

body:has(#expo.section.active) .expo-integrated-actions.compact .primary-btn,
body:has(#expo.section.active) .expo-integrated-actions.compact .secondary-btn{
  min-height:44px;
  padding:12px 16px;
  white-space:nowrap;
}

.expo-embed-shell{
  position:relative;
  background:var(--hl-blue);
  border:0;
  border-radius:0 0 8px 8px;
  overflow:hidden;
  padding:0;
}

.expo-fullscreen-exit{
  display:none;
  position:absolute;
  top:16px;
  right:16px;
  z-index:2;
  min-height:42px;
  border:1px solid rgba(255,255,255,.5);
  border-radius:4px;
  background:#fff;
  color:var(--hl-blue);
  cursor:pointer;
  font:700 .8rem/1 "Work Sans", sans-serif;
  padding:12px 16px;
  text-transform:uppercase;
}

.expo-frame-compact{
  display:block;
  width:100%;
  height:clamp(540px, 74svh, 860px);
  min-height:0;
  border:0;
  border-radius:0;
  background:var(--hl-blue);
}

.expo-embed-shell:fullscreen{
  width:100vw;
  height:100vh;
  border-radius:0;
  background:var(--hl-blue);
}

.expo-embed-shell:fullscreen .expo-fullscreen-exit,
.expo-embed-shell.is-fullscreen-fallback .expo-fullscreen-exit{
  display:block;
}

.expo-embed-shell:fullscreen .expo-frame-compact,
.expo-embed-shell.is-fullscreen-fallback .expo-frame-compact{
  width:100vw;
  height:100dvh;
}

.expo-embed-shell.is-fullscreen-fallback{
  position:fixed;
  inset:0;
  z-index:9999;
  width:100vw;
  height:100dvh;
  border-radius:0;
  background:var(--hl-blue);
}

body.expo-frame-expanded{
  overflow:hidden;
}

.expo-stage,
.expo-word-wrap,
.halo,
.halo-a,
.halo-b{
  background-image:none;
}

.halo,
.glow{
  display:none;
}

.expo-word{
  overflow-wrap:anywhere;
}

@media (max-width: 980px){
  .header-grid{
    grid-template-columns:1fr;
    align-items:start;
  }

  .nav{
    justify-content:flex-start;
  }

  .expo-section-head{
    grid-template-columns:1fr;
    align-items:start;
    gap:12px;
  }

  body:has(#expo.section.active) .expo-section-head{
    padding:12px;
  }

  body:has(#expo.section.active) .expo-section-head h2{
    font-size:clamp(1.7rem, 5vw, 2.15rem);
  }

  body:has(#expo.section.active) .expo-intro{
    font-size:.9rem;
    line-height:1.2;
  }

  body:has(#expo.section.active) .expo-integrated-actions.compact{
    flex-wrap:wrap;
    justify-content:flex-start;
  }

  .expo-frame-compact{
    height:clamp(520px, 72svh, 740px);
  }

  .hero-grid,
  .corpus-story-panel,
  .reader-layout,
  .reader-grid,
  .word-dashboard,
  .word-results-grid,
  .theme-stage,
  .theme-bottom,
  .map-context-row,
  .method-grid{
    grid-template-columns:1fr;
  }

  .reader-sidebar{
    position:static;
    height:auto;
    overflow:visible;
  }

  .article-list{
    max-height:min(58vh, 560px);
  }

  .article-text-wrap,
  .article-side{
    max-height:min(68vh, 680px);
  }
}

@media (max-width: 780px){
  body{
    font-size:16px;
  }

  .wrap{
    padding-inline:16px;
  }

  .site-header{
    position:relative;
  }

  .header-grid{
    padding-block:12px;
  }

  body:has(#expo.section.active) .header-grid{
    padding-block:8px;
  }

  .brand-col{
    display:grid;
    grid-template-columns:42px minmax(0,1fr);
    grid-template-areas:
      "logo eyebrow"
      "logo title";
    column-gap:10px;
  }

  .brand-col h1{
    font-size:2.05rem;
    white-space:normal;
  }

  body:has(#expo.section.active) .brand-col h1{
    font-size:clamp(1.45rem, 7vw, 1.85rem);
  }

  .heritage-logo{
    width:42px;
    height:42px;
  }

  body:has(#expo.section.active) .heritage-logo{
    width:36px;
    height:36px;
  }

  .header-copy{
    display:none;
  }

  .nav{
    display:flex;
    flex-wrap:nowrap;
    justify-content:flex-start;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    padding-bottom:4px;
    width:100%;
  }

  .nav button,
  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .theme-tab,
  button.chip{
    width:100%;
    min-height:46px;
    padding:14px 12px;
    white-space:normal;
  }

  .nav button{
    flex:0 0 auto;
    width:auto;
    min-width:max-content;
    white-space:nowrap;
  }

  body:has(#expo.section.active) .nav button{
    min-height:36px;
    padding:9px 10px;
    font-size:.68rem;
  }

  .panel{
    padding:20px;
  }

  .stats,
  .corpus-story-facts,
  .metric-grid,
  .metric-grid.compact,
  .collocation-grid,
  .word-controls{
    grid-template-columns:1fr;
  }

  .corpus-image-grid{
    grid-template-columns:1fr;
  }

  .corpus-story-copy p{
    text-align:left;
  }

  .hero-panel h2,
  .map-topline h2,
  .reader-hero h2{
    font-size:2.25rem;
  }

  .expo-section-head{
    border-radius:8px 8px 0 0;
  }

  .expo-section-compact{
    padding:0;
  }

  .expo-integrated-actions.compact{
    display:flex;
    gap:8px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    width:100%;
  }

  body:has(#expo.section.active) .expo-intro{
    display:none;
  }

  body:has(#expo.section.active) .expo-section-head h2{
    font-size:clamp(1.65rem, 8vw, 2.25rem);
  }

  body:has(#expo.section.active) .expo-integrated-actions.compact .primary-btn,
  body:has(#expo.section.active) .expo-integrated-actions.compact .secondary-btn{
    flex:0 0 auto;
    width:auto;
    min-height:38px;
    padding:9px 12px;
    font-size:.72rem;
    white-space:nowrap;
  }

  .expo-frame-compact{
    height:clamp(500px, 70svh, 660px);
  }

  .atlas-frame.tall{
    height:68vh;
    min-height:540px;
  }
}

@media (max-width: 460px){
  .wrap{
    padding-inline:10px;
  }

  .main-stack{
    padding-block:14px;
  }

  .nav{
    gap:6px;
  }

  .panel{
    padding:18px;
  }

  .expo-section-head{
    padding:18px;
  }

  .expo-section-compact{
    padding:0;
  }

  .expo-frame-compact{
    height:clamp(500px, 70svh, 620px);
  }
}

@media (max-height: 760px){
  body:has(#expo.section.active) .main-stack{
    padding-block:8px;
  }

  body:has(#expo.section.active) .expo-section-head{
    padding:10px 12px;
  }

  body:has(#expo.section.active) .expo-intro{
    display:none;
  }

  .expo-frame-compact{
    height:clamp(480px, 74svh, 620px);
  }
}
