/* ==========================================================================
   Tamizhan Archives — design system
   Mood: a temple at night, lit by an oil lamp. Ink, lamp-gold, kumkum, sandal.
   ========================================================================== */

/* ---------- tokens: light ("sandal paper") */
:root {
  --bg: #f6efe2;
  --bg-2: #efe5d2;
  --surface: rgba(255, 252, 245, 0.78);
  --surface-solid: #fffaf0;
  --surface-2: #f1e7d5;
  --surface-3: #e8dcc6;
  --glass: rgba(255, 250, 240, 0.72);
  --line: rgba(84, 58, 24, 0.13);
  --line-strong: rgba(84, 58, 24, 0.24);
  --ink: #1b130b;
  --ink-soft: #5d4a37;
  --ink-faint: #8c7860;
  --gold: #a8741c;
  --gold-2: #c99437;
  --gold-3: #e7c27a;
  --gold-ink: #fffaf0;
  --kumkum: #b2361c;
  --jade: #2f6b55;
  --danger: #a3271b;
  --focus: #c99437;
  --hero-ink: #1b130b;
  --shadow-sm: 0 1px 2px rgba(60, 38, 12, 0.06), 0 2px 8px rgba(60, 38, 12, 0.05);
  --shadow: 0 2px 6px rgba(60, 38, 12, 0.06), 0 14px 40px rgba(60, 38, 12, 0.09);
  --shadow-lg: 0 30px 80px rgba(60, 38, 12, 0.16);
  --glow: 0 0 0 1px rgba(201, 148, 55, 0.35), 0 18px 50px rgba(168, 116, 28, 0.18);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --display: "Cormorant Garamond", "Noto Serif Tamil", Georgia, serif;
  --serif-ta: "Noto Serif Tamil", "Cormorant Garamond", serif;
  --sans: "Inter", "Noto Sans Tamil", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 68px;
  color-scheme: light;
}

/* ---------- tokens: dark ("lamp-lit night") */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0907; --bg-2: #120e0a; --surface: rgba(255, 244, 222, 0.035); --surface-solid: #16120d;
    --surface-2: #1d1711; --surface-3: #2a2117; --glass: rgba(16, 12, 9, 0.7);
    --line: rgba(231, 194, 122, 0.12); --line-strong: rgba(231, 194, 122, 0.26);
    --ink: #f4ead8; --ink-soft: #bcab93; --ink-faint: #85755f;
    --gold: #e2b25e; --gold-2: #f0cd8a; --gold-3: #f8e2b4; --gold-ink: #1a1208;
    --kumkum: #e0623f; --jade: #6cc5a1; --danger: #ef7a6a; --focus: #f0cd8a; --hero-ink: #f4ead8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .45);
    --shadow-lg: 0 40px 100px rgba(0, 0, 0, .6); --glow: 0 0 0 1px rgba(240, 205, 138, .35), 0 20px 60px rgba(226, 178, 94, .16);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0907; --bg-2: #120e0a; --surface: rgba(255, 244, 222, 0.035); --surface-solid: #16120d;
  --surface-2: #1d1711; --surface-3: #2a2117; --glass: rgba(16, 12, 9, 0.7);
  --line: rgba(231, 194, 122, 0.12); --line-strong: rgba(231, 194, 122, 0.26);
  --ink: #f4ead8; --ink-soft: #bcab93; --ink-faint: #85755f;
  --gold: #e2b25e; --gold-2: #f0cd8a; --gold-3: #f8e2b4; --gold-ink: #1a1208;
  --kumkum: #e0623f; --jade: #6cc5a1; --danger: #ef7a6a; --focus: #f0cd8a; --hero-ink: #f4ead8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .45);
  --shadow-lg: 0 40px 100px rgba(0, 0, 0, .6); --glow: 0 0 0 1px rgba(240, 205, 138, .35), 0 20px 60px rgba(226, 178, 94, .16);
  color-scheme: dark;
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--kumkum) 6%, transparent), transparent 60%);
  background-attachment: fixed;
}
/* fine paper grain over everything, very subtle */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, footer { position: relative; z-index: 1; }
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-2); }
::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.005em; color: var(--ink); }
h1 { font-size: clamp(2.3rem, 5.2vw, 4rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h3 { font-size: 1.35rem; }
:lang(ta) h1, :lang(ta) h2, :lang(ta) h3, [lang="ta"] { font-family: var(--serif-ta); }
:lang(ta) h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.3; }
:lang(ta) h2 { line-height: 1.35; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
main { min-height: 72vh; outline: none; }
.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }
.wrap.narrow { width: min(820px, 100% - 40px); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: .875rem; }
.ta { font-family: var(--serif-ta); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

/* ---------- icons */
.i { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.18em; }
.i.lg { width: 1.6em; height: 1.6em; }
.i.xl { width: 2.2em; height: 2.2em; }

/* ---------- page header pattern: eyebrow · title · lede */
.page-head { padding: clamp(36px, 7vw, 76px) 0 clamp(18px, 3vw, 30px); position: relative; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 .74rem/1 var(--sans); letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; opacity: .7; }
:lang(ta) .eyebrow { letter-spacing: .04em; text-transform: none; font-size: .85rem; }
.page-head p, .lede { max-width: 720px; font-size: 1.08rem; color: var(--ink-soft); }
.page-head h1 .ta { color: var(--gold); font-weight: 500; }
.section { padding: clamp(40px, 7vw, 90px) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.hairline { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); margin: 0; }

/* ---------- buttons */
.btn {
  --b: var(--line-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--b);
  background: var(--surface); color: var(--ink); font: 600 .92rem/1 var(--sans); letter-spacing: .01em;
  text-decoration: none; cursor: pointer; overflow: hidden; isolation: isolate; white-space: nowrap;
  transition: transform .25s var(--ease), border-color .25s, background .25s, box-shadow .25s, color .25s;
  backdrop-filter: blur(10px);
}
.btn:hover { border-color: var(--gold); color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  color: var(--gold-ink); border-color: transparent;
  background: linear-gradient(135deg, var(--gold-3) -20%, var(--gold-2) 30%, var(--gold) 100%);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--gold) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary::after { /* light sweep */
  content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
  transition: transform .8s var(--ease);
}
.btn.primary:hover { color: var(--gold-ink); box-shadow: 0 12px 34px color-mix(in srgb, var(--gold) 45%, transparent); }
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: transparent; backdrop-filter: none; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .84rem; gap: 7px; }
.btn.icon-only { width: 44px; padding: 0; }
.btn.small.icon-only { width: 36px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; }
.link-arrow .i { transition: transform .3s var(--ease); }
.link-arrow:hover .i, a:hover > .link-arrow .i { transform: translateX(4px); }

/* ---------- pills, chips, segmented */
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 .72rem/1 var(--sans); letter-spacing: .03em;
  padding: 6px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.pill .i { width: 13px; height: 13px; }
.pill.coll { background: color-mix(in srgb, var(--gold) 13%, transparent); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.pill.claimed { background: color-mix(in srgb, var(--kumkum) 12%, transparent); color: var(--kumkum); border-color: color-mix(in srgb, var(--kumkum) 30%, transparent); }
.pill.debated { background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.pill.approved { color: var(--jade); }
.pill.pending { color: var(--gold); }
.pill.rejected { color: var(--danger); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); font: 500 .86rem/1.1 var(--sans); cursor: pointer; text-decoration: none;
  transition: all .2s var(--ease); white-space: nowrap; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.on, .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font-size: .76rem; opacity: .7; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: 600 .82rem/1 var(--sans); color: var(--ink-soft); white-space: nowrap; }
.seg button.on { background: var(--surface-solid); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button .muted { font-weight: 500; }

/* ---------- forms */
label { display: block; font: 600 .86rem/1.3 var(--sans); margin: 18px 0 8px; color: var(--ink); }
label .hint, .hint { font-weight: 400; color: var(--ink-faint); font-size: .8rem; }
input[type=text], input[type=number], input[type=url], input[type=search], input[type=email], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface-solid); color: var(--ink); transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8741c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
select[multiple] { background-image: none; padding-right: 15px; }
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input[type=file] { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; line-height: 1.55; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.date-fields { display: flex; gap: 8px; }
.date-fields input[type=number] { width: 0; flex: 1 1 64px; }
.date-fields input[name$=_year] { flex: 2 1 96px; }
.date-fields select { width: auto; flex: 2 1 110px; }
.event-select { min-height: 150px; }

/* ---------- surfaces */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 2.2vw, 26px); box-shadow: var(--shadow-sm); backdrop-filter: blur(14px);
}
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); border: 1px solid var(--line); }
.notice { position: relative; padding: 18px 20px 18px 54px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  background: color-mix(in srgb, var(--gold) 7%, var(--surface-solid)); margin: 18px 0; line-height: 1.65; }
.notice::before { content: ""; position: absolute; left: 20px; top: 20px; width: 20px; height: 20px; background: var(--gold);
  -webkit-mask: 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.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 16v-4.5M12 8h.01'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: 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.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 16v-4.5M12 8h.01'/%3E%3C/svg%3E") center/contain no-repeat; }
.notice.warn { border-color: color-mix(in srgb, var(--kumkum) 30%, transparent); background: color-mix(in srgb, var(--kumkum) 6%, var(--surface-solid)); }
.notice.warn::before { background: var(--kumkum); }
.notice strong { color: var(--ink); }
mark { background: color-mix(in srgb, var(--gold) 38%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: .86rem; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-soft); font-size: .72rem; line-height: 1; box-shadow: inset 0 -1px 0 var(--line); }
pre { background: var(--surface-2); padding: 16px 18px; border-radius: 14px; overflow-x: auto; border: 1px solid var(--line); line-height: 1.6; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font: 600 .74rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); padding: 12px; border-bottom: 1px solid var(--line-strong); }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: color-mix(in srgb, var(--gold) 4%, transparent); }
.empty { text-align: center; padding: clamp(50px, 8vw, 90px) 20px; color: var(--ink-soft); }
.empty .i.xl { color: var(--gold); margin-bottom: 14px; }
.empty h3 { margin-bottom: 6px; }

