/* ==========================================================================
   Smarther Preview — Design Tokens
   --------------------------------------------------------------------------
   A design handoff tool. The screens a designer uploads are the only saturated
   colour on the page, so everything around them is neutral by construction.
   That is not a style preference — a tinted chrome changes how a design reads,
   and a designer reviewing their own work will blame the design.

   LIGHT IS THE DEFAULT. DARK IS OPT-IN.
   Light lives on bare :root. Dark lives under [data-theme="dark"] and nowhere
   else — deliberately NOT under prefers-color-scheme, because a theme that
   turns itself on because of an OS setting is not optional. A screen that
   wants dark says so:

       <html lang="en" data-theme="dark">

   Every value below was measured. Ratios are quoted against the grounds the
   value is actually used on.

   THE PLAN'S PALETTE (§9.3) IS DARK, AND THREE OF ITS VALUES FAILED AA.
   Those corrections are kept in the dark block at the bottom: --accent and
   --danger are ring colours only, and --text-muted was lifted from #8B8E96
   (4.02 on elevated) to #9DA0A8.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ======================================================================
     1. GROUND
     ----------------------------------------------------------------------
     The board is a shade off white so a screen thumbnail sits ON something.
     Panels and cards are white. That single step is what makes a grid of
     uploads read as a board rather than as floating tiles.
     ====================================================================== */

  --bg-canvas:   #F1F2F4;   /* the board, the page ground                   */
  --bg-panel:    #FFFFFF;   /* sidebar, top bar, table head                 */
  --bg-elevated: #FFFFFF;   /* cards, dialogs, menus, inputs                */
  --bg-hover:    #EDEEF1;   /* row and item hover                           */
  --bg-press:    #E3E5E9;

  /* The mat behind a screen thumbnail. Deliberately the SAME as --bg-canvas
     rather than white: a brighter mat under a design shifts how its own
     background reads, and the designer blames the design. */
  --bg-shot:     #F1F2F4;

  /* ======================================================================
     2. INK
     ----------------------------------------------------------------------
     Two live tiers. --text-dim is for DISABLED CONTROLS ONLY, which WCAG
     exempts; it must never carry information a user needs.
     ====================================================================== */

  --text-primary: #14161A;  /* 16.17 canvas / 18.11 white / 15.61 hover     */
  --text-muted:   #5F6673;  /*  5.16 /  5.78 /  4.98 — clears AA on all three */
  --text-dim:     #9AA1AD;  /* disabled only. Never information.            */
  --text-on-fill: #FFFFFF;

  /* ======================================================================
     3. LINES — two, with different jobs and different requirements
     ----------------------------------------------------------------------
     A separator divides; it carries no meaning and has no contrast floor.
     A control's edge tells you where the control is, and needs 3:1.
     ====================================================================== */

  --border:         #E2E4E9;  /* separators, card edges — decorative        */
  --border-control: #7E8593;  /* input and button edges — 3.71 / 3.31       */

  /* ======================================================================
     4. ACCENT — one hue, three lightnesses, each measured for its own job
     ----------------------------------------------------------------------
     A single --accent cannot be a button ground AND a link colour: the
     ground needs to be dark enough for white, the text dark enough against
     white, and a ring light enough to be seen against both. Three values,
     one hue.
     ====================================================================== */

  --accent:        #4B7BEC;  /* selection and focus RINGS ONLY.             */
                             /* 3.93 on white, 3.51 on canvas — clears the  */
                             /* 3:1 a non-text boundary needs. Never text.  */
  --accent-fill:   #4068D0;  /* primary button ground. White on it 5.11.    */
  --accent-press:  #3560C9;
  --accent-text:   #2F58BE;  /* links, current nav label — 5.75 / 6.44      */
  --accent-wash:   #E0E8FB;  /* selected row ground. Muted text on it 4.71, */
                             /* accent text 5.25, ink 14.75.                */
                             /* A darker #D8E2F9 looked better and put muted */
                             /* text at 4.45 — a fail nobody sees until it  */
                             /* is measured, and only on selected rows.     */

  /* ======================================================================
     5. STATUS
     ====================================================================== */

  --ok:          #1A7F37;    /* 4.73 on white                               */
  --warn:        #9A6700;    /* 4.87 on white                               */
  --warn-wash:   #FFF8E6;
  --warn-line:   #EBD9A6;
  --danger:      #E5484D;    /* destructive RING. 3.09 on white.            */
  --danger-fill: #C0272D;    /* destructive button. White on it 5.88.       */
  --danger-text: #C0272D;    /* 5.25 / 5.88                                 */
  --danger-wash: #FDECEC;

  --transparent: transparent;

  /* ======================================================================
     6. OVER ARTWORK
     ----------------------------------------------------------------------
     A badge sitting on an uploaded screen cannot use theme ink: the ink
     behind it belongs to somebody else's design. It is always a dark plate
     with a white label, in both themes.
     ====================================================================== */

  --over-art:     rgba(0, 0, 0, .62);
  --over-art-ink: #FFFFFF;
  --scrim:        rgba(18, 20, 24, .46);

  /* ======================================================================
     7. THE ARTWORK STAND-IN
     ----------------------------------------------------------------------
     Not designs — the smallest honest shape that reads as "a mobile screen"
     on a board. Tokenised so the board changes with the theme; a real upload
     replaces the whole node with an <img>.
     ====================================================================== */

  --art-ground: #EEF0F4;
  --art-band:   #C3C9D4;
  --art-head:   #D3D8E1;
  --art-hero:   #DDE1E9;
  --art-blk:    #E5E8ED;
  --art-fill:   #F5F6F9;

  /* ======================================================================
     8. TYPE
     ----------------------------------------------------------------------
     A tool used all day by three people. 13px body is deliberate density,
     not a slip — the alternative is scrolling past work to find work.
     ====================================================================== */

  --font-ui:   ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --t-11: 11px;   /* pixel dimensions on a card, keyboard hints             */
  --t-12: 12px;   /* meta, table cells, counts                              */
  --t-13: 13px;   /* body, controls, labels — the workhorse                 */
  --t-14: 14px;   /* the sidebar's navigation — read at a glance, all day  */
  --t-15: 15px;   /* card titles, section names                             */
  --t-18: 18px;   /* page title                                             */
  --t-22: 22px;   /* dialog title, share view project name                  */
  --t-28: 28px;   /* auth heading, empty-state heading                      */

  --w-regular:  400;
  --w-medium:   500;
  --w-semibold: 600;

  --lh-tight: 1.25;
  --lh-snug:  1.4;
  --lh-body:  1.55;

  /* ======================================================================
     9. SPACE — the complete scale. There is nothing between these.
     ----------------------------------------------------------------------
     Every value a rule may use is listed here. A shorthand containing one
     token that does not exist voids the WHOLE declaration silently, so the
     scale is written out rather than assumed.
     ====================================================================== */

  --s-0:  0px;
  --s-2:  2px;
  --s-4:  4px;
  --s-6:  6px;
  --s-8:  8px;
  --s-10: 10px;
  --s-12: 12px;
  --s-16: 16px;
  --s-20: 20px;
  --s-24: 24px;
  --s-32: 32px;
  --s-40: 40px;
  --s-56: 56px;

  /* ======================================================================
     10. SHAPE AND DEPTH
     ----------------------------------------------------------------------
     Shadows are far softer here than in the dark theme. On a dark ground a
     shadow is the only way to lift a card; on a light one the border already
     does that, and a heavy shadow reads as dirt.
     ====================================================================== */

  --r-4:    4px;
  --r-6:    6px;    /* the plan's --radius. Cards, buttons, inputs.         */
  --r-10:   10px;   /* dialogs                                             */
  --r-16:   16px;   /* the sign-in card and its cover panel                */
  --r-full: 999px;

  /* The sign-in cover.
     Every stop sits between #16265C and #4068D0. That ceiling is not a taste
     call: white on #4068D0 measures 5.11 and white on the next step up
     (#4B7BEC) measures 3.93, which fails. A mesh gradient has no single
     background colour to check, so the whole range is kept inside the passing
     band and the check stops being necessary.
     CSS gradients resolve through var() and paste into Figma as real fills. */
  --cover-mesh:
    radial-gradient(120% 90% at 16% 6%,   #1B2E75 0%, transparent 56%),
    radial-gradient( 92% 72% at 82% 24%,  #3355BC 0%, transparent 60%),
    radial-gradient(104% 82% at 28% 74%,  #4068D0 0%, transparent 62%),
    radial-gradient( 84% 64% at 90% 94%,  #23387F 0%, transparent 60%),
    linear-gradient(158deg, #243C96 0%, #16265C 100%);

  --shadow-card:  0 1px 2px rgba(16, 20, 28, .06);
  --shadow-menu:  0 4px 16px rgba(16, 20, 28, .14);
  --shadow-modal: 0 16px 48px rgba(16, 20, 28, .20);
  --ring:         0 0 0 2px var(--accent);
  --ring-focus:   0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--accent);

  /* ======================================================================
     11. LAYOUT
     ====================================================================== */

  --canvas-width:  1440px;
  --canvas-min:    1024px;
  --canvas-max:    1680px;
  /* A MINIMUM, not a fixed height. 100vh rather than 900px because the two are
     the same thing during capture — an artboard is shot at 1440×900, so 100vh
     IS 900px — while in the running app it follows the real window instead of
     leaving a short page scrolling against a 900px floor. */
  --canvas-height: 100vh;

  --sidebar-w:  220px;
  --topbar-h:   52px;
  --row-h:      32px;   /* table and list rows — dense on purpose           */
  --control-h:  32px;
  --control-lg: 38px;   /* auth and dialog primary controls                 */

  --dialog-w-sm: 420px;
  --dialog-w:    520px;
  --dialog-w-lg: 680px;

  /* The screen card. 393pt iOS artwork at this width is the board's unit. */
  --shot-w:      168px;
  --shot-ratio:  393 / 852;

  /* Free canvas (FR-5). Everything placed on the canvas snaps to this.
     24px because it divides the 16px gutter's rhythm evenly and because a
     card is seven units wide — a screen dropped beside another lines up with
     it without anybody aiming. */
  --free-unit:   24px;

  --content-max: 1180px;

  /* ======================================================================
     12. MOTION
     ====================================================================== */

  --dur:  120ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
}

/* ==========================================================================
   DARK — opt-in, via data-theme="dark" on <html>
   --------------------------------------------------------------------------
   This is the plan's own palette (§9.3), with its three AA failures fixed:

     plan value            measured                       resolution
     --------------------  -----------------------------  ------------------
     --accent  #4B7BEC     white on it 3.93 — FAILS as a  rings only
                           button ground
     --danger  #E5484D     white on it 3.91 — FAILS       rings only
     --text-muted #8B8E96  4.02 on --bg-elevated — FAILS  lifted to #9DA0A8

   The hue is unchanged in all three cases. Only lightness moved.

   Only what differs from light is redefined here. Space, type, radius and
   layout are one set of values shared by both themes.
   ========================================================================== */

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-canvas:   #1E1F23;
  --bg-panel:    #26272C;
  --bg-elevated: #2E3036;
  --bg-hover:    #35373E;
  --bg-press:    #3D3F47;
  --bg-shot:     #1E1F23;

  --text-primary: #E8E9EB;  /* 13.55 / 12.27 / 10.86                        */
  --text-muted:   #9DA0A8;  /*  6.29 /  5.70 /  5.04                        */
  --text-dim:     #6E717A;

  --border:         #3A3C43;
  --border-control: #767A83;  /* 3.83 / 3.46 / 3.07                         */

  --accent:       #4B7BEC;    /* 4.19 on canvas — a ring, never text        */
  --accent-fill:  #4068D0;    /* white on it 5.11                           */
  --accent-press: #3560C9;
  --accent-text:  #7EA2F5;    /* 6.57 / 5.94 / 5.26                         */
  --accent-wash:  #232A3D;

  --ok:          #3FB950;     /* 6.48 / 5.87 / 5.19                         */
  --warn:        #D29922;     /* 6.52 / 5.90 / 5.23                         */
  --warn-wash:   #2A2519;
  --warn-line:   #4A3D1C;
  --danger:      #E5484D;
  --danger-fill: #CC3B3F;     /* white on it 4.92                           */
  --danger-text: #F0797D;     /* 6.07 / 5.49 / 4.86                         */
  --danger-wash: #33191B;

  --scrim: rgba(12, 13, 15, .68);

  --art-ground: #262A33;
  --art-band:   #454B58;
  --art-head:   #3A4150;
  --art-hero:   #3E4657;
  --art-blk:    #333A47;
  --art-fill:   #2C323D;

  --shadow-card:  0 1px 3px rgba(0, 0, 0, .40);
  --shadow-menu:  0 4px 16px rgba(0, 0, 0, .45);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, .55);
}
