/* Pallanguzhi web: shared tokens and components (tasks.md T53).
   Colours mirror lib/ui/app_theme.dart (T13/T46 carved-wood palette). */
:root {
  --ground: #1f130b;
  --surface: #33200f;
  --sheet: #3f2814;
  --terracotta: #c1502e;
  --terracotta-light: #e0794a;
  --brass: #b8893a;
  --brass-light: #e9c98a;
  --wood: #8a5a33;
  --wood-dark: #6b4424;
  --inlay: #5a3820;
  --hollow: #3a2412;
  --ivory: #f3e6d0;
  --soft: #d9c6ab;
  --hairline: rgba(184, 137, 58, 0.18);
  --nav-height: 64px;
  --font-heading: "EB Garamond", Georgia, serif;
  --font-body: "Open Sans", "Segoe UI", sans-serif;
  --font-tamil: "Noto Serif Tamil", serif;
  /* T46 pulli dot grid: 26px pitch, ivory dots 7.5%, lattice 3%. */
  --kolam: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='13' cy='13' r='1.3' fill='%23F3E6D0' fill-opacity='.075'/%3E%3Cpath d='M13 4.5 L21.5 13 L13 21.5 L4.5 13 Z' fill='none' stroke='%23F3E6D0' stroke-opacity='.03' stroke-width='.8'/%3E%3C/svg%3E");
}

html { background-color: var(--ground); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.site {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ground);
  background-image: var(--kolam);
  color: var(--ivory);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:focus-visible { outline: 2px solid var(--brass-light); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 8px 14px; border-radius: 8px;
  background: var(--surface); color: var(--brass-light); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ── Nav ─────────────────────────────────────────────────────────────── */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--nav-height); box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(31, 19, 11, 0.78);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
@media (min-width: 640px) { .site-nav { padding: 0 24px; } }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.3rem;
  color: var(--brass-light); text-decoration: none; letter-spacing: 0.01em;
}
.brand img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; }

