/* ==========================================================================
   karaikudi.biz — glass morphism design system
   Mobile-first. Light + dark. No framework, no build step.
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture, svg { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:where(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 2. Tokens (light is the base) ---------- */
:root {
  /* Chettinad palette: limestone, turmeric, terracotta, temple-tank teal */
  --saffron:    #e08a2e;
  --terracotta: #c25236;
  --teal:       #0e7c74;
  --plum:       #7a3f6d;
  --gold:       #b98a1f;

  --accent:      #c25236;
  --accent-soft: #f0b27a;

  --bg:    #f4efe7;
  --bg-2:  #efe6da;
  --ink:   #2b2620;
  --ink-2: #5c5348;
  --ink-3: #8a7f72;

  --glass:        rgba(255, 255, 255, .55);
  --glass-strong: rgba(255, 255, 255, .76);
  --glass-soft:   rgba(255, 255, 255, .34);
  --stroke:       rgba(255, 255, 255, .70);
  --stroke-2:     rgba(43, 38, 32, .10);
  --sheen:        linear-gradient(160deg, rgba(255,255,255,.75), rgba(255,255,255,0) 42%);
  --shadow:       0 8px 32px rgba(60, 44, 28, .13);
  --shadow-lg:    0 20px 60px rgba(60, 44, 28, .18);

  --blob-1: rgba(224, 138, 46, .34);
  --blob-2: rgba(14, 124, 116, .30);
  --blob-3: rgba(194, 82, 54, .26);
  --blob-4: rgba(122, 63, 109, .22);

  --blur: 18px;
  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 28px;

  --sans:  "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --tamil: "Noto Sans Tamil", "Nirmala UI", "Latha", var(--sans);

  --shell: 1240px;
  --gap: clamp(.85rem, 3vw, 1.35rem);
  --header-h: 62px;
}

:root { color-scheme: light; }

/* Dark palette, defined once and applied through both switches. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent:      #f0a35c;
    --accent-soft: #f5c48f;

    --bg:    #14161f;
    --bg-2:  #0e1017;
    --ink:   #f0ece6;
    --ink-2: #bcb4a9;
    --ink-3: #8d857b;

    --glass:        rgba(30, 34, 47, .55);
    --glass-strong: rgba(30, 34, 47, .80);
    --glass-soft:   rgba(255, 255, 255, .05);
    --stroke:       rgba(255, 255, 255, .12);
    --stroke-2:     rgba(255, 255, 255, .08);
    --sheen:        linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,0) 45%);
    --shadow:       0 8px 32px rgba(0, 0, 0, .38);
    --shadow-lg:    0 24px 70px rgba(0, 0, 0, .50);

    --blob-1: rgba(224, 138, 46, .38);
    --blob-2: rgba(14, 124, 116, .38);
    --blob-3: rgba(194, 82, 54, .30);
    --blob-4: rgba(122, 63, 109, .34);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent:      #f0a35c;
  --accent-soft: #f5c48f;

  --bg:    #14161f;
  --bg-2:  #0e1017;
  --ink:   #f0ece6;
  --ink-2: #bcb4a9;
  --ink-3: #8d857b;

  --glass:        rgba(30, 34, 47, .55);
  --glass-strong: rgba(30, 34, 47, .80);
  --glass-soft:   rgba(255, 255, 255, .05);
  --stroke:       rgba(255, 255, 255, .12);
  --stroke-2:     rgba(255, 255, 255, .08);
  --sheen:        linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,0) 45%);
  --shadow:       0 8px 32px rgba(0, 0, 0, .38);
  --shadow-lg:    0 24px 70px rgba(0, 0, 0, .50);

  --blob-1: rgba(224, 138, 46, .38);
  --blob-2: rgba(14, 124, 116, .38);
  --blob-3: rgba(194, 82, 54, .30);
  --blob-4: rgba(122, 63, 109, .34);
}

/* ---------- 3. Page canvas + aurora ---------- */
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--header-h);
  -webkit-font-smoothing: antialiased;
}

