/* Latch & Lantern skins: the shared base.
   Everything here applies to every skin: the default token set, the rules that name no skin,
   the swatch glyphs (they key on data-theme-pick, not on the active skin) and the keyframes.
   Each skin's own rules are in theme-<skin>.css, loaded after this file (server/src/lib/html-inject.ts
   puts the member's skin in the page; js/theme.js loads the others when asked). See docs/adding-a-theme.md. */

/* ============================================================
   Latch & Lantern :: THEME ENGINE

   Ported verbatim from reference/dannycaplan-main.html lines 23-373:
   41 custom properties x 5 skins, switched by html[data-theme].
   Nothing outside this file may hard-code a themed colour - app.css and
   login.css consume tokens only, which is what makes a new skin a
   ~90-line block here plus two map entries in js/theme.js.

   Adding a theme (see docs/adding-a-theme.md):
     1. a block here,  2. THEME_GLYPH + THEME_WORDS in js/theme.js,
     3. a swatch in app.html,  4. the whitelist in routes/prefs.ts.
   ============================================================ */
/* ============================================================
   CAPLAN FAMILY :: COMMAND CENTER
   TACTICAL / MILITARY CAMO THEME
   100% self-contained - no external fonts, no external assets
   ============================================================ */

/* ============================================================
   THEME ENGINE
   :root = CAMO (default / base).  html[data-theme="biohazard"],
   "tribal", "onyx" and "steel" redefine the SAME tokens.
   Nothing below this block should hard-code a themed colour.
   ============================================================ */