.nav-links { display: none; align-items: center; gap: 24px; font-size: 0.875rem; color: var(--soft); }
.nav-links a:not(.btn) { color: inherit; text-decoration: none; transition: color 0.15s; }
.nav-links a:not(.btn):hover, .nav-links a[aria-current="page"] { color: var(--brass-light); }
@media (min-width: 640px) {
  .nav-links { display: flex; }
  .site-nav .nav-play-mobile { display: none; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; font-family: var(--font-body); font-weight: 700;
  font-size: 0.95rem; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.btn-primary {
  padding: 13px 26px; color: #fff4e6;
  background: linear-gradient(180deg, #d25e38, var(--terracotta));
  box-shadow: inset 0 0 0 1px rgba(233, 201, 138, 0.35), 0 8px 22px rgba(193, 80, 46, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(233, 201, 138, 0.5), 0 10px 26px rgba(193, 80, 46, 0.45); }
.btn-ghost {
  padding: 13px 22px; color: var(--ivory); font-weight: 600;
  background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(243, 230, 208, 0.25);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn-primary:hover { transform: none; } }

/* ── Type ────────────────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brass-light); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.4);
}
.tamil { font-family: var(--font-tamil); font-weight: 500; color: var(--brass); letter-spacing: 0.04em; }
.kicker { margin: 0 0 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--brass); }
.section-title { font-family: var(--font-heading); font-weight: 500; font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.1; color: var(--ivory); }
.section-title em, .display em { font-style: normal; color: var(--brass-light); }
.display { font-family: var(--font-heading); font-weight: 500; line-height: 1.02; color: var(--ivory); }
.tagline { font-family: var(--font-heading); font-style: italic; font-size: clamp(1.35rem, 3.4vw, 1.75rem); color: var(--brass-light); }
.lede { color: var(--soft); font-size: 1rem; line-height: 1.7; }
.link-arrow { color: var(--brass-light); font-weight: 600; text-decoration: none; }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 3px; }

.ornament { display: flex; align-items: center; gap: 10px; width: min(240px, 70%); }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(184, 137, 58, 0.6), transparent); }
.ornament svg { width: 22px; height: 22px; flex: none; }

/* ── Board (CSS-drawn, T46 carved wood) ──────────────────────────────── */
.board {
  display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: 1fr 1fr;
  gap: clamp(4px, 1.4vw, 10px); padding: clamp(10px, 2.2vw, 16px) clamp(12px, 2.8vw, 22px);
  /* Rounded rectangle like the app's plank (corner ≈ pit radius + padding),
     not a stadium: a full 999px radius clipped the four corner pits. */
  border-radius: 9% / 28%; box-sizing: border-box;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255, 220, 170, 0.05) 0 1px, transparent 1px 13px),
    linear-gradient(180deg, var(--wood), var(--wood-dark));
  box-shadow: inset 0 0 0 1.5px var(--brass), inset 0 0 0 4.5px var(--inlay),
    inset 0 0 0 5.5px rgba(233, 201, 138, 0.25), 0 18px 40px rgba(0, 0, 0, 0.6);
}
.pit {
  aspect-ratio: 1; border-radius: 50%; box-sizing: border-box; padding: 20%;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 1.5px;
  background: radial-gradient(circle at 50% 38%, var(--hollow) 0%, #4e311a 55%, var(--wood-dark) 100%);
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 220, 170, 0.25);
  transition: box-shadow 0.2s;
}
.pit.is-glow { box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.7), 0 0 0 2.5px var(--terracotta-light), 0 0 12px rgba(224, 121, 74, 0.45); }
.seed {
  width: 27%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8ea, #e8d6b4 55%, #b89a6e);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.55);
}

/* ── Cards, steps, stats, badges ─────────────────────────────────────── */
.card, .stat, .step { border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.25); }
.card { padding: 20px 18px; background: linear-gradient(180deg, rgba(255, 220, 170, 0.035), transparent), var(--surface); }
.card-icon { width: 36px; height: 36px; margin-bottom: 14px; border-radius: 10px; display: grid; place-items: center; color: var(--brass-light); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.45); }
.card-icon svg { width: 18px; height: 18px; }
.card h3, .step h3 { margin: 0 0 6px; font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; color: var(--ivory); }
.card p, .step p { margin: 0; font-size: 0.875rem; line-height: 1.6; color: var(--soft); }
.step { padding: 20px 18px; background: rgba(31, 19, 11, 0.55); }
.step-no { font-family: var(--font-heading); font-size: 2rem; line-height: 1; color: var(--terracotta-light); }
.stat { padding: 16px 6px; text-align: center; background: rgba(31, 19, 11, 0.6); font-size: 0.8rem; color: var(--soft); }
.stat b { display: block; margin-bottom: 4px; font-family: var(--font-heading); font-size: 2.1rem; font-weight: 600; line-height: 1; color: var(--brass-light); }

.store-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.store-badges[hidden], .store-badge[hidden] { display: none; }
.store-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px;
  color: var(--ivory); text-decoration: none; font-size: 0.82rem; font-weight: 600;
  background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(243, 230, 208, 0.22);
}
.store-badge:hover { background: rgba(0, 0, 0, 0.5); }
.store-badge svg { width: 18px; height: 18px; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--hairline); background: rgba(31, 19, 11, 0.6); padding: 40px 16px 28px; }
@media (min-width: 640px) { .site-footer { padding: 40px 24px 28px; } }
.footer-inner { width: min(1120px, 100%); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.footer-grid > :first-child { grid-column: 1 / -1; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } .footer-grid > :first-child { grid-column: auto; } }
.footer-title { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600; color: var(--brass-light); }
.footer-title img { width: 22px; height: 22px; border-radius: 6px; }
.footer-copy { margin: 0; color: var(--soft); font-size: 0.88rem; line-height: 1.6; }
.footer-copy-subtle { margin-top: 10px; opacity: 0.8; }
.footer-heading { margin: 0 0 10px; color: var(--brass); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li + li { margin-top: 8px; }
.footer-list li[hidden] { display: none; }
.footer-list a, .footer-bottom a { color: var(--soft); text-decoration: none; font-size: 0.9rem; }
.footer-list a:hover, .footer-bottom a:hover { color: var(--brass-light); }
.footer-bottom { margin-top: 24px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: rgba(217, 198, 171, 0.65); font-size: 0.78rem; }
.footer-bottom nav { display: flex; gap: 14px; }
.footer-bottom a { font-size: 0.78rem; }

/* ── Sticky mobile CTA (home) ────────────────────────────────────────── */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 14px 16px;
  background: linear-gradient(to top, rgba(31, 19, 11, 0.97), transparent);
  transform: translateY(110%); visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}