/* Fixed aurora field that the glass panels refract. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg) 0%, var(--bg-2) 100%);
  pointer-events: none;
}
.aurora::before,
.aurora::after,
.aurora span {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}
.aurora::before {
  width: 62vmax; height: 62vmax;
  top: -22vmax; left: -18vmax;
  background: var(--blob-1);
  animation: drift-a 34s ease-in-out infinite alternate;
}
.aurora::after {
  width: 52vmax; height: 52vmax;
  bottom: -20vmax; right: -16vmax;
  background: var(--blob-2);
  animation: drift-b 42s ease-in-out infinite alternate;
}
.aurora span:nth-of-type(1) {
  width: 40vmax; height: 40vmax;
  top: 34%; right: -12vmax;
  background: var(--blob-3);
  animation: drift-c 38s ease-in-out infinite alternate;
}
.aurora span:nth-of-type(2) {
  width: 34vmax; height: 34vmax;
  bottom: 6%; left: -10vmax;
  background: var(--blob-4);
  animation: drift-d 46s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(14vw, 10vh, 0) scale(1.15); } }
@keyframes drift-b { to { transform: translate3d(-12vw, -8vh, 0) scale(1.2); } }
@keyframes drift-c { to { transform: translate3d(-16vw, 12vh, 0) scale(.85); } }
@keyframes drift-d { to { transform: translate3d(10vw, -14vh, 0) scale(1.1); } }

/* ---------- 4. Layout shell ---------- */
.shell {
  width: min(100% - 2rem, var(--shell));
  margin-inline: auto;
}
/* Mobile-first: each column of the home page is a one-column grid with even
   spacing. The breakpoints further down turn them into side-by-side columns.
   Grid gap rather than margins, so a child's own margin cannot cancel it. */
.stack,
.home-layout,
.home-rail,
.home-aside { display: grid; gap: var(--gap); }
/* A section label that is itself a grid item would otherwise add its own
   margin on top of the gap, spacing it further from the group it labels
   than the group's items are from each other. */
.stack > .nav-drawer__label { margin-bottom: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 5. The glass primitive ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(165%);
  backdrop-filter: blur(var(--blur)) saturate(165%);
}
/* Specular top edge — what sells the "pane of glass" read. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--sheen);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  pointer-events: none;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

.card { padding: clamp(1rem, 3.5vw, 1.5rem); }
.card--tight { padding: .95rem 1.05rem; }

/* ---------- 6. Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--glass);
  border-bottom: 1px solid var(--stroke-2);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}
.site-header__inner {
  width: min(100% - 1.5rem, var(--shell));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}
/* Below the desktop breakpoint the search lives in the drawer instead. */
.site-header__inner .search { display: none; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  letter-spacing: -.015em;
  text-decoration: none;
  margin-right: auto;
  font-size: 1.02rem;
}
.brand__mark {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--saffron), var(--terracotta));
  color: #fff;
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(194, 82, 54, .40);
}
.brand__name { line-height: 1.15; }
.brand__name small {
  display: block;
  font-size: .61rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.icon-btn {
  width: 40px; height: 40px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--stroke-2);
  background: var(--glass-soft);
  color: var(--ink);
  transition: background .2s, transform .2s;
}
.icon-btn:hover { background: var(--glass-strong); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
:root[data-theme="dark"] .icon-btn .icon-sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-btn .icon-sun  { display: none; }
}

/* ---------- 7. Navigation ---------- */
.nav-desktop { display: none; }

.nav-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(84vw, 340px);
  z-index: 80;
  padding: calc(var(--header-h) + .75rem) 1.15rem 1.5rem;
  background: var(--glass-strong);
  border-left: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow: var(--shadow-lg);
  transform: translateX(101%);
  transition: transform .34s cubic-bezier(.32, .72, 0, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nav-drawer[data-open="true"] { transform: translateX(0); }
.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 16, 12, .40);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.nav-scrim[data-open="true"] { opacity: 1; visibility: visible; }

