/* The ONE token file for the whole hub: the classic pages link it (index.html, login.html) and the Next app imports it
   (app/globals.css maps it into Tailwind with @theme inline). Colours, shadows, type AND layout live here; no page sets
   its own width, margins or colours (Lance 10/28: "i thought we are using tokens so that style is the same app wide?").

   Themes: light is the default; dark applies with <html data-theme="dark">, or with the OS in dark mode unless the page
   says data-theme="light" (public/theme.js writes the attribute before paint). Printing is always light (the dark blocks
   are screen-only), and any element with data-theme="light" (the A4 slips) stays light inside a dark page.
   The two dark blocks must stay identical: test/tokens.test.js checks it. */

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --raised: #FAFAFB;
  --sunken: #ECEDF0;
  --border: #E3E5E9;
  --border-strong: #D5D8DE;
  --text: #17181B;
  --text-2: #565A62;
  --muted: #9AA0A8;
  --red: #E0242B;
  --red-hover: #B51C22;
  --red-tint: #FDF2F2;
  --red-border: #F6C9CB;
  --amber: #A15C07;
  --amber-tint: #FDF6EA;
  --amber-border: #F1DDB5;
  --amber-bar: #E3A84A;
  --chart-bar: #2F3540;
  --chart-bar-2: #CDD2DA;
  --green: #1D7A4E;
  --green-tint: #E7F2EC;
  /* place tags on 今日 (Lance 10/30, the 9/14 board): one tint per place, text + background */
  --tag-blue: #1F5FB4; --tag-blue-bg: #E5EEFB; --tag-pink: #B0325C; --tag-pink-bg: #FBE7EE;
  --tag-green: #1F7A4D; --tag-green-bg: #E3F4EA; --tag-orange: #A4561B; --tag-orange-bg: #FCEBDD;
  --tag-yellow: #8A6A0B; --tag-yellow-bg: #FBF1D3; --tag-purple: #5B45B0; --tag-purple-bg: #ECE7FB;
  --tag-teal: #19736D; --tag-teal-bg: #DDF2F1;
  --green-border: #CFE6DA;
  --on-accent: #FFFFFF;      /* text on red / green fills */
  --grid-line: rgba(16, 18, 22, .025);   /* the fine 16px grid, subtler than T4's .035 */
  --ground-top: #F7F8FB;                 /* the ground fades from this (top left) ... */
  --ground-bottom: #E9EDF3;              /* ... to this (bottom right) */
  --row-hover: rgba(16, 18, 22, .035);   /* a row under the mouse */
  --ink-hover: #33363C;                  /* a dark ink button (bg-text) under the mouse */
  --glow: rgba(224, 36, 43, .11);       /* the red glow top left */
  --glow-2: rgba(70, 100, 160, .12);     /* the cool glow bottom right */
  --scrim: rgba(16, 18, 22, .32);
  --shadow: 0 1px 2px rgba(16,18,22,.04), 0 2px 6px rgba(16,18,22,.06);
  --shadow-lg: 0 1px 2px rgba(16,18,22,.05), 0 8px 24px rgba(16,18,22,.08);
  --shadow-pop: 0 2px 4px rgba(16,18,22,.06), 0 18px 48px rgba(16,18,22,.18);
}

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0C0E12;
    --surface: #17181B;
    --raised: #1C1D21;
    --sunken: #121316;
    --border: #26282D;
    --border-strong: #33363C;
    --text: #ECEDEF;
    --text-2: #A3A8B0;
    --muted: #6C727B;
    --red: #F0474D;
    --red-hover: #FF6A6F;
    --red-tint: rgba(240, 71, 77, .12);
    --red-border: rgba(240, 71, 77, .34);
    --amber: #E3A84A;
    --amber-tint: rgba(227, 168, 74, .12);
    --amber-border: rgba(227, 168, 74, .32);
    --amber-bar: #E3A84A;
    --chart-bar: #A3A8B0;
    --chart-bar-2: #33363C;
    --green: #4CC38A;
    --green-tint: rgba(76, 195, 138, .12);
    --tag-blue: #8DB6F5; --tag-blue-bg: rgba(94,150,240,.16); --tag-pink: #F29BB7; --tag-pink-bg: rgba(240,94,140,.15);
    --tag-green: #7FD6AC; --tag-green-bg: rgba(76,195,138,.14); --tag-orange: #F2B07F; --tag-orange-bg: rgba(240,150,80,.15);
    --tag-yellow: #E9CB77; --tag-yellow-bg: rgba(230,190,70,.14); --tag-purple: #B9A8F5; --tag-purple-bg: rgba(150,125,240,.16);
    --tag-teal: #7BD8D0; --tag-teal-bg: rgba(70,200,190,.14);
    --green-border: rgba(76, 195, 138, .30);
    --on-accent: #FFFFFF;
    --grid-line: rgba(255, 255, 255, .025);
    --ground-top: #15181E;
    --ground-bottom: #090A0D;
    --row-hover: rgba(255, 255, 255, .04);
    --ink-hover: #FFFFFF;
    --glow: rgba(240, 71, 77, .14);
    --glow-2: rgba(90, 120, 190, .14);
    --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.45);
    --shadow-pop: 0 2px 4px rgba(0,0,0,.5), 0 18px 48px rgba(0,0,0,.6);
  }
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0C0E12;
    --surface: #17181B;
    --raised: #1C1D21;
    --sunken: #121316;
    --border: #26282D;
    --border-strong: #33363C;
    --text: #ECEDEF;
    --text-2: #A3A8B0;
    --muted: #6C727B;
    --red: #F0474D;
    --red-hover: #FF6A6F;
    --red-tint: rgba(240, 71, 77, .12);
    --red-border: rgba(240, 71, 77, .34);
    --amber: #E3A84A;
    --amber-tint: rgba(227, 168, 74, .12);
    --amber-border: rgba(227, 168, 74, .32);
    --amber-bar: #E3A84A;
    --chart-bar: #A3A8B0;
    --chart-bar-2: #33363C;
    --green: #4CC38A;
    --green-tint: rgba(76, 195, 138, .12);
    --tag-blue: #8DB6F5; --tag-blue-bg: rgba(94,150,240,.16); --tag-pink: #F29BB7; --tag-pink-bg: rgba(240,94,140,.15);
    --tag-green: #7FD6AC; --tag-green-bg: rgba(76,195,138,.14); --tag-orange: #F2B07F; --tag-orange-bg: rgba(240,150,80,.15);
    --tag-yellow: #E9CB77; --tag-yellow-bg: rgba(230,190,70,.14); --tag-purple: #B9A8F5; --tag-purple-bg: rgba(150,125,240,.16);
    --tag-teal: #7BD8D0; --tag-teal-bg: rgba(70,200,190,.14);
    --green-border: rgba(76, 195, 138, .30);
    --on-accent: #FFFFFF;
    --grid-line: rgba(255, 255, 255, .025);
    --ground-top: #15181E;
    --ground-bottom: #090A0D;
    --row-hover: rgba(255, 255, 255, .04);
    --ink-hover: #FFFFFF;
    --glow: rgba(240, 71, 77, .14);
    --glow-2: rgba(90, 120, 190, .14);
    --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.45);
    --shadow-pop: 0 2px 4px rgba(0,0,0,.5), 0 18px 48px rgba(0,0,0,.6);
  }
}

