/* ===========================================================================
   Candid — design system
   ---------------------------------------------------------------------------
   Lifted from the Candid.dc.html design file. That file styles everything
   inline, which is right for a design tool and wrong for an application: the
   same button appears forty times and drifts. Here each decision is made once.

   Palette, type scale, radii and motion are the design's; nothing has been
   reinterpreted.
   =========================================================================== */

:root {
  /* The three brandable slots. applyBrand() in app.js overwrites exactly these
     three on <html> from the customer's main / secondary / accent colours; the
     defaults below are Candid's own. Nothing else in this file may hard-code
     them, or a customer's palette lands everywhere except the one place that
     was written out by hand. */
  --ink:    #10211F;  /* MAIN      — headings, sidebar, primary buttons */
  --coral:  #FF9179;  /* SECONDARY — avatars, record marks, hover */
  --teal:   #00C4B4;  /* ACCENT    — progress, focus rings, selection */

  /* What goes *on top* of those three. A customer can pick a pale main colour
     as easily as a dark one, so the foreground is derived from the surface at
     runtime rather than assumed to be white. Same defaults, same result, until
     someone brands the app. */
  --on-ink:   #FFFFFF;
  --on-teal:  #10211F;
  --on-coral: #10211F;

  /* Body copy. --ink is a *surface* colour — the sidebar, the primary button —
     and reading it as the text colour too is what makes a pale brand colour
     unusable: pick buttercup yellow as your main colour and every paragraph in
     the app turns buttercup on white. applyBrand() darkens the main colour
     until it clears 7:1 against the card, and puts the result here. A brand
     that is already dark comes through untouched. */
  --text: #10211F;

  /* Candid's own ink, for foregrounds on the colours that are *not* brandable
     — the amber badge, the green "sending" pill. Those surfaces never move, so
     their text must not move with the brand either. */
  --ink-fixed: #10211F;
  /* Candid's accent and secondary, likewise unbrandable, for the one part
     that keeps Candid's colours whatever the brand: the Today calendar. */
  --teal-fixed:  #00C4B4;
  --coral-fixed: #FF9179;

  --page:   #F4F4F4;  /* app background */
  --card:   #FFFFFF;
  --amber:  #FFB300;  /* badges, warnings */
  --good:   #2E9E63;  /* solid "going well" — filled stage pills, score rings */
  --bad:    #C0362C;  /* solid "over" — dead stages, alert badges */
  --muted:  #6B6B6B;

  /* The sending calendar's four steps, as four hues rather than one ink fading
     out. The grey ramp it replaced was honest about the ordering and told you
     nothing else: three follow-ups that differed only in how washed out they
     were, which at 14px is not a difference at all.

     Fixed, not brandable. Stage 1 is the one exception — it stays on --teal
     because "the first email is the accent colour" is the point the whole
     calendar is making, and a customer's accent should carry it. The other
     three are Candid's own, so a brand with a blue accent cannot collapse
     stages 1 and 2 into the same chip.

     Ordered teal → blue → orchid → coral, cool to warm, so the ramp still
     reads as a sequence. Validated: every adjacent pair clears the
     colour-blind separation floor under protanopia, deuteranopia and
     tritanopia, and every foreground below clears 4.5:1 on its own fill. Do not
     nudge one of these by eye — the pairs are what was checked, not the
     swatches.

     The gold that used to close the ramp went with the last follow-up. The
     four that remain are the same four that were checked as a run, so nothing
     here needs re-validating. */
  --stage-1:    var(--teal);
  --stage-2:    #2450C8;
  --stage-3:    #D461C4;
  --stage-4:    #D6402F;
  --on-stage-1: var(--on-teal);
  --on-stage-2: #FFFFFF;
  --on-stage-3: var(--ink-fixed);
  --on-stage-4: #FFFFFF;
  /* The LinkedIn line on the dashboard's week: a deeper teal than --teal,
     so it holds 3:1 on white beside the other five lines. */
  --li:     #00897E;
  /* The platforms' own colours, for what is theirs: the Thread's WhatsApp
     and LinkedIn messages are tinted with them, as their marks are. */
  --whatsapp: #25D366;
  --linkedin: #0A66C2;
  --line:   #D4D4D4;
  --hair:   rgba(0, 0, 0, .08);

  /* Typography. Two slots, same deal: applyBrand() replaces the family names,
     the fallback chain stays. A brand face that fails to load therefore lands
     on Geist rather than on Times New Roman. */
  --font-head: 'Geist';
  --font-body: 'Geist';
  --font-stack: system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Weight is part of a typeface, not a detail of it: Playfair at 400 and
     Playfair at 700 are different decisions about the same brand. The design
     uses two — regular for copy, semibold for everything emphatic — so those
     are the two the customer sets.

     --weight-strong is the emphatic one, and it is *derived* from the body
     weight rather than chosen. It has to move with it: body copy at 600 beside
     labels pinned at 600 is not a bolder app, it is an app with no emphasis
     left. applyBrand() takes it a step up from the body weight, clamped to
     what the family actually publishes. */
  --weight-head:   600;
  --weight-body:   400;
  --weight-strong: 600;

  /* Candid's own mark is a single-colour SVG and is knocked out to white on the
     ink panels. A customer's logo is not ours to recolour, so applyBrand() sets
     this to `none` the moment one is uploaded. */
  --logo-filter: brightness(0) invert(1);

  /* A multiplier, not a size. The mark appears at four different heights — 28
     on the auth panel, 26 in the sidebar, 24 in the onboarding bar, 22 in the
     phone top bar — and those differences are the design's, not an accident.
     One absolute height would flatten them and blow out the top bar. Scaling
     keeps the relationships, and lets a monogram — which reads far larger than
     a wordmark at the same height — be brought back down to match. Trims
     downward only: 1 is the size every one of those four was drawn at. */
  --logo-scale: 1;

  --r-input: var(--r-btn);   /* fields share the buttons' corner (frontend/CLAUDE.md, "Corners and spacing") */
  --r-card:  24px;   /* the design's card radius; panels run 28px */
  --r-pill:  99px;

  /* Nested corners (frontend/CLAUDE.md, "Corners and spacing"). Anything
     rounded inside a rounded container takes the container's radius less the
     gap between them, so the gap runs the same width round the curve:
     inner = outer - padding, never under --r-min. --r-box and --pad-box are
     the drawer containers' (.ovbox); a container with other values re-declares
     --r-inner on itself from its own radius and padding, and its children read
     that. Round marks (photos, faces, pills, dots) are exempt: a circle has no
     corner to match. */
  --r-box:   16px;
  --pad-box: 20px;
  --r-min:   8px;
  --r-inner: max(var(--r-min), calc(var(--r-box) - var(--pad-box)));

  /* Buttons are rounded rectangles, not pills (Rob, 12 Nov 2026), so a button
     shares its corner with the photos and tiles beside it. The corner grows a
     little with the height: 8 for a small control (about 32), 10 for the
     standard one (--control-h), 12 for a 44px one. A one-line field beside a
     button takes the button's corner. */
  --r-btn-sm: 8px;
  --r-btn:    10px;
  --r-btn-lg: 12px;

  /* One spacing scale, on a 4px grid. Gaps, padding and margins take a step
     from it rather than an odd number of their own. */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* Display scale. 1 unless shared/display-scale.js sets it from the screen's
     size: .9 on a laptop, 1.2 or 1.5 on a large monitor ("Display scale"
     near the foot of this file).

     The type scale, the control heights and the spacing here are all absolute
     px, deliberately — a button is meant to be the same button on every
     screen — so there is no root font-size the app could be re-based on to
     bring it down. `zoom` on <body> is what does it, and it takes
     everything with it: type, controls, radii, borders, shadows.

     What zoom does *not* scale is vh and vw. A 100vh element inside zoom .9
     lays out at the full 720px and then paints at 648, so the shell would
     stop a tenth of the way up the screen. Nothing below may read 100vh or
     100vw directly for that reason: they read --vh and --vw, which divide the
     zoom back out. A new viewport-unit length has to go through them too. */
  --zoom: 1;
  --vh: calc(100vh / var(--zoom));
  --vw: calc(100vw / var(--zoom));

  --topbar-h: 78px;
  /* One height for every pill control on desktop — buttons, icon buttons, tabs,
     chips, the search field. If they can share a row they have to share a
     height, and the only way to guarantee that is one number they all read. */
  --control-h: 38px;
  --aside-w:  236px;
  --aside-w-collapsed: 78px;
}
/* On a touch screen every control in a row stands at the 44px a thumb can hit,
   icon buttons and chips included, so a row still shares one height. */
