/* ==========================================================================
   Code Repair Shop — Design Tokens
   Single source of truth for every website and app in the family.
   See STYLEGUIDE.md. Change a value HERE first, then propagate.

   Usage:
     <html data-product="crs|mytimecounts|nochangehere|mitf"
           data-theme="light|dark">   (omit data-theme => follow the system)
   Dark is the default. Light applies via the system preference or the
   explicit data-theme="light" override.

   Surfaces consume tokens only. The only literal colors in a codebase
   should be the ones in this file.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- Shared neutrals — dark (default) -------------------------------- */
  --c-bg:            #0d0b09;
  --c-panel:         #14110d;
  --c-panel-2:       #191510;
  --c-line:          #27211a;
  --c-line-strong:   #3a3024;
  --c-ink:           #f0e9de;
  --c-muted:         #a89d8d;
  --c-faint:         #7a705f;
  --c-terminal-bg:   #0b0908;

  /* --- Shared semantic — dark ----------------------------------------- */
  --c-ok:            #86dcae;
  --c-warn:          #f5c451;
  --c-err:           #ff7a70;
  --c-info:          #7fb8ff;

  /* --- Brand accents: helper vars, resolved by theme ------------------ */
  /* Default brand = the shop (orange). data-product overrides these. */
  --c-accent-dark:        #ff8a3d;
  --c-accent-strong-dark: #ff9d5c;
  --c-accent-ink-dark:    #1c1106;
  --c-accent-light:       #a34606;
  --c-accent-ink-light:   #fff6ec;

  /* Active accent (dark by default) */
  --c-accent:        var(--c-accent-dark);
  --c-accent-strong: var(--c-accent-strong-dark);
  --c-accent-ink:    var(--c-accent-ink-dark);

  /* --- Derived accent tints (from the active accent) ------------------ */
  --c-accent-soft:  color-mix(in srgb, var(--c-accent) 16%, transparent);
  --c-accent-line:  color-mix(in srgb, var(--c-accent) 55%, var(--c-line-strong));
  --c-accent-hover: color-mix(in srgb, var(--c-accent) 88%, #ffffff);
  --c-glow:         color-mix(in srgb, var(--c-accent) 16%, transparent);
  --c-glow-soft:    color-mix(in srgb, var(--c-accent) 12%, transparent);
  --c-header-bg:    color-mix(in srgb, var(--c-bg) 85%, transparent);

  /* --- Typography ----------------------------------------------------- */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;

  /* --- Space (8px base) ----------------------------------------------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;
  --space-9: 48px; --space-10: 56px; --space-11: 64px; --space-12: 96px;

  /* --- Radii ---------------------------------------------------------- */
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   18px;
  --radius-pill: 999px;

  /* --- Elevation ------------------------------------------------------ */
  --c-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);

  /* --- Motion --------------------------------------------------------- */
  --ease:       cubic-bezier(0.2, 0, 0, 1);
  --dur-fast:   150ms;
  --dur:        200ms;
  --dur-slow:   300ms;
  --dur-reveal: 600ms;

  /* --- Layout --------------------------------------------------------- */
  --nav-h:      64px;
  --container:  1080px;
  --container-narrow: 44rem;
}

/* ==========================================================================
   Brand accents
   Each product sets its dark + light accent triple. The active accent is
   resolved by the theme blocks below. Never set --c-accent directly here.
   ========================================================================== */

[data-product="crs"] {
  --c-accent-dark:         #ff8a3d;
  --c-accent-strong-dark:  #ff9d5c;
  --c-accent-ink-dark:     #1c1106;
  --c-accent-light:        #a34606;
  --c-accent-ink-light:    #fff6ec;
}

[data-product="mytimecounts"] {
  --c-accent-dark:         #4fa8ff;
  --c-accent-strong-dark:  #6fb8ff;
  --c-accent-ink-dark:     #04121f;
  --c-accent-light:        #0b5ea8;
  --c-accent-ink-light:    #ffffff;
}

[data-product="nochangehere"] {
  --c-accent-dark:         #a78bfa;
  --c-accent-strong-dark:  #b9a1fb;
  --c-accent-ink-dark:     #0f0720;
  --c-accent-light:        #5b34c7;
  --c-accent-ink-light:    #ffffff;
}

[data-product="mitf"] {
  --c-accent-dark:         #4fd08a;
  --c-accent-strong-dark:  #6fdda0;
  --c-accent-ink-dark:     #04200f;
  --c-accent-light:        #12764a;
  --c-accent-ink-light:    #ffffff;
}

/* ==========================================================================
   Light theme
   Same neutrals for every brand; only the accent triple differs. The two
   light blocks (system preference and explicit override) are identical —
   keep them in sync.
   ========================================================================== */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --c-bg:          #f7f4ee;
    --c-panel:       #efeadf;
    --c-panel-2:     #e8e2d5;
    --c-line:        #dcd2c2;
    --c-line-strong: #c5b7a3;
    --c-ink:         #221a10;
    --c-muted:       #63594a;
    --c-faint:       #8a8272;

    --c-ok:   #157347;
    --c-warn: #8a5c00;
    --c-err:  #c0392b;
    --c-info: #1d6fb8;

    --c-accent:        var(--c-accent-light);
    --c-accent-strong: var(--c-accent-light);
    --c-accent-ink:    var(--c-accent-ink-light);

    --c-shadow: 0 24px 60px rgba(43, 30, 15, 0.16);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --c-bg:          #f7f4ee;
  --c-panel:       #efeadf;
  --c-panel-2:     #e8e2d5;
  --c-line:        #dcd2c2;
  --c-line-strong: #c5b7a3;
  --c-ink:         #221a10;
  --c-muted:       #63594a;
  --c-faint:       #8a8272;

  --c-ok:   #157347;
  --c-warn: #8a5c00;
  --c-err:  #c0392b;
  --c-info: #1d6fb8;

  --c-accent:        var(--c-accent-light);
  --c-accent-strong: var(--c-accent-light);
  --c-accent-ink:    var(--c-accent-ink-light);

  --c-shadow: 0 24px 60px rgba(43, 30, 15, 0.16);
}

/* ==========================================================================
   Base primitives — optional starting point.
   Surfaces may adopt these or write their own against the tokens.
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--c-accent); color: var(--c-accent-ink); }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
