/* ============================================================================
   CreativeRoll design tokens — the single source of truth for the dashboard. The Studio
   (public/studio/css/platform.css) declares the same values; change both together.

   THE IDENTITY
   ------------
   Ink, paper and one signal — the same system as ScreenRoll. The mark is three blocks in a
   mosaic, two in ink and the top-right one in orange (tools/make-icons.py, brand/README.md).
   The brand colour is the ink itself — buttons, links, the active item — and orange is spent
   on one meaning: what is live, and what the click measures.

   Light is the interface. The public site (this copy) follows the visitor's device: dark when it
   asks for dark, with the dashboard's Graphite values (frontend/src/tokens.css, 1.22.0) — the same
   warm ink and paper, inverted, as a signed-in user who chose Graphite sees the product.
   ============================================================================ */

:root {
  /* --- Ground and surfaces -------------------------------------------------
     Warm paper rather than a cold near-white. The neutrals carry the same warmth, so the
     hairlines, the sunken wells and the page read as one material instead of grey on cream. */
  --ground:          #F6F4EF;  /* page background — paper */
  --surface:         #FFFFFF;  /* panels, table bodies, inputs */
  --surface-sunken:  #EFEDE8;  /* table headers, inset wells, disabled fields */
  --surface-hover:   #FAF9F6;
  --surface-tint:    #FCFBF8;  /* rows opened under a parent in a tree table */

  /* --- Ink -----------------------------------------------------------------
     Never pure black. #16181D is the ink of the mark: a near-black with no hue to argue with
     the paper or the signal. */
  --ink:             #16181D;  /* headings, primary text */
  --ink-secondary:   #45474D;  /* body copy, table cells */
  /* Must clear AA against the *sunken* surface, not just white — that is where it is used
     most (table headers, mono labels, form hints). Judged against the darkest ground it lands
     on, not the lightest. */
  --ink-muted:       #5F6167;  /* labels, captions, placeholders */
  /* Passes AA on the paper ground, on white and on the sunken well. De-emphasis has to come
     from size and weight here, not from fading text out of legibility. */
  --ink-faint:       #66686E;  /* captions, timestamps, disabled */

  /* --- Lines ---------------------------------------------------------------
     Hairlines do the work that borders-around-everything used to do. Two
     weights only: `--line` separates, `--line-strong` encloses. */
  --line:            #E4E1DA;
  --line-strong:     #D4D0C7;

  /* --- Brand (do not redefine) --------------------------------------------
     The ink. Used as INFORMATION: active, selected, primary action. Never as decoration,
     never as a gradient wash. */
  --brand:           #16181D;
  --brand-bright:    #3A3D45;  /* focus rings, secondary emphasis — a lifted ink, not a second hue */
  --brand-hover:     #2C2F36;  /* a dark button lightens under the pointer */
  --brand-tint:      #EAE7E0;  /* selected rows, active nav, subtle fills */
  --brand-tint-line: #D9D5CC;

  /* --- Signal --------------------------------------------------------------
     The orange block of the mark. One meaning only: live — a published creative, a campaign
     serving, the click that is measured.
     A shape, never words (#E8542B is 3.4:1 on white) and never a button or a section fill.
     Warnings are amber-yellow precisely so this orange is never mistaken for one. */
  --signal:          #E8542B;
  --signal-tint:     #FCE9E2;

  /* --- The dark panel ------------------------------------------------------
     The only dark in the system (the sign-in brand panel), and the same ink as the mark.
     `--dark` is the panel itself, `--dark-raised` a card on it, `--dark-line` its hairlines. */
  --dark:          #16181D;
  --dark-raised:   #202329;
  --dark-line:     #2E3138;
  --dark-ink:      #F6F4EF;
  --dark-ink-mute: #9A9CA3;

  /* --- Semantic (status only — never a decorative accent) ------------------- */
  /* Two greens, because a fill and a label have different jobs. --ok is the dot, the bar,
     the pip: saturated and readable as a shape. --ok-text is for words, where #16A34A only
     reached 3.0:1 on the light ground and 3.0:1 on its own tint. Never set text in --ok. */
  --ok:              #16A34A;
  --ok-text:         #107536;
  --ok-hover:        #15803D;  /* pressed/hover fill for a success button */
  --ok-tint:         #E7F4EA;
  --ok-tint-line:    #B9E0C4;  /* border on the ok tint — same pattern as --brand-tint-line */
  /* Amber-yellow, not orange: the signal owns orange, and a warning that looks like "live"
     says the opposite of what it means. */
  --warn:            #CA8A04;
  --warn-text:       #8A5A00;  /* words on the warn tint — --warn itself is too light there */
  --warn-tint:       #FBF3DC;
  --warn-tint-line:  #EBD9A6;  /* border on the warn tint — same pattern as --ok-tint-line */
  --warn-deep:       #5E3E00;  /* the darkest of the amber-yellow warning family — orange belongs to the signal */
  --danger:          #DC2626;
  --danger-text:     #B91C1C;  /* words and hover fill — #DC2626 on its own tint is 4.23:1, under AA */
  --danger-tint:     #FCEBE9;
  --danger-tint-line:#F1C9C4;
  /* Information is the interface speaking, so it speaks in ink. */
  --info:            #3A3D45;
  --info-tint:       #EAE7E0;

  /* --- Category (media types) -----------------------------------------------
     Not status. HTML5/Widget/VAST badges need to be told apart at a glance, and
     borrowing --danger for "VAST" would say something untrue about it.
     Warm, like everything else: this names a format, it does not rate it. It was
     violet, which was the one thing on a dashboard page that belonged to no family. */
  --category-umber:      #7C2D12;
  --category-umber-tint: #F6EAE3;

  /* --- Type ----------------------------------------------------------------
     TWO ROLES. Reading and accent.

       ui / mono — Inter. Everything you read: body, tables, labels, controls,
                   figures. Drawn for interfaces at small sizes, and it shows on a
                   dense table — open apertures and distinct letterforms at 11px are
                   the difference between scanning a column and decoding it.
       display   — Onest. Headings and the wordmark. The product's voice, spent
                   where there is room for it rather than on every row of data.

     Both variable, both self-hosted, subsets loaded by `unicode-range`.

     The display stack falls back to Inter on purpose. Onest covers Latin and
     Cyrillic; a heading containing Greek — or Arabic once that arrives — lands on
     our own reading face rather than on whatever the operating system supplies.
     The page degrades within the system instead of out of it.

     ADDING A SCRIPT: declare the new face under the SAME family name with its own
     `unicode-range` in fonts.css. The browser picks per character, no call site
     changes, and nobody who does not read that script downloads it. Noto Sans is
     the designated source for what Inter lacks (Arabic, JP, KR, Thai, Devanagari,
     Hebrew) — it is the only family drawn to cover every writing system.

     --font-figures is Inter, not a mono face, and it is NOT called --font-mono:
     Tailwind v4 owns that name and defines it as the operating system's monospace
     stack. Ours was imported first and silently lost, so every code, resolution
     and timestamp in the product rendered in SF Mono on a Mac and Consolas on
     Windows — a third typeface nobody chose, different per machine. The bridge in
     index.css's @theme now points Tailwind's own --font-mono at this value too, so
     the `font-mono` utility class lands in the same place.

     What machine values get instead of a mono face: tabular figures and a slashed
     zero, both from Inter. That is what a monospace was doing for us — telling a
     code apart from prose and making 0 unmistakable when somebody reads a creative
     code aloud to a colleague — without a third voice.
  /* No operating-system faces in these stacks, deliberately. Naming -apple-system
     or 'Segoe UI' does not give us a fallback we control — it guarantees the page
     looks like a different product on every machine, which is the whole failure we
     are trying to remove. Our faces are self-hosted, same-origin and preloaded in
     index.html, so they are present before first paint; `sans-serif` is the honest
     last resort for the case where that has already failed, not a design we plan
     around. The display stack falls to Inter first for the same reason: degrade
     inside our own system before leaving it. */
  --font-display: 'Onest', 'Inter', sans-serif;
  --font-ui:      'Inter', sans-serif;
  --font-figures: 'Inter', sans-serif;

  /* The display voice, now that it is not a separate family. A heading is the
     weight axis pushed well past bold and the tracking pulled in — deliberate,
     not `font-bold` by default, which is what made the app read as a generic
     admin panel the last time there was no display face. */
  --display-weight:  800;
  --display-tracking: -0.03em;

  /* Type scale. Deliberately short — every size that exists will get used, and
     a scale with twelve steps is a scale with no hierarchy. */
  --text-2xs: 10.5px;
  --text-xs:  11.5px;
  --text-sm:  12.5px;
  --text-base:13.5px;
  --text-md:  15px;
  --text-lg:  18px;
  --text-xl:  22px;
  --text-title: 24px;  /* a page's title (PageHeader) — between xl and 2xl, on purpose */
  --text-2xl: 28px;
  --text-3xl: 36px;

  /* --- Shape ---------------------------------------------------------------
     Small radii. Large ones read as consumer software; this is an operations
     tool that happens to be well made. */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 6px;    /* was 10; one radius for everything that is not a control */
  --radius-pill: 999px;  /* progress bars, grab handles, count chips */

  /* --- Elevation -----------------------------------------------------------
     Shadows are for things that genuinely float (modals, menus). Panels sit on
     the page and get a hairline instead — that is the whole difference between
     this and the card-everything look. */
  --shadow-pop:   0 1px 2px rgba(22, 24, 29, 0.06), 0 4px 12px rgba(22, 24, 29, 0.06);
  --shadow-modal: 0 24px 64px rgba(22, 24, 29, 0.24);

  /* --- Motion --------------------------------------------------------------
     One duration, one curve. Anything slower feels broken on a dense UI. */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur:  140ms;

  /* --- Legacy aliases ------------------------------------------------------
     The dashboard was built against these names. Keeping them mapped onto the
     new tokens means the whole app re-skins from this file with no JSX edits,
     and lets components migrate to the semantic names gradually instead of in
     one risky sweep. Do not use these in new code. */
  --content-bg:     var(--ground);
  --card-bg:        var(--surface);
  --topbar-bg:      var(--surface);
  --border:         var(--line);
  --text-primary:   var(--ink);
  --text-secondary: var(--ink-secondary);
  --text-muted:     var(--ink-muted);
  --accent:         var(--brand);
  --accent-light:   var(--brand-bright);
  --accent-hover:   var(--brand-hover);
  --success:        var(--ok);
  --danger-legacy:  var(--danger);
  --warning:        var(--warn);

  /* The sidebar is part of the interface, so it is light (see the identity at the top). */
  --sidebar-bg:     var(--surface);
  --sidebar-hover:  var(--surface-hover);
  --sidebar-active: var(--brand-tint);
  --sidebar-border: var(--line);
}