/* type, shape and the page frame (the same in both themes) */
:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Menlo", "Consolas", monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --row-h: 44px;
  /* frame: the floating sidebar card, then the page with equal side margins (classic 概要, Lance 10/1 and 10/28 "perfect") */
  --side-inset: 12px;                                         /* sidebar card and header card sit this far from the window edge */
  --side-w: 264px;
  --frame-side: calc(var(--side-w) + 2 * var(--side-inset)); /* where the page column starts when the hub sidebar is shown */
  --page-x: 32px;                                             /* left and right margin of the page column */
  --page-top: var(--side-inset);
  --page-gap: 16px;                                           /* between sections of a page */
  --hdr-radius: 16px;                                         /* the inset header card (option B, Lance 10/28) */
  --hdr-pad-x: 20px;
}
@media (min-width: 900px) and (max-width: 1180px) { :root { --side-w: 232px; --page-x: 22px; } }
@media (max-width: 899px) { :root { --frame-side: 0px; --page-x: 16px; } }

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter.woff2") format("woff2"); }
html { background: var(--bg); }
/* The ground is "two glows" (Lance 10/29, hub-ui/glow-v1.png B, replacing the 10/28 T4 grid): a soft red glow top left and
   a cool glow bottom right over a fade between two shades of the ground, with the fine 16px grid on it (Lance 10/29: the grid stays, only the
   thick 80px lines and + marks went). It sits on a fixed layer behind the page,
   so nothing moves or redraws on scroll. body is its own stacking context (isolation) so the z-index -1 layer paints above
   body's colour and below everything. */