/* ---------- header */
.topbar {
  position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  display: flex; align-items: center; gap: 18px; padding: 0 clamp(16px, 3vw, 34px);
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--line); transition: background .3s, border-color .3s, height .3s;
}
.topbar.on-hero:not(.scrolled) { background: transparent; border-color: transparent; backdrop-filter: none; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-mark .ring { fill: none; stroke: var(--gold); stroke-width: 1.4; }
.brand-mark .fill { fill: url(#brandGrad); }
.brand-mark text { fill: var(--gold-ink); font: 700 21px var(--serif-ta); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font: 600 1.28rem/1 var(--display); letter-spacing: .01em; }
.brand-text small { font: 500 .72rem/1.3 var(--serif-ta); color: var(--gold); margin-top: 3px; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; color: var(--ink-soft);
  font: 500 .92rem/1 var(--sans); position: relative; transition: color .2s, background .2s; }
.nav a .i { width: 17px; height: 17px; opacity: .85; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.active { color: var(--ink); }
.nav a.active::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.nav .nav-support { margin-left: 6px; color: var(--gold-ink); background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--gold) 30%, transparent); }
.nav .nav-support:hover, .nav .nav-support.active { color: var(--gold-ink); background: linear-gradient(135deg, var(--gold-3), var(--gold-2)); }
.nav .nav-support.active::after { display: none; }
.search-trigger { display: flex; align-items: center; gap: 10px; flex: 0 1 300px; min-width: 0; height: 42px; padding: 0 8px 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-faint); font: 400 .9rem var(--sans);
  cursor: text; transition: border-color .2s, box-shadow .2s; }
.search-trigger:hover { border-color: var(--gold); color: var(--ink-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 10%, transparent); }
.search-trigger span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-trigger kbd { flex: none; }
.tools { display: flex; align-items: center; gap: 6px; }
.tool-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); transition: all .2s; }
.tool-btn:hover { color: var(--gold); border-color: var(--gold); }
.lang-toggle { width: auto; padding: 0 13px; gap: 7px; display: inline-flex; font: 600 .84rem var(--serif-ta); }
.auth-slot { display: flex; align-items: center; gap: 8px; }
.auth-slot .avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); }
.auth-slot .who { font-size: .84rem; color: var(--ink-soft); max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menu-toggle { display: none; }

/* ---------- mobile bottom tab bar */
.tabbar { display: none; }

/* ---------- command palette */
.palette { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: start center; padding: 12vh 16px 16px;
  background: color-mix(in srgb, #000 45%, transparent); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.palette.open { opacity: 1; pointer-events: auto; }
.palette-box { width: min(680px, 100%); border-radius: 22px; overflow: hidden; background: var(--surface-solid); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg); transform: translateY(-10px) scale(.98); transition: transform .3s var(--ease); }
.palette.open .palette-box { transform: none; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.palette-input .i { color: var(--gold); width: 20px; height: 20px; }
.palette-input input { border: 0; background: transparent; min-height: 62px; padding: 0; font-size: 1.08rem; box-shadow: none !important; }
.palette-results { max-height: min(60vh, 520px); overflow-y: auto; padding: 8px; }
.palette-group { padding: 10px 12px 6px; font: 600 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.palette-item { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; cursor: pointer; }
.palette-item .pi-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--gold); }
.palette-item .pi-text { flex: 1; min-width: 0; }
.palette-item .pi-title { display: block; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.palette-item .pi-sub { display: block; font-size: .8rem; color: var(--ink-faint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.palette-item.sel, .palette-item:hover { background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--ink); }
.palette-item.sel .pi-icon { background: var(--gold); color: var(--gold-ink); }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--ink-faint); }
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }
.palette-empty { padding: 30px; text-align: center; color: var(--ink-faint); }

/* ---------- footer */
.footer { margin-top: 80px; border-top: 1px solid var(--line); background: linear-gradient(180deg, transparent, var(--bg-2)); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; padding: 64px 0 40px; }
.footer-brand p { color: var(--ink-soft); max-width: 360px; font-size: .94rem; margin-top: 16px; }
.footer h4 { font: 600 .74rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 16px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer ul a { color: var(--ink-soft); font-size: .94rem; }
.footer ul a:hover { color: var(--ink); }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 22px 0 34px; border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-faint); }
.footer-bottom span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- toast */
.toast { position: fixed; bottom: 26px; left: 50%; z-index: 4000; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 13px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 140px); transition: transform .45s var(--ease); }
.toast.show { transform: translate(-50%, 0); }

/* ---------- motion */
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(30px, -20px) scale(1.06); } }
@keyframes flicker { 0%, 100% { opacity: .9; transform: scaleY(1); } 40% { opacity: 1; transform: scaleY(1.06); } 70% { opacity: .82; transform: scaleY(.96); } }
.page-in { animation: pageIn .7s var(--ease) both; }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.spot { --mx: 50%; --my: 50%; }
.spot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--gold) 13%, transparent), transparent 45%); }
.spot:hover::after { opacity: 1; }
.lift { transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s; }
.lift:hover { transform: translateY(-5px); box-shadow: var(--glow); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.skeleton { border-radius: var(--radius); min-height: 260px; border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--surface-2) 40%, color-mix(in srgb, var(--gold) 8%, var(--surface-2)) 50%, var(--surface-2) 60%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--gold); animation: spin .8s linear infinite; display: inline-block; }

/* ==========================================================================
   HOME
   ========================================================================== */
.hero { position: relative; min-height: min(92vh, 900px); display: grid; align-items: center; overflow: hidden;
  margin-top: calc(-1 * var(--header-h)); padding: calc(var(--header-h) + 50px) 0 70px; isolation: isolate; }
.hero-aura { position: absolute; inset: -20%; z-index: -2; pointer-events: none; }
.hero-aura span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; animation: float 18s ease-in-out infinite; }
.hero-aura span:nth-child(1) { width: 46vw; height: 46vw; right: 2%; top: 8%; background: color-mix(in srgb, var(--gold) 45%, transparent); }
.hero-aura span:nth-child(2) { width: 34vw; height: 34vw; left: 4%; bottom: 0; background: color-mix(in srgb, var(--kumkum) 32%, transparent); animation-delay: -6s; }
.hero-aura span:nth-child(3) { width: 22vw; height: 22vw; left: 40%; top: 20%; background: color-mix(in srgb, var(--jade) 22%, transparent); animation-delay: -11s; }
.hero-kolam { position: absolute; right: -6vw; top: 50%; width: min(760px, 62vw); aspect-ratio: 1; transform: translateY(-50%); z-index: -1; color: var(--gold); opacity: .55; }
.hero-kolam svg { width: 100%; height: 100%; animation: spin 240s linear infinite; }
.hero-kolam .k-line { fill: none; stroke: currentColor; stroke-width: .7; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 6s var(--ease) forwards; }
.hero-kolam .k-line:nth-child(2) { animation-delay: .4s; } .hero-kolam .k-line:nth-child(3) { animation-delay: .8s; }
.hero-kolam .k-line:nth-child(4) { animation-delay: 1.2s; } .hero-kolam .k-line:nth-child(5) { animation-delay: 1.6s; }
.hero-kolam .k-dot { fill: currentColor; opacity: 0; animation: fadeIn 1s ease forwards; animation-delay: calc(1.8s + var(--d, 0s)); }
.hero-content { max-width: 760px; }
.hero h1 { font-size: clamp(3rem, 8vw, 6.4rem); line-height: .95; margin: 0 0 14px; color: var(--hero-ink); letter-spacing: -.02em; }
.hero h1 em { font-style: italic; font-weight: 500; color: var(--gold); }
.hero .ta-title { font: 600 clamp(1.4rem, 3.2vw, 2.3rem)/1.3 var(--serif-ta); margin-bottom: 26px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold), var(--kumkum)); -webkit-background-clip: text; background-clip: text; color: transparent; }
:lang(ta) .hero h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.2; }
.hero p.lede { font-size: clamp(1.05rem, 1.6vw, 1.22rem); line-height: 1.75; color: var(--ink-soft); max-width: 640px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.hero .btn { min-height: 52px; padding: 0 26px; font-size: .98rem; }
.hero-scroll { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-faint); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; }
.hero-scroll::after { content: ""; width: 1px; height: 38px; background: linear-gradient(var(--gold), transparent); animation: flicker 2s ease-in-out infinite; }

/* hero photographs (photo mode) */
.hero-photos { position: absolute; inset: 0; z-index: -4; overflow: hidden; background: #0b0907; }
.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.1);
  transition: opacity 1.8s ease, transform 9s cubic-bezier(.25, .1, .25, 1); will-change: opacity, transform; }
.hero-photo.on { opacity: 1; transform: scale(1); }
.hero-shade { position: absolute; inset: 0; z-index: -3; pointer-events: none; opacity: 0; transition: opacity 1.2s;
  background:
    linear-gradient(90deg, rgba(9, 6, 3, .92) 0%, rgba(9, 6, 3, .72) 34%, rgba(9, 6, 3, .28) 66%, rgba(9, 6, 3, .4) 100%),
    linear-gradient(180deg, rgba(9, 6, 3, .6) 0%, transparent 22%, transparent 62%, var(--bg) 100%); }
