/* Distill's design system: the tokens and the frame every page of the product shares.

   Two pages are built on it. The studio (web/distill/index.html) is ours and uses it directly. The clip desk
   (web/index.html) is the engine's own page; it is given this file and desk.css as it is served
   (studio/distill/brand.py), which point its variables at these tokens. One set of colours, one typeface, one
   frame, one navigation: that is what makes it one product instead of two that link to each other.

   Quiet on purpose: grey surfaces, one accent for the thing you can press, red only for something that needs
   looking at, and the system's own typeface. Token names say what a colour is for, never what it looks like,
   so a theme is a change of values here and nothing else.

   Everything shared is prefixed `ds-` or is a custom property, because this file is also loaded into a page
   that has its own `.btn`, `.nav` and `.card`. */
/* Light or dark: every colour is one `light-dark(light, dark)` pair, resolved by `color-scheme`. That follows
   the system unless a person chose otherwise in the rail, which sets `data-theme` on <html> (theme.js applies
   it before the first paint; shell.js draws the control). One list of colours, no second dark block. */
:root {
  color-scheme: light dark;
  --page: light-dark(#FFFFFF, #16171A);          /* the board: where a page's content sits */
  --raised: light-dark(#FFFFFF, #1D1E22);        /* a card, a field, a button */
  --sunk: light-dark(#F4F4F6, #111214);          /* a pressed or recessed patch */
  --fg: light-dark(#17181C, #EDEEF1);
  --fg-soft: light-dark(#5E626B, #A4A8B1);
  --fg-faint: light-dark(#6B6F78, #9296A0);
  --rule: light-dark(rgba(23, 24, 28, .12), rgba(237, 238, 241, .13));
  --rule-soft: light-dark(rgba(23, 24, 28, .06), rgba(237, 238, 241, .06));
  --side: light-dark(#F4F4F6, #0F1012);          /* the frame and its navigation */
  --side-hover: light-dark(rgba(23, 24, 28, .05), rgba(237, 238, 241, .05));
  --side-on: light-dark(rgba(23, 24, 28, .08), rgba(237, 238, 241, .09));
  --side-fg: light-dark(#3A3D44, #D3D5DA);
  --side-dim: light-dark(#80848D, #858993);
  --accent: light-dark(#4F5BD5, #8C95FF);        /* the one thing you can press */
  --accent-deep: light-dark(#3F49B8, #AAB1FF);
  --accent-soft: light-dark(#EEF0FC, #23264A);
  --accent-line: light-dark(#C9CDF5, #3E4486);
  --danger: light-dark(#C2372D, #FF8A7A);
  --danger-soft: light-dark(#FBEAE8, #3A1E1B);
  --ok: light-dark(#23784C, #7FD3A2);
  --ok-soft: light-dark(#E5F3EA, #15301F);
  --warn: light-dark(#8A5A12, #E6B76A);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --rail: 232px;
  --ds-r: 8px;              /* controls */
  --ds-r-lg: 12px;          /* panels, and the board itself */

  --on-fill: light-dark(#FFFFFF, #0E1030);       /* text on an accent or red fill */
  --edge: light-dark(rgba(23, 24, 28, .14), rgba(237, 238, 241, .15));   /* the outline round cards, fields, buttons */
  --press: var(--accent-soft);                   /* a chosen tab, format or toggle */
  --on-press: light-dark(var(--accent-deep), var(--fg));
  --press-line: var(--accent-line);
  --hint: light-dark(#8A8F98, #7A7E87);          /* a field's placeholder */
  --thumb: light-dark(#D5D7DC, #34363C);         /* a scrollbar */
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ------------------------------------------------------------------ the frame's navigation */
.ds-nav { display: flex; flex-direction: column; gap: 1px; }
.ds-nav h4, .ds-heading {
  margin: 0; padding: 14px 10px 4px; color: var(--side-dim);
  font: 500 12.5px/1.3 var(--sans); letter-spacing: 0;
}
/* A heading is a button that folds its group (shell.js). It keeps the heading's look; the chevron turns. */
.ds-fold { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 28px; margin: -6px 0 -2px; padding: 0 2px 0 0; border: 0; border-radius: 6px; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ds-fold svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.ds-fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.ds-fold:hover { color: var(--fg); }
.ds-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ds-group.shut > .ds-item:not([aria-current]), .ds-folded { display: none !important; }
@media (prefers-reduced-motion: reduce) { .ds-fold svg { transition: none; } }
.ds-item {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: 7px;
  color: var(--side-fg); text-decoration: none; font: 500 14.5px/1.2 var(--sans); white-space: nowrap;
  border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left;
}
.ds-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; color: var(--side-dim); }
.ds-item:hover { background: var(--side-hover); color: var(--fg); }
.ds-item:hover svg { color: var(--fg); }
.ds-item[aria-current="page"] { background: var(--side-on); color: var(--fg); font-weight: 600; }
.ds-item[aria-current="page"] svg { color: var(--fg); }
.ds-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (pointer: coarse) { .ds-item { min-height: 44px; } }
/* A heading only a screen reader needs: a group in the navigation whose one row already names it. */
.ds-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ds-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; text-align: center;
  background: var(--rule-soft); font-size: 12.5px; font-weight: 600; color: inherit;
}

/* What a video needs (writer, narrator, renderer): only shown when one of them is missing. */
.ds-ready { list-style: none; margin: 8px 0 0; padding: 0 10px; display: grid; gap: 4px;
  font: 400 13px/1.3 var(--sans); color: var(--danger); }
.ds-ready:empty { display: none; }
.ds-ready li { display: flex; gap: 8px; align-items: baseline; }
.ds-ready li:not(.off) { display: none; }
.ds-ready i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; }
.ds-note { display: none; }

/* <main> takes focus after a page change (so a screen reader starts there); it is not a control, so no ring. */
#main:focus { outline: none; }

/* System / Light / Dark, at the foot of the rail (shell.js `themeSwitch`). */
.ds-theme { display: inline-flex; gap: 2px; margin: 6px 10px 0; padding: 2px; border-radius: 8px; background: var(--side-hover); }
.ds-theme button { display: grid; place-items: center; width: 30px; height: 26px; border: 0; border-radius: 6px;
  background: transparent; color: var(--side-dim); cursor: pointer; }
.ds-theme button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.ds-theme button:hover { color: var(--fg); }
.ds-theme button[aria-pressed="true"] { background: var(--raised); color: var(--fg); box-shadow: 0 0 0 1px var(--rule-soft); }
.ds-theme button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse) { .ds-theme button { width: 44px; height: 36px; } }
/* The wordmark beside the mark: text, so it follows the chosen theme (an <img> of an SVG only sees the system's). */
.ds-word { font: 650 16px/1 var(--sans); letter-spacing: -.02em; color: var(--fg); }

/* ------------------------------------------------------------------ the brand's one pop colour
   Highlighter yellow, from the Glint logo (a fat drop whose shine is a play button). Calm on purpose: it is
   only ever a FILL on indigo or on a dark surface, with dark ink on it, never text or a thin line on white,
   where it all but disappears (1.12:1). Used for: the premium mark, and in dark mode the reading line and a
   chapter's sweep. Ratios in docs/UX.md's token table. The React studio carries the same values in its theme
   (web/studio-app/themes/distill/distill.theme.ts). */
:root {
  --pop: #E4FF52;
  --on-pop: #17181C;                              /* 15.8:1 on --pop */
  --pop-fill: light-dark(var(--accent), var(--pop));   /* a progress line: indigo on white, yellow on dark */
  --pop-mark-bg: light-dark(#4F5BD5, var(--pop)); /* the premium mark's disc */
  --pop-mark-fg: light-dark(var(--pop), var(--on-pop));  /* its drop: 4.94:1 on indigo, 15.8:1 on yellow */
}
/* A row that is not shown (the Credits row before billing answers): `hidden` loses to `.ds-item`'s display. */
.ds-item[hidden] { display: none; }
