/* Sandfold site. Tokens from projects/sandfold/DESIGN.md ("Courtyard at Dusk"), as built in
   app/src/main/java/org/sonicon/sandfold/ui/theme/Color.kt: Material roles light ("Lime-wash")
   and dark ("Dusk"): background, onBackground, onBackgroundMuted, surfaceContainer(+High),
   primary/onPrimary, tertiary, outline. The field tokens are fixed in both themes, as in the app:
   thresholdStone/edge for the stone bands, chalk for text on stone, diyaFlame for accents on
   stone, swept earth and marigold for the decorative bunting. Baloo 2 (display, variable wght
   400-800) over Mukta (body 400/600). Powder colours are never used for text on the light ground;
   spills and muddied shapes never use the error role (DESIGN.md). */

@font-face {
    font-family: "Baloo 2";
    src: url("/sandfold/fonts/baloo2-var.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Mukta";
    src: url("/sandfold/fonts/mukta-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Mukta";
    src: url("/sandfold/fonts/mukta-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;
    --bg: #EFEBF3;            /* background */
    --surface: #FBF9FC;       /* surface */
    --ink: #1E1828;           /* onBackground */
    --muted: #57506A;         /* onBackgroundMuted */
    --link: #3D2E85;          /* primary, dusk indigo */
    --on-link: #FFFFFF;       /* onPrimary */
    --accent: #8C1D4F;        /* tertiary */
    --card: #E8E3EF;          /* surfaceContainer */
    --chip: #DFD9E8;          /* surfaceContainerHigh */
    --outline: #776E88;       /* outline */
    /* Field tokens: fixed in both themes */
    --stone: #2B221D;         /* thresholdStone */
    --stone-edge: #4A3B32;    /* thresholdStone edge */
    --earth: #6B5444;         /* swept earth floor */
    --chalk: #F4EEE3;         /* chalk */
    --flame: #FFC24D;         /* diyaFlame */
    --marigold: #EF7D1A;      /* Marigold powder (decorative only) */
    --leaf: #2F7A34;          /* Mango leaf powder (decorative only) */
    --display: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --body: "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17121F;
        --surface: #1E1828;
        --ink: #EFE8F4;
        --muted: #B3A9C0;
        --link: #F5B843;      /* primary, diya flame */
        --on-link: #2F1E00;
        --accent: #FFB0CB;
        --card: #262031;
        --chip: #30293C;
        --outline: #958AA2;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 1.0625rem/1.6 var(--body);
    overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-weight: 750; font-size: clamp(2.2rem, 6vw, 3.5rem); line-height: 1.1; }
h2 { font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.1rem); }
h3 { font-weight: 650; font-size: 1.3rem; margin: 0 0 0.3em; }
p { margin: 0 0 1em; }
strong { font-weight: 600; }
.accent { color: var(--accent); }

.wrap { max-width: 70rem; margin: 0 auto; padding: 0 1rem; }

.skip-link {
    position: absolute; left: 1rem; top: -4rem;
    background: var(--link); color: var(--on-link);
    padding: 0.75rem 1rem; border-radius: 12px; z-index: 10;
}
.skip-link:focus { top: 1rem; }
.skip-link:focus-visible { outline-color: var(--ink); }

/* Header */
.topbar .wrap {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.25rem 1.5rem; padding-block: 0.5rem;
}
.brand {
    display: flex; align-items: center; gap: 0.6rem; min-height: 48px;
    color: var(--ink); text-decoration: none;
}
.brand img { border-radius: 12px; }
.wordmark { font-family: var(--display); font-weight: 750; font-size: 1.6rem; line-height: 1.1; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 0.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 0.75rem;
    color: var(--ink); font-weight: 600; text-decoration: none; border-radius: 12px;
}
.site-nav a:hover { background: var(--chip); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }

/* Torana bunting: marigold flowers and mango leaves on a string (decorative) */
.bunting {
    height: 1.5rem;
    background-image:
        radial-gradient(circle at 50% 50%, var(--flame) 0 2px, var(--marigold) 3px 7px, transparent 8px),
        radial-gradient(4px 7px at 50% 50%, var(--leaf) 0 95%, transparent 100%),
        linear-gradient(var(--outline), var(--outline));
    background-size: 3rem 1.5rem, 3rem 1.5rem, 100% 1px;
    background-position: 0 0, 1.5rem 0, 0 0.2rem;
    background-repeat: repeat-x, repeat-x, no-repeat;
}

/* Sections */
main { display: block; }
.section { padding: 2.5rem 0; }
.section + .section { border-top: 1px solid var(--outline); }
.section.stone-section, .section.stone-section + .section, .section.closing { border-top: 0; }
.answer { font-size: 1.15rem; max-width: 42rem; }
.detail, .prose p, .prose ul { max-width: 42rem; }

/* Hero */
.hero { background: var(--surface); color: var(--ink); padding: 0.75rem 0 1rem; }
.hero a:not(.play-badge) { color: var(--link); }
.hero-grid { display: grid; gap: 2rem; align-items: center; padding-block: 2rem; }
@media (min-width: 56rem) { .hero-grid { grid-template-columns: 1fr 22rem; } }
.hero-grid > * { min-width: 0; }
.hero-inner .wrap { padding-block: 1.5rem; }
.kicker { font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.cta-note { margin: 0; font-weight: 600; }
.play-badge { display: inline-block; min-height: 48px; border-radius: 8px; }
.play-badge img { width: 188px; height: 56px; }
.hero-shot { display: block; max-width: 22rem; margin: 0 auto; }

/* Framed marketing shots get a 1 px border (guide: framed shots) */
.phone { border: 1px solid var(--outline); border-radius: 16px; }

/* Cards */
.cards { display: grid; gap: 1rem; list-style: none; margin: 1.25rem 0 0; padding: 0; }
@media (min-width: 48rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .cards.four { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--card); color: var(--ink); border-radius: 18px; padding: 1.25rem; }
.card p:last-child { margin: 0; }
.card .no { display: block; font-family: var(--display); font-weight: 700; color: var(--muted); }

/* Threshold-stone bands: chalk text on stone, diya-flame headings (fixed in both themes) */
.band {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    border-radius: 8px; padding: 1.5rem;
}
.band h2 { margin: 0; }
.band.stack { display: block; }
.band.stack h2 { margin-bottom: 0.6em; }
.band.stack p:last-child { margin: 0; }
.stone {
    background: var(--stone); color: var(--chalk);
    border: 10px solid var(--stone-edge);
}
.stone h2 { color: var(--flame); }
.stone a:not(.play-badge) { color: var(--chalk); text-decoration-thickness: 2px; }
.stone :focus-visible { outline-color: var(--chalk); }

/* States: line form carries the state as in the app (double line = filled, dashes = muddied) */
.state {
    display: inline-block; padding: 0.1rem 0.6rem; border-radius: 10px;
    font-weight: 600; border: 2px solid var(--ink);
}
.state.filled { border-style: double; border-width: 4px; }
.state.muddied { border-style: dashed; }
.state.complete { background: var(--card); }
.state.neat { background: var(--card); box-shadow: 0 0 0 3px var(--marigold); border-color: var(--ink); }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 48rem) { .gallery { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64rem) { .gallery { grid-template-columns: repeat(6, 1fr); } }
.gallery > li { min-width: 0; }
.shot { margin: 0; }
.shot figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.5rem; }

/* Question links */
.qlinks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-width: 42rem; }
.qlinks a {
    display: flex; align-items: center; min-height: 48px; padding: 0.5rem 1rem;
    background: var(--card); color: var(--ink); border-radius: 12px;
    font-weight: 600; text-decoration: none;
}
.qlinks a:hover { text-decoration: underline; }
.hero .qlinks a { color: var(--ink); }
.toc { margin-top: 1rem; }

/* Breadcrumb */
.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 0.5rem; padding: 0; font-size: 0.95rem; }
.crumbs li + li::before { content: "›"; padding: 0 0.5rem; }
.crumbs li { display: inline-flex; align-items: center; min-height: 48px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 48px; }

