/* ── Font faces ──────────────────────────────────────────────────────
   The @font-face rules for Adriane Text, NeueHaasDisplayBold and
   NeueMontreal Regular + Medium live in app.css (2026-11-17), pointing at
   copies of the same files in app/fonts. The build gives each a
   content-hashed /static/ address with a one-year immutable cache;
   /assets/fonts/* is served with a 60-second cache the app cannot change.
   The family names below are unchanged. */


/* ════════════════════════════════════════════════════════════════════
   ONE AUTHORITATIVE TOKEN LAYER

   This single :root replaces the two competing :root blocks that used to
   live here (a base block plus a later "Stencil Tweaks" override block).
   Every token below is seeded with the exact value the app rendered
   before consolidation — the winning value of whichever block previously
   set it last — so this pass is visually identical.

   It is organised as:
     1. Brand Kit role layer  — the canonical semantic source (colour +
        typography roles) a future global Brand Kit will drive.
     2. Derived app tokens    — shadcn tokens, surface/border/text
        hierarchy, shelf, progress — mapped to the role layer wherever a
        value matches a role exactly, and left literal otherwise.
   ════════════════════════════════════════════════════════════════════ */
:root {
  /* ── 1a. Brand Kit colour roles (canonical source) ─────────────────
     Seven semantic colour roles seeded with BOSM's current effective
     colours. These are the single source of truth; the app tokens below
     reference them. Changing one of these later is what a global Brand
     Kit will do — nothing consumes a raw hex for these roles anymore. */
  --color-signature-dark: #111A2B;    /* Midnight Ink */
  --color-supporting-navy: #1C2436;   /* Museum Navy */
  --color-canvas: #FAFAFA;            /* White Alt */
  --color-editorial-paper: #F2F0EC;   /* Book Paper */
  --color-structure: #C7C3BE;         /* Silver */
  --color-quiet-accent: #92A3BE;      /* Archive Blue */
  --color-annotation: #8B1111;        /* Red Pen */
  --color-mobile-ink: #101820;        /* Mobile Ink Surface — quiet near-black mobile surface (Pantone Black 6C) */

  /* ── 1b. Typography roles (canonical source) ───────────────────────
     Five semantic type roles. --font-ui carries the functional interface
     face already in use; the reading/editorial roles name faces that are
     loaded; accent/signature name their intended faces for the future
     with graceful fallbacks and are NOT applied to any route in this pass. */
  --font-ui: 'NeueMontreal Regular', sans-serif;          /* functional interface */
  --font-reading: 'Newsreader', Georgia, serif;           /* long-form reading */
  --font-editorial: 'Adriane Text', Georgia, serif;       /* editorial entry */
  --font-accent: 'Diethelm', 'Adriane Text', Georgia, serif;   /* rare expressive accent */
  --font-signature: 'Inkpen Scribble', 'Bradley Hand', cursive; /* signature / annotation */

  /* ── 2. Typography ─────────────────────────────────────────────────
     Effective values unchanged. Display stays the Haas grotesk cut used
     for headings; sans (body/UI) derives from the --font-ui role. */
  --font-display: 'NeueHaasDisplayBold', sans-serif;
  --font-sans: var(--font-ui);
  --font-mono: ui-monospace, SFMono-Regular, monospace;

  /* ── Brand Kit editorial type (creator-assignable) ─────────────────
     Three student-facing editorial roles a creator can point at an uploaded
     Font Library face (Display / Editorial body / Accent). Each falls back to a
     BOSM default here, so an unassigned role renders exactly as before; a
     student page emits a scoped override for an assigned role only (see the
     BrandTypography component + brand-typography.ts resolver). Consumed ONLY by
     editorial content on student surfaces — never navigation, controls,
     metadata, timestamps, or any permanent interface type. */
  --font-brand-display: var(--font-display);
  --font-brand-editorial: var(--font-sans);
  --font-brand-accent: var(--font-sans);
  --font-weight-display: 700;
  --line-height-display: 1.1;
  --tracking-display: -0.01em;
  --font-weight-body: 400;
  --line-height-body: 1.7;
  --tracking-body: 0em;
  --font-weight-mono: 400;

  /* ── student display type scale ─────────────────────────────────────
     Named, rem-based font-size steps for the one-off display/heading
     sizes used across the public/student surfaces (Dashboard, Library,
     Video, Notes, Motivations). Each step is exactly the size the surface
     already rendered at — this scale centralises those sizes as shared
     Tailwind utilities (`text-student-*`, mapped below in app.css) instead
     of each component inlining its own `text-[Nrem]` arbitrary value.
     Named by the rem value with its decimal point removed, so a step's
     class name is traceable straight back to its value (1.375rem ->
     student-1375). Never repurpose a step to a different size — add a
     new one instead, so every consumer keeps its exact current scale. */
  --text-student-102: 1.02rem;
  --text-student-10625: 1.0625rem;
  --text-student-110: 1.1rem;
  --text-student-115: 1.15rem;
  --text-student-120: 1.2rem;
  --text-student-125: 1.25rem;
  --text-student-130: 1.3rem;
  --text-student-135: 1.35rem;
  --text-student-1375: 1.375rem;
  --text-student-140: 1.4rem;
  --text-student-150: 1.5rem;
  --text-student-155: 1.55rem;
  --text-student-160: 1.6rem;
  --text-student-1625: 1.625rem;
  --text-student-170: 1.7rem;
  --text-student-175: 1.75rem;
  --text-student-180: 1.8rem;
  --text-student-1875: 1.875rem;
  --text-student-190: 1.9rem;
  --text-student-200: 2rem;
  --text-student-205: 2.05rem;
  --text-student-210: 2.1rem;
  --text-student-225: 2.25rem;
  --text-student-235: 2.35rem;
  --text-student-240: 2.4rem;
  --text-student-250: 2.5rem;
  --text-student-260: 2.6rem;
  --text-student-275: 2.75rem;
  --text-student-290: 2.9rem;
  --text-student-300: 3rem;
  --text-student-305: 3.05rem;
  --text-student-320: 3.2rem;
  --text-student-350: 3.5rem;

  /* ── shadcn base tokens ────────────────────────────────────── */
  --background: var(--color-canvas);   /* #FAFAFA — off-white editorial canvas */
  --foreground: #101820;               /* Pantone Black 6C — all typography */
  --card: #FFFFFF;
  --card-foreground: #101820;
  --popover: #FFFFFF;
  --popover-foreground: #101820;
  --primary: #172E50;                  /* Dark Navy — buttons & accents */
  --primary-foreground: #FFFFFF;
  --secondary: #ECEAE4;                /* soft neutral surface */
  --secondary-foreground: #101820;
  --muted: #ECEAE4;
  --muted-foreground: var(--color-supporting-navy);   /* #1C2436 */
  --accent: color-mix(in srgb, var(--foreground) 4%, var(--background));
  --accent-foreground: var(--foreground);
  --destructive: var(--color-signature-dark);         /* #111A2B */
  --destructive-foreground: #FFFFFF;
  --border: #E3E1DB;                   /* off-white border */
  --input: #E3E1DB;
  --ring: color-mix(in srgb, var(--primary) 45%, var(--background));
  --success: #4F7A5B;                  /* muted green for completed states */
  --success-on-dark: #7FB08A;          /* the same green lifted for small text on the dark student surfaces (Verified, Active, Completed) */
  --warning: oklch(0.769 0.154 71.29);

  /* ── sidebar ───────────────────────────────────────────────── */
  --sidebar: #ECEAE4;
  --sidebar-foreground: #101820;
  --sidebar-primary: var(--color-signature-dark);     /* #111A2B */
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: color-mix(in srgb, var(--foreground) 6%, var(--background));
  --sidebar-accent-foreground: var(--foreground);
  --sidebar-border: color-mix(in srgb, var(--foreground) 10%, var(--background));
  --sidebar-ring: color-mix(in srgb, var(--primary) 50%, var(--background));

  /* ── surface hierarchy ─────────────────────────────────────── */
  --background-secondary: #ECEAE4;     /* slightly deeper neutral surface */
  --surface-hover: color-mix(in srgb, var(--foreground) 5%, var(--background));
  --surface-active: color-mix(in srgb, var(--foreground) 8%, var(--background));
  --surface-elevated: var(--card);
  --ink-light: #3A434D;                /* lighter ink for subtext */

  /* ── border hierarchy ──────────────────────────────────────── */
  --border-subtle: color-mix(in srgb, var(--foreground) 6%, var(--background));
  --border-muted: color-mix(in srgb, var(--foreground) 9%, var(--background));
  --border-strong: color-mix(in srgb, var(--foreground) 22%, var(--background));

  /* ── text hierarchy ────────────────────────────────────────── */
  --foreground-secondary: #3A434D;

  /* ── primary depth ─────────────────────────────────────────── */
  --primary-hover: var(--color-quiet-accent);         /* #92A3BE */
  --primary-muted: color-mix(in srgb, var(--primary) 20%, var(--background));
  --primary-soft: color-mix(in srgb, var(--primary) 12%, var(--background));
  --primary-tint: color-mix(in srgb, var(--primary) 6%, var(--background));

  /* ── focus & error ─────────────────────────────────────────── */
  --focus-ring: color-mix(in srgb, var(--primary) 40%, transparent);
  --error: oklch(0.577 0.245 27.325);
  --error-foreground: oklch(0.985 0 0);

  /* ── radius ────────────────────────────────────────────────── */
  --radius: 0.25rem;
  --radius-none: 0rem;
  --radius-sm: 0.125rem;
  --radius-lg: 0.375rem;
  --radius-xl: 0.5rem;
  --radius-full: 9999px;

  /* ── shadows ───────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(33, 28, 26, 0.04), 0 2px 8px rgba(33, 28, 26, 0.05);
  --shadow-md: 0 4px 16px rgba(33, 28, 26, 0.07);
  --shadow-lg: 0 12px 40px rgba(33, 28, 26, 0.12);

  /* ── motion ────────────────────────────────────────────────── */
  --duration-fast: 100ms;
  --duration-normal: 250ms;
  --duration-slow: 450ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);

  /* ── spacing ───────────────────────────────────────────────── */
  --spacing-base: 0.2rem;

  /* ── Mobile support-icon clearance (one shared constant) ───────
     The in-app support launcher is a fixed 56x56px control pinned to
     the bottom-left (16px left/bottom offsets, each plus the device
     safe-area inset). Its painted footprint therefore reaches
     16 + 56 = 72px above the safe-area bottom. This one constant is
     the total clear zone measured from the TRUE screen bottom: 84px
     (72px footprint + a 12px breathing margin) PLUS the bottom safe
     area counted EXACTLY ONCE here. Below-md layouts that collide with
     the launcher (bottom-nav inner rows, bottom page padding, anchored
     bottom strips) pad by this value instead of re-deriving it or
     adding env(safe-area-inset-bottom) a second time. */
  --support-clearance: calc(84px + env(safe-area-inset-bottom));

  /* ── Mobile bottom nav — stable minimum bottom inset (one shared
     constant) ────────────────────────────────────────────────────
     The shared student bottom nav (BottomNav in
     app/components/library/nav.tsx) pads its inner row by
     env(safe-area-inset-bottom) alone, so on a device or preview frame
     that reports zero for that inset the row's bottom padding collapses
     to zero and its controls + active indicator land flush on the true
     viewport edge. This is the stable floor for that padding — the nav
     takes max(env(safe-area-inset-bottom), this value), so a real,
     nonzero inset (home indicator / gesture bar) is never shrunk, and a
     zero reading still gets genuine breathing room. Matches the 12px
     breathing margin already used above for --support-clearance and
     below for --support-bubble-dock-reserve. Every mobile-only content
     clearance that pads above this nav (library/motivations/notes/video
     page wrappers, Dashboard's) adds this same constant on top of
     --support-clearance so the taller bar never covers the last item of
     scrollable content. */
  --bottom-nav-min-inset: 12px;

  /* ── Mobile nav dock — support-bubble RIGHT footprint (scoped) ─────
     The shared student bottom nav (BottomNav in
     app/components/library/nav.tsx) reserves passive space on its right,
     below 768px only, so the fixed support launcher (Setup: position
     Bottom right, Hide on phones off — a 56x56px control offset 16px from
     the right/bottom edges, each plus the device safe-area inset) never
     overlaps a nav item or label. This constant is scoped to that one dock
     only — it supersedes the --support-clearance vertical lift for this
     component; --support-clearance itself is unchanged and still governs
     every other surface. 56px footprint + 16px edge offset + a 12px
     breathing margin, plus the right safe-area inset counted exactly once
     here. */
  --support-bubble-dock-reserve: calc(56px + 16px + 12px + env(safe-area-inset-right));

  /* ── 3D Shelf (Testing) — restrained dark BOSM book tones ──────
     One editorial collection. Consumed exclusively by
     testing-shelf-view.tsx — no other surface references these. */
  --shelf-midnight-ink: var(--color-signature-dark);  /* #111A2B — dominant book tone */
  --shelf-black6:       #101820;  /* Pantone Black 6 C — depth / darker books */
  --shelf-museum-navy:  var(--color-supporting-navy); /* #1C2436 — secondary tonal variation */
  --shelf-chalkboard:   #1A1A1A;  /* neutral dark */
  --shelf-graphite:     #302E30;  /* neutral dark — subtle charcoal variation */
  --shelf-title:        #FAFAFA;  /* White Alt — spine & cover titles */
  --shelf-rule:         #E7E5E2;  /* Soft Gray — fine rules & detail text */
  --shelf-select:       var(--color-quiet-accent);    /* #92A3BE — selection accent only */
  --shelf-annot:        var(--color-quiet-accent);    /* #92A3BE — tiny annotation mark */

  /* ── watch progress (video) ───────────────────────────────────
     The filled portion of every video progress rail is Red Pen; the
     track is a muted neutral tuned per surface. */
  --progress: var(--color-annotation);   /* #8B1111 — Red Pen — filled progress */
  --progress-track: color-mix(in srgb, #101820 12%, transparent);   /* Black 6, low-opacity — light surfaces */
  --progress-track-inverse: color-mix(in srgb, #FAFAFA 16%, transparent); /* White Alt, low-opacity — dark surfaces */

  /* ── App Theme semantic tokens (Batch 0) ──────────────────────────
     An additive naming layer for the app-theme migration. New names
     only — no surface consumes them yet.
     NOTE: five names the source brief also listed here — --accent,
     --border-muted, --border-strong, --focus-ring, --error — are
     deliberately NOT re-declared. Their live values differ from the
     brief's values and they are read app-wide through @theme inline
     (bg-accent, border-border-muted, ring-focus-ring, text-error, …),
     so overriding them would change rendered surfaces well beyond the
     single intended change below. */
  --app-background: #FAFAFA;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;   /* elevated surfaces — separated by shadow, not colour */
  --text-primary: #101820;
  --text-secondary: #4F6D91;
  --brand-primary: #172E50;
  --brand-primary-foreground: #FFFFFF;
  --brand-primary-hover: color-mix(in srgb, #172E50, white 10%);
  --brand-primary-soft: color-mix(in srgb, #172E50, white 85%);

  /* Danger — four roles, one hue */
  --danger-fill: #8B1111;              /* button / badge fill */
  --danger-foreground: #FFFFFF;        /* text on --danger-fill */
  --danger-text-on-light: #8B1111;     /* inline danger text on light surfaces */
  --danger-border-on-light: #8B1111;   /* field borders on light surfaces */
  --danger-soft: color-mix(in srgb, #8B1111, white 90%);

  /* INTENTIONAL — the one visible change this batch makes: Button
     variant="destructive" moves from dark navy (#111A2B) to Red Pen. */
  --destructive: var(--danger-fill);
  --destructive-foreground: var(--danger-foreground);

  /* ── Creator Studio rail — named BOSM aliases (Batch 1) ────────────
     The Studio sidebar is a deliberately dark, non-toggling surface: it
     never reads --app-background/--surface/--text-primary/--text-secondary
     (those follow the future App Theme) and never reads --sidebar-*
     (that's shadcn's own light-mode sidebar token set, unrelated) or
     --bosm-* (the Student Dashboard's separate light/dark toggle). These
     names are declared once, unconditionally, so the rail is stable no
     matter what either of those systems later does. Every value below is
     the exact hex the component already rendered — one alias per unique
     value, seeded for pixel-identical output. Values that already have a
     canonical Brand Kit role reference that role instead of repeating
     the literal. */
  --studio-rail-bg: #101820;                              /* Pantone Black 6C — rail field */
  --studio-rail-active: var(--color-supporting-navy);     /* #1C2436 Museum Navy — active nav panel */
  --studio-rail-accent: var(--color-annotation);          /* #8B1111 Red Pen — active edge + CTA fill */
  --studio-rail-accent-hover: #A11515;                    /* Red Pen hover state */
  --studio-rail-text-strong: var(--color-canvas);         /* #FAFAFA White Alt — primary rail text */
  --studio-rail-text-secondary: #C6CFD9;                  /* row values, link text */
  --studio-rail-text-tertiary: #8A98A8;                   /* creator role, default labels, icons */
  --studio-rail-text-muted: #6E7E90;                      /* brand subhead, uppercase row labels */
  --studio-rail-text-quiet: #7C8A99;                      /* helper notes under fields */
  --studio-rail-text-inactive: #9FADBC;                   /* inactive nav label/icon */
  --studio-rail-text-hover: #E7ECF1;                      /* inactive nav hover text */
  --studio-rail-link-text: #DDE4EC;                       /* hosted-link row text */
  --studio-rail-divider: var(--color-structure);          /* #C7C3BE Silver — identity block rule */
  --studio-rail-focus-ring: #A9D7F5;                      /* Post-it Sky — keyboard focus on dark */
  --studio-rail-success: #7FB08A;                         /* hosted status dot/text, copy confirmation */
  --studio-rail-warning-border: #C9A24B;                  /* display-only domain badge border */
  --studio-rail-warning-text: #DABF7C;                    /* display-only domain badge text */
  --studio-rail-error-text: #E39B9B;                      /* inline validation message */
  --studio-rail-error-border: #C86B6B;                    /* invalid input border */
  --studio-rail-popover-bg: #141C27;                      /* app-link popover surface */
  --studio-rail-input-bg: #0B121A;                        /* popover field/link chip fill */
  --studio-rail-placeholder: #54636F;                     /* input placeholder text */

  /* ── Studio canvas implementation tokens (extended Batch 0) ────────
     Fixed implementation aliases for the Creator Studio canvas migration
     — NOT creator-facing App Theme roles and never editable by the Visual
     System control. Declared once here, unconditionally, exactly like the
     Studio rail block above: they are stable across light/dark by design,
     so they are not duplicated into the [data-bosm-theme] blocks (a dark
     pass, if ever needed, is deferred). Every value is the exact literal it
     replaces — zero rendered change until a consumer references it.

     Audit note: the five canonical brand roles the migration also targets
     (--color-signature-dark, --color-supporting-navy, --color-editorial-
     paper, --color-quiet-accent, --color-structure) already exist above at
     these exact values and are reused as-is — not redeclared here. And
     --foreground-secondary already exists AND is mapped through @theme
     inline (text-foreground-secondary, app-wide), so it is NOT overridden:
     the Studio migration uses the --studio-foreground-secondary alias below
     at the identical value instead. */

  /* Fixed brand alias — same hex as --color-signature-dark, distinct role:
     dark panel / pill / background fill (vs. signature ink for text). */
  --color-signature-dark-surface: #111A2B;

  /* Structural roles */
  --border-hairline: #E7E5E2;              /* dominant Studio divider — distinct from --border (#E3E1DB) */
  --focus-ring-info: #8FBFE0;              /* info / light-blue focus accent */
  --brand-primary-pressed: #24406B;        /* pressed / deeply active brand state */
  --danger-fill-hover: #6E0D0D;            /* danger button hover fill */

  /* Studio-scoped secondary text — alias of the collided app-wide
     --foreground-secondary, kept at the identical value so the Studio
     migration never couples to (or overrides) the shared token. */
  --studio-foreground-secondary: #3A434D;

  /* Text ladder — fixed aliases at exact current values; consolidation and
     dark-mode values deferred to a dedicated pass. */
  --text-meta: #5E6772;                    /* metadata, timestamps, supporting copy */
  --text-subdued: #7C8794;                 /* quieter metadata, secondary icon labels */
  --text-muted: #9AA5B1;                   /* most muted readable copy */
  --text-mid: #5C6B7A;                     /* mid-level helper text */
  --text-deep: #3C556B;                    /* deeper supporting copy */
  --text-dense: #566476;                   /* dense metadata in tight contexts */

  /* ── Creator Studio Theme roles (creator-editable) ─────────────────
     The eleven semantic roles the Brand Kit → Visual System "Creator
     Studio Theme" control drives. These are DELIBERATELY brand-new names:
     nothing outside the Studio canvas reads them, so overriding them
     per-creator (on the StudioThemeScope wrapper, never at :root) can
     never reach student, storefront or shadcn-global surfaces — every
     collision the audit flagged (--danger-fill → --destructive app-wide,
     --focus-ring / --border-strong exposed through utilities, the tokens
     redeclared in [data-bosm-theme]) is sidestepped by not reusing those
     names. Each default resolves to the EXACT value the Studio canvas
     renders today — several reference an existing role/token so no new
     literal is invented — making a surface's adoption pixel-identical
     until a creator saves a theme, and reset-to-default a no-op. The dark
     Studio rail and --color-signature-dark sidebar are intentionally NOT
     among these roles and stay fixed regardless of any saved theme. */
  --studio-role-page-background: var(--app-background);       /* #FAFAFA — canvas */
  --studio-role-surface: var(--surface);                      /* #FFFFFF — cards/pills */
  --studio-role-text-primary: var(--color-signature-dark);    /* #111A2B — actual canvas ink */
  --studio-role-text-secondary: var(--text-secondary);        /* #4F6D91 — supporting copy */
  --studio-role-divider: var(--border-hairline);              /* #E7E5E2 — dominant divider */
  --studio-role-border-strong: var(--border-strong);          /* ~22% ink — emphasised border */
  --studio-role-action-fill: var(--brand-primary);            /* #172E50 — primary action */
  --studio-role-action-text: var(--brand-primary-foreground); /* #FFFFFF — text on action */
  --studio-role-destructive-fill: var(--danger-fill);         /* #8B1111 — destructive action */
  --studio-role-destructive-text: var(--danger-foreground);   /* #FFFFFF — text on destructive */
  --studio-role-focus-ring: var(--focus-ring);                /* primary @ 40% — focus ring */
}

/* ── BOSM Dashboard theme tokens ───────────────────────────────────
   Semantic colours for the Student Dashboard's light/dark toggle. These
   now DERIVE from the canonical role layer above rather than defining a
   competing palette: solid values reference the roles directly, and the
   ink/structure/canvas tints are expressed as color-mix over the same
   roles (spec-identical to the rgba() values they replace). Values that
   have no matching role (Alice Blue, Post-it Sky, Pantone Black 6C, pure
   white/black gradient stops) stay literal. Light is the default; dark
   is a charcoal-black editorial treatment. Only Dashboard components
   read these tokens, so every other surface is unaffected. */
:root,
[data-bosm-theme="light"] {
  --bosm-canvas: var(--color-canvas);             /* #FAFAFA — page canvas */
  --bosm-surface: var(--color-canvas);            /* #FAFAFA — the "white" panel field */
  --bosm-tile: #FFFFFF;                            /* Dashboard bento tile — true white on the #FAFAFA canvas */
  --bosm-card-1: #F0F8FF;                          /* Alice Blue utility card */
  --bosm-card-2: var(--color-canvas);             /* #FAFAFA — White Alt utility card */
  --bosm-card-3: var(--color-editorial-paper);    /* #F2F0EC — Book Paper utility card */
  --bosm-ink: var(--color-signature-dark);        /* #111A2B — Midnight Ink — primary text */
  --bosm-ink-2: color-mix(in srgb, var(--color-signature-dark) 74%, transparent); /* secondary text */
  --bosm-label: color-mix(in srgb, var(--color-signature-dark) 80%, transparent); /* metric / eyebrow labels */
  --bosm-muted: color-mix(in srgb, var(--color-signature-dark) 62%, transparent); /* quiet inline copy */
  --bosm-pending: color-mix(in srgb, var(--color-signature-dark) 60%, transparent); /* fine print / pending */
  --bosm-border: var(--color-structure);          /* #C7C3BE — Silver — rules & panel borders */
  --bosm-divider: color-mix(in srgb, var(--color-signature-dark) 8%, transparent); /* light row dividers */
  --bosm-hover: color-mix(in srgb, var(--color-signature-dark) 3%, transparent);   /* faint hover wash */
  --bosm-hover-strong: color-mix(in srgb, var(--color-signature-dark) 6%, transparent); /* icon-button hover */
  --bosm-scroll: color-mix(in srgb, var(--color-signature-dark) 22%, transparent);  /* internal scrollbar thumb */
  --bosm-accent: var(--color-quiet-accent);       /* #92A3BE — Archive Blue — quiet accent, unchanged */
  /* Resume progress-bar fill only — Archive Blue measured ~1.8:1 against its
     track over light-toned covers (fails the 3:1 non-text contrast minimum).
     Uses the already-declared darker #4F6D91 (--text-secondary) rather than a
     new hex; scoped to this one control so --bosm-accent itself is untouched. */
  --bosm-resume-fill: var(--text-secondary);      /* #4F6D91 — legible resume-bar fill (light) */
  --bosm-nav-bg: color-mix(in srgb, var(--color-canvas) 85%, transparent);
  --bosm-nav-border: color-mix(in srgb, var(--color-signature-dark) 8%, transparent);

  /* ── depth / hero / CTA (light = current appearance, unchanged) ── */
  --bosm-page: var(--color-canvas);               /* #FAFAFA — deepest page fill — solid in light */
  --bosm-frame: var(--color-canvas);              /* #FAFAFA — student page/body frame (light) */
  --bosm-hero: var(--color-signature-dark);       /* #111A2B — hero card — solid Midnight Ink in light */
  --bosm-elevated: var(--color-editorial-paper);  /* #F2F0EC — elevated/selected wash (light) */
  --bosm-cta: #FFFFFF;                             /* hero CTA fill — white in light */
  --bosm-cta-ink: var(--color-signature-dark);    /* #111A2B — hero CTA text */
}

[data-bosm-theme="dark"] {
  --bosm-canvas: #101820;                          /* Pantone Black 6C — near-black canvas */
  --bosm-surface: var(--color-signature-dark);    /* #111A2B — Midnight Ink — primary card field */
  --bosm-tile: var(--color-signature-dark);       /* Dashboard bento tile — Midnight Ink in dark (never white) */
  --bosm-card-1: var(--color-signature-dark);     /* #111A2B — standard card */
  --bosm-card-2: var(--color-signature-dark);     /* #111A2B */
  --bosm-card-3: var(--color-signature-dark);     /* #111A2B — charcoal-black first */
  --bosm-ink: var(--color-canvas);                /* #FAFAFA — White Alt — primary text */
  --bosm-ink-2: var(--color-editorial-paper);     /* #F2F0EC — Book Paper — secondary text */
  --bosm-label: var(--color-editorial-paper);     /* #F2F0EC — Book Paper — labels (crisp, not blue) */
  --bosm-muted: var(--color-quiet-accent);        /* #92A3BE — Archive Blue — muted text */
  --bosm-pending: var(--color-quiet-accent);      /* #92A3BE — Archive Blue — fine print / pending */
  --bosm-border: color-mix(in srgb, var(--color-structure) 18%, transparent); /* Silver at low opacity */
  --bosm-divider: color-mix(in srgb, var(--color-structure) 14%, transparent); /* Silver at low opacity */
  --bosm-hover: color-mix(in srgb, var(--color-canvas) 5%, transparent);
  --bosm-hover-strong: color-mix(in srgb, var(--color-canvas) 9%, transparent);
  --bosm-scroll: color-mix(in srgb, var(--color-canvas) 22%, transparent);
  --bosm-accent: #A9D7F5;                          /* Post-it Sky — dark-mode accent/focus */
  --bosm-resume-fill: var(--bosm-accent);          /* dark mode contrast was already fine — unchanged */
  --bosm-nav-bg: rgba(16, 24, 32, 0.85);
  --bosm-nav-border: rgba(255, 255, 255, 0.10);

  /* ── near-black editorial hierarchy (dark) ─────────────────────────────
     Page reads black first, charcoal second, navy third. Gradient stops are
     approved BOSM dark tones only. */
  --bosm-page: radial-gradient(140% 115% at 50% 0%, #101820 0%, #080D13 78%);
  --bosm-frame: #0A0F15;                            /* near-black student page/body frame (dark) — matches Motivations' ambient */
  --bosm-hero: linear-gradient(155deg, var(--color-signature-dark) 0%, #101820 100%);
  --bosm-elevated: var(--color-supporting-navy);  /* #1C2436 — Museum Navy — elevated/selected only */
  --bosm-cta: #A9D7F5;                             /* Post-it Sky — CTA fill */
  --bosm-cta-ink: var(--color-signature-dark);    /* #111A2B — Midnight Ink — CTA text */

  /* ── Mobile student surface system (near-black) ─────────────────────────
     The approved mobile-Dashboard treatment the creator asked to anchor on
     (near-black quiet surface, quiet blue-gray outline, deeper black canvas
     around it), promoted from hardcoded literals to four shared tokens so the
     Video page renders the SAME roles on mobile. The quiet Ink surface and its
     edge/secondary-text track the creator's saved roles (Mobile Ink Surface,
     Archive Blue, Silver) through the student wrapper; the deep canvas is kept
     deliberately distinct from the Ink surface. Consumed only on the mobile
     Dashboard cells and the Video page — never actions, status, or alerts. */
  --bosm-mobile-canvas: #080D13;                                        /* deep canvas behind mobile content — distinct from Mobile Ink */
  --bosm-mobile-ink: var(--color-mobile-ink);                           /* #101820 — quiet near-black surface (metric cells, video surface) */
  --bosm-mobile-edge: color-mix(in srgb, var(--color-quiet-accent) 24%, transparent); /* Archive Blue @24% — quiet blue-gray outline */
  --bosm-mobile-text-secondary: var(--color-structure);                 /* #C7C3BE — Silver — secondary/label text on the ink surface */

  /* ── App Theme semantic tokens — dark context (Batch 0) ───────────
     New names only. The consumed shadcn tokens the source brief also
     listed for the dark context (--border, --border-muted,
     --border-strong, --accent, --focus-ring, --error) are deliberately
     NOT overridden, so dark Dashboard surfaces stay unchanged. */
  --app-background: #111A2B;
  --surface: #1C2436;
  --surface-raised: #1C2436;
  --text-primary: #FAFAFA;
  --text-secondary: #A8B8CC;
  --brand-primary: #3D6899;
  --brand-primary-foreground: #FFFFFF;
  --brand-primary-hover: color-mix(in srgb, #3D6899, white 10%);
  --brand-primary-soft: color-mix(in srgb, #3D6899, white 85%);
  --danger-fill: #8B1111;
  --danger-foreground: #FFFFFF;
  --danger-text-on-dark: #E87070;
  --danger-border-on-dark: #E87070;
  --danger-soft: color-mix(in srgb, #E87070, #111A2B 85%);
  --destructive: var(--danger-fill);
  --destructive-foreground: var(--danger-foreground);

  /* ── Shared token dark layer — the single global student recolor ───────
     The student routes are the ONLY surfaces that ever carry
     data-bosm-theme="dark" (Storefront and Creator Studio never do), so
     overriding the shared shadcn / surface / border / text tokens here
     recolours every student surface that reads them — the Video page, the
     Library content grid, Saved, controls, cards, sheets and popovers — to
     the BOSM dark palette WITHOUT copying any colour into a route. Values
     reuse the canonical brand roles and the already-validated dark --bosm /
     App-Theme values above, so the palette stays one system.

     Surfaces that already ship their own explicit dark treatment (Notes and
     the shared nav via bosm-dark: utilities, the Dashboard via --bosm-*
     tokens and inline var()) set the property directly on the element, which
     out-specifies these variable defaults — so those pages are unchanged and
     only bare-token light surfaces flip. */
  --background: #101820;                 /* Pantone Black 6C — page canvas */
  --foreground: var(--color-canvas);     /* #FAFAFA — primary text */
  --card: var(--color-signature-dark);   /* #111A2B — Midnight Ink — raised panel */
  --card-foreground: var(--color-canvas);
  --popover: #141C27;                    /* slightly elevated popover surface */
  --popover-foreground: var(--color-canvas);
  --primary: #3D6899;                    /* lifted navy — legible on near-black */
  --primary-foreground: #FFFFFF;
  --secondary: var(--color-supporting-navy);   /* #1C2436 — Museum Navy surface */
  --secondary-foreground: var(--color-canvas);
  --muted: var(--color-supporting-navy);       /* #1C2436 */
  --muted-foreground: #A8B8CC;                 /* legible muted copy on dark */
  --accent: color-mix(in srgb, var(--color-canvas) 8%, #101820);
  --accent-foreground: var(--color-canvas);
  --border: color-mix(in srgb, #FFFFFF 14%, transparent);
  --input: color-mix(in srgb, #FFFFFF 18%, transparent);
  --ring: color-mix(in srgb, #A9D7F5 60%, transparent);

  --background-secondary: #0A0F15;       /* deeper offset surface (matches frame) */
  --surface-hover: color-mix(in srgb, #FFFFFF 5%, transparent);
  --surface-active: color-mix(in srgb, #FFFFFF 9%, transparent);
  --surface-elevated: var(--color-supporting-navy);   /* #1C2436 */
  --ink-light: #A8B8CC;

  --foreground-secondary: #A8B8CC;
  --border-subtle: color-mix(in srgb, #FFFFFF 8%, transparent);
  --border-muted: color-mix(in srgb, #FFFFFF 12%, transparent);
  --border-strong: color-mix(in srgb, #FFFFFF 24%, transparent);

  --primary-hover: #4E7CB0;
  --primary-muted: color-mix(in srgb, #3D6899 26%, #101820);
  --primary-soft: color-mix(in srgb, #3D6899 16%, #101820);
  --primary-tint: color-mix(in srgb, #3D6899 10%, #101820);

  --focus-ring: color-mix(in srgb, #A9D7F5 45%, transparent);
}

/* ── Student dark page/body frame ──────────────────────────────────
   The near-black surface behind the scrollable student experiences, set
   on the root element so overscroll (rubber-banding) and any area beyond
   the page never flash the light canvas. Scoped to the data-bosm-theme=
   "dark" attribute, which ONLY the student routes ever set (Dashboard's
   dark mode and Notes) and never Creator Studio — so this frame can never
   leak into the Studio's light shell or flash during a transition to it.
   The attribute is set flash-free before paint on a direct load by the
   head script in root.tsx, and toggled across single-page navigation by
   each owning route (removed on leave), so the frame follows the route. */
:root[data-bosm-theme="dark"] {
  background-color: var(--bosm-frame);
}

/* ── Student UI scope (.bosm-student-ui) ────────────────────────────────
   The opt-in student-surface colour family — the approved near-black mobile
   Dashboard palette, applied at BOTH mobile and desktop across non-Studio
   student UI. It does NOT introduce a second colour store: every alias here
   points at an EXISTING owner (the --color-* brand roles and the --bosm-
   mobile-* surface tokens), so the values stay one system and follow the
   creator's saved palette through the student wrapper exactly as before. This
   block only re-exposes them as a small, stable vocabulary the Library UI
   reads at every width, so a component can drop its ad-hoc light/dark literals
   and read one alias instead. Applied on the Library/Saved wrapper (and thus
   its nav + the preview dialog rendered inside it), never at :root — so the
   Creator Studio light shell and the Storefront are untouched. Semantic
   success/error keep their own tokens and are deliberately NOT aliased here.

   Verified pairs (source brief): #FAFAFA on #101820 = 17.14:1; #A9D7F5 with
   #111A2B text = 11.38:1. */
.bosm-student-ui {
  /* Every alias resolves from an EXISTING owner that the creator's saved Brand
     Kit already feeds through the student wrapper (resolveStudentColorVars sets
     --color-* from brand_kits.visual_system on this same element), so a future
     palette change propagates here automatically. The listed hex is a FALLBACK
     only — it never overrides a saved value. Two owners are fixed in the current
     system and have no editable role yet (reported as gaps, not new hardcodes):
     the deep canvas (--bosm-mobile-canvas, #080D13) and the pale-blue accent
     (--bosm-accent, Post-it Sky #A9D7F5) — this scope reuses those same owners
     rather than minting its own literal, so they follow if either becomes a
     role. accent-ink IS creator-editable: it tracks the Signature Ink role. */
  --bosm-ui-canvas: var(--bosm-mobile-canvas, #080d13);          /* deep canvas — fixed owner */
  --bosm-ui-surface: var(--color-mobile-ink, #101820);           /* Mobile Ink role */
  --bosm-ui-elevated: var(--color-supporting-navy, #1c2436);     /* Museum Navy role */
  --bosm-ui-text: var(--color-canvas, #fafafa);                  /* White Alt role */
  --bosm-ui-text-secondary: var(--color-structure, #c7c3be);     /* Silver role */
  --bosm-ui-muted: var(--color-quiet-accent, #92a3be);           /* Archive Blue role */
  --bosm-ui-accent: var(--bosm-accent, #a9d7f5);                 /* Post-it Sky — fixed owner */
  --bosm-ui-accent-ink: var(--color-signature-dark, #111a2b);    /* Signature Ink role */
  --bosm-ui-border: color-mix(in srgb, var(--color-quiet-accent, #92a3be) 24%, transparent); /* Archive Blue @24% */
}

/* ── Compact student text actions (.bosm-action) ────────────────────────
   The reusable, role-based text-action buttons for the student UI: 12px
   corners (matching the Studio Categories/Create shape), the permanent
   interface font, 14px labels, compact padding, and a 44px minimum target on
   mobile. Four variants — Primary (accent fill / ink text), Secondary (ink
   fill / off-white text + quiet border), Tertiary (plain secondary text), and
   Destructive (the existing accessible red). Includes hover / pressed /
   disabled / loading / focus states. These read the .bosm-student-ui aliases,
   so they only render correctly inside that scope. */
.bosm-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 0.5rem 0.9rem;
  min-height: 40px;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}
@media (max-width: 767px) {
  .bosm-action { min-height: 44px; }
}
.bosm-action:focus-visible {
  box-shadow: 0 0 0 2px var(--bosm-ui-canvas, #080d13),
    0 0 0 4px var(--bosm-ui-accent, #a9d7f5);
}
.bosm-action:disabled,
.bosm-action[aria-disabled="true"],
.bosm-action[data-loading="true"] {
  opacity: 0.5;
  pointer-events: none;
}
.bosm-action[data-loading="true"] { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  .bosm-action { transition: none; }
}

.bosm-action--primary {
  background: var(--bosm-ui-accent-ink, #111a2b);
  color: var(--bosm-ui-text, #fafafa);
  border-color: rgba(255, 255, 255, 0.15);
}
.bosm-action--primary:hover {
  background: color-mix(in srgb, var(--bosm-ui-accent-ink, #111a2b) 88%, white);
}
.bosm-action--primary:active {
  background: color-mix(in srgb, var(--bosm-ui-accent-ink, #111a2b) 82%, black);
  transform: translateY(1px);
}

.bosm-action--secondary {
  background: var(--bosm-ui-surface, #101820);
  color: var(--bosm-ui-text, #fafafa);
  border-color: var(--bosm-ui-border, rgba(146, 163, 190, 0.24));
}
.bosm-action--secondary:hover {
  border-color: var(--bosm-ui-muted, #92a3be);
  background: color-mix(
    in srgb,
    var(--bosm-ui-text, #fafafa) 6%,
    var(--bosm-ui-surface, #101820)
  );
}
.bosm-action--secondary:active { transform: translateY(1px); }

.bosm-action--tertiary {
  background: transparent;
  color: var(--bosm-ui-text-secondary, #c7c3be);
}
.bosm-action--tertiary:hover {
  color: var(--bosm-ui-text, #fafafa);
  background: color-mix(in srgb, var(--bosm-ui-text, #fafafa) 6%, transparent);
}
.bosm-action--tertiary:active { transform: translateY(1px); }

/* Reset password link (Account → Membership, Password card): explicit
   focus-visible outline per spec, instead of the shared accent ring. */
.bosm-action.bosm-reset-password:focus-visible {
  outline: 2px solid #fafafa;
  outline-offset: 2px;
  box-shadow: none;
}

.bosm-action--destructive {
  background: var(--danger-fill, #8b1111);
  color: var(--danger-foreground, #ffffff);
}
.bosm-action--destructive:hover {
  background: color-mix(in srgb, var(--danger-fill, #8b1111) 88%, white);
}
.bosm-action--destructive:active { transform: translateY(1px); }

/* ── Mobile-landscape lesson player ────────────────────────────────
   When a phone is held horizontally (short viewport), keep the 16:9 lesson
   player within the viewport height so its controls stay reachable, letterboxed
   via object-contain (no stretch, no crop). One height-based query, so it never
   touches tablets or laptops — which are taller than 500px — regardless of their
   CSS width. Below-the-fold lesson details/notes remain reachable by scrolling. */
@media (orientation: landscape) and (max-height: 500px) {
  .video-stage-landscape {
    max-height: 82svh;
    max-width: calc(82svh * 16 / 9);
    margin-inline: auto;
  }
}

/* Home screen launch hand-off (routes/home.tsx useStandaloneEnter): while a
   signed-in member's installed-app launch on "/" is being moved to the
   Dashboard, the storefront stays unpainted so it never flashes the Sign In
   scene. Only in standalone / fullscreen display; a browser tab is untouched. */
@media (display-mode: standalone), (display-mode: fullscreen) {
  [data-standalone-enter] {
    visibility: hidden;
  }
}

/* New Upload badge outline pulse (VideoCard, data-card-new-upload): the
   pill's own outline brightens and fades twice over ~2s, then settles to a
   quiet static outline that stays for as long as the pill shows — no loop,
   no permanent halo, no layout shift. A box-shadow ring (not border) so it
   follows the pill's rounded corners without changing its box size; a thin,
   non-blurred ring reads as an outline rather than the old bleeding glow.
   The pill's text, colour, font and dark backing are untouched — only the
   old glint + glow are replaced by this. The lesson preview modal's New
   Upload pill (video-preview-modal.tsx) reuses the same settled ring via
   .bosm-new-upload-outline-static, with no pulse. */
@keyframes bosm-new-upload-outline-pulse {
  0% { box-shadow: 0 0 0 1px rgba(169, 215, 245, 0.2); }
  25% { box-shadow: 0 0 0 1.5px rgba(169, 215, 245, 0.95); }
  50% { box-shadow: 0 0 0 1px rgba(169, 215, 245, 0.2); }
  75% { box-shadow: 0 0 0 1.5px rgba(169, 215, 245, 0.95); }
  100% { box-shadow: 0 0 0 1px rgba(169, 215, 245, 0.55); }
}
.bosm-new-upload-outline-pulse {
  animation: bosm-new-upload-outline-pulse 2s ease-in-out 1 both;
}
.bosm-new-upload-outline-static {
  box-shadow: 0 0 0 1px rgba(169, 215, 245, 0.55);
}
@media (prefers-reduced-motion: reduce) {
  .bosm-new-upload-outline-pulse {
    animation: none;
    box-shadow: 0 0 0 1px rgba(169, 215, 245, 0.55);
  }
}

/* Notify Members bell, video lesson editor only (notify-members.tsx: opener
   + listOpener, gated there on contentType === "video" so the Motivation
   editor's instance of the same hook never gets this class). Hover plays one
   subtle ring-shake and holds still — :hover re-applying the keyframe is what
   makes leave-then-rehover play it again; it never loops while the cursor
   stays, and (hover: hover) keeps a touch tap from ever matching it, so it
   can't fire from keyboard focus either. transform-only, so it never shifts
   the button or its label. */
@keyframes bosm-notify-bell-shake {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-10deg); }
  30% { transform: rotate(8deg); }
  45% { transform: rotate(-6deg); }
  60% { transform: rotate(4deg); }
  75% { transform: rotate(-2deg); }
  90% { transform: rotate(1deg); }
}
@media (hover: hover) {
  .bosm-notify-bell:hover .bosm-notify-bell-icon {
    animation: bosm-notify-bell-shake 0.5s ease-in-out 1;
    transform-origin: top center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bosm-notify-bell-icon,
  .bosm-notify-bell:hover .bosm-notify-bell-icon {
    animation: none;
  }
}
