/* ============ my.adhd — shared theme ============
   Loaded by every page before bento.css, which draws the look (the ground
   and the pieces, BRAND.md §5), and then the page's own sheet.
   Palette: Vivid Blue #4737FF, the lilac ground by day and #101018 by
   night, Stone Gray for secondary text. Vivid Orange is the mark, and
   everything that is late, urgent or pressed (BRAND.md §3.3); what makes
   it work as a signal is that nothing else on the page competes for it.
   Destructive is --danger, a different red for a different question, and
   the two never swap.
   Type: Baloo 2 (variable, 400-800), self-hosted. */

/* ============ the site's two faces ============
   Baloo 2 above is the app's and the wordmark's, and it stays theirs. The
   public site is set in DM Sans and DM Mono — light-weight sans at large
   sizes for anything that is a sentence, mono for anything that is a
   label. Self-hosted for the same reason Baloo is: a page that has to ask
   a third party before it can draw its own headline is a page with a
   flash of the wrong type in it.

   DM Sans is the variable file, so one request covers 100-900 and the
   site can set 400 everywhere and mean it. DM Mono has no variable cut;
   400 is the working weight and 300 is for the big grey lines. */
@font-face{
  font-family:"DM Sans";
  src:url("../fonts/DMSans-Variable.woff2") format("woff2-variations"),
      url("../fonts/DMSans-Variable.woff2") format("woff2"),
      url("../fonts/DMSans-Variable.ttf") format("truetype");
  font-weight:100 900;
  font-style:normal;
  font-display:swap;
}
@font-face{
  font-family:"DM Mono";
  src:url("../fonts/DMMono-Regular.woff2") format("woff2"),
      url("../fonts/DMMono-Regular.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}
@font-face{
  font-family:"DM Mono";
  src:url("../fonts/DMMono-Light.woff2") format("woff2"),
      url("../fonts/DMMono-Light.ttf") format("truetype");
  font-weight:300;
  font-style:normal;
  font-display:swap;
}

/* Two faces, one family. Everything but Devanagari comes from a 61 KB
   WOFF2 cut of the variable font (tools/fonts.py); the 667 KB TTF is only
   fetched for a Devanagari character, which this site never writes. The
   ranges are tools/fonts.py's DEVANAGARI, and must move with it. */
@font-face{
  font-family:"Baloo 2";
  src:url("../fonts/Baloo2-Latin.woff2") format("woff2-variations"),
      url("../fonts/Baloo2-Latin.woff2") format("woff2");
  font-weight:400 800;
  font-style:normal;
  font-display:swap;
  unicode-range:U+0000-08FF, U+0980-1CCF, U+1D00-A8DF, U+A900-10FFFF;
}
@font-face{
  font-family:"Baloo 2";
  src:url("../fonts/Baloo2-Variable.ttf") format("truetype-variations"),
      url("../fonts/Baloo2-Variable.ttf") format("truetype");
  font-weight:400 800;
  font-style:normal;
  font-display:swap;
  unicode-range:U+0900-097F, U+1CD0-1CFF, U+A8E0-A8FF;
}

:root{
  color-scheme:light;   /* keep form controls and scrollbars light */

  /* brand */
  --blue:#4737FF;        /* Vivid Blue   */
  --blue-deep:#3529BF;
  --blue-pale:#ACA5FF;
  --pale:#D1CDFF;        /* Pale Blue    */
  --navy:#202030;        /* Deep Blue    */
  --black:#101018;
  --stone:#5E5E6A;       /* Stone Gray   */
  --orange:#F75C03;      /* Vivid Orange — the mark, and late */
  --violet:#7B3FE4;      /* logo capsule  */
  --violet-deep:#3A1C86; /* the violet's deep end — the field runs to it */
  --violet-pale:#DCC9FF; /* and its pale one, for the same field on paper */
  --danger:#D92D20;      /* destructive only — never decoration */
  /* The word wears the capsule's colour, in both themes — the lockup reads
     as one object only while the two purples are the same purple. */
  --wordmark-accent:var(--violet);

  /* surfaces + text */
  --backdrop:#E9E7FB;
  --surface:#FFFFFF;
  --wash:#F4F3FE;
  --wash-2:#E9E7FD;
  --ink:var(--black);
  --ink-soft:var(--navy);
  --muted:var(--stone);
  --faint:#6B6B7A;   /* AA on white and on --wash: 5.2:1 / 4.8:1 */
  --line:#E4E2F5;
  --line-strong:#CFCBE9;
  --accent:var(--blue);

  --measure:720px;      /* readable column width for the app */
  /* The public site's two families — see the @font-face blocks above.
     --display stays Baloo and stays the app's; on the site it is worn by
     the wordmark and by nothing else. */
  --sans:"DM Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --mono:"DM Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --ease:cubic-bezier(.22,.9,.28,1);
  --display:"Baloo 2",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  /* An icon's stroke is the stem of the text it sits with (BRAND.md §4.3),
     measured from fonts/ in em, so a stroke in these follows its label's
     size. The two faces agree to .004em up to 600 and part at 700. Draw
     with vector-effect:non-scaling-stroke, so the em is screen pixels. */
  --stem-400:.082em;
  --stem-500:.1em;
  --stem-600:.122em;
  --stem-sans-700:.135em;
  --stem-baloo-700:.148em;
  --stem-sans-800:.14em;
  --stem-baloo-800:.17em;
}


/* tokens the app paints accent-coloured chrome with. Split out so the
   dark scheme can flip the text on top of them — white on a light
   lavender accent is unreadable. */
:root{
  --on-accent:#FFFFFF;
  /* --danger is the button fill and carries white text at 4.8:1 on both
     grounds, so it does not move. Red as *text* is the part that fails on
     a dark page, hence a separate ink. */
  --danger-ink:var(--danger);
  --danger-wash:rgba(217,45,32,.06);
}

/* ============ night ============
   Only the values move; every selector in the app already reads a token.
   The palette is defined once in a custom property block and applied by
   both the explicit toggle and the system preference. Brand blue is far
   too dark to sit on #101018, so the accent lifts to the pale blue and
   text on top of it goes back to near-black. */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;

    --backdrop:#15151F;
    --surface:#101018;
    --wash:#1A1A26;
    --wash-2:#232333;
    --ink:#F3F2FB;
    --ink-soft:#D6D4EA;
    --muted:#9A98AC;
    --faint:#8B8AA0;
    --line:#262636;
    --line-strong:#3B3A52;
    --accent:#8B7DFF;

    /* --violet is deliberately NOT overridden here, and used to be.

       It was lifted to #A97BFF at night because #7B3FE4 gives 3.31:1 on
       #101018, measured against the 4.5:1 that 16px bold text needs. But
       the wordmark is not text in that sense: WCAG 1.4.3 exempts logotypes
       outright — "text that is part of a logo or brand name has no
       contrast requirement" — and ".adhd" is half the brand name. The
       threshold being enforced did not apply to the thing it was applied
       to.

       What the lift cost was the mark's identity across surfaces.
       favicon.svg, icons/icon-source.svg and icons/mark-solid.svg all
       carry #7B3FE4 on their own fixed ground and cannot follow a theme,
       so a token that moved at night meant the lockup in the nav was a
       different purple from the one in the browser tab beside it. One
       brand purple, both themes, matching every standalone export.

       The capsule and the word still share the token, so the lockup still
       reads as one object — that part of the old note stands. */

    --on-accent:#101018;
    --danger-ink:#FF8A7E;
    --danger-wash:rgba(255,138,126,.10);
  }
}

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

  --backdrop:#15151F;
  --surface:#101018;
  --wash:#1A1A26;
  --wash-2:#232333;
  --ink:#F3F2FB;
  --ink-soft:#D6D4EA;
  --muted:#9A98AC;
  --faint:#8B8AA0;
  --line:#262636;
  --line-strong:#3B3A52;
  --accent:#8B7DFF;

  /* --violet is deliberately NOT overridden here — see the matching note in
     the prefers-color-scheme block above for why the night lift came out.
     Short version: it was enforcing a contrast threshold that WCAG 1.4.3
     exempts logotypes from, and the cost was the nav's mark being a
     different purple from the favicon's. */

  --on-accent:#101018;
  --danger-ink:#FF8A7E;
  --danger-wash:rgba(255,138,126,.10);
}

