/* ============================================================
   Asobi Tools — Design Tokens
   Light + dark switch automatically via the user's OS setting
   (light-dark() + color-scheme). Manual override: set
   data-theme="light" | "dark" on <html>; default is auto.
   ============================================================ */

:root {
  color-scheme: light dark;

  /* ---- Color: one warm paper, one ink, ONE accent ---- */
  --bg:          light-dark(#FAF8F4, #171411);
  --surface:     light-dark(#FFFFFF, #201C17);
  --surface-2:   light-dark(#F3EFE7, #29241D);
  --ink:         light-dark(#1D1A16, #F1ECE4);
  --ink-2:       light-dark(#6E675E, #A79E92);  /* muted text */
  --line:        light-dark(#E7E1D7, #38322A);
  --line-strong: light-dark(#D4CCBE, #4A4238);

  /* Accent: Asobi vermilion (shu) */
  --accent:      light-dark(#D4472A, #F26B4A);
  --accent-hover:light-dark(#BC3B20, #F58163);
  --accent-text: light-dark(#B83A20, #F58163);  /* accent used AS text */
  --on-accent:   #FFFFFF;
  --accent-soft: light-dark(#FBEAE5, #34201A);  /* tinted chip/bg */

  /* Trust + states */
  --ok:          light-dark(#1E7A4F, #46C28E);
  --ok-soft:     light-dark(#E6F3EC, #16291F);
  --warn:        light-dark(#9A6A00, #E3B341);
  --error:       light-dark(#B3261E, #F28B82);

  --focus-ring:  light-dark(#D4472A, #F26B4A);
  --shadow-1:    light-dark(0 1px 2px rgba(29,26,22,.06), 0 1px 2px rgba(0,0,0,.5));
  --shadow-2:    light-dark(0 2px 12px rgba(29,26,22,.08), 0 2px 12px rgba(0,0,0,.45));

  /* ---- Typography ---- */
  /* Display: New Tropic (Tropical Type, self-hosted WOFF2 — never in git).
     Body/UI: system stack — fast, native, free. */
  --font-display: "New Tropic", "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-xs: 0.8125rem;   /* 13 — microcopy, disclosures */
  --text-sm: 0.9375rem;   /* 15 — secondary */
  --text-md: 1.0625rem;   /* 17 — body */
  --text-lg: 1.25rem;     /* 20 — lead */
  --text-xl: 1.5rem;      /* 24 — h3 / card titles */
  --text-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);  /* h2 */
  --text-3xl: clamp(2.1rem, 1.6rem + 2.6vw, 3rem);      /* h1 */

  --leading-tight: 1.15;
  --leading-body: 1.55;

  /* ---- Space (4px base) / radius / width ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  --r-control: 10px;  /* buttons, inputs */
  --r-card: 16px;     /* tool card, panels */
  --r-pill: 999px;

  --w-content: 720px; /* editorial column */
  --w-tool: 960px;    /* the tool card may stretch wider */

  --speed: 160ms;     /* one transition speed everywhere */
}

/* Manual override hooks (future theme toggle — free to add later) */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---- Self-hosted brand face (license: Tropical Type Commercial —
       web embedding on own domains OK; files NEVER committed to git) ---- */
@font-face {
  font-family: "New Tropic";
  src: url("../fonts/NewTropicRegular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "New Tropic";
  src: url("../fonts/NewTropicText.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "New Tropic";
  src: url("../fonts/NewTropicBold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  text-rendering: optimizeLegibility;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
p  { margin: 0 0 var(--sp-4); }
a  { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
small, .muted { color: var(--ink-2); font-size: var(--text-sm); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
