/* ═══ dash macOS: design tokens (final: A's chrome + B's human details) ═══════════════
   Drop-in for the top of apps/web/src/styles.css. Replaces the old dark-only :root.
   Light by default; dark via the system (prefers-color-scheme) or <html data-theme="dark">;
   <html data-theme="light"> forces light. Accessibility settings swap tokens only.
   Colour rule (PLAN.md rule 7, updated): system blue = actions and selection;
   amber = "needs you" and nothing else; green and red = status only. No project tint.
   Spec and rationale: docs/designs/macos/final/spec.md
   ═════════════════════════════════════════════════════════════════════════════════ */
:root{
  color-scheme: light;

  /* type: the system stack, no web fonts */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --fs-title: 15px;   /* Title 3: toolbar title, focused pane name */
  --fs-body: 13px;    /* Body / Headline */
  --fs-callout: 12px; /* task lines, hints */
  --fs-sub: 11px;     /* section heads (sentence case), meta */
  --fs-foot: 10px;    /* badges */
  --fs-mono: 12px;    /* terminals, 18px line height */

  /* text and lines */
  --label: rgba(0,0,0,.85);
  --label-2: rgba(0,0,0,.52);
  --label-3: rgba(0,0,0,.28);
  --sep: rgba(0,0,0,.10);
  --fill: rgba(0,0,0,.05);          /* hover */
  --fill-2: rgba(0,0,0,.08);        /* pressed, quiet selection */

  /* actions and selection: system blue */
  --accent: #0088ff;                 /* focus ring, selection glyphs */
  --accent-fill: #0071e3;            /* default button, selected row, send; white text 4.7:1 */
  --accent-ink: #0068d6;             /* blue text: links, "With you", attach hint */
  --accent-wash: rgba(0,136,255,.12);
  --on-accent: #ffffff;

  /* needs you: amber, and only that */
  --needs: #e8a33d;
  --needs-ink: #8f5a00;              /* amber text on paper, 5.8:1 */
  --needs-wash: rgba(232,163,61,.16);
  --on-needs: #1a1408;
  --needs-edge: #a86a0f;             /* ◆ outline: amber alone is 2.2:1 on white, graphics need 3:1 */

  /* status */
  --working: #34c759;  --working-ink: #1f7a35;
  --error: #ff383c;    --error-ink: #c9141b;
  --idle: #8e8e93;

  /* surfaces: the content layer is opaque paper, never glass */
  --desktop:
    radial-gradient(60% 70% at 12% 8%, #e3eefb 0, rgba(227,238,251,0) 70%),
    radial-gradient(50% 60% at 88% 22%, #8fbdea 0, rgba(143,189,234,0) 70%),
    radial-gradient(70% 60% at 40% 105%, #4d8bd6 0, rgba(77,139,214,0) 70%),
    linear-gradient(160deg, #b7d4f2 0%, #6c9fdc 100%);
  --win-bg: rgba(242,242,245,.88);
  --win-filter: blur(60px) saturate(160%);
  --card: #ffffff;
  --card-shadow: 0 0 0 .5px var(--sep), 0 1px 2px rgba(0,0,0,.05);
  --term: #ffffff;                   /* PROVISIONAL: terminal well, see terminal-theme.md (Lumen) */
  --inset: rgba(0,0,0,.03);          /* grouped lists, Needs cards, bands */
  --bubble: #f0f0f3;                 /* Atlas's chat bubbles */
  --bubble-you: var(--accent-fill);  /* your bubble (see spec §5: the one blue that isn't a control) */
  --bubble-you-fg: #ffffff;
  --diff-add: rgba(0,0,0,.06);      /* neutral: green only ever means status */
  --diff-add-ink: var(--label);
  --kbd-bg: rgba(0,0,0,.06);
  --monogram: linear-gradient(180deg, #a9aeb9, #858b97);

  /* functional layer: Liquid Glass, regular variant */
  --sb-bg: rgba(250,250,252,.60);
  --sb-wall-filter: blur(34px) saturate(170%);
  --sb-wall-opacity: 1;
  --glass-ctl: rgba(255,255,255,.66);
  --ctl-filter: blur(16px) saturate(180%);
  --menu-bg: rgba(246,246,248,.74);
  --menu-filter: blur(40px) saturate(180%);
  --glass-edge: inset 0 0 0 .5px rgba(0,0,0,.10);
  --glass-spec: inset 0 1px 0 rgba(255,255,255,.85);
  --lift: 0 8px 28px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --lens: #ffffff;                   /* selected segment / tab */
  --lens-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.06);

  /* controls */
  --ctl-bg: #ffffff;
  --ctl-shadow: 0 0 0 .5px rgba(0,0,0,.14), 0 .5px 1.5px rgba(0,0,0,.12);
  --field-bg: #ffffff;
  --field-ring: inset 0 0 0 .5px rgba(0,0,0,.18), inset 0 .5px 1px rgba(0,0,0,.05);
  --def-bg: linear-gradient(180deg, color-mix(in srgb, var(--accent-fill) 88%, #fff), var(--accent-fill));
  --def-edge: 0 0 0 .5px rgba(0,60,140,.4), 0 1px 2px rgba(0,60,140,.25), inset 0 .5px 0 rgba(255,255,255,.3);
  --ring: var(--accent);

  /* reduced-transparency fallbacks (solid) */
  --solid-glass: #ececef;
  --solid-ctl: #f6f6f8;
  --solid-win: #f2f2f5;

  /* window controls: packaged Mac app only, never drawn in the browser tab */
  --tl-r: #ff5f57; --tl-y: #febc2e; --tl-g: #28c840; --tl-off: #d4d4d8;

  /* geometry */
  --r-window: 20px;  --r-sidebar: 12px;  --r-card: 12px;  --r-inner: 8px;  --r-ctl: 7px;
  --sidebar-w: 224px;   /* 180–360, drag edge */
  --pm-w: 400px;        /* 360–760, drag edge; the Needs column follows */
  --rail-w: 60px;       /* hidden sidebar */
  --toolbar-h: 52px;  --status-h: 28px;  --pane-head-h: 40px;

  /* motion */
  --t-hover: 120ms;
  --t-panel: 380ms;
  --t-attach: 220ms;
  --press: .96;
  --move: 1;         /* 0 under Reduce Motion: every transform is multiplied by it */
  --rm: 0;           /* 1 under Reduce Motion: scripts read it */
  --arrive-y: -12px;
  --arrive-s: .98;
  --live-play: running;
  --ease-std: cubic-bezier(.25,.1,.25,1);
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease-in: cubic-bezier(.5,0,.9,.5);
  --spring-smooth: linear(0, .049, .157, .285, .411, .525, .624, .706, .772, .825, .866, .899, .924, .943, .957, .968, .976, .982, .987, .99, .993, .995, .996, .997, 1);
  --spring-snappy: linear(0, .047, .156, .291, .43, .559, .672, .765, .838, .895, .936, .966, .986, .998, 1.006, 1.01, 1.011, 1.011, 1.01, 1.008, 1.007, 1.005, 1.004, 1.003, 1);
  --spring-bouncy: linear(0, .061, .2, .371, .542, .692, .815, .907, .972, 1.013, 1.036, 1.045, 1.045, 1.041, 1.033, 1.025, 1.018, 1.011, 1.006, 1.003, 1, .999, .998, .998, 1);
}

/* ── Dark: same block twice, for the system setting and for the in-app toggle ── */
:root[data-theme="dark"]{ 
  color-scheme: dark;
  --label: rgba(255,255,255,.88);
  --label-2: rgba(255,255,255,.55);
  --label-3: rgba(255,255,255,.28);
  --sep: rgba(255,255,255,.10);
  --fill: rgba(255,255,255,.07);
  --fill-2: rgba(255,255,255,.11);
  --accent: #0091ff;
  --accent-fill: #0071e3;
  --on-accent: #ffffff;
  --accent-ink: #4fb0ff;
  --accent-wash: rgba(0,145,255,.18);
  --working: #30d158;
  --working-ink: #4cd964;
  --error: #ff4245;
  --error-ink: #ff6b6e;
  --idle: #98989d;
  --desktop:
    radial-gradient(60% 70% at 12% 8%, #1d3d74 0, rgba(29,61,116,0) 70%),
    radial-gradient(50% 60% at 88% 22%, #173a6e 0, rgba(23,58,110,0) 70%),
    radial-gradient(70% 60% at 40% 105%, #2b58a6 0, rgba(43,88,166,0) 70%),
    radial-gradient(40% 50% at 70% 70%, #3b2c6e 0, rgba(59,44,110,0) 70%),
    linear-gradient(160deg, #0d1a33 0%, #091226 100%);
  --menubar-fg: rgba(255,255,255,.9);
  --win-bg: rgba(24,24,27,.90);
  --card: #212125;
  --term: #1a1a1e;
  --bubble: rgba(255,255,255,.08);
  --diff-add: rgba(255,255,255,.08);
  --diff-add-ink: var(--label);
  --needs-edge: transparent;
  --kbd-bg: rgba(255,255,255,.1);
  --needs: #e8a33d;
  --needs-ink: #f0b457;
  --needs-wash: rgba(232,163,61,.16);
  --card-shadow: 0 0 0 .5px var(--sep), 0 1px 2px rgba(0,0,0,.3);
  --inset: rgba(255,255,255,.04);
  --sb-bg: rgba(40,40,46,.52);
  --sb-wall-filter: blur(34px) saturate(150%) brightness(.8);
  --glass-ctl: rgba(70,70,78,.42);
  --menu-bg: rgba(40,40,46,.72);
  --glass-edge: inset 0 0 0 .5px rgba(255,255,255,.10);
  --glass-spec: inset 0 1px 0 rgba(255,255,255,.14);
  --lift: 0 10px 32px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.4);
  --lens: rgba(255,255,255,.16);
  --lens-shadow: 0 1px 3px rgba(0,0,0,.3), inset 0 .5px 0 rgba(255,255,255,.12);
  --ctl-bg: rgba(255,255,255,.13);
  --ctl-shadow: inset 0 .5px 0 rgba(255,255,255,.1), 0 0 0 .5px rgba(0,0,0,.4), 0 .5px 1.5px rgba(0,0,0,.3);
  --field-bg: rgba(255,255,255,.06);
  --field-ring: inset 0 0 0 .5px rgba(255,255,255,.14);
  --monogram: linear-gradient(180deg, #7d828d, #5c616b);
  --solid-glass: #2a2a2e;
  --solid-ctl: #333338;
  --solid-win: #18181b;
  --tl-off: #4a4a50;
 }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ 
  color-scheme: dark;
  --label: rgba(255,255,255,.88);
  --label-2: rgba(255,255,255,.55);
  --label-3: rgba(255,255,255,.28);
  --sep: rgba(255,255,255,.10);
  --fill: rgba(255,255,255,.07);
  --fill-2: rgba(255,255,255,.11);
  --accent: #0091ff;
  --accent-fill: #0071e3;
  --on-accent: #ffffff;
  --accent-ink: #4fb0ff;
  --accent-wash: rgba(0,145,255,.18);
  --working: #30d158;
  --working-ink: #4cd964;
  --error: #ff4245;
  --error-ink: #ff6b6e;
  --idle: #98989d;
  --desktop:
    radial-gradient(60% 70% at 12% 8%, #1d3d74 0, rgba(29,61,116,0) 70%),
    radial-gradient(50% 60% at 88% 22%, #173a6e 0, rgba(23,58,110,0) 70%),
    radial-gradient(70% 60% at 40% 105%, #2b58a6 0, rgba(43,88,166,0) 70%),
    radial-gradient(40% 50% at 70% 70%, #3b2c6e 0, rgba(59,44,110,0) 70%),
    linear-gradient(160deg, #0d1a33 0%, #091226 100%);
  --menubar-fg: rgba(255,255,255,.9);
  --win-bg: rgba(24,24,27,.90);
  --card: #212125;
  --term: #1a1a1e;
  --bubble: rgba(255,255,255,.08);
  --diff-add: rgba(255,255,255,.08);
  --diff-add-ink: var(--label);
  --needs-edge: transparent;
  --kbd-bg: rgba(255,255,255,.1);
  --needs: #e8a33d;
  --needs-ink: #f0b457;
  --needs-wash: rgba(232,163,61,.16);
  --card-shadow: 0 0 0 .5px var(--sep), 0 1px 2px rgba(0,0,0,.3);
  --inset: rgba(255,255,255,.04);
  --sb-bg: rgba(40,40,46,.52);
  --sb-wall-filter: blur(34px) saturate(150%) brightness(.8);
  --glass-ctl: rgba(70,70,78,.42);
  --menu-bg: rgba(40,40,46,.72);
  --glass-edge: inset 0 0 0 .5px rgba(255,255,255,.10);
  --glass-spec: inset 0 1px 0 rgba(255,255,255,.14);
  --lift: 0 10px 32px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.4);
  --lens: rgba(255,255,255,.16);
  --lens-shadow: 0 1px 3px rgba(0,0,0,.3), inset 0 .5px 0 rgba(255,255,255,.12);
  --ctl-bg: rgba(255,255,255,.13);
  --ctl-shadow: inset 0 .5px 0 rgba(255,255,255,.1), 0 0 0 .5px rgba(0,0,0,.4), 0 .5px 1.5px rgba(0,0,0,.3);
  --field-bg: rgba(255,255,255,.06);
  --field-ring: inset 0 0 0 .5px rgba(255,255,255,.14);
  --monogram: linear-gradient(180deg, #7d828d, #5c616b);
  --solid-glass: #2a2a2e;
  --solid-ctl: #333338;
  --solid-win: #18181b;
  --tl-off: #4a4a50;
 } }

/* ── Reduce Transparency: glass becomes solid; nothing else changes ── */
@media (prefers-reduced-transparency: reduce){ :root{ 
  --sb-bg: var(--solid-glass);
  --sb-wall-opacity: 0;
  --glass-ctl: var(--solid-ctl);
  --ctl-filter: none;
  --menu-bg: var(--solid-glass);
  --menu-filter: none;
  --win-bg: var(--solid-win);
  --win-filter: none;
  --glass-edge: inset 0 0 0 1px var(--sep);
 } }

/* ── Reduce Motion: no transforms, fades only, the working pulse stops ── */
@media (prefers-reduced-motion: reduce){ :root{ 
  --t-panel: 0ms;
  --press: 1;
  --move: 0;
  --rm: 1;
  --arrive-y: 0px;
  --arrive-s: 1;
  --live-play: paused;
 } }

/* ── Increase Contrast ── */
@media (prefers-contrast: more){
  :root{ --sep: rgba(0,0,0,.35); --label-2: rgba(0,0,0,.72); --glass-edge: inset 0 0 0 1px rgba(0,0,0,.35); --card-shadow: 0 0 0 1px rgba(0,0,0,.35); }
  :root[data-theme="dark"]{ --sep: rgba(255,255,255,.35); --label-2: rgba(255,255,255,.78); --glass-edge: inset 0 0 0 1px rgba(255,255,255,.35); --card-shadow: 0 0 0 1px rgba(255,255,255,.35); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){ --sep: rgba(255,255,255,.35); --label-2: rgba(255,255,255,.78); --glass-edge: inset 0 0 0 1px rgba(255,255,255,.35); --card-shadow: 0 0 0 1px rgba(255,255,255,.35); }
}