/* ============ the brand lockup ============
   Defined once. It used to live in both chrome.css and styles.css, which
   is how the app ended up a pixel tighter than the landing page. */
/* The asterisk spans 18-82 of its 100-unit viewBox, so the ink starts
   --logo-bearing in from the edge of the box. A lockup sitting flush on the
   gutter therefore *looks* inset by that much — which is why the toggle,
   whose ring has no such bearing, read as closer to the screen edge than
   the mark did even though both measured the same 20px. */
:root{--logo-size:26px; --logo-bearing:calc(var(--logo-size) * .18)}
.logo{width:var(--logo-size); height:var(--logo-size); flex:none; display:block}
.lg-star{fill:var(--orange)}
.lg-pill{stroke:var(--violet)}
.wordmark{font-family:var(--display); font-size:16px; font-weight:700; letter-spacing:-.03em; color:var(--ink)}
.wordmark .accent{color:var(--wordmark-accent)}
.brand-lockup{display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit; border-radius:var(--b-radius)}
.brand-lockup:focus-visible{outline:3px solid var(--b-focus); outline-offset:4px}
@media (hover:hover){ .brand-lockup:hover .wordmark{color:var(--accent)} }

/* ---------- day / night ----------
   A round icon button that shows where the page IS, not where a click
   takes you: a sun while it is light, a moon while it is dark. It used to
   show the other one — the destination rather than the state — which is a
   defensible convention and the wrong one here, because the bar carries a
   clock two elements to its left and a reader scanning that strip reads
   the pair as one report on the time of day. The button still says what
   pressing it does; it says it in the accessible name, which is where a
   screen reader looks and where an icon cannot help anyone. */