.nav-drawer__label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .67rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.nav-list { display: grid; gap: .3rem; margin-bottom: 1.25rem; }
.nav-list a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 550;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
}
.nav-list a:hover { background: var(--glass-soft); color: var(--ink); }
.nav-list a[aria-current="page"] {
  background: var(--glass);
  border-color: var(--stroke);
  color: var(--ink);
}
.nav-list a[aria-current="page"] .nav-dot { background: var(--accent); opacity: 1; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); opacity: .55; flex: none; }
.nav-list a .ext { margin-left: auto; font-size: .72rem; color: var(--ink-3); }

/* ---------- 8. Search ---------- */
.search {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .3rem .3rem .85rem;
  border-radius: 999px;
  background: var(--glass-soft);
  border: 1px solid var(--stroke-2);
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: .35rem 0;
  font-size: .9rem;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; }
.search button {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--saffron), var(--terracotta));
  color: #fff;
  transition: transform .18s;
}
.search button:hover { transform: scale(1.06); }
.search button svg { width: 15px; height: 15px; }

/* ---------- 9. Typography ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.page-title { font-size: clamp(1.9rem, 7.5vw, 3.4rem); letter-spacing: -.035em; }
.eyebrow {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { font-size: clamp(1rem, 3.2vw, 1.12rem); color: var(--ink-2); }
.muted { color: var(--ink-2); }
.tiny  { font-size: .8rem; color: var(--ink-3); }
.ta { font-family: var(--tamil); line-height: 1.85; }

.prose p + p, .prose p + ul, .prose p + ol,
.prose ul + p, .prose ol + p { margin-top: .9rem; }
.prose a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }

/* ---------- 10. Buttons & chips ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .62rem 1.1rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--stroke);
  background: var(--glass-soft);
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--primary {
  background: linear-gradient(140deg, var(--saffron), var(--terracotta));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(194, 82, 54, .32);
}
.btn--sm { padding: .42rem .85rem; font-size: .82rem; }
.btn svg { width: 15px; height: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .8rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink-2);
  background: var(--glass-soft);
  border: 1px solid var(--stroke-2);
  transition: transform .18s, color .18s, border-color .18s;
}
.chip:hover { transform: translateY(-2px); color: var(--ink); border-color: var(--stroke); }

/* Same colour treatment as .btn--primary, so the sibling-site links in
   "Also from us" read as destinations rather than as tags. */
.chip--primary {
  background: linear-gradient(140deg, var(--saffron), var(--terracotta));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(194, 82, 54, .32);
}
.chip--primary:hover { color: #fff; border-color: transparent; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); }

/* ---------- 11. Hero ---------- */
.hero { padding: clamp(1.4rem, 6vw, 2.6rem); overflow: hidden; border-radius: var(--radius-lg); }
.hero__kicker { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; }
.hero h1 { margin-bottom: .7rem; }
.motto { font-family: var(--tamil); color: var(--teal); font-weight: 600; font-size: 1.02rem; }
:root[data-theme="dark"] .motto { color: #4ec3b8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .motto { color: #4ec3b8; }
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .28rem .75rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-2);
  background: var(--glass-soft);
  border: 1px solid var(--stroke-2);
}
.date-pill::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}

/* ---------- 12. Sections ---------- */
.section { margin-top: clamp(1.6rem, 6vw, 2.75rem); }
/* The left side is an eyebrow stacked over a heading. Baseline alignment
   would pin the action button to the eyebrow's baseline, floating it above
   the heading; aligning to the end lines it up with the heading itself. */
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}
.section__head h2 { font-size: clamp(1.25rem, 4.5vw, 1.7rem); }

/* ---------- 13. Media cards ---------- */
.grid { display: grid; gap: var(--gap); }

.figure-card { overflow: hidden; display: flex; flex-direction: column; }
.figure-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--glass-soft); }
/* The deity photographs are portrait; anchor the crop to the top so the
   face and headdress stay in frame instead of being cut off. */