:root {
    /* -- core palette -- */
    --bg-void: #0c0d0b;
    --bg-panel: #15171a;
    --bg-panel-2: #191c18;
    --bg-panel-raised: #1d201c;
    --toxic: #d9a441;
    --toxic-dim: #8c6b32;
    --hazard: #768a57;
    --danger: #c36962;
    --text: #c9cec4;
    --text-dim: #878e81;
    --line: #3a4139;
    --line-strong: #636a61;   /* >= 3:1 on --bg-panel: input / control borders (tools/contrast-check.js) */

    /* -- browser chrome -- */
    /* Dark by default (camo); the grouped light-skin selector list near the bottom of
       this file flips it to `light` for every light substrate, which is what tells the
       browser to paint native controls (date/time inputs, scrollbars, autofill) dark
       instead of its default light chrome. */
    color-scheme: dark;

    /* -- rgb triplets, for rgba() alpha compositing -- */
    --toxic-rgb: 217,164,65;
    --hazard-rgb: 118,138,87;
    --danger-rgb: 195,105,98;

    /* -- derived surfaces -- */
    --modal-fill: #0e100d;      /* deepest inset / expanded-modal fill */
    --bg-inset: var(--modal-fill);
    --bg-deep: #0a0b09;
    --bg-raised-2: #171a16;
    --bg-shade-a: #131511;
    --bg-shade-b: #121410;
    --bg-tint: #111310;
    --bg-track: #1e211c;
    --scroll-thumb-2: #6b5222;
    --on-accent: #12140f;       /* text drawn ON an accent fill */
    --text-dimmer: #868e81;
    --text-disabled: #565c50;
    --hazard-text: #8f8563;

    /* -- glow intensity: alpha multiplier + blur multiplier -- */
    --glow-k: 1;
    --glow-blur-k: 1;
    --glow-soft: 0 0 calc(9px * var(--glow-blur-k)) rgba(var(--toxic-rgb), calc(.16 * var(--glow-k)));
    --glow-strong: 0 0 calc(30px * var(--glow-blur-k)) rgba(var(--toxic-rgb), calc(.14 * var(--glow-k)));

    /* -- typography -- */
    /* The floor for text a person has to read: nothing on the hub's cards, nav, header or
       settings draws below 12px. Written as max(<the design size>, var(--fs-min)) so a rule
       keeps its own size where that is already bigger. Decorative skin glyphs and the
       frame wall's own type scale (today.css-style .today-* rules) are exempt on purpose.
       Defined once, here, on :root; skins inherit it and never redefine it. */
    --fs-min: .75rem;
    /* The clipping cue (js/overflow-cue.js): how tall the fade is on a card that is cut
       off, and how much of the last line still shows at its very edge (0 = gone). It is a
       mask, so it takes the card's own background on every skin; there is no colour here. */
    --clip-fade-h: 2.5rem;
    --clip-fade-floor: .08;
    /* The scrim and ink for a caption laid over a photograph (a photograph is any colour,
       so this is a fixed dark wash on every skin, not the card's own background). */
    --photo-scrim: rgba(8, 10, 12, .8);
    --photo-scrim-ink: #fff;
    /* Settings buttons and selects (css/polish.css "Settings controls"): one height, and the
       depth a button has. A skin that is flat, hard-edged or glowing redefines the four
       --btn-* shadow tokens in the "Settings buttons: depth per skin family" block at the
       foot of this file; every other skin keeps this soft, layered one. */
    --btn-h: 2.25rem;
    --btn-lift: -1px;
    --btn-shadow: 0 1px 2px rgba(var(--shadow-ink-rgb), .22), 0 3px 8px rgba(var(--shadow-ink-rgb), .14);
    --btn-shadow-hover: 0 2px 4px rgba(var(--shadow-ink-rgb), .26), 0 8px 16px rgba(var(--shadow-ink-rgb), .18);
    --btn-shadow-press: inset 0 1px 3px rgba(var(--shadow-ink-rgb), .35);
    --font-stencil: "Black Ops One", "Arial Black", Impact, "Segoe UI", sans-serif;
    --font-mono: "Space Grotesk", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    /* numbers, times, counts, set with tabular figures (polish.css). Camo keeps a
       monospace for them; most soft skins point this at their own body face. */
    --font-data: "JetBrains Mono", Consolas, "Courier New", monospace;

    /* -- decorative recipes -- */
    --hazard-stripe: linear-gradient(180deg, rgba(255,255,255,.05) 0%, rgba(0,0,0,.45) 100%), repeating-linear-gradient(135deg, #55643f 0 6px, #3a4139 6px 12px);
    --toxic-stripe: linear-gradient(180deg, rgba(255,255,255,.05) 0%, rgba(0,0,0,.4) 100%), repeating-linear-gradient(135deg, #8c6b32 0 5px, #3a4139 5px 10px);
    --bg-body-pattern:
        repeating-linear-gradient(115deg, rgba(26,28,22,.55) 0 58px, transparent 58px 146px, rgba(18,20,15,.5) 146px 208px, transparent 208px 336px),
        repeating-linear-gradient(21deg, rgba(21,23,19,.5) 0 88px, transparent 88px 186px, rgba(16,18,16,.55) 186px 258px, transparent 258px 414px),
        repeating-linear-gradient(74deg, rgba(26,28,22,.32) 0 38px, transparent 38px 128px),
        linear-gradient(160deg, #101210 0%, #0c0d0b 55%, #0e100c 100%);
    --bg-sidebar-pattern:
        repeating-linear-gradient(118deg, rgba(30,33,26,.7) 0 34px, transparent 34px 82px, rgba(20,22,17,.65) 82px 118px, transparent 118px 190px),
        repeating-linear-gradient(28deg, rgba(24,27,21,.6) 0 46px, transparent 46px 104px),
        linear-gradient(180deg, #0e100d 0%, #0a0b09 100%);

    /* -- glyph + flavour strings -- */
    --glyph: '▲';
    --label-transmission: 'INCOMING TRANSMISSION';
    --label-active: 'MISSION ACTIVE · AUTHORIZED PERSONNEL ONLY';

    --sidebar-w: 212px;
}

/* ---- shared professional-theme typography + glyph cleanup ----
   --glyph is '' on these skins, so every decorative ::before and
   every JS-filled .theme-glyph would otherwise leave a hole in the
   layout (flex gap, a 2.2rem empty line box, stray word spacing). */

/* softer header rhythm (stencil tracking was 4px).
   `hearts` joins these because it also swaps --font-stencil for a
   normal UI sans - 4px of tracking on Segoe UI is a ransom note.
   It is deliberately NOT in the two ::before / :empty rules above:
   those exist because onyx and steel set --glyph to '', and hearts
   very much has a glyph. */
/* ==== THEME TOKENS END ==== */

/* ============================================================
   OVERLAY TOKENS  (Phase 3)

   The reference app lifted list rows, form panels and drop zones
   with hard-coded rgba(255,255,255,.02) / .015 literals. On the five
   dark skins that reads as a faint highlight; on a LIGHT skin it is a
   grey smear, which is why the reference could never have a pink or
   hearts theme. The 13 literals in app.css are now these two tokens.

     --overlay-1   a lifted surface: list rows, form panels, chips
     --overlay-2   a fainter lift: dashed upload / drop zones

   Five skins repeat the same values - that is deliberate, so the
   Phase 3 commit changed nothing visually. `hearts` is the skin they
   were tokenised FOR: it is the only one that inverts them, and it is
   a two-line change here rather than thirteen edits in app.css.
   ============================================================ */
:root {
    --overlay-1: rgba(255,255,255,.02);
    --overlay-2: rgba(255,255,255,.015);
}

/* ============================================================
   SHAPE + VOICE-OF-CASE TOKENS  (themes overhaul)

   A skin is no longer just a palette: these tokens let one skin be
   cut-corner stencilled camo and another be a round-shouldered
   garden page, without app.css growing a single per-theme rule.

   Declared in their own :root block ON PURPOSE — the theme audit in
   test/family-setup.test.ts walks the FIRST :root block and demands
   every skin redefine every colour token; shape tokens have sane
   inheritable defaults and only the skins that differ set them.

     --card-clip        the card silhouette (camo's cut corner)
     --radius-*         card / modal / control rounding
     --case-heads       uppercase on the hard skins, none on the soft
     --deco-k           corner-bracket intensity (0 hides them)
     --stripe-k         hazard/top-stripe intensity (0 hides them)
     --tracking-*       heading letter-spacing
     --shadow-ink-rgb   what colour "depth" is on a light skin
   ============================================================ */
:root {
    /* Retired to `none`: a clip-path clips the card's own shadow away, so the cut
       corners of the camo family are now PAINTED (app.css, "cut corners without a
       clip-path") and the token stays only so every skin still declares it. */
    --card-clip: none;
    --radius-card: 0;
    --radius-modal: 0;
    --radius-control: 0;
    --case-heads: uppercase;
    --deco-k: 1;
    --stripe-k: 1;
    --tracking-heads: 4px;
    --tracking-h2: 2.5px;
    --shadow-ink-rgb: 0,0,0;
}

/* ---- glyph-less skins: the same ::before / :empty cleanup onyx
   and steel needed, for the two architectural skins (noir draws its venetian
   blind on the empty glyph spans instead: the batch-5 noir section) ---- */

/* ---- light-skin browser chrome ----
   :root pins color-scheme to `dark`; every light skin flips it back so native
   controls (date/time inputs, scrollbars, autofill, the password-reveal icon)
   paint light instead of inheriting camo's dark chrome. */

/* ---- light-skin substrate corrections, generalised ----
   The hearts-only correction list above predates the overhaul; these
   grouped rules extend the same fixes to every light skin, tinted by
   each skin's own --shadow-ink-rgb. (For hearts the group repeats its
   own block with matching values; the group wins by order.) */

/* ---- elevated cards on a light substrate: the edge, gloss, rule and shadow tokens
   app.css declares on .section, retuned for a tinted ink on cream ---- */

/* ---- sentence-case skins: calmer heading weights, like onyx/steel ---- */

/* ---- the frame wall's photo backdrop and glass (2026-10-16, app.css "the default wall") ----
   A second :root block on purpose, outside the skin token set: these are ONE value for
   every skin and are never copied into a skin block. The backdrop is a photo darkened 45 %
   on the server, so the glass and its ink are light-on-dark on EVERY skin, light ones
   included: the photo, not the skin, is the background (as the slideshow's captions are).
   Only the time-of-day tint pair follows the skin (light skins, below).
   tools/contrast-check.js scores --wall-ink and --wall-ink-dim on --wall-glass over the
   worst backdrop (a white photo at 55 %) with either tint on top. */
:root {
    --wall-ink: #f6f3ec;
    --wall-ink-dim: #d6d1c6;
    --wall-glass: rgba(12, 14, 18, 0.52);
    --wall-glass-strong: rgba(12, 14, 18, 0.78);
    --wall-glass-solid: rgba(16, 18, 22, 0.94);
    --wall-glass-line: rgba(255, 255, 255, 0.16);
    --wall-base: #14171c;
    --wall-accent: #f0c46a;
    --wall-accent-rgb: 240, 196, 106;   /* --wall-accent as a triplet, for its own tint (the undo button) */
    --wall-cool: rgba(46, 86, 160, 0.30);
    --wall-warm: rgba(196, 112, 40, 0.26);
}

/* ---- the Frame palette (2026-10-19, frame.palette 'frame', every hub's default) ----
   The frame wall's own designed look, independent of the hub's skin: a deep ink-navy base,
   panels as slightly lighter glass, warm off-white ink, and ONE signature hue per panel,
   used for the cell title, the cell glyph and a 3 px rule along the panel's top — never
   for body text and never as a fill (Next up is the one filled panel). Each member has a
   hue of their own (js/sections/_member-hue.js picks which). A second :root block like
   the wall's above: one value for every skin, never copied into a skin block. app.css
   ("the Frame palette") points the skin's tokens at these inside a frame wall whose view
   says data-palette="frame" — both looks, the photo backdrop and the plain wall.
   tools/contrast-check.js scores every hue and the dim ink as text, at 4.5:1, on the glass
   over the worst backdrop and on the plain wall's panel, at every warmth, and the hero's
   ink on its fill. Retune a hue here, one line, and re-run it. */
:root {
    --fp-base: #0f1424;
    --fp-base-2: #151c30;
    --fp-ink: #f3eee6;
    --fp-ink-dim: #b3ada3;
    --fp-glass: rgba(14, 19, 34, 0.70);
    --fp-glass-strong: rgba(14, 19, 34, 0.84);
    --fp-glass-solid: rgba(17, 23, 40, 1);
    --fp-glass-line: rgba(255, 255, 255, 0.10);
    --fp-panel: rgba(255, 255, 255, 0.06);
    --fp-track: rgba(255, 255, 255, 0.14);
    --fp-cool: rgba(60, 100, 180, 0.18);
    --fp-warm: rgba(200, 120, 50, 0.16);
    --fp-accent: #f2b544;
    --fp-accent-rgb: 242, 181, 68;
    --fp-accent-dim: #a87a2a;
    /* the panels */
    --fp-weather: #f2b544;
    --fp-next: #de6d56;
    --fp-next-ink: #1b1310;
    --fp-feed: #f08cb0;
    --fp-tonight: #f0a066;
    --fp-shopping: #78c894;
    --fp-homework: #ae9ef5;
    --fp-events: #66bbea;
    --fp-question: #52c9c1;
    --fp-around: #8fd19e;
    --fp-allowance: #e3c25a;
    --fp-poll: #8fb4f5;
    --fp-countdown: #f08466;
    --fp-reading: #f294b6;
    --fp-watchlist: #66bbea;
    /* the weather's line icons */
    --fp-wx-sun: #f2b544;
    --fp-wx-cloud: #9fb0c8;
    --fp-wx-rain: #66bbea;
    --fp-wx-snow: #d4e9f7;
    --fp-wx-thunder: #ae9ef5;
    --fp-wx-fog: #a9adb5;
    /* the members, i mod 8 by user id */
    --fp-member-0: #f39276;
    --fp-member-1: #f2b544;
    --fp-member-2: #7ccc94;
    --fp-member-3: #66bbec;
    --fp-member-4: #b2a2f6;
    --fp-member-5: #f294b6;
    --fp-member-6: #56cbc3;
    --fp-member-7: #d9c46a;
}

/* ---- the frame wall's time-of-day tint on light skins ----
   The plain wall (frame.look 'plain') lays the tint over the skin's own light page, so a
   light skin's pair is a pale wash (sky in the morning, peach at dusk), never the dark
   blue / amber that would muddy it; over the photo backdrop the pale pair barely lightens
   the dark wash: contrast-check.js scores the glass ink with this pair as with the :root
   one (it reads this grouped block's --wall-* tokens for each skin it names). */

/* ---- the plain wall's secondary text (2026-10-19) ----
   On the plain look (frame.look 'plain') a frame cell has no fill, so its titles, meta
   lines, bylines and labels sit on the page itself under the time-of-day tint, not on a
   card. app.css re-points --text-dim and --text-dimmer at --wall-text-dim inside that
   view only; the deck keeps its own tokens, which pass on the card gradient. A skin whose
   --text-dim reaches 4.5:1 there keeps it (var(--text-dim)); the others take their
   --text-dim moved toward their --text just far enough (camo, the :root, 28 %; the rest
   9-26 %). tools/contrast-check.js "plain wall" scores it at every warmth on bg-void and
   the body pattern's stops; a new skin gets camo's value until it adds its own line. */
:root { --wall-text-dim: #93998d; }

/* ---- the selected state's words (2026-10-19) ----
   The active sidebar item and the selected Settings tabs are the accent on its own tint
   (rgba(--toxic-rgb, .16) over the sidebar, .10 over the modal fill). On most skins that
   is --toxic itself; where a light skin's accent is too light to read on its own tint it
   is the same hue a step darker. The brand colour (--toxic) is untouched.
   tools/contrast-check.js "selected state" scores it at 4.5:1. */
:root { --selected-ink: var(--toxic); }

/* ============================================================
   STICKY NOTES (2026-10-16): the same four paper colours in every skin, and the ink drawn
   on them — js/sections/notes.js's stripe and the frame wall's fridge note. Not part of a
   skin's token block: a note is paper, whatever the room looks like.
   ============================================================ */
:root {
    --note-yellow: #e0b23a;
    --note-pink: #dd7a9c;
    --note-blue: #5f9ad8;
    --note-green: #68b36c;
    --note-ink: #1b1a16;
}

/* The frame wall sets text straight on the page, so the leaves and the sparkle stay
   on the hub: a frame keeps the skin's colours and drops the scatter. */

/* The banners (billing, lock, the demo) are a translucent tint of the accent; on these
   two skins the page behind them is scattered with leaves and sparkle, so the banner
   host lays the plain page colour down first and no leaf ever sits under a word. */

/* ---- the sidebar ornament: the moon, the leaves, the holly, the disco ball ----
   Painted on .sidebar-ornament, an in-flow spacer between the nav and the footer
   (app.html) that takes only the height the nav leaves over (flex 1 1 0, min-height
   0). When the nav fills the sidebar - an open group, a short window, the phone
   drawer - the spacer is nothing and so is the ornament: it can never sit under a
   word, and it scrolls with the sidebar instead of floating over it. It is a size
   container, so an ornament with less room than it needs is not drawn at all rather
   than drawn cut off. Every other skin hides the spacer (app.css), which leaves
   their sidebar exactly as it was. */
@container (max-height: 108px) {
    .sidebar-ornament::before,
.sidebar-ornament::after { display: none; }
}
@keyframes newyear-sparkle {
    from { opacity: .15; }
    to { opacity: 1; }
}

/* ---------- Settings buttons: depth per skin family ----------
   css/polish.css draws every Settings button with --btn-shadow / --btn-shadow-hover /
   --btn-shadow-press / --btn-lift. The default (:root) is a soft two-layer shadow that reads
   on every light and most dark skins. A skin whose identity is not soft says so here:
     hard offset  the cut-corner and console skins and the diner: a crisp 2px block, no blur
     glow         neon and New Year's: the accent, lit, no drop shadow
     flat         chalkboard, notebook, Wall Street: no shadow at all, the border does the work
   Every ink here is a literal on purpose: this is the one file colour lives in. */
html:not([data-theme]) {
    --btn-lift: -1px;
    --btn-shadow: 0 2px 0 rgba(0, 0, 0, .6);
    --btn-shadow-hover: 0 3px 0 rgba(0, 0, 0, .7);
    --btn-shadow-press: inset 0 2px 0 rgba(0, 0, 0, .45);
}

/* ---- the round-3 and batch-2 skins share these readability floors: nothing under 13px, small text never tight ---- */  /* the open card's flavour line was the accent at .45 alpha, about 3:1 */
/* Widget and Today text the app sizes small: labels and meta lines to 13px, list and body text to 14px, caps tracking to .04em.
   Card text sized inline (font-size: 0.75rem in the style attribute) can only be lifted with !important. */
@media (max-width: 640px) {
}
/* the nine older redesigns (round 3 and batch 2) still faded the Dashboard's last stat row (Projects / Funny videos) into the clip cue: the same short, firm fade as steel and onyx, so every stat row reads in every skin */
/* the sidebar is 212px: the capitals skins keep their nav on one line (tighter tracking, a point smaller) */
/* U+2746 is missing from every font we ship (a tofu box): the drawn snowflake stands in wherever the character would show.
   The sidebar logo, the nav heading and the hub title are the .theme-glyph rules above; these are the Settings theme tile (shown in every skin) and the quote label */
.theme-swatch[data-theme-pick="thanksgiving"] .theme-swatch-glyph { display: inline-block; width: 20px; height: 20px; background: url("skins/thanksgiving-pumpkin.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="christmas"] .theme-swatch-glyph { display: inline-block; width: 18px; height: 22px; background: url("skins/christmas-tree.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="atelier"] .theme-swatch-glyph { display: inline-block; width: 22px; height: 20px; background: url("skins/atelier-picture-light.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="bakery"] .theme-swatch-glyph { display: inline-block; width: 20px; height: 20px; background: url("skins/bakery-swirl.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="notebook"] .theme-swatch-glyph { display: inline-block; width: 20px; height: 20px; background: url("skins/notebook-pencil.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="wallstreet"] .theme-swatch-glyph { display: inline-block; width: 14px; height: 12px; background: url("skins/wallstreet-triangle.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="lagoon"] .theme-swatch-glyph { display: inline-block; width: 22px; height: 18px; background: url("skins/lagoon-shell-coral.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="spring"] .theme-swatch-glyph { display: inline-block; width: 20px; height: 20px; background: url("skins/spring-seedling.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="daisy"] .theme-swatch-glyph { display: inline-block; width: 22px; height: 22px; background: url("skins/daisy-mark.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="tearoom"] .theme-swatch-glyph { display: inline-block; width: 28px; height: 22px; background: url("skins/tearoom-cup.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="dune"] .theme-swatch-glyph { display: inline-block; width: 28px; height: 16px; background: url("skins/dune-sun.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="frost"] .theme-swatch-glyph { display: inline-block; width: 22px; height: 19px; background: url("skins/frost-house.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="bubbles"] .theme-swatch-glyph { display: inline-block; width: 20px; height: 20px; background: url("skins/bubbles-bubble.svg") center / contain no-repeat; }
.theme-swatch[data-theme-pick="winter"] .theme-swatch-glyph { font-size: 0; display: inline-block; width: 20px; height: 20px; background: url("skins/winter-flake.svg") center / contain no-repeat; }