body {
  margin: 0; color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "palt" 1;
  background-color: var(--bg);
  isolation: isolate;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1000px 600px at 6% -8%, var(--glow), transparent 62%),
    radial-gradient(1000px 700px at 100% 110%, var(--glow-2), transparent 62%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(160deg, var(--ground-top) 0%, var(--ground-bottom) 100%);
  background-size: auto, auto, 16px 16px, 16px 16px, auto;
}
@media print { html, body { background: #fff; background-image: none; } body::before { content: none; } }

/* ---------- motion: the one hover / press primitive for the whole hub (classic + Next) ----------
   Lance 10/28 "making it like more responsive". Three behaviours, only on things that are really clickable:
     ix-lift  = a clickable card: lifts 2px with a deeper shadow
     ix-row   = a clickable table row or list row: a soft highlight
     ix-press = a button or link button: its own hover colour (set where it is styled), and it presses 1px on :active
   Next components put the ix-* class on the element; the classic pages' own classes are listed beside them, so both
   apps run this same rule (a classic rule that starts with all: unset sets transition: var(--ix-transition) again). Hover only with a mouse; touch gets the :active press only. Transitions are on transform,
   box-shadow and background-color only. Reduced motion = no movement and no transitions. */
:root {
  --dur-fast: 150ms;
  --ease-hub: cubic-bezier(.16, 1, .3, 1);   /* fast out, soft landing (not Tailwind's --ease-out, which it owns) */
  --lift: -2px;
  --press: 1px;
  --ix-transition: transform var(--dur-fast) var(--ease-hub), box-shadow var(--dur-fast) var(--ease-hub), background-color var(--dur-fast) var(--ease-hub);
}
.ix-lift, .ov-kpi, a.ov-link, .stat-btn,
.ix-row, .dt-table tr.link > td,
.ix-press, .btn, .dt-btn, .link-btn, .side-out, .side-search { transition: var(--ix-transition); }
@media (hover: hover) and (pointer: fine) {
  .ix-lift:hover, .ov-kpi:hover, a.ov-link:hover, .stat-btn:hover { transform: translateY(var(--lift)); box-shadow: var(--shadow-lg); }
  .ix-row:hover, .dt-table tr.link:hover > td { background-color: var(--row-hover); }
}
.ix-lift:active, .ov-kpi:active, a.ov-link:active, .stat-btn:active { transform: translateY(var(--press)); box-shadow: var(--shadow); }
.ix-row:active, .dt-table tr.link:active > td { background-color: var(--row-hover); }
.ix-press:active:not(:disabled), .btn:active:not(:disabled), .dt-btn:active, .link-btn:active, .side-out:active, .side-search:active { transform: translateY(var(--press)); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .ix-lift, .ov-kpi, a.ov-link, .stat-btn, .ix-press, .btn, .dt-btn, .link-btn, .side-out, .side-search { transform: none !important; }
}