.figure-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  transform-origin: center top;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.figure-card:hover .figure-card__media img { transform: scale(1.05); }
.figure-card__tag {
  position: absolute;
  top: .7rem; left: .7rem;
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(20, 16, 12, .42);
  border: 1px solid rgba(255,255,255,.28);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.figure-card__body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.figure-card__body h3 { font-size: 1.05rem; }
.figure-card__body p { font-size: .92rem; color: var(--ink-2); }
.figure-card__body .more { margin-top: auto; padding-top: .35rem; font-size: .85rem; }
.figure-card__body .more a { color: var(--accent); font-weight: 600; text-decoration: none; }
.figure-card__body .more a:hover { text-decoration: underline; }

/* Portrait deity panel */
.deity { text-align: center; padding: 1.1rem; }
.deity .motto { margin-bottom: .7rem; line-height: 1.5; }
.deity img {
  display: block;
  width: 100%;
  height: auto;              /* full width, natural proportions, no crop */
  border-radius: var(--radius-sm);
}
.deity figcaption { margin-top: .7rem; font-size: .85rem; color: var(--ink-2); }

/* ---------- 14. Festival of the month ---------- */
.festival { overflow: hidden; text-align: center; }
.festival__media { position: relative; aspect-ratio: 16 / 10; background: var(--glass-soft); }
.festival__media img { width: 100%; height: 100%; object-fit: cover; }
.festival__media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(18,14,10,.60), rgba(18,14,10,0) 55%);
}
.festival__body { padding: 1.1rem; }
.festival__title { font-family: var(--tamil); font-size: 1.14rem; font-weight: 600; line-height: 1.55; }
.festival__alt { color: var(--ink-3); font-size: .85rem; font-style: italic; margin-top: .15rem; }
.festival .btn { margin-top: .85rem; }

/* ---------- 15. Blog feed ---------- */
.feed h4 {
  font-family: var(--sans);
  font-size: .98rem;
  font-weight: 650;
  line-height: 1.4;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--stroke-2);
}
.feed h4:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.feed h4 a { color: var(--ink); text-decoration: none; }
.feed h4 a:hover { color: var(--accent); }
.feed p { font-size: .88rem; color: var(--ink-2); margin-top: .3rem; }
.feed p a { color: var(--accent); }
.feed img { border-radius: var(--radius-sm); margin: .5rem 0; }
.feed__state { color: var(--ink-3); font-size: .88rem; }

/* ---------- 16. Sponsor cards ---------- */
.sponsor { padding: 1.05rem 1.1rem; display: grid; gap: .3rem; }
.sponsor h3 { font-size: 1.05rem; }
.sponsor__place { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.sponsor__offer {
  margin: .6rem 0 .4rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 24%, transparent);
  font-size: .86rem;
  font-weight: 550;
  text-align: center;
}
.sponsor__person { font-size: .9rem; color: var(--ink-2); }
.sponsor__person strong { color: var(--ink); }
.sponsor__call {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .35rem;
  font-weight: 650;
  font-size: .95rem;
  color: var(--accent);
  text-decoration: none;
}
.sponsor__call:hover { text-decoration: underline; }
.sponsor__call svg { width: 15px; height: 15px; }

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 108px;
  border-radius: var(--radius);
  border: 1px dashed var(--stroke-2);
  background: var(--glass-soft);
  color: var(--ink-3);
  font-size: .7rem;
  letter-spacing: .28em;
  text-transform: uppercase;
}

/* ---------- 17. Notice panel ---------- */
.notice { padding: 1.15rem 1.2rem; }
.notice h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.notice p + p { margin-top: .7rem; }
.notice .accent-rule {
  width: 46px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--saffron), var(--terracotta));
  margin-bottom: .8rem;
}

/* ---------- 18. Heritage document ---------- */
.doc-layout { display: block; }

.toc { padding: 1.05rem 1.1rem; }
.toc h2 { font-size: .95rem; margin-bottom: .6rem; }
.toc ol { list-style: none; padding: 0; display: grid; gap: .05rem; }
.toc a {
  display: block;
  padding: .38rem .6rem;
  border-radius: 10px;
  font-size: .87rem;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .18s, color .18s, border-color .18s;
}
.toc a:hover { background: var(--glass-soft); color: var(--ink); }
.toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--glass-soft);
  font-weight: 600;
}
.toc__note {
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--stroke-2);
  font-size: .77rem;
  color: var(--ink-3);
}
.toc__note div + div { margin-top: .2rem; }
.toc__note a { color: var(--accent); }