.sticky-cta.is-visible { transform: none; visibility: visible; transition: transform 0.3s ease; }
@media (min-width: 640px) { .sticky-cta { display: none; } }
@media (prefers-reduced-motion: reduce) { .sticky-cta { transition: none; } }

/* ── Reveal on scroll (only once JS marks <html class="js">) ──────────── */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ── Reading layout (about, privacy) ─────────────────────────────────── */
.doc { width: min(680px, 100%); margin: 0 auto; box-sizing: border-box; padding: calc(var(--nav-height) + 40px) 16px 48px; }
@media (min-width: 640px) { .doc { padding-left: 24px; padding-right: 24px; } }
.doc h1 { margin: 6px 0 12px; font-family: var(--font-heading); font-weight: 500; font-size: clamp(2.3rem, 7vw, 3rem); line-height: 1.05; }
.doc .intro { margin: 0 0 20px; font-size: 1.05rem; line-height: 1.75; color: var(--soft); }
.doc h2 {
  display: flex; align-items: center; gap: 10px; margin: 40px 0 10px;
  font-family: var(--font-heading); font-weight: 500; font-size: 1.85rem; line-height: 1.15;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}
.doc h2::before {
  content: ""; flex: none; width: 15px; height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M11 2.5c3 3 3 5.5 0 8.5c-3-3-3-5.5 0-8.5z M11 19.5c3-3 3-5.5 0-8.5c-3 3-3 5.5 0 8.5z M2.5 11c3-3 5.5-3 8.5 0c-3 3-5.5 3-8.5 0z M19.5 11c-3-3-5.5-3-8.5 0c3 3 5.5 3 8.5 0z' fill='none' stroke='%23B8893A' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.doc h3 { margin: 22px 0 6px; font-family: var(--font-heading); font-size: 1.3rem; font-weight: 600; color: var(--brass-light); }
.doc p, .doc li { font-size: 0.97rem; line-height: 1.8; color: #e7d8c0; }
.doc p { margin: 0 0 14px; }
.doc ul:not(.doc-toc), .doc ol { margin: 0 0 14px; padding-left: 1.3rem; }
.doc ul:not(.doc-toc) { list-style: disc; }
.doc ol { list-style: decimal; }
.doc li::marker { color: var(--brass); }
.doc a:not(.btn) { color: var(--brass-light); text-underline-offset: 3px; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.doc-toc a { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; color: var(--brass-light); text-decoration: none; box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.35); }
.doc-toc a:hover { background: rgba(184, 137, 58, 0.12); }
.names, .facts { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0 16px; }
@media (min-width: 560px) { .names, .facts { grid-template-columns: 1fr 1fr; } }
.names > div, .fact { padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.22); }
.names > div { font-size: 0.85rem; color: var(--soft); }
.names b { display: block; font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; color: var(--ivory); }
.fact h3 { margin: 0 0 4px; font-size: 1.1rem; }
.fact p { margin: 0; font-size: 0.85rem; line-height: 1.6; color: var(--soft); }
.figure { margin: 16px 0 10px; padding: 16px; border-radius: 16px; background: rgba(51, 32, 15, 0.6); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.22); }
.figure figcaption { margin-top: 12px; text-align: center; font-size: 0.82rem; font-style: italic; color: var(--soft); }
.cta-card { margin: 40px 0 0; padding: 26px 20px; text-align: center; border-radius: 18px; background: radial-gradient(ellipse at 50% 0%, rgba(193, 80, 46, 0.18), transparent 70%), var(--surface); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.3); }
.cta-card h2 { justify-content: center; margin-top: 0; }
.cta-card h2::before { display: none; }

/* ── Play shell (tasks.md T53; sizing from chauka-bara T205) ──────────────
   .play-frame fills the real available space; it never forces an aspect
   ratio. Flutter's BoardLayout (T35) draws a horizontal board when its area
   is wider than tall and a vertical one otherwise. */
.play-shell {
  --play-header-height: 44px;
  --play-footer-height: 52px;
  --play-main-padding: 0px;
  --play-frame-max-width: 100vw;
  --play-viewport-height: 100svh;
  margin: 0; width: 100%; min-height: 100vh; box-sizing: border-box;
  overflow-x: hidden; overflow-y: auto;
  background-color: var(--ground);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(193, 80, 46, 0.12), transparent 60%), var(--kolam);
  color: var(--ivory); font-family: var(--font-body);
}
@supports (height: 100dvh) { .play-shell { --play-viewport-height: 100dvh; } }