.hero.has-photos .hero-shade { opacity: 1; }
.hero.has-photos .hero-aura { display: none; }
.hero.has-photos .hero-kolam { opacity: .2; color: #f0cd8a; mix-blend-mode: screen; }
.hero.has-photos h1 { color: #fbf3e4; text-shadow: 0 2px 30px rgba(0, 0, 0, .5); }
.hero.has-photos .lede { color: rgba(251, 243, 228, .86); text-shadow: 0 1px 12px rgba(0, 0, 0, .45); }
.hero.has-photos h1 em, .hero.has-photos .eyebrow { color: #f0cd8a; }
.hero.has-photos .btn:not(.primary) { background: rgba(255, 255, 255, .08); color: #fbf3e4; border-color: rgba(255, 255, 255, .28); backdrop-filter: blur(12px); }
.hero.has-photos .btn:not(.primary):hover { border-color: #f0cd8a; color: #fff; }
.hero.has-photos kbd { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: rgba(251, 243, 228, .8); }
.hero.has-photos .hero-scroll { display: none; }
.hero-foot { position: absolute; left: 0; right: 0; bottom: 64px; display: flex; align-items: end; justify-content: space-between; gap: 20px;
  opacity: 0; transition: opacity 1s .6s; pointer-events: none; }
.hero.has-photos .hero-foot { opacity: 1; pointer-events: auto; }
.hero-dots { display: flex; gap: 8px; }
.hero-dots button { width: 44px; height: 22px; padding: 9px 0; border: 0; background: none; cursor: pointer; }
.hero-dots i { display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .28); overflow: hidden; position: relative; }
.hero-dots button.on i::after { content: ""; position: absolute; inset: 0; background: #f0cd8a; transform-origin: left; animation: dotfill 7s linear forwards; }
@keyframes dotfill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hero-credit { display: inline-flex; align-items: center; gap: 10px; max-width: min(560px, 60vw); padding: 9px 14px; border-radius: 999px;
  background: rgba(9, 6, 3, .45); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, .14); color: rgba(251, 243, 228, .9); font-size: .78rem; }
.hero-credit:hover { color: #fff; border-color: rgba(240, 205, 138, .5); }
.hero-credit .i { color: #f0cd8a; flex: none; }
.hero-credit b { font-weight: 600; white-space: nowrap; }
.hero-credit span { opacity: .75; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* the transparent header over a photo uses light ink until the page scrolls */
.topbar.on-hero.photo:not(.scrolled) { --ink: #fbf3e4; --ink-soft: rgba(251, 243, 228, .85); --ink-faint: rgba(251, 243, 228, .65);
  --surface: rgba(255, 255, 255, .08); --surface-2: rgba(255, 255, 255, .14); --line: rgba(255, 255, 255, .18); --line-strong: rgba(255, 255, 255, .3); }
.topbar.on-hero.photo:not(.scrolled) .brand-text small { color: #f0cd8a; }
@media (max-width: 760px) {
  .hero-shade { background: linear-gradient(180deg, rgba(9, 6, 3, .35) 0%, rgba(9, 6, 3, .55) 30%, rgba(9, 6, 3, .78) 70%, var(--bg) 100%); }
  .hero.has-photos .hero-kolam { opacity: .1; }
  .hero > * { min-width: 0; }
  .hero-foot { position: static; margin-top: 26px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero-credit { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .hero-photo { transform: none !important; } .hero-dots button.on i::after { animation: none; transform: none; } }

.stats-band { position: relative; margin-top: -40px; z-index: 2; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); border-radius: var(--radius-lg); overflow: hidden; }
.stat { padding: 26px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font: 600 clamp(1.8rem, 3vw, 2.5rem)/1 var(--display); color: var(--ink); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.stat span { font-size: .82rem; color: var(--ink-soft); letter-spacing: .02em; }
.stat .i { color: var(--gold); margin-bottom: 12px; width: 22px; height: 22px; }

.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.door { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 300px; padding: 30px; border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; overflow: hidden; isolation: isolate; }
.door:hover { color: var(--ink); }
.door::before { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--door, var(--gold)) 30%, transparent), transparent 70%); transition: transform .8s var(--ease); }
.door:hover::before { transform: scale(1.35); }
.door-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; color: var(--door, var(--gold));
  background: color-mix(in srgb, var(--door, var(--gold)) 12%, transparent); border: 1px solid color-mix(in srgb, var(--door, var(--gold)) 30%, transparent); margin-bottom: 8px; }
.door-icon .i { width: 28px; height: 28px; }
.door h2 { font-size: 2.1rem; margin: 0; }
.door p { color: var(--ink-soft); margin: 0; }
.door .door-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--door, var(--gold)); font-weight: 600; }
.door-year { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.door-year input { flex: 1 1 100px; width: auto; min-height: 42px; }
.door-year select { width: auto; min-height: 42px; }
.door-year .btn { min-height: 42px; }

.coll-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.coll-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 24px; min-height: 210px; border-radius: var(--radius);
  color: #fff8ec; text-decoration: none; overflow: hidden; isolation: isolate; background: var(--cg); box-shadow: var(--shadow); }
.coll-tile:hover { color: #fff8ec; }
.coll-tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background:
  radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .22), transparent 45%), linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .35)); }
.coll-tile .ct-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25); margin-bottom: auto; }
.coll-tile .ct-icon .i { width: 22px; height: 22px; }
.coll-tile h3 { color: inherit; font: 600 1.45rem/1.25 var(--serif-ta); margin: 14px 0 2px; }
.coll-tile .ct-en { font-size: .84rem; opacity: .82; }
.coll-tile .ct-count { font: 600 .8rem var(--sans); opacity: .9; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
[data-coll="literature"] { --cg: linear-gradient(140deg, #b8662a, #7d2a14 70%, #4a170c); }
[data-coll="magazines"] { --cg: linear-gradient(140deg, #2f6d78, #1c3f57 70%, #10233a); }
[data-coll="articles"] { --cg: linear-gradient(140deg, #4f7a3e, #2c4d2b 70%, #1a2f1c); }
[data-coll="speeches"] { --cg: linear-gradient(140deg, #8a3d6b, #521f45 70%, #2e1028); }
[data-coll="records"] { --cg: linear-gradient(140deg, #6b5a3a, #3e3221 70%, #241c12); }
[data-coll="all"] { --cg: linear-gradient(140deg, #9b7a3a, #5c431a 70%, #33240c); }

.feature-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.era-ribbon { display: flex; height: 54px; border-radius: 14px; overflow: hidden; margin: 22px 0 10px; box-shadow: var(--shadow-sm); }
.era-ribbon a { flex: 1; position: relative; transition: flex .5s var(--ease); }
.era-ribbon a:hover { flex: 2.4; }
.era-ribbon a span { position: absolute; left: 10px; bottom: 8px; font: 600 .7rem/1.2 var(--sans); color: rgba(255, 255, 255, .92); opacity: 0; white-space: nowrap;
  transition: opacity .3s; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.era-ribbon a:hover span { opacity: 1; }
.otd-card h3 { display: flex; align-items: center; gap: 10px; }
.otd-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.otd-list a { display: flex; gap: 14px; align-items: baseline; color: var(--ink); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.otd-list a:hover { border-color: var(--gold); }
.otd-list .y { font: 600 1.1rem var(--display); color: var(--gold); min-width: 54px; }

.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 260px); gap: 18px; overflow-x: auto; padding: 4px 4px 20px; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.rail > * { scroll-snap-align: start; }

/* ==========================================================================
   COVERS & ITEM CARDS (archive, library, rails)
   ========================================================================== */
.cover { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 16px 16px 14px;
  color: #fff6e6; background: var(--cg, linear-gradient(140deg, #8a6a33, #4b3516)); overflow: hidden; isolation: isolate; text-align: left; }
.cover::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(0, 0, 0, .28) 0 6px, rgba(255, 255, 255, .1) 6px 7px, transparent 7px),
              radial-gradient(circle at 80% 10%, rgba(255, 255, 255, .18), transparent 45%); }
.cover::after { content: ""; position: absolute; inset: 10px 10px 10px 16px; border: 1px solid rgba(255, 235, 200, .28); border-radius: 4px; z-index: -1; }
.cover { filter: hue-rotate(calc(var(--tone, 0) * 7deg)) brightness(calc(1 + var(--tone, 0) * 0.06)); }
.cover .cv-kind { display: flex; align-items: center; gap: 6px; font: 600 .62rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.cover .cv-title { font: 600 1.05rem/1.35 var(--serif-ta); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35); padding-left: 4px; }
.cover .cv-year { font: 600 .9rem var(--display); opacity: .9; padding-left: 4px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.item-card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); overflow: hidden; color: var(--ink); }
.item-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; height: 100%; }
.item-link:hover { color: inherit; }
.item-thumb { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.item-card:hover .item-thumb img { transform: scale(1.06); }
.item-thumb .icon { color: var(--gold); }
.item-thumb .badge { position: absolute; left: 10px; top: 10px; z-index: 2; }
.item-thumb .badge .pill { background: rgba(0, 0, 0, .55); color: #fff3df; border-color: rgba(255, 255, 255, .18); backdrop-filter: blur(8px); }
.item-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item-body h3 { font: 600 1.06rem/1.35 var(--display); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:lang(ta) .item-body h3, .item-body h3[lang="ta"] { font-family: var(--serif-ta); font-size: .98rem; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--ink-faint); }
.item-meta .dot::before { content: "·"; margin: 0 2px; }
.item-aff { font-size: .8rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: auto; }
.tl-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .82rem; }
.hits { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 2px; background: color-mix(in srgb, var(--gold) 4%, transparent); }
.hit { display: flex; gap: 8px; align-items: baseline; text-align: left; font-size: .8rem; line-height: 1.5; color: var(--ink-soft); text-decoration: none;
  background: none; border: 0; padding: 7px 8px; border-radius: 8px; width: 100%; }
.hit:hover { background: var(--surface-2); color: var(--ink); }
.hit.more { color: var(--gold); font-weight: 600; }
.hit-page { flex: none; font: 700 .7rem var(--sans); color: var(--gold); }

/* ==========================================================================
   ARCHIVE (filters rail + results)
   ========================================================================== */
.archive-layout { display: grid; grid-template-columns: 260px 1fr; gap: 34px; align-items: start; }
.filter-rail { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 22px; }
.filter-rail h4 { font: 600 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 10px; }
.filter-list { display: grid; gap: 2px; }
.filter-list a, .filter-list button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink-soft);
  font-size: .9rem; text-decoration: none; background: none; border: 0; text-align: left; width: 100%; }
.filter-list a:hover, .filter-list button:hover { background: var(--surface-2); color: var(--ink); }
.filter-list .on { background: color-mix(in srgb, var(--gold) 13%, transparent); color: var(--ink); font-weight: 600; }
.filter-list .on .i { color: var(--gold); }
.filter-list .i { color: var(--ink-faint); }
.results-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.results-bar .search-box { flex: 1 1 320px; position: relative; }
.results-bar .search-box .i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); }
.results-bar .search-box input { padding-left: 46px; border-radius: 999px; min-height: 50px; }
.results-count { font-size: .9rem; color: var(--ink-soft); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 24px; }
.filters input[type=search] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }

/* ==========================================================================
   LIBRARY
   ========================================================================== */
.collections { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.coll-card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 18px; min-height: 260px; padding: 32px; border-radius: var(--radius-lg);
  color: #fff8ec; text-decoration: none; overflow: hidden; isolation: isolate; background: var(--cg); box-shadow: var(--shadow); }
.coll-card:hover { color: #fff8ec; }
.coll-card::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 90% 10%, rgba(255, 255, 255, .2), transparent 45%), linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, .3)); }
.coll-card .cc-art { position: absolute; right: -30px; bottom: -40px; z-index: -1; opacity: .13; }
.coll-card .cc-art .i { width: 240px; height: 240px; stroke-width: 1; }
.coll-card h2 { color: inherit; font: 600 clamp(1.7rem, 3vw, 2.3rem)/1.25 var(--serif-ta); margin: 18px 0 4px; }
.coll-card .cc-en { font: 500 1.1rem var(--display); opacity: .85; }
.coll-card p { opacity: .82; margin: 14px 0 0; max-width: 440px; font-size: .95rem; }
.coll-card .cc-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .25); }
.coll-card .cc-icon .i { width: 26px; height: 26px; }
.coll-card .cc-stats { grid-column: 1 / -1; display: flex; gap: 28px; align-items: end; margin-top: auto; }
.coll-card .cc-stats strong { display: block; font: 600 1.9rem/1 var(--display); }
.coll-card .cc-stats span { font-size: .78rem; opacity: .8; }
.coll-card .cc-bar { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; align-self: center; }
.coll-card .cc-bar i { display: block; height: 100%; background: #fff2d6; border-radius: 4px; }
.coll-card .cc-go { position: absolute; right: 26px; top: 26px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .15); transition: transform .4s var(--ease), background .3s; }
.coll-card:hover .cc-go { transform: rotate(-45deg); background: rgba(255, 255, 255, .28); }
.library-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 22px; }
.mini-door { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.mini-door:hover { color: var(--ink); }
.mini-door .md-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); color: var(--gold); flex: none; }
.mini-door strong { display: block; font: 600 1.15rem var(--display); }
.mini-door span { font-size: .86rem; color: var(--ink-soft); }
.mini-door > .i { margin-left: auto; color: var(--ink-faint); }

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.head-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 22px; color: var(--ink-soft); font-size: .88rem; }
.head-facts span { display: inline-flex; align-items: center; gap: 7px; }
.head-facts .i { color: var(--gold); width: 16px; height: 16px; }
.head-facts b { font: 600 1.15rem/1 var(--display); color: var(--ink); }
.head-facts kbd { font-size: .7rem; }
.tl-filters { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.tl-filters .era-bar { flex: 1 1 auto; min-width: 0; padding: 2px 0; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.tl-filters-end { display: flex; gap: 10px; align-items: center; flex: none; }
.tl-controls { position: sticky; top: var(--header-h); z-index: 60; padding: 16px 22px 10px; border-radius: 22px;
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent); backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: box-shadow .3s, border-radius .3s; }
.tl-controls.stuck { box-shadow: var(--shadow); border-radius: 0 0 22px 22px; border-top-color: transparent; }
.tl-console { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.tl-now { min-width: 0; }
.tl-now-era { display: inline-flex; align-items: center; gap: 8px; font: 600 .72rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
:lang(ta) .tl-now-era { letter-spacing: 0; text-transform: none; font-size: .8rem; }
.tl-now-era i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.tl-now-date { font: 600 clamp(1.5rem, 3vw, 2.1rem)/1.1 var(--display); color: var(--ink); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: lining-nums; }
.tl-now-year { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .8rem; color: var(--gold); }
.tl-now-year .i { width: 14px; height: 14px; transition: transform .2s; }
.tl-now-year:hover .i { transform: translateX(3px); }
.tl-transport { display: flex; align-items: center; gap: 10px; }
.btn.round { border-radius: 999px; }
.btn.icon-only.round { width: 46px; height: 46px; padding: 0; justify-content: center; }
.btn.play { min-height: 56px; padding: 0 28px 0 22px; font-size: 1rem; }
.btn.play .i { width: 20px; height: 20px; }
.btn.play.playing { animation: pulseGold 2.4s ease-in-out infinite; }
@keyframes pulseGold { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--gold) 18%, transparent), var(--glow); } }
.tl-jump-btn { justify-self: end; }
.tl-jump-btn.on { border-color: var(--gold); color: var(--gold); }
.travel { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin: 16px 0 4px; padding: 16px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line); animation: pageIn .3s var(--ease); }
.travel[hidden] { display: none; }
.travel label { display: grid; gap: 6px; font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
:lang(ta) .travel label { text-transform: none; letter-spacing: 0; }
.travel label.grow { flex: 1 1 120px; }
.travel input[type=number], .travel select { min-height: 44px; width: 100%; }
.travel input[name=day] { width: 76px; }
.travel .btn { min-height: 44px; }
.scrub-bubble { position: absolute; bottom: 30px; transform: translateX(-50%); padding: 5px 11px; border-radius: 8px; background: var(--ink); color: var(--bg);
  font: 600 .82rem/1 var(--sans); white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); }
