/* Lilac researcher homepage; statistics and tool wiring remain server-backed. */
#home-intro.hero {
 --home-art:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 500 290%22 fill=%22none%22%3E%0A%3Cdefs%3E%3ClinearGradient id=%22paper%22 x2=%220%22 y2=%221%22 gradientUnits=%22objectBoundingBox%22%3E%3Cstop stop-color=%22%23fff%22/%3E%3Cstop offset=%221%22 stop-color=%22%23faf5ff%22/%3E%3C/linearGradient%3E%3Cfilter id=%22shadow%22 x=%22-.35%22 width=%221.7%22 y=%22-.35%22 height=%221.75%22%3E%3CfeDropShadow dx=%220%22 dy=%2210%22 stdDeviation=%2213%22 flood-color=%22%234c2c7a%22 flood-opacity=%22.22%22/%3E%3C/filter%3E%3ClinearGradient id=%22lens%22%3E%3Cstop stop-color=%22%23f4e9ff%22/%3E%3Cstop offset=%221%22 stop-color=%22%23e1cbff%22/%3E%3C/linearGradient%3E%3C/defs%3E%0A%3Cg fill=%22%23bc9fe3%22 opacity=%22.65%22%3E%3Cpath d=%22M23 40h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2zm-42 14h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2zm-42 14h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2zm14 0h2v2h-2z%22/%3E%3C/g%3E%0A%3Cg transform=%22rotate(-15 145 150)%22 filter=%22url(%23shadow)%22%3E%3Crect x=%2270%22 y=%2256%22 width=%22204%22 height=%22184%22 rx=%2221%22 fill=%22url(%23paper)%22 stroke=%22%23e7d6fa%22 stroke-width=%222%22/%3E%3Crect x=%2282%22 y=%2269%22 width=%22178%22 height=%2248%22 rx=%2214%22 fill=%22%23ead9f8%22/%3E%3Cpath d=%22M98 145h140M98 164h132M98 183h133%22 stroke=%22%23ddc9ef%22 stroke-width=%226%22 stroke-linecap=%22round%22/%3E%3C/g%3E%0A%3Cg transform=%22rotate(13 335 148)%22 filter=%22url(%23shadow)%22%3E%3Crect x=%22215%22 y=%2244%22 width=%22202%22 height=%22189%22 rx=%2222%22 fill=%22url(%23paper)%22 stroke=%22%23e7d6fa%22 stroke-width=%222%22/%3E%3Crect x=%22226%22 y=%2255%22 width=%22179%22 height=%2250%22 rx=%2215%22 fill=%22%23e9ddfb%22/%3E%3Cpath d=%22M239 139h143M239 159h132M239 180h127%22 stroke=%22%23ded0f3%22 stroke-width=%226%22 stroke-linecap=%22round%22/%3E%3C/g%3E%0A%3Cg transform=%22rotate(4 250 150)%22 filter=%22url(%23shadow)%22%3E%3Crect x=%22139%22 y=%2255%22 width=%22227%22 height=%22194%22 rx=%2222%22 fill=%22white%22 stroke=%22%23e5d2fb%22 stroke-width=%222%22/%3E%3Crect x=%22154%22 y=%2268%22 width=%22198%22 height=%2247%22 rx=%2213%22 fill=%22%23ebdbff%22/%3E%3Ctext x=%22330%22 y=%2297%22 direction=%22rtl%22 text-anchor=%22start%22 fill=%22%236135af%22 font-family=%22system-ui,sans-serif%22 font-size=%2216%22 font-weight=%22bold%22%3E%D8%A7%D9%84%D8%B4%D9%88%D8%A7%D9%87%D8%AF%3C/text%3E%3Crect x=%22155%22 y=%22130%22 width=%22194%22 height=%2222%22 rx=%226%22 fill=%22%23f6f1fa%22/%3E%3Crect x=%22155%22 y=%22160%22 width=%22194%22 height=%2222%22 rx=%226%22 fill=%22%23eee2fc%22/%3E%3Crect x=%22155%22 y=%22190%22 width=%22194%22 height=%2222%22 rx=%226%22 fill=%22%23f6f1fa%22/%3E%3Cpath d=%22M169 141h25m17 0h29m18 0h25m-114 30h25m64 0h25m-114 30h25m17 0h29m18 0h25%22 stroke=%22%23ccc0de%22 stroke-width=%224%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M212 171h23%22 stroke=%22%239b65e4%22 stroke-width=%224%22 stroke-linecap=%22round%22/%3E%3C/g%3E%0A%3Cpath d=%22m377 193 28 28%22 stroke=%22%237943ca%22 stroke-width=%2210%22 stroke-linecap=%22round%22/%3E%3Ccircle cx=%22351%22 cy=%22167%22 r=%2235%22 fill=%22url(%23lens)%22 fill-opacity=%22.8%22 stroke=%22%237943ca%22 stroke-width=%225%22/%3E%3Ccircle cx=%22351%22 cy=%22167%22 r=%2224%22 stroke=%22%239d68e7%22 stroke-width=%222.4%22/%3E%0A%3C/svg%3E");
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #263c5c;
  border-radius: clamp(18px, 4vw, 26px);
  margin-block: clamp(.65rem, 2vw, 1.4rem) clamp(1.05rem, 3vw, 1.75rem);
  padding: clamp(1.05rem, 3.4vw, 2.85rem);
  min-block-size: clamp(10.7rem, 23vw, 18rem);
  color: #fff;
  background: radial-gradient(ellipse at 16% 62%, #255094 0%, #1b345a 35%, transparent 68%),
    linear-gradient(130deg, var(--ds-navy, #0f172a), #142541 54%, #1e3a5f);
  box-shadow: 0 10px 28px #0f172a21;
}
#home-intro.hero::before {
  position: absolute;
  z-index: -1;
  content: "";
  inset-block: 2% 1%;
  inset-inline-end: 0;
  inline-size: 43%;
  background: var(--home-art) center / contain no-repeat;
  pointer-events: none;
}
#home-intro.hero :is(.home-hero-heading, .project-subtitle, p:not(.kicker):not(.notice)) {
  max-inline-size: min(50ch, 61%);
}
#home-intro.hero .home-hero-heading {
  display: block;
  margin-block-end: .2rem;
}
#home-intro.hero .kicker {
  display: inline-block;
  margin: 0 0 .32rem;
  color: #d7eaff;
  font-size: clamp(.69rem, 2.5vw, .92rem);
  font-weight: 700;
  line-height: 1.55;
}
#home-intro.hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.8rem, 6vw, 3.3rem);
  line-height: 1.24;
}
#home-intro.hero .project-subtitle {
  color: #e4effc;
  font-size: clamp(.91rem, 3.25vw, 1.58rem);
  font-weight: 700;
  line-height: 1.48;
  margin: 0 0 .45rem;
}
#home-intro.hero p:not(.kicker):not(.project-subtitle):not(.notice) {
  font-size: clamp(.78rem, 2.55vw, 1rem);
  color: #d4e3f5;
  line-height: 1.7;
  margin-block-end: 0;
}
body:not(.in-tool) :is(.tools-header, :is(#home-corpora,#home-modern-corpora) > .section-head) {
  align-items: center;
  margin-block: .6rem .75rem;
}
body:not(.in-tool) :is(#tools-title, #corpora-title) {
  margin: 0;
  color: var(--ds-navy, #0f172a);
  font-size: clamp(1.13rem, 3.8vw, 1.66rem);
  line-height: 1.4;
}
body:not(.in-tool) #tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: clamp(.5rem, 1.6vw, .85rem);
  margin-block-end: clamp(1.15rem, 4vw, 2.2rem);
}
body:not(.in-tool) #tools > .tool-with-help {
  --home-accent: var(--ds-blue, #2563eb);
  --home-dark: #1645b6;
}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="coll"] { --home-accent: var(--ds-green, #059669); --home-dark: #047857; }
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="ng"] { --home-accent: var(--ds-purple, #7c3aed); --home-dark: #5b21b6; }
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="list"] { --home-accent: var(--ds-amber, #d97706); --home-dark: #9a4508; }
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="morph"] { --home-accent: var(--ds-pink, #be185d); --home-dark: #9d174d; }
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="research"] { --home-accent: var(--ds-cyan, #0891b2); --home-dark: #0e6178; }
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="post"] { --home-accent: #6d28d9; --home-dark: #4c1d95; grid-column: span 2; }
body:not(.in-tool) #tools .tool-tile {
  color: var(--ds-navy, #0f172a);
  background: linear-gradient(135deg,#fff,#f7fafd);
  border: 1px solid #d8e1ed;
  border-radius: 16px;
  box-shadow: 0 3px 10px #0f172a0e;
  padding: .56rem .56rem .56rem .56rem;
  padding-inline-end: 2.3rem;
  min-block-size: 60px;
  gap: .56rem;
  font-size: clamp(.8rem, 2.65vw, 1rem);
  line-height: 1.35;
}
body:not(.in-tool) #tools .tool-tile:hover { border-color: var(--home-accent); }
body:not(.in-tool) #tools .tool-tile span { min-inline-size: 0; overflow-wrap: anywhere; }
body:not(.in-tool) #tools .tool-tile svg {
  flex: 0 0 auto;
  display: block;
  box-sizing: border-box;
  color: #fff;
  inline-size: clamp(1.75rem, 8.7vw, 2.55rem);
  block-size: clamp(1.75rem, 8.7vw, 2.55rem);
  padding: clamp(.31rem, 1.6vw, .48rem);
  border-radius: 10px;
  background: linear-gradient(145deg,var(--home-accent),var(--home-dark));
  box-shadow: inset 0 1px 0 #ffffff42, 0 2px 6px #0f172a24;
}
body:not(.in-tool) #tools .help-mark {
  inset-inline-end: .07rem;
  inset-block-start: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  inline-size: 2rem;
  block-size: 2.75rem;
  min-block-size: 0;
  padding: 0;
  color: #263a53;
  background: radial-gradient(circle at center,#edf3fa 0 8px,#d8e5f3 8px 9px,transparent 9px);
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}
body:not(.in-tool) #tools .help-mark:hover { color: var(--home-dark); }
body:not(.in-tool) #tools :is(.tool-tile,.help-mark):focus-visible {
  outline: 2px solid var(--home-dark);
  outline-offset: 1px;
}
:is(#home-corpora,#home-modern-corpora) > .section-head { gap: .4rem .6rem; flex-wrap: wrap; }
:is(#home-corpora,#home-modern-corpora) > .section-head > span {
  display: inline-block;
  padding: .2rem .58rem;
  border: 1px solid #d9e3ee;
  border-radius: 999px;
  background: #fff;
  color: #374a65;
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card {
  --home-stage: var(--ds-blue, #2563eb);
  --home-stage-dark: #1b4297;
  --home-stage-tint: #eef4ff;
  --home-stage-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5c4-1 7 0 9 2 2-2 5-3 9-2v13c-4-1-7 0-9 2-2-2-5-3-9-2zm9 2v13'/%3E%3C/svg%3E");
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d7e1ed;
  border-radius: 18px;
  box-shadow: 0 4px 14px #0f172a12;
  display: flex;
  flex-direction: column;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card[data-stage="middle"] {
  --home-stage: var(--ds-green, #059669);
  --home-stage-dark: #06614b;
  --home-stage-tint: #eaf9f3;
  --home-stage-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='m3 9 9-5 9 5-9 5zm4 2.3v5.2c3.4 2 6.6 2 10 0v-5.2M21 9v7'/%3E%3C/svg%3E");
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card[data-stage="secondary"] {
  --home-stage: var(--ds-amber, #d97706);
  --home-stage-dark: #855005;
  --home-stage-tint: #fff6e8;
  --home-stage-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.65' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M3 9h18L12 4zM5 20h14M4 18h16M7 9v9m5-9v9m5-9v9'/%3E%3C/svg%3E");
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3 {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-block-size: 3.65rem;
  padding: .67rem .88rem;
  gap: .5rem;
  background: linear-gradient(115deg,var(--home-stage-dark) 35%,var(--home-stage));
  color: #fff;
  font-size: 1.17rem;
  line-height: 1.45;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3::before,
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3::after {
  content: "";
  display: block;
  background: currentColor;
  -webkit-mask: var(--home-stage-icon) center / contain no-repeat;
  mask: var(--home-stage-icon) center / contain no-repeat;
  pointer-events: none;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3::before { inline-size: 1.5rem; block-size: 1.5rem; flex: none; }
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3::after {
  position: absolute;
  z-index: -1;
  inset-inline-end: .55rem;
  inset-block-end: -1.5rem;
  inline-size: 6.4rem;
  block-size: 6.4rem;
  transform: rotate(-13deg);
  opacity: .17;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card {
  margin: .65rem .65rem .65rem;
  gap: .48rem;
  min-inline-size: 0;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card > div {
  min-inline-size: 0;
  display: grid;
  align-content: start;
  gap: .16rem;
  background: var(--home-stage-tint);
  border: 1px solid #0f172a13;
  border-radius: 12px;
  padding: .47rem;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dt {
  color: #334155;
  font-weight: 650;
  font-size: .82rem;
  line-height: 1.5;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dd {
  min-inline-size: 0;
  color: var(--ds-navy, #0f172a);
  font-weight: 800;
  font-size: clamp(.87rem, 3.2vw, 1.28rem);
  line-height: 1.36;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > p { margin: 0 .85rem .5rem; }
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > p.hint:empty { display: none; }
:is(#historic-corpus-cards,#modern-corpus-cards) .historic-open {
  min-block-size: 44px;
  margin: auto .65rem .65rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(120deg,var(--home-stage-dark) 55%,var(--home-stage));
}
:is(#historic-corpus-cards,#modern-corpus-cards) .historic-open:hover { background: var(--home-stage-dark); }
:is(#historic-corpus-cards,#modern-corpus-cards) .historic-open:focus-visible { outline: 2px solid var(--home-stage-dark); outline-offset: 2px; }
@media (max-width: 720px) {
  body:not(.in-tool) #tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
  :is(#historic-corpus-cards,#modern-corpus-cards) { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 360px) {
  #home-intro.hero { padding-inline: .88rem; }
  #home-intro.hero::before { inset-inline: auto -.6rem; }
  body:not(.in-tool) #tools .tool-tile { gap: .3rem; padding-inline: .36rem 1.73rem; }
  body:not(.in-tool) #tools .help-mark { inline-size: 1.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.in-tool) #tools :is(.tool-tile,.help-mark),
  :is(#historic-corpus-cards,#modern-corpus-cards) .historic-open { transition: none; }
}

/* Approved violet homepage. */
body.shawahed-design:has(#home-intro):not(.in-tool) {
  --ds-page:#fbfafd; --ds-navy:#1c1539; --ds-ink:#1c1539;
  --ds-line:#eae4f2; --ds-accent:#6937cc; --ds-accent-text:#5e2eb5;
  --ds-tint:#f3ebff; --ds-muted:#625970;
}
#home-intro.hero {
  min-block-size:clamp(16rem,24vw,21rem);border-color:transparent;box-shadow:none;color:#1c1539;
  background:radial-gradient(ellipse at -11% 112%, transparent 55%, #bfa9e959 55.2%, transparent 55.55%,transparent 62%,#bfa9e959 62.2%,transparent 62.55%) left / 63% 100% no-repeat,
             radial-gradient(ellipse at 8% 39%,#e9d9ff 0%,#eee2fc 34%,transparent 69%),
             linear-gradient(112deg,#ece0fe,#f9f6fd 90%);
}
#home-intro.hero::before {inline-size:49%;inset-block:3% 0}
#home-intro.hero .kicker {color:#6334ab}
#home-intro.hero h1 {color:#6533be;font-size:clamp(2.15rem,6vw,4.7rem);line-height:1.14}
#home-intro.hero .project-subtitle {color:#1c1539;font-size:clamp(1.03rem,3vw,2rem)}
#home-intro.hero p:not(.kicker):not(.project-subtitle):not(.notice) {color:#51485f;font-size:clamp(.81rem,1.6vw,1rem)}
.violet-hero-actions {display:flex;gap:.6rem;flex-wrap:wrap;margin-block-start:1rem;max-inline-size:56%}
.violet-hero-actions a {display:inline-flex;align-items:center;justify-content:space-between;gap:.65rem;min-block-size:44px;padding:.4rem .85rem;border:1px solid #e5d8f5;border-radius:12px;background:#fff;color:#5d2ab7;font-size:.89rem;font-weight:750;text-decoration:none}
.violet-hero-actions .violet-start {background:linear-gradient(135deg,#8547e8,#642cbd);color:white;border-color:transparent}
.violet-hero-actions a:hover {box-shadow:0 2px 9px #6c38aa26}
.violet-guide-link {min-height:44px;padding:.18rem .32rem;border:0;background:transparent;color:#6334ab;font-weight:750;box-shadow:none}
.violet-guide-link span {margin-inline-start:.3rem}
body:not(.in-tool) #tools > .tool-with-help {--home-accent:#ede3ff;--home-dark:#6635b6}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="coll"] {--home-accent:#e9effd;--home-dark:#3f59a9}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="ng"] {--home-accent:#f0e3fb;--home-dark:#873abd}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="list"] {--home-accent:#f4eafe;--home-dark:#7343bf}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="morph"] {--home-accent:#f9e9f4;--home-dark:#a34784}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="research"] {--home-accent:#e7f0fb;--home-dark:#42659f}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="post"] {--home-accent:#ece6fb;--home-dark:#6240a4;grid-column:auto}
body:not(.in-tool) #tools .tool-tile {background:#fff;border-color:#eae4f2;box-shadow:none}
body:not(.in-tool) #tools .tool-tile svg {background:var(--home-accent);color:var(--home-dark);box-shadow:none}
body:not(.in-tool) #tools .tool-tile:hover {border-color:var(--home-dark)}
body:not(.in-tool) #tools .help-mark {color:#5e2eb5;background:radial-gradient(circle at center,#f5effc 0 8px,#eae0f9 8px 9px,transparent 9px)}
:is(#home-corpora,#home-modern-corpora) > .section-head > span {background:#f2eafc;color:#6334ab;border-color:transparent}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card {--home-stage:#efe4ff;--home-stage-dark:#6231af;--home-stage-tint:#faf7fd;border-color:#eae4f2;box-shadow:none;container-type:inline-size}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card[data-stage="middle"] {--home-stage:#ebe5ff;--home-stage-dark:#563e9d;--home-stage-tint:#f8f6fd}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card[data-stage="secondary"] {--home-stage:#f1e2f8;--home-stage-dark:#78429d;--home-stage-tint:#faf6fc}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3 {margin:.55rem .55rem 0;border-radius:12px;color:var(--home-stage-dark);background:linear-gradient(110deg,var(--home-stage),var(--home-stage-tint))}
:is(#historic-corpus-cards,#modern-corpus-cards) .corpus-card > h3::after {display:none}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card > div {border:0;gap:.14rem;padding:.48rem .52rem;align-content:start}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dt {grid-row:2;color:#625970;font-weight:500;font-size:.78rem}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dd {grid-row:1;color:var(--home-stage-dark);font-variant-numeric:tabular-nums;overflow-wrap:normal}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dd bdi {font-family:system-ui,sans-serif;font-weight:650;font-size:clamp(1rem,6cqi,1.62rem);line-height:1.3;direction:ltr;unicode-bidi:isolate;display:inline-block;max-inline-size:100%}
:is(#historic-corpus-cards,#modern-corpus-cards) .stats-card dd bdi[data-primary-count] {white-space:normal}
:is(#historic-corpus-cards,#modern-corpus-cards) .historic-open {background:#f2ebfe;color:var(--home-stage-dark);font-weight:750}
:is(#historic-corpus-cards,#modern-corpus-cards) .historic-open:hover {background:var(--home-stage);color:var(--home-stage-dark)}
@media(max-width:760px) {
  #home-intro.hero :is(.home-hero-heading,.project-subtitle,p:not(.kicker):not(.notice)) {max-inline-size:66%}
  .violet-hero-actions {max-inline-size:100%}
  body:not(.in-tool) #tools > .tool-with-help[data-tool-key="post"] {grid-column:span 2}
}
@media(max-width:440px) {
 #home-intro.hero :is(.home-hero-heading,.project-subtitle,p:not(.kicker):not(.notice)) {max-inline-size:100%}
}
@media (max-width:580px) {
 #home-intro.hero {min-block-size:0;padding-block-end:clamp(3.5rem,15vw,4.75rem)}
 #home-intro.hero::before {inset-block:auto -.1rem;inset-inline:0;inline-size:100%;block-size:clamp(3.4rem,15vw,4.7rem)}
 #home-intro.hero :is(.home-hero-heading,.project-subtitle,p:not(.kicker):not(.notice)) {max-inline-size:100%}
}

body.shawahed-design:has(#home-intro) .app-bottom-nav {display:none}
body.shawahed-design:has(#home-intro) {padding-block-end:env(safe-area-inset-bottom,0px);scroll-padding-block-end:0}

/* Vector wordmark first in RTL, with the institutional label beside it. */
#home-intro.hero .home-hero-heading {
 display:flex;flex-wrap:nowrap;align-items:center;gap:clamp(.52rem,1.5vw,1.3rem);
 margin-block:.02rem .7rem;max-inline-size:63%;width:max-content;
}
#home-intro.hero .home-hero-heading h1 {
 inline-size:clamp(7.45rem,18.5vw,15.5rem);flex:0 1 auto;min-inline-size:0;line-height:1;
}
#home-intro.hero .shawahed-wordmark {display:block;inline-size:100%;block-size:auto;overflow:visible}
#home-intro.hero .home-hero-heading .kicker {
 margin:0;flex:0 1 auto;min-inline-size:0;max-inline-size:13em;
 padding-inline-start:clamp(.48rem,1.4vw,1.1rem);border-inline-start:1px solid #b99be3;
 font-size:clamp(.76rem,1.58vw,1.14rem);line-height:1.45;text-wrap:balance;
}
#home-intro.hero .home-hero-heading:not(:has(.kicker)) h1 {inline-size:clamp(8rem,20vw,15.5rem)}
@media(max-width:580px) {
 #home-intro.hero .home-hero-heading {max-inline-size:100%;margin-block-end:.55rem}
 #home-intro.hero .home-hero-heading h1 {inline-size:clamp(7.2rem,37vw,11rem)}
 #home-intro.hero .home-hero-heading .kicker {font-size:clamp(.75rem,3.25vw,.98rem)}
}

/* The two research cards share a row on mobile as well as desktop. */
body:not(.in-tool) #tools:has(.research-topics-tile) > .tool-with-help[data-tool-key="post"] {grid-column:auto}
body:not(.in-tool) #tools .research-topics-tile {--home-accent:#eee7fb;--home-dark:#5e34a5}
body:not(.in-tool) #tools .research-topics-link {display:flex;align-items:center;height:100%;text-decoration:none;padding-inline-end:.55rem}
body:not(.in-tool) #tools .research-topics-link {
 color:#27143f;background:#f2eafb;border-color:#e5d8f5;font-weight:800;
}
body:not(.in-tool) #tools .research-topics-link:hover {background:#ece0f8;border-color:#8158bc}

/* Research activity replaces the decorative artwork within the signed-in hero. */
body #home-intro.hero:has(#home-usage)::before{display:none;}
body #home-intro.hero:has(#home-usage){min-block-size:0;padding-block-end:clamp(.9rem,2.5vw,1.85rem);}
body #home-intro.hero:has(#home-usage) :is(.home-hero-heading,.project-subtitle,p:not(.kicker):not(.notice)){max-inline-size:100%;}
#home-usage{position:relative;margin-block-start:.8rem;max-inline-size:40rem;}
#home-intro.hero #home-usage>[data-usage-status]{margin:.32rem 0 0;color:#57446a;font-size:.78rem;}
#home-usage [data-metric-row]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:stretch;gap:clamp(.2rem,1.35vw,.6rem)}
#home-usage article{min-width:0;display:grid;grid-template-rows:1fr auto;align-items:center;gap:.25rem;padding:clamp(.32rem,1.5vw,.65rem) .18rem;border-radius:.65rem;border:1px solid #e2d2f6;background:#fcf9ffda;color:#342047;text-align:center}
#home-usage article h3{margin:0;font-size:clamp(.67rem,2.95vw,.95rem);line-height:1.35;overflow-wrap:anywhere}
#home-usage article>bdi{display:block;color:#583289;font-size:clamp(1rem,4.4vw,1.65rem);font-weight:750;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
#home-usage [data-usage-grid]:not([hidden]){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:.45rem;margin-block-start:.45rem}
#home-usage details{min-width:0;border-radius:.65rem;background:#fcf9ffda;color:#342047;border:1px solid #e2d2f6}
#home-usage details summary{display:list-item;cursor:pointer;font-weight:700;font-size:clamp(.71rem,2.5vw,.9rem);padding:.32rem .45rem;overflow-wrap:anywhere}
#home-usage ol{padding:0 .45rem;list-style:none;margin:0}
#home-usage li{display:flex;justify-content:space-between;gap:.3rem;padding:.2rem 0;border-bottom:1px solid #e6dcf4;overflow-wrap:anywhere;font-size:.85rem}
#home-usage li bdi{min-width:0}

/* Keep the new card directly below Phenomena, preserving Research Topics beside it. */
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="frequency-scale"] {
 grid-column:3;--home-accent:#e7eafa;--home-dark:#3d519e;
}
body:not(.in-tool) #tools .frequency-scale-link {display:flex;align-items:center;text-decoration:none}
@media(max-width:760px){
 body:not(.in-tool) #tools > .tool-with-help[data-tool-key="frequency-scale"] {grid-column:1}
}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="school-examples"] {grid-column:4;--home-accent:#eee7fb;--home-dark:#56349a}
body:not(.in-tool) #tools .school-examples-link {display:flex;align-items:center;text-decoration:none}
@media(max-width:760px){body:not(.in-tool) #tools > .tool-with-help[data-tool-key="school-examples"] {grid-column:2}}
body:not(.in-tool) #tools > .tool-with-help[data-tool-key="school-affixes"] {--home-accent:#f5e7fa;--home-dark:#763792}

/* Match the home tool buttons even when a tile navigates to a separate page. */
body:not(.in-tool) #tools .tool-tile:is(.frequency-scale-link,.school-examples-link) {font-weight:650}

body:not(.in-tool) #tools > .tool-with-help[data-tool-key="frequency-studies"] {--home-accent:#eee7fb;--home-dark:#56349a}

/* One accessible table design for both research periods. */
.corpus-table-panel {
  position:relative; isolation:isolate; overflow:hidden; margin-block:clamp(1rem,2.8vw,2rem);
  padding:clamp(.4rem,1.4vw,1rem) clamp(.22rem,1.15vw,.8rem) clamp(1.2rem,2.8vw,2rem);
  border:1px solid #fff; border-radius:clamp(1rem,2.7vw,1.8rem);
  background:radial-gradient(ellipse at 3% 0%,#e9d7f9,transparent 40%),radial-gradient(ellipse at 100% 2%,#e2c5f1,transparent 41%),#f2ebfa;
  box-shadow:0 .45rem 1.2rem #4e227f20; color:#3e1169;
}
.corpus-table-panel[hidden]{display:none}
.corpus-table-panel::after,.corpus-table-panel::before {
  content:""; z-index:-1; position:absolute; inset-inline:-4%; inset-block-end:-1.9rem;
  block-size:3.25rem; pointer-events:none; border-radius:50% 39% 0 0;
  background:linear-gradient(105deg,#e7cdfc,#b385e6 60%,#6e32a9); transform:rotate(-2deg);
}
.corpus-table-panel::before {inset-block-end:-2.22rem;transform:rotate(3deg);background:#d2acec}
.corpus-table-heading {display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:clamp(.3rem,2.5vw,1rem);text-align:center;margin:0 auto .65rem;padding:.22rem .25rem;max-width:58rem}
.corpus-table-heading svg {inline-size:clamp(1.35rem,5.3vw,3.35rem);color:#7233a5}
.corpus-table-heading h2 {margin:0;color:#420f68;font-size:clamp(1.12rem,4vw,2.3rem);font-weight:850;line-height:1.35}
.corpus-table-period {display:inline-flex;align-items:center;gap:clamp(.3rem,2vw,1.1rem);margin-block-start:.26rem}
.corpus-table-period::before,.corpus-table-period::after {content:"";inline-size:clamp(.65rem,6vw,3.4rem);block-size:2px;border-radius:5px;background:#7233a5}
.corpus-table-period bdi {background:linear-gradient(150deg,#8547aa,#4c1a75);color:white;padding:.19em .95em;border-radius:2em;font:750 clamp(.85rem,3vw,1.6rem)/1.35 system-ui,sans-serif;white-space:nowrap}
.corpus-table-panel .corpus-table-scroll {display:block!important;width:100%;overflow-x:auto;border:1px solid #fff9;padding:clamp(.1rem,.7vw,.4rem);border-radius:clamp(.7rem,1.7vw,1.35rem);background:#decef0;outline-offset:2px}
.corpus-table-panel table {width:100%;min-width:280px;table-layout:fixed;border-collapse:separate;border-spacing:clamp(.12rem,.5vw,.34rem);margin:0;text-align:center}
.corpus-table-panel .ct-stage {width:24%}.corpus-table-panel .ct-page {width:17%}.corpus-table-panel .ct-ref {width:16%}.corpus-table-panel .ct-token {width:24%}.corpus-table-panel .ct-form {width:19%}
.corpus-table-panel :is(th,td) {border-radius:clamp(.37rem,1.4vw,.9rem);border:1px solid #fff9;text-align:center;vertical-align:middle;margin:0}
.corpus-table-panel thead th {padding:.55em .2em;background:linear-gradient(#8d51b3,#512174);color:#fff;font-size:clamp(.63rem,2.65vw,1.13rem);font-weight:760;line-height:1.4}
.corpus-table-panel tbody td {background:#fdf9fe;color:#41116b;padding:.6em .05em;font:780 clamp(.65rem,2.95vw,1.48rem)/1.3 system-ui,sans-serif;white-space:nowrap;font-variant-numeric:tabular-nums}
.corpus-table-panel tbody td [data-primary-count] {white-space:normal;overflow-wrap:anywhere}
.corpus-table-panel tbody th {padding:.5rem .12rem;background:#f5eafa}
.corpus-table-stage {display:flex;justify-content:center;align-items:center;gap:.12em;color:#41116b;font-size:clamp(.78rem,3.05vw,1.5rem);font-weight:830;white-space:nowrap}
.corpus-table-stage svg {inline-size:1em;block-size:1em;flex:none}
.corpus-table-open {display:flex;align-items:center;justify-content:center;gap:.16em;min-block-size:44px;margin:.35rem auto 0;border-radius:2em;background:linear-gradient(#8c52b2,#52217b);color:#fff!important;font-size:clamp(.58rem,2.3vw,.96rem);line-height:1.3;text-decoration:none;padding:.16em .28em;max-inline-size:15em}
.corpus-table-open:hover {background:#41125f}.corpus-table-open:focus-visible {outline:2px solid #4b137c;outline-offset:2px}
.corpus-table-open svg {inline-size:1em;block-size:1em;flex:none}
.corpus-table-panel .corpus-table-note {margin:.42rem .5rem 0;text-align:center;font-size:.8rem;color:#533974}

.corpus-table-panel [data-corpus="historic-total"] .corpus-table-stage {white-space:normal;line-height:1.25;padding-inline:.12rem}

#home-intro.hero .home-period-title{margin:.25rem 0 .4rem;color:#25143f;font-size:clamp(1.14rem,5.5vw,2.05rem);font-weight:850;line-height:1.35}
#home-intro.hero .home-periods{display:flex;flex-wrap:wrap;gap:.33rem;margin-block:0 .72rem}
#home-intro.hero .home-periods bdi{display:inline-block;padding:.16rem .54rem;border:1px solid #d9c6f2;border-radius:999px;background:#f7efff;color:#503382;font-size:clamp(.72rem,2.85vw,1rem);font-weight:750;font-variant-numeric:tabular-nums}

/* Preserve complete counts at narrow widths; scrolling is confined to the table. */
.corpus-table-panel table {min-inline-size:21rem}
.corpus-table-panel thead th {overflow-wrap:normal;word-break:normal}
.corpus-table-panel tbody td [data-primary-count] {white-space:nowrap;overflow-wrap:normal}
@media(max-width:39rem){
 .corpus-table-panel tbody td {font-size:clamp(.69rem,2.6vw,.97rem)}
 .corpus-table-panel .ct-token {width:22%}
 .corpus-table-panel .ct-ref {width:18%}
}