/* The rail scrolls at desktop widths. Left alone, the browser draws a solid
   OS scrollbar straight across the frosted panel; this gives it a thin
   translucent thumb built from the same tokens, so it reads as part of the
   glass and picks up the accent colour on hover. */
.toc-rail { display: none; }
/* Firefox has no ::-webkit-scrollbar, so it needs the standard properties.
   Chromium understands both, but as soon as scrollbar-color is set it draws
   its own plain thin bar and ignores the pseudo-elements below - which is why
   the rounded inset thumb never appeared. Scope these to browsers that lack
   the pseudo-element, i.e. Firefox. */
@supports not selector(::-webkit-scrollbar) {
  .toc-rail {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink-3) 35%, transparent) transparent;
  }
}
.toc-rail::-webkit-scrollbar { width: 10px; }
.toc-rail::-webkit-scrollbar-track { background: transparent; }
.toc-rail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-3) 38%, transparent);
  /* transparent border + content-box clip insets the thumb from the edge */
  border: 3px solid transparent;
  background-clip: content-box;
}
.toc-rail::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 70%, transparent);
  background-clip: content-box;
}

/* Mobile: collapsible ToC */
.toc-mobile { margin-bottom: var(--gap); }
.toc-mobile > summary {
  list-style: none;
  cursor: pointer;
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  font-size: .92rem;
}
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary::after {
  content: "";
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .25s;
}
.toc-mobile[open] > summary::after { transform: rotate(-135deg) translateY(2px); }
.toc-mobile .toc {
  border: 0; box-shadow: none; background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  padding-top: 0;
}
.toc-mobile .toc::before { display: none; }

/* The article can run past 30,000px on a phone. A backdrop-filter over a
   surface that tall blows past the compositor's texture limit and the panel
   stops painting, so this one pane stays translucent without the live blur. */
.doc {
  padding: clamp(1.1rem, 4.5vw, 2.2rem);
  background: var(--glass-strong);
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
}
.doc h2.sec-title {
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--stroke-2);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.doc h2.sec-title:first-of-type { margin-top: .4rem; padding-top: 0; border-top: 0; }
.doc h3.sub-title {
  font-size: 1.1rem;
  margin-top: 1.9rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.doc h3.sub-title::before {
  content: "";
  display: block;
  width: 30px; height: 2px; border-radius: 2px;
  background: var(--accent);
  margin-bottom: .55rem;
  opacity: .85;
}
.doc p { margin-top: .95rem; }
.doc > p:first-child { margin-top: 0; }
.doc ol, .doc ul { margin-top: .95rem; padding-left: 1.35rem; display: grid; gap: .45rem; }
.doc li { padding-left: .15rem; }
.doc li::marker { color: var(--ink-3); font-size: .88em; }
.doc a { color: var(--accent); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.doc a:hover { text-decoration-color: currentColor; }
.doc .role { display: block; color: var(--ink-3); font-style: italic; font-size: .85em; line-height: 1.5; }
.doc .more { margin-top: .5rem; font-size: .86rem; }
.doc .more a { font-weight: 550; }
.doc .more::before { content: "\2192\00a0"; color: var(--ink-3); }
.doc .doc-intro {
  font-size: clamp(1.02rem, 3.4vw, 1.15rem);
  color: var(--ink-2);
  font-family: var(--serif);
  font-style: italic;
}
.doc b, .doc strong { font-weight: 650; color: var(--ink); }

/* Two of the lists in this document run to ~90 entries. Collapsed by default
   they stay one tap away and keep the page a sane length to scroll. */
.long-list { margin-top: .95rem; }
.long-list > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .95rem;
  border-radius: 999px;
  font-size: .87rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--glass-soft);
  border: 1px solid var(--stroke-2);
  transition: background .2s, transform .2s;
}
.long-list > summary:hover { transform: translateY(-1px); background: var(--glass); }
.long-list > summary::-webkit-details-marker { display: none; }
.long-list > summary::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .25s;
}
.long-list[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
.long-list[open] > summary { margin-bottom: .3rem; }

.doc-hero { padding: clamp(1.4rem, 6vw, 2.4rem); margin-bottom: var(--gap); border-radius: var(--radius-lg); }

/* ---------- 19. Contact ---------- */
.contact-grid { display: grid; gap: var(--gap); align-items: start; }
.contact-row { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--stroke-2); }
.contact-row:last-child { border-bottom: 0; }
.contact-row__icon {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--glass-soft);
  border: 1px solid var(--stroke-2);
  color: var(--accent);
}
.contact-row__icon svg { width: 17px; height: 17px; }
.contact-row__label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.contact-row a { color: var(--ink); text-decoration: none; font-weight: 600; }
.contact-row a:hover { color: var(--accent); }