.scrub-bubble[hidden] { display: none; }
.scrubber { position: relative; margin-top: 14px; height: 30px; }
.scrub-track { position: absolute; left: 0; right: 0; top: 11px; height: 8px; display: flex; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.scrub-track span { flex: 1; }
.scrubber input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: grab; }
.scrubber input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-solid);
  border: 3px solid var(--gold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 20%, transparent), var(--shadow); }
.scrubber input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-solid); border: 3px solid var(--gold); }
.scrubber input[type=range]::-moz-range-track { background: transparent; }
.era-bar { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.era-bar::-webkit-scrollbar { display: none; }
.era-chip { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px 6px 10px;
  font: 500 .8rem/1 var(--sans); color: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; }
.era-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gold)); }
.era-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.era-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.timeline { position: relative; padding: 40px 0 100px; }
.timeline::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-1px);
  background: linear-gradient(transparent, var(--line-strong) 6%, color-mix(in srgb, var(--gold) 60%, transparent) 50%, var(--line-strong) 94%, transparent); }
.era-marker { position: relative; text-align: center; margin: 56px 0 30px; z-index: 1; }
.era-marker span { display: inline-block; padding: 10px 22px; border-radius: 999px; color: #fff8ec; font: 600 1.05rem var(--display);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .25); }
:lang(ta) .era-marker span { font-family: var(--serif-ta); font-size: .95rem; }
.era-marker small { display: block; color: var(--ink-faint); margin-top: 8px; font-size: .82rem; }
.tl-event { position: relative; width: 50%; padding: 12px 44px; opacity: 0; transition: opacity .8s var(--ease), transform .8s var(--ease); }
.tl-event.left { left: 0; transform: translateX(-30px); }
.tl-event.right { left: 50%; transform: translateX(30px); }
.tl-event.visible { opacity: 1; transform: none; }
.tl-event::after { content: ""; position: absolute; top: 34px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg);
  border: 2px solid var(--gold); z-index: 2; transition: transform .35s var(--ease), background .3s, box-shadow .3s; }
.tl-event.left::after { right: -7px; }
.tl-event.right::after { left: -7px; }
.tl-event.is-doc::after { border-radius: 4px; transform: rotate(45deg); border-color: var(--gold-2); }
.tl-event.active::after { background: var(--gold); transform: scale(1.4); box-shadow: 0 0 0 8px color-mix(in srgb, var(--gold) 20%, transparent), 0 0 30px var(--gold); }
.tl-event.is-doc.active::after { transform: rotate(45deg) scale(1.4); }
.tl-card { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(14px); transition: border-color .35s, box-shadow .45s var(--ease), transform .45s var(--ease); }
.tl-event.active .tl-card { border-color: color-mix(in srgb, var(--gold) 55%, transparent); box-shadow: var(--glow); }
.tl-year { display: inline-flex; align-items: center; gap: 8px; font: 600 .82rem/1 var(--sans); letter-spacing: .06em; color: var(--gold); margin-bottom: 10px; }
.tl-year a { color: inherit; }
.tl-card h3 { font-size: 1.4rem; margin: 0 0 4px; }
.tl-card .ta { color: var(--ink-faint); font-size: .95rem; margin-bottom: 10px; display: block; }
.tl-card p { margin: 8px 0 12px; color: var(--ink-soft); font-size: .96rem; }
.docs-btn { margin-top: 6px; }
.ev-docs { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.doc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.doc-tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); font-size: .78rem; line-height: 1.3; }
.doc-tile .item-thumb { border-radius: 10px; aspect-ratio: 3 / 4; }
.doc-tile .cover { padding: 8px; } .doc-tile .cover .cv-title { font-size: .72rem; -webkit-line-clamp: 3; } .doc-tile .cover .cv-kind, .doc-tile .cover .cv-year { display: none; }
.doc-tile span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tl-doc { display: grid; grid-template-columns: 96px 1fr; gap: 18px; color: var(--ink); text-decoration: none; }
.tl-doc:hover { color: var(--ink); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.doc-thumb { width: 96px; height: 124px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .cover { padding: 8px; } .doc-thumb .cover .cv-title { font-size: .72rem; } .doc-thumb .cover .cv-kind { display: none; }
.read-link { display: inline-flex; align-items: center; gap: 6px; font: 600 .84rem var(--sans); color: var(--gold); margin-top: 8px; }
.tl-edge { text-align: center; color: var(--ink-faint); font-size: .9rem; padding: 26px 0; position: relative; z-index: 1; }
.tl-edge span { background: var(--bg); padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); }
.otd { margin: 18px 0; }
.otd ul { margin: 12px 0 0; padding-left: 20px; }
.tl-footnote { color: var(--ink-faint); font-size: .84rem; max-width: 860px; }

/* ==========================================================================
   YEAR
   ========================================================================== */
.year-hero { position: relative; text-align: center; padding: clamp(40px, 7vw, 80px) 0 20px; overflow: hidden; isolation: isolate; }
.year-hero::before { content: ""; position: absolute; left: 50%; top: 40%; width: 600px; height: 340px; transform: translate(-50%, -50%); z-index: -1;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--era, var(--gold)) 30%, transparent), transparent 70%); filter: blur(20px); }
.year-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.year-nav > :first-child { justify-self: start; } .year-nav > :last-child { justify-self: end; }
.year-title h1 { font-size: clamp(4rem, 13vw, 9rem); line-height: .9; margin: 0; font-variant-numeric: lining-nums;
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--era, var(--gold)) 70%, var(--ink))); -webkit-background-clip: text; background-clip: text; color: transparent; }
:lang(ta) .year-title h1 { font-family: var(--display); font-size: clamp(3rem, 10vw, 7rem); }
.year-era { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 600; font-size: .95rem; }
.year-era::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--era, var(--gold)); box-shadow: 0 0 12px var(--era, var(--gold)); }
.year-jump { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 26px 0 10px; }
.year-jump input { width: 120px; } .year-jump select { width: auto; }
.month-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; margin: 26px 0 10px; }
.month-cell { position: relative; height: 104px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 8px 2px; transition: border-color .25s, transform .3s var(--ease); }
.month-cell .bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 13px 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 45%, transparent), color-mix(in srgb, var(--gold) 15%, transparent)); transition: height .9s var(--ease); }
.month-cell .m, .month-cell .n { position: relative; font-size: .76rem; }
.month-cell .n { font: 700 .95rem var(--display); }
.month-cell.empty { opacity: .4; cursor: default; }
.month-cell:not(.empty):hover { border-color: var(--gold); transform: translateY(-3px); }
.year-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 30px; }
.year-event { display: block; color: var(--ink); }
.year-event h3 { font-size: 1.25rem; margin: 6px 0 4px; }
.year-event p { font-size: .94rem; color: var(--ink-soft); margin: 8px 0; }
.year-colls { margin: 0 0 18px; flex-wrap: wrap; }
.year-timeline { position: relative; border-left: 1px solid var(--line-strong); margin-left: 10px; padding-left: 26px; }
.year-month { position: sticky; top: calc(var(--header-h) + 10px); z-index: 2; display: inline-flex; margin: 26px 0 12px; padding: 7px 16px;
  border-radius: 999px; background: var(--surface-solid); border: 1px solid var(--line-strong); font: 600 1rem var(--display); box-shadow: var(--shadow-sm); }
.year-month::before { content: ""; position: absolute; left: -33px; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 5px var(--bg); }
.year-doc { display: grid; grid-template-columns: 58px 1fr; gap: 16px; align-items: center; padding: 10px; border-radius: 14px; text-decoration: none; color: var(--ink);
  transition: background .2s; }
.year-doc:hover { background: var(--surface); color: var(--ink); }
.year-doc .doc-thumb { width: 58px; height: 74px; border-radius: 8px; }
.year-doc .doc-thumb .cover .cv-title { font-size: .55rem; -webkit-line-clamp: 3; } .year-doc .doc-thumb .cover .cv-year { display: none; }
.year-doc-title { font-weight: 500; line-height: 1.4; }
.year-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 4px; }

/* ==========================================================================
   ITEM VIEWER
   ========================================================================== */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 30px; padding: 24px 0 70px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-faint); margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-soft); } .crumbs a:hover { color: var(--gold); }