/* Block flow + explicit calc() heights, not flex percentages: a percentage
   height on a flex-grown child isn't reliably definite (chauka-bara T205). */
.play-layout { width: 100%; }

.play-topbar, .play-bottombar {
  box-sizing: border-box; background: rgba(31, 19, 11, 0.78);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.play-topbar {
  height: var(--play-header-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--hairline);
}
.play-topbar .brand { font-size: 1.1rem; }
.play-topbar .brand img { width: 24px; height: 24px; }
.play-topbar nav a { color: var(--soft); text-decoration: none; font-size: 0.85rem; }
.play-topbar nav a:hover { color: var(--brass-light); }

.play-main {
  height: calc(var(--play-viewport-height) - var(--play-header-height) - var(--play-footer-height) - (var(--play-main-padding) * 2));
  min-height: 240px; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: var(--play-main-padding); overflow: hidden;
}

.play-frame {
  width: 100%; height: 100%; max-width: var(--play-frame-max-width); max-height: 100%;
  overflow: hidden; background: var(--ground);
}
#flutter_host flt-glass-pane, #flutter_host flutter-view { width: 100% !important; height: 100% !important; }

/* Fixed 600px to match the 160×600 <ins>; never a percentage (a shorter box
   would clip the creative). Shown only via the breakpoint below. */
.play-ad-gutter { display: none; width: 160px; height: 600px; align-items: center; justify-content: center; flex-shrink: 0; }

.play-bottombar {
  min-height: var(--play-footer-height); padding: 4px 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; text-align: center;
  border-top: 1px solid var(--hairline); color: rgba(217, 198, 171, 0.62); font-size: 0.75rem; line-height: 1.35;
}
.play-bottombar p { margin: 0; }
.play-bottom-links { display: flex; gap: 14px; }
.play-bottombar a { color: rgba(217, 198, 171, 0.75); text-decoration: none; }
.play-bottombar a:hover { color: var(--brass-light); }

@media (min-width: 768px) {
  .play-shell {
    --play-header-height: 48px;
    --play-footer-height: 36px;
    --play-main-padding: 12px;
    --play-frame-max-width: 1600px;
  }
  .play-topbar { padding: 0 18px; }
  .play-frame {
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.35), 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 48px rgba(193, 80, 46, 0.08);
  }
  .play-bottombar { flex-direction: row; justify-content: space-between; padding: 0 18px; }
}

/* Keep in sync with play.html's wideQuery: pushing an <ins> while its gutter
   is display:none permanently wastes that slot's one push. */
@media (min-width: 1160px) and (min-height: 820px) {
  .play-main { gap: 20px; min-height: 600px; }
  .play-ad-gutter { display: flex; }
}

/* New for pallanguzhi: a phone on its side. Our board is a long plank, so
   every pixel of height decides pit size; the bars give theirs up. */
@media (orientation: landscape) and (max-height: 500px) {
  .play-shell { --play-header-height: 0px; --play-footer-height: 0px; --play-main-padding: 0px; }
  .play-topbar, .play-bottombar { display: none; }
  .play-frame { border-radius: 0; box-shadow: none; }
}

/* Loader: four seeds hop until Flutter's first frame. */
.play-loader {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(31, 19, 11, 0.92); opacity: 1; visibility: visible;
  transition: opacity 280ms ease, visibility 0s linear 280ms;
}
.play-loader--hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.play-loader-card {
  display: grid; place-items: center; gap: 12px; padding: 16px 20px; border-radius: 12px;
  background: var(--surface); box-shadow: inset 0 0 0 1px rgba(184, 137, 58, 0.3); color: var(--ivory);
}
.play-loader-seeds { display: flex; gap: 7px; }
.play-loader-seeds span {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8ea, #e8d6b4 55%, #b89a6e);
  animation: seedHop 1.2s ease-in-out infinite;
}
.play-loader-seeds span:nth-child(2) { animation-delay: 0.15s; }
.play-loader-seeds span:nth-child(3) { animation-delay: 0.3s; }
.play-loader-seeds span:nth-child(4) { animation-delay: 0.45s; }
.play-loader-label { margin: 0; font-size: 0.9rem; }
@keyframes seedHop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) {
  .play-loader { transition: none; }
  .play-loader-seeds span { animation: none; }
}