/* ---------- 20. 404 ---------- */
.error-wrap { min-height: 62vh; display: grid; place-items: center; text-align: center; padding: 2rem 0; }
.error-code {
  font-family: var(--serif);
  font-size: clamp(6rem, 32vw, 14rem);
  line-height: .85;
  font-weight: 600;
  letter-spacing: -.05em;
  background: linear-gradient(140deg, var(--saffron), var(--terracotta) 55%, var(--plum));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* ---------- 21. Footer ---------- */
.site-footer {
  margin-top: clamp(2rem, 8vw, 4rem);
  padding: clamp(1.4rem, 5vw, 2.2rem) 0 calc(1.4rem + env(safe-area-inset-bottom));
  background: var(--glass);
  border-top: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}
.site-footer__grid { display: grid; gap: 1.4rem; }
.site-footer h4 {
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .6rem;
}
.site-footer ul { display: grid; gap: .35rem; }
.site-footer a { color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer .tagline { font-style: italic; color: var(--ink-2); font-size: .92rem; }
.site-footer__base {
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--stroke-2);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--ink-3);
}
.site-footer__base a { font-size: inherit; }

/* ---------- 22. Back to top ---------- */
.to-top {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 50;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s, visibility .25s;
}
.to-top[data-show="true"] { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 18px; height: 18px; }

/* ---------- 23. Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ==========================================================================
   Breakpoints
   ========================================================================== */

/* ---- >= 600px ---- */
@media (min-width: 600px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .site-footer__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- >= 860px: desktop nav + sidebars ---- */
@media (min-width: 860px) {
  :root { --header-h: 70px; }

  .icon-btn--menu { display: none; }
  .nav-drawer, .nav-scrim { display: none; }

  .nav-desktop { display: flex; align-items: center; gap: .1rem; }
  .nav-desktop a {
    padding: .5rem .74rem;
    border-radius: 999px;
    font-size: .89rem;
    font-weight: 550;
    color: var(--ink-2);
    text-decoration: none;
    transition: background .2s, color .2s;
  }
  .nav-desktop a:hover { background: var(--glass-soft); color: var(--ink); }
  .nav-desktop a[aria-current="page"] {
    color: var(--ink);
    background: var(--glass-strong);
    box-shadow: inset 0 0 0 1px var(--stroke-2);
  }
  .site-header__inner .search { display: flex; width: 200px; margin-left: .4rem; }

  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .site-footer__grid { grid-template-columns: 1.7fr 1fr 1fr 1fr; }

  .home-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .home-aside { position: sticky; top: calc(var(--header-h) + 1rem); }

  .doc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--gap); align-items: start; }
  .toc-rail {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow-y: auto;
  }
  .toc-mobile { display: none; }

  .contact-grid { grid-template-columns: 1fr 1.35fr; }
}

/* ---- >= 1100px: three-column home ---- */
@media (min-width: 1100px) {
  .home-layout { grid-template-columns: 280px minmax(0, 1fr) 320px; }
  .home-rail { position: sticky; top: calc(var(--header-h) + 1rem); }
}

/* ---- print ---- */
@media print {
  .site-header, .nav-drawer, .nav-scrim, .to-top, .aurora, .toc-rail, .toc-mobile, .ad-slot { display: none !important; }
  body { padding-top: 0; background: #fff; color: #000; }
  .glass {
    background: #fff; border: 1px solid #ddd; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .glass::before { display: none; }
}