/* Tables: stack into cards at 600 px and below */
table { border-collapse: collapse; width: 100%; max-width: 48rem; margin: 1rem 0 1.5rem; }
caption { text-align: left; color: var(--muted); padding-bottom: 0.5rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--outline); }
thead th { border-bottom: 2px solid var(--ink); font-family: var(--display); font-weight: 650; font-size: 1.05rem; }
@media (max-width: 37.5rem) {
    caption { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    tbody, tr, td { display: block; }
    tr { background: var(--card); color: var(--ink); border-radius: 12px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; }
    td { border: 0; padding: 0.25rem 0; }
    td::before { content: attr(data-label) ": "; font-weight: 600; }
}

.limits { max-width: 46rem; padding-left: 1.25rem; }
.limits li { margin-bottom: 0.75rem; }

.faq > section { padding: 1.5rem 0; border-top: 1px solid var(--outline); }
.faq > section:first-child { border-top: 0; }

/* Footer */
.footer { border-top: 1px solid var(--outline); padding: 2rem 0; margin-top: 1rem; font-size: 0.95rem; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-top p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; list-style: none; margin: 1rem 0; padding: 0; gap: 0 1rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 48px; }
.fine { color: var(--muted); }
.fine p { margin: 0 0 0.5rem; }
.fine a { display: inline-block; padding-block: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto; }
}
