/*
 * Go-zen design tokens
 * Single source of truth for color, type, space, depth and layering.
 * Light by default; dark via prefers-color-scheme (no toggle by design).
 * Brand lineage: washi / sumi / hanko / kaya. Never slate SaaS dark.
 *
 * Breakpoints (custom properties cannot drive @media, so they are a fixed
 * convention used everywhere in style.css):
 *   40em  phone landscape / small tablet (2-col storyboard)
 *   48em  tablet portrait (nav expands; nav.js mirrors this query)
 *   56em  tablet / laptop (hero + splits go two-column)
 *   72em  wide desktop (section rail, 4-col storyboard)
 */

:root {
  /* Brand palette (light) */
  --washi: #F7F4ED;
  --washi-deep: #EFE8DC;
  --sumi: #17150F;
  --ink-soft: #3D3A34;
  --line: rgba(42, 39, 34, 0.24);
  --kaya: #C4A574;
  --kaya-light: #CDB386;
  --kaya-deep: #A67C52;
  --hanko: #C23A22;
  --hanko-deep: #A8321C;
  --stone-black: #1A1814;
  --stone-white: #F5F2EA;
  /* Goban paint: stays real black/white on wood in both schemes */
  --goban-black: #1A1814;
  --goban-white: #F5F2EA;
  /* App goban (ZenTokens.kt GobanWood*): theme-invariant, same board at night */
  --goban-wood: #D6A566;
  --goban-wood-light: #E4C08A;
  --goban-wood-dark: #8C6230;
  --goban-wood-border: #6E4A22;
  --goban-wood-lift: #E8C07A;
  --goban-line: #1A120C;
  --goban-radius: 0.875rem;
  --goban-shadow: 0 5px 10px rgba(0, 0, 0, 0.33);

  /* Semantic surfaces and ink (components use these) */
  --surface: var(--washi);
  --surface-deep: var(--washi-deep);
  --surface-field: #FBF8F1;
  --surface-glass: rgba(247, 244, 237, 0.9);
  --ink: var(--sumi);
  --ink-muted: #625B51;
  --line-strong: rgba(42, 39, 34, 0.48);
  --accent: var(--hanko);
  --accent-fill: #C23A22;
  --accent-fill-hover: #A8321C;
  --accent-ink: #F7F4ED;
  --accent-wash: rgba(194, 58, 34, 0.07);
  --error-wash: rgba(194, 58, 34, 0.1);
  --focus-ring: var(--hanko);
  /* Light Android captures sit on cream in both schemes */
  --sketch-paper: #F7F4ED;

  /* Phone frame: flat graphite edge, not kaya wood. Same in both schemes. */
  --device-shell: #2B2C30;
  --device-edge: #0E0E10;
  --device-edge-light: rgba(255, 255, 255, 0.1);
  --device-button: #3A3B40;
  --device-camera: #060607;
  /* Screen glass: the captures' own edge color, so the inset is seamless */
  --device-screen: #F6F2EA;

  /* Depth: two levels only, plus the phone mock */
  --shadow-color: rgba(23, 21, 15, 0.12);
  --elev-1: 0 1px 0 rgba(23, 21, 15, 0.05);
  --elev-2: 0 18px 40px var(--shadow-color);

  /* Type families */
  --font-display: "Shippori Mincho", "Shippori Mincho Fallback", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --font-body: "Zen Kaku Gothic New", "Zen Kaku Gothic Fallback", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-mono: ui-monospace, "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Type scale: labels → hero. Nothing renders below --text-label. */
  --text-label: 0.75rem;      /* uppercase mono labels, tags */
  --text-meta: 0.8125rem;     /* mono dates and counts (mono runs wide) */
  --text-small: 0.875rem;     /* captions, hints, footer */
  --text-input: 1rem;         /* form fields: 16px keeps iOS from zooming */
  --text-ui: 0.9375rem;       /* nav, buttons, excerpts */
  --step-0: 1.0625rem;        /* body */
  --step-1: 1.25rem;          /* lede, card titles, quotes */
  --step-2: clamp(1.5rem, 1.1rem + 1.2vw, 2rem);      /* section h2 */
  --step-3: clamp(2rem, 1.4rem + 2vw, 3rem);          /* page h1 */
  --step-4: clamp(2.6rem, 1.6rem + 3.6vw, 4.25rem);   /* hero h1, ma line */

  --track-tight: -0.01em;
  --track-label: 0.08em;
  --track-wide: 0.18em;

  --lh-tight: 1.15;
  --lh-heading: 1.25;
  --lh-meta: 1.45;
  --lh-body: 1.7;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-section-tight: clamp(3rem, 2rem + 4vw, 4.5rem);
  --space-section: clamp(4rem, 2.5rem + 6vw, 6.5rem);
  --space-section-loose: clamp(5rem, 3rem + 8vw, 8.5rem);

  /* Layout */
  --radius: 2px;
  /* Phone geometry, relative to the phone width (cqi of .kaya-frame).
     Thin uniform bezel, flagship corners, concentric screen corners.
     The rem values are the fallback for browsers without container units. */
  --device-bezel: 0.25rem;
  --radius-device: 1.6rem;
  --radius-screen: calc(var(--radius-device) - var(--device-bezel));
  --measure: 65ch;
  --reading: 40rem;
  --site-max: 72rem;
  --pad-x: clamp(1rem, 4vw, 2.5rem);
  --header-h: 4.25rem;

  /* Layers */
  --z-raised: 1;
  --z-sticky: 40;
  --z-header: 50;
  --z-nav: 60;
  --z-grain: 90;
  --z-skip: 100;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 0.18s;
  /* Motion: long settle, no bounce. A stone set down, not a toast popping. */
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-enter: 0.55s;
  --dur-ceremony: 0.9s;
  --reveal-shift: 1.25rem;
  /* Material stones keep their own shadow: wood is wood in both schemes */

  color-scheme: light;
}

/* Warm night paper: sumi ground, washi cream ink, restrained hanko.
   Kaya wood stays wood. Forms keep readable fields. */
@media (prefers-color-scheme: dark) {
  :root {
    --washi: #141210;
    --washi-deep: #1C1914;
    --sumi: #EDE6D9;
    --ink-soft: #C4BDB0;
    --line: rgba(237, 230, 217, 0.18);
    --kaya: #B89568;
    --kaya-light: #C2A378;
    --kaya-deep: #8F6A45;
    --hanko: #E0523A;
    --hanko-deep: #C23A22;
    --stone-black: #0E0C0A;
    --stone-white: #221E18;

    --surface-field: #1A1712;
    --surface-glass: rgba(20, 18, 16, 0.92);
    --ink-muted: #9A9285;
    --line-strong: rgba(237, 230, 217, 0.36);
    /* Text accent brightens for contrast; filled buttons keep the deeper
       vermilion so cream button text stays AA. */
    --accent-fill: #C23A22;
    --accent-fill-hover: #A8321C;
    --accent-wash: rgba(224, 82, 58, 0.1);
    --error-wash: rgba(224, 82, 58, 0.14);

    --shadow-color: rgba(0, 0, 0, 0.4);
    --elev-1: 0 1px 0 rgba(0, 0, 0, 0.25);

    color-scheme: dark;
  }
}

/* Container units: the bezel and corners scale with each phone (hero ~11.5rem,
   product 13 to 15rem). 2.2% bezel, 14% outer radius. */
@supports (width: 1cqi) {
  :root {
    --device-bezel: 2.2cqi;
    --radius-device: 14cqi;
  }
}