@media (pointer: coarse) { :root { --control-h: 44px; --r-btn: var(--r-btn-lg) } }

* { box-sizing: border-box }

/* Every scroller, not just the page.
 *
 * Setting scrollbar-color anywhere switches Chrome to standard scrollbar
 * styling for the whole document, at which point the ::-webkit-scrollbar rules
 * below are ignored and each scroller falls back to `scrollbar-width: auto` —
 * a full 16px system bar. Only <html> carried the thin declaration, so the page
 * scrollbar was slim and every inner one — the main column, the replies list,
 * the thread, the drawers — was fat. The design puts this on `*`.
 *
 * The ::-webkit- rules are kept below for browsers that do not support the
 * standard properties; where both are understood, these win. */
html, * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent }

body {
  margin: 0;
  font-family: var(--font-body), 'Geist', var(--font-stack);
  font-weight: var(--weight-body);
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { text-wrap: pretty }

/* Headings take the brand's display face and weight; everything else inherits
   the body face and weight from <body>. Both resolve to Geist at 600/400 until
   a customer picks otherwise.

   Re-scoping --weight-strong here rather than adding a second token is what
   makes the forty-odd rules that style a heading by class — .h2, .h3,
   .auth__form h1, .card__head h2 — follow the heading weight without any of
   them being edited, and without a specificity fight they were never written
   to have. A custom property set on the element is read by whichever rule
   wins. */
h1, h2, h3, h4, .h2, .h3 {
  font-family: var(--font-head), 'Geist', var(--font-stack);
  --weight-strong: var(--weight-head);
  font-weight: var(--weight-head);
}

::selection { background: var(--teal); color: var(--on-teal) }

a { color: var(--text); text-decoration: none }
a:hover { color: var(--coral) }
/* No underlines anywhere, a hard rule: a link or control shows it can be
   clicked by its weight, colour and a coral hover, never an underline. On a
   button this wins over anything later; tests/frontend.test.mjs fails on any
   underline in the stylesheets. Line-through (a done step) is not an underline. */
button, [role="button"], .btn, .chip, .linkbtn, .iconbtn, .bizbtn { text-decoration: none !important }

/* Material Symbols, as the design uses them. */
.ms {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  user-select: none;
}

.cav { font-family: 'Caveat', cursive; font-weight: var(--weight-strong) }

::-webkit-scrollbar { width: 10px; height: 10px; background: transparent }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 65%, transparent); background-clip: content-box }