.viewer-title h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); margin-bottom: 8px; }
.viewer-title .sub { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--ink-soft); font-size: .92rem; margin-bottom: 20px; }
.stage { position: relative; background: radial-gradient(ellipse at top, #2a2117, #0d0a07 70%); border-radius: var(--radius-lg); min-height: 460px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid rgba(240, 205, 138, .12); }
.stage img { max-height: 80vh; object-fit: contain; margin: auto; cursor: zoom-in; transition: transform .5s var(--ease); }
.stage img.zoomed { transform: scale(2); cursor: zoom-out; }
.stage audio { margin: auto; width: 90%; }
/* ---------- book reader */
.stage.has-reader { background: none; border: 0; box-shadow: none; overflow: visible; min-height: 0; }
.viewer > * { min-width: 0; }
.viewer.wide { grid-template-columns: minmax(0, 1fr); }
.viewer.wide .side { position: static; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.reader { --r-ink: #f3e8d8; --r-line: rgba(240, 205, 138, .16); --r-desk: radial-gradient(120% 90% at 50% 0%, #33281c 0%, #17110b 55%, #0b0806 100%);
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; color: var(--r-ink); scroll-margin-top: calc(var(--header-h) + 10px);
  background: var(--r-desk); border: 1px solid var(--r-line); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .05); }
.reader.tone-sepia { --r-desk: radial-gradient(120% 90% at 50% 0%, #4a3620 0%, #241809 60%, #120c05 100%); }
.reader.tone-night { --r-desk: radial-gradient(120% 90% at 50% 0%, #15161c 0%, #08090c 70%); --r-line: rgba(160, 175, 210, .14); }
.reader-bar { position: relative; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: rgba(10, 8, 6, .55); backdrop-filter: blur(14px); border-bottom: 1px solid var(--r-line); }
.rb-group { display: flex; align-items: center; gap: 6px; }
.rb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--r-line); background: rgba(255, 255, 255, .05); color: var(--r-ink); font: 600 .82rem/1 var(--sans); cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s, color .2s; }
.rb-btn:hover { background: rgba(240, 205, 138, .12); border-color: rgba(240, 205, 138, .45); color: #fff; }
.rb-btn:active { transform: scale(.94); }
.rb-btn.on { color: #f0cd8a; border-color: rgba(240, 205, 138, .55); background: rgba(240, 205, 138, .12); }
.rb-btn .i { width: 18px; height: 18px; }
.rb-sep { width: 1px; height: 22px; background: var(--r-line); margin: 0 4px; }
.rb-page { display: inline-flex; align-items: center; gap: 8px; font: 600 .86rem/1 var(--sans); color: rgba(243, 232, 216, .75); }
.rb-page input { width: 58px; height: 38px; padding: 0 6px; text-align: center; border-radius: 10px; background: rgba(0, 0, 0, .35);
  border: 1px solid var(--r-line); color: #fff; font: 600 .95rem/1 var(--sans); -moz-appearance: textfield; }
.rb-page input::-webkit-inner-spin-button { -webkit-appearance: none; }
.rb-page b { color: var(--r-ink); }
.rb-modes { padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, .3); border: 1px solid var(--r-line); gap: 2px; }
.rb-modes button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px; border: 0; border-radius: 10px; background: none;
  color: rgba(243, 232, 216, .7); font: 600 .82rem/1 var(--sans); cursor: pointer; transition: background .25s, color .25s; }
.rb-modes button .i { width: 16px; height: 16px; }
.rb-modes button:hover { color: #fff; }
.rb-modes button.on { background: linear-gradient(135deg, #f3d395, #c9933a); color: #1a1208; box-shadow: 0 4px 14px rgba(201, 147, 58, .35); }
.rb-modes button:disabled { opacity: .35; cursor: not-allowed; }
.rb-mark { position: relative; }
.rb-mark.on { color: #f0cd8a; }
.rb-mark.on .i { fill: currentColor; }
.rb-mark .tick { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round;
  stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; opacity: 0; pointer-events: none; }
.rb-mark.pop { animation: markPop .7s var(--ease); }
.rb-mark.pop .i { animation: starHide .9s ease; }
.rb-mark.pop .tick { animation: tickDraw .9s ease; }
@keyframes markPop { 0% { transform: scale(1); } 30% { transform: scale(1.25); background: #c9933a; box-shadow: 0 0 0 10px rgba(240, 205, 138, .18); } 100% { transform: scale(1); } }
@keyframes starHide { 0%, 100% { opacity: 1; } 20%, 70% { opacity: 0; } }
@keyframes tickDraw { 0% { opacity: 0; stroke-dashoffset: 24; } 20% { opacity: 1; } 55% { stroke-dashoffset: 0; opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: 0; } }
.reader-progress { height: 3px; background: rgba(255, 255, 255, .06); }
.reader-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c9933a, #f3d395); box-shadow: 0 0 12px rgba(240, 205, 138, .6);
  transition: width .6s var(--ease); }
.reader-stage { position: relative; display: grid; place-items: center; overflow: auto; outline: none; padding: 28px clamp(14px, 3vw, 40px);
  height: clamp(480px, calc(100vh - var(--header-h) - 190px), 1600px); perspective: 2400px; overscroll-behavior: contain; }
.viewer.wide .reader-stage { height: clamp(520px, calc(100vh - var(--header-h) - 150px), 1800px); }
.reader-stage.zoomed { place-items: start center; }
.reader[data-mode="scroll"] .reader-stage { display: block; }
.reader-stage.bump { animation: bump .35s ease; }
@keyframes bump { 30% { transform: translateX(-8px); } 60% { transform: translateX(6px); } }
.reader-stage::-webkit-scrollbar { width: 10px; height: 10px; }
.reader-stage::-webkit-scrollbar-thumb { background: rgba(240, 205, 138, .25); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.spread { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; opacity: 0; }
.spread.ready { opacity: 1; }
.spread.leaving { z-index: 0; }
.sheet { position: relative; flex: none; background: #fbf8f1; border-radius: 3px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 2px 4px rgba(0, 0, 0, .25), 0 24px 60px -10px rgba(0, 0, 0, .7); }
.sheet:not(.painted)::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(201, 147, 58, .14) 50%, transparent 70%) 0 0 / 250% 100%, repeating-linear-gradient(180deg, transparent 0 22px, rgba(0, 0, 0, .05) 22px 24px) 12% 14% / 76% 72% no-repeat, #f3ede0;
  animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -250% 0, 12% 14%; } }
.sheet canvas { display: block; width: 100%; height: 100%; transition: filter .5s; }
.sheet .pno { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); padding: 3px 9px; border-radius: 999px; font: 600 .68rem/1 var(--sans);
  background: rgba(20, 14, 8, .55); color: #f3e8d8; opacity: 0; transition: opacity .3s; pointer-events: none; }
.sheet:hover .pno { opacity: 1; }
.tone-sepia .sheet { background: #f1e3c4; }
.tone-sepia .sheet canvas { filter: sepia(.55) saturate(1.15) brightness(.96) contrast(1.02); }
.tone-night .sheet { background: #16171b; }
.tone-night .sheet canvas { filter: invert(.9) hue-rotate(180deg) brightness(1.05) contrast(.92); }
/* open book: spine shadow, page curl light */
.spread.is-book .sheet.left { border-radius: 4px 0 0 4px; }
.spread.is-book .sheet.right { border-radius: 0 4px 4px 0; }
.spread.is-book .sheet.left::after, .spread.is-book .sheet.right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 14%; pointer-events: none; z-index: 2; }
.spread.is-book .sheet.left::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .08) 60%, rgba(0, 0, 0, .28)); }
.spread.is-book .sheet.right::after { left: 0; background: linear-gradient(270deg, transparent, rgba(0, 0, 0, .08) 60%, rgba(0, 0, 0, .28)); }
.spread.is-book.solo .sheet.cover { box-shadow: 6px 0 0 -2px #e9e2d2, 12px 0 0 -4px #d9d0bc, 0 24px 60px -10px rgba(0, 0, 0, .7); }
/* animations */
.enter-open { animation: bookOpen 1s var(--ease) both; transform-origin: 50% 60%; }
@keyframes bookOpen { from { opacity: 0; transform: perspective(1600px) rotateX(18deg) rotateY(-22deg) translateY(40px) scale(.86); filter: blur(4px); }
  60% { filter: blur(0); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .35s ease both; }
.slide-in-next { animation: slideInNext .55s var(--ease) both; }
.slide-in-prev { animation: slideInPrev .55s var(--ease) both; }
.slide-out-next { animation: slideOutNext .5s var(--ease) both; }
.slide-out-prev { animation: slideOutPrev .5s var(--ease) both; }
@keyframes slideInNext { from { opacity: 0; transform: perspective(1600px) translateX(18%) rotateY(-14deg); } to { opacity: 1; transform: none; } }
@keyframes slideInPrev { from { opacity: 0; transform: perspective(1600px) translateX(-18%) rotateY(14deg); } to { opacity: 1; transform: none; } }
@keyframes slideOutNext { to { opacity: 0; transform: perspective(1600px) translateX(-22%) rotateY(18deg) scale(.94); } }
@keyframes slideOutPrev { to { opacity: 0; transform: perspective(1600px) translateX(22%) rotateY(-18deg) scale(.94); } }
.fold-out-next { transform-origin: left center; animation: foldOutNext .42s cubic-bezier(.55, 0, .9, .45) both; z-index: 3; }
.fold-out-prev { transform-origin: right center; animation: foldOutPrev .42s cubic-bezier(.55, 0, .9, .45) both; z-index: 3; }
.fold-in-next { transform-origin: right center; animation: foldInNext .45s cubic-bezier(.1, .55, .45, 1) .4s both; z-index: 4; }
.fold-in-prev { transform-origin: left center; animation: foldInPrev .45s cubic-bezier(.1, .55, .45, 1) .4s both; z-index: 4; }
@keyframes foldOutNext { to { transform: perspective(2000px) rotateY(-90deg); filter: brightness(.55); } }
@keyframes foldOutPrev { to { transform: perspective(2000px) rotateY(90deg); filter: brightness(.55); } }
@keyframes foldInNext { from { transform: perspective(2000px) rotateY(90deg); filter: brightness(.55); } to { transform: none; filter: none; } }
@keyframes foldInPrev { from { transform: perspective(2000px) rotateY(-90deg); filter: brightness(.55); } to { transform: none; filter: none; } }
.spread.leaving .sheet:not([class*="fold-out"]) { z-index: 2; position: relative; }
/* long scroll */
.scroll-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-bottom: 30px; }
/* loading, resume, finished */
.reader-loading { display: grid; justify-items: center; gap: 18px; color: rgba(243, 232, 216, .7); font-size: .9rem; }
.rl-book { position: relative; width: 120px; height: 84px; perspective: 600px; }
.rl-book i { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; background: #f3ede0; border-radius: 0 4px 4px 0; transform-origin: left center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: rlFlip 1.8s ease-in-out infinite; }
.rl-book i:nth-child(1) { animation-delay: 0s; } .rl-book i:nth-child(2) { animation-delay: .25s; background: #ebe3d2; } .rl-book i:nth-child(3) { animation-delay: .5s; background: #e3d9c4; }
.rl-book::before { content: ""; position: absolute; top: 0; left: 0; width: 50%; height: 100%; background: #e3d9c4; border-radius: 4px 0 0 4px; }
@keyframes rlFlip { 0%, 15% { transform: rotateY(0); } 60%, 100% { transform: rotateY(-180deg); } }
.reader-error { margin: auto; text-align: center; color: var(--r-ink); }
.reader-resume { position: absolute; z-index: 6; left: 50%; top: 78px; transform: translateX(-50%); width: min(620px, calc(100% - 28px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-radius: 18px; font-size: .9rem;
  background: rgba(24, 18, 11, .88); backdrop-filter: blur(16px); border: 1px solid rgba(240, 205, 138, .35); box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  animation: resumeIn .6s var(--ease) .9s both; }
.reader-resume[hidden] { display: none; }
.reader-resume > span { flex: 1 1 200px; color: rgba(243, 232, 216, .8); }
.reader-resume b { color: #f0cd8a; display: block; font: 600 1.05rem var(--display); }
.reader-resume .btn.ghost { background: transparent; color: var(--r-ink); border-color: var(--r-line); }
.reader-resume.bye { animation: resumeOut .35s ease both; }
@keyframes resumeIn { from { opacity: 0; transform: translate(-50%, -16px) scale(.96); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes resumeOut { to { opacity: 0; transform: translate(-50%, -12px) scale(.96); } }
.rr-tick, .reader-done svg { width: 38px; height: 38px; flex: none; fill: none; stroke: #f0cd8a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.rr-tick circle, .reader-done circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: drawStroke .7s ease 1.2s forwards; }
.rr-tick path, .reader-done path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: drawStroke .45s ease 1.75s forwards; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
.reader-done { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 12px;
  padding: 26px 34px; border-radius: 22px; background: rgba(20, 15, 9, .9); backdrop-filter: blur(16px); border: 1px solid rgba(240, 205, 138, .4);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: resumeIn2 .5s var(--ease) both; }
.reader-done svg { width: 64px; height: 64px; }
.reader-done circle { animation-delay: .2s; } .reader-done path { animation-delay: .75s; }
.reader-done b { font: 600 1.3rem var(--display); color: #fbf3e4; }
.reader-done.bye { animation: fadeOut .5s ease both; }
@keyframes resumeIn2 { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes fadeOut { to { opacity: 0; } }
/* footer: page slider with bookmark ticks, bookmark chips */
.reader-foot { display: grid; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--r-line); background: rgba(10, 8, 6, .45); }
.rd-slider { position: relative; height: 22px; }
.rd-slider input { position: absolute; inset: 0; width: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; z-index: 2; }
.rd-slider::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.rd-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #f3d395; border: 3px solid #1a1208;
  box-shadow: 0 0 0 4px rgba(240, 205, 138, .25); }
.rd-slider input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #f3d395; border: 3px solid #1a1208; }
.rd-ticks { position: absolute; left: 9px; right: 9px; top: 4px; height: 14px; pointer-events: none; }
.rd-ticks i { position: absolute; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; background: #f0cd8a; box-shadow: 0 0 8px rgba(240, 205, 138, .7); }
.rd-marks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .8rem; color: rgba(243, 232, 216, .65); min-height: 30px; }
.rd-marks .i { width: 14px; height: 14px; color: #f0cd8a; }
.rd-marks-label, .rd-hint { display: inline-flex; align-items: center; gap: 6px; }
.rd-hint.keys { margin-left: auto; }
.rd-hint kbd { background: rgba(255, 255, 255, .08); border-color: var(--r-line); color: var(--r-ink); }
.rd-chip { display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid rgba(240, 205, 138, .35); background: rgba(240, 205, 138, .08);
  animation: fadeIn .3s ease; overflow: hidden; }
.rd-chip button { border: 0; background: none; color: #f3e8d8; font: 600 .78rem/1 var(--sans); padding: 7px 4px 7px 12px; cursor: pointer; }
.rd-chip button + button { padding: 7px 9px 7px 4px; opacity: .6; }
.rd-chip button:hover { color: #f0cd8a; opacity: 1; }
/* full screen */
.reader.is-full { border-radius: 0; border: 0; height: 100vh; }
.reader.is-full .reader-stage { flex: 1; height: auto; }
@media (max-width: 760px) {
  .reader-bar { padding: 10px; gap: 8px; }
  .rb-modes button span, .rb-tools .rb-btn span, .rb-wide, .rb-sep, .rd-hint.keys { display: none; }
  .rb-modes { order: 3; width: 100%; justify-content: stretch; }
  .rb-modes button { flex: 1; justify-content: center; }
  .reader-stage { padding: 16px 10px; height: calc(100svh - var(--header-h) - 230px); min-height: 420px; }
  .reader-resume { top: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .enter-open, .slide-in-next, .slide-in-prev, .fold-in-next, .fold-in-prev { animation: fadeIn .2s ease both !important; }
}
.at-source { margin: auto; max-width: 480px; text-align: center; color: #f3e8d8; padding: 50px 24px; }
.at-source .at-icon { width: 76px; height: 76px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 22px;
  background: rgba(240, 205, 138, .1); border: 1px solid rgba(240, 205, 138, .25); color: #f0cd8a; }
.at-source .at-icon .i { width: 34px; height: 34px; }
.at-source p { color: #d7c8b2; }
.at-source .small { opacity: .7; margin-top: 16px; }
.side { display: grid; gap: 18px; align-content: start; position: sticky; top: calc(var(--header-h) + 18px); }
.side .card h3 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.side .card h3 .i { color: var(--gold); }
.provenance dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: .9rem; }
.provenance dt { color: var(--ink-faint); font-size: .8rem; letter-spacing: .02em; padding-top: 1px; }
.provenance dd { margin: 0; overflow-wrap: anywhere; }
.affil-badge { position: relative; padding: 16px 16px 16px 18px; border-radius: 14px; margin: 0 0 18px; font-size: .9rem; line-height: 1.6;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, transparent), transparent); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); }
.affil-badge::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--gold); }
.side-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.side .fine { margin-top: 16px; font-size: .8rem; color: var(--ink-faint); line-height: 1.6; }
.time-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); grid-template-areas: "prev here next"; gap: 12px; margin: 0 0 18px; }
.tn-link { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: .88rem; text-decoration: none; transition: border-color .2s, transform .3s var(--ease); }
a.tn-link:hover { border-color: var(--gold); color: var(--ink); }
a.tn-link.prev:hover { transform: translateX(-3px); } a.tn-link.next:hover { transform: translateX(3px); }
.tn-link .i { color: var(--gold); flex: none; }
.tn-link span { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tn-link span b { font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tn-link small { color: var(--ink-faint); font-size: .74rem; }
.tn-link.prev { grid-area: prev; } .tn-link.next { grid-area: next; justify-content: flex-end; text-align: right; }
.tn-link.muted { color: var(--ink-faint); justify-content: center; }
.tn-here { grid-area: here; align-self: center; display: inline-flex; align-items: center; gap: 8px; max-width: 320px; padding: 8px 14px;
  border-radius: 999px; background: var(--surface-2); font-size: .82rem; color: var(--ink-soft); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.read-on { margin-top: 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 16%, var(--surface-solid)), var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.page-text { margin-top: 20px; }
.page-text summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.page-text summary::-webkit-details-marker { display: none; }
.page-text summary .i { color: var(--gold); transition: transform .3s; }
.page-text[open] summary .chev { transform: rotate(180deg); }
.ocr-text { white-space: pre-wrap; font: 400 1rem/1.85 var(--serif-ta); margin-top: 14px; max-height: 60vh; overflow-y: auto; padding-right: 8px; }
.in-results { max-height: 46vh; overflow-y: auto; margin: 0 -8px; }
.curate { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.curate summary { cursor: pointer; }
.description-card { margin-top: 20px; white-space: pre-line; color: var(--ink-soft); }

/* ==========================================================================
   MAP
   ========================================================================== */
.map-shell { position: relative; height: calc(100vh - var(--header-h)); min-height: 560px; }
#mapEl { position: absolute; inset: 0; z-index: 1; background: var(--surface-2); }
.map-panel { position: absolute; z-index: 500; left: 24px; top: 24px; width: min(380px, calc(100% - 48px)); border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-lg); }
.map-panel h1 { font-size: 2rem; margin-bottom: 6px; }
.map-panel p { font-size: .9rem; color: var(--ink-soft); margin: 0 0 14px; }
.map-legend { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-soft); max-height: 150px; overflow-y: auto; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
#mapEl .leaflet-tile-pane { filter: sepia(.35) saturate(.75) brightness(1.02) contrast(.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #mapEl .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) sepia(.35) saturate(.6); } }
:root[data-theme="dark"] #mapEl .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) sepia(.35) saturate(.6); }
.leaflet-popup-content-wrapper { border-radius: 16px !important; background: var(--surface-solid) !important; color: var(--ink) !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-tip { background: var(--surface-solid) !important; }
.leaflet-popup-content { font-family: var(--sans); font-size: .88rem; line-height: 1.55; margin: 16px 18px !important; }
.leaflet-popup-content strong { font: 600 1.05rem var(--display); }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-faint) !important; }
.gold-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; background: linear-gradient(135deg, var(--gold-2), var(--gold)); transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }

/* ==========================================================================
   FORMS PAGES: contribute
   ========================================================================== */
.form-layout { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; }
.steps { position: sticky; top: calc(var(--header-h) + 24px); list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: step; }
.steps li { counter-increment: step; }
.steps a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; color: var(--ink-soft); font-size: .92rem; }
.steps a::before { content: counter(step); width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-strong); font: 600 .82rem var(--sans); color: var(--ink-faint); transition: all .25s; }
.steps a:hover { background: var(--surface-2); color: var(--ink); }
.steps a.done::before { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.form-section { scroll-margin-top: calc(var(--header-h) + 24px); margin-bottom: 22px; }
.form-section > h3 { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; margin-bottom: 4px; }
.form-section > h3 .num { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font: 600 .9rem var(--sans);
  background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold); }
.form-section > p { color: var(--ink-soft); font-size: .92rem; margin-bottom: 4px; }
.dropzone { position: relative; display: grid; place-items: center; text-align: center; gap: 10px; padding: 40px 20px; margin-top: 14px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: all .25s; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--surface-2)); }
.dropzone .dz-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--surface-solid); color: var(--gold); box-shadow: var(--shadow-sm); }
.dropzone .dz-icon .i { width: 28px; height: 28px; }
.dropzone strong { font: 600 1.15rem var(--display); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-file { display: none; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.dropzone.has-file .dz-file { display: inline-flex; }
.dropzone.has-file .dz-prompt { display: none; }
.form-submit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.signin-card { max-width: 560px; text-align: center; padding: 44px 34px; }
.signin-card .i.xl { color: var(--gold); margin-bottom: 10px; }
.signin-card #gBig { display: flex; justify-content: center; margin-top: 20px; }

/* ==========================================================================
   SUPPORT
   ========================================================================== */
.support-hero { display: grid; grid-template-columns: 1fr 400px; gap: 40px; align-items: center; }
.support-hero .qr-card { margin-top: 56px; }
.qr-card { text-align: center; padding: 34px; border-radius: var(--radius-lg); position: relative; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 16%, var(--surface-solid)), var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  box-shadow: var(--glow); }
.qr-card h3 { display: flex; align-items: center; justify-content: center; gap: 10px; }
#qr { display: inline-block; padding: 16px; background: #fff; border-radius: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.qr-placeholder { width: 220px; height: 220px; margin: 16px auto; display: grid; place-items: center; border-radius: 18px; border: 1.5px dashed var(--line-strong); color: var(--ink-faint); }
.qr-placeholder .i { width: 56px; height: 56px; }
.uses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.use { padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.use .u-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--gold) 13%, transparent); color: var(--gold); margin-bottom: 14px; }
.use strong { display: block; font: 600 1.15rem var(--display); margin-bottom: 4px; }
.use span { font-size: .88rem; color: var(--ink-soft); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 14px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 6px; padding: 28px; border-radius: var(--radius-lg); }
.plan.featured { border-color: color-mix(in srgb, var(--gold) 50%, transparent); box-shadow: var(--glow); background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 9%, var(--surface-solid)), var(--surface-solid)); }
.plan .badge { position: absolute; top: 18px; right: 18px; }
.plan h3 { text-transform: capitalize; margin: 0; }
.plan .price { font: 600 2.6rem/1.1 var(--display); margin: 10px 0 2px; }
.plan .price small { font: 400 .9rem var(--sans); color: var(--ink-faint); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: .9rem; color: var(--ink-soft); }
.plan li { display: flex; gap: 10px; } .plan li .i { color: var(--jade); margin-top: 3px; }

/* ==========================================================================
   DEVELOPERS, ABOUT, ADMIN, SEARCH
   ========================================================================== */
.code-card { padding: 0; overflow: hidden; }
.code-card .code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.code-card .dots { display: flex; gap: 6px; } .code-card .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.code-card pre { margin: 0; border: 0; border-radius: 0; background: transparent; }
.key-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.key-form input { flex: 1 1 260px; width: auto; }
.prose { font-size: 1.08rem; line-height: 1.85; color: var(--ink-soft); }
.prose h2 { margin-top: 2.2em; color: var(--ink); }
.prose p:first-of-type::first-letter { float: left; font: 600 4.2em/.82 var(--display); color: var(--gold); padding: 6px 12px 0 0; }
:lang(ta) .prose p:first-of-type::first-letter { font-family: var(--serif-ta); font-size: 3.2em; }
.pull-quote { margin: 2em 0; padding: 26px 30px; border-radius: var(--radius); font: 500 italic 1.6rem/1.45 var(--display); color: var(--ink);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent); border-left: 3px solid var(--gold); }
:lang(ta) .pull-quote { font: 500 1.25rem/1.7 var(--serif-ta); }
.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 22px 0; }
.principle { padding: 22px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: .95rem; line-height: 1.65; color: var(--ink-soft); }
.principle .i { color: var(--gold); width: 24px; height: 24px; margin-bottom: 12px; display: block; }
.admin-table td .actions { display: flex; gap: 6px; }
.search-event { color: var(--ink); text-decoration: none; }
.search-event:hover { color: var(--ink); }
.search-years { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- additions for redesigned markup */
.item-thumb .cover, .doc-thumb .cover, .doc-tile .item-thumb .cover { position: absolute; inset: 0; }
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.item-thumb .badge { z-index: 2; }
.doc-thumb { position: relative; }
.results-bar .search-box { display: block; margin: 0; font-weight: 400; }
.year-event.card { text-decoration: none; }
.year-event.card:hover { color: var(--ink); }
.otd-card h3 .i { color: var(--gold); }
.item-meta .i { width: 13px; height: 13px; vertical-align: -2px; }
.tl-meta .i { width: 14px; height: 14px; vertical-align: -2px; }
.tl-meta a { display: inline-flex; align-items: center; gap: 4px; }
.coll-tile .ct-count .i { width: 13px; height: 13px; }
.viewer-title .sub .i { color: var(--gold); }
.read-on .i.lg { color: var(--gold); }
.stats .stat { position: relative; }
.stats .spinner { margin: 20px auto; display: block; }

.filter-details > summary { display: none; list-style: none; }
.filter-details > summary::-webkit-details-marker { display: none; }
.filter-groups { display: grid; gap: 22px; }
@media (max-width: 960px) {
  .filter-details > summary { display: inline-flex; }
  .filter-details[open] > summary { margin-bottom: 16px; }
  .filter-groups { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) { .filter-groups { grid-template-columns: 1fr; } }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .nav a .lbl { display: none; }
  .nav a { padding: 10px; }
  .nav .nav-support .lbl { display: inline; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3) { border-right: 0; }
  .coll-strip, .uses { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .support-hero { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .archive-layout, .form-layout, .viewer { grid-template-columns: 1fr; }
  .filter-rail { position: static; }
  .steps { display: none; }
  .side { position: static; }
  .doors, .feature-grid, .collections, .plans { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .topbar { gap: 10px; }
  .nav { display: none; }
  .search-trigger { flex: none; width: 40px; height: 40px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger span, .search-trigger kbd, .brand-text small, .hero kbd, .hero-scroll { display: none; }
  .hero .actions .btn { flex: 1 1 100%; }
  .brand-text strong { font-size: 1.12rem; }
  .tools .tool-btn:not(.lang-toggle):not(.theme-toggle) { display: none; }
  .auth-slot { display: none; }
  .tabbar { position: fixed; z-index: 1500; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px; border-radius: 22px; background: var(--glass); backdrop-filter: blur(20px) saturate(1.3); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 16px; border: 0; background: none;
    color: var(--ink-faint); font: 500 .66rem/1.1 var(--sans); }
  .tabbar .i { width: 22px; height: 22px; }
  .tabbar .active { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
  body { padding-bottom: 90px; }
  .hero { min-height: auto; padding-bottom: 70px; }
  .hero-kolam { width: 120vw; right: -50vw; opacity: .35; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  .stat:nth-child(2n) { border-left: 1px solid var(--line); }
  .coll-strip, .uses, .library-links, .principles, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; padding-top: 44px; }
  .filter-rail { grid-template-columns: 1fr; }
  .timeline::before { left: 20px; }
  .tl-event, .tl-event.right { width: 100%; left: 0; padding: 10px 0 10px 46px; transform: translateY(24px); }
  .tl-event.left::after, .tl-event.right::after { left: 13px; right: auto; }
  .era-marker { text-align: left; padding-left: 36px; }
  .tl-filters { flex-direction: column; align-items: stretch; }
  .tl-filters .era-bar { margin: 0 -16px; padding: 2px 16px; }
  .tl-filters-end { justify-content: space-between; }
  .tl-controls { padding: 12px 14px 6px; border-radius: 18px; margin: 0 -6px; }
  .tl-controls.stuck { border-radius: 0 0 18px 18px; }
  .tl-console { grid-template-columns: 1fr auto auto; gap: 8px; }
  .tl-now-date { font-size: 1.35rem; }
  .tl-now-year { display: none; }
  .tl-transport { gap: 6px; }
  .btn.icon-only.round { width: 40px; height: 40px; }
  .btn.play { min-height: 46px; width: 46px; padding: 0; justify-content: center; }
  .btn.play span { display: none; }
  .tl-jump-btn { width: 40px; height: 40px; min-height: 0; padding: 0; justify-content: center; border-radius: 999px; }
  .tl-jump-btn span { display: none; }
  .head-facts .kbd-hint { display: none; }
  .tl-doc { grid-template-columns: 74px 1fr; } .doc-thumb { width: 74px; height: 96px; }
  .month-strip { grid-template-columns: repeat(6, 1fr); }
  .year-nav { grid-template-columns: 1fr 1fr; } .year-title { grid-column: 1 / -1; order: -1; }
  .time-nav { grid-template-columns: 1fr 1fr; grid-template-areas: "here here" "prev next"; } .tn-here { max-width: none; justify-self: center; }
  .map-panel { left: 12px; right: 12px; top: 12px; width: auto; padding: 18px; }
  .map-panel .map-legend { display: none; }
  .items { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .coll-card { padding: 24px; min-height: 230px; }
  .toast { bottom: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal, .tl-event { opacity: 1; transform: none; }
  .hero-kolam .k-line { stroke-dashoffset: 0; } .hero-kolam .k-dot { opacity: 1; }
}

/* ==========================================================================
   CONTRIBUTE — what to share, how it works, joining, live preview
   ========================================================================== */
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 8px 0 34px; }
.share-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; align-items: start;
  padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.share-tile .st-icon { grid-row: span 2; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--gold);
  background: color-mix(in srgb, var(--gold) 13%, transparent); transition: transform .4s var(--ease); }
.share-tile:hover .st-icon { transform: rotate(-8deg) scale(1.08); }
.share-tile strong { font: 600 1.08rem var(--display); }
.share-tile > span:last-child { font-size: .86rem; color: var(--ink-soft); }
.journey { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 0 0 44px; padding: 30px 26px;
  border-radius: var(--radius-lg); border: 1px solid var(--line); background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 7%, var(--surface-solid)), var(--surface-solid)); }
.journey::before { content: ""; position: absolute; top: 56px; left: calc(16.6% + 10px); right: calc(16.6% + 10px); height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--kumkum), var(--jade)); transform-origin: left; transform: scaleX(0); transition: transform 1.6s var(--ease) .3s; }
.journey.in::before { transform: scaleX(1); }
.j-step { position: relative; display: grid; justify-items: center; text-align: center; gap: 8px; }
.j-dot { position: relative; z-index: 1; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; color: #1a1208;
  background: linear-gradient(135deg, #f3d395, #c9933a); box-shadow: 0 0 0 6px var(--surface-solid), var(--glow); }
.journey.in .j-dot { animation: popIn .6s var(--ease) both; animation-delay: var(--d); }
.j-dot i { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 .7rem/1 var(--sans);
  font-style: normal; background: var(--ink); color: var(--bg); }
.j-step strong { font: 600 1.15rem var(--display); margin-top: 6px; }
.j-step > span:last-child { font-size: .88rem; color: var(--ink-soft); max-width: 280px; }
@keyframes popIn { from { opacity: 0; transform: scale(.4); } 70% { transform: scale(1.08); } to { opacity: 1; transform: none; } }
.join { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; margin-bottom: 50px; }
.join-card { padding: 36px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--gold) 14%, var(--surface-solid)), var(--surface-solid)); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.join-icon { width: 70px; height: 70px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 22px; color: #1a1208;
  background: linear-gradient(135deg, #f3d395, #c9933a); box-shadow: var(--glow); animation: floatY 5s ease-in-out infinite; }
.join-icon .i { width: 30px; height: 30px; }
@keyframes floatY { 50% { transform: translateY(-6px); } }
.join-card h2 { font-size: 1.9rem; margin-bottom: 8px; }
.join-card #gBig { display: flex; justify-content: center; margin: 22px 0 6px; }
.join-card #gBig .btn, .join-card #gBig button { min-height: 50px; padding: 0 26px; font-size: 1rem; }
.promises { list-style: none; padding: 0; margin: 24px auto 0; display: grid; gap: 10px; text-align: left; max-width: 420px; }
.promises li { display: flex; gap: 12px; align-items: flex-start; font-size: .92rem; color: var(--ink-soft); }
.promises .i { flex: none; width: 20px; height: 20px; padding: 3px; border-radius: 50%; color: #fff; background: var(--jade); }
.join-side { display: grid; gap: 14px; padding-top: 6px; }
.credit-preview { margin: 0; box-shadow: var(--shadow-sm); }
.faq { max-width: 860px; margin: 0 auto 30px; }
.faq h2 { margin-bottom: 18px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 2px; cursor: pointer; list-style: none;
  font: 600 1.12rem var(--display); color: var(--ink); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { transition: transform .3s var(--ease); color: var(--gold); flex: none; }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item p { margin: 0 0 18px; color: var(--ink-soft); animation: fadeIn .35s ease; max-width: 720px; }
.contrib-guide { margin-bottom: 24px; padding: 0; }
.contrib-guide > summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; }
.contrib-guide > summary::-webkit-details-marker { display: none; }
.contrib-guide > summary .i:first-child { color: var(--gold); }
.contrib-guide > summary .chev { margin-left: auto; transition: transform .3s; }
.contrib-guide[open] > summary .chev { transform: rotate(180deg); }
.contrib-guide[open] > .share-grid, .contrib-guide[open] > .journey { margin: 0 20px 20px; }
.contrib-guide .journey { background: var(--surface-2); }
/* form rail: progress ring, steps, live preview */
.form-rail { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 18px; }
.form-rail .steps { position: static; }
.rail-progress { display: flex; align-items: center; gap: 14px; padding: 4px 6px; }
.rail-progress svg { width: 54px; height: 54px; transform: rotate(-90deg); flex: none; }
.rail-progress circle { fill: none; stroke: var(--surface-3); stroke-width: 4; }
.rail-progress .arc { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset .6s var(--ease), stroke .3s; }
.rail-progress.complete .arc { stroke: var(--jade); }
.rail-progress span { font-size: .9rem; color: var(--ink-soft); }
.rail-progress b { font: 600 1.6rem var(--display); color: var(--ink); }
.rail-progress small { display: block; color: var(--ink-faint); }
.steps a.done::before { content: "✓"; animation: popIn .4s var(--ease); }
.live-preview { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.lp-card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.lp-thumb { width: 64px; height: 80px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; color: var(--gold);
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 18%, var(--surface-2)), var(--surface-2)); border: 1px solid var(--line); }
.lp-thumb img { width: 100%; height: 100%; object-fit: cover; animation: fadeIn .4s ease; }
.lp-body { min-width: 0; display: grid; gap: 4px; }
.lp-body strong { font: 600 1rem/1.25 var(--display); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lp-body small { color: var(--ink-faint); font-size: .78rem; }
#lpCredit .affil-badge { font-size: .8rem; padding: 12px 12px 12px 14px; }
.dz-check { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--jade); }
.dz-check svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
.dropzone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--jade) 55%, transparent); background: color-mix(in srgb, var(--jade) 7%, var(--surface-2)); }
.dropzone.has-file .dz-check { animation: popIn .45s var(--ease); }
.dropzone.has-file .dz-check svg { animation: drawStroke .45s ease .25s forwards; }
.form-section.shake { animation: shake .45s ease; border-color: color-mix(in srgb, var(--kumkum) 50%, transparent); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.sent-overlay { position: fixed; inset: 0; z-index: 3500; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(8px); animation: fadeIn .3s ease; }
.sent-card { width: min(480px, 100%); text-align: center; padding: 38px 30px; border-radius: var(--radius-lg); background: var(--surface-solid); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); animation: sentIn .5s var(--ease) both; }
@keyframes sentIn { from { opacity: 0; transform: translateY(20px) scale(.94); } to { opacity: 1; transform: none; } }
.sent-card svg { width: 84px; height: 84px; fill: none; stroke: var(--jade); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sent-card circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: drawStroke .7s ease .2s forwards; }
.sent-card path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: drawStroke .45s ease .8s forwards; }
.sent-card h2 { margin: 14px 0 8px; }
.sent-card p { color: var(--ink-soft); }
.sent-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ==========================================================================
   SUPPORT — impact, giving card, ways to help
   ========================================================================== */
.support-hero { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; gap: 46px; }
.impact { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 560px; }
.impact-stat { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); }
.impact-stat > span { grid-row: span 2; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent); }
.impact-stat b { font: 600 1.7rem/1.1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.impact-stat small { color: var(--ink-faint); font-size: .8rem; }
.give-card { margin-top: clamp(30px, 6vw, 70px); padding: 28px; border-radius: var(--radius-lg); position: relative; overflow: hidden;
  background: radial-gradient(130% 80% at 100% 0%, color-mix(in srgb, var(--gold) 18%, var(--surface-solid)), var(--surface-solid) 60%);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); box-shadow: var(--glow), var(--shadow); display: grid; gap: 16px; }
.give-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 236, 200, .12) 50%, transparent 60%) -200% 0 / 200% 100% no-repeat; animation: sheen 6s ease-in-out infinite 1.5s; }
@keyframes sheen { 0%, 70% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.give-head { display: flex; align-items: center; gap: 14px; }
.give-head h3 { margin: 0; font-size: 1.4rem; }
.give-icon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #e07a4f, #b8442a);
  box-shadow: 0 8px 22px rgba(184, 68, 42, .35); animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(.98); } 45% { transform: scale(1.06); } }
