/* ---------------------------------------------------------------------
   Web fonts -- self-hosted (2026-09-18, launch-readiness plan item 2.5)

   Poppins (600, 700) and Inter (variable, 400-700) used to load from
   Google Fonts, which sent every visitor's IP address to Google and
   cost two extra connections before first text. The woff2 files in
   static/fonts/ are Google Fonts' own latin and latin-ext subsets,
   downloaded once; unicode-range means a page only fetches latin-ext if
   it actually has such characters. No other weights are used anywhere
   in this file or dashboard.css (Poppins had an unused 800 in the old
   link). templates/base.html preloads the two latin files every page
   needs first.
   --------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght.01ba6c2a184b.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-wght.65850a373e25.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600-latin-ext.5a1b7c983a9d.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600-latin.b550bca8934b.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700-latin-ext.d3aa06d13d3c.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700-latin.0bd523f60499.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------------
   Design tokens

   2026-08-19 (site owner: "the color is too many... like WSJ, CNN, CNA,
   BBC"): moved from a four-color "one badge hue per pillar" system to one
   restrained accent (--line-brand) used everywhere a color is needed for
   chrome -- nav, buttons, links, badges, card accents -- the way a real
   newsroom's site uses one brand color, not a different hue per section.
   Section identity (News/Economics/History/Higher Education) now comes
   from label text and nav placement, not color-coding.

   Revised 2026-09-13 (site owner, on the one-accent orange/blue pass
   below: "use a mix of nus blue and nus orange for the website color
   theme, not just one color for a whole page") -- back to TWO accents
   in active use, --line-brand (orange) and --accent-secondary (blue),
   but not a return to the four-hue pillar system above: this split is
   by UI ROLE, not by section. --line-brand stays the "primary action"
   color -- a solid fill paired with --line-brand-on, used for the
   actual buttons/badges/active-states a reader taps (every such fill
   pair was individually audited, not just pattern-matched, to make
   sure text-on-fill contrast still held with the fill color swapped).
   --accent-secondary took over every OTHER --line-brand usage --
   plain links, hover/focus borders, left-border-strip accents, tinted
   backgrounds -- which is the majority of call sites by a wide margin,
   so most of any given page reads as blue chrome with orange reserved
   for its handful of primary actions, rather than one color washing
   over the whole page. See --line-brand's and --accent-secondary's own
   comments below for the color history and contrast figures.

   The four --line-news/economics/history/highered constants below are
   NOT removed -- they're kept for the small number of places a color
   still carries real meaning rather than brand identity: red for
   errors/destructive actions (already a --line-news-ink reuse, same as
   any other site's danger-red) and amber for the correction/draft
   "pay attention" notices (--line-history). Each still has a darker
   "-ink" variant for AA-safe text/links, verified with a contrast
   script, not eyeballed -- see the constants below.
   --------------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  --ink: #12161f;
  --ink-soft: #454b57;
  --ink-faint: #6b7280;
  /* Revised 2026-08-19 (site owner: "color and layout need to be
     improved"): moved --paper from a near-white #f6f8fb to a clearer
     steel-blue-grey #e7ecf3 so raised cards would visibly "lift" off the
     page via background contrast alone, since a shadow wasn't enough by
     itself and the site was then in a boxed-card, transit-signage
     register. --border-strong was raised the same pass for the same
     reason (1.76:1 in dark mode against --paper-raised, worse in light).

     Revised again 2026-08-22 (site owner: wants a white background like
     the reference mockup). By this point the 2026-08-22 card-styling
     pass had already moved .story-card away from background-based
     separation entirely (no fill, no border -- typography and grid gaps
     only), so the original rationale for a tinted page background no
     longer covers the cards that actually ship today. First tried a warm
     off-white (#F7F5F0); site owner: "not good, I want white background"
     -- the reference mockup is pure white, not off-white, so --paper now
     matches --paper-raised exactly at #ffffff. The remaining raised
     surfaces (.lead-story, .secondary-card, forms, popovers) all carry
     their own real 1px --border (1.41:1 against white, a deliberately
     subtle hairline, not a hard line) plus a hover-state --border-strong
     (3.33:1 against white, clears the WCAG 1.4.11 non-text 3:1 floor for
     a UI-component boundary) -- so they stay legible via their own
     border, not via any page/card background difference, which is now
     zero. Verified visually (headless-Chromium screenshot against the
     reference mockup), not just by the numbers, since a hairline border
     reads differently than a background tint. Dark mode is untouched by
     this revision -- pure white would not translate the same way there
     (that's a separate design decision if ever raised). */
  --paper: #ffffff;
  --paper-raised: #ffffff;
  /* Revised 2026-08-22 (site owner, after the pure-white --paper change:
     "the slightly off-white impression comes from the light gray-blue
     borders, dark typography, and muted red accents -- not from the
     background itself"). --border/--border-strong were still the cool
     blue-gray pair tuned for the retired blue-gray --paper and were
     never revisited when the page went pure white -- they were the real
     source of the lingering "cool" cast the site owner was seeing, not
     an actual background-color bug (confirmed server-side: --paper is
     #ffffff, verified against the live deployed CSS). Hue-shifted both
     from blue (~216deg) to a warm neutral (~30-35deg) in the same family
     as burgundy/the retired warm-white, keeping comparable
     lightness/contrast rather than just eyeballing a new color:
     --border #e2ddd6 (1.35:1 against white paper -- a deliberately
     subtle hairline, same intent as the old 1.41:1); --border-strong
     #8c8073 (3.85:1 against white -- still clears the WCAG 1.4.11
     non-text 3:1 floor for a UI-component boundary, slightly better than
     the old pair's 3.33:1). Dark mode intentionally untouched -- this
     was a light-mode-only observation about the white background. */
  --border: #e2ddd6;
  --border-strong: #8c8073;

  /* Pillar "lines" -- badge (bright fill) / ink (AA-safe text&link) / on (text color to place ON the badge fill) */
  --line-news: #e5383b;        --line-news-ink: #a61b1e;      --line-news-on: var(--ink);
  --line-economics: #0fa968;   --line-economics-ink: #0b7a4c; --line-economics-on: var(--ink);
  --line-history: #f5a524;     --line-history-ink: #9a6400;   --line-history-on: var(--ink);
  --line-highered: #7c4fe0;    --line-highered-ink: #5b35b5;  --line-highered-on: #ffffff;

  --highlight-yellow: rgba(255, 205, 0, 0.35);
  --highlight-green:  rgba(15, 169, 104, 0.28);
  --highlight-pink:   rgba(230, 90, 150, 0.28);
  --highlight-blue:   rgba(70, 130, 220, 0.28);

  /* The "primary action" accent -- solid-fill buttons/badges/active
     states (paired with --line-brand-on), the handful of things on any
     given page meant to read as "the main thing to do here." Was a deep
     indigo (#2a4b8d), then a teal, then a burgundy (site owner,
     2026-08-20, on the indigo: "I do not like blue color, it is so
     cold, make it warm and bright" -- burgundy read as a more
     editorial/serious accent than the teal or a generic tech-blue).
     Revised again 2026-09-12 (site owner: "I want the color theme for
     the whole website to be energetic, for young students, and modern"
     -- then, on a first teal-based pass: "do not use green for the
     theme color, use nus orange and nus blue as the theme color"). NUS
     orange/blue are the National University of Singapore's own
     corporate colors, adopted here purely as a color reference the
     site owner already had in mind, with no NUS affiliation implied
     anywhere in the UI. This token cycled through several NUS oranges/
     golds while it held the PRIMARY-ACTION role -- see git history for
     that back-and-forth's full detail, since none of it is where this
     token ended up. 2026-09-13 (site owner: "make nus blue the main
     color theme, and orange the supplementary one") first tried
     swapping this token's COLOR with --accent-secondary's below (this
     one blue, that one orange) without touching any of the ~225 call
     sites referencing one or the other by name. That undersold "main"
     -- --accent-secondary still covered the majority of those call
     sites (links, hover/focus borders, tinted backgrounds), so orange
     still dominated most of any given page by sheer frequency even
     though blue owned the single most prominent element (the primary
     CTA fill). Site owner, on seeing it live: "I told you to use nus
     blue as the main color, why is it still orange?" -- --accent-
     secondary now holds the SAME blue as this token (see its own
     comment below), so every one of those ~225 call sites renders
     blue; only the header wordmark's "News" span stays orange, as a
     deliberately fixed exception (--brand-news-gold below, now its own
     value independent of either role token, so it can't get swept up
     in a future "which token is which color" swap again). Contrast
     verified with the same relative-luminance script this file's other
     color decisions cite, not eyeballed. Light mode: --line-brand-on
     #ffffff on --line-brand #003D7C = 10.72:1 (AAA); --line-brand-ink
     #002F63 on white paper = 13.23:1 (AAA). Dark mode: --line-brand
     #7CB4E8 on --paper-raised #1b212e = 7.33:1 (AAA); --line-brand-ink
     #A8D8F7 on --paper-raised #1b212e = 10.61:1 (AAA); --line-brand-on
     #0d1017 on --line-brand #7CB4E8 = 8.65:1 (AAA). */
  /* Writing-activity ramp for the Stats page (2026-09-20). A
     SEQUENTIAL scale: one hue, light to dark, four data steps. Both
     modes were run through the dataviz validator against their own
     surface -- monotone lightness, visible step gaps, and a light end
     that clears the surface by 2:1. The first light end I tried
     (#dbe6f2) failed that last check at 1.23:1, which is exactly the
     kind of thing eyeballing misses.
     --stats-l0 is ABSENCE, not a low value, so it is neutral rather
     than the palest blue. */
  --stats-l0: #eceef2;
  --stats-l1: #8fb2d6;
  --stats-l2: #5183bf;
  --stats-l3: #25589a;
  --stats-l4: #003D7C;
  --line-brand: #003D7C;
  --line-brand-ink: #002F63;
  --line-brand-on: #ffffff;

  /* 2026-09-13 (site owner: "why is it still orange?", after the
     primary/secondary color swap above still left orange covering most
     of the page) -- --accent-secondary is no longer a second color at
     all; it's a plain alias of --line-brand, so every call site that
     used to read "the secondary chrome color" (links, hover/focus
     borders, tinted backgrounds -- the majority of this file's ~225
     brand-color call sites, from the earlier "use a mix of nus blue
     and nus orange... not just one color for a whole page" pass) now
     renders the exact same blue as the primary-action buttons instead
     of a separate orange. The token stays defined (rather than
     replacing all ~185 var(--accent-secondary...) references with
     var(--line-brand...) directly) so a future "add a second accent
     back" request is a one-line change here again, not another mass
     find-and-replace across the file. --line-history (the amber
     correction/draft notice color) is untouched -- it was never part
     of this brand-accent system either direction. */
  --accent-secondary: var(--line-brand);
  --accent-secondary-ink: var(--line-brand-ink);
  --accent-secondary-on: var(--line-brand-on);

  /* 2026-09-13 (site owner: "use nus gold for the 'News' text") -- the
     header wordmark's "News" span (.brand-news below) needed a full-
     brightness orange, not an AA-safe dark "-ink" TEXT shade the way
     body text would need (that dark-ink treatment is what read as
     muddy/brown rather than a true accent color in earlier attempts).
     Originally a plain alias of whichever of --line-brand/--accent-
     secondary happened to be orange that week -- broke the first time
     both tokens ended up the same color (see --accent-secondary's own
     comment above, "why is it still orange?"), since aliasing either
     one now means aliasing blue. Given its own fixed value instead,
     independent of both role tokens, so "News" stays orange no matter
     which of --line-brand/--accent-secondary is which color in the
     future. Light mode value matches NUS Orange (PANTONE 152C
     #EF7C00); dark mode (below) uses the same lighter #FFA94D the
     primary-action token used while it was orange. --brand-news-gold
     on white paper is 2.78:1, which fails AA for ordinary text, but a
     wordmark/logotype is explicitly exempt from WCAG 1.4.3's contrast
     requirement (this "News" span is part of the Biblinkage brand name,
     not body copy). */
  --brand-news-gold: #EF7C00;
  /* Orange accent (2026-09-18, site owner: use the brand's orange more).
     Navy stays for actions; orange marks "where you are" and "what needs
     attention". The logo orange is too light for text or lines on white,
     so light mode uses deeper shades: --accent-warm for lines and fills
     (3.5:1 on white), --accent-warm-ink for text (5:1). */
  --accent-warm: #D96A00;
  --accent-warm-ink: #B45309;
  --accent-warm-on: #ffffff;

  /* 2026-09-12, site-wide energetic/modern redesign (site owner: "I want
     the color theme for the whole website to be energetic, for young
     students, and modern") -- was "Source Serif 4 Variable"/"IBM Plex
     Sans Variable" (an editorial serif-headline/sans-UI pairing).
     Neither was ever actually loaded anywhere (no <link>/@font-face for
     either exists in templates/base.html or this file), so both had
     been rendering via their fallback stacks in every real browser --
     Georgia/Times for headings, system-ui/Segoe UI for chrome -- since
     whichever web-font pass first named them. Poppins/Inter are the
     first real web fonts this site actually loads (self-hosted since
     2026-09-18 -- see the @font-face rules at the top of this file);
     --font-display carries the
     rounded-geometric, energetic personality on headings/titles/short
     labels, --font-body is the readable workhorse for everything else,
     including article body text (.article-body sets no font-family of
     its own, so it inherits straight from body's own --font-body
     default -- see that rule's own comment). */
  --font-display: "Poppins", "Nunito Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: 3.25rem;

  /* Was 0 (a flat, sharp-cornered, "broadsheet" look) since the
     restrained-color-system pass. Revised 2026-09-12, site-wide
     energetic/modern redesign (site owner: "I want the color theme for
     the whole website to be energetic, for young students, and
     modern") -- rounded corners read as friendlier/more app-like than
     the hard-edged newspaper look, matching the same brief that moved
     the type pair to Poppins/Inter and the accent to NUS orange/blue
     above. 14px (not a small 4-6px "just take the edge off" radius)
     so cards/buttons/inputs actually read as rounded at a glance, the
     way the approved Study-page mockup did. ~25 call sites had
     border-radius: 0 hardcoded as a literal instead of referencing
     var(--radius) -- checked each individually and switched them to
     var(--radius) too (ordinary buttons/inputs/nav links/cards with no
     stated reason to stay flat), so this token change actually reaches
     the whole site rather than missing everything that predates the
     var(--radius) convention. Two genuine exceptions stayed literal:
     .search-results' mobile fixed dropdown (flush against the sticky
     header and both viewport edges -- a rounded corner would float
     oddly there) and .line-swatch (a small square color-key mark, not
     a card/control). .flashcard-popover.is-sheet (the mobile bottom
     sheet) got a literal border-radius: 16px 16px 0 0 instead of plain
     var(--radius) -- its bottom/side edges are flush with the viewport
     like the dropdown above, but rounding just the top edge is the
     standard bottom-sheet treatment and reads more "app-like," which
     fits this redesign better than leaving it fully square. */
  --radius: 14px;
  /* Shape and control-size scale (2026-10-10 UX audit, UX_AUDIT.md M1/M7):
     --radius for cards and panels, --radius-sm for menu rows, inputs and
     chips' inner wells, --radius-pill for buttons. Controls are
     --control-h-sm (36px) by default and grow to --control-h (44px, the
     WCAG 2.5.5 target) under pointer: coarse. */
  --radius-sm: 8px;
  --radius-pill: 999px;
  --control-h: 44px;
  --control-h-sm: 36px;
  --tool-plate: color-mix(in srgb, var(--accent-secondary) 7%, var(--paper-raised));
  --tool-plate-hover: color-mix(in srgb, var(--accent-secondary) 11%, var(--paper-raised));
  --max-width: 1080px;
  --content-width: 700px;

  /* Aa panel preferences (2026-08-27 reading-preferences design) -- these
     three defaults must render byte-identical to the fixed values they
     replace (1.15rem/1.7/var(--content-width)) so a reader who never opens
     the panel sees zero change. Overridden either by the before-paint
     inline script in base.html (returning readers) or live by
     initReadingPrefsPanel() in site.js (same session). */
  --reading-font-scale: 1;
  --reading-line-height: 1.7;
  --reading-content-width: var(--content-width);

  /* Flat UI (site owner, 2026-09-18: "no border shading"): kept as tokens
     so the call sites still read as "card depth", but drawn as nothing --
     separation comes from the hairline borders and solid fills. */
  --shadow-card: none;
  --shadow-card-hover: none;
}

/* Dark palette applies two ways: automatically when the OS/browser prefers
   dark AND the reader hasn't explicitly chosen light (the :not() guard),
   or unconditionally when the Aa reading-preferences panel's theme
   buttons (see static/js/site.js's setTheme()) have set data-theme="dark"
   -- that explicit choice wins over system preference in both
   directions, which is why the same token block appears twice: once
   gated by the media query, once gated by the attribute selector. The
   header used to have its own toggle button setting the same attribute,
   removed 2026-09-04 (site owner: "just let the website follow the
   theme of the system") -- the Aa panel's theme buttons were kept on
   request as the one remaining way to set it. Kept as two full copies
   rather than a shared
   custom-property trick so each block stays trivially greppable/editable
   on its own. --paper/--paper-raised/--border-strong widened here too,
   2026-08-19, same reasoning as :root's comment (1.09:1 was even harder
   to see than light mode's gap). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef0f4;
    --ink-soft: #b9c0cc;
    --ink-faint: #838b99;
    --paper: #0a0d13;
    --paper-raised: #1b212e;
    --border: #242b3a;
    --border-strong: #556074;

    /* Its own steps, validated against the dark surface -- an
       automatic inversion of the light ramp fails the light-end
       contrast check there. */
    --stats-l0: #1b212e;
    --stats-l1: #2a4a78;
    --stats-l2: #3f6ca6;
    --stats-l3: #5c93d6;
    --stats-l4: #93c1f5;

    --line-news: #ff6b6a;        --line-news-ink: #ff9a99;        --line-news-on: #0d1017;
    --line-economics: #3ddb9a;   --line-economics-ink: #6ee6b4;   --line-economics-on: #0d1017;
    --line-history: #ffc266;     --line-history-ink: #ffd68f;     --line-history-on: #0d1017;
    --line-highered: #a888f2;    --line-highered-ink: #c3adf7;    --line-highered-on: #0d1017;

    --line-brand: #7CB4E8;
    --line-brand-ink: #A8D8F7;
    --line-brand-on: #0d1017;

    --accent-secondary: var(--line-brand);
    --accent-secondary-ink: var(--line-brand-ink);
    --accent-secondary-on: var(--line-brand-on);

    --brand-news-gold: #FFA94D;
    --accent-warm: #FFA94D;
    --accent-warm-ink: #FFA94D;
    --accent-warm-on: #1a1206;

    --highlight-yellow: rgba(255, 205, 0, 0.45);
    --highlight-green:  rgba(61, 219, 154, 0.35);
    --highlight-pink:   rgba(255, 140, 190, 0.35);
    --highlight-blue:   rgba(120, 170, 255, 0.35);

    --shadow-card: none;
    --shadow-card-hover: none;
  }
}

:root[data-theme="dark"] {
  /* The activity ramp is repeated here, not inherited: this block
     redefines every surface token independently, so without its own
     steps a manually-chosen dark theme would paint light-mode cells on
     a dark surface. Same values as the prefers-color-scheme block. */
  --stats-l0: #1b212e;
  --stats-l1: #2a4a78;
  --stats-l2: #3f6ca6;
  --stats-l3: #5c93d6;
  --stats-l4: #93c1f5;
  --ink: #eef0f4;
  --ink-soft: #b9c0cc;
  --ink-faint: #838b99;
  --paper: #0a0d13;
  --paper-raised: #1b212e;
  --border: #242b3a;
  --border-strong: #556074;

  --line-news: #ff6b6a;        --line-news-ink: #ff9a99;        --line-news-on: #0d1017;
  --line-economics: #3ddb9a;   --line-economics-ink: #6ee6b4;   --line-economics-on: #0d1017;
  --line-history: #ffc266;     --line-history-ink: #ffd68f;     --line-history-on: #0d1017;
  --line-highered: #a888f2;    --line-highered-ink: #c3adf7;    --line-highered-on: #0d1017;

  --line-brand: #7CB4E8;
  --line-brand-ink: #A8D8F7;
  --line-brand-on: #0d1017;

  --accent-secondary: var(--line-brand);
  --accent-secondary-ink: var(--line-brand-ink);
  --accent-secondary-on: var(--line-brand-on);

  --brand-news-gold: #FFA94D;
  --accent-warm: #FFA94D;
  --accent-warm-ink: #FFA94D;
  --accent-warm-on: #1a1206;

  --highlight-yellow: rgba(255, 205, 0, 0.45);
  --highlight-green:  rgba(61, 219, 154, 0.35);
  --highlight-pink:   rgba(255, 140, 190, 0.35);
  --highlight-blue:   rgba(120, 170, 255, 0.35);

  --shadow-card: none;
  --shadow-card-hover: none;
}

/* ---------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* 2026-09-12, site-wide energetic/modern color-and-type pass -- the
     base default used to be --font-serif (Source Serif 4, an editorial
     reading face); this is the one deliberate exception to the
     otherwise-mechanical --font-serif -> --font-display rename
     elsewhere in this file: the SITE'S OWN DEFAULT reading text
     (article bodies included -- .article-body sets no font-family of
     its own, so it inherits straight from here) now defaults to the
     body/reading font, not the display one. --font-display is for
     headings/titles/short labels specifically, applied explicitly
     wherever that's wanted (h1 and friends, just below). */
  font-family: var(--font-body);
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* Chinese, Japanese and Korean interface text: full-height characters
   need more leading than Latin text to read as comfortably (2026-11-14
   spacing survey). Only the inherited default changes -- anything with
   its own line-height keeps it -- and English learning material on a
   translated page (marked lang="en") goes back to 1.5. :where() keeps
   both rules at the lowest specificity so no component rule is beaten. */
:where(html:lang(zh), html:lang(ja), html:lang(ko)) body { line-height: 1.7; }
:where(html:lang(zh), html:lang(ja), html:lang(ko)) :where([lang="en"]) { line-height: 1.5; }
/* Multi-line help and prose blocks that set their own 1.5. */
:where(html:lang(zh), html:lang(ja), html:lang(ko)) :is(.review-grades-hint, .study-stats-note, .review-howto li, .privacy-toggle-hint, .vh-tool-text, .vh-loop li, .vh-plan-list li):not([lang="en"]) { line-height: 1.7; }

a { color: var(--accent-secondary-ink); }
img, svg { max-width: 100%; display: block; }

::selection { background: color-mix(in srgb, var(--accent-secondary) 25%, transparent); }

:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------------
   Header + line strip (the signature element)
   --------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2) var(--space-3);
  /* Solid, not frosted (2026-09-14): the old 92% color-mix + blur(8px)
     let scrolled article text visibly bleed through the sticky bar.
     Opaque in both themes and in html.header-compact (inherits this). */
  background: var(--paper-raised);
  /* 2026-09-06 (site owner: fast-scrolling the Journal Calendar's own
     sticky nav bar underneath, "it is better not to hide the header").
     Reproduced live on the connected physical device (Galaxy A07,
     Android 16), not just from the report: a real fling-scroll
     screenshot showed .site-header visibly compressed/squashed for a
     frame mid-scroll, right at the exact moment its own text and the
     calendar's sticky nav bar underneath both looked briefly wrong --
     Chromium's WebView compositor mishandling a position:sticky element
     that also has backdrop-filter (an expensive, layer-heavy effect)
     during a fast scroll, a known category of rendering glitch on this
     combination. Settled back to its correct layout within ~2s either
     way -- never a permanent bug, only ever a mid-scroll compositor
     artifact -- but real and reproducible.
     transform: translateZ(0) forces this onto its own stable GPU
     compositing layer instead of letting the browser fall back to
     whatever path was producing the squash -- the standard fix for
     this exact sticky+backdrop-filter class of bug, and a pure
     rendering hint: no visual/layout change to the settled state,
     confirmed by re-running the identical fling gesture after this
     change and no longer seeing the artifact. */
  transform: translateZ(0);
}

/* Was a four-color gradient with small "interchange station" dots at
   each line boundary, in the spirit of the MRT-line concept the four
   pillar colors used to carry through nav/badges/cards. Dropped
   2026-08-19 (site owner: "the color is too many... like WSJ, CNN, CNA,
   BBC") in favor of one accent color used sparingly -- a plain rule
   under the masthead, the way BBC's own black bar under its red
   masthead works, not a rainbow. See restrained-color-system commit. */
.line-strip {
  position: sticky;
  top: 0;
  z-index: 9;
  height: 3px;
  background: var(--accent-secondary);
}

/* Reading progress -- collapsed (height: 0) by default so it's inert on
   every non-article page without needing per-page template logic;
   site.js adds .active only when the page has an .article-body, and
   drives .reading-progress-fill's width from scroll position.
   top: var(--header-height) parks it flush under the sticky masthead.
   It used to be top: 5px, which pinned it BEHIND .site-header (z 10 vs
   9) once scrolled -- only its ends showed, past the header's
   max-width, as two stubs above the page (2026-09-18, Journal reading
   view: article pages hide it in reading-header-mode, so it only ever
   surfaced where there's no header reading bar). */
.reading-progress {
  position: sticky;
  top: var(--header-height, 0px);
  z-index: 9;
  height: 0;
  background: var(--border);
  overflow: hidden;
  transition: height 0.15s ease;
}
.reading-progress.active { height: 3px; }
.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-secondary);
}

/* "N words looked up · M saved" indicator (2026-08-27
   article-completion-flow design) -- static/js/site.js's
   initReadingTally(). Server-rendered hidden on every page (present,
   inert, same as .reading-progress itself); JS only unhides it for a
   logged-in reader on an article page, once lookedUp/saved is nonzero.
   The [hidden] rule below is required regardless -- same established
   precedent as .back-to-top[hidden] (static/css/site.css:294). */
.reading-tally {
  position: sticky;
  top: 8px;
  z-index: 9;
  text-align: center;
  padding: 0.3em 0;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-faint);
}
.reading-tally[hidden] { display: none; }

.back-to-top {
  position: fixed;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 15;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.back-to-top:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.back-to-top[hidden] { display: none; }

.brand-group {
  display: flex;
  flex-direction: column;
  margin-right: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}
/* 2026-09-13 (site owner: "'Bib' -> NUS blue, ... 'News' -> NUS
   orange"), matching the logo image's own two-tone wordmark. .brand-bib
   uses --line-brand-ink, NUS Blue's AA-safe TEXT color (see :root's
   own comment for the exact contrast figures) -- not the bare
   --line-brand fill, which is tuned for solid button backgrounds and
   reads too saturated as body-sized text. .brand-news is the one
   exception to that "-ink for text" rule -- see --brand-news-gold's
   own :root comment for why it uses a full-brightness fixed orange
   instead (2026-09-13, "use nus gold for the 'News' text"). Briefly
   replaced by a single <img> carrying the baked-in wordmark (static/
   img/logo-header.png), then reinstated -- "on the front page, it
   should be like the logo-mark.png with Biblinkage as text on the right
   side" -- real HTML text stays sharp at any zoom/density and
   themeable via CSS, which a raster wordmark can't match; logo-
   header.png is now favicon/app-icon-only (see templates/base.html's
   own head-icon comments). */
.brand-bib { color: var(--line-brand-ink); }
.brand-news { color: var(--brand-news-gold); }
/* The icon mark next to the "Biblinkage" text (see templates/base.html's
   own comment) -- static/img/logo-mark.png is a transparent-background
   silhouette (no fill/rounded-square backing baked in, unlike the flat
   placeholder it replaced), so this only needs to fix its render size
   in the header; object-fit keeps its own aspect ratio inside the
   fixed box since the source crop isn't a perfect square. */
.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
}

.tagline {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  /* About the English tagline's own width (2026-11-13): a longer
     translation wraps to a second line instead of widening the brand
     block and pushing the header's buttons onto a second row. */
  max-width: 17rem;
  line-height: 1.3;
}

/* Hide on narrow viewports -- the header nav already wraps/scrolls
   there, and a second line under the brand competes for the same
   cramped space. */
@media (max-width: 700px) {
  .tagline { display: none; }
}

/* Compact header on scroll (2026-09-13, CNA-inspired design review --
   see static/js/site.js's initCompactHeaderOnScroll() for the full
   reasoning and why search/sign-in stay reachable here instead of
   disappearing the way CNA's own does). html.header-compact is a
   scroll-position class, not a viewport one -- unlike the @media rule
   above, this applies at any width once scrolled. */
html.header-compact .tagline {
  display: none;
}
/* Tighter than the default var(--space-2) var(--space-3) -- vertical
   padding only, horizontal stays put so the nav row below doesn't
   shift sideways when this toggles. Less aggressive than the app's own
   permanent var(--space-1) var(--space-2) compact bar (below) -- this
   is a scrolled desktop/mobile web header still showing the full nav
   row, not the app's single slim brand-only bar. */
html.header-compact .site-header {
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
}
/* Phones (2026-09-15, site owner: "depending on the viewport size,
   secondary elements (like utility links or sub-navigation) collapse or
   hide"): once scrolled, the Study/Journal/Feeds text links step aside
   so the header is one icon row plus the section nav instead of wrapping
   to three rows. They come back at the top of the page; search, saved,
   messages and account stay as icons. site.js's margin compensation
   keeps the page from shifting when this toggles. */
@media (max-width: 700px) {
  html.header-compact .study-link,
  html.header-compact .journal-link,
  html.header-compact .feeds-link,
  html.header-compact .applications-link,
  html.header-compact .courses-link,
  html.header-compact .speaking-link,
  html.header-compact .speaking-menu { display: none; }
}

/* Desktop, every page that shows the section nav (2026-09-18 for the front
   page; 2026-10-03 extended, site owner: "the tabs of other pillars should
   have the same head nav changing effect as the Home tab" -- the selector
   used to be body[data-active-pillar="home"]). The body:not(...) list is
   the same set of pages whose .site-nav-wrap is display: none further
   down this file -- keep the two in step, or this block's display: flex
   brings the nav back there. Article pages are left out via
   :not(.has-reading-header): they have their own one-row reading bar
   below. Original brief (site owner: "when scrolling down, the
   folding effect should move the nav bar to the top, in the same row with
   the icon"). Once compact, the section nav leaves its own row and sits
   between the logo and the utility icons, so the whole header is one row.
   Measured at the 1080px max width: the nine links need ~610px, but only
   ~510px is free between the full brand and the search icon, so the
   "Biblinkage" wordmark steps aside and the logo mark stays. Where the row
   still runs out of room the nav scrolls sideways under the same edge fade
   phones use (initSiteNavFade). Below 960px the two-row compact header
   stays -- a one-row nav there would show barely half the sections. */
@media (min-width: 960px) {
  /* nowrap: a wrapping flex row wraps before it shrinks, so the nav would
     push the icons onto a second row instead of scrolling. */
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-header { flex-wrap: nowrap; gap: var(--space-2); }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-header > * { flex-shrink: 0; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .brand-group { margin-right: 0; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .brand > span { display: none; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .brand-mark { width: 28px; height: 28px; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-header > .site-nav-wrap {
    order: 0;
    flex: 1 1 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
  }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav::-webkit-scrollbar { display: none; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav a {
    /* 0.35rem, not 0.5rem (2026-10-10): wins back ~38px, so a signed-in
       header nearly fits every section before the scroll button is needed. */
    padding: 0.4rem 0.35rem 0.55rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-fade {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to right, transparent, var(--paper-raised));
    transition: opacity 0.15s ease;
  }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-fade.is-hidden { opacity: 0; }
  /* The fade alone went unnoticed (2026-10-10 usability review: "Hotspot"
     clipped with no visible cue), so a wider fade plus a button that
     scrolls the nav; it points back once the end is reached. */
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-fade { width: 44px; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-more {
    display: inline-flex;
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--paper-raised);
    color: var(--ink);
    cursor: pointer;
  }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-more[hidden] { display: none; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-wrap.has-more .site-nav { padding-right: 34px; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-more:hover { border-color: var(--ink-soft); }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-more:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
  html.header-compact:not(.has-reading-header) body:not([data-active-pillar=""], [data-active-pillar="journal"], [data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="dashboard"]) .site-nav-more.is-back svg { transform: scaleX(-1); }
}
/* Everywhere else the nav wraps, or scrolls under a phone's own swipe. */
.site-nav-more { display: none; }

/* ---------------------------------------------------------------------
   Article reading bar (2026-09-15, site owner: "Dynamic Header
   Shrinking/Hiding (Behavioral Navigation)... just like the wall street
   journal"). Once an article's own .article-actions toolbar has scrolled
   out of view, site.js's initCompactHeaderOnScroll() adds
   html.reading-header-mode and the header collapses to ONE row: brand, the
   article title (truncated), and icon proxies for Listen / reading
   preferences / Save / Share, with reading progress as its bottom edge.
   Section nav, tagline, search and the account/utility links step aside
   until the reader scrolls back up past the toolbar -- the header is
   swapped for a slimmer one, never hidden outright (site owner,
   2026-09-06: "it is better not to hide the header").
   Secondary pieces drop out by width: the wordmark under 900px, Share
   under 700px, Listen under 360px.
   :root.reading-header-mode (0,2,0 + element/class) deliberately out-ranks the
   html.header-compact / html.capacitor-app rules further down this file
   that re-show .app-header-search/.app-header-account.
   The root class is deliberately NOT named .header-reading: that's the
   bar element's own class, and .header-reading { display: none } would
   then match <html> itself and blank the whole page.
   The header's in-flow height never changes when these modes toggle --
   site.js gives it a compensating margin-bottom -- so the article text
   doesn't jump as the bar swaps.
   --------------------------------------------------------------------- */
.header-reading { display: none; }
:root.reading-header-mode .site-header {
  flex-wrap: nowrap;
  gap: var(--space-2);
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}
:root.reading-header-mode .brand-group { margin-right: 0; flex: none; }
:root.reading-header-mode .brand { font-size: 1.15rem; }
:root.reading-header-mode .brand-mark { width: 28px; height: 28px; }
:root.reading-header-mode .tagline,
:root.reading-header-mode .site-nav-wrap,
:root.reading-header-mode #search-widget,
:root.reading-header-mode .app-header-search,
:root.reading-header-mode .saved-link,
:root.reading-header-mode .study-link,
:root.reading-header-mode .journal-link,
:root.reading-header-mode .feeds-link,
:root.reading-header-mode .applications-link,
:root.reading-header-mode .courses-link,
:root.reading-header-mode .speaking-link,
:root.reading-header-mode .speaking-menu,
:root.reading-header-mode .messages-link,
:root.reading-header-mode .account-avatar,
:root.reading-header-mode .account-menu,
:root.reading-header-mode .account-link,
:root.reading-header-mode .header-info-link,
:root.reading-header-mode .app-header-account {
  display: none;
}
/* In flow (3px when active), so hidden without removing its box --
   display: none would nudge the article up 3px as the bar swaps in. */
:root.reading-header-mode .reading-progress { visibility: hidden; }
:root.reading-header-mode .header-reading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 0;
  min-width: 0;
}
.header-reading-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding-left: var(--space-2);
  border-left: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-reading-tools { display: flex; align-items: center; gap: 0.15rem; flex: none; }
.header-reading-btn {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease;
}
.header-reading-btn[hidden] { display: none; }
.header-reading-btn:hover,
.header-reading-btn[aria-pressed="true"],
.header-reading-btn[aria-expanded="true"] { color: var(--accent-secondary-ink); }
.header-reading-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 1px; }
.header-reading-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.header-reading-save-filled { display: none; }
.header-reading-btn[aria-pressed="true"] .header-reading-save-outline { display: none; }
.header-reading-btn[aria-pressed="true"] .header-reading-save-filled { display: block; fill: currentColor; stroke: none; }
/* Progress along the bar's bottom edge. .site-header's own
   transform: translateZ(0) makes it the containing block. Fill width is
   driven by initScrollAids() together with the original .reading-progress. */
.header-reading-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--border);
}
.header-reading-progress .reading-progress-fill { height: 100%; width: 0%; background: var(--accent-secondary); }
@media (max-width: 900px) {
  :root.reading-header-mode .brand > span { display: none; }
}
@media (max-width: 700px) {
  .header-reading-btn[data-proxy="share"] { display: none; }
  .header-reading-title { font-size: 0.88rem; }
}
@media (max-width: 360px) {
  .header-reading-btn[data-proxy="listen"] { display: none; }
}
/* With the bar carrying these tools, the in-page toolbar no longer needs
   to pin itself under the header (html.has-reading-header is only set by
   site.js on pages that actually have the bar, so no-JS readers keep the
   sticky toolbar). */
:root.has-reading-header .article-actions { position: static; }
/* A reading-preferences or Share panel opened from the bar (site.js adds
   .is-docked) anchors under the bar instead of to its own off-screen
   toolbar button. !important beats the inline top/left/max-height that
   initReadingPrefsPanel()'s positionPanel() writes. */
:root.reading-header-mode .reading-prefs-panel.is-docked,
:root.reading-header-mode .share-panel.is-docked {
  position: fixed !important;
  top: calc(var(--header-height, 56px) + 6px) !important;
  bottom: auto !important;
  left: auto !important;
  right: max(12px, calc((100vw - var(--max-width)) / 2 + 12px)) !important;
  max-height: calc(100vh - var(--header-height, 56px) - 18px) !important;
  overflow-y: auto;
}

.saved-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 1rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.saved-link:hover, .saved-link.active { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }

/* 2026-09-06 (site owner: "improve the design of the header, make it
   modern, professional") -- .account-link used to be its own bordered
   box, the exact same treatment .study-link/.journal-link/.feeds-link
   had (see their own shared rule below) -- a real, visible inconsistency
   once actually compared against .site-nav a right underneath it in the
   same header: one row of plain, underlined text links (the established,
   correct pattern -- see that rule's own "one accent color... BBC/CNA/
   CNN/WSJ don't recolor each tab" comment) sitting directly below a row
   of bordered form-style buttons doing the exact same job (navigate
   somewhere). Restyled to match .site-nav a's own link language instead
   of inventing a third one -- same color/weight/hover-underline idiom,
   just at this row's own font-size. Still flat/sharp-cornered either way
   (border-radius: 0 either style), so no clash with that half of the
   established brand system -- the inconsistency was button-vs-link, not
   the corner radius. */
.account-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.account-link:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}
/* About / Pricing beside "Log in" for signed-out visitors (2026-09-19):
   the same plain text style, so "Sign up free" stays the one solid
   button. Below 900px (measured with the search box in place) they'd push
   "Sign up free" onto a second row, so there -- tablets and phones -- the
   footer keeps them instead. */
.header-info-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.header-info-link:hover { border-color: var(--border-strong); color: var(--ink); }
.header-info-link.active { border-color: var(--accent-warm); color: var(--ink); }
@media (max-width: 899px) {
  .header-info-link { display: none; }
}

/* "Sign up free" (2026-09-18, launch-readiness plan item 1.6) -- the
   header's one solid button: the primary action for a logged-out
   visitor, so it takes the --line-brand fill that marks primary actions
   everywhere else. Flat, no shadow. Stays visible on every width, in the
   compact scrolled header and in the app. */
.signup-link {
  /* inline-block, not inline-flex: flex would make "Sign up" and the
     " free" span separate items and swallow the space between them. */
  display: inline-block;
  flex: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.signup-link:hover { background: var(--accent-secondary-ink); color: var(--line-brand-on); }
.signup-link:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
:root.reading-header-mode .signup-link { display: none; }
/* Keeps the logged-out top bar on one row down to 320px: below ~385px
   "Log in" + "Sign up free" + the search icon no longer fit beside the
   wordmark, so the button drops "free" and the gaps tighten; at 340px and
   under the wordmark steps down a size too. 2026-11-12: the longer
   "Biblinkage" (was "BibNews") wrapped the row between 320 and 355px, so
   the wordmark steps down from 385px and, at 340px and under, the mark
   and its gap shrink as well (measured: one row at every width 320-390). */
@media (max-width: 385px) {
  :root .site-header { column-gap: var(--space-1); }
  .signup-link { padding-inline: 0.6rem; }
  .signup-link-full { display: none; }
  .brand { font-size: 1.25rem; }
}
@media (max-width: 340px) {
  .brand { font-size: 1.1rem; gap: 0.3em; }
  .brand-mark { width: 26px; height: 26px; }
}

/* What a free account adds (pages/free_account.html). Sections clear the
   sticky header when a bottom-nav tab jumps to one of them. */
.free-account-tool { scroll-margin-top: calc(var(--header-height, 56px) + var(--space-2)); }
.free-account-tool h2 { margin-bottom: 0.3rem; }
.free-account-cta {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.free-account-cta .pricing-cta-btn { margin-top: var(--space-1); }
.free-account-note { font-size: 0.9rem; color: var(--ink-soft); }

/* Logged-in account avatar (site owner, 2026-08-22: "currently it looks
   like a button similar to study and journal" -- .account-link's bordered
   box, sharing that exact styling, was indistinguishable from a nav
   button). A round initial badge, not a bordered rectangle -- circular
   is a deliberate exception to this site's flat sharp-corner aesthetic
   (var(--radius): 0) elsewhere: an avatar is an identity badge, a
   different UI category from a card/button, and "round" is close to a
   universal convention for that category. No profile photos exist in
   this app's data model, so the reader's own first initial stands in,
   the same no-new-feature approach used elsewhere this session (e.g.
   deriving a journal entry's "title" from its own first line rather
   than adding a field). "Log in" (logged out) keeps .account-link's
   existing button treatment -- that state has no identity to badge. */
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  border-radius: 50%;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.account-avatar:hover { opacity: 0.85; }

/* See .account-link's own comment just above -- same fix, same reason:
   matches .site-nav a's plain-text-link idiom instead of the bordered-
   button treatment this used to share with that link. */
.study-link, .journal-link, .feeds-link, .applications-link, .courses-link, .speaking-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.study-link:hover, .journal-link:hover, .feeds-link:hover, .applications-link:hover, .courses-link:hover, .speaking-link:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.study-link.active, .journal-link.active, .feeds-link.active, .applications-link.active, .courses-link.active, .speaking-link.active {
  border-color: var(--accent-warm);
  color: var(--ink);
}

/* Higher contrast (2026-08-27 reading-preferences design) -- reassigns the
   existing soft/weak tokens to their own already-defined strong
   counterparts. Every place in the site that already uses --ink-soft/
   --border (not just the article body) gets stronger contrast for free,
   with zero new color values and zero new selectors beyond this one rule
   -- same pattern [data-theme="dark"] already uses for its own overrides. */
/* Must be :root[data-contrast="high"] (0,2,0), not the bare attribute
   selector [data-contrast="high"] (0,1,0) -- the bare form loses to both
   :root[data-theme="dark"] (0,2,0) and the prefers-color-scheme dark
   block's :root:not([data-theme="light"]) (also 0,2,0, since :not() takes
   its argument's specificity), both of which reassign these same two
   tokens earlier in the cascade -- so higher contrast was a complete
   no-op for every dark-mode reader (2026-08-27 final review, finding 2). */
:root[data-contrast="high"] {
  --ink-soft: var(--ink);
  --border: var(--border-strong);
}

/* Focus Mode (2026-08-27 article-completion-flow design) -- toggled by
   static/js/site.js's initFocusMode(), read before first paint by
   templates/base.html's inline script so there's no flash of the hidden
   chrome. .site-header itself is NOT hidden -- the logo/search/account
   row and the Focus Mode button's own toolbar (.article-actions, also
   not in this list) have to stay reachable to turn it back off. Only
   .site-nav (the nav-links row inside the header) is hidden, not the
   whole header.

   .site-nav and .line-strip specifically use visibility: hidden rather
   than display: none, unlike .site-footer/.article-rail -- both sit in
   the DOM above .article-actions (site-nav inside the header, line-strip
   between the header and <main>), so collapsing their box on toggle-on
   shifts everything below, including the Focus Mode button itself,
   upward by their combined height (confirmed live: ~45px). A second
   real tap aimed at the button's last-seen screen position then lands
   on whatever is now there instead and misses it, making the toggle
   look stuck on with no way to cancel it. site-footer/article-rail sit
   below or beside the article body, so hiding them outright doesn't
   move anything the reader was just interacting with. */
html[data-focus-mode="true"] .site-nav,
html[data-focus-mode="true"] .line-strip {
  visibility: hidden;
}
html[data-focus-mode="true"] .site-footer,
html[data-focus-mode="true"] .article-rail {
  display: none;
}

/* Aa reading-preferences panel (2026-08-27 design) -- anchored dropdown
   under a fixed toolbar button, same positioning pattern as
   .search-results (position: absolute, anchored to the nearest
   positioned ancestor) -- deliberately NOT positionPopover's viewport-flip
   logic, which exists for selection-anchored popovers, not a panel that
   opens from a fixed button. */
.action-reading-prefs-wrap { position: relative; display: inline-block; }
/* top/bottom and max-height below are the CSS-side defaults; site.js's
   initReadingPrefsPanel() overrides both inline every time the panel opens
   (measuring actual space above/below the trigger button first) -- these
   defaults only matter for the instant before that JS runs. Was a fixed
   `top: calc(100% + 6px)` with no max-height at all, so a reader who
   opened Aa near the bottom of the first viewport got a panel rendered
   from y=864 to y=1212 in an 857px-tall viewport -- entirely below the
   fold, with no way to scroll it into view (2026-09-04 UI smoke test). */
.reading-prefs-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: min(280px, 90vw);
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
/* The `display: flex` above (author-origin) beats the UA stylesheet's own
   `[hidden] { display: none }` regardless of specificity, so without this
   companion rule the panel rendered permanently open on every article
   page from first paint. Same precedent as .back-to-top[hidden],
   .review-grades[hidden], and .article-actions button[hidden] elsewhere
   in this file (2026-08-27 final review, finding 1). */
.reading-prefs-panel[hidden] { display: none; }
.reading-prefs-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.reading-prefs-group-label {
  flex-basis: 100%;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
/* Prefixed with .article-actions (the panel's actual containing element)
   rather than left as the bare .reading-prefs-group form -- the panel is
   always nested inside .article-actions, and the pre-existing
   .article-actions button / .article-actions button[aria-pressed="true"]
   rules tie in specificity with the un-prefixed form and win by coming
   later in source order, so none of this styling (font-size, padding,
   pressed-state colors) ever actually applied (2026-08-27 final review,
   finding 4). */
.article-actions .reading-prefs-group button {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.85rem;
}
.article-actions .reading-prefs-group button:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.article-actions .reading-prefs-group button[aria-pressed="true"] {
  border-color: var(--accent-secondary);
  background: var(--accent-secondary);
  color: var(--paper);
}

/* Listening controls mini-bar (2026-08-27 listening-controls design) --
   shown only while playback is active (toggled by static/js/site.js's
   rewritten initListenButton(), not a static "hidden unless a preference
   is set" pattern like .reading-prefs-panel). The [hidden] rule below is
   required regardless -- same established precedent as
   .back-to-top[hidden] (static/css/site.css:294) and the fix in commit
   fd2371e for .reading-prefs-panel[hidden]. Every button selector below
   is prefixed with .article-actions for the same reason
   .reading-prefs-group's own buttons needed it (2026-08-27 final review,
   finding 4, that same commit) -- .listen-controls lives inside
   .article-actions, so an unprefixed .listen-controls button selector
   would tie in specificity with the pre-existing .article-actions button
   rule and lose on source order. */
.listen-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.4em;
  padding: 0.4em 0.6em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.listen-controls[hidden] { display: none; }
.listen-rate-group { display: flex; gap: 0.3rem; }
.article-actions .listen-controls button {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.8rem;
}
.article-actions .listen-controls button:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.article-actions .listen-controls button[aria-pressed="true"] {
  border-color: var(--accent-secondary);
  background: var(--accent-secondary);
  color: var(--paper);
}

/* Paragraph highlight during playback (2026-08-27 listening-controls
   design) -- the same "you are here" tint idiom already used for
   .site-nav a.active (static/css/site.css:619), reused here rather than
   inventing a new visual language for "currently active" state. */
.listen-active {
  background: color-mix(in srgb, var(--accent-secondary) 10%, transparent);
}

/* Always its own full-width row below brand/utilities, at every width --
   not just under the 540px mobile query. Previously .site-nav only broke
   onto row 2 when the flex-wrap on .site-header happened to run out of
   room, which meant the wrap point depended on exact viewport width and
   label lengths -- at some in-between widths (~1365px) a single trailing
   item (the theme toggle) would wrap alone onto an otherwise-empty row 2.
   A masthead that's always two rows has no such in-between case. */
.site-nav-wrap {
  position: relative;
  order: 3;
  flex-basis: 100%;
  /* A flex item's automatic min-width is its content's un-shrunk intrinsic
     width, UNLESS the item's own overflow is non-visible (spec special-case:
     that zeroes the automatic minimum instead). Previously .site-nav was
     both the flex item AND the overflow-x:auto element in one, so this
     never came up; splitting scroll-affordance duties into a wrapper broke
     that pairing -- without this, .site-nav-wrap refused to shrink below
     the ~660px needed to fit all 9 unwrapped nav links, which stretched
     .site-header (and so the whole page) to that width instead of letting
     .site-nav scroll internally within 320px. Confirmed via the WebView's
     own DevTools protocol (adb forward + Runtime.evaluate), not just
     inferred: window.innerWidth was 672 and .site-nav's clientWidth exactly
     equalled its scrollWidth (660, no internal scroll at all) before this. */
  min-width: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

/* Scroll-affordance hint for the 540px-and-under horizontal-scroll nav
   below -- hidden here (nav wraps instead of scrolling above 540px, so
   there's nothing to hint at) and only shown, positioned, and sized in
   that media query. Sits on .site-nav-wrap rather than as a pseudo-element
   on .site-nav itself because .site-nav is the scrolling element -- a
   pseudo-element there would scroll away with the content instead of
   staying pinned over the trailing edge. JS (initSiteNavFade() in
   static/js/site.js) toggles .is-hidden once the nav is scrolled to its
   end, so the hint disappears exactly when there's nothing left to hint
   at, rather than sitting there permanently regardless of scroll position. */
.site-nav-fade {
  display: none;
  pointer-events: none;
}

.site-nav a {
  position: relative;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.25rem 0.5rem 0.45rem;
  transition: color 0.15s ease;
}
/* 2026-09-15 (site owner: the pill-with-underline active tab looked
   dated) -- no background or border any more. The current tab is ink +
   bold with a short rounded bar under the label; hovering shows only a
   colour change. The bar is a pseudo-element so it never shifts the
   text or changes the row height. */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.4rem;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-warm);
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.2s ease;
}

/* Abbreviated nav label -- see .site-nav a on Higher Education in
   base.html. Desktop shows the full name; the mobile block below swaps
   which span is visible, since "Higher Education" alone is what was
   forcing the mobile nav onto its own wrapped row. */

/* One accent color for the whole nav, not one per section -- readers
   already tell sections apart by the label text, the way a real
   newsroom's nav works (BBC/CNA/CNN/WSJ don't recolor each tab). */
.site-nav a:hover { color: var(--ink); }

/* Active tab -- the section of the page/article currently being viewed.
   A solid underline plus a filled background reads as "you are here" in a
   way a hover-only state can't, and it persists while the mouse is
   elsewhere on the page. */
.site-nav a.active {
  font-weight: 700;
  color: var(--ink);
}
.site-nav a.active::after { transform: translateX(-50%) scaleX(1); }
@media (prefers-reduced-motion: reduce) {
  .site-nav a::after { transition: none; }
}

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-5);
}

/* ---------------------------------------------------------------------
   Labels (NEWS BRIEF / ANALYSIS / LONG READ) -- editorial labels are
   core to the publication's promise (Project doc, Section 5): always
   show readers what kind of piece this is.

   Design review, 2026-08-20: a solid-fill pill on every routine format
   badge read as generic SaaS tagging rather than an editorial signal --
   loud in a way that didn't correspond to anything actually being more
   important. .label is a quiet tinted rectangle for all of them.

   2026-08-22: Format shrank from 6 values to 3 (News Brief/Analysis/
   Long Read), dropping Commentary along with Explainer and Newsletter
   -- so .label-commentary's stronger solid-pill treatment (kept, before
   this, as the one deliberately louder badge for the opinion/reporting
   boundary) is now dead: no article can ever have format="commentary"
   again. Removed here rather than left as unreachable CSS.
   --------------------------------------------------------------------- */
.label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-secondary-ink);
  margin: 0 0.5em var(--space-2) 0;
  text-decoration: none;
}
/* .label is an <a> now (links to more of that format) -- kept looking
   identical to the old inert <span>, plus a hover so it reads as
   clickable. */
a.label:hover, a.label:focus-visible { opacity: 0.85; text-decoration: none; }
a.label:focus-visible { outline: 2px solid var(--accent-secondary-ink); outline-offset: 2px; }

/* Reading level (2026-08-25 English-learning pivot) -- the one label on
   the page a reader actually needs to *notice at a glance* rather than
   just recognize, so it keeps the solid-pill treatment .label-commentary
   used to have (before the 2026-08-22 card-styling pass reduced .label
   to bare colored text) instead of the now-quiet base .label look.
   Still --line-brand only -- the one-accent system (see :root, 2026-08-19)
   stays intact; Advanced vs Intermediate is told apart by fill *weight*
   (solid vs a tint of the same hue), not by a second hue, matching the
   site's "identity comes from label text, not color-coding" rule. */
.label-level {
  padding: 0.15em 0.65em;
  border: 1px solid transparent;
  border-radius: 999px;
}
.label-level-advanced {
  border-color: var(--line-brand);
  background: var(--line-brand);
  color: var(--line-brand-on);
}
/* Outline, not a tinted fill (2026-09-16, site owner: no tinted/shaded
   fills) -- still lighter than Advanced's solid pill, so the two levels
   stay distinguishable by weight alone. Both carry a 1px border (see
   .label-level) so they render at the same size. */
.label-level-intermediate {
  background: transparent;
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}

/* 2026-09-13 design review, "News cards should feel like content.
   Learning actions should feel like tools... small chips for 2 min,
   Advanced, Save, Journal, Listen" -- .card-chip is read_minutes'
   equivalent of .label-level's pill treatment (a plain tinted pill,
   not tied to any one pillar/level hue -- reading time isn't a
   judgment the way Advanced/Intermediate is, so it gets the neutral
   --border/--ink-faint pairing already established for low-emphasis
   chrome elsewhere, not an accent color). */
.card-chip {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15em 0.65em;
  margin: 0 0.4em var(--space-2) 0;
}

/* Flashcard mastery status (2026-09-01, English-learning-system product
   review) -- same pill shape and one-accent-color system as .label-level
   above ("identity comes from label text, not color-coding"): status is
   told apart by fill *weight* only, graduated from barely-there (New) to
   solid (Mastered), not by hue. Weak is the one exception that needs to
   visually flag "needs attention" without a second hue -- a dashed
   border on top of the same light tint Learning uses, rather than a
   different color. */
.flashcard-status {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.4em;
}
/* New and Weak are the two states that need the reader's attention, so
   they take the orange accent (2026-09-18, site owner: "use more orange
   color on the study page"): orange text and a hairline orange border,
   no fill. Learning -> Learned -> Mastered stay a blue progression. */
.flashcard-status-new {
  background: none;
  border: 1px solid var(--accent-warm);
  color: var(--accent-warm-ink);
}
.flashcard-status-learning {
  background: color-mix(in srgb, var(--accent-secondary) 18%, var(--paper-raised));
  color: var(--accent-secondary-ink);
}
.flashcard-status-weak {
  background: none;
  color: var(--accent-warm-ink);
  border: 1px dashed var(--accent-warm);
}
.flashcard-status-learned {
  background: color-mix(in srgb, var(--accent-secondary) 45%, var(--paper-raised));
  color: var(--accent-secondary-ink);
}
.flashcard-status-mastered {
  background: var(--line-brand);
  color: var(--line-brand-on);
}

.flashcard-progress {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.3em 0 0;
}

.study-status-summary { text-transform: capitalize; }

/* Deck filter nav (2026-09-07, "organize into decks/tags... review just
   'Economics' words") -- pill shape matches .journal-tag's own
   established convention for "a small clickable filter token" elsewhere
   in this file, not a new shape invented for this one page. A real
   server-rendered ?deck= link nav (accounts.views.study), not a client-
   side filter -- see study.html's own comment on why status/sort (just
   below on the page) could stay client-side but this couldn't. */
.study-deck-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
  margin: 0 0 var(--space-2);
}
.study-deck-pill {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25em 0.8em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
}
/* The selected deck is "where you are", so it's orange (2026-09-18). */
.study-deck-pill:hover { border-color: var(--accent-warm); color: var(--ink); }
.study-deck-pill.active { background: var(--accent-warm); border-color: var(--accent-warm); color: var(--accent-warm-on); }
.study-deck-label { margin-right: 0.2em; font-family: var(--font-body); font-size: 0.78rem; font-weight: 700; color: var(--ink-faint); }
.study-deck-unfiled {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-faint);
}
/* 2026-09-12 learner-UX review -- small circular "+" beside the deck
   pills, revealing .study-deck-form on click (initStudyDeckCreateToggle,
   site.js) instead of that form sitting permanently inline. Sized to
   match .study-deck-pill's own height so it reads as part of the same
   row, not a mismatched control. */
.study-deck-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}
.study-deck-add-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.study-deck-form {
  display: flex;
  gap: 0.4em;
}
/* The UA's built-in `[hidden] { display: none }` loses to ANY author-origin
   `display` rule regardless of specificity -- same established pattern as
   .flashcard-add-word-form[hidden] just below it on this page. */
.study-deck-form[hidden] { display: none; }
/* min-width: 0 -- same flex-item shrink gotcha .collection-form input
   already documents its own copy of, reused verbatim here rather than
   re-deriving it. */
.study-deck-form input {
  min-width: 0;
  width: 10rem;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.35em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
}
.study-deck-form button {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.9em;
  border: none;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.study-deck-form button:hover { background: var(--accent-secondary-ink); }
.study-deck-delete-form { margin: 0; }
/* Rename the open deck (2026-10-14): a <details> whose summary reads as a
   quiet text button beside Delete; opening it shows the same form style
   as "+ New deck". 44px touch target, like the rest of this row. */
.study-deck-rename { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.study-deck-rename > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.25rem;
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.study-deck-rename > summary::-webkit-details-marker { display: none; }
.study-deck-rename[open] > summary { color: var(--accent-secondary-ink); }
/* .account-danger-link is already this codebase's shared "destructive
   text-button" look (used by e.g. .saved-bookmark-actions' own Remove
   button) -- reused as-is, no deck-specific override needed. */

/* Search/filter/sort controls above the flashcard grid (2026-09-05,
   design feedback: "as saved vocabulary grows, finding specific words
   will become difficult"). Search input styling matches
   .journal-search-input's pill shape; the row itself is a flex-wrap,
   same general shape as .flashcard-add-word-form just below it in the
   page, so the two controls rows read as siblings, not unrelated
   widgets. */
.study-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 var(--space-2);
}
.study-search-input {
  flex: 1 1 200px;
  min-width: 0;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.5em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.study-search-input:focus { border-color: var(--accent-secondary); outline: none; }
.study-toolbar-field { display: flex; font-family: var(--font-body); }
.study-toolbar-field select {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  padding: 0.45em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.study-toolbar-field select:focus { border-color: var(--accent-secondary); outline: none; }
.study-toolbar-meta {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75em;
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.study-toolbar-meta:empty,
.study-toolbar-count:empty { display: none; }
@media (max-width: 540px) {
  /* Search gets its own full-width line; status, sort and add share the next. */
  .study-search-input { flex-basis: 100%; }
  .study-toolbar-field { flex: 1 1 0; min-width: 0; }
  .study-toolbar-field select { width: 100%; }
}
/* Client-side-hidden non-matches (2026-09-05) -- same [hidden]-loses-to-
   author-display trap this file has already had to guard against
   elsewhere (.flashcard-add-word-form, .gloss-pronounce); .flashcard-item
   sets nothing that would override [hidden] on its own, but this is
   asserted explicitly rather than relying on that remaining true. */
.flashcard-item[hidden] { display: none; }
.study-no-matches {
  list-style: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: var(--space-3);
}


/* ---------------------------------------------------------------------
   Lead story
   --------------------------------------------------------------------- */
/* Thickened 5px -> 6px, 2026-08-19 -- previously identical in treatment
   to .secondary-card below except for size, so "this is THE story"
   competed with "these are also happening" on weight alone. (A per-pillar
   tinted background wash lived here briefly; dropped 2026-08-19 -- see
   the restrained-color-system commit -- in favor of one accent color
   site-wide, the way a real newsroom's section pages read.) */
.lead-story {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}
/* No image on the lead story (every article predating the stock-image
   layer, or one Pexels came back empty for) -- collapse the reserved
   second column rather than leaving dead space, same pattern as
   .featured-layout's own empty-rail case. */
.lead-story:not(:has(.lead-story-image)) {
  grid-template-columns: minmax(0, 1fr);
}
.lead-story-image .card-image {
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .lead-story {
    grid-template-columns: minmax(0, 1fr);
  }
  .lead-story-image {
    order: -1;
  }
}


.lead-story h1 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}

.lead-story h1 a { text-decoration: none; color: var(--ink); }
.lead-story .dek { margin-bottom: var(--space-2); }
.lead-story h1 a:hover { text-decoration: underline; text-decoration-color: var(--border-strong); }

.dek {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: 46ch;
  margin: 0;
}

/* ---------------------------------------------------------------------
   Story sections (2026-08-21, Nature News-style density) -- a labeled
   group of dense cards, used for "Latest" and each per-pillar homepage
   section, and for a topic page's full article grid. Deliberately NOT
   reusing .pillar-row/.article-list's existing classes/rules -- both are
   used by other templates outside this pattern (.pillar-row by
   editors/list.html's own unrelated grid of editor cards; .article-list
   by detail.html/search.html/saved.html) and must keep rendering exactly
   as they do today.
   --------------------------------------------------------------------- */
.story-section { margin-bottom: var(--space-5); }

.section-heading {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--space-2);
}
.section-heading a { color: inherit; text-decoration: none; }
.section-heading a:hover { color: var(--accent-secondary-ink); }

/* 2026-09-15 front-page pass: homepage section titles were small grey
   uppercase labels with "View all" parked under the whole section. Now
   the title reads as a title and "View all" sits on the same line.
   Scoped to .section-header so other .section-heading uses (About page
   footnote, Editor's Picks) keep their small-label look. */
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem var(--space-2);
  margin-bottom: var(--space-3);
}
.section-header .section-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
.section-header .view-all { margin-top: 0; white-space: nowrap; }

/* Compact topic-section row: up to 4 small cards. auto-fill (not
   auto-fit) keeps empty tracks, so a section with one story shows one
   quarter-width card instead of stretching it across the page. */
.compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}
.compact-card { position: relative; min-width: 0; }
.compact-card-image {
  display: block;
  width: 100%;
  /* height: auto (2026-09-18) -- the <img> now carries width/height
     attributes (_article_img.html), whose presentational height would
     otherwise win over aspect-ratio. */
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin-bottom: 0.6rem;
  border-radius: calc(var(--radius) - 4px);
  background: var(--tool-plate);
}
.compact-card h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
}
.compact-card h3 a { color: var(--ink); text-decoration: none; }
.compact-card h3 a::after { content: ""; position: absolute; inset: 0; }
.compact-card:hover h3 a { text-decoration: underline; }
@media (max-width: 600px) {
  .compact-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .compact-card {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 0.8rem;
    align-items: start;
  }
  .compact-card-image { grid-row: span 2; margin: 0; aspect-ratio: 4 / 3; }
}

.story-grid {
  display: grid;
  /* max 340px per column, not 1fr -- site owner, 2026-08-22: a sparse
     pillar/section with only one or two cards (a new Editorial piece,
     freshly seeded) was stretching that lone card's column, and its
     16:9 .card-image, to the entire container width (auto-fit's single
     remaining column claims all available space when nothing else is
     there to share it with). Capped at roughly the same per-card width
     a full row already settles into on a ~1080px container (--max-width),
     so the grid looks consistent whether it holds 1 card or 8 -- extra
     trailing space just stays empty, which reads better than a
     comically oversized card. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 340px));
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.story-card {
  position: relative;
  padding: 0 0 var(--space-3);
}

.story-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0.5em 0 0.4em;
}
.story-card h3 a { text-decoration: none; color: var(--ink); }
/* Same stretched-link technique as .compact-card's own h3 a::after
   (2026-09-15, that comment's own words: "the thumbnail is clickable
   without a second, duplicate link") -- .story-card's image and dek were
   dead click space until now. The format label above the headline stays
   independently clickable (it links to a different place, the format
   filter) via position + z-index so it paints above this invisible
   overlay despite coming earlier in the DOM. */
.story-card h3 a::after { content: ""; position: absolute; inset: 0; }
.story-card > a.label { position: relative; z-index: 1; }
.story-card:hover h3 a { text-decoration: underline; }
.story-card .dek {
  font-size: 0.92rem;
  margin: 0 0 0.6em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* Featured section layout -- the first populated pillar section on the
   homepage gets one larger featured story + a compact headline list for
   the rest, instead of a uniform story-grid, so the page doesn't read as
   N identical grids stacked (design review, 2026-08-22). */
.featured-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-3);
}
.featured-layout:not(:has(.home-rail-list)) {
  grid-template-columns: minmax(0, 1fr);
}
/* A hairline divider on the list column -- without it, the list's first
   headline sits at the same height as the featured story's image (which
   sits well above its own headline), and reads as if it's the image's
   caption/headline instead of a separate story (site owner, 2026-08-23,
   screenshot: a Harvard story's image visually paired with the
   California headline next to it). This site never uses card
   borders/backgrounds (deliberately flat -- see .story-card), so a
   single rule matching .home-rail-list's own existing li borders is the
   in-pattern fix, not a boxed card around the featured story. */
.featured-layout .home-rail-list {
  border-left: 1px solid var(--border);
  padding-left: var(--space-3);
}
.featured-card {
  position: relative;
}
.featured-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0.5em 0 0.4em;
}
.featured-card h3 a { text-decoration: none; color: var(--ink); }
/* Same stretched-link technique as .story-card above. */
.featured-card h3 a::after { content: ""; position: absolute; inset: 0; }
.featured-card > a.label { position: relative; z-index: 1; }
.featured-card:hover h3 a { text-decoration: underline; }
.featured-card .dek {
  font-size: 1rem;
  margin: 0 0 0.6em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 700px) {
  .featured-layout { grid-template-columns: minmax(0, 1fr); }
  /* Stacked under the featured story, the side divider becomes a top one. */
  .featured-layout .home-rail-list {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--border);
  }
}

.view-all {
  display: inline-block;
  margin-top: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-secondary-ink);
}
.view-all:hover { text-decoration: underline; }

/* Shared meta line (label + timestamp + reading time) under a headline in
   any compact list -- home's secondary cards and Latest feed today,
   reusable anywhere else a list item needs the same three facts. */
.article-list-meta {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article-list-meta .label { margin: 0; font-size: 0.62rem; padding: 0.2em 0.6em; }

/* ---------------------------------------------------------------------
   Secondary featured stories -- one step down from the lead, one step up
   from the compact Latest list. Two cards, side by side on desktop.
   --------------------------------------------------------------------- */
.secondary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

/* Left accent, not top -- 2026-08-19. Used to mirror .lead-story's
   top-border treatment at a smaller size, which made "the story" and
   "also happening" read as siblings rather than a clear hierarchy. A
   side stripe (a "branch line" off the main one, keeping the transit
   metaphor) is quieter by construction -- no tinted background either,
   so these stay visibly a step down from the lead. */
.secondary-card {
  position: relative;
  min-width: 0;
}

/* 2026-09-15 (site owner: "I do not like the card design... used too
   common by other websites, especially the shading border") -- the
   bordered, rounded box with a coloured edge stripe (.lead-story's top
   stripe, .secondary-card's left one) is gone. News stories are now
   open: photo, headline and white space separate them, no box at all.
   Learning tools (.today-card, .feature-card) use a soft tinted
   plate instead, so "news" and "tool" read as different things. The
   one brand mark left is a small amber dot before the story's format
   label -- the notes above about stripes describe the old design. */
.lead-story .lead-story-text > .label:first-child::before,
.secondary-card > a.label:first-of-type::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.45em;
  border-radius: 50%;
  background: var(--brand-news-gold);
  vertical-align: 0.05em;
}
.lead-story-image .card-image,
.secondary-card .card-image {
  border-radius: calc(var(--radius) - 4px);
}

.secondary-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0 0 0.4em;
}
.secondary-card h2 a { text-decoration: none; color: var(--ink); }
/* Same stretched-link technique as .story-card above -- both its labels
   (format and reading level) are real links here (unlike _article_card.html's
   span-only reading level), so both need the z-index rescue. */
.secondary-card h2 a::after { content: ""; position: absolute; inset: 0; }
.secondary-card > a.label { position: relative; z-index: 1; }
.secondary-card:hover h2 a { text-decoration: underline; }
.secondary-card .dek {
  font-size: 0.92rem;
  margin: 0 0 0.6em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* ---------------------------------------------------------------------
   Homepage layout -- single-column news stream (site owner, 2026-08-23:
   dropped the "Most saved" utility-rail module, which was this layout's
   only reason to ever be two columns -- see git history for the prior
   two-thirds-stream-plus-rail version if a rail module returns). Topic
   sections (.pillar-row) stay a full-width row below, matching the
   original layout review's own sketch for that part.
   --------------------------------------------------------------------- */
.home-layout {
  display: grid;
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-4);
}
@media (min-width: 900px) {
  .home-layout-single { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------------
   Editor's Picks (2026-09-04, site owner-supplied WSJ "Most Popular"
   rail reference) -- paired locally with the Latest section only, via
   .home-latest-row, rather than reviving a page-wide sidebar grid (the
   site owner explicitly declined reversing .home-layout-single's own
   2026-08-23 decision above). Fixed 220px column, narrower than a
   .story-grid card's own 240-340px range (see that rule's comment) --
   the reference's rail is visibly slimmer than the main content cards
   beside it, not just "whatever's left over" from a fluid fr split.
   --------------------------------------------------------------------- */
.home-latest-row {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}
@media (min-width: 900px) {
  .home-latest-row { grid-template-columns: minmax(0, 1fr) 220px; }
}

.editors-picks {
  border-top: 1px solid var(--border);
  padding-top: var(--space-2);
}
.editors-picks-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
}
/* Solid --line-brand pill, same treatment as .label-level-advanced --
   this codebase's one-accent design system tells badges apart by label
   text/fill weight, not a new hue per pillar (see :root's own comment),
   so this stays on that system rather than matching the reference
   screenshot's gold "OPINION" tag literally. */
.editors-picks-badge {
  flex: none;
  padding: 0.15em 0.65em;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.editors-picks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.editors-picks-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}
.editors-picks-text a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}
.editors-picks-text a:hover { text-decoration: underline; }
.editors-picks-text .article-list-meta { margin: 0.3em 0 0; }
.editors-picks-thumb {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------------
   Today (2026-10-03, replacing the Today's English session card): the
   signed-in student's plan for the day (accounts/today.py), or what
   Biblinkage covers for a visitor. Same tinted plate the old card used, so
   it still reads as the page's one tool rather than another story.
   Each row is one link: a bold action and a quieter line under it.
   --------------------------------------------------------------------- */
.today-card {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--tool-plate);
  border-radius: var(--radius);
}
.today-heading {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
}
.today-date,
.today-intro {
  margin: 0.15em 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.today-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.today-list > li + li { border-top: 1px solid var(--border); }
.today-item {
  display: grid;
  grid-template-columns: 0.35rem minmax(0, 1fr);
  column-gap: 0.75rem;
  min-height: 44px;
  padding: 0.6em 0.4em;
  margin: 0 -0.4em;
  border-radius: calc(var(--radius) - 2px);
  text-decoration: none;
  color: var(--ink);
}
/* A short coloured bar per kind of task, so the list scans at a glance;
   the label still says what each one is, so colour never carries it alone. */
.today-item::before {
  content: "";
  grid-row: 1 / span 2;
  align-self: stretch;
  border-radius: 999px;
  background: var(--line-brand);
}
.today-item-words::before { background: var(--accent-secondary); }
.today-item-deadline::before { background: var(--brand-news-gold); }
.today-item-course::before { background: var(--line-brand); }
.today-item-interview::before { background: var(--ink-soft); }
.today-item-campus::before { background: var(--accent-secondary); }
.today-item:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.today-item:hover .today-item-label { text-decoration: underline; }
.today-item:focus-visible { outline: 2px solid var(--accent-secondary-ink); outline-offset: 1px; }
.today-item-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}
.today-item-detail {
  grid-column: 2;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.today-more {
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: 0.88rem;
}
.today-more a { color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.today-more a:hover { text-decoration: underline; }
.today-more .today-signup {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.2em;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border-radius: var(--radius);
  font-weight: 700;
}
.today-more .today-signup:hover { text-decoration: none; opacity: 0.9; }
.today-extension {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: var(--space-2) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.4;
}
.today-extension a { color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.today-extension a:hover { text-decoration: underline; }
.today-extension span { color: var(--ink-soft); }
/* Chrome extensions don't run on phones, tablets or in the Android app. */
@media (hover: none), (max-width: 700px) {
  .today-extension, .vh-more-action { display: none; }
}
.dashboard-today { margin-top: var(--space-3); }

/* ---------------------------------------------------------------------
   Homepage hero -- lead story + the Today card side by side (2026-09-03
   design review: the session card used to sit full-width above the lead
   story, pushing the actual top headline below the fold on mobile and
   leaving half the desktop width empty). DOM order is always
   today-card then lead-story (see home.html) -- desktop
   repositioning below is grid-column only, never `order`, so tab/
   screen-reader order matches the mobile visual order on every
   breakpoint.
   --------------------------------------------------------------------- */
.home-hero {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.home-hero > .lead-story,
.home-hero > .today-card {
  /* These accounted for spacing when both sections were standalone
     .home-layout children; .home-hero's own gap/margin-bottom does that
     job now. Left un-guarded by a media query (applies at every width,
     not just desktop) since it's needed on mobile too. */
  margin-bottom: 0;
}
@media (min-width: 700px) {
  .home-hero {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: start;
  }
  .home-hero > .lead-story { grid-column: 1; grid-row: 1; }
  .home-hero > .today-card { grid-column: 2; grid-row: 1; }

  /* Stack the lead story's image above its text instead of re-splitting
     the hero's already-narrower ~1.5fr column -- .lead-story's own
     internal 1.6fr/1fr text+image grid assumed the full ~1040px content
     width; inside a ~600-650px hero column that split would leave the
     headline only ~370-400px wide carrying its existing
     clamp(1.9rem,4vw,2.9rem) font, causing excessive wrapping. Reuses
     the same order:-1 treatment .lead-story-image already gets below
     700px today (static/css/site.css:876-883) -- just applied here at
     every width once the lead story is confined to the hero's narrower
     column, not only on mobile. */
  .home-hero > .lead-story { grid-template-columns: minmax(0, 1fr); }
  .home-hero > .lead-story .lead-story-image { order: -1; }

}

.home-rail-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.home-rail-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.home-rail-list li:last-child { border-bottom: none; }
.home-rail-list a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.home-rail-list a:hover { text-decoration: underline; }
.home-rail-list .article-list-meta { margin: 0.2em 0 0; }

.card-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: var(--space-2);
}
/* 2026-09-13 design review, item 2 ("large blank gap on cards with no
   photo") -- .story-grid/.featured-layout cards (the only places
   .card-image-placeholder ever renders -- confirmed via grep, see that
   rule's own comment) get a shorter ratio than the base 16:9 above.
   .lead-story-image's single hero photo and .secondary-card's
   thumbnails also reuse .card-image but are hand-rolled markup outside
   either grid container, so they're untouched here -- one tall hero
   image isn't the repeating-grid problem this is fixing, and there's
   no reason to shrink it along with it. 2.2:1 is from the 2.2-2.4
   range discussed for this fix: short enough to visibly close the gap,
   still tall enough that a photo-less card's headline doesn't read as
   belonging to a neighboring card's image -- the 2026-08-23 bug
   .card-image-placeholder exists to prevent (see _article_card.html's
   own comment on that). */
.story-grid .card-image,
.featured-layout .card-image {
  aspect-ratio: 2.2 / 1;
}
/* Same footprint as .card-image in the same .story-grid/.featured-
   layout context (see the comment just above) -- _article_card.html's
   own comment covers why an image-less card still reserves this space
   at all. Exclusively rendered inside those two containers (confirmed
   via grep), so it can just take the 2.2:1 ratio directly with no
   scoping needed, unlike .card-image above. Bordered + a centered
   muted photo icon, rather than the previous bare/transparent box --
   left unstyled, an empty aspect-ratio box read as a rendering glitch
   (a real blank spot) rather than a deliberate "no photo for this one"
   placeholder. --border (not a background tint) is what separates
   raised surfaces from --paper in light mode across this file (see
   --paper's own comment on why the two are identical there); the
   --paper-raised fill still matters in dark mode, where it isn't. */
.card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 2.2 / 1;
  margin-bottom: var(--space-2);
  background: var(--paper-raised);
  border: 1px solid var(--border);
}
.card-image-placeholder-icon {
  width: 28px;
  height: 28px;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.detail-image {
  display: block;
  width: 100%;
  height: auto;
  /* 2026-09-12 learner-UX review, Finding 3 -- with only width:100%/
     height:auto, a tall-aspect source photo could push the article
     body (and now the .article-actions toolbar right above it, moved
     up in the same fix) well past the first screen. object-fit:cover
     crops rather than distorts once max-height actually constrains the
     rendered height below the image's native aspect ratio. */
  max-height: 360px;
  object-fit: cover;
  margin: var(--space-3) 0 0;
}
@media (max-width: 600px) {
  .detail-image { max-height: 240px; }
}
.image-caption {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin: 0.3em 0 var(--space-2);
}
.image-caption a { color: inherit; text-decoration: underline; }

/* ---------------------------------------------------------------------
   Pillar row (homepage) & article lists (topic pages) -- bright,
   shadow-lifted cards rather than flat bordered boxes.
   --------------------------------------------------------------------- */
.pillar-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.pillar-row > div {
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: border-color 0.15s ease;
}

.pillar-row > div:hover { border-color: var(--border-strong); }

.pillar-row h2 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin: 0 0 var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 3px solid var(--border);
}

.pillar-row h2 a { text-decoration: none; color: var(--ink); }

.pillar-row ul { list-style: none; margin: 0; padding: 0; }
.pillar-row li { padding: 0.55rem 0; font-size: 0.98rem; border-bottom: 1px solid var(--border); }
.pillar-row li:last-child { border-bottom: none; }
.pillar-row li a { text-decoration: none; color: var(--ink); }
.pillar-row li a:hover { text-decoration: underline; }

.pillar-row .view-all {
  display: inline-block;
  margin-top: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-secondary-ink);
}
.pillar-row .view-all:hover { text-decoration: underline; }

.article-list { list-style: none; padding: 0; margin: 0; }

.article-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.article-list li:first-child { padding-top: 0; }
.article-list a { text-decoration: none; font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.article-list a:hover { text-decoration: underline; }
.article-list .dek { font-size: 1rem; margin-top: 0.35rem; }

/* /saved/ page only -- see static/js/site.js::initSavedArticlesPage */
#saved-articles-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.saved-remove {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.3em 0.8em;
  cursor: pointer;
}
.saved-remove:hover { border-color: var(--line-news); color: var(--line-news-ink); }

/* ---------------------------------------------------------------------
   Saved-articles collections & notes (logged-in /saved/ only) -- design
   review: "evolve Saved into a lightweight research library."
   --------------------------------------------------------------------- */
/* 2026-09-05 redesign (site owner: "still the same as before, super
   ugly" / "make it beautiful and professional and modern") -- the
   whole page was previously unconstrained-width plain text with no
   card treatment at all; this brings it in line with the card+shadow
   language already established elsewhere (.rss-feed-card, #review-card)
   instead of introducing a new visual idiom. .saved-page centers a
   single reading-width column -- margin: auto, not just max-width, the
   thing .static-page itself is still missing (see that class's own
   comment elsewhere in this file). */
/* 2026-09-15 (site owner: "too wordy, and the layout is weird") -- the
   centred 700px column sat visibly off the header/footer's left edge on
   wide screens. Left-aligned like .static-page instead, so it lines up
   with the logo. */
.saved-page { max-width: var(--content-width); }
.saved-page h1 { margin-bottom: 0.25em; }
/* 2026-09-16 restyle (site owner: "fancier, more professional, modern,
   energetic"; standing rule: no shadows, edge stripes or tinted fills).
   Energy comes from solid brand blue, weight and size only. */
.saved-summary {
  margin: 0 0 var(--space-3);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink-soft);
}
/* Jump row: one plain link per shelf, wrapping on narrow screens. */
.saved-jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-2) 0;
  border-block: 1px solid var(--border);
}
.saved-jump a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.saved-jump-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-jump a:hover { color: var(--accent-secondary-ink); text-decoration: underline; text-underline-offset: 3px; }
.saved-jump a:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 3px; border-radius: 4px; }
/* Count badge -- solid fill, used in the jump row and section headings.
   inline-block, so a hovered link's underline doesn't run through it. */
.saved-count {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  vertical-align: 0.2em;
}
.saved-page-note {
  margin: 0 0 var(--space-4);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-faint);
}
.saved-page-note a { color: var(--accent-secondary); font-weight: 600; }

/* Empty state: no box, no divider -- an icon, one line, one way forward. */
.article-list li.saved-empty-item { padding: 0; border-bottom: 0; }
.saved-empty {
  display: grid;
  justify-items: start;
  gap: 0.35rem;
  padding-block: var(--space-3);
}
.saved-empty-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.4rem;
  fill: color-mix(in srgb, var(--brand-news-gold) 16%, transparent);
  stroke: var(--brand-news-gold);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.saved-empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}
.saved-empty-hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.article-list a.saved-empty-link,
.saved-empty-link {
  margin-top: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-secondary);
  text-decoration: none;
}
.saved-empty-link::after { content: " \2192"; }
.article-list a.saved-empty-link:hover,
.saved-empty-link:hover { text-decoration: underline; }

.collection-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  font-family: var(--font-body);
}
.collection-form input {
  /* min-width: 0 overrides the flex item default of min-width: auto,
     which for a text input resolves to its intrinsic content width (not
     0) -- without this, the input refused to shrink below that width and
     pushed the button (autonomous audit's 320px-viewport screenshot
     pass, matching the same fix #search-widget already needed for the
     same reason -- see that rule elsewhere in this file). flex-wrap on
     the form above is the other half of the fix: once neither child can
     shrink further, the button drops to its own row instead of both
     being squeezed into an unreadably narrow sliver. */
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 20rem;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
.collection-form input:focus {
  outline: 2px solid var(--accent-secondary);
  outline-offset: -1px;
  border-color: var(--accent-secondary);
}
.collection-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.collection-form button:hover { background: var(--accent-secondary-ink); }

.saved-collection { margin-bottom: var(--space-5); scroll-margin-top: calc(var(--header-height, 75px) + var(--space-2)); }
/* A hairline under each shelf's heading row -- was a brand left-edge
   stripe, which the site owner rejects as shading. */
.saved-collection-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}
.saved-collection h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
/* min-width: 0 + overflow-wrap: break-word -- same flex-item shrink
   gotcha and same unbroken-long-word overflow already fixed elsewhere
   in this file (see .collection-form input and .article-body): a
   max_length=100 collection name with no spaces is legal today and,
   without these, forces .saved-collection-header (a flex row) past its
   width instead of wrapping, taking the whole page into horizontal
   scroll and squashing "Delete collection" against the edge. */
.saved-collection-header h2 { min-width: 0; overflow-wrap: break-word; }
.saved-collection-header h2 .saved-count { margin-left: 0.3em; }
.saved-collection-header form { flex-shrink: 0; }
.saved-collection-delete {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.saved-collection-delete:hover { color: var(--line-news-ink); text-decoration: underline; }

.saved-bookmark-list { display: flex; flex-direction: column; gap: var(--space-2); }
/* Real cards, not a plain divider-list -- overrides .article-list li's
   border-bottom "reading list" treatment (this ties on specificity and
   wins on source order, see that rule earlier in this file). Flat
   since 2026-09-16: a hairline that turns brand blue on hover, no
   shadow and no lift. */
.saved-bookmark-list li.saved-bookmark {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: var(--space-3) var(--space-3) var(--space-2);
  transition: border-color 0.15s ease;
}
.saved-bookmark-list li.saved-bookmark:first-child { padding-top: var(--space-3); }
.saved-bookmark-list li.saved-bookmark:hover,
.saved-bookmark-list li.saved-bookmark:focus-within { border-color: var(--accent-secondary); }
/* The two empty-state messages ("No articles filed here yet.../
   Everything saved is filed into a collection above.") are plain <li>s
   with no .saved-bookmark class -- kept quiet and un-carded on purpose,
   an empty state reads as an invitation to act, not as content. */
.saved-bookmark-list li:not(.saved-bookmark) {
  padding: var(--space-2) 0;
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.saved-bookmark-header { margin-bottom: var(--space-2); }
.article-list a.saved-bookmark-title,
.saved-bookmark-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: break-word;
}
.article-list a.saved-bookmark-title:hover { color: var(--accent-secondary-ink); text-underline-offset: 3px; }
/* Facts line under the title -- spaced by the gap, no separators. */
.saved-bookmark-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em 1em;
  margin: 0.45em 0 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.saved-bookmark-meta .label { margin: 0; }
.saved-bookmark-form { font-family: var(--font-body); }
.saved-bookmark-field-label {
  display: block;
  margin-bottom: 0.3em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.saved-bookmark-note-field { display: block; margin-bottom: var(--space-2); }
/* The UA's built-in `[hidden]{display:none}` rule loses to ANY author-
   origin `display` rule on the same element regardless of specificity
   -- the `display: block` above would otherwise keep this field
   visible from first paint despite the bare `hidden` attribute in
   _saved_bookmark.html. Same established pattern as .back-to-top[hidden]/
   .rss-feed-card-menu-panel[hidden] elsewhere in this file. */
.saved-bookmark-note-field[hidden] { display: none; }
.saved-bookmark-form textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  resize: vertical;
}
.saved-bookmark-form textarea:focus {
  outline: 2px solid var(--accent-secondary);
  outline-offset: -1px;
  border-color: var(--accent-secondary);
}
/* Note field above, a control row below -- was one cramped flex-wrap
   line with the textarea, dropdown, and Save button all competing for
   space at 200-240px minimum widths each. */
.saved-bookmark-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
/* +Add note / the note preview -- a plain link-styled button, same
   idiom as .saved-collection-delete, so it reads as a toggle rather
   than a third form control competing with Collection/Save/Remove.
   (2026-09-16: these rendered as outlined pills until the generic
   button rule below was scoped to the menu panels.) */
.saved-bookmark-note-toggle {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-bookmark-note-toggle:hover { color: var(--accent-secondary-ink); text-decoration: underline; text-underline-offset: 3px; }
.saved-bookmark-note-toggle:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; border-radius: 4px; }
.saved-bookmark-note-preview { font-weight: 400; color: var(--ink-soft); font-style: italic; }
/* Groups the folder menu + overflow menu together on the right of the
   control row, so space-between on .saved-bookmark-controls puts
   exactly two things on opposite ends (the note toggle, and this whole
   group) -- not three items spread evenly across the row. */
.saved-bookmark-controls-group { display: flex; align-items: center; gap: 0.3em; }
/* 2026-09-12 learner-UX review, "move collection changes into a folder
   menu and Remove into an overflow menu" -- same toggle/click-outside-
   closes shape and panel look as .rss-feed-card-menu (initSavedBookmark
   Menus, site.js). Two separate .saved-bookmark-menu instances share
   this one ruleset (folder icon vs. "⋯", picking a collection vs.
   Remove) rather than needing two near-duplicate rule sets. */
.saved-bookmark-menu { position: relative; }
.saved-bookmark-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; padding: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: none; color: var(--ink-soft); cursor: pointer;
}
.saved-bookmark-menu-btn svg { width: 1.1rem; height: 1.1rem; }
.saved-bookmark-folder-btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.saved-bookmark-overflow-btn svg { fill: currentColor; }
.saved-bookmark-menu-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary); }
/* Open menu: the trigger fills solid, so it's clear which card's menu is up. */
.saved-bookmark-menu-btn[aria-expanded="true"] { border-color: var(--line-brand); background: var(--line-brand); color: var(--line-brand-on); }
.saved-bookmark-menu-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.saved-bookmark-menu-panel {
  position: absolute; top: 100%; right: 0; z-index: 5; min-width: 12rem;
  margin-top: 0.3em; padding: 0.6em; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--paper-raised);
  display: flex; flex-direction: column; gap: 0.5em;
}
/* The UA's built-in `[hidden] { display: none }` loses to ANY author-
   origin `display` rule regardless of specificity -- same established
   pattern as .messaging-menu-panel and the other examples in this file
   (see .messaging-search-bar[hidden]'s own comment above). */
.saved-bookmark-menu-panel[hidden] { display: none; }
.saved-bookmark-overflow-menu .saved-bookmark-menu-panel button { width: 100%; }
.saved-bookmark-collection-field { display: flex; flex-direction: column; }
/* max-width + the ellipsis trio -- a native <select> sizes itself to
   its widest <option> text, and a max_length=100 collection name with
   no spaces (same legal-today case as .saved-collection-header h2
   above) renders here as a plain <option> in every bookmark card,
   ballooning the select past the card and forcing the whole page into
   horizontal scroll. Same fix idiom as .saved-bookmark-note-toggle
   just above: clip the closed control, the open dropdown still shows
   full option text. */
.saved-bookmark-form select {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-bookmark-actions { display: flex; gap: var(--space-2); }
.saved-bookmark-menu-panel button {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
}
.saved-bookmark-menu-panel button:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* .account-danger-link (Remove) still wins its own color over both
   rules above: `.saved-bookmark-menu-panel button`/`:hover` and
   `button.account-danger-link`/`:hover` (near the Design tokens
   section of this file) are EQUAL specificity (0,1,1)/(0,2,1) --
   account-danger-link wins on source order, being declared later in
   this file, not because it's more specific. It doesn't touch
   border-color though (profile.html's plain-link "Delete account"
   usage has no border to match), so pin that here instead of on the
   shared utility class. Selector updated 2026-09-12 -- Remove moved
   from .saved-bookmark-actions into its own overflow menu. */
.saved-bookmark-overflow-menu .account-danger-link:hover { border-color: var(--line-news); }

/* 2026-09-16 usability pass (site owner: "make this page more user
   friendly"). Flat like the rest of the page. */
/* Action confirmation, shown on the card/section it's about
   (articles.views._saved_flashes). */
.saved-flash {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
}
.saved-flash::before {
  content: "\2713";
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.72rem;
}
/* The redirect's #fragment lands here: clear the sticky header, and
   outline the card that was just changed. */
.saved-bookmark,
.saved-collection { scroll-margin-top: calc(var(--header-height, 75px) + var(--space-3)); }
.saved-bookmark-list li.saved-bookmark:target { border-color: var(--accent-secondary); outline: 1px solid var(--accent-secondary); }
.saved-bookmark-list > li[hidden],
.saved-collection[hidden] { display: none; }

/* Toolbar: find box + "+ New collection". */
.saved-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}
.saved-toolbar:not(:has(> :not([hidden]))) { display: none; }
.saved-filter { position: relative; flex: 1 1 16rem; max-width: 30rem; }
.saved-filter[hidden] { display: none; }
.saved-filter-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.saved-new-collection-btn {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-secondary);
  cursor: pointer;
}
.saved-new-collection-btn:hover { color: var(--accent-secondary-ink); text-decoration: underline; text-underline-offset: 3px; }
.saved-new-collection-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; border-radius: 4px; }
.saved-new-collection-btn[hidden],
.collection-form[hidden] { display: none; }
.saved-filter input {
  width: 100%;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 0.9rem 0.65rem 2.4rem; /* room for .saved-filter-icon */
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
.saved-filter input:focus {
  outline: 2px solid var(--accent-secondary);
  outline-offset: -1px;
  border-color: var(--accent-secondary);
}
.saved-filter-empty {
  margin: 0 0 var(--space-4);
  font-family: var(--font-body);
  color: var(--ink-soft);
}
.saved-filter-empty[hidden] { display: none; }

/* Open note: "Save note" (solid, the one real action) + "Hide". */
.saved-bookmark-note-actions { display: inline-flex; align-items: center; gap: var(--space-2); }
.saved-bookmark-note-actions[hidden] { display: none; }
.saved-bookmark-note-save {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--line-brand);
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.saved-bookmark-note-save:hover { background: var(--accent-secondary-ink); border-color: var(--accent-secondary-ink); }
.saved-bookmark-note-save:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

h1 { font-family: var(--font-display); }

/* ---------------------------------------------------------------------
   Article detail
   --------------------------------------------------------------------- */
/* Scoped to .article-detail, not the bare `article` type selector --
   templates/base.html's before-paint script sets --reading-content-width
   on <html> on every page, not just article detail pages, so a bare
   selector here let a reader's column-width choice leak onto homepage
   story cards and other <article> elements that had a fixed 700px cap
   before this branch (2026-08-27 final review, finding 3). */
article.article-detail { max-width: var(--reading-content-width); }
article h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.15; margin: 0 0 var(--space-2); }
/* A page title and its one-line subtitle sit var(--space-2) apart, as on
   articles, About and Pricing (2026-11-14 spacing survey: Courses had 0,
   Log in 4px, Dashboard and Register the browser's 0.67em h1 margin). */
.tool-title:has(+ .dek),
:is(.account-card, .auth-layout .account-card) > h1:has(+ .dek) { margin-bottom: var(--space-2); }
article > .dek { font-size: 1.15rem; margin-bottom: var(--space-3); }

.article-breadcrumb {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.article-breadcrumb:hover { color: var(--accent-secondary-ink); }

/* overflow-wrap: break-word -- without it, one genuinely unbroken long
   word (a pasted URL, a run-on typo with no spaces) doesn't wrap at
   all and forces the whole page into horizontal scroll, not just that
   line -- confirmed live via .journal-read-view (reuses this exact
   class) with a 100+-char unbroken word, autonomous audit, 2026-09-05,
   goal doc section I. Same idiom .journal-attachment-pdf-link already
   uses (overflow-wrap: anywhere, further down this file) for the
   identical class of problem with long filenames. break-word (not the
   more aggressive anywhere) here specifically, since article/journal
   prose should still prefer breaking at normal word boundaries and only
   fall back to breaking mid-word when a single word truly doesn't fit --
   anywhere would break early even when a normal wrap point exists a
   little further on. */
.article-body { font-size: calc(1.15rem * var(--reading-font-scale)); line-height: var(--reading-line-height); overflow-wrap: break-word; }
.article-body p { margin: 1.3em 0; }
/* h1 was never offered in real article bodies (the page's own <h1> is
   the title, rendered separately -- see articles/views.py::
   _render_article_body's docstring), so no rule existed here until the
   journal entry's rich-text editor started offering it too (site owner,
   2026-08-22) -- .journal-read-view reuses this same .article-body
   class, and a real article's Markdown source still can't produce an
   h1 either way (no "#" single-hash heading in the generation prompts),
   so this only ever fires for journal content in practice. */
.article-body h1 { font-size: 1.7rem; margin-top: 2em; }
.article-body h2 { font-size: 1.4rem; margin-top: 2em; }
.article-body a { color: var(--accent-secondary-ink); }

/* A classic editorial drop cap on the opening paragraph of a long-form
   piece -- cheap, tasteful, and purely typographic (no external image). */
article.long-read .article-body > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.8em;
  line-height: 0.8;
  font-weight: 700;
  padding: 0.05em 0.08em 0 0;
  color: var(--accent-secondary);
}

.article-meta {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: -0.5em;
  margin-bottom: var(--space-2);
}

/* Topic page pagination (2026-09-18, launch-readiness plan item 1.5) --
   plain links, no buttons: newer on the left, older on the right. */
.topic-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.topic-pagination a {
  color: var(--accent-secondary-ink);
  font-weight: 600;
}
.topic-pagination-status {
  color: var(--ink-faint);
  margin: 0 auto;
}

/* 2026-09-18, launch-readiness plan item 0.9 -- AI disclosure beside the
   byline (detail.html). Hairline outline, no fill or shadow, so it reads
   as a quiet label rather than a button; underlines on hover like a link. */
.article-meta .ai-label {
  display: inline-block;
  margin-left: 0.25em;
  padding: 0 0.45em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.article-meta .ai-label:hover,
.article-meta .ai-label:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

/* 2026-09-12 learner-UX review, Finding 2 -- static hint pointing at
   the always-on word/phrase selection popover (see detail.html's own
   comment on why this is a fixed line, not a dismissible banner). */
.vocab-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--accent-secondary-ink);
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.5em 0.8em;
  margin: 0 0 var(--space-2);
}
/* Nudges the icon down to optically align with the first line of text
   rather than sitting flush with the top of the whole (possibly
   wrapped, multi-line) paragraph. */
.vocab-hint .article-icon { margin-top: 0.15em; }

/* ---------------------------------------------------------------------
   Listen / Save / Share toolbar -- see static/js/site.js for the
   SpeechSynthesis-backed listen button, the localStorage-backed save
   toggle, and the copy-link/native-share handlers. The explicit
   email/WhatsApp/LinkedIn links need no JS at all (plain hrefs).
   --------------------------------------------------------------------- */
/* Sticky (2026-09-13 design review, item 6's own open question -- "keep
   them sticky or easy to reach while reading" was left unresolved when
   the toolbar was first grouped, since pinning a second bar competes
   with the compact-header-on-scroll feature's whole point of reducing
   chrome while reading; site owner's call once asked directly: pin it
   anyway). top: var(--header-height) -- the same var initHeaderHeightVar()/
   initCompactHeaderOnScroll() (site.js) already keep in sync with the
   header's real height, so this toolbar automatically re-docks flush
   under the header whether it's full-height or scrolled-compact,
   without this rule needing to know which. A solid --paper background
   (not the header's then-frosted color-mix+backdrop-filter, itself made
   solid 2026-09-14) -- .site-
   header's own comment documents a real sticky+backdrop-filter
   compositing glitch on some Android WebViews; a second such element
   isn't worth risking the same bug for a background effect this
   toolbar doesn't need to match exactly. z-index 8, one below .site-
   header/.line-strip/.reading-progress's shared 9-10 (this toolbar
   docks BELOW those, never over them). */
.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: 0.82rem;
  margin-bottom: var(--space-3);
  position: sticky;
  top: var(--header-height, 112px);
  z-index: 8;
  background: var(--paper);
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* .action-share-message ("Send to a friend") added to this selector
   2026-09-13 -- it was the one action in this toolbar never actually
   styled as a pill/button (a plain inline link, unlike every sibling
   here), noticed only once it needed the same icon+label inline-flex
   layout the others already had for their new SVG icons.
   .action-journal-login (item 10, "clarify logged-out actions") is the
   logged-out stand-in for .action-journal -- same pill, so a logged-in
   and a logged-out reader see the same-shaped control in the same spot,
   just with a different label/destination. */
.article-actions button, .article-actions .action-share-links a, .article-actions .action-journal,
.article-actions .action-share-message, .article-actions .action-journal-login {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font: inherit;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.35em 0.9em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.article-actions button:hover, .article-actions .action-share-links a:hover, .article-actions .action-journal:hover,
.article-actions .action-share-message:hover, .article-actions .action-journal-login:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}

.article-actions button[aria-pressed="true"] {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
  background: color-mix(in srgb, var(--accent-secondary) 10%, transparent);
}

/* The `.article-actions button { display: inline-flex; ... }` rule above
   (0,1,1 specificity) beats the UA stylesheet's `[hidden] { display: none }`
   regardless of specificity rules for author vs. UA styles -- so a hidden
   action button (vocab-mode toggle with no lookup feature available,
   .action-listen with no Speech Synthesis, .action-native-share with no
   Web Share API) stayed visible-but-inert instead of actually hidden. Same
   fix, same precedent as .back-to-top[hidden] and .review-grades[hidden]
   elsewhere in this file (2026-08-26 final review, finding 2). This
   subsumes the narrower `@media (hover: hover) { .action-vocab-mode }`
   rule below for touch devices, where that media query doesn't apply. */
.article-actions button[hidden] { display: none; }

/* 2026-09-13 design review ("Replace emoji-style icons with consistent
   UI icons ... they feel a bit casual beside the polished dark news
   design") -- same reasoning and the same stroke-based line-icon look
   as .journal-icon (2026-09-02, "replace every emoji with one
   consistent SVG icon set"), just under its own name since this is a
   different feature area's icon set, matching this codebase's existing
   convention of one -icon class per area rather than a single shared
   name (see e.g. .dashboard-action-icon, .messaging-new-icon). */
.article-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* .action-save and .listen-pause-resume each carry BOTH of their two
   states' icons in the markup (outline/filled star; pause bars/play
   triangle) and let aria-pressed -- which their own JS already sets on
   every state change, static/js/site.js -- pick which one shows,
   instead of JS swapping SVG content or toggling a class of its own.
   One less thing for the two to get out of sync on. */
.action-save-icon-filled,
.listen-play-icon {
  display: none;
}
.action-save[aria-pressed="true"] .action-save-icon-outline,
.listen-pause-resume[aria-pressed="true"] .listen-pause-icon {
  display: none;
}
.action-save[aria-pressed="true"] .action-save-icon-filled,
.listen-pause-resume[aria-pressed="true"] .listen-play-icon {
  display: block;
}
/* The filled star is the "already saved" state -- reads as done/active
   rather than an outline in the same accent color an unsaved star
   already uses on hover, the same filled-vs-outline convention most
   bookmark/favorite icons use elsewhere (this one has no precedent in
   this codebase to match, being the first two-state icon toggle here). */
.action-save-icon-filled { fill: currentColor; }

/* 2026-09-13 design review, "group them like Listen | Text size |
   Focus mode | Save | Journal | Share" -- .action-share-wrap/
   .share-panel are the Share half of that, the same open/close/
   position idiom .action-reading-prefs-wrap/.reading-prefs-panel
   already established just above (site.js's new initSharePanel()
   mirrors initReadingPrefsPanel()'s own toggle/outside-click/Escape
   handling). right: 0 rather than left: 0 -- Share is the last item in
   the row, so a left-anchored panel as wide as .reading-prefs-panel
   would usually run past the right edge of the viewport/article
   column; right-anchoring keeps it growing back into the column
   instead. */
.action-share-wrap { position: relative; display: inline-block; }
.share-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: max-content;
  min-width: 180px;
  padding: var(--space-2);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}
/* Same author-origin-beats-UA-[hidden] precedent as .reading-prefs-panel
   just above -- without this the panel would render permanently open. */
.share-panel[hidden] { display: none; }
/* Every pill inside stacks full-width and left-aligns its own icon+label
   instead of staying the auto-width, center-aligned inline-flex pill
   .article-actions button/.action-share-message/.action-journal use out
   in the main toolbar row -- a vertical dropdown list reads better as a
   list than as a column of separately-centered chips. */
.share-panel .action-share-message,
.share-panel .action-native-share,
.share-panel .action-copy-link,
.share-panel .action-share-links a {
  width: 100%;
  justify-content: flex-start;
}
.action-share-links { display: contents; } /* its children flow as if direct siblings inside .share-panel */
/* The UA's built-in `[hidden] { display: none }` loses to the author
   `display: contents` above, so without this override the explicit
   Email/WhatsApp/LinkedIn/Copy-link row stayed visible even after
   static/js/site.js's initShareButtons() set hidden=true on it when a
   native Share button is available -- leaving BOTH share affordances on
   screen in the app (2026-09-03 fix). Same established pattern as
   .back-to-top[hidden]/.journal-media-item[hidden] elsewhere in this
   file. */
.action-share-links[hidden] { display: none; }

/* Vocabulary mode toggle only makes sense on touch devices (tap-to-define
   replaces the desktop select-to-define flow) -- JS only ever clears
   `hidden` when `(hover: none)` matches (see initFlashcardSelection's
   vocabModeBtn wiring in site.js), so this is a belt-and-suspenders gate
   against it ever showing on a hover-capable device, same pattern as
   .action-listen's own JS-side `if (!("speechSynthesis" in window))` gate.
   Selector has to be `.article-actions .action-vocab-mode` (two classes),
   not the bare `.action-vocab-mode` the plan's brief specified -- the
   generic `.article-actions button { display: inline-flex; ... }` rule
   above is a class+type selector, (0,1,1) specificity, which beats a
   single-class `.action-vocab-mode` selector's (0,1,0) and would win
   despite the `hidden` attribute (author-stylesheet declarations always
   beat the UA stylesheet's own `[hidden] { display: none }`, regardless of
   specificity) -- confirmed live: without this the button rendered
   visible on a real desktop-viewport Chromium context. */
@media (hover: hover) {
  .article-actions .action-vocab-mode { display: none; }
}

/* ---------------------------------------------------------------------
   Summary card (labeled "TL;DR" before the 2026-09-12 learner-UX
   review) -- key_points is a short list generated alongside the body
   (see generate_article.py's schema); renders only when present, so
   pieces published before this field existed just don't show one.
   Native <details>, open by default: the whole point is visible-by-
   default fast context, with a collapse option for a reader who doesn't
   want it taking up space, not a "click to reveal" teaser.
   --------------------------------------------------------------------- */
.tldr-card {
  font-family: var(--font-body);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}

.tldr-card summary {
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-secondary-ink);
  list-style: none;
}
.tldr-card summary::-webkit-details-marker { display: none; }
.tldr-card summary::before { content: "▾ "; }
.tldr-card[open] summary::before { content: "▾ "; }
.tldr-card:not([open]) summary::before { content: "▸ "; }

.tldr-card ul {
  margin: var(--space-2) 0 0;
  padding-left: 1.2em;
  font-size: 0.98rem;
  line-height: 1.55;
}
.tldr-card li { margin: 0.4em 0; }

/* ---------------------------------------------------------------------
   Study page -- flashcards saved from selected article text (design,
   2026-08-21). Each card is a <details>/<summary>, the same "click to
   reveal" mechanism .tldr-card already uses, not a new flip mechanism.
   --------------------------------------------------------------------- */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* position: relative -- containing block for .flashcard-delete-form's
   absolute positioning below. */
.flashcard-item { list-style: none; margin: 0; padding: 0; position: relative; }

/* Flat: hairline border only, no brand left-edge stripe (2026-09-15,
   site owner: "I do not like border shading"), and tighter padding for
   the compact Study pass. */
.flashcard {
  font-family: var(--font-body);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
}

.flashcard summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
  display: block;
}
.flashcard summary::-webkit-details-marker { display: none; }
/* Single-line ellipsis truncation (2026-08-29 design-review follow-up,
   the term-length counterpart to .flashcard-context's 2-line clamp
   above) -- a reader can save a whole sentence as `front`, not just a
   word/short phrase, which otherwise wraps and dominates the grid card's
   heading. Scoped to this inner wrapper, not <summary> itself, so the
   ▸/▾ arrow (formerly a <summary>-level ::before, moved down to this
   wrapper) renders beside the term rather than on its own line the way
   an inline ::before immediately before a block-level next sibling
   would. display: block (rather than the default inline default a bare
   text node would get) is what lets white-space/overflow/text-overflow
   actually apply here. */
/* 2026-09-15 (site owner: "the status must be shown in the card
   regardless of the length of the words"): the row is now a flex line
   and only .flashcard-term-text truncates -- previously the whole row
   (term AND status badge) shared one ellipsis, so a long saved phrase
   pushed the badge out of sight. */
.flashcard-term-row {
  display: flex;
  align-items: center;
  gap: 0.4em;
  min-width: 0;
  /* Reserves room for .flashcard-delete-icon, which sits on top of this
     row (absolutely positioned, not part of this element's own box) --
     without this, a long term's ellipsis truncation wouldn't account for
     the icon and text would run underneath it. */
  padding-right: 1.7em;
}
.flashcard-term-row::before { content: "▸"; flex: none; font-size: 0.75em; color: var(--accent-secondary-ink); }
.flashcard[open] .flashcard-term-row::before { content: "▾"; }
.flashcard-term-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flashcard-term-row .flashcard-status { flex: none; margin-left: 0; }
/* Bug fix, 2026-08-29 (same day as the truncation above): the ellipsis
   was unconditional, so opening a card to read the rest of a long saved
   term still showed "survive often enough, and vin…" -- the whole point
   of expanding a <details> is to see everything it's hiding. Truncation
   is a closed-card, tidy-grid concern only; an open card has the room
   and the reader's explicit intent to read the full term. */
.flashcard[open] .flashcard-term-text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* ---------------------------------------------------------------------
   Flashcard pop-up (2026-09-15, site owner: "when open a flashcard, we
   should make it a full mode via poping it up"). site.js's
   initFlashcardDialog() opens a native <dialog> instead of expanding the
   card inside its grid cell, MOVING the card's own content (definition,
   context, source, edit form) into .flashcard-dialog-body and back on
   close -- one copy of every form/listener, no clones. The body carries
   .flashcard too so every `.flashcard ...` rule above still applies; the
   overrides just below undo that class's grid-cell chrome. Flat: hairline
   border, no shadow -- the dimmed ::backdrop is the only depth. Phones get
   a full-screen sheet. No-JS readers keep the in-place <details> expand.
   --------------------------------------------------------------------- */
.flashcard-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 880px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--paper-raised);
  color: var(--ink);
  overflow: hidden;
}
.flashcard-dialog::backdrop { background: rgba(10, 13, 19, 0.5); }
.flashcard-dialog-inner { display: flex; flex-direction: column; max-height: inherit; }
.flashcard-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 0.5rem;
}
.flashcard-dialog-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem; min-width: 0; }
.flashcard-dialog-heading .flashcard-status { margin-left: 0; }
.flashcard-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.flashcard-dialog-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.flashcard-dialog-close:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.flashcard-dialog-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.flashcard-dialog-body.flashcard {
  overflow-y: auto;
  padding: 0 1.25rem 1.5rem;
  border: 0;
  border-radius: 0;
  background: none;
}
.flashcard-dialog-body .flashcard-back { font-size: 1.1rem; }
.flashcard-dialog-body .flashcard-context { font-size: 0.95rem; }
.flashcard-dialog-edit-toggle {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  cursor: pointer;
}
.flashcard-dialog-edit-toggle:hover { text-decoration: underline; }
.flashcard-dialog-edit-toggle[hidden] { display: none; }
.flashcard-dialog-close:focus-visible,
.flashcard-dialog-edit-toggle:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.flashcard-edit-form[hidden] { display: none; }
@media (max-width: 540px) {
  .flashcard-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .flashcard-dialog-inner { height: 100%; }
}

/* Pulled up to sit directly under the term (2026-09-04, site owner
   feedback: "the audio icon sits in an awkward floating spot directly
   above the part-of-speech tag") -- previously .gloss-pronounce-row sat
   between .flashcard-progress and the definition block, reading as a
   stray element wedged mid-card. Kept as its own row rather than moved
   inside <summary> itself: <summary> is a native disclosure toggle, so
   any click landing inside it -- including on this button -- also
   opens/closes the card, which would make pressing 🔊 while reading
   immediately collapse the card back shut. .gloss-pronounce-row's own
   base rule (shared with the gloss popover / review card, which don't
   carry a .flashcard ancestor) is left alone; this only tightens the
   copy that's actually inside a .flashcard. */
.flashcard .gloss-pronounce-row { margin: 0.3em 0 0.6em; }

.flashcard-back { font-size: 0.98rem; line-height: 1.5; margin: 0.6em 0 0.3em; }
/* The meaning in the learner's own language (2026-11-13), under the English
   definition in the word list and on the review card's answer. */
.flashcard-translation,
.review-translation {
  margin: 0.35em 0 0.6em;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}
.flashcard-translation-setup {
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
/* Clamped to 2 lines (2026-08-29 design-review follow-up) -- a saved
   phrase's full source sentence can run long enough to dominate the grid
   card visually over the actual term (.flashcard summary above), same
   complaint the design review raised. line-clamp is the standard
   property now; -webkit-line-clamp/-webkit-box-orient are still required
   alongside it for the widest current browser support, same three-
   property pattern this technique always needs. */
/* No line-clamp (2026-08-29: the 2-line clamp added earlier the same day
   was removed here, not just [open]-scoped, after it turned out to be
   based on a wrong premise). .flashcard-context lives inside a <details>
   -- native browser behavior renders NONE of a closed <details>'s
   content at all, not just this paragraph, so a "keep the closed grid
   tidy" clamp never actually did that job; a reader only ever sees this
   text after explicitly opening the card, at which point clamping it
   just cuts off the sentence they opened the card to read. */
.flashcard-context {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0.6em 0;
}
/* Highlights the saved term within its own context sentence -- shared by
   the saved-cards grid (.flashcard-context) and the active review card
   (.review-context, populated by site.js's initReviewMode); both feed it
   the same before/<mark>blank</mark>/after split accounts/cloze.py's
   build_cloze_segments already produces for cloze-mode review cards, just
   rendered highlighted instead of blanked. Reuses the same brand-tinted
   background idiom as .listen-active/.site-nav a.active elsewhere in
   this file, not a new visual language; font-style: normal overrides the
   italic context text around it, since an italicized highlight reads
   worse than an upright one against italic surroundings. */
.flashcard-context mark, .review-context mark {
  background: color-mix(in srgb, var(--accent-secondary) 18%, transparent);
  color: inherit;
  font-weight: 600;
  font-style: normal;
  padding: 0 0.1em;
}
.flashcard-source { font-size: 0.78rem; color: var(--ink-faint); margin: 0.3em 0 0.6em; }
.flashcard-source a { color: var(--ink-faint); }

/* Edit form redesign (2026-09-04, "the flashcard design is super ugly"
   follow-up): the form previously ran flush against the quote/source
   above it with no visual break, and Definition/Note/Update all carried
   identical plain-form-field weight, so an open card read as one grey
   wall rather than "reading zone, then editing zone, then one primary
   action." border-top here is the only thing separating the two; the
   rest is spacing, hierarchy and a proper focus state, all built from
   tokens already in use elsewhere in this file (uppercase micro-label
   treatment matches .reading-prefs-group-label; the filled button
   matches .journal-new-link's background/border/hover-opacity pattern)
   rather than inventing new ones. */
.flashcard-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
  margin-top: 0.75em;
  padding-top: 0.75em;
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
}
.flashcard-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
/* Border is transparent at rest, not just softened (2026-09-04, site
   owner: "not much difference. the big ugly input box is still there")
   -- --paper and --paper-raised are the same #ffffff in light mode (see
   :root's own comment), so a resting border was the ONLY thing marking
   this as a box; a permanently visible rectangle around a field that's
   mostly just being read, not typed into, is exactly what read as
   "boxy." Revealing the border on hover, and the full brand ring only
   on focus, keeps the field looking like part of the card until a
   reader actually reaches for it. */
.flashcard-edit-form textarea {
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.15s ease;
}
.flashcard-edit-form textarea:hover { border-color: var(--border); }
/* Focus is a plain brand-color border -- the 3px tinted glow ring was
   removed 2026-09-15 (site owner: "I do not like border shading"). */
.flashcard-edit-form textarea:focus {
  outline: none;
  border-color: var(--accent-secondary);
}
/* Note is the secondary field (private, optional) -- smaller and softer
   than Definition so the two don't compete for attention. */
.flashcard-edit-form textarea.flashcard-note-input {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
/* "+ Add note" disclosure (2026-09-15, "the note box shall be closed as
   default"). Overrides the card-level `.flashcard summary` rule (display
   font, 1rem bold) that would otherwise apply to this nested summary too,
   and styles it as a small text link. Once open, the summary hides and
   the labelled field takes its place. */
.flashcard .flashcard-note-details > summary.flashcard-note-toggle {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  cursor: pointer;
  list-style: none;
}
.flashcard .flashcard-note-toggle::-webkit-details-marker { display: none; }
.flashcard .flashcard-note-toggle:hover { text-decoration: underline; }
.flashcard .flashcard-note-toggle:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.flashcard .flashcard-note-details[open] > summary.flashcard-note-toggle { display: none; }
.flashcard-edit-form button {
  align-self: flex-start;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line-brand);
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.flashcard-edit-form button:hover { opacity: 0.85; }
.flashcard-edit-form button:disabled { opacity: 0.6; cursor: progress; }
.flashcard-edit-actions { display: flex; align-items: center; gap: 0.75rem; }
.flashcard-edit-status { font-size: 0.85rem; font-weight: 600; color: var(--ink-faint); }

/* Delete as an icon on the card's top-right corner (2026-09-05, site
   owner: "make the delete flashcard link an icon on the flashcard, right
   side of the word"), replacing the old plain-text "Delete flashcard"
   link that only lived at the bottom of an already-opened card -- this
   is reachable straight from the closed grid now. Its <form> sits outside
   <details> in the template (see that file's own comment); position here
   is relative to .flashcard-item, offset by .flashcard's own padding
   tokens so it lands flush with where the card's padding box would put
   it, top-right, roughly level with the term in <summary>. */
.flashcard-delete-form {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  margin: 0;
}
.flashcard-delete-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
/* Same faint-by-default, danger-red-on-hover language as
   .saved-collection-delete/.highlight-view-delete -- a filled hover
   background is new here (those two are plain text with nothing to
   contain), needed so a 15px icon still reads as an obvious hit target. */
.flashcard-delete-icon:hover {
  color: var(--line-news-ink);
  background: color-mix(in srgb, var(--line-news-ink) 10%, transparent);
}
.flashcard-delete-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* font-family explicit, not just "font: inherit" (2026-09-05, design
   feedback: this button "uses small-caps/serif styling that doesn't
   quite match the clean sans-serif nav") -- body's own default font IS
   serif site-wide (editorial reading copy), and every other button on
   this page correctly overrides to sans for its own UI-chrome text
   (.flashcard-edit-form sets it once for its whole form, including its
   own "font: inherit" button) -- this one was a plain oversight, not a
   deliberate serif choice, since it and .flashcard-add-word-form had
   nothing declaring it and so fell all the way through to body's serif. */
.flashcard-add-word-btn {
  align-self: flex-start;
  font: inherit;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  margin: 0.5em 0 1em;
  border: 1px solid var(--line-brand);
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.study-toolbar .flashcard-add-word-btn { margin: 0; }
/* Empty Library: the "start here" card already offers "Add a word
   manually" (it forwards its click to this button), so the standalone
   button stays in the DOM but out of sight until the empty state is
   removed by the first added card. */
.study-empty-state + .flashcard-add-word-btn { display: none; }
.flashcard-add-word-btn:hover { opacity: 0.85; }

/* 2026-09-13 design review, "the inline 'Add a word' form... feels too
   wide for one input. A compact modal or small inline pill-form would
   look more polished" -- study.html's own comment on this form covers
   why a pill, not a modal. The bordered/radius/background that used to
   sit on .flashcard-add-word-form itself (a padded card around a
   labeled input) moved onto the new .flashcard-add-word-fields wrapper
   below, sized to content (max-width) rather than stretching full-
   width like the old card did. */
.flashcard-add-word-form {
  display: block;
  margin: 0 0 1.5em;
  font-family: var(--font-body);
}
/* The UA's built-in `[hidden] { display: none }` loses to ANY author-origin
   `display` rule regardless of specificity -- same established pattern as
   .rss-feed-card-rename-form[hidden]/.back-to-top[hidden] elsewhere here. */
.flashcard-add-word-form[hidden] { display: none; }
.flashcard-add-word-fields {
  display: flex;
  align-items: stretch;
  max-width: 22rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper-raised);
  overflow: hidden;
}
.flashcard-add-word-fields:focus-within {
  border-color: var(--accent-secondary);
  box-shadow: none;
}
.flashcard-add-word-form input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  color: var(--ink);
}
.flashcard-add-word-form input:focus { outline: none; }
.flashcard-add-word-form button[type="submit"] {
  flex: none;
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border: none;
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.flashcard-add-word-status {
  margin: 0.4em 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.flashcard-source-manual { color: var(--ink-faint); }

/* ---------------------------------------------------------------------
   Study page Review/Library tabs (2026-09-12 learner-UX review) -- same
   underline-tab visual language as .site-nav a/.site-nav a.active
   (header nav) above, reused here rather than inventing a second tab
   idiom for one page.
   --------------------------------------------------------------------- */
.study-tabs {
  display: flex;
  gap: 1em;
  border-bottom: 1px solid var(--border);
  margin: 0 0 var(--space-2);
}
.study-tab {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5em 0.2em;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.study-tab:hover { color: var(--accent-secondary-ink); }
.study-tab.active { color: var(--ink); border-color: var(--accent-warm); }
.study-panel[hidden] { display: none; }

/* ---------------------------------------------------------------------
   Review mode -- SM-2 spaced-repetition grading on /study/ (2026-08-25
   design: English-learning pivot). Front/context/flip/back/grades are all
   rendered by site.js's initReviewMode into #review-card -- see that
   function's own comment block for the exact markup. Styled as one card
   in the same raised-paper, brand-left-border language as .flashcard just
   above, reusing the same tokens (design review, 2026-08-25, finding I4 --
   this UI shipped with no CSS at all), rather than introducing a new look.
   --------------------------------------------------------------------- */
.study-review-mode { margin-bottom: var(--space-4); }
/* Restyled 2026-09-15 (site owner: "I do not like the shading of the
   card... make the style more professional, modern, energetic"). Flat:
   no brand left-border stripe, no drop shadow -- a hairline border on
   raised paper, and no tinted fills anywhere on it (site owner, same
   day: "I do not like shading"). The energy comes from a larger headword,
   a full-width reveal button and color-coded grade buttons. (The queue
   progress bar that ran along the top edge was removed 2026-09-18 --
   site owner: "I said no border shading!" -- the heading's own "card X
   of Y" counter already says the same thing.) */
#review-card {
  position: relative;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem 1.75rem 1.5rem;
  max-width: 42rem;
  /* 2026-09-12 learner-UX review, "a compact, centered card" -- Review
     now has the panel to itself (the Library grid is a separate tab,
     see .study-tabs above), so there's no longer a reason for this
     card to hug the left edge the way it did sharing a column with
     .flashcard-grid's own left-aligned cards. */
  margin: 0 auto;
}
@media (max-width: 480px) {
  #review-card { padding: 1.4rem 1.1rem 1.2rem; border-radius: 14px; }
}
#review-card > .flashcard-status { margin-left: 0; margin-bottom: 0.6rem; }
.review-front {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  /* 2026-09-18, site owner: "why the button is so big and close to the
     word??" -- the speak button sat 0.6rem from a word set as large as
     2.4rem, so the two read as one crowded unit. */
  gap: 0.9rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.review-front-cloze {
  display: block;
  margin-bottom: 1.4rem;
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.55rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.review-front-cloze .review-blank {
  min-width: 4em;
  line-height: 1.1;
  vertical-align: baseline;
}
.review-speak {
  position: relative; /* anchors the ::after hit-area extension below */
  display: inline-grid;
  place-items: center;
  flex: none;
  /* Smaller than the word it sits beside rather than nearly its equal
     (2026-09-18) -- it's a secondary control. The visible circle shrinks;
     the ::after below keeps the tappable area at ~44px, the same
     hit-area-extension trick .journal-entry-edit-btn uses. */
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-secondary-ink);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.review-speak::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
.review-speak svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.review-speak:hover { border-color: var(--accent-secondary); }
/* Cloze cards keep the shared renderer's pronounce button on the answer
   side (see the :has() rule further down) -- drawn as the same flat
   outline icon as .review-speak instead of the 🔊 emoji in a filled
   circle. The emoji text is hidden (font-size: 0) and replaced by a
   masked speaker glyph in currentColor. */
#review-card .review-back .gloss-pronounce,
.flashcard-dialog .gloss-pronounce {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--accent-secondary-ink);
}
#review-card .review-back .gloss-pronounce::before,
.flashcard-dialog .gloss-pronounce::before {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5.5v13l-4.5-4H4z'/%3E%3Cpath d='M15.5 9a4 4 0 0 1 0 6'/%3E%3Cpath d='M18 6.5a7.5 7.5 0 0 1 0 11'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5.5v13l-4.5-4H4z'/%3E%3Cpath d='M15.5 9a4 4 0 0 1 0 6'/%3E%3Cpath d='M18 6.5a7.5 7.5 0 0 1 0 11'/%3E%3C/svg%3E") center / contain no-repeat;
}
#review-card .review-back .gloss-pronounce:hover,
.flashcard-dialog .gloss-pronounce:hover {
  border-color: var(--accent-secondary);
  background: transparent;
}
.review-speak:focus-visible,
.review-flip:focus-visible,
.review-grades button:focus-visible {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}
.review-context {
  margin: 0.9rem 0 1.4rem;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
/* Overrides the shared grey-tint .flashcard-context/.review-context mark
   rule for the review card only: a solid brand-color underline, no
   tinted fill. */
.review-context mark {
  background: none;
  color: var(--ink);
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--accent-secondary);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
.review-flip {
  display: block;
  width: 100%;
  /* Clear of the word above it (2026-09-18): with no margin the primary
     action butted straight up against the prompt. */
  margin-top: 1.4rem;
  min-height: 3rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75em 1em;
  border: none;
  border-radius: 12px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
  transition: filter 0.15s ease;
}
.review-flip:hover { filter: brightness(1.12); }
.review-flip[hidden] { display: none; }
.review-back {
  margin-top: 0.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.55;
}
.review-back:not([hidden]) { animation: review-reveal 0.22s ease-out; }
/* The shared definition renderer adds its own pronounce button; on a
   meaning-direction card that duplicates .review-speak next to the word
   (a cloze card has no .review-speak, so its answer keeps the button).
   IPA, when present, stays. */
.review-front:has(.review-speak) ~ .review-back .gloss-pronounce { display: none; }
.review-front:has(.review-speak) ~ .review-back .gloss-pronounce-row:not(:has(.gloss-ipa)) { display: none; }
@keyframes review-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .review-back:not([hidden]) { animation: none; }
}
.review-grades {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.25rem;
}
@media (max-width: 480px) {
  .review-grades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.review-grades[hidden] { display: none; }
/* Grade buttons are the core interaction of Review mode -- obviously
   clickable, equal-width, each labelled in its own grade color (Again
   red, Hard amber, Good green, Easy blue) with the next interval below.
   Color is never the only signal: the label text says the grade. */
.review-grades button {
  --grade: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3.5rem;
  font: inherit;
  padding: 0.55em 0.5em;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--grade);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.review-grades button[data-grade="again"] { --grade: var(--line-news-ink); }
.review-grades button[data-grade="hard"]  { --grade: var(--line-history-ink); }
.review-grades button[data-grade="good"]  { --grade: var(--line-economics-ink); }
.review-grades button[data-grade="easy"]  { --grade: var(--accent-secondary-ink); }
.review-grades button:hover { border-color: var(--grade); }
.review-grade-label { font-size: 0.95rem; font-weight: 700; }
.review-grade-interval { font-size: 0.75rem; font-weight: 500; color: var(--ink-faint); }
/* 2026-09-12 learner-UX review, Finding 4 -- see site.js's own comment
   at gradesHint's creation for why this exists. Same [hidden] fix as
   .review-grades[hidden] just above (this file's own established
   pattern -- an author display rule always beats the UA's [hidden]
   default regardless of specificity). */
.review-grades-hint { margin: 0.75rem 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--ink-faint); }
.review-grades-hint[hidden] { display: none; }
.review-error { margin-top: 0.6em; font-size: 0.88rem; color: var(--line-news-ink); }
.review-blank {
  display: inline-block;
  min-width: 3em;
  border-bottom: 2px solid var(--accent-secondary);
  color: transparent;
}
.review-blank.is-revealed { color: inherit; }

/* ---------------------------------------------------------------------
   Dashboard (2026-09-12 learner-UX review, "connect existing learning
   activities") -- three big tappable tiles, flat/bordered/sharp-corner
   like every other card on this site (--radius: 0 sitewide), not a new
   visual language.
   --------------------------------------------------------------------- */
.dashboard-page { max-width: 640px; }
.dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.dashboard-action {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  background: var(--paper-raised);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dashboard-action:hover { border-color: var(--accent-secondary); box-shadow: var(--shadow-card); }
.dashboard-action-icon { font-size: 1.6rem; flex-shrink: 0; }
.dashboard-action-text { display: flex; flex-direction: column; gap: 0.15em; }
.dashboard-action-label { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.dashboard-action-sub { font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-soft); }
.dashboard-more-links { display: flex; gap: var(--space-3); font-family: var(--font-body); font-size: 0.88rem; }

/* 2026-09-12 learner-UX review -- see study.html's own comment on why
   this exists (capped intro width + real shortcut cards, once removing
   the category nav above exposed how thin a full-bleed short intro
   looked). .dashboard-action itself needs no override -- reused
   exactly as accounts:dashboard already styles it; only the two-up
   flex row around it is new. */
/* 2026-09-15 compact pass (site owner: "make /accounts/study/ more
   compact, concise"): the intro is one row -- "Study" plus two plain text
   links -- instead of title, dek sentence and a full-width shortcut card.
   Replaces the old .study-shortcuts/.study-secondary-links blocks. */
.study-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem var(--space-3);
  margin: 0 0 var(--space-2);
}
.study-intro h1 { margin: 0; font-size: 1.75rem; }
/* Study hub (2026-10-03 UI review: Study should be an overview, not the
   flashcard deck). A card per study tool, two-up on wider screens, each
   a whole-card link with a name and one line of status. */
.study-hub-page { max-width: 860px; }
.study-tools { margin: 0 0 var(--space-4); }
.study-tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
@media (min-width: 640px) { .study-tool-grid { grid-template-columns: repeat(2, 1fr); } }
.study-tool-grid > li { display: flex; }
.study-tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 6.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--font-body);
  text-decoration: none;
}
.study-tool:hover { border-color: var(--line-brand-ink); }
.study-tool:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.study-tool-name { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.study-tool-name::after { content: "→"; font-family: var(--font-body); font-weight: 600; color: var(--ink-faint); }
.study-tool:hover .study-tool-name::after { color: var(--line-brand-ink); }
.study-tool-status { font-size: 0.92rem; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.study-tool-meta { margin-top: auto; font-size: 0.82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.study-tool-extra { margin: var(--space-2) 0 0; font-size: 0.9rem; }
.study-library h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.15rem; }
.study-library-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.study-library-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-height: 44px;
  padding: 0 0.9em;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.study-library-links a:hover { border-color: var(--line-brand-ink); }
.study-library-links a:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.study-library-count { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
/* Words page header: back link, title, crossword link. */
.study-words-back { margin: var(--space-2) 0 0; font-size: 0.9rem; }
.study-words-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem var(--space-3); margin: 0 0 var(--space-2); }
.study-words-title-row h1 { margin: 0; font-size: 1.75rem; }
.study-words-crossword { font-size: 0.9rem; }
/* Word stats row (2026-09-16): Total / Learning / Learned as three equal
   flat cards -- hairline border on raised paper, no shadow, stripe or
   tinted fill; only the number carries color (Learning brand blue,
   Learned economics green, both the AA-safe -ink tokens so dark mode
   follows for free). Stays three across on phones by shrinking padding
   and number size; minmax(0, 1fr) lets a long label wrap, not overflow. */
.study-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}
.study-stat {
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.study-stat dt {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.study-stat dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.study-stat dd.study-stat-learning { color: var(--accent-warm-ink); }
.study-stat dd.study-stat-learned { color: var(--line-economics-ink); }
@media (max-width: 480px) {
  .study-stats { gap: 0.5rem; }
  .study-stat { padding: 0.6rem 0.7rem; }
  .study-stat dt { font-size: 0.64rem; letter-spacing: 0.04em; }
  .study-stat dd { font-size: 1.5rem; }
}
/* Headings/captions that stay in the document for screen readers but
   repeat what's already visible (tab counts, select placeholders). */
/* 2026-09-20: .visually-hidden added alongside the study-specific
   name this rule already had, so anything on the site can use it
   without inheriting a misleading class name. */
.study-visually-hidden,
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 2026-09-13 design review, "the empty state feels too plain... show a
   small 'Start here' card with 3 actions." .study-empty-state is now a
   container (desc line + the card), not a bare paragraph -- kept the
   same class name study.html's own comment explains site.js's existing
   `.remove()` call still needs. Centered/muted like this site's other
   empty states (.journal-empty-state and friends), the "Start here"
   card is a plain small bordered box, not full .dashboard-action-sized
   items -- the design ask's own word was "small". */
.study-empty-state {
  text-align: center;
  padding: var(--space-4) var(--space-3);
}
.study-empty-state-desc {
  margin: 0 0 var(--space-3);
  font-family: var(--font-body);
  color: var(--ink-faint);
}
.study-start-here {
  display: flex;
  flex-direction: column;
  max-width: 320px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  overflow: hidden;
  text-align: left;
}
.study-start-here-action {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.75em 1em;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.study-start-here-action:last-child { border-bottom: none; }
.study-start-here-action:hover { background: var(--paper); }
.study-start-here-icon { font-size: 1.15rem; flex-shrink: 0; }

.review-undo-bar {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.8em;
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-raised);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.review-undo-bar button {
  font: inherit;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
/* Loosened 2026-09-04 (site owner feedback on the deployed redesign:
   "increasing line height slightly and adding whitespace between
   sections... would make it far easier to scan") -- .gloss-detail's own
   margin: 0 collapses these to a dense stack by default; the more
   specific selectors here are what actually control spacing (see
   .gloss-detail's own comment). */
.flashcard-back-structured p { margin: 0 0 0.55em; line-height: 1.5; }
/* One scheme for a word's answer on the review card and in the word list
   (2026-11-14 spacing survey): the meaning and its translation read as one
   unit; the collocation and the example form a separate group below,
   each on its own line. The review card used to give the meaning the
   browser's 1em margins and the two detail lines none at all. */
:is(.review-back, .flashcard-back-structured) .gloss-pos { margin: 0 0 0.4em; }
:is(.review-back, .flashcard-back-structured) .gloss-meaning { margin: 0; }
:is(.review-back, .flashcard-back-structured) :is(.review-translation, .flashcard-translation) { margin: 0.25rem 0 0; }
:is(.review-back, .flashcard-back-structured) .gloss-detail { margin: 0.9rem 0 0; }
:is(.review-back, .flashcard-back-structured) .gloss-detail + .gloss-detail { margin-top: 0.35rem; }

/* ---------------------------------------------------------------------
   Journal -- two-pane list+detail layout (site owner, 2026-08-22,
   referencing Day One's own UI -- functional layout only: Biblinkage' own
   red/serif branding stays, no Tailwind/React rebuild, no copied brand
   assets). .journal-list-pane is the entry list (grouped by month, each
   row a two-column day-block + content structure); .journal-detail-pane
   holds the active entry's editor -- writing surface only, no date/tags/
   Save button (those live, and are edited, on the list row instead --
   see .journal-inline-edit below and static/js/site.js's
   initJournalInlineEdit/initJournalAutosave). Single column below the
   breakpoint -- selecting an entry is a real page navigation
   (accounts:journal_detail), so the list and detail panes are genuinely
   two different page states there; .journal-back-link is the way back.
   --------------------------------------------------------------------- */
.journal-layout {
  display: grid;
  /* minmax(0, 1fr): without an explicit column track, a CSS Grid item's
     default min-width is auto -- its own max-content (intrinsic) size,
     not 0 -- so below the 800px breakpoint, where the single visible
     pane had no grid-template-columns to override this at all, a long
     enough entry could size .journal-detail-pane to its own content's
     full width and force the whole page into horizontal scroll,
     completely ignoring how narrow the real viewport was (autonomous
     audit, 2026-09-05, goal doc section I -- confirmed live: a
     390px-viewport page measured 1814px wide with a long-tagged,
     long-worded entry open, .journal-detail-pane itself computing
     1801px). Same underlying gotcha as the flexbox min-width:auto fixes
     elsewhere in this file, one layout model up. The minmax(0, ...) 1fr
     track this sets is overridden below by the 800px+ media query's own
     two-column template either way -- this base rule only ever matters
     below that breakpoint, where it's exactly the single-column
     equivalent of the same fix. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  /* Rounded hairline card, no shadow (2026-09-18, site owner: no
     shading). No `overflow: hidden` here on purpose: it would
     turn this grid into a scroll container and break .journal-list-
     pane's position:sticky below. The panes carry the paper background
     right up to this rounded border, so the un-clipped inner corners
     don't read as pokes at a 14px radius. */
  border: 1px solid var(--border);
  border-radius: 14px;
}
@media (min-width: 800px) {
  /* 23rem across every view mode (site owner, 2026-09-05: Timeline "is
     too narrow and not showing the content properly" -- with the old
     17rem, the date column + thumbnail left barely ~100px for an
     entry's actual title/preview text, so anything but a short title
     wrapped across many cramped lines). This used to be Calendar-only
     (2026-09-03, same complaint, same fix) with List/Media deliberately
     left at the narrower 2026-08-22 "wider editor" width of 17rem --
     that split is gone now that List hits the identical problem;
     data-view-mode no longer needs to appear in this selector at all.

     2026-09-12 learner-UX review: this used to narrow BACK to 17rem
     once data-compose-active appeared (an entry open), on the theory
     that the editor should get the wider share while writing/reading.
     Dropped -- a reader opening an entry watched every title in the
     list they'd just been browsing visibly rewrap as the column
     narrowed under them, and 17rem-while-browsing is the exact "not
     showing the content properly" regression the two site-owner passes
     above already fixed once; reopening it just because an entry is
     open would be the same bug back on a timer. 23rem now applies in
     both states -- the editor pane gives up a little width instead. */
  .journal-layout { grid-template-columns: 23rem minmax(0, 1fr); }
  /* Keyboard-audit fix (2026-09-06): .journal-detail-pane now comes
     BEFORE .journal-list-pane in the markup (see journal.html et al's
     own comment) so a keyboard user reaches the open entry's own
     controls right after the page header, instead of tabbing through
     every month group/entry/tag in a reader's whole (unbounded) journal
     first. Grid auto-placement would otherwise put the now-first
     detail-pane in the narrow left column, so both panes get pinned to
     an explicit column here to keep the visual "list on the left,
     detail on the right" layout exactly as before -- source order
     changed, visual order didn't.

     2026-09-07 correction (site-owner-reported: sidebar rendering below
     the content pane instead of beside it, root-caused by inspecting
     the live computed layout): pinning grid-column alone was NOT
     enough. With grid-row left implicit on both, CSS Grid's SPARSE
     auto-placement algorithm (the default -- this rule never set
     grid-auto-flow: dense) walks the DOM in source order and never
     moves its placement cursor backward. detail-pane (now first in the
     DOM) gets auto-placed into row 1 (the first free cell in its
     pinned column 2) -- then when list-pane is placed next, the cursor
     has already advanced past row 1 and won't backtrack to fill the
     still-empty row 1/column 1 cell, so it drops list-pane into row 2
     instead, underneath detail-pane, exactly matching the report.
     Pinning grid-row: 1 on both removes the ambiguity the same way
     grid-column already does -- neither pane's position depends on DOM
     order, or on auto-placement's cursor behavior, at all anymore. */
  .journal-list-pane {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: var(--header-height, 112px);
    max-height: calc(100vh - var(--header-height, 112px));
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }
  .journal-detail-pane { grid-column: 2; grid-row: 1; }
  /* .journal-calendar-nav/-weekdays/-month's own desktop overrides live
     down with their base rules in the Calendar section below, NOT here
     -- see that section's own comment for why (2026-09-03 root cause:
     they used to live in this block, and silently lost every cascade
     tie to the base rules defined later in the file, since a later
     media query block that's a source further down always wins an
     equal-specificity tie regardless of the earlier one's own
     @media condition). */
}

/* 2026-09-06 (later same day): the full-workspace Calendar/Media
   redesign that used to live in this exact spot (grid-template-columns
   override + off-canvas drawer + backdrop) was reverted at the site
   owner's own request -- "I prefer the old style... make sure the
   timeline, calendar, media left side panel has the same width."
   Timeline/Calendar/Media all share the plain .journal-layout two-pane
   grid above again, unconditionally -- no data-view-mode-specific
   override left here at all, which is what actually guarantees the
   requested "same width" (a per-mode override is exactly what broke
   that guarantee the first time). See git history (the redesign commit
   and this revert) for the full before/after reasoning if this is ever
   revisited.
   --------------------------------------------------------------------- */

/* 2026-09-06 (later same day): the Journal-only wide-screen override
   that used to live in this exact spot (widening .site-main/.site-
   header/.site-footer to 1360px at 1400px+ viewports, scoped via
   body[data-active-pillar="journal"]) was removed at the site owner's
   own request -- "why the journal page seems wider than other pages??
   make the format consistent!" Journal pages now use the same sitewide
   var(--max-width) (1080px) every other page does, at every viewport
   width, with no per-pillar exception. This is the same "consistency
   over a bespoke fix" preference already applied to the Calendar/Media
   layout revert just above -- see that block's own comment and git
   history for the original fix's reasoning if this is ever revisited. */

.journal-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-2);
}
.journal-list-header h1 { margin: 0; font-size: 1.3rem; }
/* Journal switcher (2026-09-15, multiple journals): the title is a button
   showing the current journal's name; its menu lists every journal plus
   "Manage journals" (a flat <dialog>). Flat surfaces, no shadows. */
.journal-switcher { position: relative; flex: 1 1 auto; min-width: 0; }
.journal-list-header h1.journal-switcher-title { min-width: 0; }
.journal-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  margin: 0 0 0 -0.4rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.journal-switcher-btn:hover,
.journal-switcher-btn[aria-expanded="true"] { border-color: var(--border); }
.journal-switcher-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.journal-switcher-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.journal-switcher-chevron { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.journal-switcher-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: -0.4rem;
  z-index: 30;
  min-width: 14rem;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper);
  font-family: var(--font-body);
}
.journal-switcher-panel[hidden] { display: none; }
.journal-switcher-panel form { margin: 0; }
.journal-switcher-panel-label { margin: 0.25rem 0.6rem 0.3rem; font-size: 0.75rem; font-weight: 700; color: var(--ink-faint); }
.journal-switcher-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.journal-switcher-item:hover { background: var(--paper-raised); color: var(--accent-secondary-ink); }
.journal-switcher-item.is-active { font-weight: 700; }
.journal-switcher-item-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.journal-switcher-check { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--accent-secondary-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.journal-switcher-divider { height: 1px; margin: 0.3rem 0.2rem; background: var(--border); }
.journal-switcher-manage { color: var(--ink-soft); }
.journal-switcher-manage .journal-icon { width: 16px; height: 16px; }

.journal-manage-dialog {
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--font-body);
}
.journal-manage-dialog::backdrop { background: rgba(10, 13, 19, 0.5); }
.journal-manage-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.journal-manage-head h2 { margin: 0; font-size: 1.25rem; }
.journal-manage-close {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--ink-soft); cursor: pointer;
}
.journal-manage-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.journal-manage-plan { margin: 0.35rem 0 1rem; font-size: 0.85rem; color: var(--ink-soft); }
.journal-manage-plan a, .journal-manage-limit a { color: var(--accent-secondary-ink); font-weight: 600; }
.journal-manage-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.journal-manage-row { padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.journal-manage-row-main { display: flex; align-items: center; gap: 0.6rem; }
.journal-manage-row-main[hidden] { display: none; }
.journal-manage-row-name { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.journal-manage-row-current { flex: none; font-size: 0.75rem; font-weight: 700; color: var(--accent-secondary-ink); }
.journal-manage-row-actions { display: flex; gap: 0.25rem; margin-left: auto; flex: none; }
.journal-manage-link {
  padding: 0.3rem 0.55rem; border: 0; border-radius: 999px; background: none;
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--accent-secondary-ink); cursor: pointer;
}
.journal-manage-link:hover { text-decoration: underline; }
.journal-manage-link-danger { color: var(--line-news-ink); }
.journal-manage-form, .journal-manage-create { display: flex; gap: 0.5rem; align-items: center; }
.journal-manage-form[hidden], .journal-manage-delete[hidden] { display: none; }
.journal-manage-create { margin-top: 1rem; }
.journal-manage-form input[type="text"], .journal-manage-create input[type="text"], .journal-manage-delete input[type="text"] {
  flex: 1; min-width: 0; padding: 0.5rem 0.75rem; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 0.92rem;
}
.journal-manage-primary, .journal-manage-danger {
  flex: none; padding: 0.5rem 1rem; border: 0; border-radius: 999px; font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer;
}
.journal-manage-primary { background: var(--line-brand); color: var(--line-brand-on); }
.journal-manage-danger { background: var(--line-news-ink); color: #fff; }
.journal-manage-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.journal-manage-delete { display: flex; flex-direction: column; gap: 0.6rem; }
.journal-manage-delete-warning { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft); }
.journal-manage-delete-label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--ink-soft); }
.journal-manage-delete-label > span { display: block; }
.journal-manage-delete-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.journal-manage-limit { margin: 1rem 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.journal-subpage-title { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.journal-subpage-title h1 { margin: 0; }
.journal-subpage-journal { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.journal-new-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--line-brand-on);
  text-decoration: none;
  background: var(--line-brand);
  border: 1px solid var(--line-brand);
}
.journal-new-link:hover { opacity: 0.85; }

/* Floating "+" action button (2026-09-01, site owner-supplied Day One
   screenshots) -- below the single-column breakpoint (the same one
   .journal-back-link already treats as "this is the app-like, one-
   screen-at-a-time state," not the two-pane desktop layout), the small
   in-header square above turns into a Day One-style circular FAB
   instead: fixed bottom-right, above the content, on every List/
   Calendar/Media view alike (_journal_list_header.html is shared by all
   three). This is a deliberate, scoped exception to this feature's own
   "functional layout only, no copied Day One chrome" rule above --
   999px pill/circle radii already exist elsewhere on this site (chips,
   avatars, .back-to-top), so borrowing the FAB *shape* language, in the
   site's own red/serif colors rather than Day One's, doesn't actually
   introduce a foreign idiom. position: fixed pulls it out of
   .journal-list-header's flex row entirely, so no separate "hide the
   inline one" rule is needed here. */
@media (max-width: 799px) {
  .journal-new-link {
    position: fixed;
    right: var(--space-3);
    /* env(safe-area-inset-bottom) (2026-09-03, site owner: "account for
       the device safe area") is 0 on devices without a home-indicator
       gesture bar, so this is a no-op there -- additive, not a
       behavior change for those. */
    bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 999px;
    box-shadow: var(--shadow-card-hover);
  }
  .journal-new-link .journal-icon { width: 26px; height: 26px; stroke-width: 1.9; }
  /* The FAB above sits fixed over the page's own content -- without
     this, its last row can cover a real entry in the selected-day list
     (2026-09-03, site owner: the FAB "overlaps the selected-day list").
     3.5rem (FAB height) + var(--space-3) (its own bottom offset) +
     var(--space-3) again (breathing room above the FAB, not flush
     against it) + the same safe-area term as the FAB's own bottom,
     above, so this scales with it on devices that have one. */
  .journal-calendar-selected-list,
  .journal-calendar-selected-empty {
    padding-bottom: calc(3.5rem + var(--space-3) + var(--space-3) + env(safe-area-inset-bottom, 0px));
  }
  /* The padding-bottom above only helps once actually scrolled to the
     list's own end -- the FAB is fixed to the viewport, not the
     document, so it can still float directly over a short entries list
     that never needs scrolling at all (2026-09-03, third design-review
     round, site owner: the FAB "can obscure controls in the currently
     visible entry"). Hiding it outright while the multi-entry chooser
     is showing (data-showing-entry-chooser, set in
     journal_calendar.html) is simpler and more robust than trying to
     compute whether it happens to overlap in each specific case --
     matches how a single-entry date already hides the FAB along with
     the rest of .journal-list-pane (data-compose-active) once it
     auto-opens; this closes the one case that pattern doesn't cover. */
  .journal-layout[data-showing-entry-chooser] .journal-new-link { display: none; }
}

.journal-dek { padding: 0 var(--space-3) var(--space-2); margin: 0; }

/* "Soft card" pass (2026-09-02, site owner: the journal still doesn't
   read as polished as its own Day One reference, "especially
   aesthetically") -- this app's site-wide --radius is 0 by deliberate
   flat/sharp-cornered "broadsheet" brand choice (see .journal-layout's
   own comment above), and the journal feature already carries a couple
   of narrow, explicit exceptions to that (the FAB, the media pills,
   both 2026-09-01). This extends the same kind of exception across the
   feature's own tile/card/input surfaces -- the view toggle below,
   .journal-search-input, .journal-attachment-add,
   .journal-list-item-thumb, .journal-media-item, the editor box, and
   .journal-context-menu all pick up a soft radius (and, where they
   were flat-bordered rather than boxed, a card shadow) instead of the
   sitewide sharp/flat look. Nothing outside .journal-* changes --
   flashcards, review cards, and the rest of the site keep their own
   established look untouched. */
/* Compact actions group on the header's title row -- More + New entry
   (2026-09-03 header restructure). */
.journal-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

/* Full-width segmented Timeline/Calendar/Media control on its own row
   beneath the title (2026-09-03, site owner guidance). Text labels
   rather than the old cramped icon toggle, and the whole thing spans
   the pane so it reads as a clear three-way switch -- no more overflow
   shearing the header's "+" into a red sliver at the pane edge. */
.journal-view-toggle {
  display: flex;
  gap: 0.15em;
  margin: 0 var(--space-3) var(--space-2);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.2em;
}
.journal-view-toggle-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4em 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--ink-faint);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 7px;
}
.journal-view-toggle-btn:hover { color: var(--ink); }
.journal-view-toggle-btn.active { background: var(--paper-raised); border-color: var(--border-strong); color: var(--ink); box-shadow: var(--shadow-card); }
/* ~33px tall measured live on phones (2026-09-04 UI smoke test) -- short
   of the ~44px touch-target baseline. Mobile-only, same convention as
   .journal-calendar-day/.journal-calendar-nav-btn's own touch-target
   overrides further down this file: unlike the icon-only buttons above,
   these are full-width text-label tabs with nothing tightly adjacent
   above or below, so simply growing the box (rather than an invisible
   ::after hit-slop) is the simpler fix and costs nothing visually --
   desktop's more compact mouse-sized rows are untouched. */
@media (max-width: 799px) {
  .journal-view-toggle-btn { min-height: 44px; }
}

/* Over-quota grace-period warning (2026-09-06, site owner) -- same
   left-border-strip/tinted-background idiom as .account-error, since
   this is the same kind of thing: a warning about an account-level
   consequence, not a form validation error, but visually in the same
   family. Shown in _journal_list_header.html, so it appears identically
   across Timeline/Calendar/Media -- wherever a reader with over-quota
   media actually is when they'd want to see it. */
.journal-over-quota-banner {
  margin: 0 var(--space-3) var(--space-3);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line-news);
  background: var(--paper-raised);
}
.journal-over-quota-banner p { margin: 0; font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-soft); }
.journal-over-quota-banner a { color: var(--accent-secondary-ink); font-weight: 600; }

/* Shared icon sizing/stroke for every journal SVG icon (2026-09-02,
   site owner: "replace every emoji with one consistent SVG icon set")
   -- same convention templates/base.html's own .app-bottom-nav-icon
   already uses (stroke="currentColor", no fill), so these read as one
   icon language with the rest of the app instead of a second, colorful
   emoji one competing with it. */
.journal-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Stats + Trash consolidated into one "More" overflow menu (2026-09-02,
   site owner: "move Stats and Trash into the overflow... menu" -- two
   standalone icon buttons for two low-frequency destinations was more
   header clutter than either earns). Positioned/toggled exactly like
   .rss-feed-card-menu-btn/-panel elsewhere in this file (click opens,
   click outside closes -- static/js/site.js's initJournalMoreMenu());
   .journal-more-menu-panel reuses that same dropdown shape, just with
   this pass's own rounded-corner treatment. */
.journal-more-menu { position: relative; }
.journal-more-menu-btn {
  position: relative; /* anchors the ::after hit-area extension below */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 7px;
  flex: none;
  font: inherit;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
}
.journal-more-menu-btn:hover, .journal-more-menu-btn[aria-expanded="true"] { border-color: var(--border-strong); color: var(--ink); }
/* 1.9rem (~30.4px) measured well under the ~44px touch-target baseline
   (2026-09-04 UI smoke test) -- an invisible ::after enlarges the tappable
   area without growing the visible button, same technique as
   .lookup-hint-dismiss above. Safe here too: .journal-new-link, this
   button's only .journal-header-actions sibling, becomes a fixed-position
   FAB below the 799px breakpoint (this file's own .journal-new-link
   mobile rule) and so isn't a flex neighbor to bump into any more by the
   time touch targets actually matter. */
.journal-more-menu-btn::after {
  content: "";
  position: absolute;
  inset: -7px;
}
.journal-more-menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  margin-top: 0.3em;
  min-width: 9rem;
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-card-hover);
  padding: 0.3em;
}
.journal-more-menu-panel[hidden] { display: none; } /* see .rss-feed-card-menu-panel[hidden]'s own comment on why this override is needed */
.journal-more-menu-panel a {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.5em 0.6em;
  border-radius: 7px;
}
.journal-more-menu-panel a:hover { background: var(--paper); color: var(--accent-secondary-ink); }
.journal-more-menu-panel .journal-icon { color: var(--ink-faint); flex: none; }

/* Calendar (_journal_calendar_grid.html) -- rebuilt 2026-09-01 into a
   continuous multi-month scroll (accounts/views.py::journal_calendar's
   own docstring has the "why": the site owner's actual Day One
   screenshots show one uninterrupted scroll). One sticky Sun-first
   weekday header for the whole page -- var(--header-height, 112px) is
   the same value .journal-list-pane's own sticky offset already uses,
   so it tucks in right below the site's sticky masthead rather than
   under it -- then a .journal-calendar-month block per month, each a
   banded label (reusing the List view's own .journal-month-header
   look, so List and Calendar read as the same idiom) over that month's
   day grid. Entries get bold weight rather than a dot/color marker,
   matching this site's established "identity comes from label
   weight/text, not extra color-coding" restraint (same rule the
   reading-level badges follow).

   .journal-calendar-nav (2026-09-03) sits above the weekday bar, same
   sticky-stacking approach: a reader with few/no entries had nothing to
   scroll to beyond the current+1-month buffer with no way to reach any
   other month, so Prev/Next month links came back alongside the
   scroll -- see accounts/views.py::journal_calendar's ?month= handling. */
.journal-calendar {
  padding-bottom: var(--space-3);
  /* These two bars' own rendered heights (padding + line/content +
     border), used below so a month block's scroll-margin-top can clear
     both exactly -- kept as numbers here rather than duplicated in each
     scroll-margin-top, since all three have to move together or
     initJournalCalendarScroll's landing spot drifts back under a bar. */
  --journal-calendar-nav-height: 2.5rem;
  --journal-calendar-weekdays-height: 1.9rem;
}
.journal-calendar-nav {
  position: sticky;
  top: var(--header-height, 112px);
  z-index: 6;
  /* Explicit height (not auto, from padding+content) matching
     --journal-calendar-nav-height exactly -- global `* { box-sizing:
     border-box }` (site.css top) means padding/border count toward
     this height rather than adding to it, so the value above and the
     value .journal-calendar-month's scroll-margin-top adds up from are
     the SAME number by construction, not by a hand-measured guess that
     can silently drift out of sync (2026-09-01 final review's own scroll-
     clipping bug, in this file's block comment above, was exactly that
     kind of drift, for the weekday bar). 1.9rem button + 0.6rem of
     padding fits comfortably inside 2.5rem. */
  height: var(--journal-calendar-nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--paper);
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border);
}
.journal-calendar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  border-radius: 7px;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  text-decoration: none;
}
.journal-calendar-nav-btn:hover { border-color: var(--border-strong); color: var(--ink); }
/* .journal-calendar-nav-label used to be a plain <span>; now a <button>
   that opens the month/year picker below it (2026-09-03, site owner).
   flex:1 moved from the label itself onto its wrap, since the label is
   now nested one level deeper (wrap > button, not nav > label
   directly) -- the wrap is also the popover's own positioning context.
   min-width:0 (2026-09-03, third design-review round -- root-caused
   live via getBoundingClientRect on the actual nav row, not guessed:
   "Previous, month picker, next, and Today barely fit... 'Today' can
   clip") overrides a flex item's own default min-width:auto, which
   otherwise refuses to shrink a flex:1 item below its CONTENT's
   natural width -- "September 2026" plus the chevron is wider than the
   space actually left over once the two 44px touch-target arrows and
   the Today pill claim their own room at a narrow phone width, so
   without this the whole nav row grows past its container instead of
   the label shrinking, pushing Today off the right edge. */
.journal-calendar-month-picker-wrap { position: relative; flex: 1; min-width: 0; }
.journal-calendar-nav-label {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
/* Truncates only the text, never the chevron next to it (flex:none,
   below) -- see .journal-calendar-month-picker-wrap's own comment for
   why this needs to be able to shrink/truncate at all. */
.journal-calendar-nav-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-calendar-nav-label-chevron { width: 14px; height: 14px; flex: none; color: var(--ink-faint); }
.journal-calendar-month-picker {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  margin-top: 0.4em;
  width: 15rem;
  max-width: calc(100vw - 2 * var(--space-3));
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-card-hover);
  padding: var(--space-2);
}
.journal-calendar-month-picker-year {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.journal-calendar-month-picker-year-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 3em;
  text-align: center;
}
.journal-calendar-month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3em;
}
.journal-calendar-month-picker-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6em 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 7px;
  border: 1px solid transparent;
}
.journal-calendar-month-picker-cell:hover { border-color: var(--border-strong); }
.journal-calendar-month-picker-cell.is-current { background: var(--line-brand); color: var(--line-brand-on); font-weight: 700; }
.journal-calendar-today-link {
  flex: none;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-secondary-ink);
  text-decoration: none;
  padding: 0.35em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.journal-calendar-today-link:hover { border-color: var(--accent-secondary); }
.journal-calendar-weekdays {
  position: sticky;
  top: calc(var(--header-height, 112px) + var(--journal-calendar-nav-height));
  z-index: 5;
  /* Explicit height, not auto from padding+content -- see
     .journal-calendar-nav's own comment on why: with global `*
     { box-sizing: border-box }`, this guarantees the value below
     matches what .journal-calendar-month's scroll-margin-top adds up
     from exactly, rather than relying on this rule's padding/line-
     height happening to sum to the same 1.9rem by coincidence (the
     class of bug the 2026-09-01 final review comment right below
     already describes once). display:grid's own default
     align-items:stretch keeps every weekday <span> filling this height,
     text-align:center + a single grid row keeps them vertically
     centered same as before. */
  height: var(--journal-calendar-weekdays-height);
  align-items: center;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
/* Without this, scrollIntoView (initJournalCalendarScroll) lands a
   month's top edge flush at the scroll container's own y:0 -- which is
   BEHIND all the sticky bars stacked above it (the site's own masthead,
   then .journal-calendar-nav, then .journal-calendar-weekdays), not
   below them. The reader would never see the landing month's own label
   or its first 2-3 weeks, only whatever row happens to fall past the
   overlays' combined height (2026-09-01 final review, confirmed live:
   the initial ship of this feature scrolled straight past September
   into its own tail end -- same failure mode .journal-calendar-nav's
   own addition below is careful to extend, not reintroduce).
   scroll-margin-top pushes the landing point down by that same combined
   height instead. */
.journal-calendar-month {
  scroll-margin-top: calc(var(--header-height, 112px) + var(--journal-calendar-nav-height) + var(--journal-calendar-weekdays-height));
}
@media (min-width: 800px) {
  /* Deliberately placed HERE, right after the base rules above, not up
     with .journal-layout's own @media (min-width: 800px) block --
     2026-09-03 root cause, found live via a real headless-browser
     scroll-position check (getComputedStyle on the actual DOM, not a
     hand-derived guess): CSS resolves an equal-specificity tie by
     SOURCE ORDER, and a media query's own condition doesn't factor into
     that tie-break at all -- these three selectors are exactly as
     specific as their base rules above, so when this override used to
     live earlier in the file (next to .journal-layout), the base rules
     below it in source order always won the cascade, at every viewport
     width, unconditionally. That's what actually caused BOTH bugs a
     site owner found live: the September month title rendering
     partially behind the sticky weekday bar on page load, and Prev/Next
     scrolling to a spot roughly one month short of the month the nav
     bar's own label claimed to have landed on. Neither was a wrong
     height value (what an earlier fix attempt here assumed) -- the
     override computing the *correct* desktop-only value was simply
     never winning the cascade to begin with.

     .journal-calendar-nav/-weekdays's `top` (below) is relative to
     their nearest scrolling ancestor -- below this breakpoint that's
     the viewport (the site's own sticky masthead really does sit above
     it, hence var(--header-height) there), but here it's
     .journal-list-pane itself, already offset from the viewport by
     that same header height via its own `top` (.journal-layout's own
     @media block). Reusing var(--header-height) again here would stick
     the nav bar a second header-height's worth down from the pane's
     OWN top edge instead of flush against it -- same reasoning applies
     to .journal-calendar-month's scroll-margin-top below, needing only
     these two bars' heights, not the site masthead's too. */
  .journal-calendar-nav { top: 0; }
  .journal-calendar-weekdays { top: var(--journal-calendar-nav-height); }
  .journal-calendar-month { scroll-margin-top: calc(var(--journal-calendar-nav-height) + var(--journal-calendar-weekdays-height)); }
}
@media (max-width: 799px) {
  /* Touch targets measured live at ~41px (days) and ~30px (Prev/Next
     arrows) -- below the ~44px baseline most touch-target guidelines
     use (2026-09-03, site owner). Desktop's mouse-driven sizing is left
     alone; this is scoped to the breakpoint that actually has fingers
     on it. --journal-calendar-nav-height redefined here (not just
     .journal-calendar-nav-btn's own size) so the taller button still
     fits inside the bar without overflow, AND so
     .journal-calendar-month's scroll-margin-top (which reads this same
     var, in the base rule above) grows to match automatically --
     same "one number, not duplicated," reasoning as that var's own
     original comment. Placed here, after the >=800px block above, on
     purpose: this and that block are two different, non-overlapping
     conditions (never both true at once), so there's no cascade tie
     between them to worry about either way, but keeping every
     .journal-calendar-* breakpoint override grouped together (rather
     than scattering a mobile one somewhere else in the file) is what
     avoids a repeat of this file's own cascade-order bug (see this
     section's opening comment above .journal-calendar-month). */
  .journal-calendar { --journal-calendar-nav-height: 3rem; }
  .journal-calendar-nav-btn { width: 44px; height: 44px; }
  /* min-width: 0 is required alongside min-height here, not optional --
     .journal-calendar-day's base rule (below) sets aspect-ratio: 1, and a
     grid item's automatic minimum size (min-width: auto by default) folds
     that ratio in: with a definite min-height and no min-width override,
     Chromium/Firefox both refuse to shrink each day cell's *width* below
     44px either, even though the grid's own 7-column `1fr` tracks would
     otherwise happily shrink narrower. At a 360-375px phone width that
     pushed the 7-column grid's own required minimum a few px past the
     pane's actual available width -- a real, if small, page-level
     horizontal scrollbar (2026-09-04 UI smoke test: 380px document width
     against a 375px viewport). min-width: 0 lets the grid track's own
     sizing win again; min-height: 44px still keeps every cell at least
     44px tall on any phone wide enough to afford it (every width this
     grid actually ships at except the tightest few px), just no longer
     forces that same 44px onto width when the two constraints compete. */
  .journal-calendar-day { min-height: 44px; min-width: 0; }
  /* Prev/Next/month-label/Today measured to clip by a fraction of a
     px at 360px (a common Android width) once the arrows grew to their
     own 44px touch target above (2026-09-03, third design-review
     round, site owner: "Previous, month picker, next, and Today barely
     fit; 'Today' can clip at the right edge"). Trimmed gap/padding here
     rather than dropping Today to a second row or into the picker (the
     other two options offered) -- this keeps the single-row layout
     that already reads fine at wider phone widths, with real headroom
     now instead of a bare fit. */
  .journal-calendar-nav { gap: 0.4em; padding: 0 var(--space-2); }
  .journal-calendar-today-link { padding: 0.35em 0.5em; font-size: 0.72rem; }
}
.journal-calendar-month-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--paper-raised);
  border-bottom: 1px solid var(--border);
  padding: 0.5em var(--space-3);
  margin: 0;
}
/* The current month's own divider, in the brand color -- the one block
   in a long scroll a reader is most likely looking for. */
.journal-calendar-month-label.is-current { color: var(--accent-secondary-ink); }
.journal-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2em;
  padding: 0.5em var(--space-3) var(--space-2);
}
.journal-calendar-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
}
.journal-calendar-day:hover { border-color: var(--border-strong); }
.journal-calendar-day-outside { visibility: hidden; }
.journal-calendar-day.has-entry { font-weight: 700; }
.journal-calendar-day.is-today { background: var(--line-brand); color: var(--line-brand-on); border-color: var(--line-brand); }
.journal-calendar-day.is-selected:not(.is-today) { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* Bold weight alone measured "too subtle for quick scanning" (2026-09-03,
   site owner) -- a dot below the number is the same restrained,
   non-color-coded-elsewhere idiom this site already uses for e.g. an
   unread-notification badge, just smaller. .is-multiple draws a second
   dot via box-shadow rather than a real second element -- one span,
   same DOM either way. Positioned absolutely off the flex flow so it
   never nudges the number off-center. */
.journal-calendar-day-dot {
  position: absolute;
  bottom: 0.2em;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent-secondary);
}
.journal-calendar-day-dot.is-multiple { box-shadow: none; }
/* is-today's own filled brand background (above) would otherwise hide
   a same-color dot against it. */
.journal-calendar-day.is-today .journal-calendar-day-dot,
.journal-calendar-day.is-today .journal-calendar-day-dot.is-multiple {
  background: var(--line-brand-on);
  box-shadow: none;
}
.journal-calendar-day.is-today .journal-calendar-day-dot:not(.is-multiple) { box-shadow: none; }
.journal-calendar-legend {
  margin: 0.5em var(--space-3) 0;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.journal-calendar-legend .journal-calendar-day-dot { position: static; transform: none; }
/* The picker's own copy (2026-09-03) sits inside the popover's own
   padding, not the calendar's outer edge -- var(--space-3) margin
   would double up with that padding and misalign it from the month
   grid above. justify-content:center to match the grid's own
   centered-in-a-fixed-width-popover feel, not left-edge-of-page like
   the top copy. */
.journal-calendar-month-picker-legend {
  margin: var(--space-2) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  justify-content: center;
}
.journal-calendar-selected-list { margin: 0 var(--space-3) var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-2); }
.journal-calendar-selected-label {
  margin: 0 0 0.3em;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.journal-calendar-selected-empty {
  margin: 0 var(--space-3) var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.journal-calendar-selected-empty p { margin: 0 0 0.6em; }
/* "Write an entry for <date>" CTA (2026-09-03, third design-review
   round, site owner: an empty date should offer a "prominent" action,
   not just the bare "No entry" text above). Same pill shape/weight as
   .journal-calendar-today-link elsewhere on this page, but in the brand
   color -- this is the one thing on the page actually asking to be
   clicked, the Today link is a quieter utility by comparison. */
.journal-calendar-write-entry-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  text-decoration: none;
  padding: 0.5em 0.9em;
  border-radius: 999px;
}
.journal-calendar-write-entry-link:hover { opacity: 0.9; }
.journal-calendar-write-entry-link .journal-icon { width: 16px; height: 16px; stroke: var(--line-brand-on); }

/* Search (2026-08-28 product-improvements sub-project 7). */
.journal-search { padding: 0 var(--space-3) var(--space-2); }
.journal-search-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.journal-search-input:focus { border-color: var(--accent-secondary); outline: none; }
.journal-search-status {
  margin: 0.4em 0 0;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.journal-search-status[hidden] { display: none; }

/* Trash (2026-08-28 product-improvements sub-project 6) -- a plain
   utility page, not the two-pane app; reuses .account-card's own
   max-width/padding rhythm (accounts/templates/accounts/profile.html)
   rather than the journal-specific pane classes above, since this page
   has no left/right split. */
.journal-trash {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-3);
}
/* Trash, rebuilt 2026-09-20. The structural idea: each row LEADS with
   the time it has left, because that is the thing a reader is deciding
   on. The deleted-date was the wrong end of the window. */
.trash-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--line-brand);
  background: var(--paper-raised);
}
.trash-summary-line {
  margin: 0;
  flex: 1 1 18rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.trash-summary-line strong { color: var(--ink); }
/* The one destructive control on the page, so it looks like one --
   outlined in the red reserved here for permanent deletion, filling in
   only on intent (hover/focus). A permanently-filled red button beside
   a list of recoverable things would read as the primary action, which
   it is emphatically not. */
.trash-empty-btn {
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45em 1.1em;
  border: 1px solid var(--line-news-ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--line-news-ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.trash-empty-btn:hover,
.trash-empty-btn:focus-visible {
  background: var(--line-news-ink);
  color: var(--paper);
}

.trash-empty-state {
  margin: var(--space-3) 0 0;
  padding: var(--space-4) var(--space-3);
  border: 1px dashed var(--border-strong);
  text-align: center;
}
.trash-empty-state-title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.trash-empty-state-desc {
  margin: 0.5em auto 0;
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}
.trash-empty-state-link {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--line-brand);
}

.journal-trash-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.journal-trash-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}
/* The countdown. Tabular figures so the numbers line up down the
   column and the eye can scan them as a list rather than re-reading
   each one. */
.trash-clock {
  flex: 0 0 3.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.15em;
  color: var(--ink-faint);
}
.trash-clock-number {
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.trash-clock-unit { margin-top: 0.15em; font-size: 0.68rem; line-height: 1.2; text-align: center; }
/* Inside a week: amber, which already means "running out" everywhere
   else in this palette. The left edge carries it so a scan down the
   list finds the urgent rows without reading a word. */
.journal-trash-item.is-expiring {
  border-left: 3px solid var(--line-history);
  padding-left: calc(var(--space-2) - 3px);
  margin-left: -1px;
}
.journal-trash-item.is-expiring .trash-clock-number,
.journal-trash-item.is-expiring .trash-clock-unit { color: var(--accent-warm-ink); }

.journal-trash-item-text { flex: 1 1 auto; min-width: 0; }
.journal-trash-item-title { margin: 0; font-weight: 600; }
.journal-trash-item-preview { margin: 0.2em 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.journal-trash-item-meta { margin: 0.4em 0 0; color: var(--ink-faint); font-size: 0.78rem; }
.journal-trash-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  flex-shrink: 0;
}
.journal-trash-item-actions button {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3em 0.8em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.journal-trash-item-actions button:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* Restore is the action this page exists for, so it reads as the
   primary one; Delete forever stays quiet until you reach for it. */
.journal-trash-restore { color: var(--line-brand) !important; border-color: var(--line-brand) !important; }
.journal-trash-restore:hover { background: var(--line-brand); color: var(--paper) !important; }
.journal-trash-delete-forever:hover { border-color: var(--line-news-ink); color: var(--line-news-ink); }

/* Phone: the countdown moves inline with the meta line rather than
   taking a column of its own, and the actions go side by side. */
@media (max-width: 560px) {
  .journal-trash-item { flex-wrap: wrap; gap: var(--space-2); }
  .trash-clock { flex-direction: row; align-items: baseline; gap: 0.35em; flex-basis: auto; }
  .trash-clock-number { font-size: 1.05rem; }
  .trash-clock-unit { margin-top: 0; }
  .journal-trash-item-text { flex: 1 1 100%; order: 3; }
  .journal-trash-item-actions { flex-direction: row; order: 4; flex: 1 1 100%; }
}
/* Neither this standalone page nor journal_trash.html (below) sit inside
   the two-pane .journal-layout that gives .journal-back-link's own
   default (hidden until the single-column, <800px breakpoint) any
   content to collapse alongside -- both are single-column at every
   width, so the link needs to just stay visible everywhere, the same
   override .rss-feeds already carries for the same reason. Caught in
   review while building journal_stats fresh: journal_trash had silently
   had no visible way back on desktop since it shipped. */
.journal-trash .journal-back-link,
.journal-stats .journal-back-link {
  display: inline-block;
}

/* Speaking practice history (speaking_history.html). Restyled 2026-09-15
   (site owner: "make this page modern, professional, energetic, and back
   to study"): its own page shell (no longer borrowing .journal-trash),
   a header with "← Study" + count + "Choose an article", and each
   reaction as a flat card -- hairline border, no shading -- with the
   feedback laid out as a You said → Better → More natural progression
   where the natural phrasing is the visual goal. Each row's delete reuses
   .article-reaction-delete-btn's JS hook (initArticleReactionDelete) but
   is restyled here as an icon button. */
.speaking-history { max-width: 760px; margin: 0 auto; font-family: var(--font-body); }
.speaking-history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}
.speaking-history-title { display: flex; flex-direction: column; gap: 0.15rem; }
.speaking-history-title h1 { margin: 0; font-size: 1.75rem; }
.speaking-history-back {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  text-decoration: none;
}
.speaking-history-back:hover { text-decoration: underline; }
.speaking-history-count { margin: 0.2rem 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.speaking-history-cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.5em 1.15em;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.15s ease;
}
.speaking-history-cta:hover { filter: brightness(1.12); }
.speaking-history-cta:focus-visible,
.speaking-history-back:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
/* Interview practice (2026-10-03): two calls to action, and tabs that
   filter interview answers from article reactions. */
.speaking-history-ctas { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.speaking-history-cta-quiet { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); }
.speaking-history-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 var(--space-3); }
.speaking-history-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.95em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}
.speaking-history-tab span { font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }
.speaking-history-tab:hover { color: var(--ink); border-color: var(--line-brand-ink); }
.speaking-history-tab.is-active { background: var(--line-brand); border-color: var(--line-brand); color: var(--line-brand-on); }
.speaking-history-item-kind {
  align-self: flex-start;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-warm) 14%, transparent);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
}

/* Highlights page (2026-09-19): shares Speaking practice's head; one
   section per article, each quote in its own highlight color. */
.highlights-page { max-width: 760px; margin: 0 auto; font-family: var(--font-body); }
.highlights-article { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.highlights-article h2 { margin: 0 0 var(--space-2); font-size: 1.15rem; line-height: 1.3; }
.highlights-article h2 a { color: var(--ink); text-decoration: none; }
.highlights-article h2 a:hover { color: var(--accent-secondary-ink); text-decoration: underline; }
.highlights-list { list-style: none; margin: 0; padding: 0; }
.highlights-item + .highlights-item { margin-top: var(--space-3); }
.highlights-quote { margin: 0; font-size: 1.02rem; line-height: 1.65; color: var(--ink); }
.highlights-quote mark { padding: 0.05em 0.15em; color: inherit; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.highlights-note { margin: 0.4rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }
.highlights-meta { display: flex; gap: var(--space-2); margin: 0.35rem 0 0; font-size: 0.82rem; color: var(--ink-faint); }
.highlights-meta a { color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.highlights-meta a:hover { text-decoration: underline; }
.highlights-empty { padding: var(--space-4) 0; border-top: 1px solid var(--border); color: var(--ink-soft); }
.highlights-empty p { margin: 0 0 var(--space-3); }
/* Arriving at an article from the Highlights page (#highlight-<id>): a
   brief outline shows which highlight was meant. */
mark.highlight-target { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

/* Foldable cards (2026-09-15, site owner: "what will happen if there are
   many items on this page? shall we make them like foldable cards?"):
   collapsed <details> rows with a one-line preview, grouped by month,
   paginated server-side. */
.speaking-history-month + .speaking-history-month { margin-top: var(--space-3); }
.speaking-history-month-label {
  margin: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-faint);
}
.speaking-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.speaking-history-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper-raised);
  transition: border-color 0.15s ease;
}
.speaking-history-card:hover,
.speaking-history-card[open] { border-color: var(--border-strong); }
.speaking-history-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.85rem 1rem 0.85rem 1.15rem;
  cursor: pointer;
  list-style: none;
}
.speaking-history-summary::-webkit-details-marker { display: none; }
.speaking-history-summary:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; border-radius: 14px; }
.speaking-history-summary-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.speaking-history-item-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
.speaking-history-preview {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.speaking-history-card[open] .speaking-history-preview { display: none; }
.speaking-history-card[open] .speaking-history-item-title { white-space: normal; }
.speaking-history-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.speaking-history-item-duration:empty { display: none; }
.speaking-history-item-status { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 600; }
.speaking-history-item-status::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 999px; background: currentColor; }
.speaking-history-item-status-ready { color: var(--line-economics-ink); }
.speaking-history-item-status-unavailable { color: var(--ink-faint); }
.speaking-history-chevron {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: var(--ink-faint);
  transition: transform 0.2s ease;
}
.speaking-history-chevron svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.speaking-history-card[open] .speaking-history-chevron { transform: rotate(180deg); color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .speaking-history-chevron { transition: none; } }

.speaking-history-body { padding: 0 1.15rem 1rem; }
.speaking-history-audio { display: block; width: 100%; height: 40px; margin: 0.1rem 0 0; }

.speaking-history-feedback { margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.55rem; }
.speaking-history-step { display: grid; grid-template-columns: 7rem 1fr; gap: 0.75rem; align-items: baseline; }
.speaking-history-step dt { font-size: 0.78rem; font-weight: 700; color: var(--ink-faint); }
.speaking-history-step dd { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--ink-soft); }
.speaking-history-step-said dd { font-style: italic; }
.speaking-history-step-better dt { color: var(--ink-soft); }
.speaking-history-step-better dd { color: var(--ink); }
.speaking-history-step-natural { padding-top: 0.55rem; border-top: 1px solid var(--border); }
.speaking-history-step-natural dt { color: var(--accent-secondary-ink); }
.speaking-history-step-natural dd { font-size: 1.05rem; font-weight: 600; color: var(--ink); }
/* Interview answers' coaching note (2026-10-03). */
.speaking-history-step-answer { padding: 0.55rem 0.7rem; border-left: 3px solid var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 8%, transparent); }
.speaking-history-step-answer dt { color: var(--ink); }
.speaking-history-step-answer dd { color: var(--ink); }
.speaking-history-item-feedback-unavailable { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--ink-faint); }

.speaking-history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.speaking-history-article-link { font-size: 0.85rem; font-weight: 600; color: var(--accent-secondary-ink); text-decoration: none; }
.speaking-history-article-link:hover { text-decoration: underline; }
.speaking-history .speaking-history-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin: 0;
  padding: 0.35em 0.8em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.speaking-history .speaking-history-delete:hover { border-color: var(--line-news-ink); color: var(--line-news-ink); }
.speaking-history .speaking-history-delete:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.speaking-history-delete svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.speaking-history-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: 0.88rem;
}
.speaking-history-pager-link {
  padding: 0.45em 1em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
a.speaking-history-pager-link:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.speaking-history-pager-link.is-disabled { color: var(--ink-faint); border-color: var(--border); }
.speaking-history-pager-label { color: var(--ink-faint); }
@media (max-width: 540px) {
  .speaking-history-summary { padding: 0.8rem 0.75rem 0.8rem 0.9rem; }
  .speaking-history-body { padding: 0 0.9rem 0.9rem; }
  .speaking-history-step { grid-template-columns: 1fr; gap: 0.1rem; }
}

.speaking-history-empty {
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  text-align: center;
}
.speaking-history-empty-title { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.speaking-history-empty-text { max-width: 30rem; margin: 0.5rem auto 0; font-size: 0.92rem; line-height: 1.55; color: var(--ink-soft); }

/* Stats screen (journal_stats.html, 2026-09-01, site owner-supplied Day
   One screenshots) -- Streak/Entries/Media/Days/On This Day tiles.
   Reuses .journal-trash's own "standalone single-column utility page"
   shell (max-width, centered) rather than the two-pane .journal-layout,
   since there's no entry to edit here. */
.journal-stats { max-width: 680px; margin: 0 auto; padding: var(--space-3); }
/* --- Stats page, rebuilt 2026-09-20 -------------------------------
   The year leads and the numbers caption it. The old version was five
   equal tiles with tracked-out uppercase labels -- the default stats
   screen, and it said nothing about journaling. */
.stats-year { margin-top: var(--space-3); }
.stats-year-head { margin-bottom: var(--space-2); }
.stats-year-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
}
.stats-year-sub {
  margin: 0.25em 0 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* A year of columns is wider than a phone. Scroll it rather than
   shrinking the cells until they stop being readable. */
.stats-grid-scroll { overflow-x: auto; padding-bottom: 0.4rem; }
.stats-grid { --cell: 11px; --cell-gap: 3px; display: inline-block; min-width: 100%; }
.stats-grid-months {
  display: grid;
  grid-template-columns: repeat(53, var(--cell));
  gap: var(--cell-gap);
  margin-bottom: 0.3rem;
  font-family: var(--font-body);
  font-size: 0.68rem;
  color: var(--ink-faint);
}
/* Labels sit at real month boundaries, so let one overflow its single
   column rather than truncating the name. */
.stats-grid-month { white-space: nowrap; }
.stats-grid-cells { display: flex; gap: var(--cell-gap); }
.stats-grid-week {
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  gap: var(--cell-gap);
}
.stats-cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: 2px;
  background: var(--stats-l0);
}
.stats-cell-l1 { background: var(--stats-l1); }
.stats-cell-l2 { background: var(--stats-l2); }
.stats-cell-l3 { background: var(--stats-l3); }
.stats-cell-l4 { background: var(--stats-l4); }
/* Days after today in the current week: nothing happened there yet, so
   draw nothing rather than an empty-looking zero. */
.stats-cell-empty { background: transparent; }

.stats-key {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
.stats-key-label:first-child { margin-right: 0.15rem; }
.stats-key-label:last-child { margin-left: 0.15rem; }

/* The numbers, now a caption rather than the headline. Sentence case,
   no tracked-out uppercase. */
.stats-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.stats-figure { margin: 0; }
.stats-figure dt {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.stats-figure dd {
  margin: 0.15em 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stats-figure-unit { font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }
.stats-figure-note {
  margin: 0.2em 0 0;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-faint);
}
/* The streak is the one figure people come back for, so it gets the
   emphasis -- and its best-ever underneath, because a number with
   nothing to measure it against is trivia. */
.stats-figure-lead dd { font-size: 2.1rem; color: var(--line-brand); }

.stats-section-title {
  margin: 0 0 0.4em;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.journal-stats-on-this-day { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-2); }
.journal-filter-notice {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
  padding: 0 var(--space-3);
  margin: 0 0 var(--space-2);
}
.journal-empty-state { color: var(--ink-faint); text-align: center; padding: var(--space-5) var(--space-3); }
.journal-empty-state-title { margin: 0 0 0.4em; font-family: var(--font-body); font-weight: 700; color: var(--ink-soft); }
.journal-empty-state-desc { margin: 0; font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-faint); }

/* Banded month header (Day One-style) -- a full-width tinted strip
   rather than a plain text label, so month boundaries in a long list
   read at a glance while scanning, not just on close reading. */
.journal-month-group + .journal-month-group { margin-top: var(--space-2); }
.journal-month-header {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--paper-raised);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.5em var(--space-3);
  margin: 0;
}
.journal-entry-list { list-style: none; margin: 0; padding: 0; }
.journal-list-item {
  position: relative;
  border-bottom: 1px solid var(--border);
}
/* Selected entry: a hairline outline, not a coloured edge stripe
   (2026-09-18, site owner: "no border shading"). */
.journal-list-item.active { background: var(--paper-raised); outline: 1px solid var(--border-strong); outline-offset: -1px; }

/* Mobile entry-actions button (2026-08-28 journal-usability-fixes
   design, bug 5) -- the same Favorite/Pin/Copy/Export/Delete menu the
   right-click context menu already opens (static/js/site.js's
   initJournalContextMenu()), now also reachable via a visible tap
   target -- right-click alone had no equivalent at any touch-only
   width. Absolutely positioned in the row's top-right corner, the same
   idiom mobile list UIs already use for a row's overflow menu; visible
   at every width, not just mobile -- right-click stays available as the
   desktop shortcut alongside it, per the original review's own fix
   direction. */
.journal-entry-menu-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  /* Final-review fix wave, finding 7 -- min-width/min-height reach the
     ~44px mobile tap-target guideline (this is the one control added
     specifically for touch use) without changing the ⋯ glyph's own
     visual size; display:flex centers it inside that larger hit area
     instead of relying on padding alone. */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}
.journal-entry-menu-btn:hover {
  color: var(--ink);
}
.journal-entry-menu-btn:focus-visible {
  border-color: var(--border-strong);
  color: var(--ink);
  /* 2026-09-06 reader-found ("make the border of the ... smaller") --
     this rule's own border-color change IS the intentional focus
     indicator (WCAG 2.4.7 requires one, not that this specific ring be
     removed with nothing replacing it); without suppressing the
     browser's own default focus outline here too, the two stack --
     the native ring rendering just outside this 1px border made the
     whole thing read as one thick, oversized double border.

     2026-09-06 follow-up ("I still do not like the border box... make
     them disappear"): that screenshot was actually :hover, not
     :focus-visible -- the reader's cursor was still resting on the
     button right after the click that opened its menu. Split out of
     the combined selector above so :hover keeps only the color change
     (no border) and this keyboard-focus indicator -- the one WCAG
     2.4.7 actually requires -- is the only state that still shows one. */
  outline: none;
}
.journal-list-item-link {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-2) var(--space-3);
  /* Final-review fix wave, finding 7 -- clears .journal-entry-menu-btn's
     ~44px-wide hit area in the row's top-right corner, so a long
     preview_title wraps before running visually under the button
     instead of overlapping it. 3.25em, up from 2.5em (2026-10-03, site
     owner: "increase the distance between the dot icon and the title"):
     the icon sits centred in that hit area, so 2.5em left the title
     ending right against the dots. */
  padding-right: 3.25em;
  text-decoration: none;
  color: inherit;
}
/* Day-block: weekday abbreviation over a large day number, its own
   fixed-width column -- Day One's own "SUN / 9" pattern. */
.journal-list-item-datecol {
  flex: none;
  width: 2.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: var(--font-body);
  padding-top: 0.15em;
}
.journal-list-item-weekday {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}
.journal-list-item-daynum {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.journal-list-item-content { min-width: 0; flex: 1 1 auto; }
/* Row thumbnail (2026-09-01, site owner-supplied Day One screenshots) --
   the entry's earliest-uploaded ready photo (accounts/views.py's
   _attach_list_thumbnails), when it has one; entries with no photo
   attachment render no thumbnail slot at all (no placeholder box),
   same "nothing rendered when there's nothing to show" convention as
   .journal-list-item-preview's own `{% if %}` guard just above it in
   the template. */
.journal-list-item-thumb {
  flex: none;
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.journal-list-item-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 0.2em;
  /* 2-line clamp, not unbounded wrap (site owner, 2026-09-05, alongside
     the list-pane width above) -- same three-property clamp pattern as
     .journal-list-item-preview just below, so a long preview_title
     truncates with an ellipsis instead of wrapping across as many
     short lines as it takes, even at the wider 23rem column. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.journal-pin-indicator, .journal-favorite-indicator {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 0.3em;
}
.journal-pin-indicator .journal-icon, .journal-favorite-indicator .journal-icon { width: 13px; height: 13px; }
.journal-favorite-indicator { color: var(--line-news-ink); }
.journal-list-item-preview {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 0 0 0.35em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.journal-list-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin: 0;
}
.journal-meta-sep { color: var(--ink-faint); }

.journal-list-item-tags { margin: 0 var(--space-3) var(--space-2) calc(var(--space-3) + 2.4rem + var(--space-2)); }
/* Real pill styling (UI review, 2026-09-05): tags were plain colored
   text with no background/border/radius, so they didn't read as
   tappable/filterable at a glance even though tapping one filters the
   list -- unlike every other pill control on this same page
   (.journal-view-toggle-btn, .journal-media-tabs button), which already
   use border-radius: 999px + a border. Same treatment here, just at
   this row's smaller 0.7rem scale. */
.journal-tag {
  display: inline-block;
  max-width: 100%;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  text-decoration: none;
  margin-right: 0.4em;
  padding: 0.15em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
  /* overflow-wrap: anywhere -- same fix, same reasoning, as
     .journal-attachment-pdf-link (long filenames): a tag that's one
     genuinely unbroken string (a raw pasted URL, 200 repeated chars)
     has no normal wrap opportunity, so this inline-block pill sized to
     its max-content width instead of shrinking to the available row
     width -- forcing the whole page into horizontal scroll even though
     .journal-inline-edit-tags already got min-width: 0 (live QA,
     2026-09-06). Confirmed the container fix alone doesn't cover this:
     it lets pills wrap onto new lines but does nothing for a single
     pill wider than the viewport on its own. max-width: 100% caps the
     pill itself to its container so the wrap actually has somewhere to
     take effect. */
  overflow-wrap: anywhere;
}
.journal-tag:hover { border-color: var(--accent-secondary); background: var(--paper-raised); }
/* Also used for the "+" affordance rendered after existing tags (live QA,
   2026-09-06) -- .journal-inline-edit-tags shrink-wraps to its .journal-tag
   pills, so once an entry has any tags every pixel of that span used to be
   claimed by a pill's own "navigate, don't edit" click handling, with no way
   left to reopen the tag editor. A little horizontal padding here gives that
   "+" (and "Add tags") a real tap target instead of a bare glyph. */
.journal-tag-empty { font-family: var(--font-body); font-size: 0.7rem; color: var(--ink-faint); padding: 0.15em 0.3em; }

/* Click-to-edit date/tags. static/js/site.js's initJournalInlineEdit
   swaps the span's content for an <input> on click, autosaves on
   blur/Enter via api_journal_update, and swaps back -- keeping every
   element sharing that field+entry in sync (2026-08-28
   product-improvements sub-project 5: both the list row's own copy
   below AND .journal-entry-meta-row's copy above the editor). Dashed
   underline signals "editable" without implying a full form control at
   rest. */
.journal-inline-edit {
  cursor: pointer;
  border-bottom: 1px dashed var(--border-strong);
}
.journal-inline-edit:hover { border-bottom-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* min-width: 0 -- same flexbox gotcha already fixed twice elsewhere in
   this file (#search-widget, .collection-form input): as a flex item of
   .journal-entry-meta-row, this span's default min-width: auto refused
   to shrink below "every tag pill on one line," so a reader with even a
   couple of longish tags forced the whole page into horizontal scroll
   (autonomous audit, 2026-09-05, goal doc section I -- confirmed live
   with 3 long tags: 1814px page scrollWidth on a 390px viewport). The
   individual .journal-tag pills are already inline-block and wrap via
   normal text flow on their own once this span can actually shrink to
   the row's real available width. */
.journal-inline-edit-tags { display: inline-block; min-width: 0; border-bottom: none; }

/* Date/tags row above the editor (2026-08-28 product-improvements
   sub-project 5) -- same .journal-inline-edit/.journal-tag building
   blocks styled above, just laid out as a compact single row rather
   than the list row's own stacked layout. */
.journal-entry-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6em;
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.journal-inline-edit-input {
  font: inherit;
  font-size: 0.72rem;
  padding: 0.1em 0.3em;
  border: 1px solid var(--accent-secondary);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

/* Right-click context menu on a journal list row (site owner,
   2026-08-22, referencing Day One's own entry context menu -- structural
   pattern only, not its icons/branding, same "own styling" approach as
   the rest of this feature). Positioned/layered like .flashcard-popover
   (the closest existing precedent: a floating menu anchored to a mouse
   event), built and torn down by static/js/site.js's
   initJournalContextMenu. */
.journal-context-menu {
  position: fixed;
  z-index: 30;
  min-width: 12rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden; /* clips .journal-context-menu-item's own full-width hover background to these rounded corners */
  box-shadow: var(--shadow-card-hover);
  padding: 0.4em 0;
}
.journal-context-menu-stats {
  padding: 0.3em 0.9em 0.5em;
  margin: 0 0 0.3em;
  border-bottom: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  gap: 1em;
}
.journal-context-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0.45em 0.9em;
  cursor: pointer;
}
.journal-context-menu-item:hover { background: var(--paper); color: var(--accent-secondary-ink); }
.journal-context-menu-item.active { color: var(--accent-secondary-ink); }
.journal-context-menu-item-danger { color: var(--line-news-ink); }
.journal-context-menu-item-danger:hover { background: var(--paper); color: var(--line-news-ink); }

.journal-back-link {
  display: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.journal-back-link:hover { color: var(--accent-secondary-ink); }
/* Inside the entry toolbar the row itself provides the spacing; the margin
   above only pushed the link 6px above Check my English / Edit, which the
   row centres (2026-09-18). */
.journal-entry-toolbar .journal-back-link { margin-bottom: 0; }
@media (max-width: 799px) {
  .journal-back-link { display: inline-block; }

  /* Compose pane hidden by default below this breakpoint (2026-09-02,
     site owner: "in dayone app, there is no such big input box" -- an
     always-visible blank "What's on your mind?" editor sitting under
     every browse-mode screen -- List, Calendar, Media alike, since all
     three share this same .journal-layout shell -- isn't something Day
     One's own mobile UI ever shows; it only appears once the reader has
     actually asked to write). data-compose-active (set by the three
     views themselves -- accounts/views.py::journal/journal_calendar/
     journal_media's own compose_active) flips this: true whenever
     there's an actual entry loaded, or explicit intent to start one
     (the FAB's own ?new=1, or "Journal this" from an article's
     ?article=) -- in which case the browsing pane hides instead, same
     "one screen at a time" idiom .journal-back-link above already
     uses for entry selection. Desktop's two-pane layout is untouched
     -- an always-visible compose pane reads as a normal "compose
     alongside your list" idiom there, the same way it does in Gmail. */
  .journal-detail-pane { display: none; }
  .journal-layout[data-compose-active] .journal-list-pane { display: none; }
  .journal-layout[data-compose-active] .journal-detail-pane { display: block; }
}

.journal-entry-article {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin: 0 0 0.6em;
}

/* Back/Edit/Done entry toolbar (2026-09-02, read-first redesign -- see
   _journal_editor_form.html's own comment) -- replaces the old visible
   Write/Read tab pair. .journal-back-link's own display:none default
   (only shown under the single-column breakpoint) is unchanged; it's
   just nested in this flex row now instead of standing alone above it. */
.journal-entry-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
/* Sticky, at every width (2026-09-07 live QA, widened 2026-09-18 -- site
   owner: "the journal edit tool bar and the Done button should be floated
   on top in the edit mode so that users can edit and switch to the read
   mode easily"). This row is the only way back to the list and the only
   way into/out of Edit, and it used to scroll out of reach: measured
   -970px after a ~1200px scroll on a phone, and -757px after a 900px
   scroll on desktop, where the rule didn't apply at all.

   Pinned under the site's own sticky masthead, the same --header-height
   offset every other second-level sticky bar here uses
   (.journal-calendar-nav, .article-rail); the background matches the
   pane's own inherited --paper so scrolled-past content doesn't show
   through. z-index 6 sits below the masthead (10) and line-strip (9) but
   ABOVE .ql-toolbar's 5 -- the format bar comes later in the DOM, so at
   an equal z-index it painted over the Done button and swallowed its
   taps. */
.journal-entry-toolbar {
  position: sticky;
  top: var(--header-height, 112px);
  z-index: 6;
  background: var(--paper);
}
.journal-entry-edit-btn, .journal-entry-done-btn {
  position: relative; /* anchors the ::after hit-area extension below */
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent-secondary-ink);
  background: none;
  border: none;
  padding: 0;
  margin-left: auto; /* right-aligned even on desktop, where .journal-back-link stays hidden and this would otherwise be the row's only child */
  cursor: pointer;
}
/* ~20px tall measured live (2026-09-04 UI smoke test) -- short of the
   ~44px touch-target baseline. Vertical-only ::after (not left/right too,
   unlike .lookup-hint-dismiss/.journal-more-menu-btn above): this sits in
   a `justify-content: space-between` row alongside .journal-back-link,
   so widening the hit area sideways risked eating into that link's own
   tap target on a narrow phone instead. Height alone already reaches the
   full ~44px target (20px visible + 12px top/bottom). */
.journal-entry-edit-btn::after, .journal-entry-done-btn::after {
  content: "";
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 0;
  right: 0;
}
.journal-entry-edit-btn:hover, .journal-entry-done-btn:hover { text-decoration: underline; }
/* The UA's built-in `[hidden] { display: none }` rule loses to ANY
   author-origin `display` rule on the same element regardless of
   specificity -- static/js/site.js's initJournalModeToggle toggles the
   `hidden` attribute on whichever of these two isn't the current mode,
   so without this override both would just stay visible together, the
   `display: inline-flex` rule above winning over `hidden` every time.
   Same established pattern as .back-to-top[hidden]/.journal-media-
   item[hidden] elsewhere in this file. */
.journal-entry-edit-btn[hidden], .journal-entry-done-btn[hidden] { display: none; }

/* Clean reading surface (2026-09-03 design review) -- while an entry is
   in Read mode, every edit-only affordance disappears: the Add-
   attachment button, the delete badge on each attachment thumbnail
   (the thumbnails themselves stay -- a photo IS reading content; so
   does the download badge, since saving your own photo isn't an edit),
   the "Add tags" placeholder, and the dashed inline-edit underlines on
   date/tags (which also stop being tap targets -- editing happens
   behind Edit, per the read-first model). data-journal-current-mode is
   server-rendered on .journal-detail-pane and kept current by
   static/js/site.js's initJournalModeToggle. */
.journal-detail-pane[data-journal-current-mode="read"] .journal-tag-empty {
  display: none;
}
.journal-detail-pane[data-journal-current-mode="read"] .journal-entry-meta-row .journal-inline-edit {
  border-bottom-color: transparent;
  pointer-events: none;
}
/* ...except the tag links themselves -- tapping a tag FILTERS the list
   (navigation, a perfectly good reading-mode action), it doesn't edit
   anything; only the surrounding span's click-to-edit behavior is an
   edit affordance. */
.journal-detail-pane[data-journal-current-mode="read"] .journal-entry-meta-row .journal-tag {
  pointer-events: auto;
}

/* .journal-read-view is .article-body itself (same class, reused
   directly -- see _journal_read_view.html) plus this one override: the
   article page's own .article-body sits inside a max-width column
   context it doesn't need here, but font-size/line-height/heading and
   list treatment all carry over unchanged, which is the whole point. */
.journal-read-view { margin: 0; }
/* 2026-09-12 learner-UX review -- .article-body p's own 1.3em margin
   (site.css, shared with real article pages) reads as excessive in the
   narrower journal detail pane; overridden here only, not on the
   shared rule itself, so article pages are untouched. */
.journal-read-view p { margin: 0.8em 0; }

.journal-detail-pane { padding: var(--space-3); min-height: 20rem; }
/* 2026-09-12 learner-UX review, "make the selected entry and editing
   state unmistakable" -- read vs. write mode used to be inferable only
   from which edit-only controls happened to be hidden (see this file's
   own [data-journal-current-mode="read"] rules above), with no actual
   visual state change on the pane itself. A left accent border while
   actively editing (same brand-left-border idiom .journal-list-item.
   active already uses for "this is the selected entry" in the sidebar)
   gives editing its own unmistakable, always-visible signal instead. */

@media (min-width: 800px) {
  /* Roomier padding + a capped reading measure on desktop (2026-09-03
     look/feel pass) -- the entry body used to run flush-left in a
     ~700px column against a very wide, mostly-empty pane, reading as
     unbalanced. A max-width'd, left-aligned column (not centered --
     centering a lone column in a huge pane reads as adrift) with more
     breathing room around it settles it. Applies to the editor form
     and the read view alike; the placeholder centers itself
     separately below. */
  .journal-detail-pane { padding: var(--space-4) var(--space-4); }
  .journal-detail-pane > *:not(.journal-detail-placeholder) { max-width: 44rem; }
}

/* Foldable entry list (2026-09-19, site owner: "make the left panel
   foldable to the left side so we have a bigger view of the journal entry
   content"). The toolbar's panel button sets data-list-folded on
   .journal-layout (initJournalListToggle, remembered per browser); the
   list pane goes and the entry takes the whole row. With nothing beside
   it, the column is centred rather than left-aligned, and a little wider
   than the two-pane 44rem measure. Two-column widths only: below 800px
   the list and the entry are already one screen at a time, so the button
   is hidden there and the attribute does nothing. */
.journal-list-toggle { display: none; }
@media (min-width: 800px) {
  .journal-list-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--ink-faint);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    flex: none;
  }
  .journal-list-toggle:hover { color: var(--accent-secondary-ink); border-color: currentColor; }
  .journal-list-toggle-chevron { transform-box: fill-box; transform-origin: center; }
  .journal-layout[data-list-folded] .journal-list-toggle-chevron { transform: rotate(180deg); }
  .journal-layout[data-list-folded] { grid-template-columns: minmax(0, 1fr); }
  .journal-layout[data-list-folded] .journal-list-pane { display: none; }
  .journal-layout[data-list-folded] .journal-detail-pane { grid-column: 1; }
  .journal-layout[data-list-folded] .journal-detail-pane > *:not(.journal-detail-placeholder) {
    max-width: 50rem;
    margin-inline: auto;
  }
}

/* Browsing placeholder (accounts/templates/accounts/_journal_detail_
   placeholder.html) -- the calm "pick an entry or start a new one"
   surface that replaced the always-visible empty editor on desktop. */
.journal-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 24rem;
  padding: var(--space-4);
  color: var(--ink-faint);
}
/* 2026-09-12 learner-UX review -- the tip card reuses .journal-writing-
   prompt as-is (border/background/font), but that class has no
   text-align of its own, so inside this CENTERED placeholder it would
   otherwise inherit text-align: center from .journal-detail-placeholder
   above -- fine for one short line, but a multi-line tip centered reads
   noticeably worse than left-aligned. max-width keeps it from
   stretching edge-to-edge on a wide desktop pane; margin-top separates
   it from the title/text pair above rather than sitting flush under
   them the way .journal-writing-prompt's own zero-top-margin assumes
   in its usual (bottom-of-a-list) context. */
.journal-detail-placeholder-tip {
  text-align: left;
  max-width: 26rem;
  margin-top: var(--space-3);
}
.journal-detail-placeholder-icon {
  width: 46px;
  height: 46px;
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
  margin-bottom: var(--space-2);
}
.journal-detail-placeholder-title {
  margin: 0 0 0.25em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink-soft);
}
.journal-detail-placeholder-text {
  margin: 0 0 var(--space-3);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
/* 2026-09-13 design review -- "start a new one" above is now a real
   link (this partial's own top comment explains why a plain link, not
   a second button reusing the pill/button styling this selector used
   to have before its 2026-09-06 removal). Weight/color only, same
   "make it look clickable without making it a button" treatment
   other in-card text links on the site use. */
.journal-detail-placeholder-text a {
  color: var(--accent-secondary-ink);
  font-weight: 600;
  text-decoration: none;
}
.journal-detail-placeholder-text a:hover { text-decoration: underline; }
/* Modifier classes set by static/js/site.js's initJournalAutosave
   (site owner, 2026-08-22: "show the status when the journal is being
   saved" -- plain --ink-faint text alone read as too easy to miss).
   Resting/empty state keeps the original faint treatment; "saving" and
   "saved" get real color and weight so the autosave cycle is actually
   visible without staring at the corner of the screen. */
/* Writing prompt (2026-08-25 design: English-learning pivot) -- a quiet
   inline nudge shown above the editor on the create pane only (see
   accounts/views.py::journal's own comment), styled the same
   raised-paper/brand-left-border way as .flashcard/#review-card so it
   reads as a helpful aside, not a warning (design review, 2026-08-25,
   finding I4 -- shipped with no CSS at all). */
.journal-writing-prompt {
  margin: 0 0 var(--space-2);
  padding: 0.6em 0.9em;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.journal-writing-prompt strong { color: var(--ink); }
.journal-prompt-dismiss {
  display: block;
  margin-top: 0.3em;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-decoration: underline;
  cursor: pointer;
}
.journal-prompt-dismiss:hover { color: var(--line-news-ink); }

/* Vocabulary chips (2026-08-28 product-improvements sub-project 2) --
   .journal-vocab-prompt is a plain sibling class alongside the shared
   .journal-writing-prompt (so it inherits that raised-paper/brand-
   border card treatment above unchanged); everything below is specific
   to the chip layout and the click target's own affordance. */
.journal-vocab-prompt-label { margin: 0 0 0.5em; }
.journal-vocab-used-count { color: var(--ink-faint); font-size: 0.8rem; }
.journal-vocab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: 0.5em;
}
.journal-vocab-chip {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3em 0.75em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--accent-secondary-ink);
  cursor: pointer;
}
.journal-vocab-chip:hover { border-color: var(--accent-secondary); background: var(--paper-raised); }

/* "Check my English" (2026-08-28 product-improvements sub-project 3) and
   "How did this article make you feel?" (2026-09-06 article-reaction
   feature, replacing the old "Answer today's question 🎤" speaking-
   practice flow) -- same button/result treatment for both: one
   reader-initiated AI-feedback action, one result panel underneath. */
/* min-height: 44px (2026-09-04 UI smoke test measured "Check my English"
   at ~33px tall) -- display switched from inline-block to inline-flex
   just to center the label within that taller box; nothing else about
   the visible padding/border/font changes. Applies to both buttons this
   rule already shares (only "Check my English" was measured, but
   .speaking-practice-btn has always mirrored its sizing exactly, so it
   had the same shortfall). */
.journal-check-english-btn, .speaking-practice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: var(--space-2);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}
.journal-check-english-btn:hover, .speaking-practice-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.journal-check-english-btn:disabled, .speaking-practice-btn:disabled { cursor: default; opacity: 0.6; }
/* 2026-09-12 learner-UX review, "give English feedback... greater
   prominence" -- was sharing .speaking-practice-btn's own muted
   outline look; this one gets the site's brand-primary treatment
   instead (same idiom as .crossword-check-primary), since it's the
   one action on this row that reviews everything just written, not a
   secondary/optional extra. Declared after the shared rule above so it
   wins on source order (equal selector specificity), same reasoning
   .saved-bookmark-actions' own account-danger-link override documents. */
.journal-check-english-btn {
  background: var(--line-brand);
  border-color: var(--line-brand);
  color: var(--line-brand-on);
  font-weight: 600;
}
.journal-check-english-btn:hover { background: var(--accent-secondary-ink); border-color: var(--accent-secondary-ink); }
.journal-check-english-btn:disabled { background: var(--paper); border-color: var(--border-strong); color: var(--ink-soft); }
/* 2026-09-13 design review -- this button's own `display: inline-flex`
   above is an author-origin rule, which always beats the UA's built-in
   `[hidden] { display: none }` regardless of specificity or source
   order (same established pattern as .flashcard-add-word-form[hidden]/
   .rss-feed-card-rename-form[hidden] elsewhere in this file); without
   this override, the newly-added `hidden` attribute on this button
   (_journal_editor_form.html) would do nothing. */
.journal-check-english-btn[hidden] { display: none; }
/* In the entry toolbar (2026-09-18): the same quiet text action as Edit /
   Done beside it, not the filled primary button it was below the entry --
   declared after the rules above so it wins on specificity + order. It
   takes the row's right-alignment (margin-left: auto) and Edit/Done sit
   a fixed gap after it; when it's hidden (blank entry) Edit keeps its own
   auto margin, so the row lays out exactly as before. */
.journal-entry-toolbar .journal-check-english-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin: 0 0 0 auto; /* the shared rule's margin-top would drop it below Edit */
  min-height: 0; /* ...and its 44px min-height; the ::after keeps the tap area */
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent-secondary-ink);
  cursor: pointer;
}
.journal-entry-toolbar .journal-check-english-btn:hover { background: none; color: var(--accent-secondary); }
.journal-entry-toolbar .journal-check-english-btn:disabled { background: none; color: var(--ink-soft); }
.journal-entry-toolbar .journal-check-english-btn[hidden] { display: none; }
.journal-entry-toolbar .journal-check-english-btn::after {
  content: ""; position: absolute; top: -12px; bottom: -12px; left: 0; right: 0;
}
.journal-entry-toolbar .journal-check-english-btn:not([hidden]) ~ .journal-entry-edit-btn,
.journal-entry-toolbar .journal-check-english-btn:not([hidden]) ~ .journal-entry-done-btn {
  margin-left: var(--space-3);
}
.journal-check-english-result, .speaking-practice-result {
  margin-top: var(--space-2);
  padding: 0.6em 0.9em;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.journal-check-english-result[hidden], .speaking-practice-result[hidden] { display: none; }
.journal-check-english-item, .speaking-practice-item { margin: 0 0 0.5em; }
.journal-check-english-item:last-child, .speaking-practice-item:last-child { margin-bottom: 0; }
.journal-check-english-alt, .speaking-practice-alt { color: var(--ink); font-weight: 600; }
.journal-check-english-error, .speaking-practice-error { margin: 0; color: var(--line-news-ink); }
.speaking-practice-said { font-style: italic; }

/* "Check my English" confirmation dialog (2026-09-06, site owner: "a
   customized pop up message window, with better design") -- replaces
   the plain window.confirm() browser prompt (static/js/site.js's
   initJournalCheckEnglish) with a real <dialog>, same idiom as
   .rss-feed-add-dialog (accounts/templates/accounts/feeds.html):
   .showModal() gives focus-trapping, Escape-to-close, and a real
   ::backdrop for free, styled to match this app instead of the
   browser's own unstyled chrome ("127.0.0.1:8000 says…"). Sharp
   corners (var(--radius) is 0 site-wide) and the same border/paper
   tokens as every other dialog/card here -- a rounded, shadowed modal
   would read as a foreign, generic-SaaS pattern next to this app's flat,
   bordered look. */
.check-english-confirm-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--paper);
  color: var(--ink);
  width: min(26rem, calc(100% - 2 * var(--space-3)));
}
.check-english-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.check-english-confirm-header {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 0 0 var(--space-2);
}
/* Icon in a flat brand-tinted block, not a rounded "badge" -- same
   color-mix(var(--accent-secondary) ...) idiom already used for subtle
   brand-tinted backgrounds elsewhere (e.g. active states), just applied
   here for the first time to a dialog icon. */
.check-english-confirm-icon {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0.45em;
  box-sizing: content-box;
  color: var(--accent-secondary-ink);
  background: color-mix(in srgb, var(--accent-secondary) 10%, transparent);
}
.check-english-confirm-header h2 {
  margin: 0;
  font-size: 1.05rem;
}
.check-english-confirm-body {
  margin: 0 0 var(--space-3);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}
.check-english-confirm-actions {
  display: flex;
  gap: var(--space-2);
}
/* "What are you writing?" (2026-10-03), added by site.js above the
   dialog's buttons. */
.check-english-purpose {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  margin: 0 0 var(--space-3);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.check-english-purpose select {
  padding: 0.5em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.journal-check-english-purpose-note strong { color: var(--ink); }
.check-english-confirm-actions button {
  flex: 1;
  font: inherit;
  font-weight: 600;
  padding: 0.65em 1em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.check-english-confirm-send {
  border-color: var(--line-brand);
  background: var(--line-brand);
  color: var(--line-brand-on);
}
.check-english-confirm-send:hover { background: var(--accent-secondary-ink); border-color: var(--accent-secondary-ink); }
.check-english-confirm-cancel {
  background: var(--paper);
  color: var(--ink);
}
.check-english-confirm-cancel:hover { background: var(--paper-raised); }

/* Checking a selected passage (2026-09-18): the passage itself, then its
   feedback, in the same window. The quote is indented, not ruled -- flat,
   like the journal's own quotes. */
.check-passage-dialog { width: min(32rem, calc(100% - 2 * var(--space-3))); }
.check-passage-quote {
  margin: 0 0 var(--space-2);
  padding: 0 0 0 var(--space-3);
  max-height: 11rem;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
.check-passage-result {
  margin: 0 0 var(--space-3);
  padding: 0.7em 0.9em;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.check-passage-result[hidden],
.check-passage-dialog [hidden] { display: none; }
.journal-check-english-summary { color: var(--ink); font-weight: 600; }
/* In the selection menu it sits under "Add flashcard" as the secondary
   action: outlined, not a second solid button. */
.flashcard-popover .popover-check-english {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.flashcard-popover .popover-check-english:hover { border-color: var(--line-brand); color: var(--accent-secondary-ink); }

/* Shared alert/confirm dialog (2026-09-06, site owner: "I want all
   alerting message to be customised message pop up box") -- replaces
   every plain window.alert()/window.confirm() browser prompt across the
   whole site (templates/base.html's data-app-alert-dialog, driven by
   static/js/site.js's bibnewsAlert()/bibnewsConfirm()) with ONE reusable
   <dialog>, same visual language as .check-english-confirm-dialog above
   (sharp corners -- var(--radius) is 0 site-wide -- same border/paper
   tokens) but without that one's fixed icon/copy, since this dialog's
   title and body are set per call, not fixed at template-authoring time. */
.app-alert-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--paper);
  color: var(--ink);
  width: min(26rem, calc(100% - 2 * var(--space-3)));
}
.app-alert-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.app-alert-dialog-header h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
}
.app-alert-dialog-body {
  margin: 0 0 var(--space-3);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  /* alert()/confirm() messages sometimes carry their own manual
     line breaks (e.g. the HEIC rejection message's two sentences) --
     preserved instead of collapsed, matching how a native prompt
     would have rendered them. */
  white-space: pre-line;
}
/* Buttons sized to their labels and right-aligned, rather than each
   stretched to half the dialog (2026-09-20, site owner: "the buttons
   too big. make this message box looking better!").
   flex: 1 gave a four-letter "Stay" the same width as a long confirm
   label, and because a flex row stretches its items, a confirm label
   that wrapped to two lines made BOTH buttons that tall -- two large
   boxes for what is usually a one-word choice. */
.app-alert-dialog-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  align-items: center;
}
.app-alert-dialog-actions button {
  flex: 0 1 auto;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5em 1.1em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  /* Deliberately NOT white-space: nowrap -- that trades a tall button
     for one that overflows the dialog on a narrow screen. align-items
     above already stops a wrapped label from stretching its sibling,
     which was the actual complaint. */
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
/* On a narrow phone, full-width stacked buttons genuinely are easier to
   hit than two small right-aligned ones -- the one case where the old
   stretch behaviour was right. */
@media (max-width: 420px) {
  .app-alert-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .app-alert-dialog-actions button { flex: 0 0 auto; padding: 0.7em 1em; }
}
.app-alert-dialog-confirm {
  border-color: var(--line-brand);
  background: var(--line-brand);
  color: var(--line-brand-on);
}
.app-alert-dialog-confirm:hover { background: var(--accent-secondary-ink); border-color: var(--accent-secondary-ink); }
.app-alert-dialog-cancel {
  background: var(--paper);
  color: var(--ink);
}
.app-alert-dialog-cancel:hover { background: var(--paper-raised); }
/* A plain alert() has no Cancel button at all -- center the single
   remaining action instead of stretching it full-width next to an
   invisible sibling. */
.app-alert-dialog-actions:has(.app-alert-dialog-cancel[hidden]) .app-alert-dialog-confirm {
  flex: none;
  min-width: 6rem;
  margin-left: auto;
}

/* Upload confirmation (2026-09-19, owner: "When I upload a file from my
   phone, it directly uploads after selecting the file, no confirmation
   step.") -- static/js/site.js's confirmUploads(), built on the
   .app-alert-dialog above. Flat like the rest of the site (owner rule):
   hairline rows, solid text colours, no shadows or tinted fills. */
.upload-confirm-dialog {
  width: min(28rem, calc(100% - 2 * var(--space-3)));
  max-height: calc(100dvh - 2 * var(--space-3));
  overflow-y: auto;
}
.upload-confirm-title {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
}
.upload-confirm-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  border-top: 1px solid var(--border);
}
.upload-confirm-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.upload-confirm-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink-faint);
  overflow: hidden;
}
.upload-confirm-thumb img,
.upload-confirm-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-confirm-thumb svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.upload-confirm-thumb.is-video { position: relative; }
.upload-confirm-thumb .upload-confirm-play {
  position: absolute;
  inset: 0;
  margin: auto;
  /* Paper-filled, ink-outlined: readable over a blank square and over
     a light or dark first frame alike. */
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.2;
}
.upload-confirm-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.upload-confirm-name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-confirm-size {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.upload-confirm-error {
  font-size: 0.82rem;
  color: var(--line-news-ink);
}
.upload-confirm-item.is-too-large .upload-confirm-name,
.upload-confirm-item.is-too-large .upload-confirm-size {
  color: var(--ink-faint);
}
.upload-confirm-item.is-too-large .upload-confirm-thumb { opacity: 0.55; }
.upload-confirm-total,
.upload-confirm-note,
.upload-confirm-caption {
  margin: 0 0 var(--space-2);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.upload-confirm-total { color: var(--ink); font-weight: 600; }
.upload-confirm-caption { overflow-wrap: anywhere; }
.upload-confirm-actions { margin-top: var(--space-3); }
.upload-confirm-actions button { min-height: 44px; }
/* Every file too large: Close is the only action, kept to the right
   like a plain alert's OK rather than stretched across the dialog. */
.upload-confirm-actions .app-alert-dialog-cancel:only-child {
  flex: none;
  min-width: 6rem;
  margin-left: auto;
}

/* Shared video-player dialog (2026-09-06 bug fix -- see this dialog's
   own comment in templates/base.html for the full story: a played
   video used to render inside the 100x100px .journal-attachment
   thumbnail box it doesn't belong in). Sized for real viewing, not a
   thumbnail -- object-fit: contain (never crop or distort, unlike the
   thumbnail grid's object-fit: cover) inside a box that scales with
   the viewport but caps out well short of the full window. */
.journal-video-dialog {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-2);
  background: var(--paper);
  width: min(90vw, 640px);
}
.journal-video-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.journal-video-dialog video {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
}
.journal-video-dialog-close {
  position: absolute;
  top: calc(-1 * var(--space-2) - 1px);
  right: calc(-1 * var(--space-2) - 1px);
  width: 1.8rem; height: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: var(--paper); color: var(--ink); cursor: pointer; line-height: 1; font-size: 1rem;
}
.journal-video-dialog-close:hover { background: var(--paper-raised); }
.journal-video-dialog-error { margin: var(--space-2) 0 0; color: var(--ink-soft); font-size: 0.9rem; text-align: center; }

/* LaTeX support (2026-09-08, site owner: "make the journal editor
   support latex") -- insert/edit dialog, same native-<dialog> sizing
   idiom as .journal-video-dialog above, just narrower (a LaTeX source
   textarea + preview needs nowhere near that one's 640px video width). */
.journal-formula-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--paper);
  /* 520px (was 420px) -- widened for the symbol palette's own row of
     buttons below, added in the same "comparable to Overleaf" pass that
     added the textarea/preview this dialog already had. */
  width: min(92vw, 520px);
  max-height: 85vh;
  overflow-y: auto;
}
.journal-formula-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.journal-formula-dialog-form { display: flex; flex-direction: column; gap: var(--space-2); }
.journal-formula-dialog-label { display: flex; flex-direction: column; gap: 0.3em; font-size: 0.85rem; font-weight: 600; }
/* position: relative anchors .journal-formula-autocomplete (absolute)
   directly under the textarea, not the whole dialog. */
.journal-formula-input-wrap { position: relative; }
.journal-formula-dialog-input {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9rem;
  padding: 0.5em;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--paper); color: var(--ink);
  resize: vertical;
}
/* Autocomplete dropdown (2026-09-08, "make the latex support comparable
   to overleaf") -- a fixed block directly under the textarea, not
   tracked to the live caret position (see JournalEditor.jsx's own
   comment on why a plain <textarea> doesn't try to do that). z-index
   above the rest of the form -- this is the one element in the dialog
   that needs to visually float over whatever's below it (the palette). */
.journal-formula-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  max-height: 10rem;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: none;
}
.journal-formula-autocomplete-item {
  display: flex; justify-content: space-between; align-items: center; gap: 0.6em;
  padding: 0.35em 0.6em;
  font-size: 0.85rem;
  cursor: pointer;
}
.journal-formula-autocomplete-item.is-active, .journal-formula-autocomplete-item:hover { background: var(--paper-raised); }
.journal-formula-autocomplete-command { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.journal-formula-autocomplete-glyph { color: var(--ink-soft); }

/* Symbol palette (2026-09-08, same pass) -- one row per LATEX_SYMBOL_GROUPS
   entry, buttons wrapping within each row rather than one long
   horizontal scroller, so every symbol stays reachable without a
   scrollbar-hunting step. */
.journal-formula-palette { display: flex; flex-direction: column; gap: 0.4em; }
.journal-formula-palette-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3em; }
.journal-formula-palette-group-label { flex: 0 0 100%; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.journal-formula-palette-btn {
  min-width: 1.8rem; height: 1.8rem;
  padding: 0 0.3em;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--paper); color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
}
.journal-formula-palette-btn:hover { background: var(--paper-raised); border-color: var(--border-strong); }
.journal-formula-dialog-checkbox { display: flex; align-items: center; gap: 0.5em; font-size: 0.85rem; font-weight: 400; }
/* min-height keeps the dialog from visibly jumping size between "empty
   input" (no preview yet) and "one line of math" -- katex.render()'s own
   fallback for an empty source is blank, not zero-height. */
.journal-formula-dialog-preview {
  min-height: 2.4em;
  padding: 0.5em;
  border: 1px dashed var(--border);
  border-radius: 6px;
  overflow-x: auto;
}
.journal-formula-dialog-actions { display: flex; justify-content: flex-end; gap: 0.6em; }
.journal-formula-dialog-cancel, .journal-formula-dialog-insert {
  padding: 0.4em 0.9em; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
}
.journal-formula-dialog-cancel { border: 1px solid var(--border); background: var(--paper); color: var(--ink); }
.journal-formula-dialog-insert { border: none; background: var(--line-brand); color: var(--line-brand-on); }
.journal-formula-dialog-insert:hover { background: var(--accent-secondary-ink); }
.journal-formula-dialog-insert:disabled { opacity: 0.45; cursor: not-allowed; background: var(--line-brand); }

/* The formulas themselves, in both the live editor and the read view --
   click-to-edit only applies inside the editor (onEditorClick in
   JournalEditor.jsx), but the hover affordance is harmless chrome to
   leave out of the read view rather than worth a second, editor-only
   selector for. overflow-x: auto on the block variant (not the inline
   one -- an inline formula wrapping/scrolling mid-sentence would be far
   more disruptive than just overflowing) covers a long equation on a
   narrow/mobile viewport without breaking the surrounding layout. */
.journal-formula-block { overflow-x: auto; margin: 0.75em 0; }
.journal-editor-quill .journal-formula,
.journal-editor-quill .journal-formula-block {
  cursor: pointer;
  border-radius: 4px;
}
.journal-editor-quill .journal-formula:hover,
.journal-editor-quill .journal-formula-block:hover {
  outline: 1px dashed var(--border-strong);
  outline-offset: 2px;
}

/* The bordered upload button -- now only the Files tab's "Upload files"
   (entries attach files from the editor toolbar since 2026-09-19). */
.journal-attachment-add {
  display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.85rem; color: var(--accent-secondary-ink); cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.4em 0.8em; margin-top: 0.5em;
}
.journal-attachment-add .journal-icon { color: var(--accent-secondary-ink); }

/* Bounds any <img> rendered inside journal/article body HTML -- inline
   photo embedding (2026-08-29 design) is what first made it possible for
   a body to contain an <img> at all. max-width/display already come from
   the global `img, svg` reset above; only height/margin are new here.
   Scoped to .article-body (shared with real article pages), not
   journal-specific, since this is a generically-correct bound for any
   body-rendered image. */
.article-body img { height: auto; margin: 0.5em 0; }

/* Resizable inline images (2026-09-06, site owner: "I want the figure
   inserted into the journal entry resizable") -- the overlay/handle
   frontend/src/components/JournalEditor.jsx positions over a selected
   <img> inside the live Quill editor. Editor-only: there's no drag
   affordance in the read-only view, so no equivalent rule is needed
   for .journal-read-view. position: absolute against
   .journal-editor-quill (that component's own root, position:
   relative below) -- NOT against .ql-editor itself, since the overlay
   is deliberately appended as .ql-editor's sibling, not its child (a
   non-content node inside the contenteditable surface would confuse
   Quill's own diffing -- see that component's own comment). */
.journal-editor-quill { position: relative; }
.journal-image-resize-overlay {
  position: absolute;
  border: 2px solid var(--accent-secondary);
  pointer-events: none; /* the box itself is a visual outline only; only its handle is interactive */
}
.journal-image-resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-secondary);
  border: 2px solid var(--paper);
  cursor: nwse-resize;
  pointer-events: auto;
}

/* Media gallery view (journal_media.html, 2026-08-28 design; tabs
   restyled 2026-09-01 into filled pills, site owner-supplied Day One
   screenshots) -- third List/Calendar/Media left-pane view-mode
   (_journal_list_header.html). Same 999px-radius idiom
   .journal-vocab-chip already uses elsewhere in this file for a row of
   filter-style buttons, not a new shape introduced just for this; the
   grid below reuses .journal-attachment-list's flex-of-square-
   thumbnails layout, just as a wrapping grid of link-tiles instead of a
   single row. */
.journal-media-gallery { padding: 0 var(--space-3) var(--space-3); }
.journal-media-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: var(--space-2);
}
.journal-media-tabs button {
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  cursor: pointer;
}
.journal-media-tabs button.active { color: var(--line-brand-on); background: var(--line-brand); border-color: var(--line-brand); }
.journal-media-tabs button:hover:not(.active) { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }

/* Full-bleed equal-width tiles (2026-09-02, Day One-reference) --
   replaces the old flex-wrap row of fixed 100px tiles, which left an
   uneven gap at the end of every row that wasn't a multiple of the
   pane width; auto-fill here always finishes a row exactly at the
   edge, the same "camera roll" look the reference's own media grid
   has.

   2026-09-06: briefly raised to 150px tiles + a per-tile date caption
   as part of a full-workspace redesign, reverted the same day at the
   site owner's own request ("I prefer the old style") -- back to the
   original 84px "pure thumbnails, no caption" tile this comment already
   describes. Only addition kept: .active, a thin selected-state border
   -- Media gained in-place ?entry= selection (accounts/views.py::
   journal_media, kept from that same redesign since it's a real
   improvement independent of the layout question, not a style choice)
   at the same time, so SOME visible "this tile's entry is the one open
   right now" signal is still needed, same idiom as
   .journal-list-item.active elsewhere in this file. */
.journal-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 2px;
}
.journal-media-item {
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--paper-raised);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  border: 2px solid transparent;
}
.journal-media-item.active { border-color: var(--accent-secondary); }
/* The UA's built-in `[hidden] { display: none }` rule loses to ANY
   author-origin `display` rule on the same element regardless of
   specificity -- static/js/site.js's initJournalMediaTabs toggles the
   `hidden` attribute on this exact element, so without this override
   the tab filter would silently stop hiding anything the moment the
   `display: block` rule above applies. Same established pattern as
   .back-to-top[hidden]/.reading-tally[hidden] elsewhere in this file. */
.journal-media-item[hidden] { display: none; }
.journal-media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.journal-media-item-icon {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--paper-raised); color: var(--ink-faint);
}
.journal-media-item-icon svg {
  width: 34px; height: 34px; stroke: currentColor; stroke-width: 1.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Empty state (2026-09-02, Day One-reference screenshot) -- centered
   heading + description rather than .journal-empty-state's single
   plain line elsewhere in this file, matching the reference exactly;
   grid-column: 1/-1 so it spans the full grid width regardless of how
   many auto-fill columns the current pane width produced. */
.journal-media-empty-state { grid-column: 1 / -1; text-align: center; padding: var(--space-5) var(--space-3); }
.journal-media-empty-state-title { margin: 0 0 0.4em; font-family: var(--font-body); font-weight: 700; color: var(--ink-soft); }
.journal-media-empty-state-desc { margin: 0; font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-faint); }

/* Files tab (2026-09-19): the grid above becomes a list -- one row per
   file with a small preview, its name, kind/size/date and where it lives.
   Rows are hairline-separated, flat; the selected row gets the same
   accent border the grid tiles used. */
.journal-files-upload { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
/* The Files tab's primary action, styled like the "+" new-entry button
   (.journal-new-link's brand fill) rather than as another outlined
   control (2026-09-20). It was reading as one more grey-bordered chip
   among the filters and tabs, when it is the one thing this panel
   exists to do.
   Scoped to this button alone, NOT to .journal-attachment-add: the
   editor's Attach shares that class, and a filled brand button sitting
   in a formatting toolbar would compete with the text rather than lead
   it. A toolbar tool is not a primary page action. */
.journal-files-upload-btn {
  margin-top: 0;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border-color: var(--line-brand);
}
.journal-files-upload-btn .journal-icon { color: var(--line-brand-on); }
.journal-files-upload-btn:hover { opacity: 0.85; }
.journal-files-status { margin: 0; font-family: var(--font-body); font-size: 0.8rem; color: var(--ink-soft); }
.journal-files-status:empty { display: none; }
/* Cancel sits beside the progress line while an upload runs
   (2026-09-20), quiet rather than alarming -- it is an ordinary escape
   from a long operation, not a destructive action. */
.journal-files-cancel {
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.25em 0.75em;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
}
.journal-files-cancel:hover:not([disabled]) { background: var(--paper-raised); color: var(--ink); }
.journal-files-cancel[disabled] { opacity: 0.5; cursor: default; }
.journal-files-list { display: block; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
/* The row link plus its own delete button, side by side (2026-09-20).
   The button is a sibling rather than a child of the link -- nesting a
   button inside an anchor is invalid and breaks keyboard navigation of
   both -- so the <li> becomes the flex row that holds the two. */
.journal-files-list > li { border-bottom: 1px solid var(--border); display: flex; align-items: stretch; }
.journal-files-list > li.journal-media-empty-state { display: block; }
.journal-files-list > li > .journal-file-row { flex: 1 1 auto; min-width: 0; }
.journal-file-delete {
  flex: 0 0 auto;
  /* 44px each way: the minimum comfortable tap target on a phone, which
     is where this list is hardest to hit accurately. */
  width: 44px;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: 4px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--ink-faint);
  cursor: pointer;
  /* Deliberately always visible, not revealed on hover: a hover-only
     control simply does not exist on a touch screen. */
}
.journal-file-delete svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.journal-file-delete:hover, .journal-file-delete:focus-visible { color: var(--danger, #b3261e); background: var(--paper-raised); }
.journal-file-delete[disabled] { opacity: 0.5; cursor: default; }
@media (min-width: 701px) { .journal-file-delete { height: 44px; } }
.journal-files-list > li[hidden] { display: none; }
.journal-files-list > li.journal-media-empty-state { border-bottom: 0; }
.journal-file-row {
  display: flex;
  align-items: center;
  gap: 0.75em;
  aspect-ratio: auto;
  padding: 0.55em 0.4em;
  border-radius: 8px;
  background: none;
}
.journal-file-row:hover { background: var(--paper-raised); }
.journal-file-thumb {
  flex: none;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  color: var(--ink-faint);
  background: var(--paper);
}
.journal-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.journal-file-thumb svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.journal-file-text { display: flex; flex-direction: column; min-width: 0; font-family: var(--font-body); }
.journal-file-name { font-size: 0.88rem; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-file-meta, .journal-file-where { font-size: 0.76rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-file-row[data-unattached="true"] .journal-file-where { color: var(--accent-secondary-ink); }

/* A file stored without an entry, opened in the right-hand pane. */
.journal-file-panel { padding: var(--space-3); font-family: var(--font-body); max-width: 40rem; }
.journal-file-preview {
  display: flex; align-items: center; justify-content: center;
  min-height: 10rem; max-height: 28rem;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--paper-raised);
}
.journal-file-preview img, .journal-file-preview video { max-width: 100%; max-height: 28rem; display: block; }
.journal-file-preview-icon { width: 56px; height: 56px; stroke: var(--ink-faint); stroke-width: 1.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.journal-file-panel-name { margin: var(--space-3) 0 0.2em; font-size: 1.15rem; overflow-wrap: anywhere; }
.journal-file-panel-meta { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.journal-file-panel-actions { display: flex; flex-wrap: wrap; gap: 0.5em; margin: var(--space-3) 0; }
.journal-file-panel-btn {
  display: inline-flex; align-items: center;
  padding: 0.45em 0.95em;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: 0.88rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.journal-file-panel-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.journal-file-panel-delete:hover { border-color: var(--line-news); color: var(--line-news-ink); }
.journal-file-panel-primary { background: var(--line-brand); border-color: var(--line-brand); color: var(--line-brand-on); }
.journal-file-panel-primary:hover { background: var(--accent-secondary-ink); color: var(--line-brand-on); }
.journal-file-attach { padding-top: var(--space-3); border-top: 1px solid var(--border); }
.journal-file-attach label { display: block; margin-bottom: 0.4em; font-size: 0.9rem; font-weight: 600; }
.journal-file-attach-row { display: flex; gap: 0.5em; }
.journal-file-attach select {
  flex: 1; min-width: 0;
  padding: 0.45em 0.7em;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 0.88rem;
}
.journal-file-attach-hint { margin: 0.5em 0 0; font-size: 0.8rem; color: var(--ink-faint); }
.journal-file-attach-error { margin: 0.5em 0 0; font-size: 0.85rem; color: var(--line-news-ink); }

/* 2026-09-06 reader-found bug: a filter tab (Photos/PDF/Video/Documents)
   with no matching attachments used to leave this grid blank -- no
   message, same "nothing here" as it not having loaded yet. Sibling of
   .journal-media-grid, not inside it (see _journal_media_gallery.html),
   so it doesn't need grid-column: 1/-1 the way .journal-media-empty-state
   above does. */
.journal-media-filter-empty {
  margin: var(--space-4) 0 0;
  padding: var(--space-4) var(--space-3);
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* 2026-09-12 learner-UX review, "give... word count and saved status
   greater prominence" -- shares one row (site.css below) rather than
   the status paragraph sitting alone; font-size/weight bumped slightly
   from the original 0.78rem for both. */
.journal-editor-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 0.4em;
}
.journal-autosave-status {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-faint);
  min-height: 1.2em;
  margin: 0;
  transition: color 0.15s ease;
}
.journal-autosave-status-saving { color: var(--accent-secondary-ink); }
.journal-autosave-status-saved { color: var(--accent-secondary-ink); }
.journal-autosave-status-offline { color: var(--ink-faint); }
/* .journal-autosave-status-error is the one retryable tone (2026-08-28
   product-improvements sub-project 4) -- underline + pointer signal
   it's clickable, same idiom .journal-prompt-dismiss already uses for
   a plain-text clickable affordance elsewhere in this file. */
.journal-autosave-status-error { color: var(--line-news-ink); text-decoration: underline; cursor: pointer; }
.journal-word-count { font-family: var(--font-body); font-size: 0.8rem; color: var(--ink-soft); flex-shrink: 0; }
.journal-editor-source {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  /* Body font, not display -- this is the no-JS-fallback raw <textarea>
     a reader actually writes their entry into, same reasoning as
     .ql-container.ql-snow just below (the real Quill editor pane). */
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper-raised);
  color: var(--ink);
  resize: vertical;
  min-height: 20rem;
}

/* #journal-editor: the Quill rich-text mount point
   (frontend/src/components/JournalEditor.jsx). Hidden by default -- the
   plain textarea it drives is the visible, fully-functional no-JS
   fallback until the component actually mounts and shows this instead
   (see that component's own comment on why). Quill's own "snow" theme
   CSS (imported by the component, bundled by Vite) supplies most
   styling; these overrides bring its colors in line with this site's
   own tokens instead of Quill's hardcoded palette.

   The corner radius used to be forced flat here to match the sitewide
   flat/sharp-cornered brand look (var(--radius): 0) -- reversed
   2026-09-02 (soft-card pass, see .journal-view-toggle's own comment)
   to instead match .journal-editor-source's own 12px radius, split
   across the toolbar's top corners and the container's bottom corners
   so the two stacked boxes still read as one seamless surface. */
#journal-editor { display: none; }
.ql-toolbar.ql-snow, .ql-container.ql-snow {
  border-color: var(--border-strong);
  font-family: inherit;
}
.ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; }
.ql-container.ql-snow { border-radius: 0 0 12px 12px; }
/* Body font, not display -- this is the actual Quill editing pane a
   reader writes/reads their entry in, a real extended-writing context,
   not a heading/label. */
.ql-container.ql-snow { font-family: var(--font-body); font-size: 1.05rem; }
.ql-toolbar.ql-snow { background: var(--paper-raised); padding: 0.6rem 0.7rem; }
/* 2026-09-12 learner-UX review, "equations, code, tables, many fonts,
   and formatting controls occupy substantial space... keep common
   formatting visible and put specialist tools under More" / "use a
   compact formatting toolbar with an expandable second row". Each
   .journal-toolbar-secondary group (sub/superscript, color/highlight,
   align, table, formula, divider, font family, font size, highlight --
   marked at creation in JournalEditor.jsx) is hidden by default and
   only shown once toolbarContainer itself carries
   .journal-toolbar-expanded, toggled by the "More tools"/"Fewer tools"
   button that same file appends as the toolbar's own last group.
   Deliberately display:none per group, NOT overflow:hidden/max-height
   on the whole toolbar -- Quill's own color/header/font pickers open a
   position:absolute dropdown that extends BELOW the toolbar's own box,
   and clipping the container itself would have clipped those dropdowns
   too, not just the collapsed rows. This has no such risk: a hidden
   group's own dropdown can't be open in the first place, and a visible
   group's dropdown is never touched. */
/* .ql-toolbar.ql-snow prefix on both rules below, not a bare
   .journal-toolbar-secondary -- confirmed live, 2026-09-12 (site owner
   report: "no more tools shown after clicking it"): Quill's OWN base
   CSS (quill.snow.css) sets `.ql-snow .ql-formats { display:
   inline-block }`, specificity (0,2,0) -- every secondary group also
   carries the ql-formats class, so that rule beat a bare single-class
   `.journal-toolbar-secondary { display: none }` (0,1,0) regardless of
   source order, and the "hide by default" half of this feature never
   actually took effect: every group was visible from the start, so
   clicking "More tools" toggled a class but changed nothing visible.
   Matching Quill's own two-class prefix (now three/four classes total)
   is what actually wins the specificity comparison. */
.ql-toolbar.ql-snow .journal-toolbar-secondary { display: none; }
.ql-toolbar.ql-snow.journal-toolbar-expanded .journal-toolbar-secondary { display: inline-block; }
.journal-more-tools-btn {
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.ql-snow.ql-toolbar button.journal-more-tools-btn {
  width: 28px;
  height: 24px;
  padding: 3px 5px;
  margin: 2px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.journal-more-tools-btn svg { width: 18px; height: 18px; display: block; }
.journal-more-tools-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* 2026-09-09, site owner: "the editor toolbar should stay on top when
   scrolling the journal content downward" -- reuses the same
   --header-height CSS var every other sticky element on this page
   already tracks (site.js's setHeaderHeightVar), so the toolbar docks
   just below the site header instead of overlapping it. z-index: 5
   matches this app's other sticky toolbars/panels (e.g. the reply bar)
   -- high enough to sit above ordinary content, below any modal/dialog
   overlay (fullscreen mode below uses its own much higher z-index:
   200, and a native <dialog> always paints above both regardless of
   z-index). */
/* Offset by the entry toolbar's own height (measured into
   --journal-entry-toolbar-h by site.js, since it depends on the rendered
   button/font size) so the two stack instead of overlapping: Edit/Done
   stays tappable while the format bar is in reach (2026-09-18). */
.ql-toolbar.ql-snow {
  position: sticky;
  top: calc(var(--header-height, 0px) + var(--journal-entry-toolbar-h, 2.5rem));
  z-index: 5;
}
/* Breathing room between wrapped toolbar rows (2026-09-19, site owner:
   "increase the gap between rows in the tool bar. do not be too
   cramped"). Quill lays the groups out as inline-blocks, so vertical
   margin on each group is what spaces the rows; the toolbar's own
   padding is trimmed by the same amount so the first and last rows keep
   their old distance from its edges. */
.ql-toolbar.ql-snow .ql-formats { margin-top: 0.3rem; margin-bottom: 0.3rem; }
/* Quill's own 15px after every group spread the icons out (2026-09-19,
   site owner: "why so much gap between icons") -- 8px still separates
   the groups without the row looking scattered. */
.ql-toolbar.ql-snow .ql-formats { margin-right: 8px; }
/* Group dividers (2026-09-19 design review): a 1px hairline between two
   groups on the same row -- JournalEditor.jsx's updateToolbarDividers
   decides which. Every group keeps a transparent line and its padding
   whether it shows or not, so toggling one never shifts the layout; the
   8px gap above becomes 4px either side of the line. */
.ql-toolbar.ql-snow .ql-formats {
  margin-right: 4px;
  padding-left: 4px;
  border-left: 1px solid transparent;
}
.ql-toolbar.ql-snow .ql-formats.journal-toolbar-divider { border-left-color: var(--border); }
/* Touch screens (2026-09-19 accessibility check): the 28x24px buttons meet
   WCAG 2.2's 24px minimum but are tight under a finger, so on a coarse
   pointer they grow to 34x32. Padding, not height, does it -- Quill sizes
   each icon to its button's content box, so the icons stay 18px. */
@media (pointer: coarse) {
  /* One class more than quill.snow.css, which loads after this file. */
  .ql-toolbar.ql-snow .ql-formats button { width: 34px; height: 32px; padding: 7px 8px; }
  .ql-toolbar.ql-snow .ql-formats .ql-picker { height: 32px; }
  .ql-toolbar.ql-snow .ql-formats .ql-picker-label { display: flex; align-items: center; }
}
.ql-toolbar.ql-snow { padding-top: 0.3rem; padding-bottom: 0.3rem; }
/* overflow-wrap: break-word -- same fix, same reasoning, as .article-body
   above: while actively typing (or pasting) a long unbroken word/URL,
   the write-mode Quill editor needs this too, not just the read view. */
.ql-editor { min-height: 22rem; color: var(--ink); line-height: 1.6; overflow-wrap: break-word; }
/* Space between paragraphs while writing (2026-10-10, site owner: edit
   mode read as one crowded block). Quill's own .ql-editor p { margin: 0 }
   loads after this file, hence .ql-container for the extra class. Top-
   level paragraphs only, so table cells keep their tight rows. Drawings
   are pinned to blocks (journalInk.js), so they move with the text; the
   read view of an entry with ink repeats this rule below to stay aligned. */
.ql-container .ql-editor > p { margin: 0 0 0.8em; }

/* Font family + size as one Word-style control (2026-09-15, site owner:
   "the font type and size should be together, and it shows the value of
   the font where the cursor is"). Two real <select>s JournalEditor.jsx
   builds and wires by hand (see that file's comment on why Quill's own
   pickers can't be used) inside one hairline-bordered group in the
   primary toolbar row: [Family ⌄ | Size ⌄]. */
/* The attach button (2026-09-19): first in the toolbar, a paperclip with
   an "Attach" label in a hairline-bordered button -- flat, no fill, the
   same accent ink as other primary journal actions; the border takes the
   ink on hover. Height matches the font/size group beside it. */
.ql-toolbar.ql-snow .ql-formats.journal-attach-group { margin-right: 12px; }
.ql-snow.ql-toolbar button.journal-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  height: 28px;
  padding: 0 0.7rem 0 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--accent-secondary-ink);
  font: 600 0.82rem/1 var(--font-body);
  vertical-align: middle;
}
.ql-snow.ql-toolbar button.journal-attach-btn svg { width: 17px; height: 17px; float: none; }
.ql-snow.ql-toolbar button.journal-attach-btn .ql-stroke { stroke: currentColor; stroke-width: 1.9; }
.ql-snow.ql-toolbar button.journal-attach-btn:hover,
.ql-snow.ql-toolbar button.journal-attach-btn:focus-visible { border-color: currentColor; color: var(--accent-secondary-ink); }
.ql-snow.ql-toolbar button.journal-attach-btn:hover .ql-stroke { stroke: currentColor; }
.ql-snow.ql-toolbar button.journal-attach-btn:disabled { opacity: 0.55; cursor: progress; }
/* While uploading (JournalEditor.jsx's showAttachStatus): full strength,
   not the faded disabled look, since the label is the status; digits
   don't jiggle as the percent changes; and a solid 3px line along the
   bottom edge grows with --attach-progress. */
.ql-snow.ql-toolbar button.journal-attach-btn.is-uploading,
.ql-snow.ql-toolbar button.journal-attach-btn.is-uploading:hover {
  position: relative;
  opacity: 1;
  border-color: var(--border-strong); /* not the hover ink: the progress line is that color */
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.ql-snow.ql-toolbar button.journal-attach-btn.is-uploading::after {
  content: "";
  position: absolute;
  top: auto; /* the toolbar's hit-slop ::after (further down) sets top/right */
  right: auto;
  left: 0;
  bottom: 0;
  height: 3px;
  width: var(--attach-progress, 0%);
  background: currentColor;
  transition: width 0.2s linear;
}
@media (prefers-reduced-motion: reduce) {
  .ql-snow.ql-toolbar button.journal-attach-btn.is-uploading::after { transition: none; }
}
.ql-toolbar.ql-snow .ql-formats.journal-font-size-group {
  display: inline-flex;
  align-items: stretch;
  height: 28px;
  margin: 1px 8px 1px 0;
  padding-left: 0; /* has its own border; no divider slot (see Group dividers) */
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  vertical-align: middle;
}
.journal-font-picker,
.journal-size-picker {
  height: 100%;
  margin: 0;
  padding: 0 0.45em;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
}
.journal-font-picker { width: 7.75rem; text-overflow: ellipsis; }
.journal-size-picker { width: 3.4rem; border-left: 1px solid var(--border-strong); }
.journal-font-picker:hover, .journal-size-picker:hover { color: var(--accent-secondary-ink); }
.journal-font-picker:focus-visible, .journal-size-picker:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; }
@media (max-width: 540px) {
  .journal-font-picker { width: 7.25rem; }
  .journal-size-picker { width: 3.5rem; }
}

/* Nested in the Bold/Italic .ql-formats group, whose buttons Quill floats
   left -- floated too so it lines up beside Italic. */
.journal-highlight-group { position: relative; float: left; }
.journal-highlight-panel {
  position: absolute; top: 100%; left: 0; z-index: 6;
  display: flex; gap: 0.3rem; padding: 0.4rem;
  background: var(--paper-raised); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: none;
}
/* 2026-09-09, live-browser verification finding: this class's own
   `display: flex` above has the same specificity as the browser's UA
   `[hidden] { display: none }` rule and loses to it only by luck of
   cascade order -- confirmed live that the panel rendered permanently
   visible (JournalEditor.jsx's `highlightPanel.hidden = true/false`
   toggle ran correctly but had no visual effect at all). A higher-
   specificity override, not a reorder, is what actually fixes it. */
.journal-highlight-panel[hidden] { display: none; }
.journal-highlight-swatch {
  width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border-strong); cursor: pointer;
}
.journal-highlight-clear { background: var(--paper); position: relative; }
.journal-highlight-clear::before, .journal-highlight-clear::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; background: var(--ink-soft);
}
.journal-highlight-clear::before { transform: rotate(45deg); }
.journal-highlight-clear::after { transform: rotate(-45deg); }

/* Draw tools (2026-09-16, site owner: "put draw tools similar to OneNote
   to the journal editor") -- frontend/src/components/journalInk.js. The
   "Draw" button in the primary toolbar row opens .journal-ink-toolbar, a
   full-width second row inside the (sticky) Quill toolbar: Type,
   Eraser ⌄, Pen, Highlighter, Laser | 4 colours, Palette ⌄ | Thickness ⌄
   | Undo, Redo. Flat like the rest of the toolbar: hairline borders on
   the active tool and on menus, no shadows or tinted fills. */
/* More tools is the row's last inline group (fullscreen floats right), so
   Quill's 15px group gap after it only served to push it onto a second
   line once the Draw button joined the row. */
.ql-toolbar.ql-snow .ql-formats.journal-more-tools-group { margin-right: 0; }
.ql-snow.ql-toolbar button.journal-ink-toggle.is-active,
.ql-snow.ql-toolbar .journal-ink-toolbar button.is-active {
  border: 1px solid var(--accent-secondary);
  border-radius: 4px;
}
.ql-snow.ql-toolbar button.journal-ink-toggle.is-active .ql-stroke { stroke: var(--accent-secondary-ink); }
.journal-ink-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0;
  width: 100%;
  clear: both;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}
.journal-ink-toolbar[hidden] { display: none; }
.journal-ink-section {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.5rem;
}
.journal-ink-section + .journal-ink-section { border-left: 1px solid var(--border); }
.journal-ink-section:first-child { padding-left: 0; }
.ql-snow.ql-toolbar .journal-ink-toolbar button {
  width: 30px;
  height: 28px;
  padding: 4px 6px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ql-snow.ql-toolbar .journal-ink-toolbar button:disabled { opacity: 0.35; cursor: default; }
.ql-snow.ql-toolbar .journal-ink-toolbar button svg { width: 18px; height: 18px; }
.ql-snow.ql-toolbar .journal-ink-toolbar button.journal-ink-caret { width: 16px; padding: 4px 2px; margin-left: -2px; }
.ql-snow.ql-toolbar .journal-ink-toolbar button.journal-ink-caret svg { width: 10px; height: 10px; }
.journal-ink-split { position: relative; display: inline-flex; align-items: center; }
/* The current pen/highlighter colour, as a bar under the tool icon. */
.journal-ink-color-bar {
  position: absolute; left: 7px; right: 7px; bottom: 2px; height: 3px; border-radius: 1px;
}
.journal-ink-laser-trail { fill: none; stroke: #e53935; stroke-width: 1.4; stroke-linecap: round; }
.ql-snow.ql-toolbar .journal-ink-toolbar button.journal-ink-swatch,
.journal-ink-palette-grid .journal-ink-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
}
.journal-ink-swatch::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid var(--border-strong);
}
.ql-snow.ql-toolbar .journal-ink-toolbar button.journal-ink-swatch.is-active { border: 2px solid var(--accent-secondary); border-radius: 50%; }
.journal-ink-menu {
  position: absolute; top: 100%; left: 0; z-index: 7;
  margin-top: 4px;
  min-width: 11rem;
  padding: 0.35rem;
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.journal-ink-menu[hidden] { display: none; }
.ql-snow.ql-toolbar .journal-ink-toolbar .journal-ink-menu button.journal-ink-menu-item {
  display: block;
  width: 100%;
  height: auto;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.ql-snow.ql-toolbar .journal-ink-toolbar .journal-ink-menu button.journal-ink-menu-item:hover { border-color: var(--border-strong); }
.ql-snow.ql-toolbar .journal-ink-toolbar .journal-ink-menu button.journal-ink-menu-danger { color: var(--line-news-ink); }
.journal-ink-palette-menu { min-width: 0; }
.journal-ink-palette-grid { display: grid; grid-template-columns: repeat(4, 30px); gap: 0.2rem; }
.ql-snow.ql-toolbar .journal-ink-toolbar .journal-ink-palette-grid button.journal-ink-swatch { width: 30px; height: 30px; }
.journal-ink-custom-color {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--ink-soft);
}
.journal-ink-custom-color input { width: 2.2rem; height: 1.6rem; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: transparent; }
.journal-ink-size-menu { min-width: 8rem; }
.ql-snow.ql-toolbar .journal-ink-toolbar .journal-ink-size-menu button.journal-ink-size-item {
  display: flex; width: 100%; height: 30px; padding: 0 0.6rem; border-radius: 4px;
}
.journal-ink-size-line { display: block; width: 100%; border-radius: 4px; background: var(--ink); }
/* On phones the strip wraps into two rows (tools + undo/redo, then
   colours + thickness): no divider at the start of a row, and the
   thickness menu opens leftward so it stays on screen. */
@media (max-width: 540px) {
  .journal-ink-section + .journal-ink-section { border-left: 0; }
  .journal-ink-section { padding: 0 0.35rem 0 0; }
  .journal-ink-section:last-child .journal-ink-menu { left: auto; right: 0; }
}

/* The ink layer. In the editor it sits over .ql-editor's padding box
   (positioned by journalInk.js) and only takes pointer input while a
   drawing tool is active; the read view carries its own copy. */
.journal-ink-layer {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
  color: var(--ink);
  z-index: 2;
}
.journal-ink-layer-editor { overflow: hidden; }
.journal-ink-drawing .journal-ink-layer-editor { pointer-events: auto; touch-action: none; cursor: crosshair; }
.journal-ink-drawing[data-ink-tool="eraser"] .journal-ink-layer-editor {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='11' cy='11' r='9' fill='white' fill-opacity='0.6' stroke='%23333' stroke-width='1.5'/%3E%3C/svg%3E") 11 11, cell;
}
.journal-ink-drawing[data-ink-tool="laser"] .journal-ink-layer-editor { cursor: default; }
.journal-ink-laser { fill: none; stroke: #e53935; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: 0.85; }
.journal-read-view { position: relative; }
/* An entry with a drawing reads in the editor's own typography (Quill's
   .ql-editor spacing plus this site's .ql-editor/.ql-container
   overrides above), so its text wraps the same way in Read mode and the
   ink lands on the same words it was drawn over. */
.journal-read-view.journal-read-view-has-ink {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  padding: 12px 15px;
  border: 1px solid transparent;
}
.journal-read-view.journal-read-view-has-ink :is(p, ol, ul, pre, blockquote, h1, h2, h3, h4, h5, h6) { margin: 0; }
.journal-read-view.journal-read-view-has-ink > p { margin: 0 0 0.8em; }

/* Fullscreen (2026-09-08, site owner: "make it available for full screen
   mode too") -- toggled on #journal-editor (the DIV containing both
   Quill's toolbar and its editor pane as siblings, see JournalEditor.jsx's
   own comment) by the toolbar button JournalEditor.jsx appends next to
   the font picker above. Covers the viewport as a fixed overlay rather
   than just growing in place, the same "focus mode" real editors give a
   fullscreen toggle -- everything else on the page (header, sidebar)
   is hidden behind it, not just made to scroll past a taller box. */
/* max-width: none -- .journal-detail-pane's own 44rem cap on its children
   also matches this mount div and squeezed the "fullscreen" overlay into
   a 44rem strip at the left of the viewport (2026-10-03). */
#journal-editor.journal-editor-fullscreen {
  position: fixed; inset: 0; z-index: 200; max-width: none;
  display: flex; flex-direction: column;
  background: var(--paper); padding: 1rem;
}
#journal-editor.journal-editor-fullscreen .ql-toolbar.ql-snow { flex: none; }
/* No site header is visible behind the fullscreen overlay (it covers
   the whole viewport, see the rule above), so the toolbar sticks to
   the very top of the overlay itself, not the site header's height. */
#journal-editor.journal-editor-fullscreen .ql-toolbar.ql-snow { top: 0; }
#journal-editor.journal-editor-fullscreen .ql-container.ql-snow { flex: 1; }
#journal-editor.journal-editor-fullscreen .ql-editor { height: 100%; min-height: 0; }
/* Pushed to the toolbar's far right (margin-left: auto on its own
   .ql-formats group, Quill's own grouping unit) so it doesn't crowd the
   font/size pickers -- same visual slot a real editor's fullscreen
   toggle usually sits in. */
.journal-editor-fullscreen-group { float: right; margin-left: auto; }
/* Inline video embeds (2026-09-06 JournalVideoBlot) -- unlike an
   inserted photo, which already points at a small ?thumb=1 (max 400px)
   image, a video embed's src is the full, un-thumbnailed original (no
   video thumbnail exists). With preload="none" the element renders at
   the UA's placeholder size until the reader presses play, at which
   point metadata loads and, with no width/height constraint, a
   <video> defaults to its OWN NATIVE pixel dimensions -- a phone's
   portrait 1080x1920 clip would suddenly blow out to that size inline
   in the entry the moment playback starts.

   2026-09-06 follow-up (reader-found): `max-width: 100%; height: auto`
   alone -- the same pattern .article-body img just above uses -- only
   bounds a WIDE (landscape) video; it does nothing for a TALL
   (portrait) one, since the width is already under the content
   column's max-width, so nothing ever clamps the height at all. A
   portrait clip rendered at its full native height (1920px for a
   1080x1920 phone video) once played -- "becomes big, and no way to
   be small again" (reported: no UI ever offered to shrink it back,
   because nothing in the CSS ever capped it going in). Fixed the
   standard way for a replaced element that must respect BOTH a max
   width AND a max height while preserving its aspect ratio: width/
   height both auto (not one of them forced to 100%), so the browser
   sizes it at its intrinsic dimensions and THEN clamps by whichever of
   max-width/max-height is more restrictive -- correct for a wide OR a
   tall source alike, unlike forcing width to fill the column and
   leaving height uncapped. */
.ql-editor video, .journal-read-view video {
  display: block;
  height: auto;
  max-width: 100%;
  margin: 0.5em 0;
}
/* 2026-09-07: resizable video (site owner: "the photos and videos shall
   be re-sizable") -- frontend/src/components/JournalEditor.jsx's resize
   overlay now supports <video> the same way it already did <img>,
   committing the dragged width as a real width="" attribute (see that
   component's own comment for why an attribute, not an inline style).
   That attribute is USELESS as long as this rule forces `width: auto`
   unconditionally -- an explicit author-stylesheet width declaration
   always wins over a plain HTML width attribute, dragging would visibly
   do nothing. Splitting on :not([width]) keeps the exact pre-existing
   portrait-video fix (both width and height auto, dual-clamped by
   max-width/max-height so neither a wide nor a tall clip ever blows out)
   for every video that was never resized, while a resized one instead
   renders at its own explicit width, still bounded by max-width: 100%,
   with height left auto to preserve whatever aspect ratio the browser
   can determine (see JournalEditor.jsx's video-resize comment for why
   that's sometimes only known once the reader presses play, same as
   before this feature existed). */
.ql-editor video:not([width]), .journal-read-view video:not([width]) {
  width: auto;
  max-height: 22rem;
}

/* 2026-09-07: list-nesting classes (ql-indent-1..8) in the read view --
   Quill's own bundled quill.snow.css (imported by JournalEditor.jsx) is
   what actually indents .ql-indent-N while the entry is being EDITED,
   but every one of its rules is scoped to .ql-editor specifically. The
   class survives into entry.body regardless (see
   _JOURNAL_EXTRA_ALLOWED_CLASSES in markdown_utils.py), but without a
   matching rule HERE a reader who nested a sub-bullet while writing
   would see it flatten back to top-level the moment they switched to
   (or reloaded into) read mode -- same content, visibly different
   structure, with nothing on this page telling them why. Formula
   matches Quill's own exactly (quill.snow.css: non-list elements get
   3em * N; a <li> gets 1.5em more on top of that, to clear its own
   bullet/number) rather than approximating it, so switching between
   edit and read view is never visibly different. */
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-1 { padding-left: 3em; }
.journal-read-view li.ql-indent-1 { padding-left: 4.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-2 { padding-left: 6em; }
.journal-read-view li.ql-indent-2 { padding-left: 7.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-3 { padding-left: 9em; }
.journal-read-view li.ql-indent-3 { padding-left: 10.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-4 { padding-left: 12em; }
.journal-read-view li.ql-indent-4 { padding-left: 13.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-5 { padding-left: 15em; }
.journal-read-view li.ql-indent-5 { padding-left: 16.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-6 { padding-left: 18em; }
.journal-read-view li.ql-indent-6 { padding-left: 19.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-7 { padding-left: 21em; }
.journal-read-view li.ql-indent-7 { padding-left: 22.5em; }
.journal-read-view :is(p, blockquote, h1, h2, h3, h4, h5, h6).ql-indent-8 { padding-left: 24em; }
.journal-read-view li.ql-indent-8 { padding-left: 25.5em; }

/* Bullet/checklist markers in the read view (2026-09-07, journal-editor-
   onenote-parity pass) -- same "Quill's own quill.snow.css only styles
   .ql-editor, so a read-view-only rule is needed too" reasoning as the
   ql-indent-N block just above, for a DIFFERENT bug that same audit
   found: Quill's list container is always <ol>, for EVERY list type
   (data-list on each <li> is what actually distinguishes bullet/ordered/
   checked/unchecked -- see quill/formats/list.js) -- with no override, a
   bulleted OR checklist item here would silently render with the
   browser's own native DECIMAL numbering instead, matching neither what
   the reader wrote nor what the live editor showed them.
   li[data-list="ordered"] needs no rule of its own -- decimal is <ol>'s
   own browser default already, and nothing here overrides it. Checked/
   unchecked use ::before content instead of list-style-type (no native
   CSS list-style renders a checkbox glyph) -- ☑/☐, the exact same
   Unicode characters Quill's own quill.snow.css uses for the live
   editor's checkbox glyphs, so the two views read identically. This
   intentionally does NOT replicate Quill's own per-indent-level CSS
   counter-reset numbering restart for a NESTED ordered list (a real gap,
   left for later, see this rule's own git history) -- a flat
   (non-nested) list, the overwhelmingly common case, renders correctly
   either way, and getting the rare nested-numbering case wrong here is
   no worse than it already silently was before this fix (nesting itself
   already renders via the ql-indent-N padding rules above, only the
   PER-LEVEL NUMBER RESTART is the unhandled part). */
.journal-read-view li[data-list="bullet"] { list-style-type: disc; }
.journal-read-view li[data-list="checked"],
.journal-read-view li[data-list="unchecked"] {
  list-style: none;
  position: relative;
}
.journal-read-view li[data-list="checked"]::before,
.journal-read-view li[data-list="unchecked"]::before {
  display: inline-block;
  margin-left: -1.5em;
  margin-right: 0.3em;
  width: 1.2em;
  text-align: right;
  color: var(--ink-faint);
}
.journal-read-view li[data-list="checked"]::before { content: "\2611"; }
.journal-read-view li[data-list="unchecked"]::before { content: "\2610"; }

/* Font family/size in the read view (2026-09-07, journal-editor-onenote-
   parity pass) -- same "Quill's own quill.snow.css only styles
   .ql-editor" reasoning as every rule above, for JournalEditor.jsx's
   class-based FontClass/SizeClass (see that file's own comment on why
   these two ended up class-based, unlike color/background/align/text-
   align, which are style-based and need no rule here at all). Values
   copied verbatim from quill.snow.css's own .ql-editor .ql-font-serif/
   .ql-size-huge etc. rules, not approximated, for the same "edit and
   read view must never visibly disagree" reason ql-indent-N's own
   comment gives. */
.journal-read-view .ql-font-serif { font-family: Georgia, "Times New Roman", serif; }
.journal-read-view .ql-font-monospace { font-family: Monaco, "Courier New", monospace; }
.journal-read-view .ql-size-small { font-size: 0.75em; }
.journal-read-view .ql-size-large { font-size: 1.5em; }
.journal-read-view .ql-size-huge { font-size: 2.5em; }

/* cursive/fantasy (2026-09-08, site owner: "include more font types") --
   UNLIKE serif/monospace above, quill.snow.css has no built-in rule for
   these two at all (they're outside Quill's own default whitelist), so
   BOTH the live editor and the read view need their own rule here, not
   just the read view. Plain CSS generic font families (no @font-face,
   no new dependency) -- exact rendered typeface is left to each
   browser/OS's own generic-family default, same "no new palette/asset"
   restraint every other rule in this file already follows. */
.ql-editor .ql-font-cursive, .journal-read-view .ql-font-cursive { font-family: cursive; }
.ql-editor .ql-font-fantasy, .journal-read-view .ql-font-fantasy { font-family: fantasy; }

/* Named web-safe fonts (2026-09-09, site owner: "we need more font
   types") -- same mechanism as cursive/fantasy above: real named
   typefaces instead of generic font-family keywords, each with a fallback
   stack for cross-platform compatibility. Like cursive/fantasy, these
   aren't in quill.snow.css's built-in rules, so both the live editor and
   read view need their own rules here. Plain CSS web-safe stacks (no
   @font-face, no new dependency) -- each stack is a common cross-platform
   choice per typeface. */
.ql-editor .ql-font-arial, .journal-read-view .ql-font-arial { font-family: Arial, Helvetica, sans-serif; }
.ql-editor .ql-font-georgia, .journal-read-view .ql-font-georgia { font-family: Georgia, "Times New Roman", serif; }
.ql-editor .ql-font-times, .journal-read-view .ql-font-times { font-family: "Times New Roman", Times, serif; }
.ql-editor .ql-font-courier, .journal-read-view .ql-font-courier { font-family: "Courier New", Courier, monospace; }
.ql-editor .ql-font-verdana, .journal-read-view .ql-font-verdana { font-family: Verdana, Geneva, sans-serif; }
.ql-editor .ql-font-trebuchet, .journal-read-view .ql-font-trebuchet { font-family: "Trebuchet MS", sans-serif; }
.ql-editor .ql-font-palatino, .journal-read-view .ql-font-palatino { font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; }
.ql-editor .ql-font-comicsans, .journal-read-view .ql-font-comicsans { font-family: "Comic Sans MS", "Comic Sans", cursive; }

/* Horizontal rule (2026-09-07, journal-editor-onenote-parity pass) -- a
   plain <hr> already inherits sane cross-browser defaults; this only
   swaps its color for the site's own line-color token (the browser
   default is a hardcoded gray, off-brand in dark mode especially) and
   gives it the same vertical rhythm as a paragraph so it doesn't sit
   flush against the text immediately above/below it. Shared between the
   live editor and the read view (no .journal-read-view/.ql-editor
   prefix needed) since it's a plain semantic tag with no Quill-specific
   class or attribute to key off, unlike every list rule above. */
hr { border: none; border-top: 1px solid var(--border-strong); margin: 1.2em 0; }

.ql-editor.ql-blank::before { color: var(--ink-faint); font-style: normal; }
/* Toolbar icon colors. One class more specific than quill.snow.css on
   purpose (2026-09-19 accessibility check): the editor's stylesheet is a
   lazily loaded chunk that arrives AFTER site.css, so at equal
   specificity Quill's own #444 icons and #06c hover/active blue won --
   #444 on the dark toolbar measured as barely visible. The site's own
   more specific button rules (Attach, Draw) still win over these. */
.ql-toolbar.ql-snow .ql-stroke, .ql-toolbar.ql-snow .ql-stroke-miter { stroke: var(--ink-soft); }
.ql-toolbar.ql-snow .ql-fill, .ql-toolbar.ql-snow .ql-stroke.ql-fill { fill: var(--ink-soft); }
.ql-toolbar.ql-snow .ql-picker { color: var(--ink-soft); }
.ql-toolbar.ql-snow .ql-formats button:hover,
.ql-toolbar.ql-snow .ql-formats button:focus-visible,
.ql-toolbar.ql-snow .ql-formats button.ql-active,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label:hover,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label.ql-active,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item:hover,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item.ql-selected { color: var(--accent-secondary-ink); }
.ql-toolbar.ql-snow .ql-formats button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button:focus-visible .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-stroke,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label.ql-active .ql-stroke,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item.ql-selected .ql-stroke { stroke: var(--accent-secondary-ink); }
.ql-toolbar.ql-snow .ql-formats button:hover .ql-fill,
.ql-toolbar.ql-snow .ql-formats button:focus-visible .ql-fill,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-fill,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label:hover .ql-fill,
.ql-toolbar.ql-snow .ql-formats .ql-picker-label.ql-active .ql-fill,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item:hover .ql-fill,
.ql-toolbar.ql-snow .ql-formats .ql-picker-item.ql-selected .ql-fill { fill: var(--accent-secondary-ink); }
/* quill.snow.css also colors a button blue while it merely has focus, so
   a mouse click left it looking selected (the More/Fewer tools chevron
   stayed blue). Keyboard focus still shows the accent via :focus-visible
   above; a clicked button that isn't an active format goes back to ink. */
.ql-toolbar.ql-snow .ql-formats button:focus:not(:focus-visible):not(.ql-active):not(:hover) { color: var(--ink-soft); }
.ql-toolbar.ql-snow .ql-formats button:focus:not(:focus-visible):not(.ql-active):not(:hover) .ql-stroke { stroke: var(--ink-soft); }
.ql-toolbar.ql-snow .ql-formats button:focus:not(:focus-visible):not(.ql-active):not(:hover) .ql-fill { fill: var(--ink-soft); }
/* The table plugin's icon has its gray (#515151) baked into the SVG --
   barely visible on the dark toolbar. Same ink as the other icons. */
.ql-toolbar.ql-snow button.ql-table-better svg path { fill: var(--ink-soft); }
.ql-toolbar.ql-snow button.ql-table-better:hover svg path,
.ql-toolbar.ql-snow button.ql-table-better:focus-visible svg path { fill: var(--accent-secondary-ink); }
/* Quill's own snow-theme buttons are a fixed 28x24px (quill.snow.css,
   bundled ahead of this file -- see main.css's own link tag in
   templates/base.html) -- measured well under the ~44px touch-target
   baseline (2026-09-04 UI smoke test). Vertical-only ::after, same
   invisible hit-slop idiom as .lookup-hint-dismiss/.journal-more-menu-btn
   above: Quill lays every button in a .ql-formats group out flush against
   its neighbor with zero margin between them, so widening this sideways
   would immediately overlap the next button over. Capped to this
   toolbar's own 0.6rem vertical padding (the rule just above) rather than
   the full 44px shortfall, so the invisible area never pokes out past the
   toolbar's own box into the editor content underneath it. */
.ql-snow.ql-toolbar button { position: relative; }
.ql-snow.ql-toolbar button::after {
  content: "";
  position: absolute;
  top: -0.6rem;
  bottom: -0.6rem;
  left: 0;
  right: 0;
}

/* Floating "+ Flashcard" popover shown on text selection inside
   .article-body -- static/js/site.js's initFlashcardSelection(). Keeps
   a box-shadow (like .search-results) since it's a functional
   floating-over-content element, not decorative card chrome -- but
   only a light one on a plain neutral border (2026-09-15, site owner:
   "I do not like the shading of the border of the word definition
   card"; the gold top stripe, blue-tinted border, and heavy two-layer
   shadow read as a smudged halo around the edges). */
.flashcard-popover {
  position: fixed;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: min(252px, calc(100vw - 24px));
  max-width: 100%;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: none;
}
/* Vocabulary mode (touch devices, static/js/site.js's tap-to-define path)
   renders the same popover as a bottom sheet instead of positioning it
   next to a selection rect -- there's no selection to anchor to on a tap,
   and a sheet is the more natural touch pattern anyway. .popover-backdrop
   is a plain full-viewport scrim behind it; tapping it normally dismisses
   (site.js's backdropClick(), same as the existing outside-mousedown
   dismiss), except when the tap lands back on a just-tapped link within
   the double-tap-to-follow window, where it navigates instead. */
.popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(0, 0, 0, 0.4);
}
.flashcard-popover.is-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-width: none;
  width: auto;
  max-height: 33vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  border-width: 1px 0 0;
}
.flashcard-popover-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.flashcard-popover-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.flashcard-popover-close:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent-secondary) 9%, transparent);
  border-color: color-mix(in srgb, var(--accent-secondary) 24%, transparent);
}
.flashcard-popover-close:focus-visible,
.flashcard-popover-save:focus-visible,
.flashcard-popover-define:focus-visible,
.popover-highlight-swatch:focus-visible {
  outline: 2px solid var(--brand-news-gold);
  outline-offset: 2px;
}
.flashcard-popover-saved {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--line-economics-ink);
}
.flashcard-popover-save, .flashcard-popover-define {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 40px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border: 1px solid var(--line-brand);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.flashcard-popover-close + .flashcard-popover-save,
.flashcard-popover-close + .flashcard-popover-define { margin-right: 2.35rem; }
.flashcard-popover-save:hover, .flashcard-popover-define:hover {
  filter: brightness(1.1);
}
.flashcard-popover-action-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid color-mix(in srgb, currentColor 60%, transparent);
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
}
.flashcard-popover-result { margin: 0; color: var(--ink-soft); }
/* Logged-out lookup nudge's secondary "Log in" (2026-09-18) -- a plain
   centred link under the solid "Sign up free" button. */
.flashcard-popover-login {
  align-self: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
}
.flashcard-popover-result a { color: var(--accent-secondary-ink); }
.flashcard-popover-error { margin: 0; color: var(--line-news-ink); }

mark.highlight-yellow, mark.highlight-green,
mark.highlight-pink, mark.highlight-blue {
  color: inherit;
  border-radius: var(--radius);
  padding: 0 1px;
}
mark.highlight-yellow { background: var(--highlight-yellow); }
mark.highlight-green  { background: var(--highlight-green); }
mark.highlight-pink   { background: var(--highlight-pink); }
mark.highlight-blue   { background: var(--highlight-blue); }

/* Comment icon (2026-08-30): applyOneHighlight (site.js) sets
   data-has-note only on the LAST <mark> segment of a highlight that has
   one, so a highlight spanning several words gets exactly one icon, at
   its end, rather than one per segment. */
mark[data-has-note]::after {
  content: "\1F4AC";
  font-size: 0.7em;
  margin-left: 0.15em;
  vertical-align: text-top;
}

.popover-highlight-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-soft);
  white-space: nowrap;
}
.popover-highlight-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.popover-highlight-swatches {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
}
.popover-highlight-swatch {
  position: relative;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 2px solid var(--paper-raised);
  outline: 1px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition: transform 0.15s ease, outline-color 0.15s ease, box-shadow 0.15s ease;
}
.popover-highlight-swatch:hover {
  transform: translateY(-2px) scale(1.06);
  outline-color: var(--ink-soft);
  box-shadow: none;
}
.popover-highlight-swatch[data-color="yellow"], .popover-highlight-selected[data-color="yellow"] { background: #e1b52d; }
.popover-highlight-swatch[data-color="green"], .popover-highlight-selected[data-color="green"]  { background: #2d9577; }
.popover-highlight-swatch[data-color="pink"], .popover-highlight-selected[data-color="pink"]   { background: #b65d80; }
.popover-highlight-swatch[data-color="blue"], .popover-highlight-selected[data-color="blue"]   { background: #5279b5; }
.popover-highlight-selected {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper-raised);
  border-radius: 50%;
  outline: 1px solid var(--border-strong);
  box-shadow: none;
}

.popover-highlight-note-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.popover-highlight-note-input {
  min-height: 68px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.65rem;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.popover-highlight-note-input:focus {
  border-color: var(--accent-secondary);
  outline: none;
  box-shadow: none;
}
.popover-highlight-note-save {
  align-self: flex-end;
  min-height: 34px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border: 1px solid var(--line-brand);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.popover-highlight-note-save:hover { filter: brightness(1.1); transform: translateY(-1px); }
.popover-highlight-note-save:focus-visible { outline: 2px solid var(--brand-news-gold); outline-offset: 2px; }

/* Existing-highlight actions need persistent button affordance: these
   commands otherwise read like two more lines of note text. */
.highlight-view-popover .flashcard-popover-result {
  margin-right: 2.35rem;
  min-height: 30px;
  display: flex;
  align-items: center;
}
.highlight-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.highlight-view-delete,
.highlight-view-note-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 36px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 0.42rem 0.65rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.highlight-view-note-btn {
  color: var(--accent-secondary-ink);
  background: color-mix(in srgb, var(--accent-secondary) 9%, var(--paper-raised));
  border: 1px solid color-mix(in srgb, var(--accent-secondary) 45%, var(--border));
}
.highlight-view-delete {
  color: var(--line-news-ink);
  background: color-mix(in srgb, var(--line-news) 8%, var(--paper-raised));
  border: 1px solid color-mix(in srgb, var(--line-news) 38%, var(--border));
}
.highlight-view-note-btn:hover {
  background: color-mix(in srgb, var(--accent-secondary) 16%, var(--paper-raised));
  border-color: var(--accent-secondary);
  transform: translateY(-1px);
}
.highlight-view-delete:hover {
  background: color-mix(in srgb, var(--line-news) 15%, var(--paper-raised));
  border-color: var(--line-news-ink);
  transform: translateY(-1px);
}
.highlight-view-note-btn:focus-visible,
.highlight-view-delete:focus-visible {
  outline: 2px solid var(--brand-news-gold);
  outline-offset: 2px;
}
.highlight-view-action-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gloss-pos {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.gloss-detail { margin: 0; font-size: 0.82rem; color: var(--ink-soft); }
/* First-language translation under a lookup's English meaning
   (2026-09-18) -- static/js/site.js's showGlossTranslation(). The
   language label is small and faint so the translation itself reads first. */
.gloss-translation { margin: 0; color: var(--ink); font-size: 0.95rem; }
.gloss-translation-lang {
  margin-inline-end: 0.4em;
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.gloss-translation.is-pending { color: var(--ink-faint); font-size: 0.82rem; }
/* A failed translation reads like the pending state, not like an error
   banner (2026-09-20): it is nearly always a transient provider hiccup
   and the next lookup works, so it should not shout. Before this, a
   failure rendered nothing at all and looked like a missing feature. */
.gloss-translation.is-failed { color: var(--ink-faint); font-size: 0.82rem; }
.gloss-translate-setup { margin: 0; font-size: 0.82rem; }
.gloss-translate-setup a { color: var(--accent-secondary-ink); }

/* Per-word "pronounce this" row (2026-08-28) -- the button is a plain
   Web Speech API trigger (static/js/site.js's initPronounceButtons()),
   independent of whether ipa (CMUdict-sourced) is present, so it renders
   even for a phrase or a word CMUdict doesn't have. .gloss-pronounce
   ships `hidden` in the template and stays hidden unless JS confirms
   speechSynthesis support -- display: inline-flex below is an
   author-origin rule, which beats the UA [hidden]{display:none} rule by
   itself (regardless of specificity), so [hidden] has to be
   re-asserted explicitly or the button would show even without support. */
.gloss-pronounce-row { display: flex; align-items: center; gap: 0.4em; margin: 0 0 0.4em; }
/* Given real button chrome (2026-09-05, design feedback: a bare emoji
   with no border/background/hit-area "reads as an unstyled leftover...
   looks like a broken image") -- same faint-circle-outline, brand-tint-
   on-hover language as .flashcard-delete-icon elsewhere in this file,
   scaled down for an inline row next to the IPA text rather than a
   card corner. */
.gloss-pronounce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8em;
  height: 1.8em;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.gloss-pronounce[hidden] { display: none; }
.gloss-pronounce:hover {
  border-color: var(--accent-secondary);
  background: color-mix(in srgb, var(--accent-secondary) 8%, var(--paper));
  color: var(--accent-secondary-ink);
}
.gloss-ipa { font-size: 0.82rem; color: var(--ink-faint); }

/* First-use hint shown once above .article-body, prompting readers to
   try the lookup/flashcard feature -- static/js/site.js's
   initLookupHint(). Dismissed via localStorage (its own × button, or
   automatically on the reader's first text selection inside the
   article), so it never appears again on this device. */
.lookup-hint {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  margin: 0 0 var(--space-2);
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.lookup-hint-dismiss {
  position: relative; /* anchors the ::after hit-area extension below */
  flex-shrink: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}
.lookup-hint-dismiss:hover { color: var(--ink); }
/* The "×" glyph itself measured ~10x16px live (2026-09-04 UI smoke test,
   most urgent of that pass's touch-target findings) -- an invisible
   ::after enlarges the tappable area to ~44x44 without growing the
   visible glyph. Safe to extend past the button's own edges here: it
   sits at the trailing end of .lookup-hint's flex row, against that
   element's own padding (0.5em 0.75em, this file's .lookup-hint rule
   above), with nothing else inside the hint itself for the extension to
   swallow. */
.lookup-hint-dismiss::after {
  content: "";
  position: absolute;
  inset: -14px;
}

/* "Continue where you left off" banner (2026-08-27 resume-reading-
   position design) -- server-rendered hidden, unhidden by
   initResumeBanner() in static/js/site.js only when a saved scroll
   position exists for this article. Same dismissible-strip visual
   treatment as .lookup-hint above. The [hidden] rule below is required --
   without it this element would render permanently visible regardless of
   the hidden attribute, exactly the bug the Reading Preferences sub-
   project's final review caught in .reading-prefs-panel (commit
   fd2371e) -- see static/css/site.css:294 (.back-to-top[hidden]) for the
   established correct precedent. */
.resume-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  margin: 0 0 var(--space-2);
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.resume-banner[hidden] { display: none; }
.resume-banner-text {
  flex: 1 1 auto;
  text-align: left;
  font: inherit;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-secondary-ink);
  cursor: pointer;
  text-decoration: underline;
}
.resume-banner-text:hover { color: var(--accent-secondary); }
.resume-banner-dismiss {
  flex-shrink: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}
.resume-banner-dismiss:hover { color: var(--ink); }

/* End-of-article reflection check (2026-08-27 article-completion-flow
   design) -- static/js/site.js's initEndOfArticleCheck(). Same
   dismissible-strip visual family as .lookup-hint/.resume-banner for the
   initial one-line offer; expands in place into the taller 3-step flow
   once clicked (that's why this rule isn't flex like .resume-banner's
   own top-level element -- .end-check-offer, not .end-check itself, is
   the flex row). The [hidden] rule is required regardless -- same
   established precedent as .back-to-top[hidden]
   (static/css/site.css:294). */
.end-check {
  margin: 0 0 var(--space-2);
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.end-check[hidden] { display: none; }
.end-check-offer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
}
.end-check-offer-text {
  flex: 1 1 auto;
  text-align: left;
  font: inherit;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-secondary-ink);
  cursor: pointer;
  text-decoration: underline;
}
.end-check-offer-text:hover { color: var(--accent-secondary); }
.end-check-dismiss {
  flex-shrink: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
}
.end-check-dismiss:hover { color: var(--ink); }
.end-check-step { display: flex; flex-direction: column; gap: 0.5em; }
.end-check-label { margin: 0; font-weight: 700; color: var(--ink); }
.end-check-textarea {
  width: 100%;
  min-height: 4.5em;
  font: inherit;
  padding: 0.5em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.end-check-flip-card {
  padding: 0.75em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
}
.end-check-flip-front { margin: 0; font-weight: 700; }
.end-check-flip-back { margin: 0.4em 0 0; color: var(--ink-soft); }
.end-check-next, .end-check-reveal, .end-check-save, .end-check-skip {
  align-self: flex-start;
  font: inherit;
  padding: 0.35em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
}
.end-check-next:hover, .end-check-reveal:hover, .end-check-save:hover, .end-check-skip:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}
/* 2026-09-12 learner-UX review -- Skip sits beside Next (step 1's own
   explicit "answer or deliberately skip" choice); plain flex row, no
   border/background of its own beyond what .end-check-skip above
   already gives both buttons. */
.end-check-step-actions { display: flex; gap: 0.5em; }
.end-check-skip { color: var(--ink-faint); }
.end-check-error { margin: 0; color: var(--line-news-ink); }
.end-check-saved { margin: 0; color: var(--ink-soft); }

/* ---------------------------------------------------------------------
   Article layout -- two columns on wide screens (design review,
   2026-08-20: "move the sticky TOC into a desktop sidebar, it consumes
   valuable vertical space before the article begins"). .article-rail
   holds the TOC (its "sources" panel was removed 2026-08-21, site owner:
   "remove this" -- redundant with the .sourcing link after .article-body);
   single column (rail falls in after the article, in source order) below
   the breakpoint, where a persistent side rail has nowhere to persist
   next to anyway.
   --------------------------------------------------------------------- */
.article-layout {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}
@media (min-width: 1000px) {
  /* .article-rail is now conditional (no TOC/keywords/related coverage
     renders no rail at all, since the newsletter widget that used to
     guarantee it always had content was removed 2026-09-01) -- gated on
     :has() so a rail-less article gets a single 1fr column instead of an
     empty 16rem second track sitting there unused. */
  .article-layout:has(.article-rail) {
    grid-template-columns: minmax(0, 1fr) 16rem;
  }
}

.article-rail-section {
  font-family: var(--font-body);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}
.article-rail-section + .article-rail-section { margin-top: var(--space-3); }

@media (min-width: 1000px) {
  .article-rail {
    /* Sticky below the masthead. --header-height is set by site.js's
       initHeaderHeightVar() from the actual rendered .site-header +
       .line-strip height, not hand-measured -- a hardcoded px value here
       went stale twice already (70px -> 112px across the 2026-08-19 nav
       restructure, then 112px itself went stale again and let the header,
       z-index 10, visually cover the top of this rail on scroll --
       confirmed live, 2026-08-21). 112px stays only as the pre-JS/no-JS
       fallback. */
    position: sticky;
    top: var(--header-height, 112px);
    max-height: calc(100vh - var(--header-height, 112px) - 20px);
    overflow-y: auto;
  }
}

/* In-article jump-to-section nav, built from the piece's own ## headings
   (see articles/views.py::_render_article_body -- the "toc" markdown
   extension generates both this and the matching heading anchor ids, so
   they can never drift out of sync with each other). A vertical list,
   not the old horizontal wrapped-tag row -- this now lives in a ~16rem
   sidebar, not the full content column that row was sized for.

   Rendered TWICE in detail.html from the same toc_html: once inline in
   the article flow (.article-toc-inline, right after the Summary card,
   same position as before the sidebar existed) and once in .article-rail.
   CSS shows exactly one per breakpoint -- a sidebar sibling of <article>
   can't also appear mid-flow inside it, so `order` can't solve this the
   way it solved the login page's two-panel reflow; rendering the same
   data twice and toggling display is the standard fix. .article-toc-inline
   keeps its own card chrome (background/border/padding) since it isn't
   wrapped in .article-rail-section the way the sidebar copy is. */
.article-toc-inline {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}
.article-rail .article-toc { display: none; }
@media (min-width: 1000px) {
  .article-toc-inline { display: none; }
  .article-rail .article-toc { display: block; }
}

.article-toc-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.5em;
}

.article-toc .toc { margin: 0; }
.article-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}
.article-toc ul ul { padding-left: 1em; margin-top: 0.4em; }

.article-toc li { margin: 0; }
.article-toc a {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.15em 0 0.15em 0.6em;
  margin-left: -0.6em;
  transition: color 0.15s ease;
}
.article-toc a:hover { color: var(--accent-secondary-ink); }

/* Anchor targets should land below the sticky header, not flush against
   it -- var(--header-height) matches .article-rail's sticky top offset
   above, same figure both rules need (see its comment for why this isn't
   a hardcoded px value). */
.article-body h2 { scroll-margin-top: calc(var(--space-4) + var(--header-height, 112px)); }

/* ---------------------------------------------------------------------
   References (Wikipedia-style numbered footnotes, via the markdown
   "footnotes" extension -- inline [1] markers link down to a numbered,
   back-linked list here, one entry per real source).
   --------------------------------------------------------------------- */
.article-body sup.footnote-ref { font-size: 0.75em; }
.article-body sup.footnote-ref a {
  color: var(--accent-secondary-ink);
  text-decoration: none;
  padding: 0 0.1em;
}
.article-body sup.footnote-ref a:hover { text-decoration: underline; }

.footnote {
  margin-top: var(--space-4);
  padding-top: var(--space-1);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.footnote::before {
  content: "References";
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-2);
}
.footnote hr { display: none; }
.footnote ol { padding-left: 1.3em; margin: 0; }
.footnote li { margin: 0.5em 0; }
.footnote a { color: var(--accent-secondary-ink); }
.footnote-backref { text-decoration: none; margin-left: 0.3em; color: var(--ink-faint); }

.sourcing {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

/* Plain text link, same treatment as "Past reactions →" right above it
   (2026-09-15, site owner: "make the primary source link style, not
   button style") -- was a bordered pill. */
.sourcing a {
  color: var(--accent-secondary-ink);
  font-weight: 600;
  text-decoration: none;
}

.sourcing a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   "How did this article make you feel?" (2026-09-06 article-reaction
   feature, replacing the old homepage-only "Answer today's question 🎤"
   speaking-practice flow) -- appears at the end of EVERY article's own
   page (articles/templates/articles/detail.html), right before
   .sourcing (sources moved below it 2026-09-15). Same border-top
   separator/spacing rhythm as .sourcing/.useful-expressions, for visual consistency
   with the other end-of-article sections. The record button/result
   panel/item styling itself is NOT duplicated here -- .speaking-
   practice-btn/-result/-item etc. (further down this file) are shared
   with this feature's markup unchanged, same shared-class reasoning as
   .journal-check-english-btn's own comment.
   --------------------------------------------------------------------- */
.article-reaction {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.article-reaction-heading {
  margin: 0 0 0.3em;
  font-family: var(--font-body);
  font-size: 1.1rem;
}
.article-reaction-intro {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.article-reaction-existing audio {
  width: 100%;
  margin: 0.5em 0;
}
.article-reaction-delete-btn {
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-2);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}
.article-reaction-delete-btn:hover { border-color: var(--line-news-ink); color: var(--line-news-ink); }
.article-reaction-history {
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.article-reaction-history a,
.article-reaction-login a {
  color: var(--accent-secondary-ink);
  font-weight: 600;
  text-decoration: none;
}
.article-reaction-history a:hover,
.article-reaction-login a:hover { text-decoration: underline; }
.article-reaction-login {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------
   Useful Expressions (2026-09-01, English-learning-system product
   review) -- pre-generated per article, articles.deepinfra.
   generate_useful_expressions. Card styling matches .article-rail-
   section's box (same background/border/radius) rather than inventing
   a new visual weight for "one more boxed thing on the page."
   --------------------------------------------------------------------- */
.useful-expressions {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.useful-expressions-heading {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 var(--space-3);
}

.useful-expression {
  font-family: var(--font-body);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.useful-expression + .useful-expression { margin-top: var(--space-3); }

.useful-expression-term {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.3em;
  color: var(--ink);
}

.useful-expression-meaning { margin: 0 0 0.5em; }

.useful-expression-example {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 0.5em;
}

.useful-expression-patterns {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0 0 var(--space-2);
}

.useful-expression-save {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.35em 0.9em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.useful-expression-save:hover:not(:disabled) { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.useful-expression-save:disabled { cursor: default; opacity: 0.75; }

.useful-expression-error {
  font-size: 0.8rem;
  color: var(--line-news-ink);
  margin: 0.4em 0 0;
}

/* ---------------------------------------------------------------------
   Related coverage -- same pillar, most recent, see
   articles/views.py::_related_articles. Lives in .article-rail as of
   2026-08-22 (Nature.com-style thumbnails in the sidebar, site owner
   request), inside an .article-rail-section like the TOC and keywords
   sections next to it -- no card chrome of its own needed.
   --------------------------------------------------------------------- */
.related-coverage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.related-coverage-list li {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
/* The flex item is the wrapping <a>, not the <img> (2026-09-14): with
   flex: none only on the img, the <a> shrank beside long headlines and
   the global img max-width squeezed the thumbnail into a ~30x72px
   sliver. The fixed 4:3 box lives on the <a>; its tint shows if an image
   fails to load, and items with no image_url render text-only. */
.related-coverage-thumb {
  display: block;
  flex: none;
  width: 4.5rem;
  height: 3.375rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink) 8%, var(--paper-raised));
}
.related-coverage-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
.related-coverage-text { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; }
.related-coverage-text a {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}
.related-coverage-text a:hover { text-decoration: underline; }
.related-coverage-text .article-list-meta { margin: 0.3em 0 0; font-size: 0.75rem; }

/* Keywords ("Subjects" on Nature.com) -- article.keywords, a short list
   of reader-recognizable topic tags, distinct from image_keywords (which
   never reaches a template, it's Pexels search input only). Pill style
   deliberately echoes .label (the format tag on cards) rather than
   .article-toc a's link-list treatment, since these read as tags, not a
   navigation list. */
.keyword-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}
.keyword-pills a {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25em 0.75em;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.keyword-pills a:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }

/* ---------------------------------------------------------------------
   Search widget (React island)
   --------------------------------------------------------------------- */
#search-widget { position: relative; font-family: var(--font-body); min-width: 200px; }
/* Desktop header (2026-10-14 UI audit: CLS 0.65-0.86 on every signed-in
   page at 1024px). The box's width came from its content, so it was ~200px
   until the React island mounted and ~240px after -- which pushed the nav
   links 50px right and wrapped the account avatar onto a second row,
   shoving the whole page down. A flex basis the empty container and the
   mounted input both obey keeps the header the same size before and after
   mount, and the smaller basis leaves room for the avatar on one row. */
@media (min-width: 701px) {
  #search-widget { flex: 1 1 170px; min-width: 170px; max-width: 240px; }
}

.search-widget input {
  /* type="search" gets its own native rounded-corner + clear-button chrome
     in WebKit/Chromium that plain border-radius doesn't fully override --
     appearance: none opts back into the plain box model like any other
     text input, which the flat/sharp-cornered direction needs here. */
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  /* The 2026-08-28 soft resting shadow was removed 2026-09-15 (site
     owner: "I do not like border shading") -- --border-strong alone
     defines the input. */
}
.search-widget input::-webkit-search-decoration,
.search-widget input::-webkit-search-cancel-button,
.search-widget input::-webkit-search-results-button,
.search-widget input::-webkit-search-results-decoration {
  display: none;
}

.search-widget input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: none;
}

/* Was unbounded height -- a real 8-result response (2026-09-04 UI smoke
   test) rendered ~810px tall in a 701px mobile viewport, spilling straight
   through .site-nav underneath it with no way to reach anything past
   whatever happened to fit on screen. max-height + its own scroll keeps
   the popup self-contained regardless of how many rows the endpoint sends
   (also capped server-side to 5 now, see articles/views.py::api_search --
   belt and suspenders, not an either/or). z-index only matters once this
   sits inside .site-header's own stacking context (z-index: 10, this
   file's Header section) -- 20 matches every other anchored dropdown
   already at that tier (.reading-prefs-panel, .journal-more-menu-panel),
   so this doesn't lose a tie if one of those is somehow open at the same
   time. */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: min(360px, 90vw);
  max-height: min(70vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
}
.search-results-status { padding: 0.6rem 0.7rem; font-size: 0.85rem; color: var(--ink-faint); }
/* Keyboard-highlighted row (Arrow Up/Down) -- same treatment
   .search-results li a:hover already gets below, just reachable without a
   mouse. */
.search-results li.is-active a { background: var(--paper); }
/* Below the same breakpoint the header itself starts wrapping
   (static/css/site.css's own .site-header mobile rules) -- a fixed,
   full-width sheet anchored under the sticky masthead instead of a
   360px-wide box anchored to the input's own right edge, which is what
   was overlapping .site-nav and running past the viewport's right/bottom
   edges on phones. var(--header-height) is the same reader-measured
   custom property .journal-list-pane/.journal-calendar-nav already
   anchor to below the header, kept in sync by site.js's
   initHeaderHeightVar(). */
@media (max-width: 799px) {
  .search-results {
    position: fixed;
    top: var(--header-height, 112px);
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100vh - var(--header-height, 112px));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

.search-results li a {
  display: block;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
}

.search-results li a:hover { background: var(--paper); }
.search-results .label { display: block; font-size: 0.62rem; width: fit-content; }

.search-results-see-all { border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.3rem; }
.search-results-see-all a { font-weight: 600; color: var(--accent-secondary-ink); text-align: center; }

/* ---------------------------------------------------------------------
   Full search-results page (/search/) -- server-rendered filters, not a
   React island, since there's no need for live-as-you-type behavior on a
   page whose whole point is a submitted, filtered, shareable-URL query.
   --------------------------------------------------------------------- */
.search-page-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.search-page-form input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 240px;
  font: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
.search-page-form input[type="search"]::-webkit-search-decoration,
.search-page-form input[type="search"]::-webkit-search-cancel-button,
.search-page-form input[type="search"]::-webkit-search-results-button,
.search-page-form input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

.search-page-form input[type="date"] {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}

.search-page-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-faint);
}

.search-page-form select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}

.search-page-form input[type="search"]:focus, .search-page-form input[type="date"]:focus, .search-page-form select:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: none;
}

.search-page-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.search-page-form button:hover { opacity: 0.88; }

.search-page-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0 0 var(--space-2);
}

/* ---------------------------------------------------------------------
   Format filter (topic pages) -- All / News Brief / Explainer / ... as
   a row of tabs, the same "you are here" underline+fill treatment
   .site-nav a.active already uses, at a smaller scale for a
   page-local filter rather than site-wide navigation.
   --------------------------------------------------------------------- */
.format-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-body);
}
.format-filter-link {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.format-filter-link:hover { color: var(--accent-secondary-ink); border-color: var(--border-strong); }
.format-filter-link.active {
  color: var(--accent-secondary-ink);
  background: color-mix(in srgb, var(--accent-secondary) 10%, transparent);
  border-color: var(--accent-secondary);
}
.format-filter-link:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

/* ---------------------------------------------------------------------
   Account pages (registration, login, profile, password change) — shared
   card shell + form styling.

   Top-edge accent is a plain --line-brand rule (was a four-color
   gradient echoing .line-strip; dropped 2026-08-19 along with the rest
   of the per-pillar color system -- see restrained-color-system commit).
   --------------------------------------------------------------------- */
.account-card {
  position: relative;
  max-width: 26rem;
  margin: var(--space-2) auto var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-3);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* The 3px brand accent stripe along the top edge was removed 2026-09-15
   (site owner: no edge stripes / border shading). Kept as an empty rule so
   pages that already zero it (e.g. .rss-feeds::before) stay harmless. */
.account-card::before { content: none; }
.account-card h1 { margin-top: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------------
   Auth page layout (currently: login) -- a two-panel composition instead
   of a lone card adrift in empty page space. The right panel is the
   .account-card (unchanged component); the left panel is .auth-pitch, an
   editorial "why log in" listing the site's four sections. Card comes
   first in markup (mobile shows the actual task immediately, not a
   scroll past marketing copy); grid-template-areas reorders it to the
   right on wide screens without touching tab order.
   --------------------------------------------------------------------- */
.auth-layout {
  display: grid;
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-2) 0 var(--space-5);
}
.auth-layout .account-card { margin: 0 auto; }
@media (min-width: 900px) {
  .auth-layout {
    grid-template-columns: 1.05fr 0.95fr;
    grid-template-areas: "pitch card";
  }
  .auth-pitch { grid-area: pitch; }
  .auth-layout .account-card { grid-area: card; }
}

/* 2026-10-16 refresh (site owner: "too ugly"): the pitch is now an
   eyebrow, a short headline and three concrete feature rows with line
   icons, replacing the six-row category legend that read as filler. The
   card gets a soft shadow instead of a flat slab, and the layout is
   vertically centred in the viewport on wide screens. */
@media (min-width: 900px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 25rem);
    gap: clamp(var(--space-5), 7vw, 7rem);
    min-height: min(42rem, calc(100vh - 12rem));
    max-width: 60rem;
    margin: 0 auto;
  }
  .auth-layout .account-card { margin: 0; max-width: none; }
}
.auth-layout .account-card {
  padding: var(--space-4);
  border-radius: calc(var(--radius) * 2);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 12px 32px -12px rgb(0 0 0 / 0.18);
}
.auth-layout .account-card h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.auth-layout .account-card > .dek { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }
.auth-field { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.auth-field-head label { font-size: 0.78rem; font-weight: 600; color: var(--ink-faint); }
.auth-field-head a,
.auth-resend a {
  font-size: 0.78rem;
  color: var(--accent-secondary-ink);
  text-decoration: none;
}
.auth-field-head a:hover,
.auth-resend a:hover { text-decoration: underline; }
.auth-resend { margin: var(--space-1) 0 0; text-align: center; font-family: var(--font-body); }

/* "Continue with Google" (2026-11-14, accounts/_google_button.html): Google's
   own light button -- white fill, 1px #747775 border, #1f1f1f text, the
   full-colour "G" -- in both themes, as its brand rules ask. Then an "or"
   divider before the password form. */
.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: var(--space-3);
  padding: 0.7rem 1.2rem;
  border: 1px solid #747775;
  border-radius: var(--radius);
  background: #ffffff;
  color: #1f1f1f;
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
}
.google-button:hover { background: #f7f8f8; color: #1f1f1f; }
.google-button:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.google-button-logo { flex: none; width: 18px; height: 18px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-1);
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.auth-pitch { max-width: 30rem; font-family: var(--font-body); }
.auth-eyebrow {
  margin: 0 0 var(--space-1);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-secondary-ink);
}
.auth-pitch h2 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}
.auth-pitch h2 span { white-space: nowrap; }
.auth-pitch .dek { margin: 0 0 var(--space-4); color: var(--ink-soft); }
.auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.auth-features li { display: flex; gap: 0.9rem; align-items: flex-start; }
.auth-features svg {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.45rem;
  border-radius: var(--radius);
  background: var(--paper-raised);
  border: 1px solid var(--border);
  fill: none;
  stroke: var(--accent-secondary-ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-features strong { display: block; color: var(--ink); font-size: 0.95rem; }
.auth-features span { display: block; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.45; }
/* Phones show the card first; the pitch below it drops to a compact recap. */
@media (max-width: 899px) {
  .auth-pitch { margin: 0 auto; }
  .auth-pitch h2 { font-size: 1.6rem; }
}
/* A legend, not a bulleted list -- small-caps-weight labels read as a
   system reference (how the pillar names already read as nav labels and
   .label badges elsewhere) rather than casual list copy. */
.line-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.line-legend li { display: flex; align-items: center; gap: 0.7rem; }
/* One mark, not four colors -- these four rows are one list of sections,
   not four different things. */
.line-swatch { width: 0.85rem; height: 0.85rem; border-radius: 0; flex-shrink: 0; background: var(--accent-secondary); }

.account-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-body);
  margin: var(--space-3) 0;
}
.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.account-form input {
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
.account-form input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: none;
}
/* A field with an error gets a red outline too, not just the text below
   it -- :has() lets the input react to its own error paragraph without
   forms.py or a widget_tweaks dependency neither of which this project
   uses elsewhere. */
.account-form label:has(.field-error) input {
  border-color: var(--line-news);
}
/* register.html's age_confirmation checkbox -- .account-form label's own
   base rule (column layout, bold small field-name styling) is right for
   every OTHER field here (a text input with its own label above it), but
   wrong for a checkbox: this overrides back to a plain inline row with
   normal body text, and un-does .account-form input's text-input
   styling (padding/border/background sized for a text box) so the
   checkbox itself renders at its native size.
   2026-09-15: `.account-form .account-form-checkbox`, not the bare class --
   the bare class (0,1,0) lost to `.account-form label` (0,1,1), so the row
   override never applied and the checkbox sat above its text. The terms
   checkbox made it visible: every text run and link became its own flex
   row. Its text is now wrapped in one <span> so it flows as a sentence. */
.account-form .account-form-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink);
}
.account-form-checkbox input[type="checkbox"] {
  flex: none;
  width: auto;
  margin: 0.15rem 0 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  background: var(--paper-raised);
}
.account-form button {
  align-self: stretch;
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  margin-top: var(--space-1);
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.account-form button:hover { background: var(--accent-secondary-ink); }
.account-form button:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .account-form button { transition: none; }
}

/* Chrome extension connect page (2026-09-18, accounts/extension.py). */
.extension-connect { max-width: 32rem; font-family: var(--font-body); }
.extension-connect-steps { margin: var(--space-3) 0 0; padding-left: 1.2rem; color: var(--ink); }
.extension-connect-steps li + li { margin-top: 0.35rem; }
.extension-connect-status { margin: var(--space-3) 0; color: var(--ink-soft); }
.extension-connect-done { color: var(--ink); font-weight: 600; }
.extension-connect-stuck { color: var(--line-news-ink); }
.extension-connect-status[hidden] { display: none; }
.extension-connection-remove {
  flex: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
}
.extension-connection-remove:hover { border-color: var(--line-news); color: var(--line-news-ink); }
.extension-connect-hint { font-size: 0.82rem; color: var(--ink-soft); }
.extension-connect-subhead { margin: var(--space-4) 0 var(--space-2); font-size: 1rem; font-weight: 600; }
.extension-connections { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.extension-connections li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-2);
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.extension-connection-name { font-weight: 600; color: var(--ink); }
.extension-connection-meta { grid-column: 1; font-size: 0.8rem; color: var(--ink-soft); }
.extension-connection-disconnect { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
.extension-connection-this {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.5rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); vertical-align: 0.1em;
}

/* Site-wide Django messages framework (2026-09-08, single-device-login
   design) -- first template rendering of {{ messages }} anywhere on
   this site; see templates/base.html's own comment. Same left-border-
   strip/tinted-background idiom as .account-error below, reusing
   --line-brand (this site's one restrained accent) for the default
   info level and --line-news/-ink (same as .account-error) for
   message.tags == "error", rather than introducing a new palette. */
.site-messages { list-style: none; margin: 0 0 var(--space-2); padding: 0; }
/* All of this request's messages may be ones a page shows itself
   (base.html skips /saved/'s "saved-inline" ones) -- no empty gap then. */
.site-messages:not(:has(li)) { display: none; }
.site-message {
  margin: 0 0 0.4rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--paper-raised);
  color: var(--accent-secondary-ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.site-message-error {
  border-color: var(--line-news);
  background: var(--paper-raised);
  color: var(--line-news-ink);
}

/* Non-field-level messages ("Incorrect username or password") -- a
   bordered strip with a faint tinted wash, so "this is an error" reads
   at a glance rather than depending on reading red text. */
.account-error {
  margin: 0 0 var(--space-2);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line-news);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--line-news-ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
/* Per-field messages -- compact text under the input, not another boxed
   strip, so a form with several invalid fields doesn't stack up boxes. */
.field-error {
  margin: 0;
  color: var(--line-news-ink);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
}
.field-hint {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 400;
}
.field-hint ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
/* Change email page (2026-09-17): how-it-works notes and the pending notice. */
.account-notes { margin: 0 0 var(--space-2); padding-left: 1.1rem; }
.account-notes li + li { margin-top: 0.25rem; }
.account-pending { margin: 0 0 var(--space-2); }
.account-card-footer {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}
.account-card-footer a { color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.account-card-footer a:hover { text-decoration: underline; }
/* .manage-subscription-form (Pro users only) was missing here, so as a
   block-level <form> it broke the profile footer onto three lines with
   "·" separators left dangling (2026-09-15, site owner screenshot). Each
   action also stays on one line, so the row only wraps between actions. */
.logout-form,
.manage-subscription-form { display: inline; }
.account-card-footer > a,
.account-card-footer > form { white-space: nowrap; }
/* Profile's action row: wraps between whole actions with even spacing.
   On narrow screens the "·" separators are hidden -- a wrapped row would
   otherwise leave one dangling at a line end -- and the gap alone
   separates the links. */
.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.4rem 0.5rem;
}
@media (max-width: 480px) {
  .account-actions-sep { display: none; }
  .account-actions { column-gap: 1.25rem; }
}
.account-card-footer button {
  font: inherit;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.account-card-footer button:hover { text-decoration: underline; }

/* 2026-09-06: the three Pro benefits used to be a vague, number-free
   bullet list ("more flashcards"). Now shares pages/_pricing_table.html
   with /pricing/, which needs .static-page's ~700px width to lay out 3
   columns without the scroll-hint kicking in on every viewport -- same
   .account-card-with-a-wider-modifier-class technique as .journal-trash's
   own 680px override, not the narrower 26rem .account-card default sized
   for a lone form. */
.upgrade-card { max-width: var(--content-width); }
.upgrade-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.upgrade-choices .account-form { flex: 1 1 14rem; }

/* Same review: the refund/cancellation fine print shared .account-card-
   footer's exact color/size with plain nav links elsewhere (Login's
   "Create one", Register's "Log in") that have no reason to be
   de-emphasized. Scoped smaller + fainter here rather than changing the
   shared class those other pages rely on. */
.upgrade-fine-print { color: var(--ink-faint); font-size: 0.78rem; }

/* One-time passes (2026-11-14), shared by /pricing/ and /upgrade/. */
.pass-options { margin-top: var(--space-4); scroll-margin-top: var(--space-4); }
.pass-options-dek { color: var(--ink-soft); }
.pass-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-2); }
.pass-choice { display: flex; flex-direction: column; gap: 0.15rem; text-align: left; padding: var(--space-2); border: 1px solid var(--rule, currentColor); border-radius: 8px; width: 100%; }
.pass-choice-name { font-weight: 600; }
.pass-choice-price { font-size: 1.15rem; }
.pass-choice-note { color: var(--ink-faint); font-size: 0.8rem; }
a.pass-choice { color: inherit; text-decoration: none; transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.15s; }
/* 2026-11-15 (owner): the hovered pass is highlighted, not just re-bordered
   in the colour it already had. Same 1px border, no edge band. */
a.pass-choice:hover, a.pass-choice:focus-visible {
  border-color: var(--accent-secondary);
  background-color: color-mix(in srgb, var(--accent-secondary) 8%, var(--paper));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent-secondary) 18%, transparent);
  transform: translateY(-2px);
}
a.pass-choice:hover .pass-choice-price, a.pass-choice:focus-visible .pass-choice-price { color: var(--accent-secondary-ink); }
@media (prefers-reduced-motion: reduce) { a.pass-choice { transition: none; } a.pass-choice:hover, a.pass-choice:focus-visible { transform: none; } }
/* 2026-11-15: Google sign-up shows the suggested username; changing it is optional. */
.google-finish-username { margin: 0; }
.google-finish-username-edit summary { cursor: pointer; color: var(--accent-secondary-ink); font-size: 0.92rem; }
.google-finish-username-edit[open] summary { margin-bottom: var(--space-2); }
/* 2026-11-15: "Probably a misspelling of ..." above a definition. */
.gloss-misspelling { margin: 0 0 0.25rem; font-size: 0.9rem; font-weight: 600; color: var(--accent-secondary-ink); }
.pass-options-blocked { color: var(--ink-soft); font-size: 0.9rem; }
/* On a filled button the faint ink is unreadable: follow the button's text. */
button.pass-choice .pass-choice-note { color: inherit; opacity: 0.85; }
/* 2026-11-15: /upgrade/ puts monthly and one-time side by side. */
.pay-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); align-items: start; margin: var(--space-3) 0 var(--space-4); }
.pay-options h2 { margin-top: 0; font-size: 1.15rem; }
.pay-options .pass-options { margin-top: 0; }
.pay-options .pass-list { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.pay-options .upgrade-choices { flex-direction: column; }
.upgrade-compare-heading { font-size: 1.15rem; }

/* 2026-09-12 learner-UX review -- separates Profile/Plan into their
   own labeled groups (see profile.html's own comment). Still small, so it
   doesn't compete with "Your account" -- but 2026-09-15 (site owner,
   screenshot of "PLAN" over "PLAN"): it was styled exactly like the
   .meta-label row labels beneath it (same size, weight, uppercase, faint
   ink), so a heading and a row label read as two identical rows. Normal
   case in full ink now, so the group heading and its labels are visibly
   different kinds of text. */
.account-section-heading {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: var(--space-3) 0 0;
}
.account-meta {
  list-style: none;
  margin: 0.4em 0 var(--space-3);
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.account-meta li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.account-meta li:last-child { border-bottom: none; }
/* Profile plan renewal/expiry row (2026-09-15): the note sits under the date. */
.account-meta .plan-date,
.account-meta .plan-subscription { text-align: right; }
.account-meta .plan-date-note,
.account-meta .plan-subscription-note { display: block; margin-top: 0.15rem; font-size: 0.82rem; color: var(--ink-soft); }
.plan-manage-form { display: inline; margin: 0; }
.plan-manage-form button {
  font: inherit;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.plan-manage-form button:hover { text-decoration: underline; }
/* Profile "Privacy" section (2026-09-17). */
.privacy-form {
  margin: 0.4em 0 var(--space-3);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.privacy-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0;
  color: var(--ink);
  cursor: pointer;
}
.privacy-toggle input { margin-top: 0.25rem; width: 1.05rem; height: 1.05rem; flex: none; accent-color: var(--line-brand); }
.privacy-toggle-hint { display: block; margin-top: 0.2rem; font-size: 0.82rem; color: var(--ink-soft); }
/* Profile "Learning" section (2026-09-18): the first-language picker. */
.learning-language { display: block; padding: 0.55rem 0 0.4rem; color: var(--ink); }
.learning-language-select {
  width: 100%;
  max-width: 22rem;
  font: inherit;
  padding: 0.5em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.learning-language-select:focus { border-color: var(--accent-secondary); outline: none; }
.privacy-save {
  margin-top: 0.3rem;
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.privacy-save:hover { background: var(--accent-secondary-ink); }
.privacy-save:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

/* Profile "Usage" section (2026-09-17): one bar per plan limit. Flat --
   hairline track, solid fill, no shading. */
.usage-list {
  list-style: none;
  margin: 0.4em 0 var(--space-2);
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.usage-row {
  padding: 0.45rem 0;
}
.usage-row:last-child { border-bottom: none; }
.usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--ink);
}
.usage-label { font-weight: 600; }
.usage-figures { color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-bar {
  height: 8px;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.usage-bar-fill {
  display: block;
  height: 100%;
  background: var(--line-brand);
  transition: width 0.4s ease-out;
}
.usage-warning .usage-bar-fill { background: var(--line-history); }
.usage-full .usage-bar-fill { background: var(--line-news); }
.usage-detail {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.usage-full .usage-detail strong { color: var(--line-news-ink); }
.usage-alert {
  margin: 0.4em 0 0;
  padding: var(--space-2);
  border: 1px solid var(--line-news);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
}
.usage-upgrade {
  margin: 0 0 var(--space-3);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.account-meta .profile-change-link { margin-left: 0.5rem; font-size: 0.85rem; }

/* ---------------------------------------------------------------------
   Account page (redesigned 2026-09-17, site owner: "more professional and
   fancy"). Flat by the site's rule: hairline borders, solid colour, no
   shadows, stripes or tinted fills. Identity header, then panels in a
   two-column grid on wide screens.
   --------------------------------------------------------------------- */
.profile-page {
  max-width: 60rem;
  margin: var(--space-3) auto var(--space-5);
  font-family: var(--font-body);
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1;
}
.profile-hero-text { flex: 1; min-width: 0; }
.profile-name {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.profile-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.profile-plan-badge {
  flex: none;
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.profile-plan-badge.is-pro {
  border-color: var(--accent-warm);
  background: var(--accent-warm);
  color: var(--accent-warm-on);
}
/* Account page tabs (2026-09-29) -- same idiom as .study-tabs/.study-tab
   above, reused rather than inventing a second tab pattern. Horizontally
   scrollable rather than wrapping so it stays a single row down to phone
   width, including inside the Capacitor app. */
.profile-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 1em;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin: var(--space-3) 0 var(--space-2);
}
.profile-tab {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5em 0.2em;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.profile-tab:hover { color: var(--accent-secondary-ink); }
.profile-tab.active { color: var(--ink); border-color: var(--accent-warm); }
.profile-tabpanel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.profile-tabpanel[hidden] { display: none; }
.profile-panel {
  min-width: 0;
  padding: var(--space-3) var(--space-4) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.profile-panel[hidden] { display: none; }
.profile-panel.app-settings { margin: 0; }
.profile-panel-title {
  margin: 0 0 var(--space-1);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.profile-rows { margin: 0 0 var(--space-1); }
.profile-rows li { align-items: baseline; }
.profile-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0 0.6rem;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.profile-value .profile-change-link { margin-left: 0; font-weight: 600; }
/* Sign-in methods' Disconnect (2026-11-14): a POST button that reads as a link. */
.profile-inline-form { display: inline; }
.profile-disconnect {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.profile-disconnect:hover { text-decoration: underline; }
.profile-disconnect:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.profile-panel .usage-upgrade { margin: var(--space-1) 0 var(--space-2); }
.profile-panel .privacy-form { margin: 0 0 var(--space-1); }
.profile-panel .usage-list { margin: 0 0 var(--space-1); }
@media (min-width: 760px) {
  .profile-panel-wide .usage-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-4);
  }
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-1);
  font-size: 0.92rem;
}
.profile-contact { flex-basis: 100%; margin: 0 0 var(--space-1); }
.profile-action-link { color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.profile-action-link:hover { text-decoration: underline; }
.profile-logout {
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.profile-logout:hover { border-color: var(--ink); }
.profile-actions .account-danger-link { margin-left: auto; }
@media (max-width: 480px) {
  .profile-hero { flex-wrap: wrap; padding: var(--space-3); gap: var(--space-2) var(--space-3); }
  .profile-avatar { width: 3.25rem; height: 3.25rem; font-size: 1.45rem; }
  .profile-panel { padding: var(--space-2) var(--space-3) var(--space-1); }
  .profile-page { margin-top: var(--space-2); }
}

.account-meta .meta-label {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
/* UI review, 2026-09-05: the highest-value link on the page (the one
   upsell CTA) was a completely plain default link, identical to every
   other inline link on the site -- bold it so it actually reads as the
   standout item in its row. */
.plan-upgrade-link { font-weight: 700; }
/* Same review: "Delete account" had identical styling to "Change
   password"/"Log out" despite being the one irreversible action here,
   and /saved/'s new per-bookmark "Remove" (added same review pass) is
   the same kind of destructive control. --line-news-ink is this file's
   own established danger-red (see the Design tokens comment at the top
   of this file) -- already reused by .saved-collection-delete/
   .saved-remove for the same "this one destroys something" signal, not
   a new color invented here. Qualified with the element type (a vs.
   button, each used by a different one of these) so this reusable
   utility class has enough specificity to beat both
   .account-card-footer a's color rule (profile page) and
   .saved-bookmark-form button's (saved-articles page) regardless of
   which markup it's applied to. */
a.account-danger-link,
button.account-danger-link {
  color: var(--line-news-ink);
}
a.account-danger-link:hover,
button.account-danger-link:hover {
  color: var(--line-news);
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
/* 2026-09-17 (site owner: "make the footnote similar to" a WSJ-style
   footer): one centered row of links split by hairline dividers, and a
   centered copyright line under it. Flat -- a hairline rule above, no
   fill. */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding: var(--space-4) var(--space-3);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: var(--space-2);
}

.footer-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0 var(--space-3);
  line-height: 1.2;
}
.footer-nav a + a { border-left: 1px solid var(--border); }
.footer-nav a:hover { text-decoration: underline; }

.footer-copyright {
  margin: var(--space-3) 0 0;
  color: var(--ink);
}

/* Narrow screens: the row wraps, and a divider starting a new line looks
   stray -- plain spacing instead. */
@media (max-width: 540px) {
  .footer-nav { column-gap: var(--space-3); }
  .footer-nav a { padding: 0; }
  .footer-nav a + a { border-left: 0; }
}

/* ---------------------------------------------------------------------
   Static/trust pages (About, Editorial Principles, Privacy, Terms, ...)
   --------------------------------------------------------------------- */
.static-page { max-width: var(--content-width); }
.static-page h2 { font-size: 1.25rem; margin-top: 2em; }
.static-page ul { padding-left: 1.2em; }
.static-page li { margin: 0.5em 0; }

/* Terms of Service / Privacy Policy (2026-09-15 rewrite). Long documents
   with a contents list: hairline-ruled, flat, no fill -- same idiom as
   every other bordered surface here. scroll-margin keeps a jumped-to
   heading clear of the sticky .site-header (whose height site.js
   publishes as --header-height). */
.legal-page h2,
.legal-page h3 { scroll-margin-top: calc(var(--header-height, 56px) + var(--space-3)); }
.legal-page h3 { font-size: 1.05rem; margin-top: 1.5em; }
.legal-page ul ul { margin: 0.25em 0; }
.legal-page code { font-size: 0.9em; overflow-wrap: anywhere; }
.legal-toc {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: var(--space-3) 0;
  padding: var(--space-2) 0;
}
.legal-toc ol {
  columns: 2 16rem;
  column-gap: var(--space-4);
  margin: 0;
  padding-left: 1.6em;
}
.legal-toc li { margin: 0.2em 0; break-inside: avoid; }

/* Pricing comparison table (UI review, 2026-09-05: two stacked bullet
   lists made comparing Free vs. Pro a scroll-and-match-up-from-memory
   exercise). overflow-x: auto wrap is defensive for narrow viewports --
   3 columns fits .static-page's 700px max-width comfortably in
   practice. Flat hairline borders + zero radius, same idiom as every
   other bordered surface on this site (.rss-feed-card, .account-card,
   ...) -- this is the site's first <table>, not a new visual language. */
.pricing-table-wrap { overflow-x: auto; margin-top: var(--space-3); }
.pricing-plan-prices { display: none; }
@media (max-width: 540px) {
  .pricing-plan-prices {
    display: block;
    margin: var(--space-3) 0 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
  }
  .pricing-plan-prices + .pricing-table-wrap { margin-top: var(--space-1); }
}
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.pricing-table th,
.pricing-table td {
  border: 1px solid var(--border);
  padding: 0.6em 0.9em;
  text-align: left;
  vertical-align: top;
}
.pricing-table thead th {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--border-strong);
}
/* Price on its own line under the plan name (2026-10-14, sentence case
   instead of the old all-caps header). */
.pricing-table-price {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
}
.pricing-table tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
/* Below 540px the three plan columns no longer fit, and a sideways
   scroll hid the paid plans (2026-09-18, launch-readiness plan item 2.7;
   the old "Scroll right" hint is gone). Each feature row stacks into its
   own hairline card instead: the feature name, then one line per plan,
   labelled from the cell's data-label (_pricing_table.html). The column
   headers are visually hidden, not removed -- the ARIA roles in the
   markup keep the table readable as a table. */
@media (max-width: 540px) {
  .pricing-table-wrap { overflow-x: visible; }
  .pricing-table,
  .pricing-table tbody,
  .pricing-table tr,
  .pricing-table th,
  .pricing-table td { display: block; }
  .pricing-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .pricing-table tbody tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6em 0.8em;
    margin-bottom: var(--space-1);
  }
  .pricing-table tbody th,
  .pricing-table td {
    border: none;
    padding: 0.2em 0;
    white-space: normal;
  }
  .pricing-table tbody th { font-size: 1rem; margin-bottom: 0.2em; }
  .pricing-table td {
    position: relative;
    padding-left: 6rem;
  }
  .pricing-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 0.35em;
    width: 5.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink-faint);
  }
  .pricing-table td:nth-of-type(n+2)::before { color: var(--accent-warm-ink); }
  .pricing-table td:nth-of-type(3)::before { color: var(--line-brand-ink); }
  /* Section rows become plain headings between the stacked cards. */
  .pricing-table tbody tr.pricing-table-section { border: none; padding: var(--space-2) 0 0; margin: 0; }
  .pricing-table .pricing-table-section th { font-size: 1.05rem; padding: 0; }
}
/* The one splash of brand color the original page had none of outside
   its links -- ties the Pro column to the brand accent used everywhere
   else (nav, buttons, card stripes), and gives Pro the "this is the one
   we want you to pick" visual weight a pricing page's upsell tier
   usually gets. */
/* No tinted column fill any more (2026-09-17, flat UI): the paid plans'
   headers carry the brand colour instead. */
/* Specificity, not source order, decides this: .pricing-table thead th
   above is a class + 2 type selectors (0,1,2); a bare .pricing-table-pro-col
   is only (0,1,0), so it lost even though it comes later in the file --
   the Pro column header actually rendered in --ink-faint (a plain gray,
   axe-core's automated scan measured it failing 4.5:1 contrast against
   its own pink-tinted background) instead of the AA-safe --accent-secondary-ink
   this rule always intended. Re-qualified with the same thead/th
   compound this is overriding so it actually wins (autonomous audit,
   2026-09-05). */
.pricing-table thead th.pricing-table-pro-col { color: var(--accent-warm-ink); border-bottom-color: var(--accent-warm); }
.pricing-cta-btn {
  display: inline-block;
  margin-top: var(--space-3);
  padding: 0.75rem 1.4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  background: var(--line-brand);
  color: var(--line-brand-on);
  border-radius: var(--radius);
}
.pricing-cta-btn:hover { background: var(--accent-secondary-ink); }
.pricing-cta-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
/* De-emphasized relative to .dek's default 1.1rem/--ink-soft (UI review:
   this footnote was the same visual weight as the page's own lede
   sentence) -- same "smaller + fainter via a scoped modifier" approach
   as .upgrade-fine-print on the Upgrade page. */
.pricing-fine-print { font-size: 0.82rem; color: var(--ink-faint); margin-top: var(--space-2); }
/* Pricing page (2026-10-14 redesign, three review rounds with Codex).
   One idea carries it: the plans read as one open strip, not three
   floating cards, joined by hairlines (no coloured tier bands: owner,
   2026-10-15). The price is the largest type on the page after the
   headline, and three plain numbers say what changes. Everything else
   stays quiet: flat surfaces, hairlines, the site's own tokens, so dark
   mode follows automatically. */
.pricing-page { max-width: 960px; }
/* No bar beside the headline (owner, 2026-10-15: no coloured edge bands). */
.pricing-hero { max-width: 56rem; }
.pricing-hero-kicker {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.pricing-hero-line {
  margin: 0.15em 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.pricing-hero-dek {
  margin: var(--space-2) 0 0;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 38rem;
}
.pricing-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.pricing-plan {
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}
.pricing-plan + .pricing-plan { border-left: 1px solid var(--border); }
.pricing-plan-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}
.pricing-plan-price {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  margin: var(--space-1) 0 0;
  color: var(--ink);
}
.pricing-plan-amount {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums;
}
.pricing-plan-period { font-size: 0.9rem; color: var(--ink-soft); }
.pricing-plan-for {
  margin: var(--space-2) 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  min-height: 4.5em;
}
.pricing-plan-keys { margin: var(--space-3) 0 var(--space-3); }
.pricing-plan-keys > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.45em 0;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}
.pricing-plan-keys dt { color: var(--ink-soft); }
.pricing-plan-keys dd {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.pricing-plan-action {
  align-self: flex-start;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.3rem;
  border-radius: var(--radius-pill);
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-weight: 600;
  text-decoration: none;
}
.pricing-plan-action:hover { background: var(--line-brand-ink); }
.pricing-plan-action:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 3px; }
.pricing-plan-action-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}
.pricing-plan-action-quiet:hover { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.pricing-plans-note { margin: var(--space-2) 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.pricing-compare { margin-top: var(--space-5); }
.pricing-compare h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
}
/* The phone-only price line repeats what the plan strip already shows. */
.pricing-page .pricing-plan-prices { display: none; }
/* Paid columns get the faintest tint of their tier colour, so a row reads
   across to the right plan without colour being the only cue (the headers
   name the plans). */
.pricing-page .pricing-table td:nth-of-type(2) { background: color-mix(in srgb, var(--accent-warm) 5%, var(--paper)); }
.pricing-page .pricing-table td:nth-of-type(3) { background: color-mix(in srgb, var(--line-brand) 6%, var(--paper)); }
.pricing-table thead th.pricing-table-super-col { color: var(--line-brand-ink); border-bottom-color: var(--line-brand); }
.pricing-notes { margin-top: var(--space-2); }
/* Column widths: the paid columns carry the longest text (round 2). */
.pricing-col-feature { width: 24%; }
.pricing-col-free { width: 18%; }
.pricing-col-pro,
.pricing-col-super { width: 29%; }
/* Section rows group the 14 limits into three blocks. */
.pricing-table .pricing-table-section th {
  padding-top: 1.1em;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border-left-color: transparent;
  border-right-color: transparent;
}
.pricing-table tbody:first-of-type .pricing-table-section th { padding-top: 0.7em; }
.pricing-notes .pricing-fine-print { color: var(--ink-soft); }
.pricing-details { margin-top: var(--space-2); }
.pricing-details summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 44px;
  list-style: none;
  font-weight: 600;
  color: var(--ink);
}
.pricing-details summary::-webkit-details-marker { display: none; }
/* inline-flex drops the native marker, so the disclosure cue is drawn:
   a chevron that turns down when open. */
.pricing-details summary::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.pricing-details[open] summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .pricing-details summary::before { transition: none; } }
.pricing-details summary:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 2px; border-radius: var(--radius-sm); }
@media (max-width: 760px) {
  .pricing-plans { grid-template-columns: 1fr; border-bottom: none; }
  .pricing-plan { padding: var(--space-3) 0; }
  .pricing-plan + .pricing-plan { border-left: none; }
  .pricing-plan-for { min-height: 0; }
}
@media (max-width: 540px) {
  .pricing-page .pricing-table td:nth-of-type(n) { background: none; }
}

/* No-refunds notice (2026-09-18): plain text in full ink so it isn't missed. */
.pricing-refund-note {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
}

/* About page (2026-09-05 design pass) -- built entirely from the site's
   existing single-accent, flat-card language (.secondary-card's
   border+left-stripe, .story-grid's auto-fit sizing, .line-legend's "one
   mark, not four colors" swatch) rather than introducing new colors or
   imagery, so it reads as a designed page without drifting from the
   Nature-style restraint the rest of the site uses. */
.about-section { margin-bottom: var(--space-4); }
.about-lede {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  margin: var(--space-3) 0 var(--space-2);
}

/* The five "every piece answers" questions as quiet tag chips instead of
   a bulleted list -- .label already carries the site's one-accent
   quiet-text treatment, just reset out of .static-page's <ul>/<li>
   spacing so the chips wrap in a tight row. */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 0.7em;
  padding-left: 0;
  list-style: none;
}
.tag-row li { margin: 0; }

/* Feature grid -- same auto-fit sizing as .story-grid, same bordered/
   left-accent card as .secondary-card, kept as its own class (not reused
   directly) so this page's markup stays independent of the homepage
   story-card patterns. */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0;
}
.feature-card {
  background: var(--tool-plate);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: background-color 0.15s ease;
}
.feature-card:hover { background: var(--tool-plate-hover); }
.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.4em;
}
.feature-card p { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

/* "How it works" (2026-09-18): three steps, each a short text beside a
   phone-size screenshot from scripts/about_screenshots.py. Flat like the
   rest of the site -- a hairline border, no shadow or device frame. Each
   shot has a light and a dark file; the one not matching the theme is
   display: none, and loading="lazy" means it is never downloaded. */
.static-page .about-steps {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  counter-reset: about-step;
}
.static-page .about-step {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-3) var(--space-4);
  align-items: center;
  margin: 0 0 var(--space-4);
  counter-increment: about-step;
}
.about-step-text h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.4em;
}
.about-step-text h3::before {
  content: counter(about-step);
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.55em;
  border-radius: 50%;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.85rem;
  vertical-align: 0.1em;
}
.about-step-text p { color: var(--ink-soft); margin: 0; }
.about-steps-plain .about-step-text h3::before { content: none; }
/* The one-minute tour video (2026-11-20, scripts/howto_video.py), above
   the steps. Same hairline frame as the screenshots; the video is light
   in both themes, like the screenshots' light files. */
.about-video { margin: var(--space-3) 0 var(--space-4); }
.about-video figcaption { margin: 0 0 var(--space-2); color: var(--ink-soft); font-size: 0.95rem; }
.about-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.about-shot { margin: 0; }
.about-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.about-shot .about-shot-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .about-shot .about-shot-light { display: none; }
  :root:not([data-theme="light"]) .about-shot .about-shot-dark { display: block; }
}
:root[data-theme="dark"] .about-shot .about-shot-light { display: none; }
:root[data-theme="dark"] .about-shot .about-shot-dark { display: block; }
@media (max-width: 600px) {
  .static-page .about-step { grid-template-columns: 1fr; }
  .about-shot { max-width: 260px; margin: 0 auto; }
}

/* Pillar legend -- .line-legend's own swatch mark ("one mark, not four
   colors") extended with a description per row and laid out two-up on
   wide screens, since About has room .auth-pitch's single column didn't. */
.pillar-legend {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem 1.5rem;
}
.pillar-legend li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.pillar-legend .line-swatch { margin-top: 0.3em; }

.about-footnote {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.about-footnote .section-heading { margin-bottom: 0.5em; }
.about-footnote p:not(.section-heading) { color: var(--ink-soft); margin: 0; }

.legal-draft-notice {
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--line-history) 15%, var(--paper-raised));
  border: 1px solid var(--line-history);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}

/* Same treatment as .legal-draft-notice (amber "pay attention" tint) --
   see articles/views.py::_parsed_corrections and Article.add_correction.
   Deliberately NOT inferred from updated_at; only ever populated by an
   explicit dashboard action, so every entry here is a real, human-recorded
   correction, not routine editing noise. */
.correction-notice {
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--line-history) 15%, var(--paper-raised));
  border: 1px solid var(--line-history);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.correction-notice ul { margin: 0.4em 0 0; padding-left: 1.2em; }
.correction-notice li { margin: 0.3em 0; }

/* ---------------------------------------------------------------------
   Small screens -- checked against real phone widths (320-414px box
   math), not just eyeballed. Search box goes full-width on its own row
   because at these widths there genuinely isn't room for it next to a
   4-item nav; everything else keeps its normal single-column flow, which
   this layout was already mobile-first about.
   --------------------------------------------------------------------- */
@media (max-width: 540px) {
  .site-header { padding: var(--space-1) var(--space-2); column-gap: var(--space-2); }

  /* Confirmed live, 2026-08-17: "Higher Education" alone was enough to
     wrap the nav row itself line-by-line, and the old #search-widget rule
     below forced a THIRD full-width row on top of that -- an unusually
     tall header for what it shows. .site-nav's own row-2 placement is now
     the base rule (see above, not mobile-only); what's mobile-specific
     here is making that row scroll horizontally instead of wrapping
     line-by-line, so it only ever costs one row no matter how many
     pillars exist later. "Higher Education" also shrinks to "Higher Ed"
     here specifically because it was the single widest label forcing the
     wrap. */
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* 2026-09-01, site owner: nav scrolling "not smooth" -- touch-action
       tells the browser up front that this element owns horizontal
       panning, so a swipe commits to scrolling it immediately instead of
       the browser first waiting to see whether the gesture turns out to
       be the page's own vertical scroll (the default ambiguous-gesture
       delay any nested horizontal-scroll region has otherwise). That
       initial hesitation is what reads as "not smooth" on a touchscreen,
       more than anything about the scroll motion itself once it starts.
       scroll-behavior only helps a future *programmatic* scroll (e.g.
       scrolling a link into view) ease instead of jumping -- harmless to
       set now even though nothing currently triggers one. */
    touch-action: pan-x;
    scroll-behavior: smooth;
    gap: var(--space-1) var(--space-2);
    font-size: 0.8rem;
    margin-top: 0;
    padding-top: var(--space-1);
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 0.4rem 0.6rem 0.55rem; white-space: nowrap; flex-shrink: 0; } /* taller tap target than the desktop 0.25rem */
  .label-full { display: none; }

  /* Added 2026-08-30: the nav's own scrollbar is hidden above (both the
     standards `scrollbar-width: none` and the WebKit pseudo-element), which
     was flagged live on a 320px phone -- Education/Tech/Science/Health/
     Editorial were fully present and clickable, just scrolled off-screen
     with no visual sign more existed. This restores that sign without
     bringing back a literal scrollbar. Width and gradient stop both tuned
     to read as "content fading under something," not a hard edge -- fades
     to --paper-raised specifically (not --paper) since that's .site-
     header's own (solid, as of 2026-09-14) background, so the fade
     matches it exactly. */
  .site-nav-fade {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to right, transparent, var(--paper-raised));
    opacity: 1;
    transition: opacity 0.15s ease;
  }
  .site-nav-fade.is-hidden { opacity: 0; }

  /* #search-widget is swapped for the .app-header-search icon link at
     this width -- see the 540px block after html.header-compact's rules
     further down (it has to come after .app-header-search's own base
     display: none). */


  /* Free up width on the narrowest phones (320-375px) where the default
     20px content padding leaves cramped room. */
  .site-main, .site-footer { padding-left: var(--space-2); padding-right: var(--space-2); }

  .article-toc { padding: var(--space-2); }
  .lead-story h1 { font-size: 1.7rem; }
  article h1 { font-size: 1.5rem; }
}

/* Any table (currently just the dashboard's article list) scrolls
   sideways inside its own box on narrow screens instead of forcing the
   whole page to scroll horizontally. */
.dash-table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------------------
   Print -- strip everything that only makes sense on-screen (chrome,
   interactive widgets, reading aids) and let the article read like a
   printed page: title, byline, body, and the primary source so the
   printed copy still traces back to where it came from.
   --------------------------------------------------------------------- */
@media print {
  .site-header, .line-strip, .reading-progress, .back-to-top,
  .site-footer, .article-actions, .article-toc,
  .saved-link,
  .legal-draft-notice, .resume-banner, .reading-tally, .end-check {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  article { max-width: 100%; }
  a { color: #000; text-decoration: underline; }
  .sourcing a::after { content: " (" attr(href) ")"; font-size: 0.85em; }

  /* Journal entry "Export as PDF" (site owner, 2026-08-22) -- reuses the
     browser's native print-to-PDF rather than a new server-side PDF
     library, same pattern as the article rules just above. Only the
     Read-mode .article-body content prints, regardless of which mode
     was active on screen -- static/js/site.js's initJournalExport
     forces Read mode and calls window.print() together, but these
     rules hold even if print is triggered some other way (Ctrl+P). The
     !important on the read panel overrides its `hidden` attribute's
     UA-stylesheet display:none. */
  .journal-list-pane, .journal-entry-toolbar,
  .journal-autosave-status, .journal-entry-article,
  [data-journal-mode-panel="write"] {
    display: none !important;
  }
  [data-journal-mode-panel="read"] { display: block !important; }
  .journal-layout { display: block; }
  .journal-detail-pane { padding: 0; }
}

/* App-only pull-to-refresh indicator (static/js/site.js's
   initPullToRefresh()) -- tucked above its own resting slot via a negative
   margin-top equal to its height, so at rest (transform: none, the JS
   default) it's fully hidden above the header line; JS slides it down via
   an inline transform as the gesture progresses. Sits at var(--header
   -height) rather than the viewport top so it appears BELOW the sticky
   header, not behind/under it. */
html.capacitor-app .pull-refresh-indicator {
  position: fixed;
  top: var(--header-height, 60px);
  left: 0;
  right: 0;
  height: 44px;
  margin-top: -44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}

.pull-refresh-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.pull-refresh-indicator.armed .pull-refresh-icon {
  transform: rotate(180deg);
}

.pull-refresh-indicator.spinning .pull-refresh-icon {
  animation: pull-refresh-spin 0.6s linear infinite;
}

@keyframes pull-refresh-spin {
  to { transform: rotate(360deg); }
}

/* App-only compact header (2026-08-30, site-owner feedback: the header's
   search bar + Log in button + avatar rows "take too much space" --
   compare to a WSJ-style app's single slim brand bar). Everything hidden
   here is either redundant with .app-bottom-nav (Saved/Study/Journal/
   Feeds all have a bottom-nav tab) or has an app-only compact stand-in
   added alongside it (.app-header-search for #search-widget's full
   inline bar, .app-header-account for .account-link's bordered "Log in"
   button). .site-nav (the pillar row) is untouched -- the complaint was
   about the rows above it, not that row itself.

   .account-avatar is NOT in this hide list (2026-08-31, site-owner: put
   account access back on the header row instead of its own bottom-nav
   tab) -- it's already a compact circular badge on desktop, so it needs
   no app-only stand-in the way the rectangular .account-link button
   does; it just stays visible everywhere now.

   .reading-prefs-theme-group is hidden here for a different reason than
   the rest of this list (2026-08-31, site-owner: "we do not need the
   icon to adjust light mode, just follow the system's mode") -- not
   space, but removing the manual override entirely in-app. No app-only
   stand-in, since there's nothing to replace: templates/base.html's
   before-paint script skips applying (and clears) any saved override
   when html.capacitor-app is set, so the app always tracks
   prefers-color-scheme with no toggle needed at all. The header's own
   .theme-toggle button used to be hidden here for the same reason, but
   was removed from the markup entirely 2026-09-04 (site owner: "just
   let the website follow the theme of the system") rather than kept
   and app-hidden -- the Aa panel's theme buttons were kept on the
   website on request, so they're still hidden in-app here. */
html.capacitor-app #search-widget,
html.capacitor-app .saved-link,
html.capacitor-app .study-link,
html.capacitor-app .journal-link,
html.capacitor-app .feeds-link,
html.capacitor-app .applications-link,
html.capacitor-app .courses-link,
html.capacitor-app .speaking-link,
html.capacitor-app .speaking-menu,
html.capacitor-app .account-link,
html.capacitor-app .header-info-link,
html.capacitor-app .reading-prefs-theme-group {
  display: none;
}

/* Hide the news-topic pillar row (Home/World/Editorial/...) and its red
   accent line on PERSONAL/UTILITY pages (2026-09-02 for Journal;
   broadened 2026-09-03, site owner: "the ui should be concise and
   clear"). The topic pillars (World / Editorial / Education / ...) are
   for browsing news, so they belong only on the news-browsing pages --
   Today (home), the topic pages, article detail, search. On Saved,
   Study, Journal, Feeds, Dashboard, Messages, and the account/auth
   pages (empty active_pillar) they're unrelated chrome that duplicates
   the utility nav right above it. Each page's own <h1> ("Saved
   articles", "Study", "Your feeds", ...) is its real header.
   data-active-pillar is templates/base.html's existing hook; the
   empty-string match covers the account/login/register pages, which
   set no pillar.

   2026-09-12, learner-UX review, revisiting the 2026-09-03 call above:
   this was originally scoped to html.capacitor-app only -- "the website
   keeps full navigation on every page, since a browser tab benefits
   from the site chrome an app screen doesn't." Site owner's own re-
   review concluded that argument doesn't hold up in practice on the
   website either: the category row eats a full row of vertical space
   above the page's own content on every one of these pages, disagrees
   with the utility nav right above it about what's "active" (neither
   highlights the other's current page), and a reader mid-review, mid-
   entry, or mid-feed-settings loses that in-progress work by clicking a
   category link that was never relevant to what they were doing here in
   the first place. The `html.capacitor-app` scope is dropped -- one
   rule, not two -- rather than kept alongside a newly-redundant
   web-only copy of the same declaration. Saved and Dashboard follow the
   app's own existing precedent for the identical reasoning (a personal
   list/hub, not a way to browse THIS category of news) even though
   today's review specifically named only Study/Journal/Feeds/Account/
   Messages. */
body[data-active-pillar="journal"] .site-nav-wrap,
body[data-active-pillar="journal"] .line-strip,
body[data-active-pillar="saved"] .site-nav-wrap,
body[data-active-pillar="saved"] .line-strip,
body[data-active-pillar="study"] .site-nav-wrap,
body[data-active-pillar="study"] .line-strip,
body[data-active-pillar="feeds"] .site-nav-wrap,
body[data-active-pillar="feeds"] .line-strip,
body[data-active-pillar="messages"] .site-nav-wrap,
body[data-active-pillar="messages"] .line-strip,
body[data-active-pillar="dashboard"] .site-nav-wrap,
body[data-active-pillar="dashboard"] .line-strip,
body[data-active-pillar=""] .site-nav-wrap,
body[data-active-pillar=""] .line-strip {
  display: none;
}
/* 2026-11-15: a signed-out visitor's nav row is How it works / Pricing /
   About / Support (base.html), the way around the site rather than news
   categories, so the website keeps it on pages with no pillar (About,
   Help, Pricing). Not in the app, which has its own bottom bar. */
html:not(.capacitor-app) body[data-signed-in="0"][data-active-pillar=""] .site-nav-wrap { display: flex; }
.help-toc { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0 var(--space-3); }
.help-item { border-bottom: 1px solid var(--border); padding: var(--space-2) 0; }
.help-item summary { cursor: pointer; font-weight: 600; }
.help-item p { margin: var(--space-2) 0 0; }
.help-footer { margin-top: var(--space-4); }

/* ...and paint the sticky header in --paper here (2026-09-03 design
   review) rather than .site-header's own --paper-raised, so it matches
   the journal pages' own background and the seam against the calendar's
   sticky weekday bar disappears. (The sitewide header itself is solid
   too since 2026-09-14 -- this rule is now only about that color.) */
html.capacitor-app body[data-active-pillar="journal"] .site-header {
  background: var(--paper);
}

/* App-only: hide the website's own footer (2026-09-01, site owner: "do
   not show these at the bottom of the app when pulling the content to
   the end, it is ugly") -- a legal/about-page link list (Editorial
   Principles, Sources & Attribution, Privacy, Terms, RSS...) reads as
   website chrome, not something a native app scrolls into at the end of
   an article; the app's own bottom nav bar already serves as its
   "footer". No app-only stand-in needed, same as .theme-toggle above --
   there's nothing here worth replacing in-app. */
html.capacitor-app .site-footer {
  display: none;
}

.app-header-search,
.app-header-account {
  display: none;
}

/* 2026-09-13, CNA-inspired compact-header-on-scroll design review --
   html.header-compact reuses these app-only compact icon stand-ins on
   the ordinary website too (static/js/site.js's
   initCompactHeaderOnScroll() toggles the class; see that function's
   own comment for why). #search-widget/.account-link hide the same way
   they already do in-app -- see the html.header-compact rule further
   below, next to html.capacitor-app's own equivalent. */
html.capacitor-app .app-header-search,
html.capacitor-app .app-header-account,
html.header-compact .app-header-search,
html.header-compact .app-header-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink-soft);
  text-decoration: none;
}

html.capacitor-app .app-header-search:hover,
html.capacitor-app .app-header-account:hover,
html.header-compact .app-header-search:hover,
html.header-compact .app-header-account:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}

html.capacitor-app .app-header-search svg,
html.capacitor-app .app-header-account svg,
html.header-compact .app-header-search svg,
html.header-compact .app-header-account svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* #search-widget/.account-link hide under html.header-compact the same
   way they do under html.capacitor-app (that rule is further up this
   file, combined with a few app-only hides this scroll-triggered
   class doesn't share -- .saved-link/.study-link/.journal-link/
   .feeds-link/.reading-prefs-theme-group stay visible when merely
   scroll-compact, per "Shrink, keep everything reachable": those
   aren't the discoverability problem CNA's own compact header has,
   only search and sign-in are). */
html.header-compact #search-widget,
html.header-compact .account-link,
html.header-compact .header-info-link {
  display: none;
}

/* Phone widths (2026-09-14): logo + full search input + star + "Log in"
   wrapped the top bar onto two rows above the nav (three rows total at
   390px). Collapse search to the same .app-header-search icon link the
   compact header uses -- it opens the no-JS /search/ page, keeps its
   aria-label, and is a normal focusable link -- so the bar stays one row
   down to 320px. "Log in" keeps its text label. */
@media (max-width: 540px) {
  #search-widget { display: none; }
  .app-header-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--ink-soft);
    text-decoration: none;
  }
  .app-header-search:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
  .app-header-search svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
}

/* Matches .app-header-search/.app-header-account's 34px so the header's
   compact icons (search, account) read as one consistent row rather
   than one slightly-smaller circle among them. .messages-link (2026-09-08)
   is shown in-app the same unstyled way .account-avatar already was
   before this rule existed -- no separate app-only stand-in, same
   reasoning templates/base.html's own comment gives for account-avatar --
   so it needs the same explicit sizing here. */
html.capacitor-app .account-avatar,
html.capacitor-app .messages-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

/* Tighter than the website's own header padding, matching a native app's
   slimmer top bar now that this row is just the wordmark + one icon
   rather than wordmark + search bar + login + avatar. */
html.capacitor-app .site-header {
  padding: var(--space-1) var(--space-2);
  /* Found 2026-08-31 on a real Android 16 phone (the newsplaza_dev AVD
     only runs Android 14, so this never surfaced there): Capacitor's own
     Bridge forces the WebView edge-to-edge (decorFitsSystemWindows
     false) independent of the app's target-SDK edge-to-edge defaults --
     confirmed by testing an android:windowOptOutEdgeToEdgeEnforcement
     theme flag first (MainActivity's own themes, mobile/android/app/src/
     main/res/values/styles.xml), which had zero effect, meaning
     Android's automatic per-SDK enforcement was never the actual cause
     here. Without this, the status bar goes transparent and the header
     draws underneath it, clipping the "Biblinkage" wordmark right under
     the clock/battery icons. Same fix, same reasoning, as the bottom
     nav's own --app-nav-safe-bottom below -- env() resolves to 0px on
     anything that doesn't report a safe-area inset (older WebViews,
     landscape), so this is a no-op everywhere except where it's needed. */
  padding-top: calc(var(--space-1) + env(safe-area-inset-top, 0px));
  /* 2026-09-05, same real phone, rotated to landscape with 3-button nav
     (not gesture nav): confirmed via uiautomator that the WebView's own
     bounds are the full screen rect with zero reserved strip for the
     system nav buttons, which move to a side edge in landscape -- the
     account avatar/search icons were rendering directly under them.
     Only top/bottom insets existed before this; left/right were never
     added because the AVD used for the original 2026-08-31 fix has no
     way to test landscape 3-button nav specifically. Same no-op-when-
     unneeded reasoning as padding-top above. */
  padding-left: calc(var(--space-2) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--space-2) + env(safe-area-inset-right, 0px));
}

/* App-only compact login/account card -- site-owner feedback: the default
   .account-card (max-width: 26rem, sized as a genuinely centered card on
   a desktop/tablet auth page split-layout) reads as oversized and
   edge-to-edge rather than a distinctly centered card on a phone-width
   viewport, where there's little to no room left over between the card
   and the screen edge to actually show the centering. Desktop/tablet and
   the regular mobile website are untouched -- only the app gets a
   tighter max-width and smaller field/button padding. */
html.capacitor-app .account-card {
  max-width: 300px;
  margin: var(--space-3) auto;
  padding: var(--space-3) var(--space-3) var(--space-2);
}

html.capacitor-app .account-form input {
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
}

html.capacitor-app .account-form button {
  padding: 0.65rem 1.2rem;
}

/* App-only: hide the marketing pitch panel entirely on the login/
   register pages (2026-09-03, site owner: "we do not need this part in
   the login page on the android app"). The "One account. Journal it.
   Flashcard it. Keep it." heading, its dek, and the decorative pillar
   swatch list are website acquisition copy -- someone who has already
   installed the app doesn't need to be sold on signing up, and it just
   pushes the actual login form down the screen. The website keeps the
   full two-panel auth layout unchanged; this only collapses it to the
   card alone in-app. (This supersedes the earlier in-app h2-shrink rule
   -- there's no pitch heading left to size once the panel is gone.) */
html.capacitor-app .auth-pitch {
  display: none;
}

/* Bottom nav bar -- hidden by default, shown under html.has-bottom-nav:
   always inside the Capacitor shell, and on the website at phone widths
   (<= 700px) since 2026-09-16 (see templates/base.html's gating script).
   On those phones the header's Saved/Study/Journal/Feeds links would
   otherwise wrap it onto a second row; they live in this bar instead,
   the same layout the app already had. Everything below that has to
   clear the bar is keyed off the same class. See
   docs/superpowers/specs/2026-08-22-mobile-app-design.md's "Scope". */
.app-bottom-nav {
  display: none;
}
html.has-bottom-nav .saved-link,
html.has-bottom-nav .study-link,
html.has-bottom-nav .journal-link,
html.has-bottom-nav .feeds-link,
html.has-bottom-nav .applications-link,
html.has-bottom-nav .courses-link,
html.has-bottom-nav .speaking-link,
html.has-bottom-nav .speaking-menu {
  display: none;
}

html.has-bottom-nav {
  /* The bar's own content height, and the extra strip the iOS home
     indicator occupies underneath it. Everything that has to clear the bar
     (body's bottom padding, .back-to-top) measures against the total, so
     there's one number to change. Raised from the text-only bar's 56px to
     fit an icon + label stack (2026-08-30 icon redesign) without feeling
     cramped -- still well inside the ~49-56px native tab bars typically
     occupy, so it doesn't read as oversized next to the rest of the app. */
  --app-nav-height: 58px;
  --app-nav-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-nav-total-height: calc(var(--app-nav-height) + var(--app-nav-safe-bottom));
}

html.has-bottom-nav .app-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  justify-content: space-around;
  align-items: center;
  /* min-height + padding-bottom rather than a flat height: with the
     global border-box sizing, a fixed height would have the safe-area
     padding eat into the 56px of tappable area instead of extending
     below it. This way the labels always get their full 56px and the
     home indicator sits in the padding strip beneath them. */
  min-height: var(--app-nav-total-height);
  padding-bottom: var(--app-nav-safe-bottom);
  /* 2026-09-05, real Android 16 phone, landscape, 3-button nav: same gap
     as .site-header's own left/right fix above -- this bar spans
     left:0/right:0 with no allowance for a side-docked system nav bar,
     so the last item (Feeds) rendered directly under it. */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: var(--paper-raised);
  border-top: 1px solid var(--border);
  z-index: 100;
}

html.has-bottom-nav .app-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 0;
}

/* stroke="currentColor" on the icons (base.html) means this is the only
   rule that has to know about the active state -- .active's color change
   colors the label text AND the icon stroke together, the same one-place
   dependency .site-nav a already relies on for its own active state. */
html.has-bottom-nav .app-bottom-nav a.active {
  color: var(--accent-warm-ink);
  font-weight: 600;
}

html.has-bottom-nav .app-bottom-nav-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keeps the nav bar from covering the last bit of content it overlays.
   This has to sit on <body>, not .site-main: templates/base.html's
   document order is <main> -> <footer> -> the nav bar, so .site-main
   isn't the element that determines where the page actually ends --
   padding there just left the footer sitting under the bar. (Dropping
   the .site-main override also restores its own var(--space-5) bottom
   padding, which the flat 56px was overwriting.) */
html.has-bottom-nav body {
  padding-bottom: var(--app-nav-total-height);
}

/* Three fixed-position elements sit near the bottom of the viewport and
   would otherwise land inside or behind the bar (z-index 100). */
html.has-bottom-nav .back-to-top {
  bottom: calc(var(--app-nav-total-height) + var(--space-3));
}
html.has-bottom-nav .journal-new-link {
  bottom: calc(var(--app-nav-total-height) + var(--space-3));
}

/* .flashcard-popover is positioned by static/js/site.js setting an inline
   `top` from the text selection's rect, so unlike .back-to-top it can't be
   pushed up from CSS -- there's no `bottom` to offset, and an inline style
   would win anyway. Raising it above the bar instead keeps it visible and
   tappable for a selection near the bottom of the screen; it's a transient
   popover dismissed on the next click, so briefly overlaying persistent
   chrome is the right trade. */
html.has-bottom-nav .flashcard-popover {
  z-index: 110;
}

/* .popover-backdrop's base z-index (19) sits below the Capacitor app's own
   bottom nav bar (.app-bottom-nav, z-index: 100), so on the wrapped mobile
   app -- Vocabulary mode's primary target -- the nav bar rendered undimmed
   on top of the backdrop and stayed tappable while the sheet was supposedly
   modal. One point below the sheet's own z-index: 110 above, so the
   backdrop sits just below the sheet but above the nav bar (2026-08-26
   final review, finding 6). */
html.has-bottom-nav .popover-backdrop {
  z-index: 109;
}

/* .is-sheet is bottom-anchored (`bottom: 0`, not the inline `top` the
   selection-anchored popover above uses), so unlike that one it CAN be
   pushed up from CSS -- raise it above the bar instead of letting it
   render underneath/behind it. */
html.has-bottom-nav .flashcard-popover.is-sheet {
  bottom: var(--app-nav-total-height, 0);
}

/* Belt-and-suspenders alongside static/js/site.js's own bottomLimit()
   fix in initJournalContextMenu (2026-09-06, reader report): that JS
   change keeps the journal entry "···" menu positioned clear of this
   bar in the first place, but its base z-index (30, site.css's own
   .journal-context-menu rule) still sits below the bar's 100 -- raised
   here too, same reasoning as .flashcard-popover above, so a menu that
   ends up flush against the bar (e.g. a very tall stats row) renders on
   top of it rather than partly behind it. */
html.has-bottom-nav .journal-context-menu {
  z-index: 110;
}

/* The conversation card fills the viewport under the header; with the
   bar showing it has to stop above it too, or the composer is covered.
   Pre-JS fallback only -- site.js's sizeMessagingCard() measures the
   bar the same way and sets the real height. */
html.has-bottom-nav .messaging-conversation-page {
  height: calc(100dvh - var(--header-height, 112px) - 4rem - var(--app-nav-total-height));
}

/* ---------------------------------------------------------------------
   Reader RSS feed cards (/accounts/feeds/, 2026-08-29 design) -- a
   grid of per-feed cards, one per RssSubscription. .rss-feeds itself
   still reuses .account-card's shell (matching .journal-trash's own
   680px override, not the narrower 26rem .account-card default sized
   for the login/register forms). Also forces .journal-back-link
   visible at every width here -- its default (display: none, shown
   only under 799px) exists for the two-pane journal layout, which
   this single-purpose page has no equivalent of.
   --------------------------------------------------------------------- */
.rss-feeds {
  max-width: 1080px; /* matches --max-width, the site's own content shell -- was narrower than that for no clear reason */
  /* .account-card sets overflow: hidden (kept there to clip
     ::before's top accent bar to the card's rounded corners on the
     single-form account pages that share this shell) -- but this page's
     rows use .rss-feed-item-popover, which overflows past its own card's
     box on purpose. --radius is 0 sitewide, so there are no rounded
     corners for the hidden overflow to be protecting here; scoped
     override rather than touching .account-card itself, which every
     other account page still relies on. */
  overflow: visible;
  /* 2026-09-12 learner-UX review, "remove the large outer panel
     surrounding the feed cards" -- .account-card is a single-FORM-page
     component (a bordered box with a brand-accent top stripe, built for
     login/register/settings), reused here only for its max-width/
     centering. Every individual .rss-feed-card already gets its own
     border/background/shadow (below), so the whole-page panel this
     class ALSO drew around the entire board -- header, dek, add-feed
     dialog trigger, and every card together -- was a second, redundant
     bordered surface around content that already had its own. Zeroed
     here rather than touching .account-card itself, which every other
     account page still relies on for its real single-form treatment. */
  background: none;
  border: none;
  padding: 0;
}
.rss-feeds::before { content: none; }
.rss-feeds .journal-back-link {
  display: inline-block;
}
/* Heading + primary action side by side (UI review, 2026-09-05: the h1,
   dek and "+ Add feed" button were three stacked block elements, all the
   vertical space that implied made the button read as an afterthought
   rather than this page's main action). */
/* 2026-09-15 concise/modern pass (site owner, "and make the mobile
   version page suitable too"): title + count line on the left, "+ Add
   feed" on the right, on one row at every width; cards flat -- hairline
   border, no resting shadow or hover lift, no shadows on the menu, row
   preview or search suggestions -- with a solid monogram badge per feed. */
.rss-feeds { font-family: var(--font-body); }
.rss-feeds-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}
.rss-feeds-heading { min-width: 0; }
.rss-feeds-header h1 { margin: 0; font-size: 1.75rem; }
.rss-feed-count {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.rss-feed-empty-state {
  color: var(--ink-faint);
  margin-top: var(--space-3);
}
/* 2026-09-13 design review -- empty-state suggested feed cards, one
   real <form> per feed.html's own comment. Reuses .dashboard-action's
   bordered/hover idiom (Study's own shortcuts already established this
   as "one shortcut-card language" -- see study.html's comment) via the
   button itself rather than the form wrapper, since a <form> can't be
   the flex/grid item AND look like a bordered card without an extra
   wrapping element the button alone already provides. */
.rss-feed-suggestions { margin-top: var(--space-3); }
.rss-feed-suggestions-label {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.rss-feed-suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.rss-feed-suggestion-card button {
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6em 1.1em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.rss-feed-suggestion-card button:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
/* Brand-filled primary CTA (UI review, 2026-09-05: the plain outline
   button didn't read as this page's main action, and never touched the
   brand color at all). Same fill/hover/focus treatment as
   .account-form button -- that's this file's own established "primary
   action" look, not a new one invented for this button. */
.rss-feed-add-btn {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 2.5rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5em 1.15em;
  margin: 0;
  border: none;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.rss-feed-add-btn:hover { background: var(--accent-secondary-ink); }
.rss-feed-add-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.rss-feed-add-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--paper);
  color: var(--ink);
  width: min(26rem, calc(100% - 2 * var(--space-3)));
}
.rss-feed-add-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.rss-feed-add-dialog .account-form {
  margin: 0;
}
.rss-feed-add-dialog-actions {
  display: flex;
  gap: var(--space-2);
}
.rss-feed-add-dialog-actions button {
  flex: 1;
}
/* .account-form button styles every <button> in the form -- including
   this Cancel button -- with the branded full-width CTA look. Override
   it back to a plain secondary button so Cancel doesn't look like a
   second "Add feed". */
.rss-feed-add-dialog-actions [data-rss-add-cancel] {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
/* Type-to-search suggestions (2026-09-03, site owner: "typing BBC, then
   bbc's rss show up") -- same absolute-popover-below-a-relative-wrap
   pattern as .journal-more-menu-panel/.journal-calendar-month-picker
   elsewhere on this site, not a new idiom. */
.rss-feed-search-wrap { position: relative; }
.rss-feed-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0.3em 0 0;
  padding: 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.rss-feed-search-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5em var(--space-2);
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
}
.rss-feed-search-suggestions button:hover { background: var(--paper); color: var(--accent-secondary-ink); }
.rss-feed-add-dialog-actions [data-rss-add-cancel]:hover {
  background: var(--paper-raised);
}
.rss-feed-board {
  display: grid;
  align-items: start;
  /* auto-fit, not auto-fill (UI review, 2026-09-05): auto-fill reserves
     empty tracks even when there's nothing to put in them, so with only
     1-2 feeds the board read as left-heavy with dead space on the right.
     auto-fit collapses those empty tracks to 0, letting existing cards'
     1fr share fill the row instead. Same column math either way once the
     board actually has enough cards to fill every track. */
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); /* wider cards show more of each item's title before it truncates */
  gap: var(--space-2);
  margin-top: 0;
}
/* Same-size cards (2026-09-16, site owner: "the cards in the feeds
   should have the same size") -- once there's room for two columns,
   every row takes the tallest card's height and each card stretches to
   fill it. A single phone column keeps natural heights: equal rows
   there would only add empty space under short cards. */
@media (min-width: 760px) {
  .rss-feed-board {
    align-items: stretch;
    grid-auto-rows: 1fr;
  }
}
.rss-feed-card {
  position: relative; /* anchors .rss-feed-card-menu-panel below */
  min-width: 0; /* lets grid-item children truncate instead of overflowing the track */
  padding: 1.1rem 1.35rem 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--paper-raised);
  transition: border-color 0.15s ease;
  /* Column, so a stretched card's pager can sit on its bottom edge. */
  display: flex;
  flex-direction: column;
}
/* Every page in one cell: the card is as tall as its tallest page, so
   paging doesn't resize the card (or, with equal rows, the whole
   board). Inactive pages keep their space but are invisible and out of
   the tab order / accessibility tree. */
.rss-feed-card-pages { display: grid; margin-bottom: 0.5rem; }
.rss-feed-card-pages > .rss-feed-card-page { grid-area: 1 / 1; min-width: 0; }
.rss-feed-card-pages > .rss-feed-card-page[hidden] { display: block; visibility: hidden; }
/* A rows-only page (page 2+) starts right under the header's hairline --
   drop its first row's own top rule so the two don't double up. */
.rss-feed-card-page > .rss-feed-card-rows:first-child > li:first-child { border-top: 0; }
/* 2026-09-16 restyle (site owner: "make the design of these cards
   fancier"; standing rule: flat -- no shadows, stripes or tints). Same
   blue-hairline hover as the Saved cards. */
.rss-feed-card:hover,
.rss-feed-card:focus-within { border-color: var(--accent-secondary); }
/* Header sits on its own band, split from the stories by a hairline. */
.rss-feed-card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 1rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border);
}
.rss-feed-card-monogram {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}
/* A feed that isn't loading: an outline, not a grey fill. */
.rss-feed-card-monogram-error {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--ink-faint);
}
.rss-feed-card-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rss-feed-card-heading:has(.rss-feed-card-title[hidden]) { display: none; }
.rss-feed-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; /* a feed's own name, or its host as a fallback, is short -- one line is enough */
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.rss-feed-card-updated {
  margin-top: 0.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.rss-feed-card-error {
  margin: 0;
  color: var(--line-news-ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.rss-feed-card-error-hint {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
/* In a card stretched to its row's height, center the error message in
   the free space rather than leaving it stranded at the top. */
.rss-feed-card-error { margin-top: auto; }
.rss-feed-card-error-hint { margin-bottom: auto; }
.rss-feed-card-menu {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}
.rss-feed-card-menu-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
}
.rss-feed-card-menu-btn:hover { border-color: var(--border); color: var(--ink); }
.rss-feed-card-menu-btn[aria-expanded="true"] { border-color: var(--line-brand); background: var(--line-brand); color: var(--line-brand-on); }
.rss-feed-card-menu-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.rss-feed-card-menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 5; /* above card content, below any site-wide modal/overlay layer */
  display: flex;
  flex-direction: column;
  min-width: 10rem;
  padding: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}
.rss-feed-card-menu-panel button,
.rss-feed-card-menu-panel a {
  font: inherit;
  text-align: left;
  border: none;
  background: none;
  padding: 0.5em 0.7em;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.rss-feed-card-menu-panel form { display: contents; }
.rss-feed-card-menu-panel button:hover,
.rss-feed-card-menu-panel a:hover {
  background: var(--paper-raised);
  color: var(--accent-secondary-ink);
}
/* The UA's built-in `[hidden] { display: none }` rule loses to ANY
   author-origin `display` rule on the same element regardless of
   specificity -- the `display: flex` rule above would otherwise keep
   this panel visible from first paint despite the bare `hidden`
   attribute in accounts/feeds.html. Same established pattern as
   .back-to-top[hidden]/.journal-media-item[hidden] elsewhere in this
   file. */
.rss-feed-card-menu-panel[hidden] { display: none; }
.rss-feed-card-large-item {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.5rem;
}
/* The card's one loud accent: how fresh the lead story is. */
.rss-feed-card-large-when {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-secondary);
}
.rss-feed-card-large-item:hover .rss-feed-card-large-title { color: var(--accent-secondary-ink); }
/* 2-line clamp, not single-line ellipsis (UI review, 2026-09-05: a real
   headline was getting cut off mid-word, which defeats the point of a
   news-feed card). Same three-property clamp pattern as .story-card .dek
   elsewhere in this file, not a new technique. */
.rss-feed-card-large-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.rss-feed-card-large-item:hover .rss-feed-card-large-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.rss-feed-card-large-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-top: 0.4em;
}
/* 2026-09-12 learner-UX review -- "Journal this" for a feed item, same
   pattern as an article page's own .action-journal. The featured item's
   own link gets full text (there's room); each compact row instead gets
   a single icon (site.css's .rss-feed-item-journal-link-compact below)
   since the row is already tight against the date column. */
.rss-feed-item-journal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-bottom: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  text-decoration: none;
}
.rss-feed-item-journal-link:hover { text-decoration: underline; }
.rss-feed-item-journal-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rss-feed-item-journal-link-compact {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  margin: -0.3rem -0.35rem -0.3rem 0;
  border-radius: 999px;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.rss-feed-item-journal-link-compact:hover { color: var(--accent-secondary-ink); background: none; }
.rss-feed-card-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* .rss-feed-item-popover overflows below its card's box (absolutely
   positioned children don't expand the parent's height). Without a
   z-index bump here, the next card in the grid -- later in DOM order,
   sitting visually right underneath -- paints over that spillover and
   hides it. Raise the whole card only while a row inside it is being
   hovered/focused. */
.rss-feed-card:has(.rss-feed-card-rows li:hover),
.rss-feed-card:has(.rss-feed-card-rows li:focus-within) {
  z-index: 20;
}
.rss-feed-card-rows li {
  position: relative; /* anchors .rss-feed-item-popover below */
  display: flex;
  justify-content: space-between;
  /* flex-start, not baseline (UI review, 2026-09-05, alongside the
     title's own 2-line clamp below) -- baseline aligns to the title's
     first line only, which reads as misaligned against the date once a
     title wraps to a second line. */
  align-items: flex-start;
  gap: var(--space-2);
  padding: 0.6em 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.4;
}
/* 2-line clamp, not single-line ellipsis -- see .rss-feed-card-large-title
   above for the same fix and rationale (UI review, 2026-09-05). */
/* > a: only the row's headline link -- the compact "Journal this" icon link
   inside .rss-feed-card-row-meta must not pick up the clamp/ink color. */
.rss-feed-card-rows li > a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
}
.rss-feed-card-rows li > a:hover {
  color: var(--accent-secondary-ink);
  text-decoration: underline;
}
.rss-feed-item-popover {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10; /* above sibling rows and the card's own border */
  margin-top: 0.3em;
  padding: var(--space-2) var(--space-3);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none; /* only ever revealed via :hover/:focus-within on the row itself */
}
.rss-feed-card-rows li:hover .rss-feed-item-popover,
.rss-feed-card-rows li:focus-within .rss-feed-item-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.rss-feed-item-popover-title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.2em;
}
.rss-feed-item-popover-date {
  display: block;
  color: var(--ink-faint);
  font-size: 0.78rem;
  margin-bottom: 0.3em;
}
.rss-feed-item-popover-excerpt {
  display: block;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.rss-feed-card-row-meta {
  display: flex;
  align-items: center;
  min-height: 1.4em;
  gap: 0.4em;
  flex-shrink: 0;
}
.rss-feed-card-row-date {
  color: var(--ink-faint);
  font-size: 0.78rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.rss-feed-card-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: auto; /* pinned to the bottom of a stretched card; .rss-feed-card-pages keeps the 0.5rem gap */
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.rss-feed-card-pager button {
  font: inherit;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  cursor: pointer;
  /* Bumped from 0.1em/0.6em (UI review, 2026-09-05: the ‹/› buttons were
     easy to miss/mis-tap) -- min-width/min-height give ‹ and › an actual
     square-ish hitbox instead of shrink-wrapping to the glyph's own
     tiny advance width. */
  padding: 0;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.05rem;
  line-height: 1;
}
.rss-feed-card-pager button:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-ink);
}
.rss-feed-card-rename-form {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 0.4em;
  margin-top: 0;
}
.rss-feed-card-rename-form input { flex: 1; min-width: 0; }
/* Same `[hidden]` vs. author-origin `display` conflict as
   .rss-feed-card-menu-panel[hidden] above -- required regardless of
   specificity, same established pattern as .back-to-top[hidden]. */
.rss-feed-card-rename-form[hidden] { display: none; }
@media (max-width: 599px) {
  .rss-feed-board { grid-template-columns: 1fr; } /* one column below the site's existing mobile breakpoint family */
  .rss-feeds-header h1 { font-size: 1.5rem; }
  .rss-feed-card { padding: 1rem 1rem 0.85rem; border-radius: 14px; }
  .rss-feed-card-large-title { font-size: 1.05rem; }
  /* No hover on touch: the row preview would only ever flash on tap. */
  .rss-feed-item-popover { display: none; }
}

/* Crossword (2026-09-08, site owner: "add a crosswords test for these
   flashcards") -- see docs/superpowers/specs/2026-09-08-flashcard-
   crossword-design.md.

   2026-10-03 redesign (site owner: "modern, energetic, professional,
   lovely"). The puzzle is drawn as letter tiles on a dotted board: block
   squares are transparent instead of black, so a mostly-empty generated
   grid no longer reads as a dark slab and the lattice of the reader's own
   words is the picture. Colour stays inside the site palette: brand navy
   marks where you are (solid tile = active cell, tint = active word),
   the existing highlight-green / news-red tokens mark Check results, and
   the orange accent is kept for the progress meter and focus. The one
   piece of ambient motion is the solved wave (.crossword-is-solved). */
.crossword-page {
  --xw-tile: var(--paper-raised);
  --xw-tile-edge: color-mix(in srgb, var(--ink) 18%, transparent);
  --xw-board: color-mix(in srgb, var(--line-brand) 5%, var(--paper));
  --xw-dot: color-mix(in srgb, var(--line-brand) 22%, transparent);
  --xw-word: color-mix(in srgb, var(--line-brand) 14%, var(--paper-raised));
  --xw-word-edge: color-mix(in srgb, var(--line-brand) 45%, transparent);
  --xw-good: color-mix(in srgb, var(--line-economics) 26%, var(--paper-raised));
  --xw-good-edge: var(--line-economics-ink);
  --xw-bad: color-mix(in srgb, var(--line-news) 20%, var(--paper-raised));
  --xw-bad-edge: var(--line-news-ink);
  --xw-radius: 14px;
}

/* ---- Header: title on the left, words-filled meter on the right ---- */
.crossword-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-2) 0 var(--space-3);
}
.crossword-head-title { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.crossword-head h1 { margin: 0; font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; }
.crossword-dek { margin: 0.15rem 0 0; font-family: var(--font-body); font-size: 0.95rem; color: var(--ink-soft); }
.crossword-back {
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  text-decoration: none;
}
.crossword-back:hover { text-decoration: underline; text-underline-offset: 3px; }

.crossword-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; min-width: min(100%, 15rem); }
.crossword-progress-text { font-family: var(--font-body); font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.crossword-progress-segments { display: flex; gap: 3px; width: 100%; max-width: 18rem; }
.crossword-progress-segments span {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  transition: background-color 0.25s ease;
}
.crossword-progress-segments span.is-filled { background: var(--accent-warm); }

/* ---- Deck chooser ---- */
.crossword-decks { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 var(--space-3); }
.crossword-deck {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.95em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}
.crossword-deck:hover { border-color: var(--line-brand-ink); color: var(--ink); }
.crossword-deck.is-active { background: var(--line-brand); border-color: var(--line-brand); color: var(--line-brand-on); }
.crossword-deck-count { font-size: 0.78rem; font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }

/* ---- Active clue bar: the brand strip that always says what to solve ---- */
.crossword-active-clue-bar {
  position: sticky;
  top: var(--header-height, 112px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: var(--space-2);
  padding: 0.55rem;
  border-radius: var(--xw-radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
}
.crossword-active-clue-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  /* Clues are full flashcard definitions, so they wrap rather than truncate. */
  white-space: normal;
}
.crossword-active-clue-label {
  display: inline-block;
  margin-right: 0.6em;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-brand-on) 18%, transparent);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: 0.08em;
}
.crossword-clue-nav {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-brand-on) 14%, transparent);
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.crossword-clue-nav:hover { background: color-mix(in srgb, var(--line-brand-on) 26%, transparent); }
.crossword-clue-nav:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }

/* ---- Board ---- */
.crossword-board {
  min-width: 0;
  padding: var(--space-3);
  border-radius: calc(var(--xw-radius) + 4px);
  background-color: var(--xw-board);
  background-image: radial-gradient(var(--xw-dot) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
}
/* The grid sizes its tiles from this box's width (cqi), so a puzzle fits
   without sideways scrolling whenever tiles can stay at least ~1.45rem;
   only wider puzzles than that scroll, inside this box, not the page. */
.crossword-grid-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  container-type: inline-size;
  padding: 2px 2px 4px;
}
.crossword-grid {
  /* initCrossword (site.js) sets grid-template-columns/rows and
     --crossword-cols once it knows the puzzle's size. */
  --crossword-gap: 4px;
  --crossword-cell-size: 2.2rem;
  --crossword-cell-size: clamp(1.45rem, calc((100cqi - 4px - (var(--crossword-cols, 15) - 1) * var(--crossword-gap)) / var(--crossword-cols, 15)), 2.6rem);
  display: grid;
  gap: var(--crossword-gap);
  margin: 0 auto;
  position: relative; /* anchors .crossword-hidden-input */
  width: max-content;
}
.crossword-cell {
  position: relative;
  width: var(--crossword-cell-size);
  height: var(--crossword-cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: max(4px, calc(var(--crossword-cell-size) * 0.18));
  background: var(--xw-tile);
  /* A key-cap edge: tiles read as pieces you place letters on. */
  box-shadow: inset 0 0 0 1px var(--xw-tile-edge), 0 2px 0 var(--xw-tile-edge);
  /* Letters sit a little low so the corner clue number never touches them. */
  padding-top: calc(var(--crossword-cell-size) * 0.14);
  box-sizing: border-box;
  font-family: var(--font-display);
  font-size: calc(var(--crossword-cell-size) * 0.46);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.crossword-cell-block { background: none; box-shadow: none; cursor: default; }
.crossword-cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-family: var(--font-body);
  font-size: max(0.5rem, calc(var(--crossword-cell-size) * 0.24));
  font-weight: 600;
  line-height: 1;
  color: var(--ink-faint);
}
/* State order matters: a tile can be in the active word AND carry a Check
   result; correct/incorrect come after word/active so a result wins. */
.crossword-cell-word { background: var(--xw-word); box-shadow: inset 0 0 0 1px var(--xw-word-edge), 0 2px 0 var(--xw-word-edge); }
.crossword-cell-active {
  background: var(--line-brand);
  color: var(--line-brand-on);
  box-shadow: 0 0 0 2px var(--accent-warm), 0 2px 0 var(--line-brand);
  transform: translateY(-1px);
}
.crossword-cell-active .crossword-cell-number { color: color-mix(in srgb, var(--line-brand-on) 75%, transparent); }
.crossword-cell-correct { background: var(--xw-good); color: var(--ink); box-shadow: inset 0 0 0 1px var(--xw-good-edge), 0 2px 0 var(--xw-good-edge); }
.crossword-cell-incorrect { background: var(--xw-bad); color: var(--ink); box-shadow: inset 0 0 0 1px var(--xw-bad-edge), 0 2px 0 var(--xw-bad-edge); }
.crossword-cell-active.crossword-cell-correct,
.crossword-cell-active.crossword-cell-incorrect { box-shadow: 0 0 0 2px var(--line-brand), 0 2px 0 var(--line-brand); }
.crossword-cell-active.crossword-cell-correct .crossword-cell-number,
.crossword-cell-active.crossword-cell-incorrect .crossword-cell-number { color: var(--ink-faint); }

/* Kept focusable for the phone keyboard (see initCrossword): opacity 0
   and a transparent caret, never display:none/visibility:hidden. */
.crossword-hidden-input {
  position: absolute;
  opacity: 0;
  border: none;
  padding: 0;
  caret-color: transparent;
}

/* ---- Solved: one diagonal wave across the tiles ---- */
@keyframes crossword-wave {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-7px); }
}
.crossword-is-solved .crossword-cell:not(.crossword-cell-block) {
  animation: crossword-wave 0.55s cubic-bezier(0.3, 0.7, 0.4, 1) both;
  animation-delay: calc(var(--wave, 0) * 35ms);
}
@media (prefers-reduced-motion: reduce) {
  .crossword-is-solved .crossword-cell:not(.crossword-cell-block) { animation: none; }
  .crossword-cell { transition: none; }
}

/* ---- Toolbar under the board ---- */
.crossword-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: var(--space-3); }
.crossword-new-puzzle-form { display: contents; }
.crossword-toolbar button {
  min-height: 2.6rem;
  padding: 0.5em 1.15em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.crossword-toolbar button:hover { border-color: var(--line-brand-ink); }
.crossword-toolbar button:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.crossword-toolbar .crossword-check-primary {
  padding-inline: 1.5em;
  border-color: var(--accent-warm);
  background: var(--accent-warm);
  /* Dark text on the orange in both themes: white on #D96A00 is under
     4.5:1 at this size, and the dark-theme orange is lighter still. */
  color: #14161c;
}
.crossword-toolbar .crossword-check-primary:hover { filter: brightness(1.06); border-color: var(--accent-warm); }
.crossword-toolbar .crossword-new-puzzle { margin-left: auto; border-color: transparent; background: none; color: var(--ink-soft); }
.crossword-toolbar .crossword-new-puzzle:hover { color: var(--ink); border-color: var(--border-strong); }
.crossword-reveal-menu { position: relative; }
.crossword-reveal-menu-btn::after { content: "▾"; margin-left: 0.4em; font-size: 0.8em; }
.crossword-reveal-menu-panel {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  z-index: 6;
  min-width: 13rem;
  padding: 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
/* An author `display` rule beats the UA's [hidden] rule, so restate it. */
.crossword-reveal-menu-panel[hidden] { display: none; }
.crossword-toolbar .crossword-reveal-menu-panel button {
  min-height: 0;
  width: 100%;
  padding: 0.55em 0.7em;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-weight: 500;
}
.crossword-toolbar .crossword-reveal-menu-panel button:hover { background: var(--xw-word); }

.crossword-status {
  display: inline-block;
  margin: var(--space-2) 0 0;
  padding: 0.45em 0.95em;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.crossword-status:empty { display: none; }
.crossword-status[data-tone="success"] { background: var(--xw-good); box-shadow: inset 0 0 0 1px var(--xw-good-edge); }
.crossword-status[data-tone="warn"] { background: var(--xw-bad); box-shadow: inset 0 0 0 1px var(--xw-bad-edge); }
.crossword-legend { margin: var(--space-2) 0 0; max-width: 65ch; font-family: var(--font-body); font-size: 0.8rem; line-height: 1.5; color: var(--ink-soft); }

/* ---- Clue lists ---- */
.crossword-clues { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); font-family: var(--font-body); }
.crossword-clue-list { min-width: 220px; flex: 1; }
.crossword-clue-heading {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}
.crossword-clue-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.crossword-clue-list li {
  display: flex;
  align-items: baseline;
  gap: 0.65em;
  padding: 0.5em 0.6em;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.crossword-clue-list li:hover { background: color-mix(in srgb, var(--line-brand) 7%, transparent); color: var(--ink); }
.crossword-clue-number {
  flex: none;
  min-width: 1.9em;
  padding: 0.05em 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.crossword-clue-text { flex: 1; }
.crossword-clue-list li.crossword-clue-active { background: var(--xw-word); color: var(--ink); box-shadow: inset 3px 0 0 var(--line-brand); }
.crossword-clue-list li.crossword-clue-active .crossword-clue-number { background: var(--line-brand); color: var(--line-brand-on); }
/* Word-level Check result: one badge per clue, empty until Check runs. */
.crossword-clue-badge { flex: none; min-width: 1.2em; font-weight: 700; font-size: 0.95rem; text-align: center; }
.crossword-clue-status-correct .crossword-clue-text { color: var(--ink-faint); }
.crossword-clue-status-correct .crossword-clue-badge { color: var(--line-economics-ink); }
.crossword-clue-status-incorrect .crossword-clue-badge { color: var(--line-news-ink); }

/* Wide screens: board left, clues in a sticky panel right. The clue bar
   spans the board column only; it still gives Prev/Next. */
@media (min-width: 900px) {
  #crossword-root {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    grid-template-areas: "clue-bar clues" "grid clues";
    column-gap: var(--space-4);
    align-items: start;
  }
  .crossword-active-clue-bar { grid-area: clue-bar; }
  .crossword-board { grid-area: grid; }
  .crossword-clues {
    grid-area: clues;
    position: sticky;
    top: calc(var(--header-height, 112px) + 0.75rem);
    max-height: calc(100vh - var(--header-height, 112px) - 1.5rem);
    overflow-y: auto;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--space-3);
    margin-top: 0;
    padding: var(--space-2) var(--space-2) var(--space-2) 0;
  }
}
@media (max-width: 600px) {
  .crossword-head { align-items: stretch; }
  .crossword-progress { align-items: stretch; }
  .crossword-progress-segments { max-width: none; }
  .crossword-board { padding: var(--space-2); }
  .crossword-grid { --crossword-gap: 2px; }
  .crossword-toolbar button { padding-inline: 0.95em; }
  .crossword-toolbar .crossword-check-primary { flex: 1; padding-inline: 1em; }
}

/* ---- Empty state ---- */
.crossword-empty {
  max-width: 34rem;
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: calc(var(--xw-radius) + 4px);
  background-color: var(--xw-board);
  background-image: radial-gradient(var(--xw-dot) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
  font-family: var(--font-body);
  color: var(--ink-soft);
}
.crossword-empty-title { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.crossword-empty p { margin: 0 0 var(--space-3); line-height: 1.5; }
.crossword-empty-cta {
  display: inline-block;
  padding: 0.55em 1.3em;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-weight: 600;
  text-decoration: none;
}
.crossword-empty-cta:hover { background: var(--line-brand-ink); color: var(--line-brand-on); }

/* User-to-user messaging (2026-09-08 design, brainstormed in chat; friend-
   request + chat-UI follow-up same day, site owner: "the message start
   with adding friends" / "make the message like a real chat tool like
   wechat"). Reuses this site's existing theme tokens throughout, same as
   every other feature's CSS in this file -- no new palette. */
/* 2026-09-12 learner-UX review, Findings 3 &amp; 6 -- this had zero width/
   height/padding (a bare inline anchor sized only by the ✉ glyph's own
   ambient font-size, the only header nav item with no explicit hit
   area) and no hover/.active rule at all, so it never showed a "you are
   here" state on /messages/ the way every other nav item does. Icon-
   only, same as .saved-link right above it in the header -- not a text
   label like .study-link/.journal-link/.feeds-link -- so this mirrors
   .saved-link's own circular-badge treatment (border ring + color, not
   an underline, which is the .study-link/.journal-link/.feeds-link
   TEXT-label idiom instead) rather than forcing an underline onto a
   lone glyph. Also fixes the tiny-click-target finding as a side
   effect: 2.1rem is a real hit area, not just the glyph's own bounds. */
.messages-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 1rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.messages-link-icon {
  width: 0.82rem;
  height: 0.82rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messages-link:hover, .messages-link.active { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.messages-badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--accent-warm); color: var(--accent-warm-on);
  border-radius: 999px; font-size: 0.65rem; line-height: 1.4;
  min-width: 15px; padding: 0 4px; text-align: center;
}

/* One circular initial badge, reused everywhere a user needs a compact
   identity: inbox rows, the thread header, and every message bubble --
   same visual language as .account-avatar (the header's own "who's
   logged in" badge) rather than inventing a second avatar style. */
.messaging-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--line-brand); color: var(--line-brand-on);
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem;
}
.messaging-avatar-lg { width: 2.75rem; height: 2.75rem; font-size: 1.1rem; }
/* Same footprint as a real avatar, fully transparent -- keeps every
   bubble in a grouped run left-aligned under the first one instead of
   sliding over to fill the gap, the same alignment trick iMessage/WeChat
   use for consecutive messages from one sender. */
.messaging-avatar-spacer { background: transparent; }

.messaging-section-heading {
  margin: 1.5em 0 0.5em; font-size: 0.95rem; font-weight: 700; color: var(--ink-soft);
}

.messaging-inbox-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.messaging-inbox-header h1, .messaging-inbox-header .dek { margin-bottom: 0; }
.messaging-add-friend {
  flex: none; padding: 0.55em 0.9em; border-radius: 999px;
  background: var(--line-brand); color: var(--line-brand-on); text-decoration: none;
  font-family: var(--font-body); font-size: 0.88rem; font-weight: 700;
}

.messaging-inbox { list-style: none; margin: 0.5em 0; padding: 0; }
.messaging-inbox-row a {
  display: flex; align-items: center; gap: 0.7em;
  padding: 0.6em 0.5em; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.messaging-request-list .messaging-inbox-row a { padding-left: calc(0.5em + 2rem + 0.7em); }
.messaging-inbox-row-unread .messaging-inbox-user { font-weight: 700; }
.messaging-inbox-user { flex: none; }
.messaging-inbox-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 0.15em; }
.messaging-inbox-row-top, .messaging-inbox-row-bottom { display: flex; align-items: center; gap: 0.6em; min-width: 0; }
.messaging-inbox-row-bottom .messaging-inbox-unread-badge { margin-left: auto; }
.messaging-muted-mark { margin-left: 0.2em; font-size: 0.72rem; color: var(--ink-soft); }
.messaging-pin-mark { color: var(--accent); font-size: 0.58rem; line-height: 1; }
.messaging-archived { margin: 1rem 0; border-top: 1px solid var(--border); padding-top: 0.7rem; }
.messaging-archived summary { cursor: pointer; color: var(--ink-soft); font-weight: 700; }
/* min-width: 0 is required for text-overflow: ellipsis to actually
   trigger on a flex item -- without it, a flex child's default
   min-width: auto refuses to shrink below its content's natural width,
   so a long preview just overflows the row instead of truncating. */
.messaging-inbox-preview { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.messaging-inbox-preview-empty { font-style: italic; }

/* Friend-request states -- pending (either direction) and declined all
   render in place of the thread/reply-form, never alongside it. */
.messaging-thread-header { display: flex; align-items: center; gap: 0.7em; margin-bottom: 0.5em; }
.messaging-thread-header h1 { margin: 0; }
.messaging-back-link {
  display: inline-block; margin-bottom: 0.7em; color: var(--ink-soft);
  font-family: var(--font-body); font-size: 0.82rem; text-decoration: none;
}
.messaging-back-link:hover { color: var(--accent-secondary-ink); }
.messaging-request-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 1em 1.2em;
  background: var(--paper-raised); max-width: 28rem;
}
.messaging-request-actions { display: flex; gap: 0.6em; margin-top: 0.8em; }
.messaging-accept-button { background: var(--line-brand); color: var(--line-brand-on); border: none; }
.messaging-decline-button { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.messaging-request-waiting { color: var(--ink-soft); font-style: italic; }

/* Search toggle sits in the header, far right (margin-left: auto is the
   simplest way to push one flex child to the end without a wrapper). */
.messaging-search-toggle {
  margin-left: auto; background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: var(--ink-soft);
}
.messaging-search-toggle:hover { color: var(--accent-secondary-ink); }
.messaging-search-bar {
  display: flex; align-items: center; gap: 0.6em; margin-bottom: 0.6em;
}
/* 2026-09-12 learner-UX review, Finding 1 -- the UA's built-in
   `[hidden] { display: none }` loses to ANY author-origin `display`
   rule regardless of specificity or source order; without this, the
   `hidden` attribute .messaging-search-toggle's own click handler
   (site.js) toggles on this element had no visual effect at all, so
   the search bar rendered permanently visible instead of appearing
   only on request. Same established pattern as the ~15 other
   `X[hidden] { display: none; }` overrides already in this file. */
.messaging-search-bar[hidden] { display: none; }
.messaging-search-input {
  flex: 1; padding: 0.4em 0.8em; border-radius: 8px;
  border: 1px solid var(--border); background: var(--paper); color: var(--ink);
}
.messaging-search-count { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }

/* The thread itself scrolls in its own pane (rather than the whole page)
   once it's tall enough -- a real chat window, not an ever-growing page
   you have to scroll past to reach the reply box. static/js/site.js's
   initMessagingThread() scrolls this to the bottom on load.

   flex: 1 1 auto (2026-09-11, replacing a flat max-height: 60vh) -- lets
   this fill exactly whatever space .messaging-conversation-page's other,
   flex:none children (header, reply-quote-banner, composer, emoji-picker)
   don't need, within that now-bounded card (see its own comment above).
   min-height: 0 is required here, not optional -- without it, a flex
   child's default min-height:auto would let its OWN content size push the
   card taller / overflow, instead of actually shrinking to fit when
   siblings (e.g. the emoji-picker opening) need more room -- the classic
   "flexbox ignores overflow on a child unless min-height:0 is set"
   footgun. */
/* Chat screens scroll in one place only -- the thread (2026-09-18; see
   site.js's own comment where html.messaging-chat-screen is set). Without
   this the page scrolled behind the sized-to-viewport chat card, and a
   drag at the top of it triggered the browser/WebView pull-to-refresh
   instead of loading older messages. overscroll-behavior on BOTH html and
   body: a value on body only reaches the viewport while html's is still
   auto, so setting both is what actually stops the refresh gesture. */
html.messaging-chat-screen,
html.messaging-chat-screen body {
  overscroll-behavior-y: contain;
}
/* Only where the bottom nav already carries navigation (the app, and the
   website at phone widths) -- on desktop the footer stays. */
html.messaging-chat-screen.has-bottom-nav .site-footer {
  display: none;
}
/* The bottom padding that keeps ordinary scrolling pages clear of the fixed
   nav is what was left of the page scroll here (36px measured): the chat
   card already stops above the nav on its own, so on this one screen the
   padding only pushes the document past the viewport again. */
html.messaging-chat-screen.has-bottom-nav body,
html.messaging-chat-screen.has-bottom-nav main {
  padding-bottom: 0;
}

.messaging-thread {
  list-style: none; margin: 1em 0; padding: 0.5em 0;
  display: flex; flex-direction: column; gap: 0.15em;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}
.messaging-message {
  display: flex; align-items: flex-end; gap: 0.4em; max-width: 85%;
  animation: messaging-message-in 0.15s ease-out;
}
@keyframes messaging-message-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.messaging-message-mine { flex-direction: row-reverse; align-self: flex-end; }
.messaging-message-bubble {
  padding: 0.5em 0.8em; border-radius: 14px; background: var(--paper-raised);
  /* A soft, barely-there elevation -- distinguishes a bubble from the
     flat page behind it without this site's usual bordered-card look,
     which would read as a form element here, not a chat bubble. */
  box-shadow: none;
}
.messaging-message-mine .messaging-message-bubble {
  background: color-mix(in srgb, var(--accent-secondary) 12%, var(--paper-raised));
}
.messaging-message-body { margin: 0; white-space: pre-wrap; word-break: break-word; }
.messaging-message-recalled .messaging-message-bubble {
  background: color-mix(in srgb, var(--surface) 82%, var(--border));
  border-color: var(--border);
  box-shadow: none;
}
.messaging-message-recalled .messaging-message-body {
  color: var(--ink-soft);
  font-style: italic;
}
/* Quoted reply preview -- sits above the actual body, inside the same
   bubble, visually subordinate to it (smaller text, a left accent bar
   like an email/chat quote convention) rather than its own bubble. */
.messaging-message-quote {
  display: flex; flex-direction: column; gap: 0.1em;
  margin-bottom: 0.35em; padding: 0.2em 0.6em;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 0.82rem;
}
.messaging-message-quote-author { font-weight: 700; color: var(--accent-secondary-ink); }
.messaging-message-quote-body { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Inline edit form -- replaces .messaging-message-body in place while
   editing (Save/Cancel), never a modal. Explicit [hidden] override
   because this rule sets its own `display` -- the bare `hidden` attribute
   alone is not enough once a rule this specific sets `display` (this
   project already hit exactly this footgun once with the emoji picker;
   see static/css/site.css's own emoji-picker [hidden] rule). */
.messaging-message-edit-form { display: flex; flex-direction: column; gap: 0.35em; }
.messaging-message-edit-form[hidden] { display: none; }
.messaging-message-edit-textarea {
  width: 100%; min-height: 2.6em; font: inherit; padding: 0.4em 0.6em;
  border-radius: 0.6em; border: 1px solid var(--border); resize: vertical;
  background: var(--paper);
}
.messaging-message-edit-actions { display: flex; gap: 0.5em; }
.messaging-message-edit-save,
.messaging-message-edit-cancel {
  font-size: 0.78rem; padding: 0.2em 0.7em; border-radius: 0.4em; cursor: pointer;
  border: 1px solid var(--border); background: var(--paper-raised); color: var(--ink);
}
.messaging-message-edit-save:hover,
.messaging-message-edit-cancel:hover { border-color: var(--border-strong); }
.messaging-message-edited-marker { color: var(--ink-soft); }
.messaging-message-delete-form,
.messaging-message-delete-everyone-form,
.messaging-message-recall-form { display: contents; }
/* A centered, day/time-divider-style line between groups (own <li>, not
   nested in the bubble) rather than a per-bubble byline -- matches how
   a real chat app surfaces time (rarely, and out-of-line) once two
   people are actually going back and forth, not once per message. */
.messaging-message-meta { text-align: center; margin: 0.3em 0; font-size: 0.72rem; color: var(--ink-soft); }
/* .messaging-seen (the old text-based "· Seen" read receipt) removed
   2026-09-09 -- replaced by the per-message .messaging-tick ladder
   further down (WhatsApp-parity pass). */
.messaging-thread-empty { text-align: center; color: var(--ink-soft); font-style: italic; }

/* Shown above the composer only while actively replying to a specific
   message -- static/js/site.js toggles [hidden] on this, never removes
   it from the DOM, so its layout never shifts anything else on toggle. */
.messaging-reply-quote-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6em;
  padding: 0.4em 0.8em; margin-top: 0.6em;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--paper-raised);
  font-size: 0.82rem; color: var(--ink-soft);
}
/* 2026-09-12 learner-UX review, Finding 5 -- same missing-override bug
   as .messaging-search-bar[hidden] above: this element's own `display:
   flex` beat the UA's `[hidden] { display: none }` regardless of the
   attribute site.js correctly toggled, so the banner rendered
   permanently visible (empty text, a lone cancel button) until a reply
   was actually clicked -- and even then, only the TEXT changed, since
   it was never really hidden to begin with. */
.messaging-reply-quote-banner[hidden] { display: none; }
.messaging-reply-quote-banner-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messaging-reply-quote-cancel { flex: none; background: transparent; border: none; cursor: pointer; color: var(--ink-soft); }

/* No position: sticky here (removed 2026-09-11) -- .messaging-
   conversation-page is now itself a bounded flex column with .messaging-
   thread as its only flex:1 (growing/scrolling) child, so this form is
   just an ordinary flex item after it and is ALWAYS visible without
   needing to stick to anything: sticky here used to dock relative to the
   whole PAGE's scroll (this form's nearest actual scrolling ancestor,
   since nothing between it and the page used to scroll/clip), which is
   what let the composer end up needing a second, page-level scroll past
   the thread's own separate one -- see .messaging-conversation-page's own
   comment for the full story. background/border-top kept regardless --
   still reads as a distinct docked bar, not content sliding under it. */
.messaging-reply-form {
  display: flex; gap: 0.5em; align-items: flex-end; margin: 0.4em 0 0;
  padding: 0.6em 0;
  background: var(--paper); border-top: 1px solid var(--border);
}
.messaging-reply-form textarea {
  flex: 1; resize: none; border-radius: 18px; padding: 0.5em 1em;
  max-height: 6em; font-family: inherit;
}
.messaging-reply-form button, .messaging-emoji-toggle {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: none; font-size: 1rem; line-height: 1; cursor: pointer;
}
.messaging-reply-form button { background: var(--line-brand); color: var(--line-brand-on); }
.messaging-reply-form button:disabled { cursor: wait; opacity: 0.55; }
.messaging-emoji-toggle { background: transparent; color: var(--ink-soft); }
.messaging-emoji-toggle:hover { color: var(--accent-secondary-ink); }

.messaging-attachment-image {
  display: block; max-width: 16rem; max-height: 16rem; border-radius: 10px;
  margin-top: 0.4em; object-fit: cover; cursor: zoom-in;
}
.messaging-attachment-chip {
  display: inline-flex; align-items: center; gap: 0.4em; margin-top: 0.4em;
  padding: 0.4em 0.7em; border: 1px solid var(--border); border-radius: 8px;
  background: var(--paper); color: var(--ink); text-decoration: none; font-size: 0.85rem;
}
.messaging-attachment-chip:hover { border-color: var(--accent-secondary); }
.messaging-attachment-expired {
  margin: 0.4em 0 0; font-size: 0.8rem; font-style: italic; color: var(--ink-soft);
}
.messaging-attach-toggle {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; color: var(--ink-soft);
}
.messaging-attach-toggle:hover { color: var(--accent-secondary-ink); }

/* A plain grid popover, positioned relative to the reply form it sits
   right below (in DOM order, not absolutely anchored to the toggle
   button specifically -- simpler, and there's only ever one composer
   per page for it to belong to). */
.messaging-emoji-picker {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.2em;
  padding: 0.5em; margin-bottom: 0.5em;
  border: 1px solid var(--border); border-radius: 10px; background: var(--paper-raised);
}
/* Required regardless of the [hidden] attribute already on this element
   in the template -- 2026-09-11, found live: an author stylesheet's own
   `display:` rule beats the UA's `[hidden] { display: none }` rule
   REGARDLESS of specificity, so without this override the emoji grid
   rendered on every page load, not just when static/js/site.js toggles
   it open -- same established precedent as .back-to-top[hidden],
   .reading-tally[hidden], .reading-prefs-panel[hidden] elsewhere in this
   file. Ate real vertical space inside .messaging-conversation-page's
   now-bounded flex column, compounding the composer-visibility bug that
   card's own fix (above) addressed separately. */
.messaging-emoji-picker[hidden] { display: none; }
.messaging-emoji-option {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.2rem; padding: 0.3em; border-radius: 6px;
}
.messaging-emoji-option:hover { background: var(--paper); }

.messaging-report-form { margin-top: 2em; padding-top: 1em; border-top: 1px solid var(--border); }
.messaging-report-button { background: transparent; border: 1px solid var(--line-news); color: var(--line-news-ink); }

/* Conversation menu (2026-09-09 -- Report moved in here alongside the
   new Block/Unblock action, replacing the old always-visible standalone
   report form at the bottom of the page). Same toggle/click-outside-
   closes pattern as the emoji picker above and the RSS feed card menus
   elsewhere in this file -- one dismissable panel idiom, reused. */
.messaging-menu { position: relative; margin-left: auto; }
.messaging-menu-toggle {
  background: transparent; border: none; cursor: pointer; font-size: 1.3rem;
  line-height: 1; padding: 0.3em 0.5em; color: var(--ink-soft); border-radius: 6px;
}
.messaging-menu-toggle:hover, .messaging-menu-toggle:focus-visible { color: var(--accent-secondary-ink); }
.messaging-menu-panel {
  position: absolute; top: 100%; right: 0; z-index: 5; min-width: 13rem;
  margin-top: 0.3em; padding: 0.4em; border: 1px solid var(--border);
  border-radius: 10px; background: var(--paper-raised); box-shadow: none;
}
.messaging-menu-item {
  display: block; width: 100%; text-align: left; background: transparent;
  border: none; cursor: pointer; padding: 0.5em 0.6em; border-radius: 6px;
  font-family: var(--font-body); font-size: 0.9rem; color: var(--ink);
}
.messaging-menu-item:hover, .messaging-menu-item:focus-visible { background: var(--paper); }
/* 2026-09-12 learner-UX review, Finding 2 -- select/textarea had no
   border/radius/background/padding/font at all (this file has no
   global select/textarea reset -- every other control on the page,
   e.g. .messaging-menu-item right above, is styled per-class), so both
   rendered as bare OS-native controls next to everything else in this
   menu panel that's already styled. */
.messaging-menu-report-form select,
.messaging-menu-report-form textarea {
  font: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4em 0.6em;
}
.messaging-menu-report-form textarea { width: 100%; margin-top: 0.3em; box-sizing: border-box; }
.messaging-menu-report-form .messaging-report-button { width: 100%; margin-top: 0.3em; }

.messaging-blocked-notice { color: var(--ink-soft); font-style: italic; text-align: center; margin: 1em 0; }

/* Day separators + the load-older/new-messages controls flanking the
   thread (2026-09-09 pagination/polling pass). */
.messaging-day-separator {
  text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.04em; margin: 0.8em 0 0.3em;
}
.messaging-unread-separator {
  display: flex; align-items: center; gap: 0.7em; margin: 0.8em 0;
  color: var(--accent-warm-ink); font-size: 0.74rem; font-weight: 700;
}
.messaging-unread-separator::before, .messaging-unread-separator::after {
  content: ""; flex: 1; height: 1px; background: var(--accent-warm);
}
.messaging-load-older, .messaging-new-messages-button {
  display: block; margin: 0.5em auto; padding: 0.4em 1em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--paper-raised); color: var(--ink);
  font-family: var(--font-body); font-size: 0.82rem; cursor: pointer;
}
.messaging-new-messages-button {
  position: sticky; bottom: 4.5em; background: var(--line-brand); color: var(--line-brand-on); border: none;
  box-shadow: none;
}
.messaging-new-messages-button[hidden] { display: none; }
.messaging-load-older:hover, .messaging-new-messages-button:hover { filter: brightness(1.05); }

.messaging-message-quote-unavailable .messaging-message-quote-body { font-style: italic; }

.messaging-search-hint { font-size: 0.76rem; color: var(--ink-soft); margin: 0.2em 0 0.6em; }

.messaging-send-status {
  min-height: 1em; font-size: 0.78rem; color: var(--ink-soft); margin: 0.2em 0 0; text-align: right;
}
.messaging-connection-status {
  position: sticky; bottom: 4.5rem; z-index: 4; width: fit-content;
  margin: 0.4em auto; padding: 0.35em 0.75em; border-radius: 999px;
  background: var(--paper-raised); border: 1px solid var(--border);
  color: var(--ink-soft); font-size: 0.76rem; box-shadow: none;
}
.messaging-send-status-error { color: var(--line-news-ink); }
.messaging-send-status-retryable { cursor: pointer; text-decoration: underline; }

/* Per-conversation unread count in the inbox (2026-09-09 -- was a
   boolean dot before; now the real count, same badge shape/positioning
   the header's own .messages-badge already established). */
.messaging-inbox-row { position: relative; }
.messaging-inbox-unread-badge {
  flex: none; min-width: 1.3em; height: 1.3em; padding: 0 0.35em; border-radius: 999px;
  background: var(--accent-warm); color: var(--accent-warm-on); font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.messaging-inbox-timestamp { flex: none; font-size: 0.72rem; color: var(--ink-soft); margin-left: auto; }

/* WhatsApp-parity pass (2026-09-09): typing, delivery ticks, and
   reactions. (Online/last-seen status was removed on 2026-09-18.) */

.messaging-thread-header-text { display: flex; flex-direction: column; min-width: 0; }
.messaging-thread-header-text h1 { margin: 0; }
.messaging-presence-line {
  margin: 0; font-size: 0.78rem; color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.messaging-presence-line [data-messaging-typing-text] { color: var(--accent-secondary-ink); font-style: italic; }

/* Delivery/read ticks -- WhatsApp's own single-check (sent)/double-
   check (delivered)/blue-double-check (read) ladder. #53bdeb is that
   same app's own signature "read" blue -- kept as a literal, narrowly-
   scoped accent (not a new root token) since it's meaningful only as
   this one universally-recognized affordance, not a color this site's
   own editorial palette would otherwise use anywhere else. */
.messaging-tick { font-size: 0.85em; letter-spacing: -0.15em; padding-right: 0.15em; }
.messaging-tick-sent, .messaging-tick-delivered { color: var(--ink-faint, var(--ink-soft)); }
.messaging-tick-read { color: #53bdeb; }

/* Reactions -- pills under a bubble, plus the small picker popover
   opened from the message's own react button. */
.messaging-message-has-reactions .messaging-message-bubble { padding-bottom: 1.6em; }
.messaging-message-reactions {
  position: absolute; bottom: -0.7em; left: 0.5em; display: flex; gap: 0.2em;
}
.messaging-message-mine .messaging-message-reactions { left: auto; right: 0.5em; }
.messaging-message-bubble { position: relative; }
.messaging-reaction-pill {
  display: inline-flex; align-items: center; gap: 0.2em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--paper-raised); color: var(--ink);
  font-size: 0.72rem; padding: 0.05em 0.4em; cursor: pointer; line-height: 1.6;
}
.messaging-reaction-pill-mine { border-color: var(--accent-secondary); background: var(--paper); }
.messaging-reaction-count { color: var(--ink-soft); }
.messaging-reaction-picker {
  position: absolute; z-index: 6; display: flex; gap: 0.2em; padding: 0.3em;
  border: 1px solid var(--border); border-radius: 999px; background: var(--paper-raised);
  box-shadow: none; bottom: 100%; margin-bottom: 0.3em;
}
.messaging-reaction-picker-option {
  background: transparent; border: none; cursor: pointer; font-size: 1.1rem; padding: 0.15em 0.3em; border-radius: 6px;
}
.messaging-reaction-picker-option:hover { background: var(--paper); }

@media (max-width: 640px) {
  .messaging-inbox-header { align-items: flex-start; }
  .messaging-inbox-row a { padding: 0.75em 0.25em; }
  /* max-height/min-height removed here 2026-09-11 -- this used to
     re-cap .messaging-thread at mobile widths independently of
     .messaging-conversation-page's own bounded height, reintroducing
     the exact "composer needs a second page-level scroll" bug this
     class's later rule blocks were fixed for -- see the base
     .messaging-thread and .messaging-conversation-page rules' own
     comments for the full story. flex: 1 1 auto (base rule) already
     sizes this correctly at every width now. */
  .messaging-message { max-width: 94%; }
  .messaging-reaction-picker { right: 0; max-width: calc(100vw - 2rem); }
  .messaging-reply-form { padding-bottom: max(0.6em, env(safe-area-inset-bottom)); }
}


/* Messaging visual refresh: one restrained workspace language across
   the inbox, request flow, and conversation view. */
.messaging-inbox-page,
.messaging-conversation-page,
.messaging-new-page {
  width: min(100%, 760px);
  margin-inline: auto;
  font-family: var(--font-body);
}

.messaging-inbox-header {
  margin: 0 0 1.5rem;
  padding: 0.35rem 0;
}
.messaging-inbox-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  letter-spacing: -0.035em;
}
.messaging-inbox-header .dek { margin-top: 0.25rem; color: var(--ink-soft); }
.messaging-add-friend {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 1.05rem;
  box-shadow: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.messaging-add-friend:hover {
  transform: translateY(-1px);
  box-shadow: none;
}
.messaging-section-heading {
  margin: 1.4rem 0 0.55rem;
  padding-inline: 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.messaging-inbox {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--paper-raised);
  box-shadow: none;
}
.messaging-inbox-row + .messaging-inbox-row { border-top: 1px solid var(--border); }
.messaging-inbox-row a {
  min-height: 4rem;
  padding: 0.8rem 0.95rem;
  border: 0;
  gap: 0.85rem;
  transition: background-color 120ms ease;
}
.messaging-inbox-row a:hover,
.messaging-inbox-row a:focus-visible {
  background: color-mix(in srgb, var(--accent-secondary) 5%, var(--paper-raised));
}
.messaging-inbox-row-unread a {
  background: color-mix(in srgb, var(--accent-secondary) 4%, var(--paper-raised));
}
.messaging-inbox .messaging-avatar { width: 2.65rem; height: 2.65rem; font-size: 0.95rem; }
.messaging-inbox-user { font-size: 0.95rem; font-weight: 650; }
.messaging-inbox-preview { font-size: 0.82rem; line-height: 1.35; }
.messaging-inbox-timestamp { font-size: 0.69rem; }
.messaging-inbox-unread-badge {
  min-width: 1.45rem;
  height: 1.45rem;
  box-shadow: none;
}
.messaging-request-list .messaging-inbox-row a { padding-left: 0.95rem; }
.messaging-request-chevron { margin-left: auto; color: var(--ink-faint); font-size: 1.5rem; }
.messaging-archived {
  margin-top: 1.25rem;
  padding: 0;
  border: 0;
}
.messaging-archived summary {
  width: fit-content;
  margin: 0 0 0.6rem 0.2rem;
  font-size: 0.78rem;
}

.messaging-back-link {
  width: min(100%, 760px);
  margin: 0 auto 0.65rem;
  padding-left: 0.15rem;
}
/* 2026-09-11 fix: previously an unbounded block with no defined height --
   .messaging-thread capped itself at max-height:60vh, but nothing capped
   the CARD as a whole, so header + thread + reply-quote-banner + composer
   + emoji-picker could easily add up to more than the actual viewport
   (confirmed live: a 694px-tall desktop viewport). .messaging-reply-form's
   own position:sticky (below) then stuck relative to the PAGE's scroll,
   not this card -- so reaching the composer needed a second, page-level
   scroll past the thread's own already-internal one, and the two competed
   (the composer could render over the thread's last rows instead of
   pushing them up). Making the card itself a flex column, bounded to
   whatever viewport space remains below the site header (var(--header-
   height), same variable/pattern already used for the journal calendar's
   own sticky pane sizing -- see .journal-list-pane), with ONLY the thread
   as a flex:1 scrolling region, means the composer is now always visible
   as an ordinary flex child at the bottom -- no page-level scroll, no
   sticky-relative-to-the-wrong-ancestor, ever. 4rem subtracted covers
   site-main's own top padding (--space-4, 2rem) plus .messaging-back-
   link's own height+margin (~1.65rem) sitting above this card -- the only
   things between the site header and this card. min-height is a floor for
   very short viewports (matches roughly what .messaging-thread's own old
   mobile-only min-height already assumed was reasonable).

   FALLBACK ONLY as of 2026-09-11: confirmed live that --header-height
   alone isn't enough to derive this card's real available space -- the
   site header's position: sticky + its own transform: translateZ(0)
   (see .site-header's own comment) produces an offset this static calc()
   can't account for, so the card rendered shorter than the viewport
   actually allowed even though --header-height itself was accurate.
   static/js/site.js's initMessagingThread() -> sizeMessagingCard() now
   measures the card's real on-screen position directly and sets an
   inline height that overrides this the instant it runs -- this calc()
   only matters for the brief window before that JS executes (or if JS
   is unavailable), same "constant is a fallback, not the source of
   truth once JS is live" pattern var(--header-height, 112px) itself
   already uses. Don't try to fix the composer-visibility bug by tuning
   this formula again -- fix/verify sizeMessagingCard() instead. */
.messaging-conversation-page {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--paper-raised);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-height, 112px) - 4rem);
  min-height: 24rem;
  /* overflow-y: auto (not hidden) as a defensive fallback ONLY --
     .messaging-thread's own flex: 1 1 auto/min-height: 0 is what's
     actually supposed to absorb any size variation among the other
     (flex:none) children, so this should never actually need to
     trigger in normal operation. But this card's fixed height means
     that if it ever does (e.g. the .messaging-emoji-picker[hidden] bug
     found and fixed the same day this rule was added -- something like
     that recurring elsewhere later), the composer degrades to "needs a
     scroll to reach" rather than being silently clipped and completely
     unreachable, which overflow: hidden would have caused instead. */
  overflow-y: auto;
}
.messaging-thread-header {
  flex: none;
  margin: 0;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--paper-raised) 96%, transparent);
}
.messaging-thread-header h1 {
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.messaging-avatar-lg { width: 2.6rem; height: 2.6rem; font-size: 1rem; }
.messaging-presence-line { margin-top: 0.18rem; font-size: 0.7rem; }
.messaging-search-toggle,
.messaging-menu-toggle,
.messaging-call-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--ink-soft);
  font-size: 1.05rem;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.messaging-search-toggle:hover,
.messaging-search-toggle:focus-visible,
.messaging-menu-toggle:hover,
.messaging-menu-toggle:focus-visible,
.messaging-call-button:hover,
.messaging-call-button:focus-visible {
  border-color: var(--border);
  background: var(--paper);
}
/* The back chevron was missing from this list (2026-09-18, site owner:
   "the go back button is too dark"): with no rule its path used the SVG
   default, a solid black fill, nearly invisible on the dark header. */
.messaging-back-link svg,
.messaging-search-toggle svg,
.messaging-call-button svg,
.messaging-reply-form [data-messaging-send-button] svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messaging-menu { margin-left: 0; }
.messaging-menu-panel {
  top: calc(100% + 0.35rem);
  width: 17rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.4rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
}
.messaging-menu-actions[hidden],
.messaging-menu-report-panel[hidden] { display: none; }
.messaging-menu-actions form { margin: 0; }
.messaging-menu-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.25;
}
.messaging-menu-icon,
.messaging-menu-chevron,
.messaging-menu-back svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messaging-menu-chevron {
  width: 0.95rem;
  height: 0.95rem;
  margin-left: auto;
  color: var(--ink-faint);
}
.messaging-menu-divider {
  height: 1px;
  margin: 0.35rem 0.4rem;
  background: var(--border);
}
.messaging-menu-item-danger { color: var(--line-news-ink); }
.messaging-menu-item-danger:hover,
.messaging-menu-item-danger:focus-visible {
  background: color-mix(in srgb, var(--line-news) 9%, var(--paper-raised));
}
.messaging-menu-subheader {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
  padding: 0 0.25rem 0.35rem;
  border-bottom: 1px solid var(--border);
}
.messaging-menu-subheader strong { font-size: 0.88rem; }
.messaging-menu-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.messaging-menu-back:hover,
.messaging-menu-back:focus-visible { background: var(--paper); color: var(--ink); }
.messaging-menu-report-panel { padding: 0.15rem; }
.messaging-menu-report-copy {
  margin: 0.65rem 0.45rem 0.8rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.45;
}
.messaging-menu-report-form { margin: 0; }
.messaging-menu-report-field {
  display: block;
  margin: 0 0.45rem 0.7rem;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 650;
}
.messaging-menu-report-field > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.messaging-menu-report-field small { color: var(--ink-faint); font-size: 0.68rem; font-weight: 500; }
.messaging-menu-report-form select,
.messaging-menu-report-form textarea {
  width: 100%;
  box-sizing: border-box;
  border-color: var(--border-strong);
  border-radius: 7px;
  background: var(--paper);
}
.messaging-menu-report-form textarea {
  min-height: 5rem;
  margin-top: 0;
  resize: vertical;
}
.messaging-menu-report-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 0.45rem;
  margin: 0.6rem 0.45rem 0.35rem;
}
.messaging-menu-report-actions button {
  min-height: 2.35rem;
  margin: 0;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.messaging-report-cancel { border: 1px solid var(--border); background: transparent; color: var(--ink-soft); }
.messaging-menu-report-actions .messaging-report-button {
  width: auto;
  margin: 0;
  border: 1px solid var(--line-news);
  background: var(--line-news);
  color: var(--line-news-on);
}
.messaging-search-bar { margin: 0; padding: 0.7rem 1rem 0; }
.messaging-search-input {
  min-height: 2.5rem;
  padding-inline: 0.9rem;
  border-radius: 999px;
  background: var(--paper);
}
/* Chrome/Safari draw their own X inside a type="search" input once it has
   a value -- redundant now that .messaging-search-clear is a real, always-
   visible control right next to it (2026-09-28); without this an input
   with text shows two X's. Firefox never drew one, so this is a no-op there. */
.messaging-search-input::-webkit-search-cancel-button { display: none; }
.messaging-search-bar button { flex: none; border-radius: 999px; }
.messaging-search-results { max-height: 16rem; overflow: auto; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
.messaging-search-results > p { margin: 0.25rem 0 0.6rem; color: var(--ink-soft); }
/* A real <button> now (2026-09-28, jumps to the message if it's loaded), not a plain div --
   reset the button defaults so it still reads as a plain result row, not a form control. */
.messaging-search-result {
  display: block; width: 100%; text-align: left;
  padding: 0.6rem; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
.messaging-search-result:nth-child(even) { background: var(--paper); }
.messaging-search-result:hover { background: color-mix(in srgb, var(--accent-secondary) 8%, var(--paper)); }
.messaging-search-result span { display: block; color: var(--ink-soft); font-size: 0.82rem; }
.messaging-search-clear {
  border: 0; background: transparent; color: var(--ink-soft); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0.2em 0.5em;
}
.messaging-search-clear:hover { color: var(--ink); }
/* Briefly marks the message a search result jumped to (site.js removes it after 2s). */
.messaging-thread .messaging-message-search-highlight .messaging-message-bubble {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
  transition: outline-color 0.2s ease;
}

.messaging-thread {
  /* height: clamp(...) removed here 2026-09-11 -- this was the actual
     winning declaration (later in source order than the base rule
     above, same selector/specificity) and reintroduced a self-sized
     thread independent of .messaging-conversation-page's own bounded
     height, which is what let header+thread+composer add up to more
     than the viewport in the first place. flex: 1 1 auto (base rule,
     not overridden by anything here) now does this job instead --
     removing this stray height is the actual fix, not the base rule's
     comment alone. max-height: none kept -- still correct, nothing
     should re-cap this independently of the flex layout. */
  max-height: none;
  margin: 0;
  padding: 1.2rem 1rem;
  gap: 0.2rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent-secondary) 4%, transparent), transparent 34%),
    color-mix(in srgb, var(--paper) 97%, var(--ink) 3%);
}
.messaging-message { max-width: min(82%, 35rem); gap: 0.5rem; }
.messaging-message .messaging-avatar { width: 1.8rem; height: 1.8rem; font-size: 0.72rem; }
.messaging-message-bubble {
  padding: 0.62rem 0.82rem;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 17px 17px 17px 5px;
  box-shadow: none;
}
.messaging-message-mine .messaging-message-bubble {
  border-color: color-mix(in srgb, var(--accent-secondary) 18%, var(--border));
  border-radius: 17px 17px 5px 17px;
  background: color-mix(in srgb, var(--accent-secondary) 11%, var(--paper-raised));
}
.messaging-message-body { font-size: 0.91rem; line-height: 1.45; }
.messaging-article-card { display: flex; gap: 0.65rem; margin-top: 0.55rem; padding: 0.55rem; max-width: 25rem; border: 1px solid var(--border); border-radius: 11px; background: var(--paper); color: var(--ink); text-decoration: none; }
.messaging-article-card img { width: 5rem; height: 4rem; border-radius: 7px; object-fit: cover; }
.messaging-article-card span { min-width: 0; }
.messaging-article-card strong, .messaging-article-card small { display: block; }
.messaging-article-card small { margin-top: 0.2rem; color: var(--ink-soft); font-size: 0.72rem; line-height: 1.3; }
.messaging-share-preview { display: flex; gap: 1rem; margin: 1rem 0 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--paper-raised); }
.messaging-share-preview img { width: 8rem; height: 6rem; border-radius: 10px; object-fit: cover; }
.messaging-share-preview p { margin: 0.4rem 0 0; color: var(--ink-soft); }
.messaging-report-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.45rem;
  padding: 0.15rem 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
}
.messaging-report-block input { margin: 0; accent-color: var(--line-news); }
.messaging-message-quote { margin: -0.15rem -0.2rem 0.5rem; padding: 0.35rem 0.6rem; border-radius: 7px; }
.messaging-message-action.messaging-message-action-text {
  width: auto;
  padding-inline: 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.messaging-message + .messaging-message-meta,
.messaging-message-meta { margin: 0.18rem 0 0.42rem 2.3rem; text-align: left; }
.messaging-message-mine + .messaging-message-meta {
  align-self: flex-end;
  margin-right: 0.25rem;
  margin-left: 0;
}
.messaging-day-separator {
  align-self: center;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-raised) 92%, transparent);
  font-size: 0.64rem;
}
.messaging-thread-empty {
  margin: auto;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper-raised) 80%, transparent);
}
.messaging-reply-quote-banner {
  margin: 0;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border-left: 0;
  border-top: 1px solid var(--border);
}
.messaging-reply-form {
  position: relative;
  bottom: auto;
  margin: 0;
  padding: 0.75rem 0.9rem;
  gap: 0.55rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 22px 22px;
  background: var(--paper-raised);
}
.messaging-reply-form textarea {
  min-height: 2.7rem;
  padding: 0.68rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.35;
}
.messaging-reply-form textarea:focus { border-color: var(--accent-secondary); outline: 2px solid color-mix(in srgb, var(--accent-secondary) 18%, transparent); }
.messaging-reply-form button,
.messaging-emoji-toggle { width: 2.7rem; height: 2.7rem; }
.messaging-reply-form [data-messaging-send-button] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.messaging-emoji-toggle { background: var(--paper); border: 1px solid var(--border); }
.messaging-send-status { margin: 0; padding: 0 1rem 0.45rem; background: var(--paper-raised); }
.messaging-new-messages-button { z-index: 3; margin-top: -3.2rem; }
.messaging-load-older { margin-block: 0.7rem; }
.messaging-request-card,
.messaging-request-waiting,
.messaging-blocked-notice {
  margin: 2rem auto;
  border-radius: 16px;
}

.messaging-new-page {
  max-width: 34rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--paper-raised);
  box-shadow: none;
}
.messaging-new-intro { text-align: center; margin-bottom: 1.4rem; }
.messaging-new-intro h1 { margin: 0.6rem 0 0.35rem; font-size: 1.65rem; }
.messaging-new-intro .dek { margin: 0 auto; max-width: 27rem; }
.messaging-new-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-secondary) 11%, var(--paper));
  color: var(--accent-secondary-ink);
  font-size: 1.45rem;
  font-weight: 500;
}
/* "Your friend link" under the Add-a-friend card: it had no styles at
   all (a bare heading and a tiny link box). Same width as the card,
   full-width read-only field. */
.messaging-friend-link {
  width: min(100%, 544px);
  margin: var(--space-3) auto 0;
  font-family: var(--font-body);
}
.messaging-friend-link h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.messaging-friend-link p { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.95rem; }
.messaging-friend-link input {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}
.messaging-friend-link .field-hint { margin-top: 0.5rem; font-size: 0.82rem; }

/* Messaging rules reminders (2026-09-17): quiet, flat, no fill. */
/* One quiet line at the start of the history (2026-09-18: was a boxed
   paragraph). It scrolls away with the conversation; the file warnings
   live on each received file and under the message box. */
.messaging-rules-notice {
  list-style: none;
  margin: 0.25rem auto 0.9rem;
  padding: 0 0.8rem;
  max-width: 34rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.messaging-rules-hint {
  margin: 0.6rem 0 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}

.messaging-new-form { margin: 0; }
.messaging-new-form input { min-height: 2.75rem; border-radius: 10px; }
.messaging-new-form button { width: 100%; min-height: 2.75rem; margin-top: 0.35rem; }

@media (max-width: 640px) {
  .messaging-inbox-page,
  .messaging-conversation-page,
  .messaging-new-page { width: 100%; }
  .messaging-inbox-header { padding-inline: 0.15rem; }
  .messaging-add-friend { min-height: 2.5rem; padding-inline: 0.8rem; font-size: 0.8rem; }
  .messaging-inbox { border-radius: 14px; }
  .messaging-inbox-row a { padding: 0.75rem; }
  .messaging-conversation-page { border-radius: 16px; }
  .messaging-thread-header { border-radius: 16px 16px 0 0; }
  /* height/min-height removed here 2026-09-11 -- .messaging-thread's own
     base rule (flex: 1 1 auto; min-height: 0) now sizes it correctly at
     every width, via .messaging-conversation-page's own bounded height;
     a fixed height here would just fight that. padding tweak kept. */
  .messaging-thread { padding: 1rem 0.65rem; }
  .messaging-message { max-width: 91%; }
  .messaging-reply-form { border-radius: 0 0 16px 16px; padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
  .messaging-new-page { border-radius: 16px; }
}

/* Voice/video calling overlay (2026-09-10). Minimal/functional pass --
   not a visual-design-heavy treatment. Base rule sets `display: grid`
   directly on the class (not relying on cascade order against the UA
   `[hidden] { display: none }` rule), so the [hidden] override below is
   required regardless of specificity -- same established precedent as
   .back-to-top[hidden]/.reading-tally[hidden] elsewhere in this file. */
.messaging-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: color-mix(in srgb, black 65%, transparent);
}
.messaging-call-overlay[hidden] { display: none; }

.messaging-call-incoming,
.messaging-call-active {
  width: min(100%, 26rem);
  border-radius: 16px;
  background: var(--paper-raised);
  border: 1px solid var(--border);
  padding: 1.4rem;
  text-align: center;
  box-shadow: none;
}
.messaging-call-incoming p { margin: 0 0 1rem; font-size: 1rem; }
.messaging-call-incoming button {
  min-height: 2.6rem;
  padding-inline: 1.1rem;
  margin: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
}
.messaging-call-incoming [data-messaging-call-answer] {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: var(--paper);
}
.messaging-call-incoming [data-messaging-call-decline] {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

/* Active call (redesigned 2026-09-18, site owner: "make these buttons
   look better", and Mute / Camera never showed their state). Fixed dark
   colours in both themes, like the photo viewer: a call screen is dark
   in every app. Round icon buttons with a label under each; a pressed
   toggle turns into a solid white circle with the crossed-out icon.
   Flat throughout: solid fills and hairlines, no shadows. */
.messaging-call-active {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 40rem);
  padding: 0;
  overflow: hidden;
  border-color: #2a2a2f;
  background: #111113;
  color: #f4f4f5;
}
.messaging-call-stage { position: relative; background: #000; }
.messaging-call-active [data-messaging-call-remote-video] {
  display: block;
  width: 100%;
  max-height: 70vh;
  min-height: 16rem;
  background: #000;
  object-fit: cover;
}
.messaging-call-active [data-messaging-call-local-video] {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 6.5rem;
  height: 9rem;
  border-radius: 10px;
  border: 1px solid #3f3f46;
  background: #000;
  object-fit: cover;
}
/* A video call shows the other person, so the name only appears on an
   audio call, where it takes the place of the video. */
.messaging-call-name { display: none; margin: 0; }
.messaging-call-active[data-call-type="audio"] video { display: none; }
.messaging-call-active[data-call-type="audio"] .messaging-call-name {
  display: block;
  padding: 3.5rem 1rem;
  background: #111113;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.messaging-call-timer {
  margin: 0;
  padding: 0.75rem 0 0;
  color: #a1a1aa;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.messaging-call-timer:empty { display: none; }
.messaging-call-network-status {
  margin: 0;
  padding: 0.35rem 1rem 0;
  color: #d4d4d8;
  font-size: 0.78rem;
}
.messaging-call-network-status:empty { display: none; }
.messaging-call-quota-status {
  margin: 0;
  padding: 0.25rem 1rem 0;
  color: #fbbf24;
  font-size: 0.75rem;
}
.messaging-call-quota-status:empty { display: none; }

.messaging-call-controls {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.1rem 1rem max(1.1rem, env(safe-area-inset-bottom, 0px));
}
.messaging-call-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 4.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: #f4f4f5;
  font: inherit;
  cursor: pointer;
}
.messaging-call-control[hidden] { display: none; }
.messaging-call-control-icon {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: #34343a;
  color: #f4f4f5;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.messaging-call-control-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .messaging-call-control:hover .messaging-call-control-icon { background: #45454c; }
  .messaging-call-control-hangup:hover .messaging-call-control-icon { background: #c0392b; }
}
.messaging-call-control:focus-visible { outline: none; }
.messaging-call-control:focus-visible .messaging-call-control-icon { outline: 2px solid #f4f4f5; outline-offset: 3px; }
.messaging-call-control-label { font-size: 0.75rem; color: #d4d4d8; white-space: nowrap; }
.messaging-call-icon-pressed { display: none; }
.messaging-call-control[aria-pressed="true"] .messaging-call-icon-default { display: none; }
.messaging-call-control[aria-pressed="true"] .messaging-call-icon-pressed { display: block; }
.messaging-call-control[aria-pressed="true"] .messaging-call-control-icon { background: #f4f4f5; color: #111113; }
.messaging-call-control-hangup .messaging-call-control-icon { background: #d93a2f; color: #fff; }

/* Minimize (top-left of the video) and the "turn on sound" prompt shown
   when the browser only allowed the other person's video to play muted
   (site.js playRemoteVideo). */
.messaging-call-minimize {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid #3f3f46;
  border-radius: 50%;
  background: #111113;
  color: #f4f4f5;
  cursor: pointer;
}
.messaging-call-minimize svg,
.messaging-call-mini-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messaging-call-minimize:focus-visible,
.messaging-call-mini-button:focus-visible { outline: 2px solid #f4f4f5; outline-offset: 2px; }
.messaging-call-unmute {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 1;
  transform: translateX(-50%);
  min-height: 2.5rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: #f4f4f5;
  color: #111113;
  font: inherit;
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
}
.messaging-call-unmute[hidden] { display: none; }
.messaging-call-mini-bar { display: none; }

/* Minimized: a small floating window over the chat, no backdrop, so the
   conversation underneath can be read and typed into during the call.
   site.js moves it by setting left/top when it's dragged. */
/* Bottom right, raised clear of the composer and its Send button. */
.messaging-call-overlay[data-minimized="true"] {
  inset: auto 1rem 7rem auto;
  display: block;
  width: 15rem;
  padding: 0;
  background: none;
}
.messaging-call-overlay[data-minimized="true"] .messaging-call-active {
  width: 100%;
  height: auto;
  border: 1px solid #3f3f46;
  border-radius: 12px;
}
.messaging-call-overlay[data-minimized="true"] .messaging-call-stage {
  flex: none;
  height: 11.25rem;
  cursor: grab;
  touch-action: none;
}
.messaging-call-overlay[data-minimized="true"] .messaging-call-active [data-messaging-call-remote-video] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}
.messaging-call-overlay[data-minimized="true"] [data-messaging-call-local-video],
.messaging-call-overlay[data-minimized="true"] .messaging-call-minimize,
.messaging-call-overlay[data-minimized="true"] .messaging-call-timer,
.messaging-call-overlay[data-minimized="true"] .messaging-call-controls { display: none; }
.messaging-call-overlay[data-minimized="true"] .messaging-call-active[data-call-type="audio"] .messaging-call-stage {
  display: grid;
  place-items: center;
  height: auto;
  background: #111113;
}
.messaging-call-overlay[data-minimized="true"] .messaging-call-active[data-call-type="audio"] .messaging-call-name {
  padding: 1rem 0.75rem 0.25rem;
  font-size: 1rem;
}
.messaging-call-overlay[data-minimized="true"] .messaging-call-mini-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem;
  border-top: 1px solid #2a2a2f;
}
.messaging-call-mini-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #34343a;
  color: #f4f4f5;
  cursor: pointer;
}
.messaging-call-mini-hangup { background: #d93a2f; color: #fff; }
.messaging-call-overlay[data-minimized="true"] .messaging-call-unmute {
  bottom: 0.5rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.8rem;
}

/* Phones: the call fills the screen like a phone call app, video on top
   and the buttons on a solid bar underneath. */
@media (max-width: 799px) {
  .messaging-call-overlay:has(.messaging-call-active:not([hidden])) { padding: 0; }
  .messaging-call-active {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .messaging-call-stage { flex: 1 1 auto; min-height: 0; }
  .messaging-call-active [data-messaging-call-remote-video] {
    position: absolute;
    inset: 0;
    height: 100%;
    max-height: none;
    min-height: 0;
  }
  .messaging-call-active [data-messaging-call-local-video] {
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    width: 6.75rem;
    height: 9.5rem;
    z-index: 1;
  }
  .messaging-call-active[data-call-type="audio"] .messaging-call-stage {
    display: grid;
    place-items: center;
    background: #111113;
  }
  .messaging-call-minimize { top: max(0.75rem, env(safe-area-inset-top, 0px)); }
  /* Top right, under the chat header: the bottom of the screen belongs to
     the composer and the keyboard while you type. */
  .messaging-call-overlay[data-minimized="true"] {
    inset: calc(env(safe-area-inset-top, 0px) + 4.5rem) 0.75rem auto auto;
    width: 8.5rem;
  }
  .messaging-call-overlay[data-minimized="true"] .messaging-call-active { height: auto; }
  .messaging-call-overlay[data-minimized="true"] .messaging-call-stage { height: 11rem; }
  .messaging-call-overlay[data-minimized="true"] .messaging-call-mini-bar { gap: 0.75rem; padding: 0.4rem; }
}

/* ---------------------------------------------------------------------
   Persistent conversation sidebar (2026-09-14, Telegram-inspired layout
   requested directly -- functional layout only: Biblinkage' own navy/blue/
   amber palette throughout, no Telegram branding/blue/assets copied).
   Same two-pane list+detail idiom .journal-layout already established
   for the Journal feature (grid, single column below the breakpoint,
   selecting a row is a real page navigation -- inbox.html and
   conversation.html are genuinely different page states, not a
   client-side swap) -- reused here for consistency rather than inventing
   a second pattern. Simpler than .journal-layout's own grid-column
   pinning trick: the sidebar (list) is already both first-in-DOM and
   visually-first/left here, so there's no keyboard-order-vs-visual-order
   mismatch to work around.
   --------------------------------------------------------------------- */
.messaging-app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  width: min(100%, 1080px);
  margin-inline: auto;
}
@media (min-width: 800px) {
  .messaging-app-shell { grid-template-columns: 300px minmax(0, 1fr); }
  /* Both panes keep their own existing card treatment (rounded corners +
     --shadow-card) rather than becoming one chrome-less flush app shell
     -- consistent with how every other "workspace" surface on this site
     (this messaging card itself, .journal-layout) already reads as a
     card floating on the page, not edge-to-edge browser chrome. */
  .messaging-app-shell .messaging-sidebar { height: calc(100dvh - var(--header-height, 112px) - 4rem); min-height: 24rem; }
}

.messaging-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
@media (min-width: 800px) {
  .messaging-sidebar { margin-right: 1rem; }
}
.messaging-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  padding: 1rem 1rem 0.6rem;
}
.messaging-sidebar-header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.messaging-sidebar-add-friend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  color: var(--line-brand-on);
  background: var(--line-brand);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.messaging-sidebar-add-friend:hover {
  transform: translateY(-1px);
  box-shadow: none;
}
.messaging-sidebar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
  margin: 0 1rem 0.7rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-faint);
}
/* Every icon SVG in the sidebar/thread header shares this same Feather-
   style line-icon shape (viewBox 24x24, stroke-based, no default fill --
   see .messaging-thread-header's own 2026-09-12 comment on why raw fill
   reads as off-brand/can't pick up currentColor). */
.messaging-sidebar-search svg,
.messaging-sidebar-add-friend svg,
.messaging-sidebar-requests-banner svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messaging-sidebar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
}
.messaging-sidebar-search input:focus { outline: none; }
.messaging-sidebar-requests-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
  margin: 0 1rem 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-secondary) 10%, var(--paper-raised));
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 550;
}
.messaging-sidebar-requests-banner:hover { background: color-mix(in srgb, var(--accent-secondary) 16%, var(--paper-raised)); }
.messaging-sidebar-requests-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.72rem;
  font-weight: 700;
}
.messaging-sidebar-requests-banner svg { margin-left: auto; flex: none; color: var(--ink-faint); }
.messaging-sidebar .messaging-inbox {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
  background: transparent;
}
.messaging-sidebar .messaging-inbox-row + .messaging-inbox-row { border-top: 1px solid var(--border); }
.messaging-sidebar .messaging-inbox-row a { padding-inline: 1rem; }
.messaging-inbox-row-active a { background: color-mix(in srgb, var(--accent-secondary) 11%, var(--paper-raised)) !important; }
.messaging-sidebar-empty {
  padding: 1.2rem 1rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.messaging-sidebar-no-results {
  margin: 0.5rem 1rem 1rem;
  color: var(--ink-faint);
  font-size: 0.82rem;
}
.messaging-sidebar-row-hidden { display: none !important; }

/* The active pane -- inbox's own empty state, or the open conversation
   card. Same width/font rules .messaging-inbox-page/.messaging-
   conversation-page already had standalone; scoped here to inside the
   shell now that the sidebar sits beside it instead of each page
   centering its own single 760px column. */
.messaging-app-shell .messaging-inbox-page,
.messaging-app-shell .messaging-conversation-page,
.messaging-active-pane {
  width: auto;
  margin-inline: 0;
  min-width: 0;
}
.messaging-active-pane-empty {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
@media (min-width: 800px) {
  .messaging-active-pane-empty { min-height: calc(100dvh - var(--header-height, 112px) - 4rem); }
}
.messaging-empty-pane-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 3.5rem 1.5rem;
  color: var(--ink-soft);
}
.messaging-empty-pane-icon { fill: var(--border-strong); }
.messaging-empty-pane-content h1 { margin: 0.3rem 0 0; font-size: 1.4rem; letter-spacing: -0.02em; color: var(--ink); }
.messaging-empty-pane-content .dek { margin: 0; max-width: 26rem; }
.messaging-add-friend-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 0.6rem;
  min-height: 2.6rem;
  padding-inline: 1.1rem;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-weight: 600;
  box-shadow: none;
}
.messaging-secondary-lists {
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.messaging-secondary-lists .messaging-section-heading:first-child { margin-top: 1.5rem; }

/* Back-to-inbox affordance in the thread header: only needed once the
   sidebar itself is hidden (below the breakpoint) -- see
   .messaging-app-shell-thread-open below. Icon button, matching the
   call/search/menu buttons beside it rather than the old block-level
   text link. */
.messaging-back-link {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  margin-right: 0.15rem;
  border-radius: 50%;
  color: var(--ink-soft);
}
.messaging-back-link:hover { background: var(--paper); color: var(--accent-secondary-ink); }
@media (max-width: 799px) {
  .messaging-back-link { display: inline-flex; }
  .messaging-app-shell-thread-open .messaging-sidebar { display: none; }
  .messaging-empty-pane-content { display: none; }
}

/* ---------------------------------------------------------------------
   Telegram-style thread (2026-09-14) -- bubbles with the time inside,
   a right-click / long-press message menu instead of the hover toolbar,
   plain header icons, and a one-bar composer. Functional layout only:
   Biblinkage' own palette tokens throughout, nothing of Telegram's own
   colors or assets. Selectors are scoped under .messaging-thread /
   .messaging-thread-header / .messaging-reply-form so they reliably win
   over the several earlier messaging passes above without !important.
   --------------------------------------------------------------------- */

/* A one-to-one thread doesn't need an avatar beside every bubble -- the
   header already says who this is. Hidden rather than removed so
   renderMessage()/colorAvatars() in site.js need no changes. */
.messaging-thread .messaging-message .messaging-avatar { display: none; }
.messaging-thread .messaging-message { max-width: min(78%, 34rem); gap: 0; position: relative; }
/* Extra breathing room only where the sender changes; consecutive
   messages from the same person stay tightly stacked. */
.messaging-thread .messaging-message-mine + .messaging-message:not(.messaging-message-mine),
.messaging-thread .messaging-message:not(.messaging-message-mine) + .messaging-message-mine { margin-top: 0.55rem; }

.messaging-thread .messaging-message-bubble {
  /* Flex-wrap so a short message and its time share one line, and a
     long one pushes the time onto its own line, bottom-right. */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 0.6rem;
  padding: 0.42rem 0.7rem 0.36rem;
  border: 0;
  border-radius: 16px 16px 16px 5px;
  background: var(--paper-raised);
  box-shadow: none;
  -webkit-touch-callout: none;
}
.messaging-thread .messaging-message-mine .messaging-message-bubble {
  border-radius: 16px 16px 5px 16px;
  background: color-mix(in srgb, var(--accent-secondary) 17%, var(--paper-raised));
}
.messaging-thread .messaging-message-recalled .messaging-message-bubble {
  background: transparent;
  border: 1px dashed var(--border-strong);
  box-shadow: none;
}
.messaging-thread .messaging-message-bubble > * { flex: 1 1 100%; min-width: 0; }
.messaging-thread .messaging-message-bubble > .messaging-message-body { flex: 0 1 auto; }
/* Reactions sit inside the bubble on the same row as the time (left and
   right), rather than the earlier pass's pill overlaid on the bubble's
   bottom edge -- which, with the time now inside the bubble, landed
   directly on top of the time and ticks (found in a real screenshot). */
.messaging-thread .messaging-message-bubble > .messaging-message-reactions {
  position: static;
  order: 9;
  flex: 0 1 auto;
  margin: 0.3rem 0 0;
}
.messaging-thread .messaging-message-has-reactions .messaging-message-bubble { padding-bottom: 0.36rem; }
/* A zero-height full-width flex item that forces the reactions + time row
   onto its own line below the text, even when the text is short. */
.messaging-thread .messaging-message-has-reactions .messaging-message-bubble::after {
  content: "";
  order: 8;
  flex: 1 1 100%;
  height: 0;
}
.messaging-thread .messaging-message-edited-marker { font-size: 0.72rem; }
.messaging-thread .messaging-bubble-meta {
  flex: 0 0 auto;
  order: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0.2rem -0.15rem -0.06rem auto;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.messaging-thread .messaging-message-mine .messaging-bubble-meta { color: color-mix(in srgb, var(--accent-secondary-ink) 55%, var(--ink-soft)); }
.messaging-thread .messaging-bubble-meta .messaging-tick { padding-right: 0; }
.messaging-thread .messaging-bubble-meta .messaging-tick-read { color: var(--accent-secondary); }

/* The message menu. Closed: invisible, non-interactive, parked ABOVE the
   bubble inside the message's own width -- never beside it, since even
   an invisible absolutely-positioned box to the side would widen the
   thread's scrollable area and add a horizontal scrollbar. Opened by
   right-click/long-press: position: fixed at the pointer (site.js
   openMenu() sets left/top). Opened by keyboard focus: shown where it
   is parked. */
.messaging-thread .messaging-message-actions {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 0.3rem);
  left: 0;
  right: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 11.5rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper-raised);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transform-origin: top left;
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.messaging-thread .messaging-message-mine .messaging-message-actions { left: auto; right: 0; transform-origin: top right; }
/* Hovering a message no longer reveals anything (the earlier passes'
   hover toolbar), and touch screens no longer show it permanently. */
.messaging-thread .messaging-message:hover .messaging-message-actions { opacity: 0; pointer-events: none; }
@media (hover: none) {
  .messaging-thread .messaging-message .messaging-message-actions { opacity: 0; pointer-events: none; transform: scale(0.97); }
  /* Long-press opens the menu, so a press mustn't also start selecting text. */
  .messaging-thread .messaging-message-bubble { -webkit-user-select: none; user-select: none; }
}
.messaging-thread .messaging-message:focus-within .messaging-message-actions,
.messaging-thread .messaging-message.messaging-message-menu-open .messaging-message-actions {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.messaging-thread .messaging-message.messaging-message-menu-open .messaging-message-actions {
  position: fixed;
  bottom: auto;
  right: auto;
}
.messaging-thread .messaging-message-action {
  display: flex;
  align-items: center;
  /* An earlier pass centred these (they were small round icon buttons);
     menu rows read left-aligned. */
  justify-content: flex-start;
  gap: 0.7rem;
  width: 100%;
  height: auto;
  min-height: 2.25rem;
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.messaging-thread .messaging-message-action:hover { background: color-mix(in srgb, var(--accent-secondary) 10%, var(--paper-raised)); color: var(--ink); }
.messaging-thread .messaging-message-action:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--accent-secondary) 10%, var(--paper-raised));
  box-shadow: inset 0 0 0 2px var(--accent-secondary);
}
.messaging-thread .messaging-message-action svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink-soft);
  pointer-events: none;
}
.messaging-thread .messaging-message-action-danger,
.messaging-thread .messaging-message-action-danger svg { color: var(--line-news-ink); }
.messaging-thread .messaging-message-action-danger:hover { background: color-mix(in srgb, var(--line-news) 9%, var(--paper-raised)); color: var(--line-news-ink); }
/* React's emoji choices render as a row across the top of the open menu. */
.messaging-thread .messaging-message-actions .messaging-reaction-picker {
  position: static;
  order: -1;
  flex-wrap: wrap;
  margin: 0 0 0.25rem;
  padding: 0.1rem 0.1rem 0.35rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Header: name + presence take the free space, and every icon button sits
   together on the right as a plain icon -- no filled circles. */
.messaging-thread-header .messaging-thread-header-text { flex: 1 1 auto; }
/* Found in a real 390px screenshot: without truncation a long-enough name
   ran straight into the call icon instead of shrinking. */
.messaging-thread-header .messaging-thread-header-text h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messaging-thread-header > .messaging-call-button,
.messaging-thread-header > .messaging-search-toggle,
.messaging-thread-header > .messaging-menu,
.messaging-thread-header > .messaging-back-link,
.messaging-thread-header > .messaging-avatar { flex: none; }
@media (max-width: 480px) {
  .messaging-thread-header { gap: 0.3rem; padding-inline: 0.6rem; }
  .messaging-thread-header .messaging-call-button,
  .messaging-thread-header .messaging-search-toggle,
  .messaging-thread-header .messaging-menu-toggle { width: 2.1rem; height: 2.1rem; }
}
.messaging-thread-header .messaging-call-button,
.messaging-thread-header .messaging-search-toggle,
.messaging-thread-header .messaging-menu-toggle {
  margin-left: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.messaging-thread-header .messaging-call-button:hover,
.messaging-thread-header .messaging-call-button:focus-visible,
.messaging-thread-header .messaging-search-toggle:hover,
.messaging-thread-header .messaging-search-toggle:focus-visible,
.messaging-thread-header .messaging-menu-toggle:hover,
.messaging-thread-header .messaging-menu-toggle:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}

/* Composer: one rounded input bar holding the emoji button, the text box
   and the attach button, with the send button beside it. */
.messaging-reply-form { align-items: flex-end; gap: 0.5rem; }
.messaging-composer-field {
  display: flex;
  align-items: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.1rem;
  padding: 0.18rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--paper);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.messaging-composer-field:focus-within {
  border-color: var(--accent-secondary);
  box-shadow: none;
}
.messaging-reply-form .messaging-composer-field textarea,
.messaging-reply-form .messaging-composer-field textarea:focus {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.4rem;
  max-height: 9rem;
  overflow-y: auto;
  padding: 0.6rem 0.25rem;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  resize: none;
}
.messaging-reply-form .messaging-emoji-toggle,
.messaging-reply-form .messaging-attach-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.messaging-reply-form .messaging-emoji-toggle:hover,
.messaging-reply-form .messaging-emoji-toggle:focus-visible,
.messaging-reply-form .messaging-attach-toggle:hover { color: var(--accent-secondary-ink); background: transparent; }
.messaging-reply-form .messaging-emoji-toggle svg,
.messaging-reply-form .messaging-attach-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.messaging-reply-form [data-messaging-send-button] { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; }

/* Generic file attachments (2026-09-09) -- JournalFileBlot's node
   carries filename/filetype as data attributes, not text content (see
   that blot's own comment on why) -- rendered here via
   content: attr(...) instead. */
/* 2026-09-19: an outline file icon (the app's own icon style, in place of
   the 📄 emoji) and the name in link color -- the whole chip is the
   download link (JournalFileBlot sets `download`). The icon is a mask so
   it takes the text color. */
.ql-editor .journal-file, .journal-read-view .journal-file {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.25em 0.65em; border-radius: 6px;
  background: none; border: 1px solid var(--border);
  color: var(--accent-secondary-ink); text-decoration: none; font-size: 0.9em;
  max-width: 100%; vertical-align: middle;
}
.journal-read-view .journal-file:hover { border-color: currentColor; }
.journal-read-view .journal-file:hover::after { text-decoration: underline; }
.ql-editor .journal-file::before, .journal-read-view .journal-file::before {
  content: ""; flex: none; width: 1.05em; height: 1.05em; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpolyline points='14 3 14 8 19 8'/%3E%3Cpath d='M12 11v6'/%3E%3Cpolyline points='9.5 14.5 12 17 14.5 14.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpolyline points='14 3 14 8 19 8'/%3E%3Cpath d='M12 11v6'/%3E%3Cpolyline points='9.5 14.5 12 17 14.5 14.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ql-editor .journal-file::after, .journal-read-view .journal-file::after {
  content: attr(data-filename); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Full editable tables (2026-09-09, OneNote-parity toolbar pass,
   quill-table-better) -- read-view only; the live editor gets its
   look from quill-table-better/dist/quill-table-better.css itself
   (imported by JournalEditor.jsx). Confirmed directly (frontend/
   node_modules/quill-table-better/dist/quill-table-better.css) that
   module's own stylesheet only borders <th>, not <td>
   (".ql-editor th{border:1px solid #000;...}", no equivalent td rule
   at all) -- these rules deliberately cover both, a real improvement
   over the editor's own look, not just parity with it. */
.journal-read-view table {
  border-collapse: collapse; width: 100%; margin: 1em 0;
}
.journal-read-view td, .journal-read-view th {
  border: 1px solid var(--border-strong); padding: 0.4em 0.6em;
}
.journal-read-view th { background: var(--paper-raised); font-weight: 600; }

/* ---------------------------------------------------------------------
   Contacts (2026-09-15, site owner: "make it like Telegram more, with the
   contacts feature") -- Chats | Contacts sidebar tabs, the contact list,
   the contact info screen, and the clickable thread-header identity.
   Flat per the site owner's standing direction: hairline borders and
   solid colour only -- no shadows, edge stripes or tinted fills. Tabs
   mirror .site-nav's 2026-09-15 treatment (bold ink + short rounded bar).
   --------------------------------------------------------------------- */
.messaging-sidebar-tabs {
  display: flex;
  flex: none;
  gap: 0.25rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--border);
}
.messaging-sidebar-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem 0.65rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 0.15s ease;
}
.messaging-sidebar-tab::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 1.6rem;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-secondary);
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.2s ease;
}
.messaging-sidebar-tab:hover { color: var(--ink); }
.messaging-sidebar-tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.messaging-sidebar-tab[aria-selected="true"]::after { transform: translateX(-50%) scaleX(1); }
.messaging-sidebar-tab:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  .messaging-sidebar-tab::after { transition: none; }
}
.messaging-sidebar-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--accent-warm);
  color: var(--accent-warm-on);
  font-size: 0.68rem;
  font-weight: 700;
}

/* A panel fills the sidebar below the tabs and owns its own scrolling,
   the way .messaging-inbox already did before the tabs existed. */
.messaging-sidebar-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-top: 0.7rem;
}
.messaging-sidebar-panel[hidden] { display: none; }
.messaging-sidebar .messaging-sidebar-panel .messaging-inbox { border-top: 1px solid var(--border); }
.messaging-sidebar-panel .messaging-sidebar-empty { list-style: none; }
.messaging-contacts-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.messaging-contacts-actions,
.messaging-contacts-list,
.messaging-contact-shared {
  margin: 0;
  padding: 0;
  list-style: none;
}
.messaging-contacts-action {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 0;
  background: transparent;
  color: var(--accent-secondary-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.messaging-contacts-action:hover { background: var(--paper); }
.messaging-contacts-action:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; }
.messaging-contacts-action .messaging-sidebar-requests-count { margin-left: auto; }
.messaging-contacts-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.65rem;
  height: 2.2rem;
}
.messaging-contacts-action-icon svg,
.messaging-contact-info-link svg,
.messaging-contact-back svg,
.messaging-contact-quick-action svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.messaging-contacts-caption {
  margin: 0.5rem 0 0;
  padding: 0.55rem 1rem 0.35rem;
  border-top: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 0.74rem;
  font-weight: 600;
}

.messaging-contact-row {
  display: flex;
  align-items: center;
}
.messaging-contact-row > a:first-child {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0 0.55rem 1rem;
  color: inherit;
  text-decoration: none;
}
.messaging-contact-row:hover,
.messaging-contact-row-active { background: var(--paper); }
.messaging-contact-row .messaging-avatar { width: 2.65rem; height: 2.65rem; font-size: 0.95rem; }
.messaging-contact-copy { display: flex; flex-direction: column; min-width: 0; }
.messaging-contact-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.messaging-contact-status {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.messaging-contact-info-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  color: var(--ink-faint);
}
.messaging-contact-info-link:hover { color: var(--accent-secondary-ink); }

/* Thread header: avatar + name + presence are one link to contact info. */
.messaging-thread-header-identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
a.messaging-thread-header-identity:hover h1 { color: var(--accent-secondary-ink); }
a.messaging-thread-header-identity:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; border-radius: 8px; }
.messaging-thread-header-identity .messaging-avatar { flex: none; }

/* Contact info screen */
.messaging-contact-pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--paper-raised);
  overflow: hidden;
}
@media (min-width: 800px) {
  .messaging-contact-pane { min-height: calc(100dvh - var(--header-height, 112px) - 4rem); }
}
.messaging-contact-topbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.messaging-contact-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  color: var(--ink-soft);
}
.messaging-contact-back:hover { color: var(--accent-secondary-ink); }
.messaging-contact-topbar-title { font-weight: 700; }
.messaging-contact-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 2rem 1rem 1.25rem;
  text-align: center;
}
.messaging-avatar-xl { width: 5.5rem; height: 5.5rem; margin-bottom: 0.6rem; font-size: 2.1rem; }
.messaging-contact-hero h1 {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.messaging-contact-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  width: min(100%, 26rem);
  margin-inline: auto;
  padding: 0 1rem 1.4rem;
  box-sizing: border-box;
}
.messaging-contact-quick-actions form { margin: 0; }
.messaging-contact-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  height: 100%;
  min-height: 4rem;
  padding: 0.6rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--accent-secondary-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.messaging-contact-quick-action:hover { border-color: var(--accent-secondary); }
.messaging-contact-quick-action:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

.messaging-contact-details { margin: 0; border-top: 1px solid var(--border); }
.messaging-contact-details > div { padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--border); }
.messaging-contact-details dt { color: var(--ink-faint); font-size: 0.76rem; font-weight: 600; }
.messaging-contact-details dd { margin: 0.2rem 0 0; color: var(--ink); overflow-wrap: anywhere; }
.messaging-contact-name-form { display: flex; gap: 0.5rem; margin-top: 0.2rem; }
.messaging-contact-name-form input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.messaging-contact-name-form input:focus { outline: none; border-color: var(--accent-secondary); }
.messaging-contact-name-form button {
  flex: none;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.messaging-contact-name-form button:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.messaging-contact-hint { margin: 0.35rem 0 0; color: var(--ink-faint); font-size: 0.76rem; }

.messaging-contact-section { padding: 1rem 1.25rem 0.5rem; }
.messaging-contact-section h2 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.messaging-contact-section h2 span { color: var(--ink-faint); font-weight: 600; }
.messaging-contact-shared li + li { border-top: 1px solid var(--border); }
.messaging-contact-shared a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 0;
  color: inherit;
  text-decoration: none;
}
.messaging-contact-shared a:hover .messaging-contact-shared-title { color: var(--accent-secondary-ink); }
.messaging-contact-shared-title { font-weight: 600; line-height: 1.35; }
.messaging-contact-shared-meta { color: var(--ink-faint); font-size: 0.76rem; }
.messaging-contact-empty { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.86rem; }

.messaging-contact-danger { margin-top: auto; padding: 0.5rem 0 0.75rem; border-top: 1px solid var(--border); }
.messaging-contact-danger form { margin: 0; }
.messaging-contact-danger-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: 0;
  background: transparent;
  color: var(--line-news-ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.messaging-contact-danger-item:hover { background: var(--paper); }
.messaging-contact-danger-item:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; }

/* ---------------------------------------------------------------------
   Full-screen photo viewer (2026-09-15) -- see site.js's
   initMessagingPhotoViewer. A solid near-black stage, the photo fitted
   to the screen (or actual size once tapped), and a plain top bar. Fixed
   dark colours in both themes on purpose: a photo viewer's stage is
   black in every app, whatever the page theme.
   --------------------------------------------------------------------- */
.messaging-photo-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0b0c;
  color: #f4f4f5;
}
.messaging-photo-viewer[open] { display: flex; flex-direction: column; }
.messaging-photo-viewer::backdrop { background: #0b0b0c; }
.messaging-photo-viewer-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
  padding: 0.6rem max(1rem, env(safe-area-inset-right)) 0.6rem max(1rem, env(safe-area-inset-left));
  padding-top: max(0.6rem, env(safe-area-inset-top));
  border-bottom: 1px solid #26262a;
}
.messaging-photo-viewer-caption {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c4c4c8;
}
.messaging-photo-viewer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 2.4rem;
  padding: 0 0.8rem;
  border: 1px solid #3a3a40;
  border-radius: 999px;
  background: transparent;
  color: #f4f4f5;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.messaging-photo-viewer-button:hover { border-color: #f4f4f5; }
.messaging-photo-viewer-button:focus-visible { outline: 2px solid #f4f4f5; outline-offset: 2px; }
.messaging-photo-viewer-close { width: 2.4rem; padding: 0; font-size: 1.4rem; line-height: 1; }
.messaging-photo-viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem;
}
.messaging-photo-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
/* Actual size: the photo keeps its natural pixels and the stage scrolls.
   margin:auto (not the stage's centring) so a photo bigger than the
   screen can be scrolled to every edge instead of being clipped. */
.messaging-photo-viewer-zoomed .messaging-photo-viewer-stage { display: block; }
.messaging-photo-viewer-zoomed .messaging-photo-viewer-image { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }

/* ---------------------------------------------------------------------
   Android app features (2026-09-17, static/js/native.js). Flat: hairline
   borders, solid colours, no shadows.
   --------------------------------------------------------------------- */
/* Journal lock: hide the page until unlocked (class set before paint by
   base.html's head script, and by native.js). */
html.journal-locked .site-main { visibility: hidden; }
.journal-lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: var(--paper);
}
.journal-lock-screen[hidden] { display: none; }
.journal-lock-box {
  width: min(100%, 22rem);
  text-align: center;
  font-family: var(--font-body);
  color: var(--ink);
}
.journal-lock-box h2 { margin: 0 0 0.4rem; font-size: 1.35rem; }
.journal-lock-box p { margin: 0 0 var(--space-3); color: var(--ink-soft); }
.journal-lock-unlock {
  width: 100%;
  min-height: 2.75rem;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}
.journal-lock-leave { display: inline-block; margin-top: var(--space-2); font-size: 0.9rem; }

/* App settings on the account page. */
.app-settings[hidden] { display: none; }
.app-settings { margin: 0 0 var(--space-3); font-family: var(--font-body); font-size: 0.95rem; }
.app-settings-time { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.4rem 1.65rem; color: var(--ink-soft); font-size: 0.9rem; }
.app-settings-time input {
  font: inherit;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--paper-raised);
  color: var(--ink);
}
.app-settings-offline { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.55rem 0; }
.app-settings-offline .privacy-save { align-self: flex-start; }
.app-settings-status { margin: 0.3rem 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--ink-soft); }

/* Study page reminder prompt (app only). */
.study-reminder-prompt[hidden] { display: none; }
.study-reminder-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.study-reminder-prompt button {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: var(--radius);
  background: var(--line-brand);
  color: var(--line-brand-on);
  cursor: pointer;
}

/* Offline reading: saved badges and the flashcard list. */
.saved-offline-status { margin: 0 0 var(--space-2); font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-soft); }
.saved-offline-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  vertical-align: middle;
}
.offline-flashcards[hidden] { display: none; }
.offline-flashcards { margin-top: var(--space-4); }
.offline-flashcards h2 { font-size: 1.2rem; margin: 0 0 0.3rem; }
.offline-flashcard-list { list-style: none; margin: 0; padding: 0; font-family: var(--font-body); }
.offline-flashcard { border-bottom: 1px solid var(--border); padding: 0.6rem 0; }
.offline-flashcard summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.offline-flashcard-due {
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--accent-warm);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--accent-warm-ink);
}
.offline-flashcard p { margin: 0.35rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }
.offline-flashcard .offline-flashcard-meaning { color: var(--ink); }
.offline-flashcard .offline-flashcard-example { font-style: italic; }

/* "Share to Biblinkage" page (2026-09-17). */
.share-target-preview {
  margin: 0 0 var(--space-3);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.share-target-preview > * { display: block; }
.share-target-preview > * + * { margin-top: 0.25rem; }
.share-target-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.share-target-option {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
}
.share-target-option:hover { border-color: var(--line-brand); }
.share-target-option strong { color: var(--line-brand); }
.share-target-option span { font-size: 0.85rem; color: var(--ink-soft); }

/* Attachments you receive stay closed until you open them (2026-09-18). */
.messaging-attachment-locked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: var(--font-body);
}
.messaging-attachment-locked-name { margin: 0; font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.messaging-attachment-locked-hint { margin: 0; font-size: 0.78rem; color: var(--ink-soft); }
.messaging-attachment-locked button {
  margin-top: 0.15rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.messaging-attachment-locked button:hover { border-color: var(--ink); }
.messaging-plan-hint { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--ink-soft); font-family: var(--font-body); }

/* ===========================================================================
   App shell, modern pass (2026-09-18, site owner: "check its UI design. make
   it modern and user friendly. it should be comparable to the most popular UI
   of current apps"). Scoped to html.capacitor-app -- the website keeps its
   own look -- and flat throughout, per the owner's standing rule: hairline
   borders and solid colour, never shadows, edge stripes or tinted fills.
   =========================================================================== */

/* App bar. The 3px accent rule under the masthead is a website masthead
   device (see .line-strip); an app bar ends cleanly at its own hairline. The
   header's icon actions become ghost buttons -- a bare icon with a round
   press target, as in current Android/iOS app bars -- instead of outlined
   circles whose two ring colours didn't even match. The avatar keeps its
   solid fill: it's content, not chrome. */
html.capacitor-app .line-strip { display: none; }
html.capacitor-app .app-header-search,
html.capacitor-app .messages-link {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: var(--ink);
}
html.capacitor-app .app-header-search:active,
html.capacitor-app .messages-link:active { background: var(--paper-raised); }
html.capacitor-app .app-header-search svg,
html.capacitor-app .messages-link svg { width: 22px; height: 22px; }

/* One word-lookup hint, not two. The article carried both a permanent
   lightbulb callout and the dismissible .lookup-hint saying the same thing;
   the dismissible one teaches a new reader and then goes away for good. */
html.capacitor-app .vocab-hint { display: none; }

/* Today: a flat surface with a hairline, not a tinted plate. */
html.capacitor-app .today-card {
  background: var(--paper);
  border: 1px solid var(--border);
}

/* Settings rows act like an app's: actions are tappable text in the accent
   colour, not underlined web links. */
html.capacitor-app .profile-change-link,
html.capacitor-app .account-card a:not(.button) {
  text-decoration: none;
  font-weight: 600;
}

/* Article toolbar in the app: Listen, Save, Share + More (2026-09-18, site
   owner chose "Primary + More"). The secondary actions stay in the DOM --
   the More sheet and the reading bar both proxy them (initAppArticleMoreSheet,
   initReadingHeaderTools) -- they just aren't shown in the row. The Aa
   button's wrapper becomes layout-less so its now-hidden button leaves no
   gap, while its panel can still open. */
html.has-bottom-nav .article-actions .action-vocab-mode,
html.has-bottom-nav .article-actions .action-reading-prefs,
html.has-bottom-nav .article-actions .action-focus-mode,
html.has-bottom-nav .article-actions .action-journal,
html.has-bottom-nav .article-actions .action-journal-login {
  display: none;
}
html.has-bottom-nav .article-actions .action-reading-prefs-wrap { display: contents; }
/* 2026-09-18 (launch-readiness plan item 2.8): the rules above were
   html.capacitor-app only; html.has-bottom-nav is the app AND the
   phone-width website, which now gets the same one-row toolbar. The More
   button (site.js initAppArticleMoreSheet) exists at every width but only
   shows here. */
.article-actions .action-more { display: none; }
html.has-bottom-nav .article-actions .action-more { display: inline-flex; }
.article-actions .action-more { padding-inline: 0.7em; }
/* Same item, the rest of the phone-width squeeze on the space above the
   article text: a slimmer toolbar, and the word-lookup hint as one plain
   line rather than a bordered box -- or not at all once the dismissible
   .lookup-hint (signed-in readers, site.js initLookupHint) is saying the
   same thing, as the app already does. */
html.has-bottom-nav .article-actions {
  padding-block: 0.45rem;
  margin-bottom: var(--space-2);
}
html.has-bottom-nav .vocab-hint {
  padding: 0;
  border: none;
  background: none;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
html.has-bottom-nav .vocab-hint .article-icon { width: 15px; height: 15px; margin-top: 0.1em; }
html.has-bottom-nav .article-detail:has(.lookup-hint) .vocab-hint { display: none; }
html.has-bottom-nav .article-detail > .dek { font-size: 1.05rem; margin-bottom: var(--space-2); }
.article-actions .action-more svg { fill: currentColor; stroke: none; }

/* The More sheet: a flat bottom sheet (hairline top edge, solid paper),
   rising from the bottom edge the way current app sheets do. */
.app-sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  background: var(--paper);
  color: var(--ink);
}
.app-sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.app-sheet-inner { padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px)); }
.app-sheet-handle {
  width: 36px;
  height: 4px;
  margin: 4px auto 8px;
  border-radius: 2px;
  background: var(--border-strong);
}
.app-sheet-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.app-sheet-row:active { background: var(--paper-raised); }
.app-sheet-row[hidden] { display: none; }
.app-sheet-row[aria-pressed="true"] { color: var(--accent-secondary-ink); font-weight: 600; }
.app-sheet-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  flex: none;
  font-weight: 700;
  color: var(--ink-soft);
}
.app-sheet-icon svg { width: 22px; height: 22px; }

/* Text size opened from the sheet: shown as a panel just above the bottom
   nav, where the sheet was, rather than hanging off the hidden Aa button. */
html.has-bottom-nav .reading-prefs-panel.app-from-sheet {
  position: fixed !important;
  top: auto !important;
  left: 12px !important;
  right: 12px !important;
  bottom: calc(var(--app-nav-total-height, 58px) + 12px) !important;
  width: auto !important;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 60;
}

/* App top bar title (2026-09-18): the logo on Today and article pages, the
   section's name on the other tabs. */
.app-bar-title { display: none; }
html.capacitor-app body:is([data-active-pillar="saved"], [data-active-pillar="study"], [data-active-pillar="journal"],
  [data-active-pillar="feeds"], [data-active-pillar="messages"], [data-active-pillar="search"]) .brand {
  display: none;
}
html.capacitor-app .app-bar-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}
/* ...so these pages' own big headings would repeat it directly underneath.
   Visually hidden in the app, not removed: each is still its page's main
   heading for screen readers. (Journal's heading stays: it's the switcher
   between journals, not a repeat.) */
html.capacitor-app .section-page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Account screen as a settings list (2026-09-18, site owner: "do it" -- it
   read like a web form: labels left, "Change" links right). App only. The
   pattern of Android Settings and current apps: each editable row is one
   tap target showing its name, its current value underneath and a chevron;
   toggles are switches on the right; account actions are plain rows.
   Flat throughout: hairlines and solid colour only.
   --------------------------------------------------------------------------- */
html.capacitor-app .profile-rows li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 2px;
  min-height: 60px;
  padding: 10px 0;
}
html.capacitor-app .profile-rows .meta-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
html.capacitor-app .profile-rows .profile-value {
  justify-content: flex-start;
  text-align: left;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
/* Editable rows: the whole row is the link (the link's own box stretched
   over the row), marked with a chevron instead of the word "Change" -- the
   link keeps "Change username" etc. as its accessible name. */
html.capacitor-app .profile-rows li:has(.profile-change-link) { padding-right: 28px; }
html.capacitor-app .profile-rows .profile-change-link { font-size: 0; }
html.capacitor-app .profile-rows .profile-change-link::before {
  content: "";
  position: absolute;
  inset: 0;
}
html.capacitor-app .profile-rows li:has(.profile-change-link)::after {
  content: "\203A";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-52%);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-faint);
  pointer-events: none;
}
html.capacitor-app .profile-rows li:has(.profile-change-link:active) { background: var(--paper); }

/* Toggles: text left, a switch right. */
html.capacitor-app .privacy-toggle {
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
}
html.capacitor-app .privacy-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  flex: none;
  border-radius: 13px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.15s ease;
}
html.capacitor-app .privacy-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.15s ease;
}
html.capacitor-app .privacy-toggle input[type="checkbox"]:checked { background: var(--line-brand); }
html.capacitor-app .privacy-toggle input[type="checkbox"]:checked::before { transform: translateX(18px); }
html.capacitor-app .privacy-toggle input[type="checkbox"]:disabled { opacity: 0.5; cursor: default; }
html.capacitor-app .privacy-toggle input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }

/* Account actions (admin dashboard, log out, delete account): one grouped
   list of plain rows, like the bottom of a settings screen, instead of a
   loose row of a link, an outlined button and a link. */
html.capacitor-app .profile-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-size: 1rem;
  overflow: hidden;
}
html.capacitor-app .profile-actions > * { border-bottom: 1px solid var(--border); }
html.capacitor-app .profile-actions > *:last-child { border-bottom: none; }
html.capacitor-app .profile-actions > a,
html.capacitor-app .profile-actions .profile-logout {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 var(--space-4);
  border: none;
  border-radius: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}
html.capacitor-app .profile-actions .profile-logout { color: var(--ink); }
html.capacitor-app .profile-actions .logout-form { margin: 0; }
html.capacitor-app .profile-actions .account-danger-link { margin-left: 0; color: var(--line-news-ink); }
html.capacitor-app .profile-actions > a:active,
html.capacitor-app .profile-actions .profile-logout:active { background: var(--paper); }

/* ---------------------------------------------------------------------------
   App feel (2026-09-18, site owner: "build my app to make its UI like a
   modern popular app"). App only.
   --------------------------------------------------------------------------- */

/* Page transitions (opted in by base.html for in-app requests): the header
   and bottom nav are their own transition groups, so they hold still while
   the page between them crossfades -- a tab switch, not a page reload. */
html.capacitor-app .site-header { view-transition-name: app-header; }
html.capacitor-app .app-bottom-nav { view-transition-name: app-bottom-nav; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 160ms; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* No web tap flash. Android WebView paints a translucent blue/grey box over
   anything tapped -- the most "this is a web page" tell there is. Replaced
   by a quick dim of the tapped control itself: flat, and it reads as a
   press. :where() keeps it at the lowest specificity, so any control with
   its own :active state keeps it. */
html.capacitor-app { -webkit-tap-highlight-color: transparent; }
html.capacitor-app :where(a, button, summary, label, [role="button"]):active { opacity: 0.6; }

/* The current tab's icon is drawn heavier as well as coloured, so it reads
   at a glance -- the flat equivalent of the active-indicator pill Material
   apps use (a tinted pill is exactly the fill this site avoids). Applies
   wherever the bottom nav shows: the app, and the website at phone width. */
html.has-bottom-nav .app-bottom-nav a.active .app-bottom-nav-icon { stroke-width: 2.2; }

/* Pinned rules notice (2026-09-18): above the scrolling messages until
   "Got it". Flat: hairline border, no fill. */
.messaging-rules-pinned {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0.5rem 0 0.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink);
}
.messaging-rules-pinned p { margin: 0; flex: 1; }
.messaging-rules-pinned button {
  flex: none;
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.messaging-rules-pinned button:hover { border-color: var(--ink); }
@media (max-width: 480px) {
  .messaging-rules-pinned { flex-direction: column; align-items: flex-start; }
}

/* Tool pages without the footer (2026-09-18): less empty space at the
   bottom, and the Journal panel reaches the bottom of the window instead
   of stopping at its last entry. */
body[data-active-pillar="study"] .site-main,
body[data-active-pillar="journal"] .site-main,
body[data-active-pillar="feeds"] .site-main,
body[data-active-pillar="messages"] .site-main { padding-bottom: var(--space-3); }
@media (min-width: 800px) {
  /* The Journal panel runs to the bottom of the window: the page becomes a
     column and the panel takes whatever height is left. */
  body[data-active-pillar="journal"] { min-height: 100dvh; display: flex; flex-direction: column; }
  /* In a flex column, .site-header's margin: 0 auto shrinks it to its
     content (798px at 1200 wide) instead of its usual 1080px, so the
     Journal header sat narrower than on every other page. */
  body[data-active-pillar="journal"] .site-header { width: 100%; }
  body[data-active-pillar="journal"] .site-main { flex: 1 0 auto; width: 100%; display: flex; flex-direction: column; }
  body[data-active-pillar="journal"] .journal-layout { flex: 1 0 auto; align-items: stretch; }
}

/* Feeds card pin and fold (2026-09-18). Flat: outline buttons; a pinned
   card's pin turns orange (the "where you are / attention" colour). */
.rss-feed-card-state { margin: 0; flex: none; }
.rss-feed-card-icon-btn {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.rss-feed-card-icon-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.rss-feed-card-icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rss-feed-card-pin[aria-pressed="true"] { color: var(--accent-warm-ink); }
.rss-feed-card-pin[aria-pressed="true"] svg { fill: var(--accent-warm); stroke: var(--accent-warm); }
.rss-feed-card-fold svg { transition: transform 0.15s ease; }
.rss-feed-card-folded .rss-feed-card-fold svg { transform: rotate(-90deg); }
.rss-feed-card-folded > :not(.rss-feed-card-header) { display: none; }
@media (prefers-reduced-motion: reduce) { .rss-feed-card-fold svg { transition: none; } }
.rss-feed-folded-heading { margin: var(--space-4) 0 var(--space-2); font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
@media (min-width: 760px) {
  .rss-feed-board-folded { grid-auto-rows: auto; align-items: start; }
}
.rss-feed-card-folded .rss-feed-card-header { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

/* Full-screen chat on phones (2026-09-18, site owner: "the chatbox to
   occupy the whole page during the chat mode in the mobile phone", and
   stay completely visible while typing). Wherever the bottom tab bar
   shows (html.has-bottom-nav: phone-width website and the app), an open
   conversation (html.messaging-chat-screen) hides the site header, tab
   bar and footer -- the chat's own back arrow returns to Messages -- and
   the card is pinned to the viewport. site.js's sizeFullScreenChat()
   sets its top and height from visualViewport, so it shrinks with the
   keyboard instead of sliding under it. min-height: 0 matters: the
   desktop card's 24rem floor is taller than what is left above an iPhone
   keyboard, which alone pushed the composer out of view. */
html.messaging-chat-screen.has-bottom-nav .site-header,
html.messaging-chat-screen.has-bottom-nav .line-strip,
html.messaging-chat-screen.has-bottom-nav .reading-progress,
html.messaging-chat-screen.has-bottom-nav .app-bottom-nav,
html.messaging-chat-screen.has-bottom-nav .site-footer { display: none; }
html.messaging-chat-screen.has-bottom-nav,
html.messaging-chat-screen.has-bottom-nav body { overflow: hidden; }
html.messaging-chat-screen.has-bottom-nav .messaging-conversation-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
html.messaging-chat-screen.has-bottom-nav .messaging-thread-header {
  border-radius: 0;
  padding-top: max(0.9rem, env(safe-area-inset-top, 0px));
}

/* No zoom when a chat field takes focus (2026-09-18, site owner: the chat
   still didn't fit the phone screen while typing). iOS Safari zooms the
   page into any text field under 16px, and the composer's textarea had
   no font-size of its own, so it fell back to the browser default. The
   zoom made everything about 1.3x larger, cut the right edge (call
   buttons, send button) off-screen, and sizeFullScreenChat() fitted the
   card to the zoomed viewport, leaving a sliver of thread. 16px is the
   threshold; touch screens only, so desktop text sizes stay as they were. */
@media (pointer: coarse) {
  html.messaging-chat-screen .messaging-conversation-page textarea,
  html.messaging-chat-screen .messaging-conversation-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  html.messaging-chat-screen .messaging-conversation-page select {
    font-size: max(16px, 1rem);
  }
}

/* Touch selections dock the word popover at the bottom (2026-09-18) so it
   never sits under the phone browser's own Copy / Share bar. Same sheet
   look as Vocabulary mode, without the dimmed backdrop. */
.flashcard-popover.is-touch-sheet { padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px)); }

/* Storage usage on the journal Files tab (2026-09-20). Reuses the
   .usage-bar / .usage-warning / .usage-full classes the account page
   already defines, so the bar reads identically in both places. */
.journal-files-storage { margin: 0 0 var(--space-2); }
.journal-files-storage-line {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.journal-files-storage.usage-full .journal-files-storage-line { color: var(--ink); }

/* Drag-and-drop onto the Files panel (2026-09-20). A dashed outline
   inset from the edge rather than a full overlay: the file list stays
   readable underneath, so a reader can still see where they are
   dropping. Pointer-events stay off the highlight so it can never
   swallow the drop it is advertising. */
.journal-media-gallery { position: relative; }
.journal-media-gallery.is-drag-over::after {
  content: "Drop files to upload";
  position: absolute;
  inset: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border: 2px dashed var(--line-brand);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--line-brand);
  z-index: 4;
}

/* Search and sort above the Files list (2026-09-20). One row on a
   desktop; stacked on a phone, where a side-by-side search box would be
   too narrow to read what you typed. */
.journal-files-controls {
  display: flex;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}
.journal-files-search { flex: 1 1 auto; min-width: 0; }
.journal-files-search input,
.journal-files-sort select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.35em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.journal-files-sort { flex: 0 0 auto; }
@media (max-width: 560px) {
  .journal-files-controls { flex-direction: column; }
  .journal-files-sort { flex: 1 1 auto; }
}

/* The line under the storage bar explaining why it never matches the
   sizes in the list (2026-09-20). Quieter than the figure itself --
   it is a footnote, not a warning. */
.journal-files-storage-note {
  margin: 0.25rem 0 0;
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-faint);
}

.hotspot-page { max-width: 720px; }
.hotspot-intro { color: var(--ink-soft); }
.hotspot-updated {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.hotspot-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.hotspot-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.hotspot-item:hover,
.hotspot-item:focus-within { border-color: var(--border-strong); }
.hotspot-rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-soft);
  min-width: 1.6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hotspot-body { flex: 1; min-width: 0; }
.hotspot-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--line-brand);
}
.hotspot-title:hover,
.hotspot-title:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.hotspot-title:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.hotspot-venue { margin: var(--space-1) 0 0; }
.hotspot-journal {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-secondary-ink);
  padding: 0.15em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper);
}
.hotspot-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.9rem;
  color: var(--ink-faint);
}
.hotspot-score {
  align-self: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-warm-ink);
  padding: 0.25em 0.7em;
  border: 1px solid currentColor;
  border-radius: 999px;
  white-space: nowrap;
}
.hotspot-page .topic-pagination { justify-content: center; gap: var(--space-3); }
.hotspot-page .topic-pagination a {
  padding: 0.4em 0.9em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.hotspot-page .topic-pagination a:hover,
.hotspot-page .topic-pagination a:focus-visible { border-color: var(--accent-secondary-ink); }
.hotspot-page .topic-pagination-status { margin: 0; }
@media (max-width: 540px) {
  .hotspot-item { flex-wrap: wrap; gap: var(--space-2); }
  .hotspot-rank { font-size: 1.15rem; min-width: 1.3em; }
}
.hotspot-empty { color: var(--ink-faint); }

/* Exchange page (exchange/): a compact hero, country chips with counts, and
   one boarding-pass card per university (flag stub, tear line, details).
   Roles: orange = deadlines and the active filter, navy = titles, links and
   the primary action, green/amber = window status. Tokens follow dark mode. */
.exchange-page { max-width: none; }
.exchange-hero {
  --exchange-hero-bg: var(--line-brand);
  --exchange-hero-fg: var(--line-brand-on);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--exchange-hero-bg);
  color: var(--exchange-hero-fg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .exchange-hero {
    --exchange-hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--line-brand) 22%, var(--paper-raised)), var(--paper-raised) 70%);
    --exchange-hero-fg: var(--ink);
    border: 1px solid var(--border);
  }
}
:root[data-theme="dark"] .exchange-hero {
  --exchange-hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--line-brand) 22%, var(--paper-raised)), var(--paper-raised) 70%);
  --exchange-hero-fg: var(--ink);
  border: 1px solid var(--border);
}
.exchange-hero h1 { margin: 0; color: inherit; font-size: clamp(1.75rem, 4.5vw, 2.25rem); letter-spacing: -0.01em; }
.exchange-intro { margin: 0.25rem 0 0; max-width: 60ch; font-size: 1rem; color: inherit; opacity: 0.9; }
.exchange-stats { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-2) 0 0; padding: 0; }
.exchange-stats li {
  padding: 0.2em 0.8em;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.exchange-note { margin: var(--space-2) 0 0; max-width: 70ch; font-size: 0.8rem; line-height: 1.5; color: inherit; opacity: 0.75; }
.exchange-filter { margin: var(--space-4) 0 0; }
/* Clears the sticky header when a link or redirect lands on one of these
   fragments (2026-10-10): filter bars, Track's #program-<pk>, a renamed
   feed card, a clicked Files row. */
.exchange-filter,
.exchange-item,
.deadlines-item,
.speaking-history-tabs,
.rss-feed-card,
.journal-files-list > li { scroll-margin-top: calc(var(--header-height, 56px) + var(--space-2)); }
.exchange-news { margin: var(--space-4) 0 0; }
.exchange-filter-label { display: block; margin-bottom: var(--space-1); font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.exchange-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.exchange-chip {
  padding: 0.4em 0.95em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-raised);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.exchange-chip:hover { border-color: var(--line-brand-ink); }
.exchange-chip:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.exchange-chip-count { margin-left: 0.2em; font-weight: 500; opacity: 0.7; }
.exchange-chip.is-active { background: var(--accent-warm); border-color: var(--accent-warm); color: var(--accent-warm-on); }
/* Continent tabs above the country chips (2026-10-04): one underlined row,
   scrolling sideways on a phone rather than wrapping into a second wall. */
.exchange-tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.exchange-tabs::-webkit-scrollbar { display: none; }
/* Admissions (2026-10-16) stacks level tabs above the continent chips. */
.admissions-levels { margin-bottom: var(--space-3); }
.exchange-tab {
  flex: none;
  padding: 0.55em 0.85em;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.exchange-tab:hover { color: var(--ink); }
.exchange-tab:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; }
.exchange-tab.is-active { color: var(--ink); border-bottom-color: var(--accent-warm); }
.exchange-country-chips { margin-top: var(--space-2); }
.exchange-country-chips .exchange-chip { font-size: 0.8rem; padding: 0.3em 0.8em; }
.exchange-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.exchange-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.exchange-item:hover,
.exchange-item:focus-within { border-color: var(--border-strong); transform: translateY(-2px); }
.exchange-stub {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-3) var(--space-1);
  border-right: 2px dashed var(--border-strong);
  border-radius: var(--radius) 0 0 var(--radius);
  background: color-mix(in srgb, var(--accent-warm) 10%, var(--paper-raised));
  font-size: 2.5rem;
  line-height: 1;
}
/* The two punches where the stub tears off. */
.exchange-stub::before,
.exchange-stub::after {
  content: "";
  position: absolute;
  right: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--border-strong);
}
.exchange-stub::before { top: -11px; clip-path: inset(50% 0 0 0); }
.exchange-stub::after { bottom: -11px; clip-path: inset(0 0 50% 0); }
.exchange-body { min-width: 0; padding: var(--space-3); }
.exchange-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.exchange-title { margin: 0; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
.exchange-title a { color: var(--line-brand-ink); text-decoration: none; }
.exchange-title a:hover,
.exchange-title a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.exchange-country {
  padding: 0.15em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.exchange-program { margin: 0.25rem 0 0; color: var(--ink-soft); }
.exchange-windows { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); }
.exchange-window {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.35em 0.4em 0.35em 0.9em;
  border: 1px solid var(--accent-warm);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-warm) 12%, var(--paper-raised));
  font-size: 0.9rem;
}
.exchange-window strong { color: var(--accent-warm-ink); }
.exchange-window-status {
  padding: 0.1em 0.65em;
  border-radius: 999px;
  background: var(--ink-faint);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.exchange-window.is-open .exchange-window-status { background: var(--line-economics-ink); color: var(--paper); }
.exchange-window.is-soon .exchange-window-status { background: var(--accent-warm-ink); color: var(--paper); }
.exchange-window.is-upcoming .exchange-window-status { background: var(--line-brand-ink); color: var(--paper); }
.exchange-window.is-closed { border-color: var(--border-strong); background: var(--paper); opacity: 0.75; }
.exchange-deadline-note { margin: var(--space-1) 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.exchange-tiles { margin: var(--space-3) 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: var(--space-1); }
.exchange-tiles > div { padding: var(--space-1) var(--space-2); border: 1px solid var(--border); border-radius: 10px; }
.exchange-tiles dt { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.exchange-tiles dd { margin: 0.1rem 0 0; font-size: 0.9rem; line-height: 1.4; overflow-wrap: anywhere; }
.exchange-tuition { margin: var(--space-2) 0 0; max-width: 70ch; font-size: 0.9rem; line-height: 1.5; }
.exchange-tuition strong { margin-right: 0.4em; }
.exchange-tuition.is-warning {
  padding: var(--space-1) var(--space-2);
  border-left: 4px solid var(--line-history);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--line-history) 14%, var(--paper-raised));
}
.exchange-eligibility { margin-top: var(--space-2); max-width: 70ch; }
.exchange-eligibility h3 { margin: 0; font-family: var(--font-display); font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.exchange-eligibility p { margin: 0.25rem 0 0; font-size: 0.9rem; line-height: 1.5; }
.exchange-eligibility ul { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; gap: 0.25rem; }
.exchange-eligibility li { position: relative; padding-left: 1.4em; font-size: 0.9rem; line-height: 1.5; }
.exchange-eligibility li::before { content: "✓"; position: absolute; left: 0; font-weight: 700; color: var(--line-economics-ink); }
.exchange-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.exchange-checked { display: inline-flex; align-items: center; gap: 0.35em; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }
.exchange-checked svg { color: var(--line-economics-ink); }
.exchange-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.55em 1.2em;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.exchange-cta:hover { background: var(--line-brand-ink); color: var(--line-brand-on); }
.exchange-cta:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.exchange-empty { margin-top: var(--space-4); color: var(--ink-soft); }
.exchange-hero-link { display: inline-block; margin-top: var(--space-2); font-size: 0.9rem; font-weight: 600; color: inherit; text-underline-offset: 3px; }
.exchange-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.exchange-track-form { margin: 0; }
.exchange-track {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5em 1.1em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.exchange-track:hover { border-color: var(--line-brand-ink); color: var(--line-brand-ink); }
.exchange-track:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.exchange-track.is-tracked { border-color: var(--line-economics-ink); color: var(--line-economics-ink); }

/* ---------------------------------------------------------------------
   Courses (2026-10-03, docs/course-materials-brief.md): a student's own
   courses and course files. Course cards carry a thin brand rule on the
   left, like a binder tab; everything else follows the account pages.
   --------------------------------------------------------------------- */
.courses-page { max-width: 1160px; }
.courses-back { margin: var(--space-2) 0 0; font-size: 0.9rem; }
.courses-head h1 { margin: 0.2rem 0 0; }
.courses-head-meta { margin: var(--space-2) 0 0; font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }
.courses-upload { margin-top: var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); }
.courses-upload > summary { padding: var(--space-2) var(--space-3); font-family: var(--font-display); font-weight: 600; cursor: pointer; }
/* Once a course has files, "+ Add a file" beside the Files heading opens
   this box (?upload=1 without JS), so a closed copy underneath would just
   be a second, bigger "Add a file" button. */
.courses-upload-tucked:not([open]) { display: none; }
.courses-limit { margin: 0; color: var(--ink-soft); }
/* Header row (2026-10-03): title on the left, "New course" / "Course
   settings" on the right, each a <details> whose panel drops down under
   its button (works without JS). */
.courses-head-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-3); }
.courses-head-row > div { flex: 1 1 20rem; min-width: 0; }
/* The panel is placed against the whole header row, so it stays on
   screen when the button wraps under the title on a phone. */
.courses-head-row { position: relative; }
.courses-head-row > .courses-popover { position: static; margin-top: var(--space-3); }
.courses-popover { position: relative; }
.courses-popover > summary { list-style: none; display: inline-flex; align-items: center; white-space: nowrap; }
.courses-popover > summary::-webkit-details-marker { display: none; }
.courses-popover-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  box-sizing: border-box;
  width: min(34rem, calc(100vw - 32px));
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
}
.courses-secondary {
  padding: 0.5em 1.15em;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.courses-secondary:hover { border-color: var(--line-brand-ink); }
.courses-popover > summary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.courses-field { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.courses-field-wide { grid-column: 1 / -1; }
.courses-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.courses-field input:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 1px; }
.courses-form-actions { margin-top: var(--space-2); }
/* Two button sizes across the course pages (2026-10-10, site owner: some
   buttons were too big). .courses-primary/.courses-secondary are the
   regular size (~36px) for page-level buttons and form submits;
   .courses-secondary-sm (~32px) is for actions inside a section -- file
   rows, toolbars, "Highlights and notes". Touch targets still grow to
   44px under the pointer: coarse rule further down. */
.courses-primary {
  padding: 0.5em 1.15em;
  border: 0;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.courses-primary:hover { background: var(--line-brand-ink); }
.courses-primary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-grid { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--space-3); }
.courses-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  background: var(--paper-raised);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.courses-card:hover { border-color: var(--line-brand-ink); }
.courses-card:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-card-code { font-size: 0.8rem; font-weight: 700; color: var(--line-brand-ink); }
.courses-card-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.courses-card-term { font-size: 0.85rem; color: var(--ink-soft); }
.courses-card-meta { margin-top: auto; padding-top: var(--space-2); font-size: 0.82rem; color: var(--ink-faint); }
.courses-card-opened { display: block; margin-top: 0.15rem; }
/* One navy binder tab for every course (2026-10-10): the five per-course
   colours (green, orange, purple, amber, red, by pk) meant nothing and
   read like statuses next to the site's red/amber notices. If a tab ever
   carries a colour again it should be a status with text beside it. */
.courses-empty { margin-top: var(--space-4); max-width: 60ch; color: var(--ink-soft); }
.courses-empty h2 { margin: 0 0 0.3em; font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.courses-upload > form,
.courses-upload > .courses-hint { margin-left: var(--space-3); margin-right: var(--space-3); }
.courses-upload > .courses-hint { margin-bottom: var(--space-3); }
.courses-files h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.15rem; }
.courses-upload-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.courses-file-pick { display: flex; flex-direction: column; gap: 0.35em; flex: 1 1 18rem; min-width: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.courses-file-pick input { max-width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); }
.courses-hint { margin: var(--space-2) 0 0; font-size: 0.82rem; line-height: 1.5; color: var(--ink-soft); }
.courses-files { margin-top: var(--space-4); }
.courses-file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.courses-file { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); scroll-margin-top: 6rem; }
.courses-file:target { border-color: var(--accent-secondary); }
.courses-file-main { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.courses-file-kind { flex: none; display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: var(--radius); background: color-mix(in srgb, var(--line-brand) 12%, var(--paper-raised)); font-size: 0.72rem; font-weight: 800; color: var(--line-brand-ink); }
/* Long names wrap after "_", "-" or "." (the soft_breaks filter's <wbr>s), and only mid-word as a last resort. */
.courses-file-name { font-weight: 600; color: var(--ink); overflow-wrap: break-word; }
.courses-file-meta { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--ink-soft); }
.courses-file-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; font-size: 0.88rem; }
.courses-file-actions form { margin: 0; }
.courses-file-text { min-width: 0; }
.courses-file-progress { font-weight: 600; color: var(--ink); }
.courses-file-open { padding: 0.45em 1em; border-radius: 999px; font-size: 0.82rem; background: var(--line-brand); color: var(--line-brand-on); font-weight: 600; text-decoration: none; white-space: nowrap; }
.courses-file-open:hover { background: var(--line-brand-ink); }
.courses-file-menu > summary { justify-content: center; width: 2rem; height: 2rem; border: 1px solid var(--border-strong); border-radius: 50%; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.courses-file-menu > summary:hover { border-color: var(--line-brand-ink); }
.courses-menu-list { display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem; width: max-content; min-width: 12rem; padding: 0.4rem; }
.courses-menu-list > a,
.courses-menu-list .courses-danger-link { display: block; width: 100%; padding: 0.5rem 0.7rem; border-radius: 6px; color: var(--ink); text-align: left; text-decoration: none; }
.courses-menu-list .courses-danger-link { color: var(--line-news-ink); }
.courses-menu-list > a:hover,
.courses-menu-list .courses-danger-link:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.courses-danger-link { padding: 0; border: 0; background: none; color: var(--line-news-ink); font: inherit; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.courses-empty-line { color: var(--ink-soft); }
.courses-file.is-pending .courses-file-kind { animation: courses-pulse 1.6s ease-in-out infinite; }
.courses-file.is-failed { border-color: var(--line-news-ink); }
.courses-file-state { font-weight: 600; color: var(--ink); }
.courses-file-state.is-error { font-weight: 500; color: var(--line-news-ink); }
@keyframes courses-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .courses-file.is-pending .courses-file-kind { animation: none; } }
/* Highlights and notes panel (2026-10-04 redesign): compact rows, one
   shape for highlights and page notes (page chip, then the text; the left
   edge is the highlight colour, neutral for notes), grouped by file in
   collapsible sections, with an All / Highlights / Notes filter. */
.courses-annotations { margin-top: var(--space-4); }
.courses-annotations-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); background: var(--paper); }
.courses-annotations-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.courses-annotations-total { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--ink-soft); }
.courses-secondary-sm { display: inline-block; padding: 0.35em 0.9em; font-size: 0.82rem; text-decoration: none; white-space: nowrap; }
.courses-secondary-sm:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
/* "Highlights and notes" controls, one look per job (2026-10-10, site
   owner: all five were identical outlined pills). Revision sheet is the
   section's main action (tinted, document icon); Export is a quiet
   download link; All/Highlights/Notes is a segmented view switch, the
   same soft-well + raised-segment pattern as .journal-view-toggle. */
.courses-tonal {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.9em;
  border: 1px solid color-mix(in srgb, var(--line-brand) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-brand) 14%, var(--paper-raised));
  color: var(--line-brand-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.courses-tonal:hover { background: color-mix(in srgb, var(--line-brand) 24%, var(--paper-raised)); border-color: var(--line-brand); }
.courses-tonal:focus-visible, .courses-quiet-link:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.4em 0.3em;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.courses-quiet-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.courses-action-icon { flex: none; }
.courses-annotations-filter { display: flex; gap: 0.15em; width: max-content; max-width: 100%; padding: 0.2em; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--ink) 5%, var(--paper)); }
.courses-annotations-filter[hidden] { display: none; }
.courses-annotations-filter button { flex: 1; padding: 0.35em 0.9em; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--ink-soft); font: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer; }
.courses-annotations-filter button:hover { color: var(--ink); }
.courses-annotations-filter button[aria-pressed="true"] { border-color: var(--border-strong); background: var(--paper-raised); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-card); }
.courses-annotations-filter button:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 1px; position: relative; }
.courses-annotations-file { border-bottom: 1px solid var(--border); }
.courses-annotations-file[hidden] { display: none; }
.courses-annotations-file > summary { display: flex; align-items: baseline; gap: var(--space-2); padding: 0.65rem 0; list-style: none; cursor: pointer; }
.courses-annotations-file > summary::-webkit-details-marker { display: none; }
.courses-annotations-file > summary::before { content: "\25B8"; flex: none; color: var(--ink-soft); transition: transform 0.15s ease; }
.courses-annotations-file[open] > summary::before { transform: rotate(90deg); }
.courses-annotations-file > summary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-annotations-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.courses-annotations-file-count { flex: none; font-size: 0.8rem; color: var(--ink-soft); }
.courses-annotation-list { list-style: none; margin: var(--space-2) 0 var(--space-3); padding: 0; display: grid; gap: 0.35rem; }
.courses-annotation[hidden] { display: none; }
.courses-annotation-row { display: grid; grid-template-columns: minmax(2.9rem, max-content) minmax(0, 1fr); gap: var(--space-2); align-items: start; padding: 0.45rem 0.6rem; border-left: 3px solid var(--hl-edge, var(--border-strong)); border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--hl-edge, var(--ink)) 8%, var(--paper-raised)); color: var(--ink); text-decoration: none; }
.courses-annotation.is-highlight { --hl-edge: #e6c200; }
.courses-annotation.is-note { background: color-mix(in srgb, var(--ink) 4%, var(--paper-raised)); }
.courses-annotation.hl-green { --hl-edge: #2fae6a; }
.courses-annotation.hl-blue { --hl-edge: #3b82f6; }
.courses-annotation.hl-pink { --hl-edge: #e0559b; }
a.courses-annotation-row:hover { background: color-mix(in srgb, var(--hl-edge) 16%, var(--paper-raised)); }
a.courses-annotation-row:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-annotation-chip { justify-self: start; margin-top: 0.1rem; padding: 0.1em 0.5em; border-radius: 999px; background: color-mix(in srgb, var(--ink) 9%, transparent); font-size: 0.74rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
a.courses-annotation-chip:hover { color: var(--ink); }
.courses-annotation-body { min-width: 0; font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.courses-annotation-text,
.courses-annotation-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.courses-annotation-kind { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.courses-annotation-note p,
.courses-annotation-note ul,
.courses-annotation-note ol { margin: 0; }
.courses-annotation-note ul,
.courses-annotation-note ol { padding-left: 1.4em; }
.courses-annotation-hl-note { display: block; margin-top: 0.2rem; font-size: 0.82rem; color: var(--ink-soft); }
/* Course settings (2026-10-07 student test): the panel opens in the page,
   under the header, pushing the files down rather than floating over their
   Open buttons; Delete sits apart from Save, in its own bordered section. */
.courses-head-row > .courses-settings[open] { flex-basis: 100%; display: flex; flex-direction: column; align-items: stretch; margin-top: 0; }
.courses-head-row > .courses-settings[open] > summary { align-self: flex-end; }
.courses-settings > .courses-settings-panel { position: static; width: 100%; margin-top: var(--space-2); box-shadow: none; }
.courses-delete-course { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin: var(--space-5) 0 0; padding: var(--space-3); border: 1px solid color-mix(in srgb, var(--line-news-ink) 35%, var(--border)); border-radius: var(--radius); }
.courses-delete-course form { margin: 0; }
.courses-delete-note { margin: 0; flex: 1 1 18rem; font-size: 0.85rem; color: var(--ink-soft); }
/* "Start here" steps on the course list until a course has a file. */
.courses-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-2); margin: var(--space-4) 0 0; padding: 0; list-style: none; counter-reset: courses-start; }
.courses-start li { position: relative; padding: var(--space-3) var(--space-3) var(--space-3) 3.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper-raised); font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); counter-increment: courses-start; }
.courses-start li::before { content: counter(courses-start); position: absolute; left: var(--space-3); top: var(--space-3); display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--line-brand); color: var(--line-brand-on); font-size: 0.85rem; font-weight: 700; }
.courses-start strong { color: var(--ink); }
/* Files heading, with a jump to "Highlights and notes" when that panel
   sits below the files (single column), where it was easy to miss. */
.courses-files-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); margin-bottom: var(--space-2); }
.courses-files-head h2 { margin: 0; }
.courses-jump-annotations { font-size: 0.88rem; font-weight: 600; }
@media (min-width: 960px) { .courses-jump-annotations { display: none; } }
.courses-annotations { scroll-margin-top: calc(var(--header-height, 112px) + var(--space-2)); }
/* The file just uploaded (?uploaded=): outlined, with a "Just added" tag,
   since the confirmation banner is at the top, out of view. */
.courses-file.is-new { border-color: var(--line-economics-ink, var(--accent-secondary)); box-shadow: 0 0 0 1px var(--line-economics-ink, var(--accent-secondary)); }
.courses-file-new { display: inline-block; margin-left: 0.5em; padding: 0.05em 0.55em; border-radius: 999px; background: color-mix(in srgb, var(--line-economics) 18%, var(--paper-raised)); font-size: 0.75rem; font-weight: 700; color: var(--line-economics-ink, var(--ink)); vertical-align: 0.1em; }
/* Rename, inside a file's "⋯" menu. */
.courses-rename { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.2rem 0 0; padding: 0.5rem 0.7rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--ink-soft); }
.courses-rename label { font-weight: 600; }
.courses-rename-row { display: flex; gap: 0.4rem; }
.courses-rename input { flex: 1 1 auto; min-width: 0; padding: 0.35em 0.55em; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 0.9rem; }
.courses-rename input:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 1px; }
.courses-menu-list > form:has(.courses-danger-link) { border-top: 1px solid var(--border); padding-top: 0.2rem; }
/* Upload: one step (choose or drop, and it uploads, site.js
   initCourseUpload); the box takes a dropped file. */
.courses-drop-text { font-family: var(--font-display); font-size: 0.98rem; color: var(--ink); }
.courses-file-types { font-weight: 500; }
.courses-upload.is-dragging { border-style: dashed; border-color: var(--line-brand-ink); background: color-mix(in srgb, var(--line-brand) 8%, var(--paper-raised)); }
.courses-upload-status { flex-basis: 100%; margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.courses-upload-status.is-error { color: var(--line-news-ink); }
.courses-upload-status[hidden] { display: none; }

/* Collections (2026-10-10, courses/detail.html): each one a foldable
   section whose header carries its name, file count and a ⋯ menu. The menu
   sits beside the <summary>, not inside it, so opening it never folds the
   section. */
.courses-files-head .courses-new-collection { margin-left: auto; }
.courses-files-head .courses-new-collection > summary { cursor: pointer; }
.courses-new-collection .courses-popover-panel { width: min(22rem, calc(100vw - 32px)); }
.courses-new-collection .courses-rename { border-top: 0; }
.courses-check-group { margin: var(--space-2) 0 0.2rem; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.courses-check-group:first-of-type { margin-top: 0; }
.courses-collection-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--ink-soft); }
.courses-collection-suggest form { margin: 0; }
.courses-menu-list .courses-collection-suggest { padding: 0.5rem 0.7rem; border-top: 1px solid var(--border); }
.courses-collection-suggest-line { margin: 0 0 var(--space-2); }
.courses-chip { min-height: 2rem; padding: 0.2em 0.8em; border: 1px dashed var(--border-strong); border-radius: 999px; background: var(--paper-raised); color: var(--ink); font: inherit; font-size: 0.85rem; cursor: pointer; }
.courses-chip:hover { border-color: var(--line-brand-ink); border-style: solid; }
.courses-chip:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-collection { position: relative; scroll-margin-top: 6rem; }
.courses-collection + .courses-collection { margin-top: var(--space-3); }
.courses-collection-fold > summary { display: flex; align-items: center; gap: var(--space-2); min-height: 2.6rem; padding: 0.3rem 3rem 0.3rem 0; list-style: none; cursor: pointer; }
.courses-collection-fold > summary::-webkit-details-marker { display: none; }
.courses-collection-fold > summary::before { content: ""; flex: none; width: 0.45rem; height: 0.45rem; margin: 0 0.15rem 0 0.1rem; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform 0.15s ease; }
.courses-collection-fold[open] > summary::before { transform: rotate(45deg); }
.courses-collection-fold > summary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-collection-name { min-width: 0; font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; overflow-wrap: anywhere; }
.courses-collection-count { flex: none; font-size: 0.8rem; color: var(--ink-soft); }
.courses-collection-fold > .courses-file-list { margin-top: var(--space-1); }
.courses-collection-empty { margin: var(--space-1) 0 0; padding: var(--space-2) var(--space-3); border: 1px dashed var(--border-strong); font-size: 0.88rem; color: var(--ink-soft); }
.courses-collection-menu { position: absolute; top: 0.2rem; right: 0; }
.courses-collection.is-drop-target > .courses-collection-fold { outline: 2px dashed var(--line-brand-ink); outline-offset: 4px; }
.courses-menu-button { display: block; width: 100%; padding: 0.5rem 0.7rem; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.courses-menu-button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.courses-menu-list > form { margin: 0; }
.courses-rename select { flex: 1 1 auto; min-width: 0; padding: 0.35em 0.55em; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 0.9rem; }
.courses-upload-into { display: flex; flex-direction: column; gap: 0.35em; flex-basis: 100%; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.courses-upload-into select { max-width: 20rem; padding: 0.35em 0.55em; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 0.95rem; }
.courses-annotations-group { margin: var(--space-3) 0 0; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border-strong); font-family: var(--font-display); font-size: 0.95rem; }
/* The panel's filter hides file groups with nothing of the chosen kind;
   hide a collection's subheading too once all of its groups are hidden. */
.courses-annotations-collection:has(.courses-annotations-file):not(:has(.courses-annotations-file:not([hidden]))) { display: none; }
.revision-scope { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: 0.9rem; }
.revision-scope select { max-width: 100%; font: inherit; }
@media print { .revision-scope { display: none; } }

/* Course page UI pass (2026-10-10). Order of what a student needs: today's
   exam task, then the files, with progress beside the highlights rather
   than above everything. Flashcards and Test yourself become a compact
   column beside the exam, not two more full-width cards. Scoped under
   .courses-detail so it wins over the older rules further down. */
.courses-detail .courses-plan-row { grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr); align-items: start; margin: var(--space-3) 0 var(--space-4); }
.courses-detail .courses-plan-row:not(:has(> .courses-study-strip)) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) { .courses-detail .courses-plan-row { grid-template-columns: minmax(0, 1fr); } }
.courses-detail .courses-plan-row > .courses-study-strip { display: flex; flex-direction: column; margin: 0; }
.courses-detail .courses-study-link { position: relative; justify-content: center; min-height: 44px; box-sizing: border-box; padding-right: 2.6rem; border-color: var(--border); background: var(--tool-plate); }
.courses-detail .courses-study-link::after { content: "\2192"; position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.courses-detail .courses-study-link:hover { background: var(--tool-plate-hover); }
.courses-detail .courses-study-link.is-due { border-color: var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 9%, var(--paper-raised)); }
.courses-detail .courses-study-link.is-due .courses-study-status { font-weight: 600; color: var(--ink); }
/* Today's share of the work is the one thing to do on this page. */
.courses-detail .courses-exam-today { margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); border-left: 3px solid var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 8%, var(--paper-raised)); line-height: 1.5; }
.courses-detail .courses-exam-actions .courses-primary { display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; }
.courses-detail .courses-exam-add > summary, .courses-detail .courses-exam-past > summary { display: list-item; min-height: 44px; box-sizing: border-box; padding: 0.6rem 0; }

/* Right-hand column: progress, then highlights and notes. It stretches to
   the files column's height and stays block flow, so the notes panel's
   position: sticky still has room to move (a grid row would pin it). */
.courses-detail .courses-detail-aside { min-width: 0; }
.courses-detail .courses-detail-aside > .courses-progress + .courses-annotations { margin-top: var(--space-4); }
.courses-detail .courses-detail-main > .courses-files:first-child,
.courses-detail .courses-detail-aside > :first-child { margin-top: 0; }
.courses-detail .courses-detail-columns { margin-top: var(--space-4); }
.courses-detail .courses-plan-row + .courses-detail-columns { margin-top: 0; }
@media (min-width: 960px) { .courses-detail .courses-detail-aside { align-self: stretch; } }
@media (max-width: 959px) { .courses-detail .courses-detail-aside { margin-top: var(--space-4); } }
.courses-detail .courses-progress .courses-time-bars { height: 3.5rem; }

/* Files heading actions, and file rows as a two-column grid so the actions
   never drop under the text; size and upload date come last and quieter. */
.courses-detail .courses-files-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-left: auto; }
.courses-detail .courses-files-head { align-items: center; }
.courses-detail .courses-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3); border-color: var(--border); }
.courses-detail .courses-file:hover, .courses-detail .courses-file:focus-within { border-color: var(--border-strong); }
.courses-detail .courses-file-actions { margin-left: 0; }
.courses-detail .courses-file-meta { line-height: 1.45; }
.courses-detail .courses-file-meta > span { display: block; }
.courses-detail .courses-file-meta-aux { font-size: 0.76rem; color: var(--ink-faint); }
.courses-detail .courses-collection-fold > summary { min-height: 2.75rem; border-bottom: 1px solid var(--border); margin-bottom: var(--space-2); }
.courses-detail .courses-collection-fold:not([open]) > summary { margin-bottom: 0; }
.courses-detail .courses-collection-menu { top: 0; }
@media (pointer: coarse) {
  .courses-detail .courses-file-menu > summary { width: 2.75rem; height: 2.75rem; }
  .courses-detail .courses-secondary-sm, .courses-detail .courses-tonal, .courses-detail .courses-quiet-link, .courses-detail .courses-annotations-filter button, .courses-detail .courses-chip { display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; }
}
@media (max-width: 560px) {
  /* Actions stay beside the name (on their own line every row doubled in
     height); the type badge gives up its room for them. */
  .courses-detail .courses-file { align-items: start; gap: var(--space-2); padding: var(--space-2); }
  .courses-detail .courses-file-kind { display: none; }
  .courses-detail .courses-file-actions { gap: 0.4rem; }
  .courses-detail .courses-file-meta > .courses-file-meta-aux, .courses-detail .courses-file-open-more { display: none; }
  .courses-detail .courses-file-open-short { display: inline; }
  .courses-detail .courses-exam-actions .courses-primary { flex: 1 1 100%; justify-content: center; }
}
/* "Continue reading" button: the short label replaces the long one on
   phones (above). Two whole labels, not "Continue" + " reading", so each
   language can word both naturally (2026-11-13). */
.courses-file-open-short { display: none; }
/* Course page columns (2026-10-03): files left, highlights right, on wide screens. */
@media (min-width: 960px) {
  .courses-detail-columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
  .courses-detail-columns .courses-annotations { position: sticky; top: calc(var(--header-height, 112px) + var(--space-2)); max-height: calc(100vh - var(--header-height, 112px) - var(--space-4)); overflow-y: auto; }
  /* The panel scrolls on its own; its header (actions, filter) stays in view. */
  .courses-detail-columns .courses-annotations-head { position: sticky; top: 0; z-index: 1; }
}
@media (max-width: 560px) {
  .courses-fields { grid-template-columns: 1fr; }
  .courses-upload-form .courses-primary { width: 100%; }
}

/* ---------------------------------------------------------------------
   Applications (2026-10-03): a reader's own list of exchange, scholarship,
   internship and job applications with their deadlines. Plain bordered
   rows like the rest of the account pages; the only colour is the due
   label, which turns warm inside a week and red once a deadline passes.
   --------------------------------------------------------------------- */
.apps-page { max-width: 820px; }
.apps-stats { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; }
.apps-stats li { padding: 0.5em 0.9em; border: 1px solid var(--border-strong); background: var(--paper-raised); font-size: 0.9rem; color: var(--ink-soft); }
.apps-stats strong { margin-right: 0.3em; font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.apps-stats li.is-soon { border-color: var(--accent-warm); }
.apps-add { margin-top: var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); }
.apps-add > summary,
.apps-edit > summary { cursor: pointer; font-weight: 600; }
.apps-add > summary { padding: var(--space-2) var(--space-3); font-family: var(--font-display); }
.apps-add > .apps-form { padding: 0 var(--space-3) var(--space-3); }
.apps-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.apps-field { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.apps-field-wide { grid-column: 1 / -1; }
.apps-field small { font-weight: 400; color: var(--ink-faint); }
.apps-field input,
.apps-field select,
.apps-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55em 0.7em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.apps-field textarea { resize: vertical; }
.apps-field input:focus-visible,
.apps-field select:focus-visible,
.apps-field textarea:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 1px; }
.apps-form-actions { margin-top: var(--space-2); }
.apps-primary {
  padding: 0.55em 1.4em;
  border: 0;
  border-radius: 999px;
  background: var(--line-brand);
  color: var(--line-brand-on);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.apps-primary:hover { background: var(--line-brand-ink); }
.apps-primary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.apps-empty { margin-top: var(--space-4); max-width: 60ch; color: var(--ink-soft); }
.apps-empty h2 { margin: 0 0 0.3em; font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.apps-section { margin-top: var(--space-4); }
.apps-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.apps-section-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; }
.apps-calendar { font-size: 0.88rem; font-weight: 600; }
.apps-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.apps-item { padding: var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); scroll-margin-top: 6rem; }
.apps-item:target { border-color: var(--accent-secondary); }
.apps-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.apps-kind { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.apps-due { padding: 0.15em 0.7em; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.apps-due.is-soon { border-color: var(--accent-warm); color: var(--ink); background: color-mix(in srgb, var(--accent-warm) 14%, var(--paper-raised)); }
.apps-due.is-overdue { border-color: var(--line-news-ink); color: var(--line-news-ink); }
.apps-title { margin: 0.35em 0 0; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; }
.apps-title a { color: var(--line-brand-ink); text-decoration: none; }
.apps-title a:hover,
.apps-title a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.apps-meta { display: flex; flex-wrap: wrap; gap: 0.2em 0.9em; margin: 0.3em 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.apps-note { margin: 0.6em 0 0; padding-left: 0.8em; border-left: 3px solid var(--border-strong); font-size: 0.9rem; line-height: 1.5; color: var(--ink-soft); overflow-wrap: anywhere; }
.apps-edit { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); font-size: 0.88rem; }
.apps-edit > summary { color: var(--ink-soft); }
.apps-delete { margin-top: var(--space-2); }
.apps-delete button { padding: 0; border: 0; background: none; color: var(--line-news-ink); font: inherit; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.apps-item.is-closed .apps-title,
.apps-item.is-closed .apps-title a { color: var(--ink-soft); }
@media (max-width: 560px) {
  .apps-fields { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Interview practice (2026-10-03, accounts/interview.html). The question
   sits in one bordered panel with the record button; the bank below is a
   set of plain disclosure lists.
   --------------------------------------------------------------------- */
.interview-page { max-width: 720px; }
.interview-back { margin: var(--space-2) 0 0; font-size: 0.9rem; }
.interview-stage { margin-top: var(--space-3); padding: var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); scroll-margin-top: calc(var(--header-height, 75px) + var(--space-2)); }
.interview-stage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem var(--space-3); }
.interview-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: 0.88rem; }
.interview-nav a { padding: 0.3em 0.65em; border: 1px solid var(--border); color: var(--ink); text-decoration: none; white-space: nowrap; }
.interview-nav a:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.interview-nav a:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 2px; }
.interview-answered-badge { margin-left: 0.4em; padding: 0.05em 0.45em; border: 1px solid var(--border); font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.interview-plan { margin: 0 0 var(--space-3); }
.interview-plan-label { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.interview-plan-steps { margin: 0.3em 0 0; padding-left: 1.4em; font-size: 0.95rem; line-height: 1.5; }
.interview-plan-steps li + li { margin-top: 0.15em; }
.interview-plan-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin: 0.75rem 0 0; }
.interview-plan-btn { padding: 0.4em 0.85em; border: 1px solid var(--border-strong); background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.interview-plan-btn:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.interview-plan-btn[aria-pressed="true"] { border-color: var(--line-brand); color: var(--accent-secondary-ink); font-weight: 600; }
.interview-plan-btn:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 2px; }
.interview-plan-status { font-size: 0.85rem; color: var(--ink-soft); }
.interview-record-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem var(--space-3); }
.interview-checks { margin: 0; font-size: 0.88rem; color: var(--ink-soft); }
.interview-checks strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.speaking-recording { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0 0; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.speaking-recording[hidden] { display: none; }
.speaking-recording-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line-news, #d93a3a); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .speaking-recording-dot { animation: speaking-recording-pulse 1.2s ease-in-out infinite; }
}
@keyframes speaking-recording-pulse { 50% { opacity: 0.35; } }
.speaking-level { position: relative; width: 6rem; height: 0.4rem; overflow: hidden; background: var(--border); flex: none; }
.speaking-level-fill { position: absolute; inset: 0; background: var(--line-brand); transform: scaleX(0); transform-origin: left center; transition: transform 80ms linear; }
.interview-label { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.interview-question { margin: 0.3em 0 var(--space-3); font-family: var(--font-display); font-size: 1.4rem; line-height: 1.3; }
.interview-tip { margin: 0.6em 0 var(--space-3); font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); }
/* gap: the label's emoji is its own aria-hidden span, and inline-flex
   drops the space between it and the words. */
.speaking-practice-btn { gap: 0.4em; }
.interview-record-btn { background: var(--line-brand); border-color: var(--line-brand); color: var(--line-brand-on); font-weight: 600; }
.interview-record-btn:hover { background: var(--accent-secondary-ink); border-color: var(--accent-secondary-ink); color: var(--line-brand-on); }
.interview-stage .speaking-practice-result { margin-top: var(--space-3); }
.interview-tip-category { padding: 0.55rem 0.75rem; border-left: 3px solid var(--line-brand); background: color-mix(in srgb, var(--line-brand) 6%, transparent); color: var(--ink); }
.interview-limit { margin: 0.6rem 0 0; font-size: 0.82rem; color: var(--ink-soft); }
/* Review before sending (2026-10-03): playback, Send, and the disclosure. */
.speaking-review-heading { font-weight: 600; color: var(--ink); }
.speaking-review-audio { display: block; width: 100%; max-width: 420px; margin: 0.4rem 0 0.75rem; }
.speaking-review-send {
  min-height: 2.5rem;
  padding: 0.5em 1.3em;
  border: 0;
  border-radius: 999px;
  background: var(--accent-warm);
  color: #14161c;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.speaking-review-send:disabled { opacity: 0.6; cursor: default; }
.speaking-review-send:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 2px; }
.speaking-review-note { margin: 0.6rem 0 0; max-width: 60ch; font-size: 0.82rem; line-height: 1.5; color: var(--ink-soft); }
.speaking-practice-answer-note { padding: 0.5rem 0.7rem; border-left: 3px solid var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 8%, transparent); color: var(--ink); }
.interview-bank { margin-top: var(--space-4); }
.interview-bank > h2,
.interview-recent > h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.2rem; }
.interview-category { border-top: 1px solid var(--border); }
.interview-category:last-of-type { border-bottom: 1px solid var(--border); }
.interview-category > summary { padding: var(--space-2) 0; font-weight: 600; cursor: pointer; }
.interview-count { margin-left: 0.4em; font-size: 0.8rem; font-weight: 500; color: var(--ink-faint); }
.interview-category ul { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: grid; gap: 0.15rem; }
.interview-category a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; padding: 0.45em 0.6em; color: var(--ink); text-decoration: none; line-height: 1.4; }
.interview-category a:hover { background: color-mix(in srgb, var(--accent-secondary) 10%, transparent); }
.interview-q-text { flex: 1 1 16rem; }
.interview-q-tag { padding: 0.05em 0.45em; border: 1px solid var(--border); font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.interview-category a.is-current { box-shadow: inset 4px 0 0 var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 10%, transparent); font-weight: 600; }
.interview-category a.is-current .is-current-tag { border-color: var(--accent-warm); color: var(--ink); }
.interview-category a:focus-visible { outline: 2px solid var(--line-brand); outline-offset: -2px; }
.interview-bank-summary { margin: -0.3rem 0 var(--space-2); font-size: 0.88rem; color: var(--ink-soft); }
.interview-recent { margin-top: var(--space-4); }
.interview-recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.interview-recent li { padding: var(--space-2) var(--space-3); border: 1px solid var(--border); }
.interview-recent-question { margin: 0 0 0.4em; font-weight: 600; }
.interview-recent audio { width: 100%; max-width: 420px; }
.exchange-page .topic-pagination { justify-content: center; gap: var(--space-3); }
.exchange-page .topic-pagination-status { margin: 0; }
/* 2026-10-10 usability pass: deadline filter, sort note, folded past
   windows, "not found" placeholders, expandable long facts, numbered pages. */
.exchange-status-chips { margin-top: var(--space-2); }
.exchange-filter-notice { margin: var(--space-3) 0 0; padding: var(--space-1) var(--space-2); border-left: 4px solid var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 10%, var(--paper-raised)); font-size: 0.9rem; }
.exchange-sort-note { margin: var(--space-3) 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.exchange-past { margin-top: var(--space-1); font-size: 0.85rem; color: var(--ink-soft); }
.exchange-past summary { cursor: pointer; width: fit-content; font-weight: 600; }
.exchange-past .exchange-windows { margin-top: var(--space-1); }
.exchange-missing { color: var(--ink-faint); font-style: italic; }
/* Short facts (GPA, Duration, Terms) read as one inline row instead of a
   grid of boxed tiles, which made each card 80-160px taller; English keeps
   a row of its own since it is the long one. */
.exchange-tiles { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.exchange-tiles > div { display: flex; align-items: baseline; gap: 0.4em; padding: 0; border: 0; border-radius: 0; }
.exchange-tiles dd { margin: 0; }
.exchange-tiles > .exchange-tile-wide { flex-basis: 100%; }
.exchange-more summary { cursor: pointer; list-style: none; }
.exchange-more summary::-webkit-details-marker { display: none; }
.exchange-more-toggle { font-weight: 600; color: var(--accent-secondary-ink); white-space: nowrap; }
.exchange-more .when-open,
.exchange-more[open] .when-closed,
.exchange-more[open] .exchange-more-preview { display: none; }
.exchange-more[open] .when-open { display: inline; }
.exchange-more[open] summary { order: 1; }
.exchange-more[open] { display: flex; flex-direction: column; gap: 0.2rem; }
.exchange-tuition { display: flex; flex-wrap: wrap; gap: 0 0.4em; align-items: baseline; }
.exchange-tuition strong { margin-right: 0; }
.exchange-pages { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; }
.exchange-pages a { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; min-height: 2.25rem; padding: 0 0.5em; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; }
.exchange-pages a.is-active { background: var(--accent-warm); border-color: var(--accent-warm); color: var(--accent-warm-on); }
.exchange-pages li[aria-hidden] { align-self: center; color: var(--ink-faint); }
.exchange-news { margin-top: var(--space-5); }
@media (any-pointer: coarse) {
  .exchange-chip,
  .exchange-tab,
  .exchange-pages a,
  .exchange-hero-link,
  .exchange-past summary { display: inline-flex; align-items: center; min-height: 44px; }
  .exchange-pages a { min-width: 44px; }
}
@media (max-width: 640px) {
  .exchange-hero { padding: var(--space-3); }
  .exchange-item { grid-template-columns: 1fr; }
  .exchange-stub { justify-content: flex-start; padding: var(--space-1) var(--space-3); border-right: 0; border-bottom: 2px dashed var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; font-size: 1.75rem; }
  .exchange-stub::before,
  .exchange-stub::after { top: auto; bottom: -11px; right: auto; }
  .exchange-stub::before { left: -11px; clip-path: inset(0 0 0 50%); }
  .exchange-stub::after { right: -11px; clip-path: inset(0 50% 0 0); }
}
/* One entrance moment: the first few cards rise in, staggered. */
@media (prefers-reduced-motion: no-preference) {
  .exchange-item { animation: exchange-rise 0.45s ease-out both; animation-delay: calc(min(var(--i, 0), 5) * 70ms); }
  @keyframes exchange-rise { from { opacity: 0; transform: translateY(12px); } }
}

/* Keyboard-shortcut hint under the review card (2026-09-30). Meaningless
   on touch-only devices, so hidden where hover isn't available. */
.review-shortcuts {
  margin: var(--space-2) 0 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
  text-align: center;
}
@media (hover: none) {
  .review-shortcuts { display: none; }
}

/* "Start review" (2026-10-03): the first thing on the page when words are due. */
.study-review-cta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 var(--space-3);
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  background: var(--accent-warm);
  color: var(--accent-warm-on);
  font-family: var(--font-body);
  text-decoration: none;
}
.study-review-cta:hover { filter: brightness(1.06); }
.study-review-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.study-review-cta-count { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.study-review-cta-text { flex: 1; min-width: 0; font-weight: 600; }
.study-review-cta-go { flex: none; font-weight: 700; white-space: nowrap; }
/* One-line explanation under the Total/Learning/Learned cards (2026-09-30),
   folded behind "What do these mean?" since 2026-10-03. */
.study-stats-info { margin: calc(-1 * var(--space-2)) 0 var(--space-3); }
.study-stats-info summary { width: fit-content; font-size: 0.8rem; color: var(--ink-faint); cursor: pointer; }
.study-stats-note {
  margin: var(--space-2) 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* Review queue summary + "how review works" note + finish message (2026-09-30). */
.review-queue-summary {
  margin: 0 0 var(--space-2);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
.review-howto {
  margin: 0 auto var(--space-3);
  max-width: 36rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-faint);
}
.review-howto summary { cursor: pointer; text-align: center; font-weight: 600; }
.review-howto p { margin: var(--space-2) 0 0; }
.review-howto ul { margin: var(--space-2) 0 0; padding-left: 1.2em; text-align: left; }
.review-howto li { margin: 0.3em 0; }
.review-done { margin: var(--space-3) 0; text-align: center; line-height: 1.5; }

/* ---------------------------------------------------------------------
   Journal visual polish (2026-10-01). Last in the file on purpose: these
   refine the rules above by cascade order alone, no specificity tricks.
   Constraints carried over from the owner's earlier passes: pure white
   page, no shadows, no coloured edge stripes, same sitewide width and
   same list-column width in every view mode. So the refinement comes
   from type weight, spacing and softly tinted surfaces only.
   Tints use color-mix() on the existing tokens so dark mode follows the
   theme without a second set of values.
   --------------------------------------------------------------------- */
.journal-layout { border-radius: 18px; border-color: var(--border); }
.journal-list-pane { border-radius: 18px 0 0 18px; }
@media (max-width: 799px) { .journal-list-pane { border-radius: 18px; } }

/* Title: the entry's name should lead without shouting. */
.journal-list-header h1 { font-size: 1.4rem; letter-spacing: -0.01em; }

/* Segmented switch and search read as one family: soft filled wells. */
.journal-view-toggle {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-color: transparent;
  border-radius: 12px;
}
.journal-view-toggle-btn { border-radius: 9px; padding: 0.5em 0.5em; }
.journal-view-toggle-btn.active { background: var(--paper); border-color: transparent; box-shadow: none; color: var(--accent-secondary-ink); }
.journal-search-input {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-color: transparent;
  padding: 0.6em 1em;
}
.journal-search-input:focus { background: var(--paper); border-color: var(--accent-secondary); }

/* Month headers: a quiet running head that stays in view while scrolling,
   instead of a grey banded strip with two rules. */
.journal-month-group + .journal-month-group { margin-top: 0; }
.journal-month-header {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  background: var(--paper);
  border: 0;
  padding: 1.1em var(--space-3) 0.4em;
}

/* Rows: hairlines inset to the text edge, lighter titles, a clear
   hover and selected state. */
.journal-list-item { border-bottom: 0; margin: 0 0.5rem; padding-bottom: 0.35rem; border-radius: 12px; }
.journal-list-item + .journal-list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--space-3) + 2.4rem + var(--space-2) - 0.5rem);
  right: var(--space-2);
  border-top: 1px solid var(--border);
}
.journal-list-item:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.journal-list-item.active,
.journal-list-item.active:hover {
  background: color-mix(in srgb, var(--accent-secondary) 9%, transparent);
  outline: 0;
}
.journal-list-item:hover::before, .journal-list-item.active::before,
.journal-list-item:hover + .journal-list-item::before, .journal-list-item.active + .journal-list-item::before { border-top-color: transparent; }
.journal-list-item-link { padding-left: calc(var(--space-3) - 0.5rem); padding-top: 0.85rem; padding-bottom: 0.4rem; }
.journal-list-item-datecol { background: none; }
.journal-list-item-weekday { font-weight: 600; font-size: 0.68rem; letter-spacing: 0; }
.journal-list-item-daynum { font-weight: 600; font-size: 1.4rem; color: var(--accent-secondary-ink); }
.journal-list-item-title { font-weight: 600; font-size: 0.95rem; line-height: 1.35; margin-bottom: 0.25em; }
.journal-list-item-preview { line-height: 1.45; }
.journal-list-item-meta { margin-top: 0.1em; }
.journal-pin-indicator { color: var(--accent-secondary-ink); }
.journal-list-item-tags { margin: 0 var(--space-3) 0.7rem calc(var(--space-3) + 2.4rem + var(--space-2) - 0.5rem); }

/* Tags: filled soft chips (borderless), so they read as labels, not
   as a row of small buttons competing with the titles. */
.journal-tag {
  border: 0;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-secondary) 9%, transparent);
  color: var(--accent-secondary-ink);
}
.journal-tag:hover { background: color-mix(in srgb, var(--accent-secondary) 17%, transparent); border: 0; }

/* Empty reading pane: a deliberate resting place, not a void. The mark
   sits in a tinted disc; the title uses the display face at a size that
   matches the header's "Journal". */
.journal-detail-placeholder { min-height: 30rem; gap: 0; }
.journal-detail-placeholder-icon {
  box-sizing: content-box;
  width: 40px;
  height: 40px;
  padding: 22px;
  margin-bottom: var(--space-3);
  border-radius: 50%;
  color: var(--accent-secondary-ink);
  background: color-mix(in srgb, var(--accent-secondary) 8%, transparent);
  opacity: 1;
}
.journal-detail-placeholder-title { font-size: 1.6rem; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 0.3em; }
.journal-detail-placeholder-text { font-size: 1rem; line-height: 1.6; max-width: 24rem; color: var(--ink-soft); }
.journal-detail-placeholder-text a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

/* Primary "new entry" mark in the header: rounder to match the system. */
.journal-new-link { border-radius: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .journal-list-item, .journal-tag, .journal-view-toggle-btn { transition: background-color 0.15s ease, color 0.15s ease; }
}

/* ---------------------------------------------------------------------
   Feeds visual polish (2026-10-02). Last in the file on purpose: refines
   the rules above by cascade order alone. Keeps the owner's standing
   rule for this page (2026-09-16): flat -- no shadows, stripes or tints.
   What changes is identity and hierarchy: every feed card gets its own
   solid colour from the site's existing line palette (used on its
   monogram and its freshness label only), and the type steps down from
   shouting to reading. Colours cycle by card position, so a pinned card
   keeps the colour of the slot it moves into rather than a stored one.
   --feed-hue is the fill (monogram), --feed-ink the text-safe variant.
   --------------------------------------------------------------------- */
.rss-feed-card { --feed-hue: var(--line-brand); --feed-hue-on: var(--line-brand-on); --feed-ink: var(--accent-secondary-ink); }
.rss-feed-card:nth-child(4n + 2) { --feed-hue: var(--line-highered); --feed-hue-on: var(--line-highered-on); --feed-ink: var(--line-highered-ink); }
.rss-feed-card:nth-child(4n + 3) { --feed-hue: var(--line-economics); --feed-hue-on: var(--line-economics-on); --feed-ink: var(--line-economics-ink); }
.rss-feed-card:nth-child(4n + 4) { --feed-hue: var(--line-news); --feed-hue-on: var(--line-news-on); --feed-ink: var(--line-news-ink); }
.rss-feed-card-monogram { background: var(--feed-hue); color: var(--feed-hue-on); width: 2.75rem; height: 2.75rem; font-weight: 600; }
.rss-feed-card-monogram-error { background: none; color: var(--ink-faint); }
.rss-feed-card:hover, .rss-feed-card:focus-within { border-color: var(--feed-hue); }

/* Page heading: a touch more air, and a calmer count line. */
.rss-feeds-header h1 { letter-spacing: -0.015em; }
.rss-feed-count { color: var(--ink-faint); }

/* Card title and the lead story. */
.rss-feed-card-title { font-weight: 600; letter-spacing: -0.005em; }
.rss-feed-card-large-when { font-weight: 600; font-size: 0.76rem; color: var(--feed-ink); }
.rss-feed-card-large-title { font-weight: 600; font-size: 1.28rem; line-height: 1.3; letter-spacing: -0.012em; }
.rss-feed-card-large-item:hover .rss-feed-card-large-title { color: var(--ink); text-decoration-color: var(--feed-hue); }
.rss-feed-card-large-excerpt { margin-top: 0.5em; }

/* Story rows: the headline reads as the content, the date as quiet
   metadata; titles darken to the card's colour on hover, flat. */
.rss-feed-card-rows li { padding: 0.7em 0; }
.rss-feed-card-rows li > a:hover { color: var(--feed-ink); }
.rss-feed-card-row-date { font-size: 0.75rem; font-variant-numeric: tabular-nums; }

/* Pager: lighter, so it recedes under the stories. */
.rss-feed-card-pager { border-top-color: transparent; }
.rss-feed-card-pager button { border-color: transparent; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rss-feed-card-pager button:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }

@media (prefers-reduced-motion: no-preference) {
  .rss-feed-card-rows li > a { transition: color 0.15s ease; }
}

/* ---------------------------------------------------------------------
   Feeds, playful pass (2026-10-02, owner: "more modern, energetic, cute,
   professional"). Supersedes the 2026-09-15/16 "flat, no shadows, stripes
   or tints" rule for THIS page only, at the owner's explicit request.
   The idea: each feed is a little sticker in its own colour. Cards get a
   tinted header band, a bouncy monogram, a small lift on hover, and a
   live-dot on the freshest story. No shadow on the card's border
   (2026-10-03, owner: "do not use shading effect on the border of
   cards on this page") -- the hover border colour is the only edge cue. Still professional: one radius family, one accent per
   card, motion only on load (once) and in answer to hover/press.
   Last in the file; refines everything above by cascade order.
   --------------------------------------------------------------------- */
.rss-feed-board { gap: 1.25rem; }
.rss-feed-card {
  --feed-pad: 1.35rem; /* side padding; the header band bleeds out by exactly this */
  border-radius: 24px;
  padding: 0 var(--feed-pad) 1rem;
  border-width: 1.5px;
}
@media (max-width: 599px) {
  .rss-feed-card { --feed-pad: 1rem; border-radius: 20px; }
}
.rss-feed-card:hover, .rss-feed-card:focus-within { border-color: var(--feed-hue); }

/* Header band in the feed's own tint, full-bleed to the card edge. */
.rss-feed-card-header {
  margin: 0 calc(var(--feed-pad) * -1) 1.1rem;
  padding: 1rem var(--feed-pad);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--feed-hue) 11%, var(--paper-raised));
}
.rss-feed-card-header { border-radius: 22px 22px 0 0; }
@media (max-width: 599px) { .rss-feed-card-header { border-radius: 18px 18px 0 0; } }
.rss-feed-card-monogram { width: 3rem; height: 3rem; border-radius: 16px; font-size: 1.3rem; }
.rss-feed-card-monogram-error { background: var(--paper-raised); border: 1.5px dashed var(--border-strong); }
.rss-feed-card-title { font-size: 1.02rem; }

/* Lead story: the freshness label becomes a pill with a live dot. */
.rss-feed-card-large-when {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.25em 0.75em 0.25em 0.65em;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--feed-hue) 13%, var(--paper-raised));
  color: var(--feed-ink);
}
.rss-feed-card-large-when::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--feed-hue);
}
.rss-feed-card-large-title { font-size: 1.36rem; line-height: 1.28; }

/* "Journal this": a friendly pill, not a bare link. */
.rss-feed-item-journal-link {
  padding: 0.3em 0.85em 0.3em 0.7em;
  margin-top: 0.15rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--feed-hue) 11%, var(--paper-raised));
  color: var(--feed-ink);
  font-weight: 600;
}
.rss-feed-item-journal-link:hover { background: color-mix(in srgb, var(--feed-hue) 20%, var(--paper-raised)); text-decoration: none; }

/* Story rows: roomy rounded hover targets. */
.rss-feed-card-rows li { margin: 0 -0.7rem; padding: 0.75em 0.7rem; border-radius: 14px; border-top-color: transparent; }
.rss-feed-card-rows li + li { box-shadow: none; }
.rss-feed-card-rows li:hover { background: color-mix(in srgb, var(--feed-hue) 8%, transparent); }
.rss-feed-card-page > .rss-feed-card-rows:first-child > li:first-child { margin-top: 0.35rem; }

/* Pager in the feed's colour. */
.rss-feed-card-pager button { background: color-mix(in srgb, var(--feed-hue) 12%, transparent); color: var(--feed-ink); }
.rss-feed-card-pager button:hover { background: var(--feed-hue); color: var(--feed-hue-on); }

/* Page header and the primary action. */
.rss-feeds-header h1 { font-size: 2rem; }
.rss-feed-count { font-size: 0.92rem; }
.rss-feed-add-btn {
  min-height: 2.75rem;
  padding: 0.55em 1.35em;
  font-weight: 600;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--line-brand) 55%, #000);
}
.rss-feed-add-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--line-brand) 55%, #000); }

@media (prefers-reduced-motion: no-preference) {
  .rss-feed-card { transition: border-color 0.15s ease, transform 0.18s ease; }
  .rss-feed-card:hover { transform: translateY(-3px); }
  .rss-feed-card-monogram { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .rss-feed-card:hover .rss-feed-card-monogram { transform: rotate(-6deg) scale(1.08); }
  .rss-feed-card-rows li { transition: background-color 0.15s ease; }
  .rss-feed-add-btn { transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease; }
  .rss-feed-add-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 color-mix(in srgb, var(--line-brand) 55%, #000); }
  /* The page's one orchestrated moment: cards rise in, staggered, once. */
  .rss-feed-board > .rss-feed-card { animation: rss-card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
  .rss-feed-board > .rss-feed-card:nth-child(2) { animation-delay: 0.07s; }
  .rss-feed-board > .rss-feed-card:nth-child(3) { animation-delay: 0.14s; }
  .rss-feed-board > .rss-feed-card:nth-child(n + 4) { animation-delay: 0.21s; }
  .rss-feed-card-large-when::before { animation: rss-live-dot 2.4s ease-in-out infinite; }
}
@keyframes rss-card-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes rss-live-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------------
   Footer redesign (2026-10-02, owner: "more energetic, professional,
   modern"). Supersedes the 2026-09-17 centred WSJ-style row above (this
   block is later in the file, so it wins by cascade order). Structure:
   a brand-colour accent bar on top (blue to the logo's orange), brand
   block left, links right, copyright in a quiet bottom bar.
   --------------------------------------------------------------------- */
.site-footer {
  position: relative;
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-3) var(--space-3);
  border-top: 0;
  text-align: left;
}
/* The accent bar: the one energetic note, 3px, brand blue into brand orange. */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--space-3);
  right: var(--space-3);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line-brand-ink) 0%, var(--line-brand-ink) 35%, var(--brand-news-gold) 100%);
}
.footer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  padding-top: var(--space-2);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}
.footer-brand-mark { width: 36px; height: 36px; flex: none; object-fit: contain; }
.footer-brand-text { display: flex; flex-direction: column; gap: 0.1rem; }
.footer-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.1; }
.footer-brand-tagline { font-size: 0.8rem; color: var(--ink-soft); }

.footer-nav { justify-content: flex-end; gap: 0.25rem; row-gap: 0.25rem; }
.footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.5em 0.85em;
  border-left: 0;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.footer-nav a + a { border-left: 0; }
.footer-nav a:hover { text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.footer-nav a:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
/* RSS: only the icon takes the brand orange -- the label stays in the link colour, since orange text on white is under AA. */
.footer-rss svg { color: var(--brand-news-gold); }
.footer-nav a.footer-rss:hover { color: var(--ink); background: color-mix(in srgb, var(--brand-news-gold) 18%, transparent); }

.footer-copyright {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-faint);
}

@media (max-width: 720px) {
  .footer-main { flex-direction: column; align-items: flex-start; }
  .footer-nav { justify-content: flex-start; margin-left: -0.85em; }
}
@media (max-width: 540px) {
  .site-footer::before { left: var(--space-2); right: var(--space-2); }
  .footer-nav { column-gap: 0.25rem; }
  .footer-nav a { padding: 0.5em 0.85em; }
}
@media (prefers-reduced-motion: no-preference) {
  .footer-nav a { transition: background-color 0.15s ease, color 0.15s ease; }
}

/* ---------------------------------------------------------------------
   Search your notes (2026-10-03, docs/roadmap.md item 1;
   accounts/templates/accounts/notes_search.html). One row per result:
   where it came from and when, its title, then the matching passage with
   the search words marked.
   --------------------------------------------------------------------- */
.notes-search-page { max-width: 46rem; }
.notes-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}
.notes-search-form input[type="search"] {
  flex: 1 1 16rem;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.9em;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.notes-search-form select {
  min-height: 44px;
  padding: 0 0.6em;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.notes-search-form button {
  min-height: 44px;
  padding: 0 1.3em;
  font: inherit;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.notes-search-form button:hover { opacity: 0.9; }
.notes-search-summary,
.notes-search-hint,
.notes-search-capped {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.notes-search-capped { font-weight: 600; color: var(--ink); }
.notes-search-results {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
}
.notes-search-results > li + li { border-top: 1px solid var(--border); }
.notes-search-result a {
  display: grid;
  gap: 0.2em;
  padding: 0.8em 0.5em;
  margin: 0 -0.5em;
  border-radius: calc(var(--radius) - 2px);
  color: var(--ink);
  text-decoration: none;
}
.notes-search-result a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.notes-search-result a:hover .notes-search-result-title { text-decoration: underline; }
.notes-search-result a:focus-visible { outline: 2px solid var(--accent-secondary-ink); outline-offset: 1px; }
.notes-search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.notes-search-result-source { font-weight: 700; color: var(--accent-secondary-ink); }
.notes-search-result-title {
  font-family: var(--font-body);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.notes-search-result-snippet {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.notes-search-result-snippet mark {
  background: color-mix(in srgb, var(--brand-news-gold) 30%, transparent);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 0.1em;
}
.notes-search-older a { font-weight: 700; color: var(--accent-secondary-ink); }

/* Interview follow-ups (2026-10-03, docs/roadmap.md item 5). */
.interview-follows {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.interview-follows span { font-weight: 700; }
.interview-follows a { color: var(--accent-secondary-ink); }
.interview-followup {
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--brand-news-gold);
  border-radius: var(--radius);
}
.interview-followup[hidden] { display: none; }
.interview-followup-label {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.interview-followup-question {
  margin: 0.2em 0 var(--space-2);
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.interview-followup-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.2em;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border-radius: var(--radius);
  text-decoration: none;
}
.interview-followup-link:hover { opacity: 0.9; }

/* ---------------------------------------------------------------------
   Revision sheets (2026-10-03, docs/roadmap.md item 2;
   courses/templates/courses/revision.html). Reads like the course page's
   own "Highlights and notes" list, then a numbered fill-in-the-blank test.
   Prints cleanly: no site chrome, answers opened by site.js before print.
   --------------------------------------------------------------------- */
.courses-annotations-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.courses-annotations-actions form { margin: 0; }
.revision-page { max-width: 46rem; }
.revision-back { margin: 0 0 var(--space-2); font-size: 0.9rem; font-weight: 600; }
.revision-head h1 { margin: 0 0 0.2em; font-family: var(--font-display); }
.revision-meta { margin: 0 0 var(--space-2); font-size: 0.9rem; color: var(--ink-soft); }
.revision-print {
  min-height: 44px;
  padding: 0 1.2em;
  font: inherit;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.revision-print:hover { opacity: 0.9; }
.revision-empty { color: var(--ink-soft); }
.revision-file { margin-top: var(--space-4); }
.revision-file h2 {
  margin: 0 0 var(--space-2);
  padding-bottom: 0.3em;
  font-family: var(--font-display);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border-strong);
  overflow-wrap: anywhere;
}
.revision-page-block { padding: var(--space-2) 0 var(--space-2) var(--space-3); border-left: 2px solid var(--border-strong); break-inside: avoid; }
.revision-page-block + .revision-page-block { margin-top: var(--space-2); }
.revision-page-label { margin: 0; font-size: 0.82rem; font-weight: 700; }
.revision-page-label a { color: var(--line-brand-ink); }
.revision-note { margin: 0.4rem 0 0; font-size: 0.95rem; line-height: 1.55; }
.revision-quote { margin: 0.45rem 0 0; padding: 0.4rem 0.7rem; border-left: 4px solid var(--hl-edge, #e6c200); background: color-mix(in srgb, var(--hl-edge, #e6c200) 12%, var(--paper-raised)); font-size: 0.97rem; line-height: 1.55; overflow-wrap: anywhere; }
.revision-quote.hl-green { --hl-edge: #2fae6a; }
.revision-quote.hl-blue { --hl-edge: #3b82f6; }
.revision-quote.hl-pink { --hl-edge: #e0559b; }
.revision-quote-note { display: block; margin-top: 0.3rem; font-size: 0.88rem; color: var(--ink-soft); }
.revision-test { margin-top: var(--space-5, 3rem); padding-top: var(--space-3); border-top: 2px solid var(--line-brand); }
.revision-test h2 { margin: 0 0 0.2em; font-family: var(--font-display); font-size: 1.25rem; }
.revision-test-intro { margin: 0 0 var(--space-3); font-size: 0.9rem; color: var(--ink-soft); }
.revision-questions { margin: 0 0 var(--space-3); padding-left: 1.6em; }
.revision-questions li { margin-bottom: 0.9em; line-height: 1.6; break-inside: avoid; }
.revision-blank { display: inline-block; min-width: 5em; border-bottom: 2px solid var(--ink); color: transparent; line-height: 1.1; }
.revision-question-source { display: block; font-size: 0.8rem; color: var(--ink-soft); }
.revision-answers summary { font-weight: 700; color: var(--accent-secondary-ink); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.revision-answers ol { padding-left: 1.6em; columns: 2 12rem; }
.revision-answers-heading { display: none; margin: 0 0 0.4em; font-family: var(--font-display); font-weight: 700; }
@media print {
  .app-bottom-nav, .revision-print, .revision-back { display: none !important; }
  .revision-page { max-width: none; }
  .revision-quote { background: none; }
  .revision-answers { break-before: page; }
  .revision-answers summary { display: none; }
  .revision-answers-heading { display: block; }
}

/* Interview progress by feedback theme (2026-10-03, docs/roadmap.md item 3). */
.interview-progress { margin-top: var(--space-4); }
.interview-progress h2 { margin: 0 0 0.2em; font-family: var(--font-display); font-size: 1.15rem; }
.interview-progress-intro { margin: 0 0 var(--space-2); font-size: 0.88rem; color: var(--ink-soft); }
.interview-themes { list-style: none; margin: 0; padding: 0; }
.interview-theme {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2em 1em;
  padding: 0.65em 0 0.65em 0.8em;
  border-left: 4px solid var(--border-strong);
}
.interview-theme + .interview-theme { margin-top: 0.4em; }
.interview-theme.is-coming_up { border-left-color: var(--brand-news-gold); }
.interview-theme.is-improving { border-left-color: #2fae6a; }
.interview-theme-label { font-weight: 700; }
.interview-theme-status { font-size: 0.88rem; color: var(--ink-soft); }
.interview-suggestion { margin: var(--space-3) 0 0; font-size: 0.92rem; }
.interview-suggestion span { display: block; color: var(--ink-soft); }
.interview-suggestion a { font-weight: 700; color: var(--accent-secondary-ink); }

/* ---------------------------------------------------------------------
   Deadlines for you (2026-10-03, docs/roadmap.md item 4;
   applications/templates/applications/deadlines.html). A date column, so
   the list reads as a calendar of what closes next; items due within two
   weeks get the gold edge the Today card uses for deadlines.
   --------------------------------------------------------------------- */
.apps-deadlines-link { margin: 0.4em 0 0; font-size: 0.92rem; }
.apps-deadlines-link a { font-weight: 700; color: var(--accent-secondary-ink); }
.deadlines-back { margin: 0 0 var(--space-2); font-size: 0.9rem; font-weight: 600; }
.deadlines-interests {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--tool-plate);
  border-radius: var(--radius);
}
.deadlines-interests fieldset { margin: 0; padding: 0; border: none; min-width: 0; }
.deadlines-interests legend { padding: 0; margin-bottom: 0.4em; font-weight: 700; }
.deadlines-kinds { display: flex; flex-wrap: wrap; gap: 0.4em; }
.deadlines-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 40px;
  padding: 0 0.9em;
  font-size: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}
.deadlines-kind:has(input:checked) { border-color: var(--line-brand); box-shadow: inset 0 0 0 1px var(--line-brand); font-weight: 600; }
.deadlines-interests button {
  min-height: 40px;
  padding: 0 1.2em;
  font: inherit;
  font-weight: 700;
  color: var(--line-brand-on);
  background: var(--line-brand);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.deadlines-list { list-style: none; margin: 0; padding: 0; }
.deadlines-item {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.deadlines-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 3.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.deadlines-date span { font-family: var(--font-display); font-size: 1.35rem; line-height: 1; color: var(--ink); }
.deadlines-item.is-soon .deadlines-date { border-color: var(--brand-news-gold); box-shadow: inset 0 0 0 1px var(--brand-news-gold); }
.deadlines-body p { margin: 0; }
.deadlines-kind-label { font-size: 0.8rem; font-weight: 700; color: var(--accent-secondary-ink); }
.deadlines-title { font-weight: 700; font-size: 1.02rem; overflow-wrap: anywhere; }
.deadlines-title a { color: var(--ink); text-decoration: none; }
.deadlines-title a:hover { text-decoration: underline; }
.deadlines-subtitle { font-size: 0.9rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.deadlines-status { margin-top: 0.2em !important; font-size: 0.88rem; font-weight: 600; }
.deadlines-item.is-soon .deadlines-status { color: var(--line-news-ink, var(--ink)); }
.deadlines-check { margin-top: 0.4em !important; font-size: 0.8rem; line-height: 1.45; color: var(--ink-soft); }
.deadlines-track {
  margin-top: 0.5em;
  min-height: 40px;
  padding: 0 1em;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--line-brand);
  background: none;
  border: 1px solid var(--line-brand);
  border-radius: var(--radius);
  cursor: pointer;
}
.deadlines-news { margin-top: var(--space-4); }
.deadlines-news h2 { margin: 0 0 0.2em; font-family: var(--font-display); font-size: 1.15rem; }
.deadlines-news-intro { margin: 0 0 var(--space-2); font-size: 0.9rem; color: var(--ink-soft); }

/* Instant journal-toolbar tooltip (2026-10-03) -- one shared bubble that
   JournalEditor.jsx positions under the hovered control, replacing the
   browser's slow native `title` tooltip. Above the fullscreen overlay
   (z-index 200). */
.journal-toolbar-tip {
  position: fixed; z-index: 1000; pointer-events: none;
  max-width: 16rem; padding: 0.25rem 0.5rem; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  font-size: 0.78rem; line-height: 1.3; white-space: nowrap;
}
.journal-toolbar-tip[hidden] { display: none; }

/* ---- Course study tools (2026-10-08): the course page's study strip,
   a course's flashcards page and Test yourself. ---- */
.courses-study-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-2); margin: var(--space-3) 0; }
.courses-study-link { display: flex; flex-direction: column; gap: 0.15rem; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper-raised); color: var(--ink); text-decoration: none; }
.courses-study-link:hover { border-color: var(--accent-secondary); }
.courses-study-link:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-study-name { font-family: var(--font-display); font-weight: 600; }
.courses-study-status { font-size: 0.85rem; color: var(--ink-soft); }

.course-cards-review { margin: var(--space-3) 0 var(--space-5); }
.course-cards-list h2 { font-family: var(--font-display); font-size: 1.15rem; }
.course-card-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.course-card-item { padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); background: var(--paper-raised); overflow-wrap: anywhere; }
.course-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem var(--space-2); font-size: 0.8rem; color: var(--ink-soft); }
.course-card-kind { font-weight: 600; }
.course-card-page { margin-left: auto; color: var(--accent-secondary-ink); }
.course-card-front { margin: 0.5rem 0 0.25rem; font-weight: 600; color: var(--ink); }
.course-card-answer, .course-card-back { margin: 0.25rem 0; font-size: 0.92rem; color: var(--ink-soft); }
.course-card-back:empty { display: none; }
.course-card-actions { display: flex; align-items: center; gap: var(--space-2); margin-top: 0.4rem; }
.course-card-edit { display: grid; gap: 0.5rem; margin-top: var(--space-2); }
.course-card-edit label { display: grid; gap: 0.2rem; font-size: 0.85rem; font-weight: 600; }
.course-card-edit textarea { width: 100%; font: inherit; font-weight: 400; }
.course-card-msg { margin: 0; color: var(--line-news-ink); font-size: 0.85rem; }
.review-back-answer { margin: 0 0 0.5rem; white-space: pre-wrap; }
.review-back-page { font-size: 0.88rem; }

.course-test-scope { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-3) 0; font-size: 0.9rem; }
.course-test-scope select { max-width: 100%; font: inherit; }
.course-test { margin-top: var(--space-3); }
.course-test-card { max-width: 46rem; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper-raised); overflow-wrap: anywhere; }
.course-test-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem var(--space-2); margin-bottom: var(--space-2); font-size: 0.82rem; color: var(--ink-soft); }
.course-test-count { font-weight: 600; }
.course-test-source { color: var(--accent-secondary-ink); }
.course-test-passage { margin: 0 0 var(--space-3); font-size: 1.08rem; line-height: 1.6; color: var(--ink); }
blockquote.course-test-passage { padding-left: var(--space-3); border-left: 3px solid var(--accent-warm); }
.course-test-blank { display: inline-block; min-width: 4em; border-bottom: 2px solid var(--ink); text-align: center; color: transparent; }
.course-test-blank.is-revealed { color: var(--ink); font-weight: 700; }
.course-test-answer { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.course-test-answer[hidden] { display: none; }
.course-test-answer input { flex: 1 1 12rem; min-width: 0; padding: 0.45em 0.7em; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; }
.course-test-verdict { margin: var(--space-2) 0 0; font-weight: 600; }
.course-test-verdict:empty { display: none; }
.course-test-verdict.is-right { color: var(--line-brand-ink); }
.course-test-verdict.is-wrong { color: var(--line-news-ink); }
.course-test-prompt { margin: 0 0 var(--space-2); color: var(--ink-soft); }
.course-test-scratch { display: block; width: 100%; margin-bottom: var(--space-2); padding: 0.45em 0.7em; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; }
.course-test-reveal { margin: var(--space-2) 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--accent-warm); background: color-mix(in srgb, var(--accent-warm) 8%, var(--paper)); white-space: pre-wrap; }
.course-test-reveal p { margin: 0 0 0.4rem; white-space: normal; }
.course-test-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.course-test-actions a { text-decoration: none; }
.course-test-summary h2 { margin-top: 0; font-family: var(--font-display); }
.course-test-missed { display: grid; gap: var(--space-2); margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.course-test-missed li { display: grid; gap: 0.3rem; padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.course-test-missed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: 0.85rem; }
.course-test-made { font-weight: 600; color: var(--line-brand-ink); }

/* ---- Exams and progress (2026-10-08, courses/planner.py) ---- */
.courses-plan-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-3); margin: 0 0 var(--space-5); }
@media (max-width: 860px) { .courses-plan-row { grid-template-columns: minmax(0, 1fr); } }
.courses-exams, .courses-progress { min-width: 0; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper-raised); scroll-margin-top: 6rem; }
.courses-exams h2, .courses-progress h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.15rem; }
.courses-exam { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.courses-exam:first-of-type { padding-top: 0; }
.courses-exam-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem var(--space-2); }
.courses-exam-head h3 { margin: 0; font-size: 1.02rem; }
.courses-exam-when { font-size: 0.88rem; color: var(--ink-soft); }
.courses-exam.is-final .courses-exam-when strong { color: var(--line-news-ink); }
.courses-exam-scope { margin: 0.2rem 0 0.4rem; font-size: 0.82rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.courses-exam-today { margin: 0.5rem 0; font-size: 0.95rem; }
.courses-exam-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.courses-exam-actions form, .courses-inline-form { display: inline; margin: 0; }
.courses-exam-add, .courses-exam-past { margin-top: var(--space-2); }
.courses-exam-add > summary, .courses-exam-past > summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.courses-exam-form { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.courses-exam-form label { display: grid; gap: 0.2rem; font-size: 0.88rem; font-weight: 600; }
.courses-exam-form input[type="text"], .courses-exam-form input[type="date"] { max-width: 20rem; padding: 0.4em 0.6em; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; font-weight: 400; }
.courses-exam-form fieldset { margin: 0; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius); }
.courses-exam-form legend { font-size: 0.88rem; font-weight: 600; }
.courses-exam-form .courses-check { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; overflow-wrap: anywhere; }
.courses-hint-inline { font-weight: 400; color: var(--ink-soft); }
.courses-exam-past ul { margin: var(--space-2) 0 0; padding-left: 1.1rem; font-size: 0.9rem; }
/* Coursework and the cross-course "Coming up" list (2026-10-12). */
.courses-coursework { margin: 0 0 var(--space-5); }
.courses-task-list { margin: 0; padding: 0; list-style: none; }
.courses-task { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.courses-task-title { flex: 1 1 10rem; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.courses-task.is-overdue .courses-exam-when strong { color: var(--line-news-ink); }
.courses-task-check, .courses-task .courses-danger-link, .courses-coursework .courses-exam-past .courses-danger-link { min-height: 44px; min-width: 44px; padding: 0 0.6rem; }
.courses-task-check { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.courses-agenda { margin: var(--space-3) 0 0; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper-raised); }
.courses-agenda h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.05rem; }
.courses-agenda ul { margin: 0; padding: 0; list-style: none; }
.courses-agenda li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem var(--space-2); padding: 0.4rem 0; border-top: 1px solid var(--border); }
.courses-agenda li:first-child { border-top: 0; }
.courses-agenda a { min-height: 44px; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink); text-decoration: none; }
.courses-agenda-kind, .courses-agenda-course, .courses-agenda-when { font-size: 0.85rem; color: var(--ink-soft); }
.courses-agenda-when { margin-left: auto; }
.courses-agenda li.is-overdue .courses-agenda-when { color: var(--line-news-ink); font-weight: 700; }
.courses-meter { height: 0.5rem; margin: 0.35rem 0; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, var(--paper)); overflow: hidden; }
.courses-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--line-brand-ink); }
.courses-progress-line { margin: 0.4rem 0 0; font-size: 0.92rem; }
.courses-time-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.35rem; height: 4.5rem; margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.courses-time-bars li { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.2rem; min-width: 0; }
.courses-time-bar { display: block; width: 100%; max-width: 1.6rem; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent-secondary); }
.courses-time-day { font-size: 0.7rem; color: var(--ink-soft); }
.courses-shaky-heading { margin: var(--space-3) 0 0.3rem; font-size: 0.95rem; }
.courses-shaky-list { margin: 0 0 var(--space-2); padding-left: 1.1rem; font-size: 0.88rem; overflow-wrap: anywhere; }
.courses-streak { margin: 0.4rem 0 0; font-weight: 600; color: var(--line-brand-ink); }
.course-test-focus { margin: 0 0 var(--space-2); font-size: 0.9rem; }
.courses-review-all { margin: var(--space-2) 0 0; }
.courses-review-all .courses-primary { display: inline-block; text-decoration: none; }

/* Study hub "This week" (2026-10-09). */
.study-week { margin: var(--space-3) 0; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper-raised); }
.study-week h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.05rem; }
.study-week-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin: 0; }
.study-week-stats dt { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.study-week-stats dd { margin: 0.15rem 0 0; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.study-week-stats dd.study-week-compare { font-family: inherit; font-size: 0.78rem; font-weight: 400; color: var(--ink-soft); }
@media (max-width: 420px) { .study-week-stats dd { font-size: 1.15rem; } }

/* Focus timer (2026-10-09, static/js/course-focus.js): bottom left, so it
   never meets the back-to-top button on the right. */
.focus-timer { position: fixed; left: var(--space-3); bottom: var(--space-3); z-index: 15; display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--paper-raised); box-shadow: 0 2px 10px rgb(0 0 0 / 0.12); font-size: 0.85rem; }
html.has-bottom-nav .focus-timer { bottom: calc(var(--app-nav-total-height) + var(--space-3)); }
.focus-timer button { border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.focus-timer-main { padding: 0.5em 0.95em; font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-timer-stop { padding: 0.5em 0.8em 0.5em 0.2em; color: var(--ink-soft); font-size: 1.05rem; line-height: 1; }
.focus-timer-stop[hidden] { display: none; }
.focus-timer button:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; border-radius: 999px; }
.focus-timer.is-focus { border-color: var(--line-brand-ink); }
.focus-timer.is-focus .focus-timer-main { color: var(--line-brand-ink); }
.focus-timer.is-break { border-color: var(--accent-warm); }
.focus-timer.is-paused .focus-timer-main { color: var(--ink-soft); }
@media print { .focus-timer { display: none; } }
/* Room under the page so the timer never hides its last lines. */
body:has(.focus-timer) .site-main { padding-bottom: 4.5rem; }
@media (max-width: 600px) { .focus-timer-today { display: none; } .focus-timer { font-size: 0.8rem; } }

/* ---------------------------------------------------------------------
   Study tools UX pass (2026-10-10, UX_AUDIT.md). Last in the file on
   purpose: one button base and one surface recipe over the course pages'
   earlier per-component rules, which had drifted apart (square and round
   cards side by side, buttons whose height depended on whether they were
   an <a>, a <button> or a <summary>).
   --------------------------------------------------------------------- */

/* Buttons. Same box whatever the element; the variant only sets colour.
   Regular size is --control-h-sm (36px); .courses-secondary-sm, the file
   rows' Open and the tonal action stay the owner's smaller in-section size
   (32px). Everything grows to --control-h on touch screens, below. */
.courses-primary, .courses-secondary, .courses-tonal, .courses-file-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  box-sizing: border-box;
  min-height: var(--control-h-sm);
  border-radius: var(--radius-pill);
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.courses-secondary-sm, .courses-tonal, .courses-file-open { min-height: 32px; }
/* The display above would otherwise beat the hidden attribute (site.js hides
   the no-JS Upload button, for one). */
.courses-primary[hidden], .courses-secondary[hidden], .courses-tonal[hidden], .courses-file-open[hidden] { display: none; }
.courses-secondary:focus-visible, .courses-file-open:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }

/* Surfaces. One radius. Containers you only read (Exams, Progress, the
   test card, "This week") take the hairline --border every other raised
   surface uses; things you click or drop onto (course cards, the upload
   box, flashcard rows) keep --border-strong, the 3:1 UI-boundary colour.
   The course page's file rows stay as the owner set them earlier the same
   day: hairline at rest, --border-strong on hover and focus. */
.courses-exams, .courses-progress, .course-test-card, .study-week { border-color: var(--border); }
.courses-card, .courses-file, .courses-upload, .course-card-item, .courses-collection-empty { border-radius: var(--radius); }
.courses-menu-list > a, .courses-menu-list .courses-danger-link, .courses-menu-button, .courses-rename input, .courses-rename select, .courses-upload-into select { border-radius: var(--radius-sm); }

/* Touch: every course page, not just the course detail page (UX_AUDIT.md
   M1). The visual stays compact where it can; the box is 44px. */
@media (pointer: coarse) {
  .courses-page :is(.courses-primary, .courses-secondary, .courses-tonal, .courses-quiet-link, .courses-file-open, .courses-chip, .courses-annotations-filter button):not([hidden]),
  .course-test :is(button, a.courses-secondary):not([hidden]),
  .courses-exam-actions .courses-danger-link,
  .course-card-actions .courses-danger-link:not([hidden]) {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-h);
    box-sizing: border-box;
  }
  .courses-file-menu > summary { width: var(--control-h); height: var(--control-h); }
  :is(.courses-menu-list > a, .courses-menu-list .courses-danger-link, .courses-menu-button):not([hidden]) { display: flex; align-items: center; min-height: var(--control-h); box-sizing: border-box; }
}

/* Course page hierarchy (UX_AUDIT.md M2, M5). "Add exam date" is a real
   button; with no exam the whole section is one line beside it. */
.courses-detail .courses-exam-add > summary.courses-secondary { display: inline-flex; min-height: 32px; padding: 0.35em 0.9em; list-style: none; }
.courses-exam-add > summary::-webkit-details-marker { display: none; }
.courses-exam-add[open] > summary { background: var(--tool-plate); border-color: var(--line-brand-ink); }
.courses-exams.is-empty { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-3); }
.courses-exams.is-empty h2 { margin: 0; font-size: 1rem; }
.courses-exams.is-empty .courses-empty-line { flex: 1 1 18rem; margin: 0; font-size: 0.9rem; }
.courses-exams.is-empty .courses-exam-add { margin: 0; }
.courses-exams.is-empty .courses-exam-add[open] { flex-basis: 100%; }
/* Delete an exam: at the far end of the row, apart from the study actions. */
.courses-exam-actions > form:last-child { margin-left: auto; }
.courses-exam-actions .courses-danger-link { font-size: 0.82rem; }

/* Empty and low-data course states (UX_AUDIT.md M3, M4). A course with no
   files is one drop zone with one button: the native file input, styled,
   so it still works with a keyboard, a screen reader and without JS. */
.courses-detail-columns.is-empty { grid-template-columns: minmax(0, 46rem); }
.courses-upload.is-first { border: 2px dashed var(--border-strong); padding: var(--space-3) 0; background: color-mix(in srgb, var(--line-brand) 4%, var(--paper-raised)); }
.courses-upload.is-first > summary { display: none; }
.courses-upload.is-first .courses-file-pick { flex-basis: 100%; align-items: center; text-align: center; }
.courses-upload.is-first .courses-drop-text { font-size: 1.1rem; }
.courses-upload.is-first > .courses-hint { text-align: center; }
.courses-file-pick input[type="file"] { padding: 0.25rem 0; }
.courses-file-pick input[type="file"]::file-selector-button {
  min-height: var(--control-h-sm);
  margin-right: 0.75em;
  padding: 0.45em 1.15em;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--line-brand);
  color: var(--line-brand-on);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.courses-file-pick input[type="file"]::file-selector-button:hover { background: var(--line-brand-ink); }
.courses-file-pick input[type="file"]:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; border-radius: var(--radius-pill); }
@media (pointer: coarse) { .courses-file-pick input[type="file"]::file-selector-button { min-height: var(--control-h); } }
.courses-progress .courses-hint strong { color: var(--ink); }
.courses-progress-start { margin: var(--space-1) 0 var(--space-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Flash messages (UX_AUDIT.md M8): text and a Dismiss button on one row,
   the same rounded strip as the rest of the site's notices. */
.site-message { display: flex; align-items: center; gap: var(--space-2); border-left-width: 3px; border-left-color: var(--accent-secondary); border-radius: var(--radius-sm); }
.site-message-error { border-left-color: var(--line-news-ink); }
.site-message-text { flex: 1 1 auto; min-width: 0; }
.site-message-dismiss { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; margin: -0.35rem -0.45rem -0.35rem 0; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.site-message-dismiss[hidden] { display: none; }
.site-message-dismiss:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.site-message-dismiss:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 1px; }
@media (pointer: coarse) { .site-message-dismiss { width: var(--control-h); height: var(--control-h); } }

/* A page note's row opens its page anywhere you click, like a highlight
   row (UX_AUDIT.md m2): the chip link's ::after covers the row; links in
   the note itself sit above it. */
.courses-annotation-row.is-note { position: relative; }
.courses-annotation-stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.courses-annotation-row.is-note:hover { background: color-mix(in srgb, var(--ink) 8%, var(--paper-raised)); }
.courses-annotation-row.is-note:has(.courses-annotation-stretch:focus-visible) { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.courses-annotation-stretch:focus-visible { outline: 0; }
.courses-annotation-note a { position: relative; z-index: 1; }

/* Journal's Timeline / Calendar / Files switch: --ink-faint on the tinted
   well measured about 4.4:1 (axe, UX_AUDIT.md M9); --ink-soft clears AA. */
.journal-view-toggle-btn:not(.active) { color: var(--ink-soft); }

/* Test yourself and revision sheet scope controls (UX_AUDIT.md m1): a
   real-sized select, and All pages / Shaky pages only as the same
   segmented switch as the course page's All / Highlights / Notes. */
.course-test-scope select, .revision-scope select {
  min-height: var(--control-h-sm);
  padding: 0.35em 0.6em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.92rem;
}
.course-test-scope select:focus-visible, .revision-scope select:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.course-test-scope label { font-weight: 600; color: var(--ink-soft); }
.course-test-focus { display: flex; gap: 0.15em; width: max-content; max-width: 100%; margin: 0 0 var(--space-3); padding: 0.2em; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--ink) 5%, var(--paper)); }
.course-test-focus a { display: inline-flex; align-items: center; min-height: 32px; box-sizing: border-box; padding: 0.3em 0.9em; border: 1px solid transparent; border-radius: 7px; color: var(--ink-soft); font-size: 0.85rem; font-weight: 500; text-decoration: none; }
.course-test-focus a:hover { color: var(--ink); }
.course-test-focus a[aria-current] { border-color: var(--border-strong); background: var(--paper-raised); color: var(--ink); font-weight: 700; }
.course-test-focus a:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 1px; }
@media (pointer: coarse) {
  .course-test-scope select, .revision-scope select, .course-test-focus a { min-height: var(--control-h); }
}

/* Header icon buttons on touch screens (UX_AUDIT.md m5): Saved, Messages,
   the app's Search and the account avatar keep their 30-34px look, with an
   invisible 44px hit area around them. */
@media (pointer: coarse) {
  .saved-link, .messages-link, .app-header-search, .account-avatar { position: relative; }
  .saved-link::after, .messages-link::after, .app-header-search::after, .account-avatar::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--control-h);
    height: var(--control-h);
    transform: translate(-50%, -50%);
  }
}

/* Contrast debt from the UI validator's axe_known list (2026-10-09),
   cleared 2026-10-10 (UX_AUDIT.md M9). On search results, .article-list a
   (0,1,1) outranked the level pills' own colour and painted --ink on the
   solid navy Advanced pill. The Pro badge's white on --accent-warm was
   ~3.4:1; --accent-warm-ink carries white at AA (and is the light orange
   with dark text in dark mode, as before). */
.article-list a.label-level-advanced { color: var(--line-brand-on); }
.article-list a.label-level-intermediate { color: var(--accent-secondary-ink); }
.profile-plan-badge.is-pro { border-color: var(--accent-warm-ink); background: var(--accent-warm-ink); }

/* Stragglers from measuring with touch emulation at 375px: text inputs
   and selects on the course pages, the "Add exam date" button (a more
   specific rule above holds it at 32px), the files' "highlights ↓" jump
   and the focus timer. */
@media (pointer: coarse) {
  .courses-page :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select),
  .courses-detail .courses-exam-add > summary.courses-secondary,
  .focus-timer button { min-height: var(--control-h); box-sizing: border-box; }
  .courses-jump-annotations { display: inline-flex; align-items: center; min-height: var(--control-h); }
}

/* Account menu (2026-10-10): the avatar is a <summary> now; the panel
   drops down under it, right-aligned, like the course pages' popovers. */
.account-menu { position: relative; flex: none; display: inline-flex; }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
.account-menu[open] > summary { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--line-brand); }
.account-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-sizing: border-box;
  width: max-content;
  min-width: 14rem;
  max-width: calc(100vw - 24px);
  padding: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
  font-family: var(--font-body);
  font-size: 0.92rem;
  text-align: left;
}
.account-menu-who { margin: 0 0 0.2rem; padding: 0.45rem 0.7rem 0.55rem; border-bottom: 1px solid var(--border); font-size: 0.82rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.account-menu-who strong { color: var(--ink); }
.account-menu-panel form { margin: 0; padding-top: 0.2rem; border-top: 1px solid var(--border); }
.account-menu-panel a, .account-menu-panel button {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-h-sm);
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account-menu-panel a:hover, .account-menu-panel button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.account-menu-panel a:focus-visible, .account-menu-panel button:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: -2px; }
@media (pointer: coarse) { .account-menu-panel a, .account-menu-panel button { min-height: var(--control-h); } }

/* ---------------------------------------------------------------------
   Course page, second pass (2026-10-11, discussed with agy). Last in the
   file on purpose, like the 2026-10-10 block above it.
   --------------------------------------------------------------------- */

/* Files: each collection is one list with hairline dividers rather than a
   stack of boxed cards, so the page has fewer outlines competing with the
   exam plan. Popovers inside a row still escape: no overflow clipping. */
.courses-detail .courses-file-list { gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper-raised); }
.courses-detail .courses-file { border: 0; border-radius: 0; background: transparent; }
.courses-detail .courses-file + .courses-file { border-top: 1px solid var(--border); }
.courses-detail .courses-file:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.courses-detail .courses-file:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.courses-detail .courses-file:only-child { border-radius: var(--radius); }
.courses-detail .courses-file:hover, .courses-detail .courses-file:focus-within { background: color-mix(in srgb, var(--ink) 3%, var(--paper-raised)); }
.courses-detail .courses-file:target { box-shadow: inset 3px 0 0 var(--accent-secondary); }
.courses-detail .courses-file.is-new { box-shadow: inset 3px 0 0 var(--line-economics-ink, var(--accent-secondary)); }
.courses-detail .courses-file.is-failed { box-shadow: inset 3px 0 0 var(--line-news-ink); }
/* The name stays underlined (it's a link), just quieter until hovered. */
.courses-detail a.courses-file-name { text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.courses-detail a.courses-file-name:hover { text-decoration-color: currentColor; }

/* One solid button per page: the exam's Start. Open is an outline button;
   Continue (a file with a last-read page) is tonal, so resuming still
   stands out a little. */
.courses-file-open { border: 1px solid var(--border-strong); background: var(--paper-raised); color: var(--ink); }
.courses-file-open:hover { background: var(--paper-raised); border-color: var(--line-brand-ink); }
.courses-file-open.is-resume { border-color: color-mix(in srgb, var(--line-brand) 45%, transparent); background: color-mix(in srgb, var(--line-brand) 14%, var(--paper-raised)); color: var(--line-brand-ink); }
.courses-file-open.is-resume:hover { background: color-mix(in srgb, var(--line-brand) 24%, var(--paper-raised)); border-color: var(--line-brand); }

/* What's known in a file: a small meter, then the counts. */
.courses-detail .courses-file-meta > .courses-file-known { display: flex; }
.courses-file-known { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.4em; color: var(--ink); }
.courses-mini-meter { flex: none; display: inline-block; width: 3rem; height: 0.35rem; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--ink) 12%, var(--paper)); overflow: hidden; }
.courses-mini-meter > span { display: block; height: 100%; background: var(--line-brand-ink); }
.courses-file-shaky { font-weight: 600; color: var(--accent-warm-ink); }

/* "Unsorted" is a holding tray, not one of the student's collections. */
.courses-collection[data-collection-key="unsorted"] .courses-collection-name { font-weight: 600; color: var(--ink-soft); }
/* The list's own border now frames each collection; the header's rule
   under it would double that line. */
.courses-detail .courses-collection-fold > summary { border-bottom: 0; margin-bottom: var(--space-1); }

/* Study strip: due cards get a chip, not just a tinted outline; on phones
   Flashcards and Test yourself sit side by side, so the files come up
   sooner. */
.courses-due-chip { display: inline-block; margin-left: 0.35em; padding: 0.05em 0.55em; border-radius: var(--radius-pill); background: var(--accent-warm-ink); color: var(--accent-warm-on); font-family: var(--font-body); font-size: 0.75rem; font-weight: 700; vertical-align: 0.1em; }
@media (max-width: 860px) {
  .courses-detail .courses-study-strip,
  .courses-detail .courses-plan-row > .courses-study-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .courses-detail .courses-study-link { padding: var(--space-2) 2.2rem var(--space-2) var(--space-2); }
  .courses-detail .courses-study-link::after { right: var(--space-2); }
  .courses-detail .courses-study-status { font-size: 0.8rem; }
}

/* Course settings: a quiet gear-and-label button that stays beside the
   title on every width (icon only on phones); open, its panel still
   takes the full width under the header. */
.courses-detail .courses-head-row { flex-wrap: nowrap; }
.courses-detail .courses-head-row:has(> .courses-settings[open]) { flex-wrap: wrap; }
.courses-detail .courses-head-row > div { flex: 1 1 auto; }
.courses-detail .courses-head-row > .courses-settings { flex: none; margin-top: var(--space-2); }
.courses-settings-btn { display: inline-flex; align-items: center; gap: 0.4em; min-height: var(--control-h-sm); padding: 0.3em 0.75em; border: 1px solid transparent; border-radius: var(--radius-pill); color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.courses-settings-btn:hover, .courses-settings[open] > .courses-settings-btn { border-color: var(--border-strong); color: var(--ink); }
.courses-settings-btn:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; }
@media (max-width: 560px) {
  .courses-settings-btn { justify-content: center; width: var(--control-h); min-height: var(--control-h); padding: 0; }
  .courses-settings-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (pointer: coarse) { .courses-settings-btn { min-height: var(--control-h); } }
.courses-detail .courses-head-row > .courses-settings[open] { flex: 1 1 100%; min-width: 0; margin-top: 0; }

/* Course list badges (2026-10-11): the next exam (navy) and cards due
   (orange), in words, so colour is never the only signal. */
.courses-card-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.courses-card-badge { display: inline-flex; align-items: center; padding: 0.15em 0.6em; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 700; line-height: 1.3; }
.courses-card-badge.is-exam { background: color-mix(in srgb, var(--line-brand) 14%, var(--paper-raised)); color: var(--line-brand-ink); }
.courses-card-badge.is-due { background: var(--accent-warm-ink); color: var(--accent-warm-on); }
@media (pointer: coarse) {
  .courses-exam-actions .courses-danger-link, .courses-annotations-filter button { min-width: var(--control-h); justify-content: center; }
}

/* ---------------------------------------------------------------------
   Tool pages, "Campus Kinetic" pass (2026-10-11, owner: "more energetic,
   modern, professional and cute"; direction worked out with agy). The
   Feeds page's approved recipe (2026-10-02, "Feeds, playful pass" above)
   carried to the other signed-in tool pages: Today, Study, Words,
   Courses, flashcards, Test yourself, Applications. Sticker cards with a
   big radius and a 1.5px edge, a tinted head band in one hue each, a
   bouncy icon badge, a small hover lift, a solid 3px ledge under primary
   buttons, and one staggered rise-in on load. Still no shadow on card
   edges (owner, 2026-10-03). News and article pages are untouched: they
   stay newsroom-plain. All motion sits behind prefers-reduced-motion.
   Last in the file on purpose.
   --------------------------------------------------------------------- */
:root {
  --radius-tool: 22px;
  --border-tool: 1.5px;
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ledge: 0 3px 0 color-mix(in srgb, var(--line-brand) 55%, #000);
  --ledge-pressed: 0 1px 0 color-mix(in srgb, var(--line-brand) 55%, #000);
}
@media (max-width: 599px) { :root { --radius-tool: 18px; } }

/* Hues for stickers: one per kind of thing, from the brand and the
   existing pillar colours (each has an AA "-ink" twin, both themes). */
.study-tool--courses, .dashboard-action--news { --sticker: var(--line-brand); --sticker-ink: var(--line-brand-ink); }
.study-tool--words, .dashboard-action--words { --sticker: var(--accent-warm); --sticker-ink: var(--accent-warm-ink); }
.study-tool--speaking, .dashboard-action--journal { --sticker: var(--line-economics); --sticker-ink: var(--line-economics-ink); }
.study-tool--interview, .dashboard-action--apps { --sticker: var(--line-highered); --sticker-ink: var(--line-highered-ink); }

/* Tool page titles end on a small orange dot, like a full stop in the
   wordmark's "News" orange: a signature, not decoration everywhere. */
.tool-title::after {
  content: "";
  display: inline-block;
  width: 0.2em;
  height: 0.2em;
  margin-left: 0.08em;
  border-radius: 50%;
  background: var(--brand-news-gold);
  vertical-align: baseline;
}
.apps-header h1.section-page-title { margin-bottom: 0.3rem; }

/* Icon badges: rounded squares in the sticker's tint. */
.study-tool-badge, .dashboard-action-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--sticker, var(--line-brand)) 16%, var(--paper-raised));
  color: var(--sticker-ink, var(--line-brand-ink));
  font-size: 1rem;
}

/* Study hub tiles: stickers with a tinted head band. */
.study-tool {
  position: relative;
  gap: 0.45rem;
  padding: 0 1.1rem 1rem;
  border: var(--border-tool) solid var(--border);
  border-radius: var(--radius-tool);
}
.study-tool:hover, .study-tool:focus-visible { border-color: var(--sticker, var(--line-brand-ink)); }
.study-tool-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 -1.1rem 0.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px) 0 0;
  background: color-mix(in srgb, var(--sticker, var(--line-brand)) 9%, var(--paper-raised));
}
.study-tool-head .study-tool-badge { background: var(--paper-raised); }
.study-tool-head .study-tool-name { flex: 1; }
.study-tool:hover .study-tool-name::after { color: var(--sticker-ink, var(--line-brand-ink)); }
.study-week { border-width: var(--border-tool); border-radius: var(--radius-tool); }
.study-week-stats > div { padding: 0.6rem 0.75rem; border-radius: 14px; background: color-mix(in srgb, var(--line-brand) 6%, var(--paper-raised)); }
.study-week-stats > div:nth-child(2) { background: color-mix(in srgb, var(--line-economics) 9%, var(--paper-raised)); }
.study-week-stats > div:nth-child(3) { background: color-mix(in srgb, var(--accent-warm) 9%, var(--paper-raised)); }
.study-library-links a { border-radius: var(--radius-pill); border-width: var(--border-tool); }

/* Today dashboard: the plan is a sticker with a live dot; the four
   actions become a two-column grid of icon tiles. */
.dashboard-page { max-width: 720px; }
.today-card { border-radius: var(--radius-tool); padding: var(--space-3); }
.today-heading { display: flex; align-items: center; gap: 0.5rem; }
.today-heading::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--brand-news-gold); }
.today-item { border-radius: 14px; }
.today-item::before { width: 0.35rem; }
.dashboard-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
@media (max-width: 480px) { .dashboard-actions { grid-template-columns: minmax(0, 1fr); } }
.dashboard-action {
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: var(--border-tool) solid var(--border);
  border-radius: var(--radius-tool);
}
.dashboard-action:hover, .dashboard-action:focus-visible { border-color: var(--sticker, var(--accent-secondary)); box-shadow: none; }
.dashboard-action-label { font-size: 1rem; }
.dashboard-more-links a { text-underline-offset: 3px; }

/* Course list: the code becomes a chip. No coloured band along the card's
   edge (2026-10-15, owner: "do not use border shading for the course
   tabs") -- the plain border, the chip and the hover colour carry it. */
.courses-card {
  border: var(--border-tool) solid var(--border);
  border-radius: var(--radius-tool);
}
.courses-card:hover, .courses-card:focus-visible { border-color: var(--line-brand-ink); }
.courses-card-code { align-self: flex-start; padding: 0.15em 0.6em; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--line-brand) 12%, var(--paper-raised)); }

/* Course page and study cards: the same shape family. */
.courses-detail :is(.courses-exams, .courses-progress, .courses-study-link, .courses-file-list, .courses-upload),
.course-test-card, #review-card, .course-card-item, .apps-item { border-width: var(--border-tool); border-radius: var(--radius-tool); }
.courses-detail .courses-exams.is-empty { border-radius: var(--radius-tool); }
.courses-detail .courses-exam-today { border-radius: 0 14px 14px 0; }
.courses-meter { height: 0.6rem; }
.courses-time-bar { border-radius: 6px 6px 2px 2px; }
.courses-detail .courses-file:first-child { border-radius: calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px) 0 0; }
.courses-detail .courses-file:last-child { border-radius: 0 0 calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px); }
.courses-detail .courses-file:only-child { border-radius: calc(var(--radius-tool) - 2px); }
.courses-file-kind { border-radius: 14px; }

/* Primary buttons on tool pages stand on a solid ledge (approved on
   Feeds' Add feed) and press down when tapped. */
.courses-primary, .apps-primary, .review-flip { box-shadow: var(--ledge); }
.courses-primary:active, .apps-primary:active, .review-flip:active { transform: translateY(2px); box-shadow: var(--ledge-pressed); }
.review-flip { border-radius: var(--radius-pill); }

/* Flashcard grades: each answer tinted in its own colour. */
.review-grades button { border-width: var(--border-tool); border-radius: 16px; background: color-mix(in srgb, var(--grade) 7%, transparent); }
.review-grades button:hover { background: color-mix(in srgb, var(--grade) 13%, transparent); }

/* Empty-state spot art: line drawings in the brand's two colours. */
.courses-spot { display: block; margin: 0 auto var(--space-1); }
.courses-empty .courses-spot { margin: 0 0 var(--space-2); }
.courses-spot .spot-line { fill: none; stroke: var(--line-brand-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.courses-spot .spot-fill { fill: color-mix(in srgb, var(--line-brand) 10%, var(--paper-raised)); }
.courses-spot .spot-paper { fill: var(--paper-raised); stroke: var(--line-brand-ink); stroke-width: 2.2; stroke-linejoin: round; }
.courses-spot .spot-accent-fill { fill: var(--accent-warm); }
.courses-spot .spot-accent-line { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Motion: answers to hover and press, plus one staggered rise-in. */
@media (prefers-reduced-motion: no-preference) {
  .study-tool, .dashboard-action, .courses-card, .courses-detail .courses-study-link { transition: border-color 0.15s ease, transform 0.18s var(--ease-out-soft); }
  .study-tool:hover, .dashboard-action:hover, .courses-card:hover, .courses-detail .courses-study-link:hover { transform: translateY(-3px); }
  .study-tool-badge, .dashboard-action-icon { transition: transform 0.25s var(--ease-bounce); }
  .study-tool:hover .study-tool-badge, .dashboard-action:hover .dashboard-action-icon { transform: rotate(-6deg) scale(1.08); }
  .courses-detail .courses-study-link::after { transition: transform 0.2s var(--ease-bounce); }
  .courses-detail .courses-study-link:hover::after { transform: translate(3px, -50%); }
  .courses-primary, .apps-primary, .review-flip { transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease; }
  .review-grades button { transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s var(--ease-out-soft); }
  .review-grades button:hover { transform: translateY(-2px); }
  .study-tool-grid > li, .dashboard-actions > a, .courses-grid > li { animation: tool-rise 0.5s var(--ease-out-soft) backwards; }
  :is(.study-tool-grid > li, .dashboard-actions > a, .courses-grid > li):nth-child(2) { animation-delay: 0.06s; }
  :is(.study-tool-grid > li, .dashboard-actions > a, .courses-grid > li):nth-child(3) { animation-delay: 0.12s; }
  :is(.study-tool-grid > li, .dashboard-actions > a, .courses-grid > li):nth-child(n + 4) { animation-delay: 0.18s; }
}
@keyframes tool-rise { from { opacity: 0; transform: translateY(12px); } }

/* Head bands on the course page's two summary cards, like the Study
   stickers: navy for the exam plan, green for progress. */
.courses-detail .courses-exams:not(.is-empty) > h2,
.courses-detail .courses-progress > h2 {
  margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-2);
  padding: 0.8rem var(--space-3);
  border-radius: calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px) 0 0;
  background: color-mix(in srgb, var(--line-brand) 8%, var(--paper-raised));
}
.courses-detail .courses-progress > h2 { background: color-mix(in srgb, var(--line-economics) 10%, var(--paper-raised)); }
.course-card-item { border-color: var(--border); }

/* Applications: the add form is a sticker too, its summary a real button. */
.apps-add { border: var(--border-tool) solid var(--border); border-radius: var(--radius-tool); }
.apps-add > summary { border-radius: calc(var(--radius-tool) - 2px); cursor: pointer; }
.apps-add[open] > summary { border-radius: calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px) 0 0; background: color-mix(in srgb, var(--line-highered) 9%, var(--paper-raised)); }
.apps-add > summary:hover { background: color-mix(in srgb, var(--line-highered) 9%, var(--paper-raised)); }

/* "This week" on phones: three tight stats still read. */
@media (max-width: 480px) {
  .study-week-stats { gap: 0.4rem; }
  .study-week-stats > div { padding: 0.5rem 0.55rem; }
  .study-week-stats dd { font-size: 1.05rem; }
}

/* Refinements after agy's review of the pass (2026-10-11). */
.today-heading::after { content: none; }
.study-start-here-icon { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 12px; background: color-mix(in srgb, var(--sticker, var(--line-brand)) 16%, var(--paper-raised)); color: var(--sticker-ink, var(--line-brand-ink)); }
.study-start-here-icon--news { --sticker: var(--line-brand); --sticker-ink: var(--line-brand-ink); }
.study-start-here-icon--words { --sticker: var(--accent-warm); --sticker-ink: var(--accent-warm-ink); }
.study-start-here-icon--speaking { --sticker: var(--line-economics); --sticker-ink: var(--line-economics-ink); }
.study-start-here-icon--interview { --sticker: var(--line-highered); --sticker-ink: var(--line-highered-ink); }
.study-start-here { border-width: var(--border-tool); border-radius: var(--radius-tool); }
.study-start-here-action { border-radius: 0; }
.study-start-here-action:first-child { border-radius: calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px) 0 0; }
.study-start-here-action:last-child { border-radius: 0 0 calc(var(--radius-tool) - 2px) calc(var(--radius-tool) - 2px); }
.courses-annotation-row { border-radius: 0 12px 12px 0; }
.profile-hero { border-width: var(--border-tool); border-radius: var(--radius-tool); background: color-mix(in srgb, var(--line-brand) 6%, var(--paper-raised)); }
.profile-tabpanel { border-width: var(--border-tool); border-radius: var(--radius-tool); }
@media (prefers-reduced-motion: no-preference) {
  .study-tool:hover .study-tool-badge, .dashboard-action:hover .dashboard-action-icon { transform: rotate(-4deg) scale(1.06); }
}

/* Dark mode: the ledge needs more body against near-black paper, and the
   tints go grey at light-mode strengths. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ledge: 0 3px 0 color-mix(in srgb, var(--line-brand) 45%, #0a0d13); --ledge-pressed: 0 1px 0 color-mix(in srgb, var(--line-brand) 45%, #0a0d13); }
  :root:not([data-theme="light"]) .study-tool-head { background: color-mix(in srgb, var(--sticker, var(--line-brand)) 16%, var(--paper-raised)); }
  :root:not([data-theme="light"]) .courses-detail .courses-exams:not(.is-empty) > h2 { background: color-mix(in srgb, var(--line-brand) 15%, var(--paper-raised)); }
  :root:not([data-theme="light"]) .courses-detail .courses-progress > h2 { background: color-mix(in srgb, var(--line-economics) 16%, var(--paper-raised)); }
  :root:not([data-theme="light"]) .study-week-stats > div { background: color-mix(in srgb, var(--line-brand) 12%, var(--paper-raised)); }
  :root:not([data-theme="light"]) .study-week-stats > div:nth-child(2) { background: color-mix(in srgb, var(--line-economics) 15%, var(--paper-raised)); }
  :root:not([data-theme="light"]) .study-week-stats > div:nth-child(3) { background: color-mix(in srgb, var(--accent-warm) 15%, var(--paper-raised)); }
}
:root[data-theme="dark"] { --ledge: 0 3px 0 color-mix(in srgb, var(--line-brand) 45%, #0a0d13); --ledge-pressed: 0 1px 0 color-mix(in srgb, var(--line-brand) 45%, #0a0d13); }
:root[data-theme="dark"] .study-tool-head { background: color-mix(in srgb, var(--sticker, var(--line-brand)) 16%, var(--paper-raised)); }
:root[data-theme="dark"] .courses-detail .courses-exams:not(.is-empty) > h2 { background: color-mix(in srgb, var(--line-brand) 15%, var(--paper-raised)); }
:root[data-theme="dark"] .courses-detail .courses-progress > h2 { background: color-mix(in srgb, var(--line-economics) 16%, var(--paper-raised)); }
:root[data-theme="dark"] .study-week-stats > div { background: color-mix(in srgb, var(--line-brand) 12%, var(--paper-raised)); }
:root[data-theme="dark"] .study-week-stats > div:nth-child(2) { background: color-mix(in srgb, var(--line-economics) 15%, var(--paper-raised)); }
:root[data-theme="dark"] .study-week-stats > div:nth-child(3) { background: color-mix(in srgb, var(--accent-warm) 15%, var(--paper-raised)); }

/* Highlights page: the journal's section (2026-10-11). */
.highlights-journal-heading { margin: var(--space-4) 0 var(--space-2); font-family: var(--font-display); font-size: 1.25rem; }
.highlights-entry-date { margin-left: 0.35em; font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); }

/* Search across highlights and notes (2026-10-12). */
.courses-search { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.courses-search input[type="search"] { flex: 1 1 14rem; min-height: 44px; box-sizing: border-box; padding: 0 0.7em; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; }
.courses-search button { min-height: 44px; }
.courses-results { margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.courses-result { padding: var(--space-2) 0; border-top: 1px solid var(--border); }
.courses-result a { display: block; min-height: 44px; color: var(--ink); text-decoration: none; }
.courses-result-where { font-size: 0.85rem; color: var(--ink-soft); }
.courses-result-snippet { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.courses-result-note { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--ink-soft); overflow-wrap: anywhere; }

/* Archived courses (2026-10-12). */
.courses-archived { margin: var(--space-4) 0 0; }
.courses-archived > summary { min-height: 44px; display: list-item; cursor: pointer; font-weight: 600; padding: 0.6rem 0; }
.courses-archive-form { margin: var(--space-3) 0 0; }
.courses-archive-form .courses-secondary { min-height: 44px; }
.courses-archived .courses-card { opacity: 0.8; }

/* Course list, concise layout (2026-10-15, owner: "make it concise and
   clear"). Due cards, the streak and search share one strip under the
   title; the agenda is a tight list; the courses follow straight after. */
.courses-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: var(--space-3) 0 0; }
.courses-toolbar > .courses-primary { display: inline-flex; align-items: center; text-decoration: none; }
.courses-toolbar .courses-streak { margin: 0; font-size: 0.9rem; }
.courses-toolbar .courses-search { flex: 0 1 24rem; flex-wrap: nowrap; margin: 0 0 0 auto; }
.courses-toolbar .courses-search input[type="search"] { flex: 1 1 auto; min-width: 0; }
.courses-page .courses-agenda { padding: var(--space-2) var(--space-3); }
.courses-page .courses-agenda h2 { margin: var(--space-1) 0 0; font-size: 0.95rem; }
.courses-page .courses-agenda li { padding: 0; }
.courses-page .courses-grid { margin-top: var(--space-3); }
.courses-card-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.courses-card-kicker .courses-card-term { font-size: 0.8rem; }
.courses-next-step { margin: var(--space-3) 0 0; font-size: 0.92rem; color: var(--ink-soft); }
/* "+ New course" stays beside the title on a phone too. */
.courses-page > .courses-head-row { flex-wrap: nowrap; align-items: center; }
.courses-page > .courses-head-row > div { flex: 1 1 auto; }
.courses-page > .courses-head-row > .courses-popover { margin-top: 0; }
/* First visit: three short steps as plain numbered lines, then the create form inline. */
.courses-first { margin-top: var(--space-3); }
.courses-first .courses-start { margin-top: 0; gap: var(--space-1) var(--space-3); }
.courses-first .courses-start li { padding: 0.2rem 0 0.2rem 2.2rem; border: 0; background: none; }
.courses-first .courses-start li::before { left: 0; top: 0.2rem; width: 1.5rem; height: 1.5rem; font-size: 0.8rem; }
.courses-first-form { max-width: 36rem; margin-top: var(--space-3); padding: var(--space-3); border: var(--border-tool) solid var(--border); border-radius: var(--radius-tool); background: var(--paper-raised); }
.courses-first-form h2 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: 1.1rem; }
@media (max-width: 640px) {
  .courses-toolbar .courses-search { flex: 1 1 100%; margin-left: 0; }
}

/* ---------------------------------------------------------------------
   Newsroom refinement (2026-10-15 site redesign). News and article pages
   only; the signed-in tool pages keep the approved "Campus Kinetic" pass.
   Same identity -- white page, NUS blue, orange only in the wordmark and
   small marks, Poppins headings over Inter, hairline rules, no card
   shading -- with a clearer hierarchy: one dominant lead, lighter
   secondary headlines, labels only when they say something
   (_card_kicker.html), one quiet meta line, and a flat section cover
   instead of a broken-image icon. Last in the file on purpose.
   --------------------------------------------------------------------- */

/* Hero: lead on the left; Today / sign-up panel and the next two stories
   on the right (home.html). */
.home-hero { gap: var(--space-4); margin-bottom: var(--space-5); }
.home-hero-side { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.home-hero-side > .today-card { margin: 0; }
@media (min-width: 1000px) {
  .home-hero { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
  .home-hero > .lead-story { grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1fr); }
  .home-hero > .home-hero-side { grid-column: 2; grid-row: 1; }
  .home-hero > .lead-story .lead-story-image { order: -1; }
}
/* Phone and tablet: the news first for a visitor; a signed-in student's
   Today plan stays on top, where the owner put it (2026-10-03). Below
   1000px the side column got too narrow for a headline beside its photo. */
@media (max-width: 999px) {
  .home-hero { display: flex; flex-direction: column; }
  .home-hero-side { display: contents; }
  .home-hero > .lead-story { order: 0; }
  .home-hero-side > .secondary-list { order: 1; }
  .home-hero-side > .today-card { order: 2; }
  .home-hero.has-plan .home-hero-side > .today-card { order: -1; }
}

.lead-story h1 { font-size: clamp(1.85rem, 3.3vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0.15rem 0 var(--space-2); }
.lead-story .dek { font-size: 1.08rem; line-height: 1.55; max-width: 62ch; }
.lead-story-image .image-caption { margin: 0.35rem 0 var(--space-2); }
/* Desktop: a lower photo (2.1:1, ~15% shorter than 16:9) and a smaller
   cap on the headline, so the lead doesn't crowd out the Today panel
   beside it (2026-10-16). */
@media (min-width: 1000px) {
  .lead-story-image .card-image { aspect-ratio: 2.1 / 1; }
  .lead-story h1 { font-size: clamp(1.85rem, 2.9vw, 2.25rem); }
}

/* The next two stories: headline rows with a small photo, under the panel. */
.secondary-list { border-top: 1px solid var(--border); }
.secondary-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); align-items: start; padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.secondary-item h2 { margin: 0 0 0.3rem; font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; line-height: 1.32; }
.secondary-item h2 a { color: var(--ink); text-decoration: none; }
.secondary-item h2 a::after { content: ""; position: absolute; inset: 0; }
.secondary-item:hover h2 a { text-decoration: underline; text-decoration-color: var(--border-strong); }
.secondary-item .card-kicker { position: relative; z-index: 1; }
.secondary-item-image { display: block; width: 104px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }

/* Labels: shown only for Analysis / Long read and non-Advanced levels. */
.card-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0 0 0.35rem; }
.card-kicker .label { margin: 0; }

/* One quiet meta line. Plain inline text: as a flexbox, each text piece
   and the <time> shrank on their own and broke into "OCT / 15" stacks in
   narrow columns (the article's "More from" rail). */
.article-list-meta:not(:has(.label)) { display: block; }

/* Story cards: a step down from the lead. */
.story-card h3, .featured-card h3 { font-weight: 600; letter-spacing: -0.005em; }
.story-card h3 { font-size: 1.1rem; line-height: 1.3; margin: 0.15rem 0 0.35rem; }
.compact-card h3 { font-weight: 600; }
.editors-picks-text > a { font-weight: 600; }
.story-grid .card-image, .featured-layout .card-image { border-radius: 8px; }
.story-card .dek { font-size: 0.95rem; color: var(--ink-soft); }
/* Fill the row instead of capping columns at 340px (which left the right
   third of a topic page empty at desktop widths). auto-fill keeps empty
   tracks, so a lone card still doesn't stretch across the page -- the
   2026-08-22 concern the 340px cap was for. */
.story-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-4) var(--space-3); }

/* No photo: a flat cover naming the section, same footprint as a photo. */
.card-image-placeholder,
.compact-card-image-empty {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  box-sizing: border-box;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: var(--radius-media, 8px);
  background: color-mix(in srgb, var(--line-brand) 8%, var(--paper));
}
.card-cover-label { font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1.2; color: var(--line-brand-ink); }
.card-cover-label::before { content: ""; display: inline-block; width: 0.45em; height: 0.45em; margin-right: 0.4em; border-radius: 50%; background: var(--brand-news-gold); vertical-align: 0.12em; }
.compact-card-image-empty .card-cover-label { font-size: 0.9rem; }

/* Article subheadings promoted from bold-only paragraphs (articles/views.py
   _BOLD_PARAGRAPH_RE). */
.article-body h3.article-subhead { margin: 2em 0 0.55em; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; color: var(--ink); }

/* ---------------------------------------------------------------------
   Visitor homepage (2026-10-16, articles/home_visitor.html): Biblinkage as a
   study workspace. Same identity as the rest of the site -- white page,
   NUS blue as the one action colour, Poppins headings over Inter, hairline
   rules, no card shading and no coloured edge bands on cards (owner,
   2026-10-15). The four core tools sit in one row on desktop and a 2x2 grid
   on phones so all four show within one scroll.
   --------------------------------------------------------------------- */
.vh-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) 0 var(--space-4);
}
.vh-eyebrow { margin: 0 0 0.6rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--line-brand-ink); }
.vh-title { margin: 0; font-family: var(--font-display); font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 700; line-height: 1.08; letter-spacing: -0.02em; color: var(--ink); }
.vh-dek { margin: 1rem 0 0; max-width: 34em; font-size: 1.08rem; line-height: 1.55; color: var(--ink-soft); }
.vh-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.vh-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
}
.vh-button-primary { background: var(--line-brand); color: var(--line-brand-on); }
.vh-button-primary:hover { background: var(--accent-secondary-ink); color: var(--line-brand-on); }
.vh-button-secondary { border: 1px solid var(--border-strong); color: var(--ink); }
.vh-button-secondary:hover { border-color: var(--ink); color: var(--ink); }
.vh-button:focus-visible,
.vh-tool-action:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.vh-note { margin: 1rem 0 0; font-size: 0.88rem; color: var(--ink-faint); }

.vh-preview { margin: 0; }
.vh-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.vh-pane {
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.vh-pane-courses,
.vh-pane-speaking { background: color-mix(in srgb, var(--line-brand) 5%, var(--paper)); }
.vh-pane-label { margin: 0 0 0.55rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }
.vh-course-list { list-style: none; margin: 0; padding: 0; }
.vh-course-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; font-size: 0.88rem; border-top: 1px solid var(--border); }
.vh-course-list li:first-child { border-top: 0; }
.vh-course-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--line-brand); }
.vh-course-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.vh-course-meta { color: var(--ink-soft); font-size: 0.8rem; }
.vh-card-word { margin: 0; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.vh-card-context { margin: 0.35rem 0 0.7rem; font-size: 0.84rem; line-height: 1.45; color: var(--ink-soft); }
.vh-card-context mark { background: color-mix(in srgb, var(--accent-secondary) 18%, transparent); color: var(--ink); font-weight: 600; padding: 0 0.1em; }
.vh-card-grades { display: flex; gap: 0.3rem; }
.vh-card-grades span { flex: 1; padding: 0.25rem 0; border: 1px solid var(--border); border-radius: 6px; text-align: center; font-size: 0.72rem; color: var(--ink-soft); }
.vh-card-grades span.is-on { background: var(--line-brand); border-color: var(--line-brand); color: var(--line-brand-on); }
.vh-journal-line { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--ink); }
.vh-journal-tags { display: flex; gap: 0.4rem; margin: 0.6rem 0 0; font-size: 0.75rem; color: var(--line-brand-ink); }
.vh-speak-q { margin: 0; font-size: 0.88rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.vh-speak-rec { display: flex; align-items: center; gap: 0.45rem; margin: 0.7rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.vh-rec-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line-news); }
.vh-preview-caption { margin-top: 0.6rem; font-size: 0.78rem; color: var(--ink-faint); }

.vh-section { padding: var(--space-4) 0; border-top: 1px solid var(--border); }
.vh-section-title { margin: 0 0 var(--space-3); font-family: var(--font-display); font-size: clamp(1.35rem, 2.4vw, 1.7rem); font-weight: 700; line-height: 1.2; color: var(--ink); }
.vh-section .section-header .vh-section-title { margin-bottom: 0; }

.vh-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
.vh-tool {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.vh-tool-shot {
  margin: -1.2rem -1.2rem 1rem;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--paper);
}
.vh-tool-shot img { display: block; width: 100%; height: auto; }
.vh-tool-shot .vh-tool-shot-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vh-tool-shot .vh-tool-shot-light { display: none; }
  :root:not([data-theme="light"]) .vh-tool-shot .vh-tool-shot-dark { display: block; }
}
:root[data-theme="dark"] .vh-tool-shot .vh-tool-shot-light { display: none; }
:root[data-theme="dark"] .vh-tool-shot .vh-tool-shot-dark { display: block; }
.vh-tool-num { margin: 0 0 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--line-brand-ink); }
.vh-tool-title { margin: 0; font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.vh-tool-text { margin: 0.55rem 0 0; font-size: 0.93rem; line-height: 1.5; color: var(--ink-soft); }
.vh-tool-fact { margin: 0.6rem 0 1rem; font-size: 0.82rem; line-height: 1.45; color: var(--ink-faint); }
.vh-tool-action {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  font-weight: 600;
  color: var(--line-brand-ink);
  text-decoration: none;
}
.vh-tool-action::after { content: "→"; margin-left: 0.35rem; }
.vh-tool-action:hover { text-decoration: underline; }

.vh-loop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.vh-loop li { display: flex; gap: 0.75rem; font-size: 0.95rem; line-height: 1.5; color: var(--ink-soft); }
.vh-loop strong { color: var(--ink); }
.vh-loop-step {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--line-brand);
  font-weight: 700;
  color: var(--line-brand-ink);
}

.vh-more { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--space-3); }
.vh-more li { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.85rem 0; border-top: 1px solid var(--border); font-size: 0.9rem; line-height: 1.45; }
.vh-more strong { color: var(--ink); font-weight: 600; }
.vh-more span { color: var(--ink-soft); }
.vh-more-link { margin: var(--space-2) 0 0; font-weight: 600; }
.vh-more-action { margin-top: 0.15rem; color: var(--accent-secondary-ink); font-weight: 600; text-decoration: none; }
.vh-more-action:hover { text-decoration: underline; }

.vh-news .section-header { margin-bottom: var(--space-2); }
.vh-news-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-3); }
.vh-news-filters a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
}
.vh-news-filters a:hover { border-color: var(--line-brand); color: var(--line-brand-ink); }
.vh-news-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4) var(--space-3); }
.vh-news-grid .vh-news-lead { grid-column: span 2; grid-row: span 2; }
.vh-news-grid .vh-news-lead h3 { font-size: 1.45rem; }

.vh-plan-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.vh-plan-list li { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; line-height: 1.5; color: var(--ink-soft); }
.vh-plan-list strong { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.vh-privacy-note { margin: var(--space-2) 0 0; font-size: 0.85rem; color: var(--ink-faint); }

.vh-closing { padding: var(--space-4) 0 calc(var(--space-4) * 1.5); border-top: 1px solid var(--border); text-align: center; }
.vh-closing h2 { margin: 0 0 var(--space-3); font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: var(--ink); }

@media (max-width: 1000px) {
  .vh-hero { grid-template-columns: 1fr; gap: var(--space-3); }
  .vh-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vh-news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vh-more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .vh-hero { padding-top: var(--space-2); }
  /* Phones: the example screens are too small to read at this width, and
     the tools become a compact 2x2 of name, headline and action, so all
     four sit near the first screen. */
  .vh-preview { display: none; }
  .vh-tools { gap: 0.75rem; }
  .vh-tool { padding: 0.9rem; }
  .vh-tool-title { font-size: 1rem; margin-bottom: 0.4rem; }
  .vh-tool-text,
  .vh-tool-fact,
  .vh-tool-shot { display: none; }
  .vh-loop,
  .vh-more,
  .vh-plan-list { grid-template-columns: 1fr; }
  .vh-loop { gap: var(--space-2); }
  .vh-news-grid { grid-template-columns: 1fr; }
  .vh-news-grid .vh-news-lead { grid-column: auto; grid-row: auto; }
  .vh-actions .vh-button { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 380px) {
  .vh-tools { grid-template-columns: 1fr; }
}

/* Header "Study tools" menu (2026-10-16, templates/base.html): first in the
   section row, before the news tabs, set off by a hairline. .site-nav-wrap
   becomes a flex row so the menu and the scrolling #site-nav sit side by
   side; the menu mirrors .site-nav's top rule and spacing in each mode so
   the row still reads as one line. Its panel is outside #site-nav, so the
   sideways scrolling there never clips it. */
/* "Start free" in the header, "Sign up" where the button is squeezed
   (the 385px block above hides the full label). */
.signup-link-short { display: none; }
@media (max-width: 385px) {
  .signup-link-short { display: inline; }
}
/* Translated headers (2026-11-13). "Se connecter", "Iniciar sesión",
   "Commencer gratuitement" and the like are far longer than "Log in" and
   "Start free", so on phones they wrapped the signed-out header onto a
   second row at every width (Japanese from 390px). In those languages the
   header uses the short sign-up label below 900px (where About and Pricing
   leave it too). The four European ones also use the round log-in icon
   .app-header-account (the app's own) in place of the text link below
   900px, and keep About and Pricing in the footer only below 1024px. :lang() follows the chrome's own lang
   attribute (base.html) as well as the page's. */
@media (max-width: 899px) {
  .signup-link:lang(ja) .signup-link-full, .signup-link:lang(fr) .signup-link-full,
  .signup-link:lang(de) .signup-link-full, .signup-link:lang(nl) .signup-link-full,
  .signup-link:lang(es) .signup-link-full { display: none; }
  .signup-link:lang(ja) .signup-link-short, .signup-link:lang(fr) .signup-link-short,
  .signup-link:lang(de) .signup-link-short, .signup-link:lang(nl) .signup-link-short,
  .signup-link:lang(es) .signup-link-short { display: inline; }
}
@media (max-width: 1023px) {
  .header-info-link:lang(fr), .header-info-link:lang(de),
  .header-info-link:lang(nl), .header-info-link:lang(es) { display: none; }
}
@media (max-width: 899px) {
  .account-link:lang(fr), .account-link:lang(de), .account-link:lang(nl), .account-link:lang(es) { display: none; }
  .app-header-account:lang(fr), .app-header-account:lang(de),
  .app-header-account:lang(nl), .app-header-account:lang(es) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--ink-soft);
    text-decoration: none;
  }
  .app-header-account:lang(fr) svg, .app-header-account:lang(de) svg,
  .app-header-account:lang(nl) svg, .app-header-account:lang(es) svg {
    width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round;
  }
}
.site-nav-wrap { display: flex; align-items: stretch; }
.site-nav-wrap > .site-nav { flex: 1 1 auto; min-width: 0; }
.study-tools-menu {
  position: relative;
  flex: none;
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
}
.study-tools-menu > summary {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem 0.45rem 0.5rem;
  margin-right: var(--space-2);
  border-right: 1px solid var(--border);
  color: var(--line-brand-ink);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.study-tools-menu > summary::-webkit-details-marker { display: none; }
.study-tools-menu > summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  margin-top: -0.2em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.study-tools-menu[open] > summary::after { transform: translateY(0.2em) rotate(-135deg); }
.study-tools-menu > summary:hover { color: var(--ink); }
.study-tools-menu > summary:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; border-radius: 4px; }
.study-tools-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  box-sizing: border-box;
  width: max-content;
  min-width: 15rem;
  max-width: calc(100vw - 24px);
  padding: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
}
.study-tools-panel a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-height: 44px;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.study-tools-panel a span { font-size: 0.8rem; font-weight: 400; color: var(--ink-soft); }
.study-tools-panel a:hover,
.study-tools-panel a:focus-visible { background: color-mix(in srgb, var(--line-brand) 8%, var(--paper-raised)); }
.study-tools-panel a:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) {
  .study-tools-menu > summary::after { transition: none; }
}
@media (max-width: 540px) {
  .study-tools-menu { margin-top: 0; padding-top: var(--space-1); font-size: 0.8rem; }
  .study-tools-menu > summary { padding: 0.4rem 0.6rem 0.55rem 0.2rem; margin-right: var(--space-1); }
}
/* One-row compact desktop header: .site-nav drops its top rule there. */
@media (min-width: 960px) {
  html.header-compact:not(.has-reading-header) .study-tools-menu { margin-top: 0; padding-top: 0; border-top: 0; align-self: center; }
  html.header-compact:not(.has-reading-header) .study-tools-menu > summary { padding: 0.4rem 0.6rem 0.55rem 0.35rem; }
}
/* Signed-out News menu (2026-11-15): the Study tools menu's look, on the
   other side of the nav, so its rule and panel face the other way. */
.news-menu > summary { margin-right: 0; margin-left: var(--space-2); padding-left: 0.75rem; border-right: 0; border-left: 1px solid var(--border); }
.news-menu .study-tools-panel { left: auto; right: 0; min-width: 11rem; }
.news-menu .study-tools-panel a { min-height: 40px; }
@media (max-width: 540px) {
  .news-menu > summary { margin-left: var(--space-1); padding-left: 0.6rem; }
}
/* Account menu (2026-10-16): Study overview, Feeds and Applications moved
   here from the header; a hairline separates them from the account items. */
.account-menu-panel a.account-menu-divided { margin-top: 0.2rem; padding-top: 0.55rem; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.account-menu-panel a.active { color: var(--ink); font-weight: 700; }

/* Header Speaking menu (2026-10-16): the summary keeps .speaking-link's
   look; the panel reuses the Study tools menu's two-line items. */
.speaking-menu { position: relative; flex: none; display: inline-flex; }
.speaking-menu > summary { list-style: none; cursor: pointer; }
.speaking-menu > summary::-webkit-details-marker { display: none; }
.speaking-menu > summary:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 2px; border-radius: 2px; }
.speaking-menu[open] > summary { border-color: var(--border-strong); color: var(--ink); }
.speaking-menu[open] > summary.active { border-color: var(--accent-warm); }
.speaking-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  box-sizing: border-box;
  width: max-content;
  min-width: 15rem;
  max-width: calc(100vw - 24px);
  padding: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
}
.speaking-menu-panel a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.speaking-menu-panel a span { font-size: 0.8rem; font-weight: 400; color: var(--ink-soft); }
.speaking-menu-panel a:hover,
.speaking-menu-panel a:focus-visible { background: color-mix(in srgb, var(--line-brand) 8%, var(--paper-raised)); }
.speaking-menu-panel a:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: -2px; }
.speaking-menu-panel a.active { font-weight: 700; }

/* Interface-language bar on translated pages (2026-11-11,
   templates/partials/ui_language_bar.html). Quiet, above the page body;
   no coloured edge band. */
.ui-language-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.ui-language-notice { margin: 0; }
.ui-language-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.ui-language-choices { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.ui-language-switcher button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: var(--space-1);
  text-decoration: underline;
  cursor: pointer;
}
.ui-language-current { padding: var(--space-1); font-weight: 600; color: var(--ink); }

/* The same switcher in the account menu (2026-11-12): a labelled 2x2 grid
   of languages, aligned with the menu's own items. */
.account-menu-language { margin-top: 0.2rem; padding: 0.35rem 0.3rem 0.4rem; border-top: 1px solid var(--border); }
.account-menu-language-label { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.2rem; padding: 0 0.4rem; font-size: 0.8rem; color: var(--ink-soft); }
.account-menu-language-label svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.account-menu-language .ui-language-bar { margin: 0; display: block; }
.account-menu-panel .account-menu-language form { border-top: 0; padding-top: 0; }
.account-menu-language .ui-language-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem; width: 100%; }
.account-menu-panel .account-menu-language .ui-language-switcher button,
.account-menu-language .ui-language-current {
  min-height: var(--control-h-sm);
  padding: 0.35rem 0.4rem;
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.account-menu-language .ui-language-current { display: flex; align-items: center; background: color-mix(in srgb, var(--ink) 7%, transparent); }
/* Signed-out header language picker (2026-11-14, templates/base.html):
   the same plain-text style as "Log in" / .header-info-link, with a globe;
   its panel is the account menu's, holding only the language list. */
.header-language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.header-language-toggle:hover,
.header-language[open] > .header-language-toggle { color: var(--ink); border-color: var(--border-strong); }
.account-menu.header-language[open] > summary { box-shadow: none; }
.header-language-toggle svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; }
.header-language .account-menu-language { margin-top: 0; border-top: 0; }
@media (max-width: 899px) {
  .header-language-current { display: none; }
}
html.header-compact .header-language-current { display: none; }
@media (pointer: coarse) { .header-language-toggle { min-height: var(--control-h); min-width: var(--control-h); justify-content: center; } }

/* Machine-translated legal pages (2026-11-11): the "English version governs" notice. */
.legal-translation-notice {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
}
.legal-translation-notice span[lang="en"] { display: block; margin-top: 0.25rem; color: var(--ink-soft); }

/* Guest demo at /try/ (2026-11-15, pages/demo.py, static/js/try-demo.js).
   Flat and hairline-ruled like the other static pages: no fills behind
   the steps, no coloured edge bands. */
.try-page { max-width: 46rem; }
.try-step { margin-top: var(--space-4); }
.try-step h2 { display: flex; align-items: center; gap: var(--space-1); }
.try-step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); font-size: 0.95rem; flex: none;
}
.try-reading {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-3); font-size: 1.08rem; line-height: 1.7;
}
.try-reading h3 { margin: 0 0 var(--space-2); font-size: 1.2rem; }
.try-reading p { margin: var(--space-2) 0 0; }
.try-reading .try-reading-course { margin: 0 0 var(--space-1); font-size: 0.85rem; color: var(--ink-faint); }
.try-word {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline dotted var(--accent-secondary);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.try-word:hover, .try-word.is-open { background: var(--highlight-blue); }
.try-word.is-saved { text-decoration-style: solid; }
.try-word:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.try-definition {
  position: relative; margin: var(--space-2) 0; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--paper-raised); font-size: 0.98rem; line-height: 1.5;
}
.try-definition-head { margin: 0 2rem var(--space-1) 0; display: flex; gap: var(--space-1); align-items: baseline; flex-wrap: wrap; }
.try-definition-head strong { font-size: 1.1rem; }
.try-pos { font-size: 0.85rem; color: var(--ink-faint); font-style: italic; }
.try-reading .try-definition-row { margin: 0.35rem 0 0; }
.try-definition-label { display: block; font-size: 0.8rem; color: var(--ink-faint); }
.try-definition-close {
  position: absolute; top: 0.25rem; right: 0.25rem; width: 2.5rem; height: 2.5rem;
  border: 0; background: none; color: var(--ink-soft); font-size: 1.4rem; cursor: pointer;
}
.try-button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
  border: 1px solid var(--line-brand); border-radius: var(--radius-sm);
  background: var(--line-brand); color: var(--line-brand-on);
  font: inherit; font-weight: 600; cursor: pointer;
}
.try-button:disabled { opacity: 0.55; cursor: default; }
.try-button-secondary { background: none; border-color: var(--border-strong); color: var(--ink); }
.try-button:focus-visible, .try-definition-close:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.try-save { margin-top: var(--space-2); }
.try-note { display: block; color: var(--ink-soft); }
.try-hint { margin: var(--space-1) 0 0; font-size: 0.9rem; color: var(--ink-faint); }
.try-card {
  margin-top: var(--space-2); padding: var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.try-card-progress { margin: 0 0 var(--space-1); font-size: 0.85rem; color: var(--ink-faint); }
.try-card-front { font-size: 1.08rem; line-height: 1.6; }
.try-card-actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.try-sentence {
  display: block; width: 100%; box-sizing: border-box; margin-top: var(--space-1);
  padding: var(--space-1); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; background: var(--paper); color: var(--ink);
}
.try-use-result { min-height: 1.5em; color: var(--ink-soft); }
.try-cta { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.try-cta-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ----- Notes (accounts/notes.html, 2026-11-15) ---------------------------
   The browser extension's notes, in their own section. List left, the open
   note right; on a phone one or the other (.notes-page--index shows the
   list, --edit/--new the note). */
.notes-page {
  display: grid;
  grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
  gap: var(--space-4);
  max-width: var(--max-width);
  margin: var(--space-2) auto var(--space-5);
  font-family: var(--font-body);
}
.notes-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.notes-list-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -0.015em; }
.notes-count { margin: 2px 0 0; color: var(--ink-faint); font-size: 0.875rem; }
.notes-new-btn {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 2.5rem;
  padding: 0.45em 1.1em;
  border-radius: var(--radius-pill);
  background: var(--line-brand);
  color: var(--line-brand-on);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.notes-new-btn:hover { background: var(--accent-secondary-ink); color: var(--line-brand-on); }
.notes-new-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.notes-new-btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.notes-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.notes-list-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
}
.notes-list-item:hover { border-color: var(--border-strong); }
.notes-list-item.active { border-color: var(--line-brand); box-shadow: inset 0 0 0 1px var(--line-brand); }
.notes-list-item:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.notes-list-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list-preview { color: var(--ink-soft); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list-when { color: var(--ink-faint); font-size: 0.78rem; }
.notes-empty, .notes-placeholder {
  padding: var(--space-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.notes-empty p, .notes-placeholder p { margin: 0; }
.notes-placeholder { display: grid; place-items: center; min-height: 14rem; text-align: center; }
.notes-editor-pane { min-width: 0; }
.notes-back { display: none; margin-bottom: var(--space-2); font-weight: 600; text-decoration: none; }
.notes-editor { display: grid; gap: var(--space-2); }
.notes-title-input,
.notes-text-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
}
.notes-title-input { min-height: var(--control-h); padding: 0 12px; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.notes-text-input {
  field-sizing: content;
  min-height: 22rem;
  max-height: 75vh;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
  white-space: pre-wrap;
}
.notes-title-input:focus, .notes-text-input:focus { border-color: var(--line-brand); outline: 2px solid var(--line-brand); outline-offset: -1px; }
.notes-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.notes-save-btn,
.notes-delete-btn {
  min-height: 2.5rem;
  padding: 0.45em 1.3em;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.notes-save-btn { border: none; background: var(--line-brand); color: var(--line-brand-on); }
.notes-save-btn:hover { background: var(--accent-secondary-ink); }
.notes-delete-btn { border: 1px solid var(--border-strong); background: transparent; color: var(--ink-soft); }
.notes-delete-btn:hover { border-color: var(--line-news); color: var(--line-news-ink); }
.notes-save-btn:focus-visible, .notes-delete-btn:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 2px; }
.notes-cancel { font-weight: 600; text-decoration: none; }
.notes-saved-at { margin-left: auto; color: var(--ink-faint); font-size: 0.82rem; }
.notes-error {
  margin: 0 0 var(--space-2);
  padding: 10px 12px;
  border: 1px solid var(--line-news);
  border-radius: var(--radius-sm);
  color: var(--line-news-ink);
}
.notes-conflict { display: grid; gap: 6px; margin-top: var(--space-3); }
.notes-conflict label { font-weight: 600; }
.notes-conflict .notes-text-input { min-height: 8rem; background: var(--paper); color: var(--ink-soft); }
.notes-sources { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.notes-sources h2 { margin: 0 0 6px; font-size: 0.9rem; color: var(--ink-soft); }
.notes-sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.notes-sources a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  text-decoration: none;
}
@media (max-width: 760px) {
  .notes-page { grid-template-columns: minmax(0, 1fr); padding: 0 var(--space-2); }
  .notes-page--index .notes-editor-pane { display: none; }
  .notes-page--edit .notes-list-pane,
  .notes-page--new .notes-list-pane { display: none; }
  .notes-back { display: inline-block; }
  .notes-text-input { min-height: 16rem; }
}

/* ---------------------------------------------------------------------
   Word pages (2026-11-18, words app): /words/, /words/<kind>/<band>/ and
   /words/<word>/. Colours come only from the shared tokens, so dark mode
   follows the :root dark blocks with no overrides of its own. Example
   cards reuse .useful-expression's box (same border/radius/padding).
   --------------------------------------------------------------------- */
.word-page { max-width: 46rem; margin: 0 auto; overflow-wrap: break-word; }
.word-page h1 { margin: 0 0 var(--space-2); }
.word-headword { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.1; }
.word-intro { color: var(--ink-soft); margin: 0 0 var(--space-3); }
.word-definition { font-size: 1.1rem; margin: 0 0 var(--space-3); }
.word-senses { margin: 0; padding-left: 1.4em; }
.word-senses li + li { margin-top: 0.35em; }
.word-pos { font-style: italic; color: var(--ink-faint); margin-right: 0.25em; }
.word-usage-note { margin: var(--space-2) 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.word-section { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.word-section h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 var(--space-3); }
.word-forms, .word-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}
.word-forms li, .word-links a {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25em 0.8em;
  text-decoration: none;
}
.word-links a { min-height: 32px; transition: border-color 0.15s ease, color 0.15s ease; }
.word-links a:hover { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.word-examples { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.word-example {
  background: var(--paper-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.word-example-sentence { margin: 0 0 var(--space-1); font-size: 1.05rem; line-height: 1.55; color: var(--ink); }
.word-example-sentence mark {
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent-secondary);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}
.word-example-source { flex-wrap: wrap; margin: 0 0 var(--space-1); }
.word-example-source cite { font-style: normal; font-weight: 600; color: var(--ink-soft); text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
.word-example-link { font-size: 0.85rem; font-weight: 600; color: var(--accent-secondary-ink); text-decoration: none; }
.word-example-link:hover { text-decoration: underline; }
.word-band-count { font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; color: var(--ink-faint); white-space: nowrap; }

/* /words/ A-Z (2026-11-20 redesign): the lists are browsed by first
   letter. On /words/ the alphabet is the page -- a grid of 26 letters, each
   with its word count; on a letter page the same letters shrink to a bar
   above an A-Z list in columns. A letter with no words stays in place,
   faded and unlinked, so the alphabet never shifts. */
.word-index { max-width: 60rem; }
.word-index-head, .word-letter-head { max-width: 40rem; margin-bottom: var(--space-4); }
.word-index-head h1, .word-letter-head h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.01em; }
.word-index-head .word-intro, .word-letter-head .word-intro { font-size: 1.05rem; margin: 0; }
.word-letters ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem; }
.word-letters a, .word-letter-none {
  display: grid;
  place-items: center;
  min-width: 2.15rem;
  height: 2.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
}
.word-letters a:hover { background: var(--tool-plate); color: var(--line-brand-ink); }
.word-letters a:focus-visible { outline: 2px solid var(--line-brand); outline-offset: 2px; }
.word-letters a[aria-current="page"] { background: var(--line-brand); color: var(--line-brand-on); }
.word-letter-none { color: var(--ink-faint); opacity: 0.45; }
/* The index's grid version. */
.word-letters-grid ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr)); gap: 0.5rem; }
/* Two even rows of 13 once there's room. */
@media (min-width: 760px) { .word-letters-grid ol { grid-template-columns: repeat(13, 1fr); } }
.word-letters-grid a, .word-letters-grid .word-letter-none {
  height: auto;
  aspect-ratio: 1;
  align-content: center;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-raised);
}
.word-letters-grid .word-letter { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; line-height: 1; }
.word-letter-count { font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.word-letters-grid a:hover { border-color: var(--line-brand); background: var(--tool-plate); }
.word-letters-grid a:hover .word-letter-count { color: var(--line-brand-ink); }
.word-letters-grid .word-letter-none { border-style: dashed; background: none; }
.word-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--line-brand-ink);
  background: color-mix(in srgb, var(--line-brand) 11%, transparent);
  border-radius: var(--radius-pill);
  padding: 0 0.55em;
  vertical-align: 0.1em;
}
.word-legend { margin: var(--space-3) 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.word-az { list-style: none; margin: var(--space-4) 0 0; padding: 0; columns: 9rem auto; column-gap: 1.5rem; }
.word-az li { break-inside: avoid; padding: 0.28rem 0; }
.word-az a { color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.word-az a:hover { color: var(--line-brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.word-index .word-credits { max-width: 40rem; margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.word-example-save {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.35em 0.9em;
  margin-top: var(--space-1);
  min-height: 36px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.word-example-save:hover:not(:disabled) { border-color: var(--accent-secondary); color: var(--accent-secondary-ink); }
.word-example-save:disabled { cursor: default; opacity: 0.75; }
.word-save-signin { margin: var(--space-2) 0 0; font-size: 0.85rem; }
.word-save-signin a { font-weight: 600; color: var(--accent-secondary-ink); text-decoration: none; }
.word-save-signin a:hover { text-decoration: underline; }
.word-save-error { font-size: 0.8rem; color: var(--line-news-ink); margin: 0.4em 0 0; }
.word-credits { margin-top: var(--space-4); font-size: 0.8rem; color: var(--ink-faint); }