.theme-toggle{
  /* the mark's optical bearing, given back to the other end of the bar */
  margin-right:var(--logo-bearing);
  /* A pale piece (bento.css's tokens, loaded next). Its shadow follows the
     icon: the sun casts orange and the moon blue, the one exception to a
     screen's single shadow colour (BRAND.md §5). Each page's sheet draws
     its press and its size in its own pieces section. */
  flex:none; width:44px; height:44px; display:grid; place-items:center;
  background:var(--p-pale); color:var(--black);
  border:var(--b-stroke) solid var(--b-line); border-radius:var(--b-pill);
  box-shadow:var(--b-lift-sm) var(--b-lift-sm) 0 var(--orange);
  cursor:pointer; padding:0;
}
:root[data-theme="dark"] .theme-toggle{box-shadow:var(--b-lift-sm) var(--b-lift-sm) 0 var(--blue)}
.theme-toggle svg{width:20px; height:20px; display:block}
/* Light is the default, so the sun is the resting state and the moon is
   what the dark stamp swaps in. Both sit in the button's one grid cell,
   and a swap is BRAND.md §6's: the leaving icon fades out as it blurs,
   the arriving one fades in sharp. Each state carries the transition
   that runs on the way into it. The media block is the no-JS night. */
.theme-toggle svg{grid-area:1/1}
.theme-toggle .t-moon,
:root[data-theme="dark"] .theme-toggle .t-sun{opacity:0; filter:blur(4px)}
:root[data-theme="dark"] .theme-toggle .t-moon{opacity:1; filter:none}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .theme-toggle .t-moon{opacity:1; filter:none}
  :root:not([data-theme="light"]) .theme-toggle .t-sun{opacity:0; filter:blur(4px)}
}
@media (prefers-reduced-motion:no-preference){
  .theme-toggle svg{transition:opacity .2s var(--ease)}
  .theme-toggle .t-moon,
  :root[data-theme="dark"] .theme-toggle .t-sun{transition:opacity .2s var(--ease), filter .2s var(--ease)}
  :root[data-theme="dark"] .theme-toggle .t-moon{transition:opacity .2s var(--ease)}
}

/* ============ a strip's faded edges ============
   BRAND.md §11.1: a row that scrolls sideways fades at its ends, the
   leading one once it has moved and the trailing one while there is more
   to come. A sheet masks its scroller with
     linear-gradient(90deg, transparent, black var(--edge-in) var(--edge-out), transparent)
   and runs edge-in and edge-out on scroll(self x). The mask goes on the
   scroller or on a still window inside a piece, never on a piece, whose
   own fill and outline it would fade. Where there is no scroll timeline
   the leading edge stays solid and the trailing one always fades. */
@property --edge-in{syntax:"<percentage>"; inherits:false; initial-value:0%}
@property --edge-out{syntax:"<percentage>"; inherits:false; initial-value:85%}
@keyframes edge-in{from{--edge-in:0%} to{--edge-in:15%}}
@keyframes edge-out{from{--edge-out:85%} to{--edge-out:100%}}
