/* shared/tokens.css — Cerebro DS token set for cerebro-matching-preview.
  
   Source: design-system-v116 styles/tokens.css — every §1 value transcribed
   verbatim (matching-safety-design D1 report, audit-results/d1-foundation.md).
   Amendments: D1 §6 P-01…P-16, approved by Fujiwara 2026-11-23 — additions are
   grouped and commented per proposal ID. Values marked "(P-nn)" did not exist
   in v1.16; everything else is spec.
  
   NOTE: custom properties cannot be used inside @media conditions, so the
   breakpoint tokens below are reference values for matchMedia()/docs/layout
   math — media queries keep literal px (see shared/components.css). */

:root {
  color-scheme: dark;

  /* ---------- surface (D1 §1.1, verbatim) ---------- */
  --c-surface-canvas: #09090a;
  --c-surface-well: #101113;
  --c-surface-panel: #141416;
  --c-surface-raised: #1b1c1f;
  --c-surface-overlay: #252629;
  --c-surface-hover: #2c2e32;

  /* ---------- text (D1 §1.2, verbatim) ---------- */
  --c-text-primary: #eeeef1;
  --c-text-secondary: #aaacb3;
  --c-text-muted: #91949d;
  --c-text-on-silver: #181b20;
  --c-text-disabled: #888d97;

  /* ---------- border (D1 §1.3, verbatim) ---------- */
  --c-border-subtle: #25262a;
  --c-border-default: #2e3034;
  --c-border-strong: #42464d;
  --c-border-input: #626772;
  --c-border-focus: #cbd5e2;

  /* ---------- accent / silver (D1 §1.4, verbatim) ---------- */
  --c-accent-base: #d7dee7;
  --c-accent-text: #edf1f6;
  --c-accent-soft: rgba(217,225,235,.075);
  --c-accent-border: rgba(220,231,246,.29);
  --c-accent-focus: #cbd5e2;

  /* ---------- status (D1 §1.5, verbatim) ---------- */
  --c-status-success: #96b29f;
  --c-status-warning: #d7b988;
  --c-status-danger: #df9898;
  --c-status-info: #b3c6df;

  /* ---------- status tints (P-01, approved) ----------
     Replaces the ad-hoc literals (#96b29f09, #d7b98833, #df989844, …) that
     were scattered through component CSS. -soft ≈10% alpha fill,
     -border ≈28% alpha edge, per the approved proposal ranges
     (bg ~8–12%, border ~25–30%). */
  --c-status-success-soft: rgba(150,178,159,.1);
  --c-status-success-border: rgba(150,178,159,.28);
  --c-status-warning-soft: rgba(215,185,136,.1);
  --c-status-warning-border: rgba(215,185,136,.28);
  --c-status-danger-soft: rgba(223,152,152,.1);
  --c-status-danger-border: rgba(223,152,152,.28);
  --c-status-info-soft: rgba(179,198,223,.1);
  --c-status-info-border: rgba(179,198,223,.28);

  /* ---------- material / silver gradients (D1 §1.6, verbatim) ----------
     Invariant: silver denotes an enabled commitment, never a decorative
     card surface. */
  --c-material-silver-face: linear-gradient(112deg,#b9c1cb 0%,#e5eaf0 18%,#fcfdff 29%,#d8dee6 42%,#afb8c4 63%,#dde3ec 83%,#f4f6fa 100%);
  --c-material-silver-hover: linear-gradient(112deg,#c7ced8 0%,#f1f4f8 16%,#ffffff 28%,#e6eaf0 43%,#c1c9d3 63%,#f0f3f8 85%,#ffffff 100%);
  --c-material-silver-pressed: linear-gradient(112deg,#abb4c0 0%,#d3dbe4 25%,#b6bfcb 52%,#a5aebc 66%,#dce3ec 100%);
  --c-material-silver-brush: repeating-linear-gradient(0deg,#ffffff04 0px,#ffffff04 1px,#11182003 1px,#11182003 2px);
  --c-material-silver-edge: linear-gradient(90deg,#838f9e 0%,#dfe7f1 23%,#ffffff 43%,#a4b1c2 69%,#e4ebf5 100%);
  --c-material-silver-marker: linear-gradient(180deg,#7d8898 0%,#e4edf8 24%,#ffffff 47%,#b5c3d6 72%,#818ea1 100%);
  --c-material-selected-face: linear-gradient(108deg,rgba(211,224,241,.115),rgba(211,224,241,.046) 48%,rgba(211,224,241,.016));

  /* ---------- space (D1 §1.7, verbatim + P-03 additions) ---------- */
  --c-space-0: 0px;
  --c-space-2: 2px;
  --c-space-4: 4px;
  --c-space-6: 6px;
  --c-space-8: 8px;
  --c-space-10: 10px;
  --c-space-12: 12px;
  --c-space-14: 14px; /* P-03: fills the 12→16 gap; same value as --c-space-select-end */
  --c-space-16: 16px;
  --c-space-20: 20px;
  --c-space-24: 24px;
  --c-space-28: 28px; /* P-03: fills the 24→32 gap */
  --c-space-32: 32px;
  --c-space-40: 40px;
  --c-space-48: 48px;
  --c-space-select-end: 14px;
  --c-space-select-content-end: 38px;

  /* P-03/P-07: page chrome guidance. Gutter steps follow the approved
     breakpoint ladder; --c-space-section is the vertical rhythm between
     page sections. Current preview shell: 32px desktop / 16px ≤720px /
     12px ≤360px gutters, 920px column. */
  --c-space-page-gutter-lg: 32px;
  --c-space-page-gutter-md: 16px;
  --c-space-page-gutter-sm: 12px;
  --c-space-section: 32px;

  /* ---------- radius (D1 §1.8, verbatim) ---------- */
  --c-radius-small: 4px;
  --c-radius-control: 5px;
  --c-radius-group: 6px;
  --c-radius-panel: 9px;
  --c-radius-dialog: 10px;
  --c-radius-round: 999px;

  /* ---------- type scale (D1 §1.9, verbatim) ---------- */
  --c-type-micro: 10px;
  --c-type-meta: 11px;
  --c-type-label: 12px;
  --c-type-body: 13px;
  --c-type-section: 14px;
  --c-type-panel: 15px;
  --c-type-detail: 21px;
  --c-type-metric: 28px;
  --c-type-line: 1.65;

  /* ---------- type roles (P-05, approved) ----------
     v1.16 components still carry literal weights/line-heights that fall
     between these steps (450/550, 1.4/1.7/1.8/1.9) — see DESIGN-F2.md. */
  --c-weight-regular: 400;
  --c-weight-medium: 500;
  --c-weight-semibold: 600;
  --c-lh-tight: 1.5;
  --c-lh-base: var(--c-type-line);
  --c-lh-loose: 1.85;
  --c-track-eyebrow: 0.08em;
  --c-track-title: 0.01em;

  /* ---------- font (D1 §1.9, verbatim) ---------- */
  --c-font-sans: Inter,-apple-system,BlinkMacSystemFont,"Hiragino Sans","Noto Sans CJK JP","Yu Gothic",sans-serif;
  --c-font-mono: "SFMono-Regular",Consolas,"Liberation Mono",monospace;

  /* ---------- size (D1 §1.10, verbatim + P-07 page column) ---------- */
  --c-size-control-small: 28px;
  --c-size-control: 32px;
  --c-size-control-large: 36px;
  --c-size-touch: 44px;
  --c-size-icon: 16px;
  --c-size-icon-small: 14px;
  --c-size-side-min: 320px;
  --c-size-side: 368px;
  --c-size-side-max: 440px;
  --c-size-detail-max: 1340px;
  --c-size-page: 920px; /* P-07: app page column max-width (current preview shell) */
  --c-size-select-chevron: 12px;

  /* ---------- inset (D1 §1.11, verbatim) ---------- */
  --c-inset-panel: 16px;
  --c-inset-detail: 20px;
  --c-inset-row-y: 10px;
  --c-inset-section: 20px;

  /* ---------- motion (D1 §1.12, verbatim + P-09 timings) ---------- */
  --c-motion-press: 140ms;
  --c-motion-fast: 160ms;
  --c-motion-focus: 280ms;
  --c-motion-switch: 300ms;
  --c-motion-panel: 360ms;
  --c-motion-exit: 190ms;
  --c-motion-sheen: 580ms;
  --c-motion-ease: cubic-bezier(.22,1,.36,1);
  --c-motion-out: cubic-bezier(.4,0,1,1);
  --c-motion-shimmer: 1.8s; /* P-09: skeleton shimmer loop (was literal) */
  --c-motion-spin: 800ms;  /* P-09: spinner rotation (was literal) */

  /* ---------- layer (D1 §1.13, verbatim) ---------- */
  --c-layer-base: 0;
  --c-layer-sticky: 10;
  --c-layer-menu: 30;
  --c-layer-dialog: 50;
  --c-layer-toast: 80;
  --c-layer-tooltip: 90;

  /* ---------- shadow / elevation (D1 §1.14, verbatim) ---------- */
  --c-shadow-panel: 0 5px 20px #0003,inset 0 1px #ffffff03;
  --c-shadow-overlay: 0 14px 44px #0005;
  --c-shadow-silver: inset 0 1px 0 #ffffffbf,inset 0 -1px 0 #4d5a6b46,0 1px 2px #0007,0 0 0 1px #050609a0;
  --c-shadow-focus: none;

  /* ---------- overlay backdrop (P-02, approved) ----------
     Was the literal #020408ca + blur(4px) inside .c-dialog::backdrop. */
  --c-backdrop: #020408ca;
  --c-backdrop-filter: blur(4px);

  /* ---------- skeleton colors (P-08, approved) ----------
     Was the literal pair #272a30/#353a43 on .c-skeleton. */
  --c-skeleton-base: #272a30;
  --c-skeleton-shine: #353a43;

  /* ---------- breakpoints (P-06, approved) — reference ladder ----------
     560px is the only breakpoint v1.16 product CSS uses (component collapse).
     The 720/1024/1280 steps are the approved app-level content ladder.
     Cannot be referenced from @media conditions — keep literal px in
     queries; these tokens document intent and serve matchMedia()/JS. */
  --c-bp-sm: 560px;
  --c-bp-md: 720px;
  --c-bp-lg: 1024px;
  --c-bp-xl: 1280px;

  /* ---------- safe-area (P-14, approved) ----------
     env() fallbacks keep these 0px on non-notched devices. Use via
     .c-safe-bottom (components.css) or directly in page CSS. */
  --c-safe-top: env(safe-area-inset-top, 0px);
  --c-safe-right: env(safe-area-inset-right, 0px);
  --c-safe-bottom: env(safe-area-inset-bottom, 0px);
  --c-safe-left: env(safe-area-inset-left, 0px);

  /* ---------- data-viz (P-15, approved) ----------
     Minimal series/axis/grid set derived from accent + status tokens.
     For route/path visuals and comparisons; not a charting library. */
  --c-chart-1: var(--c-accent-base);
  --c-chart-2: var(--c-status-info);
  --c-chart-3: var(--c-status-success);
  --c-chart-4: var(--c-status-warning);
  --c-chart-axis: var(--c-text-muted);
  --c-chart-grid: var(--c-border-subtle);
}

/* ---------- print tokens (P-16, approved) ----------
   Record surfaces (invoices, 指導記録簿) print on white paper. Values follow
   the existing invoice document palette (invoice.css); they resolve only
   while printing, so screens keep the Graphite dark theme. */
@media print {
  :root {
    --c-print-paper: #ffffff;
    --c-print-ink: #202023;
    --c-print-muted: #595961;
    --c-print-line: #c7c7cd;
    --c-print-line-strong: #a4a4ab;
  }
}