/* --- even containers ---------------------------------------------------
   A container's padding is the same all round (--pad-box), but a line of
   text carries its own air: half its leading and the ascender room above its
   capitals, half its leading and the descender room below its baseline. So a
   heading at the top and a sentence at the bottom read as a bigger gap than
   the sides. The heading that opens a container and the paragraph or list
   that ends one give that air back as a negative margin, worked out from
   their own size and line height, so the gap you see is the padding on every
   side (and the 16px from a heading to its content is exact too). It is a
   margin, not text-box-trim, because the headings are flex rows (an icon, an
   edit button), which a trim does not reach. */
:is(.drawer__body .card.ovbox, .fpanel, .panel) > :is(h2, h3, h4, .ovhead, .panel__title):first-child { margin-top: calc((1em - 1lh) / 2 - .2em) }
:is(.drawer__body .card.ovbox, .fpanel, .panel) > :is(p, ul, ol):last-child { margin-bottom: calc((1em - 1lh) / 2 - .2em) }

/* --- motion ------------------------------------------------------------- */
@keyframes cdRise    { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes cdFade    { from { opacity: 0 } to { opacity: 1 } }
@keyframes cdFallPlain { from { opacity: 1; transform: none } to { opacity: 0; transform: translateY(6px) } }
@keyframes cdSpin    { to { transform: rotate(360deg) } }
@keyframes cdPulse   { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@keyframes blobMorph {
  0%, 100% { border-radius: 58% 42% 47% 53% / 46% 55% 45% 54% }
  33%      { border-radius: 38% 62% 63% 37% / 57% 39% 61% 43% }
  66%      { border-radius: 66% 34% 39% 61% / 41% 66% 34% 59% }
}
@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1) }
  50%      { transform: translate(-2.5%, 2%) rotate(2.6deg) scale(1.04) }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important }
}