/* The device asks for dark (1.25.0): the dashboard's Graphite, so the screens of the product on the page match it. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #1F1E1C;  --surface: #272624;  --surface-sunken: #2E2D2A;  --surface-hover: #2B2A27;  --surface-tint: #292826;
    --ink: #F2EFE8;  --ink-secondary: #D0CCC3;  --ink-muted: #AAA59B;  --ink-faint: #A09A91;
    --line: #3A3935;  --line-strong: #4A4843;
    --brand: #F2EFE8;  --brand-bright: #D9D5CC;  --brand-hover: #FFFFFF;  --brand-tint: #33322E;  --brand-tint-line: #45433E;
    --signal: #F07A4A;  --signal-tint: #3B271D;
    --dark: #12100E;  --dark-raised: #1F1E1C;  --dark-line: #3A3935;  --dark-ink: #F2EFE8;  --dark-ink-mute: #AAA59B;
    --ok: #6FBF73;  --ok-text: #8DD190;  --ok-hover: #5FAF63;  --ok-tint: #1F2B1F;  --ok-tint-line: #34503A;
    --warn: #E0B04A;  --warn-text: #EDC66A;  --warn-tint: #2F2816;  --warn-tint-line: #55461F;  --warn-deep: #EDC66A;
    --danger: #E07468;  --danger-text: #EE8C81;  --danger-tint: #33201D;  --danger-tint-line: #5C3029;
    --info: #D9D5CC;  --info-tint: #33322E;
    --category-umber: #E7A47E;  --category-umber-tint: #33251C;
    --shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.28);
    --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55);
  }
  /* the creatives are never themed: a frame keeps the light scheme, as on a site */
  iframe { color-scheme: light; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
}