.give-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.give-amounts button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 1rem var(--sans); cursor: pointer; transition: transform .15s, border-color .2s, background .2s, box-shadow .2s; }
.give-amounts button:hover { border-color: var(--gold); transform: translateY(-2px); }
.give-amounts button.on { background: linear-gradient(135deg, #f3d395, #c9933a); color: #1a1208; border-color: transparent; box-shadow: 0 6px 18px rgba(201, 147, 58, .35); }
.give-custom { display: flex; align-items: center; gap: 4px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); }
.give-custom span { color: var(--ink-faint); font-weight: 600; }
.give-custom input { border: 0; background: none; padding: 0; min-height: 44px; width: 100%; box-shadow: none; font-weight: 600; }
.give-qr { position: relative; justify-self: center; padding: 14px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.give-qr.pulse { animation: qrPulse .5s var(--ease); }
@keyframes qrPulse { 40% { transform: scale(.96); } }
.give-qr #qr { padding: 0; margin: 0; box-shadow: none; display: block; }
.qr-amt { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); padding: 5px 12px; border-radius: 999px; background: #1a1208; color: #f3d395;
  font: 700 .82rem/1 var(--sans); white-space: nowrap; }
.give-id { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.give-go { justify-content: center; min-height: 52px; }
.give-fine { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: .78rem; color: var(--ink-faint); }
.give-fine .i { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.give-soon { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.give-soon strong { font: 600 1.15rem var(--display); }
.give-soon p { margin: 6px 0 12px; }
.give-soon > p { grid-column: 1 / -1; margin: 0; }
.qr-ghost { position: relative; width: 120px; height: 120px; padding: 10px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.qr-ghost i { border-radius: 3px; background: color-mix(in srgb, var(--gold) 30%, transparent); animation: ghostBlink 2.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes ghostBlink { 0%, 100% { opacity: .15; } 50% { opacity: .7; } }
.qr-ghost > span { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
  background: var(--surface-solid); color: var(--gold); box-shadow: var(--shadow-sm); }
.uses { grid-template-columns: repeat(4, 1fr); }
.use { position: relative; overflow: hidden; }
.u-num { position: absolute; right: 16px; top: 10px; font: 600 2.4rem/1 var(--display); color: color-mix(in srgb, var(--gold) 22%, transparent); }
.ways { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.way { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; padding: 22px; }
.way .w-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.way strong { font: 600 1.2rem var(--display); }
.way p { margin: 4px 0 10px; font-size: .9rem; color: var(--ink-soft); }
.way button.link-arrow { border: 0; background: none; padding: 0; color: var(--gold); cursor: pointer; }
.plan { position: relative; }
.plan-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); margin-bottom: 8px; }

@media (max-width: 1100px) {
  .support-hero { grid-template-columns: 1fr; }
  .give-card { margin-top: 0; max-width: 560px; }
  .uses { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .form-rail { position: sticky; top: var(--header-h); z-index: 20; display: flex; align-items: center; gap: 12px; margin: 0 -16px; padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .rail-progress { padding: 0; gap: 8px; }
  .rail-progress svg { width: 40px; height: 40px; }
  .rail-progress b { font-size: 1.2rem; }
  .rail-progress small { display: none; }
  .form-rail .steps { display: flex; gap: 6px; flex: 1; justify-content: flex-end; }
  .form-rail .steps a { font-size: 0; padding: 4px; gap: 0; }
  .form-rail .steps a::before { font-size: .8rem; }
  .live-preview { display: none; }
  .share-grid { grid-template-columns: repeat(2, 1fr); }
  .join { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .share-grid { grid-template-columns: 1fr; gap: 10px; }
  .share-tile { padding: 14px; }
  .journey { grid-template-columns: 1fr; gap: 22px; padding: 24px 20px; }
  .journey::before { top: 50px; bottom: 50px; left: 46px; right: auto; width: 2px; height: auto; transform: scaleY(0); transform-origin: top;
    background: linear-gradient(180deg, var(--gold), var(--kumkum), var(--jade)); }
  .journey.in::before { transform: scaleY(1); }
  .j-step { grid-template-columns: 54px 1fr; justify-items: start; text-align: left; column-gap: 16px; row-gap: 2px; }
  .j-dot { grid-row: span 2; }
  .j-step strong { margin-top: 2px; }
  .join-card { padding: 28px 20px; }
  .impact-stat { padding: 12px 14px; }
  .impact-stat b { font-size: 1.35rem; }
  .uses { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .use { padding: 16px; }
  .use span:last-child { font-size: .8rem; }
  .u-num { font-size: 1.7rem; }
  .ways { grid-template-columns: 1fr; }
  .give-amounts { grid-template-columns: repeat(3, 1fr); }
  .give-card { padding: 22px 18px; }
  .give-soon { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .impact { gap: 8px; }
  .impact-stat { column-gap: 10px; padding: 12px; }
  .impact-stat > span { width: 32px; height: 32px; border-radius: 10px; }
  .impact-stat > span .i { width: 16px; height: 16px; }
  .impact-stat small { font-size: .74rem; line-height: 1.25; }
}

/* tablet header: everything must fit in one row */
@media (max-width: 1100px) and (min-width: 761px) {
  .topbar { gap: 12px; }
  .search-trigger { flex: 0 1 220px; min-width: 44px; }
  .search-trigger kbd { display: none; }
  #authSlot .btn { font-size: 0; gap: 0; width: 40px; padding: 0; justify-content: center; }
  #authSlot .btn .i { width: 18px; height: 18px; }
}
@media (max-width: 900px) and (min-width: 761px) {
  .search-trigger { flex: none; width: 40px; padding: 0; justify-content: center; }
  .search-trigger span { display: none; }
  .brand-text small { display: none; }
}

/* ---------- image sets */
.gallery-stage { place-items: center; }
.gallery-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; box-shadow: 0 24px 60px -10px rgba(0, 0, 0, .7); border-radius: 3px; grid-area: 1 / 1; }
.gallery-stage.zoomed { place-items: start center; }
.gallery-stage img.is-zoomed { max-width: none; max-height: none; cursor: zoom-out; }
.gallery-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px; border-top: 1px solid var(--r-line); background: rgba(10, 8, 6, .45); }
.gallery-strip button { flex: none; width: 66px; height: 66px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: rgba(255, 255, 255, .05); cursor: pointer; opacity: .65; transition: opacity .2s, border-color .2s; }
.gallery-strip button:hover { opacity: 1; }
.gallery-strip button.on { opacity: 1; border-color: #f0cd8a; }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- open resources */
.res-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.res-tools input { flex: 1 1 260px; }
.res-tools select { flex: 0 1 220px; width: auto; }
.res-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.res-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--ink); text-decoration: none; min-width: 0; }
.res-card:hover { color: var(--ink); }
.res-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.res-head strong { font: 600 1.08rem var(--display); overflow-wrap: anywhere; }
.res-head .i { flex: none; width: 15px; height: 15px; color: var(--ink-faint); }
.res-owner { overflow-wrap: anywhere; }
.res-card p { margin: 4px 0 8px; font-size: .9rem; color: var(--ink-soft); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.res-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.res-meta .i { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- phones: Tamil labels run longer than English ones */
.res-cats .era-chip { white-space: normal; text-align: left; line-height: 1.3; }
@media (max-width: 480px) {
  .tools .theme-toggle { display: none; }   /* it is under "More" */
  .topbar { gap: 8px; padding: 0 12px; }
  .brand-text strong { font-size: .95rem; }
  .tl-filters-end { flex-wrap: wrap; }
  .tl-filters-end .seg { max-width: 100%; }
  .tl-filters-end .seg button { padding: 7px 10px; flex: 1 1 auto; }
}
.pill { max-width: 100%; white-space: normal; }
.res-card, .res-grid > * { min-width: 0; }
.year-doc-body { min-width: 0; overflow-wrap: anywhere; }

main, .footer { overflow-x: clip; }

/* ---------- privacy */
.map-consent { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 700; width: min(520px, calc(100% - 24px)); padding: 16px 18px; font-size: .88rem; }
.map-consent p { margin: 0 0 10px; }
.privacy-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.privacy-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
@media (max-width: 760px) { .map-consent { bottom: 104px; } }

/* ---------- brand mark and pre-rendered pages */
img.brand-mark { width: 44px; height: 44px; object-fit: contain; }
.ssr { padding: 32px 0 60px; }
.ssr-item { display: grid; grid-template-columns: 160px 1fr; gap: 28px; align-items: start; }
.ssr-thumb { width: 160px; height: auto; border-radius: 10px; }
.ssr-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 20px; }
.ssr-meta dt { color: var(--ink-faint); }
.ssr-meta dd { margin: 0; }
.ssr-list { padding-left: 1.4em; line-height: 1.7; }
.ssr-near, .ssr-pager { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 24px; }
@media (max-width: 600px) { .ssr-item { grid-template-columns: 1fr; } }
