/* =====================================================================
   SPECTRE — base theme
   Rodinium Technologies

   Sections 1-6 are the shared base every theme builds on: a dark product
   UI whose tokens hold the LCARS palette. The primary accent (the --pp
   family, orange) drives buttons, active states and focus; a set of
   secondary --lc-* colours (gold, peach, tan, lilac, periwinkle, light
   blue, red) gives headings, labels, links and data their own hue.
   Every other theme (themes/*.css) redefines the tokens under its own
   body class and restyles the ornaments.

   Section 8 is the LCARS theme's own construction (frame, elbows, colour
   block menu, heading bars, pill buttons), scoped to body.theme-lcars so
   no other theme inherits those shapes.

   Sections
     1. Tokens
     2. Reset + base elements
     3. Layout: header, top menu, account, rail, drawer, main, footer
     4. Typography helpers (page-head, nav labels, colour classes)
     5. Components: buttons, forms, tables, cards, panels, flash,
        badges, pills, stat bar, pagination
     6. Bridge for hard-coded purple in inline styles
     7. Architecture hooks (off by default) + masthead banner + emblem
     8. LCARS construction (body.theme-lcars)
     9. Light mode (html[data-mode="light"]), for themes that draw both:
        the shared light re-points, LCARS construction in light

   ---------------------------------------------------------------------
   ARCHITECTURE HOOKS
   ---------------------------------------------------------------------
   layouts/app.blade.php carries a few empty, aria-hidden elements that a
   theme can shape into its own structure (frames, elbows, bars, plates,
   rivets...). They hold no content except short decorative readout
   numbers (e.g. "47-2390"), and they are display:none until a theme turns
   them on (section 7). A theme that styles none of them looks exactly as
   it did before they existed. Turn on only what you use, under your body
   class, e.g.  body.theme-x .sp-frame__elbow--top { display: block; ... }

   Header (inside .sp-header__inner, after the menu buttons):
     .sp-header__ornament              a strip for the header (LCARS: the
                                       bottom bar of the top frame)
       .sp-header__seg--1 ... --4      four segments, in this order:
                                       seg--1, seg--2, .sp-header__code,
                                       seg--3, seg--4
       .sp-header__code                readout number

   Masthead (the banner under the header; only rendered when a banner is
   shown, see section 7):
     .sp-masthead__cap--start / --end  blocks before and after the banner
       .sp-masthead__code              readout number (in the start cap)
     .sp-masthead__frame               always visible: the box round the
                                       picture (style it to frame the banner)

   Shell (children of .sp-shell, around the rail and main):
     .sp-frame__elbow--top             first child of .sp-shell
     .sp-frame__bars--top              second child: four .sp-frame__bar
       .sp-frame__bar--1 ... --4       segments (in order)
     .sp-frame__elbow--bottom          after .sp-main
     .sp-frame__bars--bottom           last child: four .sp-frame__bar
     .sp-frame__code                   readout number inside each elbow
     (LCARS turns .sp-shell into a grid for these at 901px and up; see
     section 8. .sp-shell stays display:flex for every other theme, where
     hidden hooks take no space.)

   Rail (inside aside.sp-rail):
     .sp-rail__cap--top                between .sp-rail__head and the nav
     .sp-rail__cap--bottom             after the nav
       .sp-rail__code                  readout number in each cap

   Page head (first child of main.sp-main, above flash messages and the
   page's own <h1 class="page-head">):
     .sp-main__ornament                a strip above the page heading
       .sp-main__code                  readout number (first)
       .sp-main__seg--1 ... --3        three segments (after the code)

   Brand:
     .sp-brand__emblem                 <img> that replaces .sp-brand__mark
                                       when an emblem is uploaded
     .sp-brand--emblem-small/medium/large   on .sp-brand when an emblem
                                       is shown (its chosen size). A theme
                                       sets --sp-emblem-max on .sp-brand to
                                       keep the emblem inside its header or
                                       brand block, and may size the block
                                       by these classes

   Uploaded banner (.sp-masthead--custom) also carries
     .sp-masthead--h-short/medium/tall and
     .sp-masthead--fit-fill/whole, and its <img> --sp-banner-focus
     (section 7). A theme only needs to style the frame round it.

   The Theme Builder's "Decorative bars" switch, when off, hides every
   hook above (App\Support\ThemeCss::ornamentCss, segmented_bars).
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. TOKENS
   The --pp* names are the platform's accent contract: about a hundred
   views use them inline as var(--pp, …). Change the accent here and the
   whole site follows.
   --------------------------------------------------------------------- */
:root {
    color-scheme: dark;

    /* LCARS palette (secondary accents). --lc-orange is the accent as a
       colour block in every theme (the Theme Builder sets it from the
       accent), so in LCARS it is the steel-blue frame; the action orange
       is --lc-peach. */
    --lc-orange:  #3b86ad;  --lc-orange-rgb: 59,134,173;    /* the frame (same as --pp) */
    --lc-gold:    #f2b27c;  --lc-gold-rgb:   242,178,124;   /* warm highlight numbers */
    --lc-peach:   #ff7a59;  --lc-peach-rgb:  255,122,89;    /* action: primary buttons, current block, alerts */
    --lc-tan:     #c4cfdd;  --lc-tan-rgb:    196,207,221;   /* pale steel (labels) */
    --lc-lilac:   #9aa3c7;  --lc-lilac-rgb:  154,163,199;   /* section labels, header readout block */
    --lc-violet:  #7ea6c9;  --lc-violet-rgb: 126,166,201;   /* soft blue */
    --lc-blue:    #8cc9e6;  --lc-blue-rgb:   140,201,230;   /* links */
    --lc-blue-lt: #cce8f5;
    --lc-red:     #cc6666;  --lc-red-rgb:    204,102,102;

    /* primary accent (steel blue: the LCARS frame) */
    --pp:        #3b86ad;
    --pp-lt:     #8cc9e6;
    --pp-dk:     #1f4c68;
    --pp-bg:     #0a1824;
    --pp-rgb:    59,134,173;
    --pp-lt-rgb: 140,201,230;
    --pp-dk-rgb: 31,76,104;
    --pp-ink:    #05080d;            /* text placed on a solid accent fill */

    /* neutrals: deep navy-black page, blue-grey surfaces, solid thin lines */
    --sp-bg:          #05080d;  --sp-bg-rgb:      5,8,13;
    --sp-bg-raised:   #05080d;  --sp-bg-raised-rgb: 5,8,13;
    --sp-surface:     #0c1420;  --sp-surface-rgb: 12,20,32;
    --sp-surface-2:   #132033;
    --sp-surface-3:   #1a2b40;
    --sp-field:       #05080d;
    --sp-line:        #2b4a63;
    --sp-line-strong: #3b6482;
    --sp-text:        #e3e8ef;
    --sp-text-dim:    #9aa6b8;
    --sp-text-hi:     #ffffff;

    /* status */
    --sp-success: #33cc99;  --sp-success-rgb: 51,204,153;
    --sp-danger:  #f0605d;  --sp-danger-rgb:  240,96,93;
    --sp-warning: #ffd23f;  --sp-warning-rgb: 255,210,63;
    --sp-info:    var(--lc-blue);

    /* type */
    --sp-font-display: 'Antonio', 'Oxanium', 'Segoe UI', system-ui, sans-serif;
    --sp-font-body:    'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --sp-font-mono:    ui-monospace, 'Cascadia Code', Consolas, 'Liberation Mono', monospace;

    /* shape + layout */
    --sp-radius:    6px;
    --sp-radius-sm: 4px;
    --sp-header-h:  60px;
    --sp-rail-w:    244px;
    --sp-shell-max: 1480px;
    --sp-gutter:    clamp(16px, 2.4vw, 32px);
    --sp-ease:      cubic-bezier(0.2, 0.7, 0.2, 1);

    /* aliases still read by a few views */
    --sh-text:   var(--sp-text);
    --sh-dim:    var(--sp-text-dim);
    --sh-blue:   var(--pp);
    --sh-orange: var(--pp-lt);
    --accent:    var(--pp);
}


/* ---------------------------------------------------------------------
   2. RESET + BASE ELEMENTS
   Margins are zeroed and lists are unstyled by default (views were built
   on that); rich-text containers get their spacing and bullets back.
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* focus moves and anchor jumps stop below the sticky header, never under it (WCAG 2.4.11 focus not obscured; 30 Nov a11y run) */
html { scroll-padding-top: calc(var(--sp-header-h, 60px) + 24px); }   /* looks set the height on body (up to 76px), which html cannot read: the root value + 24px clears every look */
/* an inline help link is told apart by more than its colour (WCAG 1.4.1) */
a.sp-howto { text-decoration: underline; text-underline-offset: 2px; }

body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, figure, dl, dd, ol, ul, fieldset, legend { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img, svg, video, canvas { max-width: 100%; }
img { border: 0; height: auto; }
iframe { border: 0; max-width: 100%; }

body {
    min-height: 100vh;
    background-color: var(--sp-bg);
    background-image:
        radial-gradient(1100px 520px at 78% -220px, rgba(var(--pp-rgb),0.06), transparent 70%),
        radial-gradient(900px 600px at -10% 110%, rgba(var(--lc-lilac-rgb),0.05), transparent 70%);
    background-attachment: fixed;
    color: var(--sp-text);
    font: 400 1rem/1.6 var(--sp-font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(var(--pp-rgb),0.35); color: var(--sp-text-hi); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--sp-font-display);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    color: var(--sp-text-hi);
    margin: 0 0 0.6em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; color: var(--pp-lt); }
h4 { font-size: 1.02rem; }
h5, h6 { font-size: 0.9rem; }

p { margin: 0 0 0.85em; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--lc-blue);
    text-decoration: none;
    text-underline-offset: 0.18em;
    transition: color 0.15s;
}
a:hover { color: var(--lc-blue-lt); text-decoration: underline; }
a.image, a.image:hover { text-decoration: none; border: 0; }

strong, b { font-weight: 600; color: inherit; }
small { font-size: 0.85em; }

hr {
    height: 0;
    margin: 1.5em 0;
    border: 0;
    border-top: 1px solid var(--sp-line-strong);
}

blockquote {
    margin: 0 0 1em;
    padding: 0.6em 1em;
    border-left: 3px solid var(--pp-dk);
    background: rgba(var(--pp-rgb),0.05);
    border-radius: 0 var(--sp-radius-sm) var(--sp-radius-sm) 0;
}

code, pre, samp { font-family: var(--sp-font-mono); font-size: 0.9em; }
code {
    padding: 0.1em 0.35em;
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line);
    border-radius: 4px;
}
pre {
    padding: 12px 14px;
    background: var(--sp-field);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius-sm);
    overflow-x: auto;
}
pre code { padding: 0; border: 0; background: none; }

details > summary { cursor: pointer; }
legend { font-family: var(--sp-font-display); color: var(--lc-tan); font-weight: 600; margin-bottom: 0.4em; }
dt { font-weight: 600; color: var(--sp-text-hi); }
dd { margin: 0 0 0.6em; }

/* <kbd> is used as the field label in the classic "p > kbd + input" forms */
kbd {
    display: block;
    margin: 0 0 5px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-tan);
}

/* Rich text written by players / staff */
.post-content-wrap ul, .sp-prose ul { list-style: disc; padding-left: 1.4em; margin: 0 0 1em; }
.post-content-wrap ol, .sp-prose ol { list-style: decimal; padding-left: 1.6em; margin: 0 0 1em; }
.post-content-wrap li, .sp-prose li { margin: 0.2em 0; }

/* skip link */
.sp-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 10001;
    padding: 8px 14px;
    background: var(--pp);
    color: var(--pp-ink);
    font-weight: 600;
    border-radius: var(--sp-radius-sm);
    transition: top 0.15s;
}
.sp-skip:focus { top: 10px; color: var(--pp-ink); text-decoration: none; }

/* screen-reader only */
.sp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }


/* ---------------------------------------------------------------------
   3. LAYOUT
   --------------------------------------------------------------------- */

/* ---- header bar ---- */
.sp-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(var(--sp-bg-rgb),0.88);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--sp-line);
}
.sp-header::after {             /* segmented LCARS-style bar under the brand */
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: min(calc(var(--sp-rail-w) + 120px), 60vw);
    height: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(90deg,
        var(--pp) 0 58%, transparent 58% 60%,
        var(--lc-lilac) 60% 78%, transparent 78% 80%,
        var(--lc-blue) 80% 100%);
    pointer-events: none;
}
.sp-header__inner {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: var(--sp-shell-max);
    height: var(--sp-header-h);
    margin: 0 auto;
    padding: 0 var(--sp-gutter);
}

/* brand */
.sp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 0 1 auto;
    color: var(--sp-text-hi);
    text-decoration: none;
}
.sp-brand:hover { color: var(--sp-text-hi); text-decoration: none; }
.sp-brand__mark {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
}
.sp-brand__mark::before,
.sp-brand__mark::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    border: 2px solid var(--pp);
    transform: rotate(45deg);
    border-radius: 3px;
}
.sp-brand__mark::after {
    inset: 0;
    width: 8px;
    height: 8px;
    border: 0;
    background: var(--lc-gold);
    box-shadow: 0 0 10px rgba(var(--pp-rgb),0.7);
}
.sp-brand__mark::before { width: 18px; height: 18px; }
.sp-brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.sp-brand__name {
    font-family: var(--sp-font-display);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-brand__tag {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* top bar = main menu + account buttons (a dropdown panel on narrow screens) */
.sp-topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}
.sp-topnav { flex: 1 1 auto; min-width: 0; height: 100%; }
.sp-topnav__list {
    display: flex;
    flex-wrap: wrap;      /* never cut short or scrolled sideways: tabs tighten, then wrap (nav-account script) */
    align-items: stretch;
    gap: 2px;
    height: 100%;
}
.sp-topnav__list > li { display: flex; }
.sp-topnav__link {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 13px;
    font-family: var(--sp-font-display);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sp-text-dim);
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}
.sp-topnav__link::after {
    content: '';
    position: absolute;
    left: 13px;
    right: 13px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--pp);
    transform: scaleX(0);
    transition: transform 0.2s var(--sp-ease);
}
.sp-topnav__link:hover { color: var(--sp-text-hi); text-decoration: none; }
.sp-topnav__link:hover::after { transform: scaleX(0.4); background: var(--lc-gold); }
.sp-topnav__link.active { color: var(--sp-text-hi); }
.sp-topnav__link.active::after { transform: scaleX(1); }

/* account buttons */
.sp-account { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sp-account form { margin: 0; }
.sp-account__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 14px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sp-text);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.sp-account__btn:hover { color: var(--sp-text-hi); border-color: var(--pp); text-decoration: none; }
.sp-account__btn--primary { background: var(--pp); border-color: var(--pp); color: var(--pp-ink); border-radius: 999px; }
.sp-account__btn--primary:hover { background: var(--pp-lt); border-color: var(--pp-lt); color: var(--pp-ink); }

/* header icon buttons (drawer + menu toggles) */
.sp-iconbtn {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--sp-text);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.sp-iconbtn:hover { color: var(--sp-text-hi); border-color: var(--pp); background: rgba(var(--pp-rgb),0.08); }
.sp-iconbtn svg { width: 20px; height: 20px; display: block; }
.sp-iconbtn .sp-ico-close { display: none; }
.sp-iconbtn[aria-expanded="true"] .sp-ico-open { display: none; }
.sp-iconbtn[aria-expanded="true"] .sp-ico-close { display: block; }
.sp-iconbtn[aria-expanded="true"] { border-color: var(--pp); color: var(--pp-lt); }

/* ---- shell: rail + main ---- */
.sp-shell {
    display: flex;
    align-items: flex-start;
    max-width: var(--sp-shell-max);
    margin: 0 auto;
    padding: 0 var(--sp-gutter);
    gap: clamp(18px, 2.2vw, 34px);
}

/* side navigation rail */
.sp-rail {
    position: sticky;
    top: var(--sp-header-h);
    flex: 0 0 var(--sp-rail-w);
    width: var(--sp-rail-w);
    max-height: calc(100vh - var(--sp-header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 0 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--sp-surface-3) transparent;
}
/* Menu scroll bar on the left (Admin > Site Settings > Appearance "Menu scroll bar side",
   or the member's own choice in Account > Site Theme; App\Support\MenuScrollbar puts
   .sp-menu-scroll-left on <body>). #sp-rail is the menu's scroll box in every layout and
   theme, desktop rail and phone drawer alike: laid out right-to-left, the browser draws
   its vertical scroll bar on the left. Everything inside is set back to left-to-right, so
   text, icons, hover / current states and keyboard focus are unchanged. Only scrollTop is
   used to bring the current page's link into view, and it is not affected by direction. */
body.sp-menu-scroll-left #sp-rail { direction: rtl; }
body.sp-menu-scroll-left #sp-rail > * { direction: ltr; }
.sp-rail__head { display: none; }
.sp-rail__nav ul { margin: 0; padding: 0; list-style: none; }
.sp-rail__nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 14px;
    margin: 1px 0;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--sp-text);
    text-decoration: none;
    border-radius: var(--sp-radius-sm);
    transition: color 0.15s, background-color 0.15s;
}
.sp-rail__nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--pp);
    opacity: 0;
    transition: opacity 0.15s;
}
.sp-rail__nav a:hover { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.07); text-decoration: none; }
.sp-rail__nav a.active { color: var(--sp-text-hi); background: rgba(var(--pp-rgb),0.12); font-weight: 500; }
.sp-rail__nav a.active::before { opacity: 1; }

/* count bubble on a rail link (e.g. open content flags) */
.sp-count {
    display: inline-block;
    min-width: 20px;
    margin-left: auto;
    padding: 0 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--sp-danger);
    border-radius: 999px;
}

/* section labels + spacers inside the rail */
.nav-label {
    display: block;
    padding: 16px 14px 6px;
    font-family: var(--sp-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--lc-lilac);
    list-style: none;
}
.sp-rail__nav li.nav-label:first-child { padding-top: 4px; }
.spacer {
    display: block;
    height: 1px;
    margin: 12px 14px 4px;
    background: var(--sp-line);
    list-style: none;
}

/* scrim behind the mobile drawer */
.sp-scrim {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(0,0,0,0.66);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0s linear 0.25s;
}

/* main content */
.sp-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 28px 0 48px;
    line-height: 1.6;
}
.sp-main:focus { outline: none; }
#sp-main:focus-visible, #sp-rail:focus-visible { outline: none !important; }   /* skip-link / drawer focus targets, not controls */
.sp-main::after { content: ''; display: table; clear: both; }   /* contain floated view content */

/* footer */
.sp-footer {
    border-top: 1px solid var(--sp-line);
    background: rgba(var(--sp-bg-raised-rgb),0.75);
}
.sp-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    max-width: var(--sp-shell-max);
    margin: 0 auto;
    padding: 22px var(--sp-gutter) 26px;
    font-size: 0.84rem;
    color: var(--sp-text-dim);
}
.sp-footer__links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.sp-footer a { color: var(--sp-text); }
.sp-footer a:hover { color: var(--lc-blue-lt); }
.sp-footer__credit { text-align: right; }
.sp-footer__credit strong { color: var(--sp-text-hi); font-weight: 600; }
.sp-footer__legal { display: block; margin-top: 3px; font-size: 0.76rem; color: var(--sp-text-dim); }

.sp-noscript {
    padding: 8px 16px;
    text-align: center;
    background: rgba(var(--sp-danger-rgb),0.18);
    border-bottom: 1px solid rgba(var(--sp-danger-rgb),0.5);
    color: var(--sp-text-hi);
}

/* ---- top menu collapses into a dropdown panel ---- */
@media (max-width: 1100px) {
    .sp-header__menu { display: inline-flex; margin-left: auto; }
    .sp-topbar {
        position: absolute;
        top: 100%;
        right: var(--sp-gutter);
        width: min(300px, calc(100vw - 2 * var(--sp-gutter)));
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px;
        margin-top: 8px;
        background: var(--sp-surface);
        border: 1px solid var(--sp-line-strong);
        border-radius: var(--sp-radius);
        box-shadow: 0 18px 40px rgba(0,0,0,0.55);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: opacity 0.18s, transform 0.18s var(--sp-ease), visibility 0s linear 0.18s;
    }
    .sp-topbar.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 0.18s, transform 0.18s var(--sp-ease), visibility 0s;
    }
    .sp-topnav { height: auto; }
    .sp-topnav__list { flex-direction: column; height: auto; gap: 2px; overflow: visible; }
    .sp-topnav__list > li { display: block; }
    .sp-topnav__link {
        padding: 10px 12px;
        border-radius: var(--sp-radius-sm);
        color: var(--sp-text);
    }
    .sp-topnav__link::after { left: 0; right: auto; top: 9px; bottom: 9px; width: 2px; height: auto; transform: scaleY(0); }
    .sp-topnav__link:hover { background: rgba(var(--pp-rgb),0.08); }
    .sp-topnav__link:hover::after { transform: scaleY(0); }
    .sp-topnav__link.active { background: rgba(var(--pp-rgb),0.12); }
    .sp-topnav__link.active::after { transform: scaleY(1); }
    .sp-topbar .sp-account {
        padding: 10px 4px 4px;
        margin-top: 6px;
        border-top: 1px solid var(--sp-line);
    }
    .sp-topbar .sp-account > * { flex: 1 1 0; }
    .sp-topbar .sp-account__btn { width: 100%; height: 38px; }
    .sp-header__inner > .sp-header__account { flex: 0 1 auto; }
}

/* ---- rail becomes a slide-in drawer ---- */
@media (max-width: 900px) {
    .sp-header__drawer { display: inline-flex; }
    .sp-shell { display: block; }
    .sp-rail {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        width: min(300px, 86vw);
        max-height: none;
        padding: 0 10px 40px;
        background: var(--sp-bg-raised);
        border-right: 1px solid var(--sp-line-strong);
        box-shadow: 18px 0 50px rgba(0,0,0,0.5);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.26s var(--sp-ease), visibility 0s linear 0.26s;
    }
    .sp-rail.is-open {
        transform: none;
        visibility: visible;
        transition: transform 0.26s var(--sp-ease), visibility 0s;
    }
    .sp-rail__head {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: var(--sp-header-h);
        margin: 0 -10px 6px;
        padding: 0 10px 0 24px;
        background: var(--sp-bg-raised);
        border-bottom: 1px solid var(--sp-line);
    }
    .sp-rail__title {
        font-family: var(--sp-font-display);
        font-size: 0.78rem;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: var(--sp-text-dim);
    }
    .sp-rail__head .sp-iconbtn { display: inline-flex; }
    .sp-rail__nav a { padding: 10px 14px; font-size: 0.95rem; }
    .sp-scrim.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s, visibility 0s; }
    .sp-main { padding-top: 22px; }
    html.sp-lock, html.sp-lock body { overflow: hidden; }
}

@media (max-width: 640px) {
    :root { --sp-header-h: 56px; --sp-gutter: 16px; }
    body { font-size: 15px; background-attachment: scroll; }
    .sp-header__inner { gap: 10px; }
    .sp-brand { gap: 10px; flex: 1 1 auto; }
    .sp-brand__mark { width: 22px; height: 22px; }
    .sp-brand__mark::before { width: 15px; height: 15px; }
    .sp-brand__mark::after { width: 6px; height: 6px; }
    .sp-brand__name { font-size: 0.98rem; letter-spacing: 0.04em; }
    .sp-brand__tag { display: none; }
    .sp-topbar { right: 0; left: 0; width: auto; margin: 0; border-radius: 0 0 var(--sp-radius) var(--sp-radius); border-left: 0; border-right: 0; }
    .sp-header::after { width: 40vw; }
    .sp-footer__inner { flex-direction: column; align-items: flex-start; }
    .sp-footer__credit { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    .sp-rail, .sp-scrim, .sp-topbar, .sp-topnav__link::after { transition: none !important; }
}


/* ---------------------------------------------------------------------
   4. TYPOGRAPHY HELPERS
   --------------------------------------------------------------------- */
h1.page-head, .page-head {
    position: relative;
    margin: 0 0 0.9rem;
    padding-bottom: 0.55rem;
    font-family: var(--sp-font-display);
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--sp-text-hi);
    text-shadow: none;
}
h1.page-head::after, .page-head::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 120px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg,
        var(--pp) 0 56px, transparent 56px 62px,
        var(--lc-lilac) 62px 92px, transparent 92px 98px,
        var(--lc-blue) 98px 120px);
}
/* A centred page title (Site Settings > Front Page Heading "Centred", the front page editor's Centred button), at every
   width: the text is centred and so is the look's own bar or line under (or beside) it. */
.page-head--centre { text-align: center; justify-content: center; }
h1.page-head.page-head--centre::after, .page-head.page-head--centre::after { left: 50%; transform: translateX(-50%); }
h2.page-subhead, .page-subhead {
    margin: 1.6em 0 0.7em;
    padding-bottom: 6px;
    font-family: var(--sp-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--lc-tan);
    border-bottom: 1px solid var(--sp-line-strong);
}

.text-muted, .gray { color: var(--sp-text-dim); }
/* a help line right under a field keeps 10px clear of the field (a look's field shadow or border reached the help line's box and read as 3.9 to 4.4:1) */
.form-group :is(select, input, textarea) + small.d-block { margin-top: 10px; }
.text-white       { color: var(--sp-text-hi); }
.text-purple      { color: var(--pp); }
.purple           { color: var(--pp-lt); }
.green            { color: var(--sp-success); }
.red              { color: var(--sp-danger); }
.orange           { color: var(--sp-warning); }
.blue             { color: var(--lc-blue); }

.bold      { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.small     { font-size: 0.85em; }
.medium    { font-size: 1.08em; }
.nowrap    { white-space: nowrap; }
.align-right  { text-align: right !important; }
.align-center { text-align: center !important; }
.hidden    { display: none; }

/* "name" banner text (sign-in style pages) */
.name {
    font-family: var(--sp-font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--sp-text-hi);
}

/* department colours (data-dept is the lower-cased department name) */
.dept-header { font-family: var(--sp-font-display); text-shadow: none !important; }
.dept-header a { color: inherit; }
.dept-header[data-dept*="command"]     { --dept-c: #e2b54a; }
.dept-header[data-dept="navigation"],
.dept-header[data-dept*="helm"]        { --dept-c: #f06a5a; }
.dept-header[data-dept*="tactical"],
.dept-header[data-dept*="security"],
.dept-header[data-dept*="weapon"],
.dept-header[data-dept*="combat"]      { --dept-c: #c9ced8; }
.dept-header[data-dept*="engineering"],
.dept-header[data-dept*="operations"],
.dept-header[data-dept*="systems"]     { --dept-c: #f3c94d; }
.dept-header[data-dept*="science"]     { --dept-c: #43d8c4; }
.dept-header[data-dept*="medical"],
.dept-header[data-dept*="counsel"]     { --dept-c: #eef2f8; }
.dept-header[data-dept*="general"],
.dept-header[data-dept*="crew"]        { --dept-c: #d79a62; }


/* ---------------------------------------------------------------------
   5. COMPONENTS
   --------------------------------------------------------------------- */

/* ---- buttons ---- */
button, .btn, input[type=submit], input[type=button], input[type=reset],
input.button-main, input.button-sec {
    display: inline-block;
    padding: 8px 18px;
    font-family: var(--sp-font-display);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-decoration: none;
    vertical-align: middle;
    color: var(--sp-text-hi);
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover,
input.button-sec:hover {
    color: var(--sp-text-hi);
    background: var(--sp-surface-3);
    border-color: rgba(var(--pp-rgb),0.6);
    text-decoration: none;
}
.btn-primary, button.button-main, input.button-main {
    color: var(--pp-ink);
    background: var(--pp);
    border-color: var(--pp);
    border-radius: 999px;
}
.btn-primary:hover, button.button-main:hover, input.button-main:hover {
    color: var(--pp-ink);
    background: var(--pp-lt);
    border-color: var(--pp-lt);
    box-shadow: 0 0 0 3px rgba(var(--pp-rgb),0.18);
}
.btn-success { color: #d6fbe9; background: rgba(var(--sp-success-rgb),0.16); border-color: rgba(var(--sp-success-rgb),0.7); }
.btn-success:hover { color: #fff; background: rgba(var(--sp-success-rgb),0.3); border-color: var(--sp-success); }
.btn-danger { color: #ffe0df; background: rgba(var(--sp-danger-rgb),0.16); border-color: rgba(var(--sp-danger-rgb),0.7); }
.btn-danger:hover { color: #fff; background: rgba(var(--sp-danger-rgb),0.3); border-color: var(--sp-danger); }
.btn-sm, button.button-small, button.button-sec { padding: 4px 11px; font-size: 0.72rem; }
button[disabled], .btn[disabled], .btn.disabled, input[type=submit][disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* a reaction button under a post or a log (what plugins add there: post.show.reactions / log.show.reactions);
   .is-on: pressed */
.btn-reaction {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 3px 12px;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
    background: transparent;
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.btn-reaction:hover { color: var(--pp-lt); border-color: var(--pp); background: rgba(var(--pp-rgb),0.06); text-decoration: none; }
.btn-reaction.is-on { color: var(--pp-lt); border-color: var(--pp); background: rgba(var(--pp-rgb),0.14); }
.reaction-icon { font-size: 1.2em; line-height: 1; vertical-align: -0.05em; }

/* ---- form fields ---- */
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=url], input[type=tel], input[type=date],
input[type=time], input[type=datetime-local], input[type=month], input[type=week],
input:not([type]), select, textarea, .form-control {
    max-width: 100%;
    padding: 7px 11px;
    font-family: var(--sp-font-body);
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--sp-text-hi);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=url], input[type=tel], input:not([type]) { width: 18rem; }
textarea { width: 100%; min-height: 5.5em; resize: vertical; }
select { padding-right: 30px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: rgba(166,158,146,0.75); }
input:hover, select:hover, textarea:hover, .form-control:hover { border-color: rgba(var(--pp-rgb),0.45); }
input:focus, select:focus, textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--pp);
    background: var(--sp-surface);
    box-shadow: 0 0 0 3px rgba(var(--pp-rgb),0.2);
}
input[disabled], select[disabled], textarea[disabled] { opacity: 0.55; cursor: not-allowed; }
input[type=checkbox], input[type=radio], input[type=range], progress { accent-color: var(--pp); }
input[type=checkbox], input[type=radio] { width: auto; cursor: pointer; }
input[type=file] { max-width: 100%; color: var(--sp-text-dim); font-size: 0.9rem; }
input[type=file]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    font: 600 0.75rem var(--sp-font-display);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text-hi);
    background: var(--sp-surface-3);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    cursor: pointer;
}
input.small  { width: 4.5rem; }
input.medium { width: 8rem; }
input[type=color] { width: 44px; height: 34px; padding: 2px; background: var(--sp-field); border: 1px solid var(--sp-line-strong); border-radius: var(--sp-radius-sm); }

label { cursor: default; }
.form-group { display: block; margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-family: var(--sp-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-tan);
}
/* a label wrapping a checkbox / radio reads as normal text */
.form-group label:has(> input[type=checkbox]), .form-group label:has(> input[type=radio]) {
    font-family: var(--sp-font-body);
    font-size: 0.92rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--sp-text);
    cursor: pointer;
}
.form-group input[type=text], .form-group input[type=email], .form-group input[type=number],
.form-group input[type=date], .form-group input[type=time], .form-group input[type=url],
.form-group input[type=password], .form-group input[type=search], .form-group input[type=tel],
.form-group select, .form-group textarea {
    width: 100%;
    max-width: 600px;
}
.help, .form-group small, .form-group .help {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--sp-text-dim);
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 0.94rem; }
th {
    padding: 9px 10px;
    text-align: left;
    vertical-align: bottom;
    font-family: var(--sp-font-display);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lc-violet);
    border-bottom: 1px solid var(--sp-line-strong);
}
td {
    padding: 9px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--sp-line);
}
tr:nth-child(even) td, tr.alt td { background: rgba(255,255,255,0.018); }
/* not an old site's plain table on a skin-frame page: an !important here would beat its own sheet's row colours */
tr:hover td:not(:where(body.sp-skin td:not(:is(.sp-skin-content, :has(> .sp-skin-anchor)) table[class] td))) { background: rgba(var(--pp-rgb),0.05) !important; }
tr.light_gray td { background: var(--sp-surface-2); }

/* ---- cards + panels ---- */
.card, .panel {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--sp-line-strong); }
.card-header, .panel-header {
    margin: 0 0 12px;
    padding-bottom: 8px;
    font-family: var(--sp-font-display);
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lc-lilac);
    border-bottom: 1px solid var(--sp-line);
}
.card-body, .panel-body { padding: 2px 0; }

/* ---- flash messages + alerts ---- */
.flash-success, .flash-error, .flash-info, .alert {
    position: relative;
    margin-bottom: 16px;
    padding: 11px 14px 11px 16px;
    font-size: 0.94rem;
    color: var(--sp-text-hi);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-left-width: 3px;
    border-radius: var(--sp-radius-sm);
}
.flash-success, .alert-success { border-color: rgba(var(--sp-success-rgb),0.45); border-left-color: var(--sp-success); background: rgba(var(--sp-success-rgb),0.08); }
.flash-error, .alert-danger, .alert-error { border-color: rgba(var(--sp-danger-rgb),0.45); border-left-color: var(--sp-danger); background: rgba(var(--sp-danger-rgb),0.08); }
.flash-info, .alert-info { border-color: rgba(var(--lc-blue-rgb),0.4); border-left-color: var(--lc-blue); background: rgba(var(--lc-blue-rgb),0.07); }
.alert-warning { border-color: rgba(var(--sp-warning-rgb),0.45); border-left-color: var(--sp-warning); background: rgba(var(--sp-warning-rgb),0.08); }

/* ---- badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--sp-font-display);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--sp-text);
    background: var(--sp-surface-3);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
}
.badge-gray   { color: var(--sp-text-dim); }
.badge-purple { color: var(--pp-lt); background: rgba(var(--pp-rgb),0.12); border-color: rgba(var(--pp-rgb),0.5); }
.badge-green  { color: #a3f0d4; background: rgba(var(--sp-success-rgb),0.12); border-color: rgba(var(--sp-success-rgb),0.5); }
.badge-red    { color: #ffb4b2; background: rgba(var(--sp-danger-rgb),0.12); border-color: rgba(var(--sp-danger-rgb),0.5); }
.badge-yellow, .badge-warning { color: #ffe58f; background: rgba(var(--sp-warning-rgb),0.12); border-color: rgba(var(--sp-warning-rgb),0.5); }

/* ---- pills (filter chips) ---- */
a.pill, .pill {
    display: inline-block;
    margin: 2px 1px;
    padding: 2px 10px;
    font-family: var(--sp-font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sp-text);
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-line-strong);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
a.pill:hover { color: var(--sp-text-hi); border-color: var(--pp); text-decoration: none; }
a.pill.active, a.pill-active, .pill.active { color: var(--pp-ink); background: var(--pp); border-color: var(--pp); }

/* ---- stat bar ---- */
.stat-bar {
    display: flex;
    flex-wrap: wrap;   /* more boxes than fit: a second row, never cut off */
    align-items: stretch;
    min-height: 84px;
    overflow: hidden;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.stat-item {
    display: flex;
    flex: 1 0 auto;   /* share the bar's width */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* the narrowest a box starts at before sharing out the spare width: small enough that a full
       dashboard bar (nine boxes) fits one row on a 1366 screen instead of leaving one box alone
       on a second row; a box never gets narrower than its longest word */
    width: 92px;
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid var(--sp-line);
}
.stat-item:last-child { border-right: 0; }
.stat-item.stat-mission { flex: 1 1 auto; width: auto; padding: 12px 18px; }
.stat-number {
    font-family: var(--sp-font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--pp-lt);
}
.stat-mission .stat-number { font-size: 1.1rem; color: var(--sp-text-hi); }
.stat-label {
    margin-top: 3px;
    font-family: var(--sp-font-display);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
}

/* ---- images ---- */
.mission-banner {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}

/* ---- edit links ---- */
a.edit { color: var(--sp-warning); }
a.edit:hover { color: #ffe58f; }

/* ---- pagination (Laravel "default" / bootstrap views) ---- */
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin: 1em 0; padding: 0; list-style: none; }
.pagination li > a, .pagination li > span, .pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 0.88rem;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--sp-radius-sm);
    text-decoration: none;
}
.pagination li > a:hover, .pagination .page-link:hover { border-color: var(--pp); color: var(--sp-text-hi); }
.pagination .active > span, .pagination .active .page-link { color: var(--pp-ink); background: var(--pp); border-color: var(--pp); font-weight: 600; }
.pagination .disabled > span, .pagination .disabled .page-link { opacity: 0.45; }

/* ---- long labels ----
   A name, rank, position, department or ship name with no spaces in it
   ("FFN News Correspondent\Reporter") wraps inside its box instead of running out
   of it or being cut off. min-width: 0 lets a box inside a flex or grid row shrink
   so the wrap can happen. Give any new label box the class sp-wrap-label.
   (Where one line with "..." is meant, such as the header ship name, menus and
   dense lists, the text stays one line and its full wording is in a title="".) */
.sp-wrap-label,
.page-head,
.dept-header,
.crew-card-rank, .crew-card-body,
.coc-card-rank, .coc-card-name, .coc-card-position, .coc-dept-label,
.bio-profile-info .position-line,
.wo-rank, .wo-name,
.portrait-name,
.post-card-authors, .post-card-mission-name,
.stat-item.stat-mission,
.app-info-grid dd,
.user-name,
.wiki-infobox .ib-title, .wiki-infobox .ib-sub, .wiki-infobox .ib-head {
    min-width: 0;
    overflow-wrap: anywhere;
}


/* ---------------------------------------------------------------------
   6. BRIDGE: HARD-CODED PURPLE IN INLINE STYLES
   Older views carry the original purple as literal values in style=""
   attributes (stored content, or views not yet converted). Values
   written with var(--pp...) already follow the accent, so those elements
   are excluded; only literal purple is repainted. Purple inside <style>
   blocks can't be reached from here and is converted to the tokens in
   the views themselves.
   --------------------------------------------------------------------- */
:is(
    [style*="color:#a855f7" i], [style*="color: #a855f7" i],
    [style*="color:#8b5cf6" i], [style*="color: #8b5cf6" i],
    [style*="color:#7c3aed" i], [style*="color: #7c3aed" i]
):not([style*="var(--pp" i]):not(.dept-header):not([style*="background:#a855f7" i]):not([style*="background: #a855f7" i]):not([style*="background-color:#a855f7" i]) {
    color: var(--pp) !important;
}
:is(
    [style*="color:#c084fc" i], [style*="color: #c084fc" i],
    [style*="color:#a78bfa" i], [style*="color: #a78bfa" i],
    [style*="color:#818cf8" i], [style*="color: #818cf8" i]
):not([style*="var(--pp" i]):not(.dept-header):not([style*="background:#c084fc" i]):not([style*="background: #c084fc" i]) {
    color: var(--pp-lt) !important;
}
:is([style*="color:#6b21a8" i], [style*="color: #6b21a8" i]):not([style*="var(--pp" i]):not(.dept-header) {
    color: var(--pp-dk) !important;
}
:is(
    [style*="solid #a855f7" i], [style*="solid #c084fc" i], [style*="solid #6b21a8" i],
    [style*="solid rgba(168,85,247" i], [style*="solid rgba(168, 85, 247" i],
    [style*="solid rgba(107,33,168" i], [style*="solid rgba(192,132,252" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    border-color: rgba(var(--pp-rgb),0.4) !important;
}
:is(
    [style*="background:#a855f7" i], [style*="background: #a855f7" i], [style*="background-color:#a855f7" i],
    [style*="background:#6b21a8" i], [style*="background: #6b21a8" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    background: var(--pp) !important;
    color: var(--pp-ink) !important;
}
:is(
    [style*="background:rgba(168,85,247" i], [style*="background: rgba(168,85,247" i],
    [style*="background:rgba(107,33,168" i], [style*="background: rgba(107,33,168" i]
):not([style*="var(--pp" i]):not(.dept-header) {
    background-color: rgba(var(--pp-rgb),0.12) !important;
}
:is([style*="linear-gradient" i]):is([style*="#2d0a4e" i], [style*="#6b21a8" i]):not([style*="var(--pp" i]) {
    background-image: linear-gradient(135deg, var(--pp-bg), var(--pp-dk)) !important;
}

/* Example values shown under form fields */
.eg { display: block; margin-top: 3px; font-size: .85rem; color: var(--sp-text-dim); }
.eg::before { content: ''; display: inline-block; width: 14px; height: 6px; border-radius: 3px; background: var(--lc-lilac); margin-right: 7px; vertical-align: 2px; opacity: .8; }
.eg code { color: var(--lc-gold); }


/* ---------------------------------------------------------------------
   7. ARCHITECTURE HOOKS (default off) + MASTHEAD BANNER + EMBLEM
   The hook elements are documented at the top of this file. They stay
   hidden for every theme that does not switch them on.
   --------------------------------------------------------------------- */
.sp-header__ornament,
.sp-frame__elbow,
.sp-frame__bars,
.sp-rail__cap,
.sp-main__ornament,
.sp-masthead__cap { display: none; }

/* header emblem (Admin > Site Settings > Appearance), in place of the brand mark.
   --sp-emblem is the chosen size (Emblem size: .sp-brand--emblem-small / -medium /
   -large on .sp-brand; smaller on phones, see the 640px block below). It never
   grows past --sp-emblem-max, which each theme sets on .sp-brand to the room its
   header (or its brand block) has; the fallback is the header height less a margin. */
.sp-brand { --sp-emblem: 34px; }
.sp-brand--emblem-medium { --sp-emblem: 46px; }
.sp-brand--emblem-large  { --sp-emblem: 60px; }
.sp-brand__emblem {
    display: block;
    flex: 0 0 auto;
    width: min(var(--sp-emblem), var(--sp-emblem-max, calc(var(--sp-header-h) - 14px)));
    height: min(var(--sp-emblem), var(--sp-emblem-max, calc(var(--sp-header-h) - 14px)));
    object-fit: contain;
}

/* masthead banner: the uploaded banner, or the theme's own default banner
   (public/images/banners/<root theme>.svg, 1600 x 360) with the sim's name
   written over it in the theme's display face */
.sp-masthead {
    display: flex;
    align-items: stretch;
    max-width: var(--sp-shell-max);
    margin: 14px auto 0;
    padding: 0 var(--sp-gutter);
}
.sp-masthead__frame {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    background: var(--sp-bg-raised);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
}
.sp-masthead__img {
    display: block;
    width: 100%;
    height: clamp(110px, 16vw, 240px);
    max-width: none;
    object-fit: cover;
    object-position: center;
}
/* An uploaded banner: Banner height / Banner fit / Banner focus point
   (App\Support\BannerDisplay puts the classes on .sp-masthead and the focus on the
   img as --sp-banner-focus). Heights follow the frame's own width (container
   units: about the first figure on a phone, the last on a wide screen), so the
   settings preview draws exactly what the site draws; the vw line before each is
   for browsers without container units. A filled banner is cropped around the
   focus point at every width ("x% y%" keeps that point of the picture in view);
   "whole" never crops, and the frame's background shows round it. */
.sp-masthead--custom .sp-masthead__frame { container-type: inline-size; }
.sp-masthead--custom .sp-masthead__img { object-position: var(--sp-banner-focus, 50% 50%); }
.sp-masthead--h-short .sp-masthead__img {
    height: clamp(64px, 41px + 9.2vw, 170px);
    height: clamp(64px, 41px + 9.2cqw, 170px);
}
.sp-masthead--h-medium .sp-masthead__img {
    height: clamp(90px, 51px + 15.3vw, 260px);
    height: clamp(90px, 51px + 15.3cqw, 260px);
}
.sp-masthead--h-tall .sp-masthead__img {
    height: clamp(130px, 75px + 23.5vw, 400px);
    height: clamp(130px, 75px + 23.5cqw, 400px);
}
/* Sim name over an uploaded banner: a soft wash from the left keeps it readable on any picture. */
.sp-masthead--custom .sp-masthead__name {
    z-index: 2;
    padding: 0.5em 1.4em 0.5em 0;
}
.sp-masthead--custom .sp-masthead__name::before {
    content: "";
    position: absolute;
    inset: -35% -20% -35% -12%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(0,0,0,0.6), rgba(0,0,0,0));
    pointer-events: none;
}
/* larger text: the name block grows over the picture and its tagline can reach the picture's light parts; a dark band behind the block keeps it readable (normal text is untouched) */
html:is(.a11y-text-large, .a11y-text-xlarge) .sp-masthead__name { z-index: 2; padding: 0.4em 1.4em 0.4em 0.6em; margin-left: -0.6em; }
html:is(.a11y-text-large, .a11y-text-xlarge) .sp-masthead__name::before {
    content: "";
    position: absolute;
    inset: 0 -4% 0 -8%;
    z-index: -1;
    background: linear-gradient(90deg, rgba(3,6,16,0.84) 70%, rgba(3,6,16,0));
    pointer-events: none;
}
.sp-masthead--fit-whole .sp-masthead__img { object-fit: contain; object-position: 50% 50%; }
.sp-masthead__name {
    position: absolute;
    left: clamp(16px, 5%, 72px);
    top: 50%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: min(62%, 760px);
    margin: 0;
    transform: translateY(-50%);
    pointer-events: none;
}
.sp-masthead__title {
    font-family: var(--sp-font-display);
    font-size: clamp(1.35rem, 3.4vw, 3rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sp-text-hi);
    text-shadow: 0 2px 14px rgba(0,0,0,0.85), 0 0 2px rgba(0,0,0,0.9);
    overflow-wrap: anywhere;
}
.sp-masthead__tag {
    font-family: var(--sp-font-display);
    font-size: clamp(0.72rem, 1.1vw, 0.95rem);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--pp-lt);
    text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
@media (max-width: 640px) {
    .sp-masthead { margin-top: 10px; }
    .sp-masthead__img { height: clamp(84px, 27vw, 150px); }
    .sp-brand { --sp-emblem: 28px; }
    .sp-brand.sp-brand--emblem-medium { --sp-emblem: 34px; }
    .sp-brand.sp-brand--emblem-large  { --sp-emblem: 40px; }
}


/* =====================================================================
   8. LCARS CONSTRUCTION (body.theme-lcars)
   The LCARS theme's own structure, built on the hooks above. Everything
   is scoped to body.theme-lcars (Theme Builder themes built on LCARS get
   it too: their body has both classes).

   The look: a steel-blue frame on a deep navy-black page. One elbow at the
   top left joins the frame bar along the top of the content to the menu
   column under it. Bars are thin and one colour each (at most one short
   dark end piece). The side menu is a stack of plain dark-blue blocks with
   their labels at the bottom right; the current page's block is lit in the
   action orange. Orange is kept for primary buttons, the current menu
   block and alerts only; the lilac marks section labels. No readout
   numbers, no rainbow blocks, no glow.

   Every colour comes from the 8a tokens (which read the palette tokens in
   section 1), so a recoloured custom theme recolours the frame:
     --lcars-frame     the frame: elbow, bars, header brand block
     --lcars-frame-lt  light frame tone: hovers, title text
     --lcars-frame-dk  dark frame tone: menu blocks, end pieces, table heads
     --lcars-action    primary buttons, the current menu block, highlights
     --lcars-second    the lilac: section labels, the header readout block
     --lcars-warm      warm highlight numbers (stat readouts)

     8a. frame tokens + page
     8b. header: brand block, thin bottom bar, menu blocks, pills
     8c. masthead banner frame
     8d. shell frame (901px and up): the elbow, top bar, bottom bar
     8e. rail blocks (all widths)
     8f. headings: page head, sub head
     8g. components: cards, buttons, fields, tables, flash, badges...
     8h. narrow screens: no elbow, compact header, drawer
     8i. header emblem
   Low-specificity rules (:where(body.theme-lcars) + the base selector)
   restyle shared components without beating a view's own classes.
   ===================================================================== */

/* ---- 8a. frame tokens + page ---- */
body.theme-lcars {
    --sp-rail-w:   224px;
    --sp-header-h: 76px;
    --lcars-frame:      var(--pp);
    --lcars-frame-lt:   var(--pp-lt);
    --lcars-frame-dk:   var(--pp-dk);
    --lcars-action:     var(--lc-peach);
    --lcars-second:     var(--lc-lilac);
    --lcars-warm:       var(--lc-gold);
    --lcars-ink:        var(--pp-ink);     /* text on light colour blocks */
    --lcars-block-text: var(--sp-text-hi); /* text on the dark menu blocks */
    --lcars-gap:   4px;            /* page-colour gap between blocks */
    --lcars-hbar:  12px;           /* header bottom bar */
    --lcars-bar:   24px;           /* shell frame top bar */
    --lcars-bbar:  12px;           /* shell frame bottom bar */
    --lcars-outer: 44px;           /* elbow outer radius */
    --lcars-inner: 18px;           /* elbow inner (concave) radius */
    --lcars-block-h: 40px;         /* side-menu block height: plain square blocks as in the owner's pre-rework LCARS picture */
    --lcars-pill:  999px;          /* pill ends; the Theme Builder's pill switch can square it */
    background-image: none;
}

/* the readout numbers and the page-head strip are not part of this look */
body.theme-lcars :is(.sp-header__code, .sp-frame__code, .sp-rail__code, .sp-main__code, .sp-masthead__code),
body.theme-lcars .sp-main__ornament { display: none; }

/* ---- 8b. header ---- */
body.theme-lcars .sp-header {
    background: var(--sp-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 0;
}
body.theme-lcars .sp-header::after { display: none; }   /* the ornament draws the bar */
body.theme-lcars .sp-header__inner {
    position: relative;
    gap: 10px;
    padding-bottom: calc(var(--lcars-hbar) + 8px);
}
/* brand: a frame-colour block over the menu column, rounded on the left */
body.theme-lcars .sp-brand {
    flex: 0 0 var(--sp-rail-w);
    align-self: center;
    width: var(--sp-rail-w);
    min-height: 44px;
    padding: 4px 16px 4px 20px;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    border-radius: var(--lcars-pill) 0 0 var(--lcars-pill);
}
body.theme-lcars .sp-brand:hover { color: var(--lcars-ink); background: var(--lcars-frame-lt); }
body.theme-lcars .sp-brand__text { align-items: flex-end; text-align: right; }
/* a name too wide for the block steps its font down to fit (the layout's fit script, never
   below --sp-brand-fit-min of its size), then takes two lines (is-fit-wrap); only a name too
   long even for that ends in an ellipsis, on one line */
body.theme-lcars .sp-brand__text > * { max-width: 100%; }
body.theme-lcars .sp-brand__name { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.05em; line-height: 1.05; --sp-brand-fit-min: 0.62; }
body.theme-lcars .sp-brand__name.is-fit-wrap { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; }
body.theme-lcars .sp-brand__tag { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; color: var(--lcars-ink); }
body.theme-lcars .sp-brand__mark::before { border-color: var(--lcars-ink); }
body.theme-lcars .sp-brand__mark::after { background: var(--lcars-ink); box-shadow: none; }
body.theme-lcars .sp-brand:focus-visible { outline-offset: -5px !important; outline-color: var(--lcars-ink) !important; }

/* the header's thin bottom bar: one frame-colour bar, then one lilac readout block */
body.theme-lcars .sp-header__ornament {
    position: absolute;
    left: var(--sp-gutter);
    right: var(--sp-gutter);
    bottom: 0;
    display: flex;
    align-items: stretch;
    gap: var(--lcars-gap);
    height: var(--lcars-hbar);
    pointer-events: none;
}
body.theme-lcars .sp-header__seg { display: block; }
body.theme-lcars .sp-header__seg--1 { flex: 1 1 auto; background: var(--lcars-frame); border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
body.theme-lcars .sp-header__seg--2,
body.theme-lcars .sp-header__seg--4 { display: none; }
body.theme-lcars .sp-header__seg--3 { flex: 0 0 72px; background: var(--lcars-second); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }

/* main menu: a row of plain dark blocks, labels at the bottom right, the current one lit */
@media (min-width: 1101px) {
    body.theme-lcars .sp-topbar { align-items: center; gap: 12px; height: auto; }
    body.theme-lcars .sp-topnav { height: auto; }
    body.theme-lcars .sp-topnav__list { align-items: center; gap: var(--lcars-gap); height: auto; }
    body.theme-lcars .sp-topnav__link {
        height: 34px;
        padding: 0 12px 4px 16px;
        align-items: flex-end;
        justify-content: flex-end;
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: 0.08em;
        color: var(--lcars-block-text);
        background: var(--lcars-frame-dk);
        border-radius: 0;
    }
    body.theme-lcars .sp-topnav__link::after { display: none; }
    body.theme-lcars .sp-topnav__link:hover { color: var(--lcars-ink); background: var(--lcars-frame); }
    body.theme-lcars .sp-topnav__list > li > .sp-topnav__link.active { color: var(--lcars-ink); background: var(--lcars-action); }
}
/* menu blocks sit in a scrolling row: draw the focus ring inside the block */
body.theme-lcars .sp-topnav__link:focus-visible,
body.theme-lcars .sp-rail__nav a:focus-visible {
    outline: 3px solid currentColor !important;
    outline-offset: -6px !important;
    text-decoration: underline;
}

/* account buttons + header toggles: pills */
body.theme-lcars .sp-account__btn {
    height: 34px;
    padding: 0 18px 1px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    border: 0;
    border-radius: var(--lcars-pill);
}
body.theme-lcars .sp-account__btn--primary { background: var(--lcars-action); }
body.theme-lcars .sp-account__btn:hover { color: var(--lcars-ink); background: var(--lcars-frame-lt); }
body.theme-lcars .sp-iconbtn {
    align-self: center;
    width: 52px;
    height: 36px;
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    border: 0;
    border-radius: var(--lcars-pill);
}
body.theme-lcars .sp-iconbtn:hover { color: var(--lcars-ink); background: var(--lcars-frame-lt); }
body.theme-lcars .sp-iconbtn[aria-expanded="true"] { color: var(--lcars-ink); background: var(--lcars-action); }

/* ---- 8c. masthead: a frame-colour cap, thin bars above and below, a dark end cap ---- */
body.theme-lcars .sp-masthead { gap: var(--lcars-gap); margin-top: 8px; }
body.theme-lcars .sp-masthead__cap {
    display: block;
    flex: 0 0 32px;
    background: var(--lcars-frame-dk);
    border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0;
}
body.theme-lcars .sp-masthead__cap--start {
    flex-basis: 64px;
    background: var(--lcars-frame);
    border-radius: var(--lcars-outer) 0 0 var(--lcars-outer);
}
body.theme-lcars .sp-masthead__frame {
    padding: var(--lcars-gap) 0;
    background: var(--sp-bg);
    border: 0;
    border-top: 6px solid var(--lcars-frame);
    border-bottom: 6px solid var(--lcars-frame);
    border-radius: 0;
}
body.theme-lcars .sp-masthead__title { letter-spacing: 0.08em; color: var(--sp-text-hi); }
body.theme-lcars .sp-masthead__tag { color: var(--lcars-frame-lt); }
/* light mode, larger text: the small buttons' ink (#120b02 on the light blue block) was 4.47:1; true black clears 4.5:1 */
html[data-mode="light"] body.theme-lcars a.btn.btn-sm:not(.btn-danger) { color: #000; }

/* ---- 8d. shell frame: the elbow + bars round the content (wide screens) ----
   grid:      column 1 (rail width)        column 2 (content)
   row 1      .sp-frame__elbow--top        .sp-frame__bars--top
   row 2      .sp-rail (sticky)            .sp-main
   row 3      .sp-frame__bars--bottom across both columns
   One elbow only: the bottom of the frame is a thin square bar (the
   bottom elbow hook is not drawn). */
@media (min-width: 901px) {
    body.theme-lcars .sp-shell {
        display: grid;
        grid-template-columns: var(--sp-rail-w) minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        align-items: start;
        gap: 0;
        margin-top: 10px;
    }
    body.theme-lcars .sp-frame__elbow--top {
        position: relative;
        display: block;
        grid-column: 1;
        grid-row: 1;
        height: 60px;
        background: var(--lcars-frame);
        border-top-left-radius: var(--lcars-outer);
    }
    /* inner curve where the elbow meets the top bar (a hard-edged corner fill, not a glow) */
    body.theme-lcars .sp-frame__elbow--top::after {
        content: '';
        position: absolute;
        left: 100%;
        top: var(--lcars-bar);
        width: var(--lcars-inner);
        height: var(--lcars-inner);
        background: radial-gradient(circle at 100% 100%, transparent calc(var(--lcars-inner) - 0.5px), var(--lcars-frame) var(--lcars-inner));
    }
    body.theme-lcars .sp-frame__bars {
        display: flex;
        gap: var(--lcars-gap);
        height: var(--lcars-bar);
    }
    body.theme-lcars .sp-frame__bars--top { grid-column: 2; grid-row: 1; align-self: start; }
    body.theme-lcars .sp-frame__bars--bottom { grid-column: 1 / -1; grid-row: 3; align-self: end; height: var(--lcars-bbar); margin-top: 16px; }
    body.theme-lcars .sp-frame__bar { display: block; }
    body.theme-lcars .sp-frame__bar--1 { flex: 1 1 auto; background: var(--lcars-frame); }
    body.theme-lcars :is(.sp-frame__bar--2, .sp-frame__bar--3) { display: none; }
    body.theme-lcars .sp-frame__bar--4 { flex: 0 0 48px; background: var(--lcars-frame-dk); border-radius: 0 var(--lcars-pill) var(--lcars-pill) 0; }
    body.theme-lcars .sp-frame__bars--bottom .sp-frame__bar--4 { border-radius: 0; }
    body.theme-lcars .sp-frame__elbow--bottom { display: none; }
    body.theme-lcars .sp-rail {
        z-index: 1;
        grid-column: 1;
        grid-row: 2;
        align-self: start;
        padding: var(--lcars-gap) 0;
        background: var(--sp-bg);
        scrollbar-color: var(--lcars-frame-dk) var(--sp-bg);
    }
    body.theme-lcars .sp-main {
        grid-column: 2;
        grid-row: 2;
        padding: 12px 0 36px 34px;
    }
}

/* ---- 8e. rail: a column of plain blocks (all widths) ---- */
/* the caps continue the elbow's column above the menu and close it below */
body.theme-lcars .sp-rail__cap { display: block; background: var(--lcars-frame); }
body.theme-lcars .sp-rail__cap--top { height: 20px; margin-bottom: var(--lcars-gap); }
body.theme-lcars .sp-rail__cap--bottom { height: 28px; }
body.theme-lcars .sp-rail__nav li { margin: 0 0 var(--lcars-gap); }
body.theme-lcars .sp-rail__nav a {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
    min-height: var(--lcars-block-h);   /* the same height as the section blocks (li.nav-label), so the stack is even */
    margin: 0;
    padding: 6px 14px 4px;              /* label at the bottom right of a square block */
    font-family: var(--sp-font-display);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: 0.06em;
    text-align: right;
    text-transform: uppercase;
    color: var(--lcars-block-text);
    background: var(--lcars-frame-dk);
    border-radius: 0;
}
body.theme-lcars .sp-rail__nav a:hover {
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    text-decoration: none;
}
/* current page: the block lit in the action colour */
body.theme-lcars .sp-rail__list > li > a.active {
    color: var(--lcars-ink);
    background: var(--lcars-action);
    font-weight: 700;
}
body.theme-lcars .sp-rail__nav a::before { display: none; }
body.theme-lcars .sp-rail__nav a .sp-count {
    order: -1;
    margin: 0 auto 1px 0;
    font-family: var(--sp-font-body);
    color: var(--sp-text-hi);
    background: var(--sp-bg);
}
/* section labels (and Command): lilac blocks; spacer: a plain gap */
body.theme-lcars .sp-rail__nav li.nav-label,
body.theme-lcars .sp-rail__nav li.nav-label:first-child {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: var(--lcars-block-h);
    padding: 6px 14px 5px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.1;
    text-align: right;
    color: var(--lcars-ink);
    background: var(--lcars-second);
}
body.theme-lcars .sp-rail__nav li.spacer {
    height: 12px;
    margin: 0 0 var(--lcars-gap);
    background: transparent;
}
body.theme-lcars .sp-rail__nav li.menu-filter-search a { font-style: normal; }
/* "Find in menu" box at the top of the rail */
body.theme-lcars .menu-filter { padding: 8px 0 10px; }   /* room under the frame cap */
body.theme-lcars .menu-filter .menu-filter__input {
    padding: 6px 14px;
    color: var(--sp-text-hi);
    background: var(--sp-field);
    border: 1px solid var(--sp-line-strong);
    border-radius: var(--lcars-pill);
}
body.theme-lcars .menu-filter .menu-filter__input:focus { border-color: var(--lcars-frame); box-shadow: 0 0 0 2px rgba(var(--pp-rgb),0.3); }
body.theme-lcars .menu-filter .menu-filter__input::placeholder { color: var(--sp-text-dim); opacity: 1; }
body.theme-lcars .menu-filter__status { padding: 4px 6px 0; text-align: right; color: var(--sp-text-dim); opacity: 1; }

/* ---- 8f. headings ---- */
body.theme-lcars :is(.page-head, .page-subhead, h1, h2) { text-transform: uppercase; letter-spacing: 0.05em; }
/* page title: light frame-tone text after a short frame cap, a thin bar filling the line */
body.theme-lcars :is(h1.page-head, .page-head) {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 14px;
    margin: 0 0 1.1rem;
    padding-bottom: 0;
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1.08;
    color: var(--lcars-frame-lt);
}
body.theme-lcars :is(h1.page-head, .page-head)::before,
body.theme-lcars :is(h1.page-head, .page-head)::after {
    content: '';
    position: static;
    clip-path: none;
    box-shadow: none;
}
body.theme-lcars :is(h1.page-head, .page-head)::before {
    flex: 0 0 28px;
    height: 0.6em;
    min-height: 16px;
    background: var(--lcars-frame);
    border-radius: var(--lcars-pill) 0 0 var(--lcars-pill);
}
body.theme-lcars :is(h1.page-head, .page-head)::after {
    flex: 1 1 0;
    width: auto;
    min-width: 40px;
    height: 6px;
    min-height: 0;
    background: var(--lcars-frame-dk);
    border-radius: 0;
}
/* centred page title: a bar each side of the text, so the text sits in the middle of the line at every width */
body.theme-lcars h1.page-head.page-head--centre::before,
body.theme-lcars .page-head.page-head--centre::before {
    flex: 1 1 0;
    min-width: 18px;
    height: 6px;
    min-height: 0;
    background: var(--lcars-frame-dk);
    border-radius: 0;
}
body.theme-lcars h1.page-head.page-head--centre::after,
body.theme-lcars .page-head.page-head--centre::after { left: auto; transform: none; }
/* section title: bright text, a short frame cap and a hairline */
body.theme-lcars :is(h2.page-subhead, .page-subhead) {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 0;
    font-size: 1.3rem;
    color: var(--sp-text-hi);
    border-bottom: 0;
}
body.theme-lcars :is(h2.page-subhead, .page-subhead)::before,
body.theme-lcars :is(h2.page-subhead, .page-subhead)::after { content: ''; }
body.theme-lcars :is(h2.page-subhead, .page-subhead)::before { flex: 0 0 14px; height: 0.5em; background: var(--lcars-frame); border-radius: var(--lcars-pill) 0 0 var(--lcars-pill); }
body.theme-lcars :is(h2.page-subhead, .page-subhead)::after { flex: 1 1 0; min-width: 30px; height: 1px; background: var(--sp-line-strong); }
:where(body.theme-lcars) h3 { letter-spacing: 0.04em; }
:where(body.theme-lcars) legend, :where(body.theme-lcars) kbd { font-size: 0.9rem; letter-spacing: 0.08em; }

/* ---- 8g. components ---- */
/* panels: the shared card (surface, 1px line, --sp-radius corners); the header
   is a dark frame-tone band with bright condensed capitals */
:where(body.theme-lcars) .card-header,
:where(body.theme-lcars) .panel-header {
    min-height: 30px;
    margin: 0 0 12px;
    padding: 6px 12px 5px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.25;
    color: var(--lcars-block-text);
    background: var(--lcars-frame-dk);
    border: 0;
    border-radius: var(--sp-radius-sm);
}
:where(body.theme-lcars) .card-header a, :where(body.theme-lcars) .panel-header a { color: inherit; text-decoration: underline; }

/* buttons: solid pills (40px tall), condensed capitals, no borders; primary in the action colour */
:where(body.theme-lcars) button,
:where(body.theme-lcars) .btn,
:where(body.theme-lcars) input[type=submit],
:where(body.theme-lcars) input[type=button],
:where(body.theme-lcars) input[type=reset],
:where(body.theme-lcars) input.button-sec {
    padding: 11px 20px 10px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) button:hover,
:where(body.theme-lcars) .btn:hover,
:where(body.theme-lcars) input[type=submit]:hover,
:where(body.theme-lcars) input[type=button]:hover,
:where(body.theme-lcars) input[type=reset]:hover,
:where(body.theme-lcars) input.button-sec:hover {
    color: var(--lcars-ink);
    background-color: var(--lcars-frame-lt);
    border-color: transparent;
}
:where(body.theme-lcars) .btn-primary,
:where(body.theme-lcars) button.button-main,
:where(body.theme-lcars) input.button-main { color: var(--lcars-ink); background: var(--lcars-action); border: 0; }
:where(body.theme-lcars) .btn-primary:hover,
:where(body.theme-lcars) button.button-main:hover,
:where(body.theme-lcars) input.button-main:hover { color: var(--lcars-ink); background: var(--lcars-warm); box-shadow: none; }
:where(body.theme-lcars) .btn-success { color: var(--lcars-ink); background: var(--sp-success); border: 0; }
:where(body.theme-lcars) .btn-success:hover { color: var(--lcars-ink); background: #6fe0b9; }
:where(body.theme-lcars) .btn-danger { color: var(--lcars-ink); background: var(--lc-red); border: 0; }
:where(body.theme-lcars) .btn-danger:hover { color: var(--lcars-ink); background: var(--sp-danger); }
:where(body.theme-lcars) .btn-sm,
:where(body.theme-lcars) button.button-small,
:where(body.theme-lcars) button.button-sec { padding: 6px 14px 5px; font-size: 0.85rem; }
:where(body.theme-lcars) input[type=file]::file-selector-button {
    padding: 6px 16px 5px;
    font: 600 0.9rem var(--sp-font-display);
    color: var(--lcars-ink);
    background: var(--lcars-frame);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .btn-reaction { font-size: 0.9rem; }

/* fields: dark wells with the shared solid line (base rules); the focus ring is the frame */
:where(body.theme-lcars) .form-group label { font-size: 0.92rem; }

/* tables: a dark frame-tone head row, a hairline under each row */
:where(body.theme-lcars) th {
    padding: 7px 12px 6px;
    vertical-align: middle;
    font-size: 0.92rem;
    color: var(--lcars-block-text);
    background: var(--lcars-frame-dk);
    border-bottom: 0;
}
:where(body.theme-lcars) th a { color: inherit; }
:where(body.theme-lcars) td { border-bottom-color: var(--sp-line); }

/* post cards, list rows, tag chips: in components.css (it loads after this file) */

/* flash messages: a status-colour edge on the left */
:where(body.theme-lcars) .flash-success, :where(body.theme-lcars) .flash-error,
:where(body.theme-lcars) .flash-info, :where(body.theme-lcars) .alert {
    border-left-width: 6px;
    border-radius: var(--sp-radius);
}

/* badges and filter pills: solid pills with dark ink */
:where(body.theme-lcars) .badge {
    padding: 2px 10px 1px;
    font-size: 0.78rem;
    color: var(--lcars-ink);
    background: var(--lcars-second);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .badge-gray   { color: var(--lcars-ink); background: var(--sp-text-dim); }
:where(body.theme-lcars) .badge-purple { color: var(--lcars-ink); background: var(--lcars-frame-lt); }
:where(body.theme-lcars) .badge-green  { color: var(--lcars-ink); background: var(--sp-success); }
:where(body.theme-lcars) .badge-red    { color: var(--lcars-ink); background: var(--sp-danger); }
:where(body.theme-lcars) .badge-yellow, :where(body.theme-lcars) .badge-warning { color: var(--lcars-ink); background: var(--sp-warning); }
:where(body.theme-lcars) a.pill, :where(body.theme-lcars) .pill {
    padding: 3px 14px 2px;
    font-size: 0.85rem;
    color: var(--lcars-block-text);
    background: var(--lcars-frame-dk);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) a.pill:hover { color: var(--lcars-ink); background: var(--lcars-frame); }
:where(body.theme-lcars) a.pill.active, :where(body.theme-lcars) a.pill-active, :where(body.theme-lcars) .pill.active { color: var(--lcars-ink); background: var(--lcars-action); }

/* pagination: pills */
:where(body.theme-lcars) .pagination li > a, :where(body.theme-lcars) .pagination li > span,
:where(body.theme-lcars) .pagination .page-link {
    font-family: var(--sp-font-display);
    font-size: 0.95rem;
    color: var(--lcars-block-text);
    background: var(--lcars-frame-dk);
    border: 0;
    border-radius: var(--lcars-pill);
}
:where(body.theme-lcars) .pagination li > a:hover { color: var(--lcars-ink); background: var(--lcars-frame); }
:where(body.theme-lcars) .pagination .active > span,
:where(body.theme-lcars) .pagination .active .page-link { color: var(--lcars-ink); background: var(--lcars-action); }

/* stat bar: warm readout numbers on the shared panel */
:where(body.theme-lcars) .stat-number { color: var(--lcars-warm); font-size: 1.9rem; }

:where(body.theme-lcars) blockquote { border-left: 4px solid var(--lcars-frame); border-radius: 0; background: rgba(var(--pp-rgb),0.06); }
:where(body.theme-lcars) .sp-kicker { font-size: 0.86rem; color: var(--lcars-second); }

/* footer: plain page colour under the frame */
body.theme-lcars .sp-footer { background: var(--sp-bg); border-top: 0; }
body.theme-lcars .sp-footer__credit strong { font-family: var(--sp-font-display); letter-spacing: 0.06em; color: var(--lcars-frame-lt); }

/* ---- 8h. narrow screens ---- */
/* main menu dropdown: a page-colour panel with a frame column; links are dark blocks */
@media (max-width: 1100px) {
    body.theme-lcars .sp-header__menu { margin-left: 0; }
    body.theme-lcars .sp-header__account { margin-left: auto; }
    body.theme-lcars .sp-topbar {
        top: calc(100% + 6px);
        padding: 10px 10px 10px 26px;
        background: var(--sp-bg);
        border: 1px solid var(--sp-line-strong);
        border-left: 16px solid var(--lcars-frame);
        border-radius: 24px 0 0 24px;
    }
    body.theme-lcars .sp-topnav__list { gap: var(--lcars-gap); }
    body.theme-lcars .sp-topnav__link {
        justify-content: flex-end;
        padding: 10px 14px 6px;
        font-size: 1.05rem;
        letter-spacing: 0.08em;
        color: var(--lcars-block-text);
        background: var(--lcars-frame-dk);
        border-radius: 0;
    }
    body.theme-lcars .sp-topnav__link::after { display: none; }
    body.theme-lcars .sp-topnav__link:hover { color: var(--lcars-ink); background: var(--lcars-frame); }
    body.theme-lcars .sp-topnav__list > li > .sp-topnav__link.active { color: var(--lcars-ink); background: var(--lcars-action); }
    body.theme-lcars .sp-topbar .sp-account { border-top: 0; }
}

/* below 900px: no elbow; the header becomes a compact pill row over a
   full-width thin bar, and the rail is the drawer */
@media (max-width: 900px) {
    body.theme-lcars { --sp-header-h: 64px; --lcars-hbar: 8px; }
    body.theme-lcars .sp-header__inner { align-items: center; padding-bottom: calc(var(--lcars-hbar) + 6px); }
    body.theme-lcars .sp-brand {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 40px;
        min-height: 0;
        padding: 0 18px 0 16px;
    }
    body.theme-lcars .sp-brand__name { font-size: 1.15rem; }
    body.theme-lcars .sp-main { padding-top: 16px; }
    body.theme-lcars .sp-rail { padding: 0 12px 40px; background: var(--sp-bg); border-right: 6px solid var(--lcars-frame); }
    body.theme-lcars .sp-rail__head { background: var(--sp-bg); border-bottom: 0; margin-bottom: var(--lcars-gap); }
    body.theme-lcars .sp-rail__title { font-size: 1rem; letter-spacing: 0.12em; color: var(--lcars-frame-lt); }
    body.theme-lcars .sp-rail__nav a { padding: 10px 14px 6px; font-size: 1.05rem; }
    body.theme-lcars .sp-rail__cap--top { border-radius: 18px 0 0 0; }
    body.theme-lcars .sp-rail__cap--bottom { height: 24px; }
    body.theme-lcars .sp-masthead__cap--start { flex-basis: 30px; border-radius: 22px 0 0 22px; }
    body.theme-lcars .sp-masthead__cap--end { flex-basis: 18px; }
    body.theme-lcars .sp-masthead__frame { border-top-width: 4px; border-bottom-width: 4px; }
}
@media (max-width: 640px) {
    body.theme-lcars { --sp-header-h: 60px; }
    body.theme-lcars .sp-header__inner { gap: 6px; }
    body.theme-lcars .sp-brand { height: 36px; padding: 0 14px 0 12px; gap: 8px; }
    body.theme-lcars .sp-brand__name { font-size: 1.05rem; }
    body.theme-lcars { --sp-hdr-btn-w: 46px; --sp-hdr-btn-h: 34px; }
    body.theme-lcars .sp-iconbtn { width: 46px; height: 34px; }
    body.theme-lcars .sp-header__seg--3 { flex-basis: 40px; }
    body.theme-lcars :is(h1.page-head, .page-head) { gap: 10px; font-size: 1.6rem !important; }
    body.theme-lcars :is(h1.page-head, .page-head)::before { flex-basis: 18px; }
}

@media (max-width: 400px) {
    body.theme-lcars { --sp-hdr-btn-w: 40px; --sp-hdr-btn-h: 34px; }
    body.theme-lcars .sp-iconbtn { width: 40px; }
}

/* ---- 8i. header emblem (Emblem size, section 7) ----
   Wide screens: the emblem sits in the frame-colour brand block, which
   grows a little for a large one (it stays inside the header); the name
   steps down a size to make room. Narrow screens: the brand pill grows a
   little for a medium or large emblem, staying inside the header. */
body.theme-lcars .sp-brand { --sp-emblem-max: 38px; }
body.theme-lcars .sp-brand--emblem-medium .sp-brand__name { font-size: 1.25rem; }
body.theme-lcars .sp-brand--emblem-large { padding-left: 22px; gap: 8px; --sp-emblem-max: 46px; }
body.theme-lcars .sp-brand--emblem-large .sp-brand__name { font-size: 1.15rem; }
@media (max-width: 900px) {
    body.theme-lcars .sp-brand { --sp-emblem-max: 32px; }
    body.theme-lcars .sp-brand--emblem-medium { height: 44px; --sp-emblem-max: 36px; }
    body.theme-lcars .sp-brand--emblem-large { height: 46px; padding-left: 16px; gap: 10px; --sp-emblem-max: 38px; }
    body.theme-lcars :is(.sp-brand--emblem-medium, .sp-brand--emblem-large) .sp-brand__name { font-size: 1.15rem; }
}
@media (max-width: 640px) {
    body.theme-lcars .sp-brand { --sp-emblem-max: 28px; }
    body.theme-lcars .sp-brand--emblem-medium { height: 40px; --sp-emblem-max: 32px; }
    body.theme-lcars .sp-brand--emblem-large { height: 42px; padding-left: 12px; gap: 8px; --sp-emblem-max: 34px; }
    body.theme-lcars :is(.sp-brand--emblem-medium, .sp-brand--emblem-large) .sp-brand__name { font-size: 1.05rem; }
}


/* =====================================================================
   9. LIGHT MODE
   A theme may draw a light and a dark version; the reader then picks one
   with the Light / Dark / Auto menu (App\Support\ColorMode). The head script
   sets <html data-mode="light|dark"> before the first paint, so these rules
   apply from the start. A theme's light palette sits under
     html[data-mode="light"] body.theme-<key> { ...tokens... }
   at the end of its own stylesheet (a Theme Builder theme gets one made
   from its colours, App\Support\ThemeModes) and lists both in 'modes'.

   Light-mode token roles (same names as dark, different jobs on a light page):
     --pp, --pp-lt     accent TEXT colours (dark enough for 4.5:1 on cards);
                       --pp is also the accent fill under --pp-ink
     --pp-ink          text on an accent fill (light)
     --pp-dk           the softer accent (edges, bars)
     --pp-bg           a pale accent tint
     --lc-*            the theme's colour BLOCKS (fills, bars, frames): they
                       stay bright, with dark ink on them
     --sp-link, --sp-link-hi   link text and its hover
     --sp-label        labels, legends and section titles
     --sp-label-2      table heads, rail section labels, card headers
     --sp-mark         short accent words (stat numbers, kickers, codes)
   9b re-points the base rules that colour TEXT with an --lc-* block colour
   to these text tokens, with :where() so no theme or view rule is beaten
   by specificity it did not have before.

   Contrast (WCAG): body text >= 4.5:1, large text / UI >= 3:1 in both
   modes (scratchpad tool modes_contrast.py reads the token blocks).
   ===================================================================== */

/* ---- 9a. root ----
   A theme that draws both modes sets its own light tokens (above). Only the
   browser's own controls are switched here. (No built-in theme has a light
   palette yet: a theme with one mode gets no data-mode at all, so nothing in
   this section touches it.) */
html[data-mode="light"] { color-scheme: light; }
/* "Boost contrast" in light mode: deeper ink and lines (accessibility.css
   forces near-white text for the dark pages; here it is near-black) */
html.a11y-contrast[data-mode="light"] {
    --sp-text:        #000000;
    --sp-text-dim:    #3a3026;
    --sp-line:        rgba(60,38,12,0.32);
    --sp-line-strong: rgba(60,38,12,0.52);
}
/* the text token, not a literal black: a look whose light mode keeps dark panels sets its own --sp-text (body.theme-x) and the text
   follows it; a light page still gets the #000 above (30 Nov sweep: #000 on dark panels, 1.1:1) */
html.a11y-contrast[data-mode="light"] :is(.post-content-wrap, .bio-section, .sp-main p, .sp-main li, .sp-main td) { color: var(--sp-text) !important; }

/* ---- 9b. shared re-points: text that used a colour-block token ---- */
:where(html[data-mode="light"]) a { color: var(--sp-link); }
:where(html[data-mode="light"]) a:hover { color: var(--sp-link-hi); }
:where(html[data-mode="light"]) .sp-footer a { color: var(--sp-text); }
:where(html[data-mode="light"]) .sp-footer a:hover { color: var(--sp-link-hi); }
:where(html[data-mode="light"]) .blue { color: var(--sp-link); }
/* a link inside a tinted notice (flash message, alert, the Security check notice) reads in the notice's own text colour, underlined:
   the look's link colour is chosen for the plain page and drops under 4.5:1 on a tinted notice in light mode. */
html[data-mode="light"] :is(.flash-success, .flash-error, .flash-info, .alert) a:not(.btn),
html[data-mode="light"] :is(.flash-success, .flash-error, .flash-info, .alert) a:not(.btn):hover { color: var(--sp-text-hi); text-decoration: underline; }
/* a button inside a notice keeps its own text-and-background pair (set together by its button style); only plain links take the notice's text colour,
   so the button text is never forced onto a button background it was not paired with. */
html[data-mode="light"] :is(.flash-success, .flash-error, .flash-info, .alert) a.btn { text-decoration: none; }
:where(html[data-mode="light"]) legend { color: var(--sp-label); }
:where(html[data-mode="light"]) kbd { color: var(--sp-label); }
:where(html[data-mode="light"]) .form-group label { color: var(--sp-label); }
:where(html[data-mode="light"]) h2.page-subhead, :where(html[data-mode="light"]) .page-subhead { color: var(--sp-label); }
/* the danger heading keeps the look's heading text colour (a look can lay a coloured plate behind section headings: red text on it fell to 3.2:1); the danger cue is the edge */
.page-subhead--danger { padding-left: 0.6em; border-left: 4px solid var(--sp-danger); }
:where(html[data-mode="light"]) th { color: var(--sp-label-2); }
:where(html[data-mode="light"]) .nav-label { color: var(--sp-label-2); }
:where(html[data-mode="light"]) .card-header, :where(html[data-mode="light"]) .panel-header { color: var(--sp-label-2); }
:where(html[data-mode="light"]) .eg code { color: var(--sp-mark); }
:where(html[data-mode="light"]) .sp-footer__legal { color: var(--sp-text); }   /* the footer can sit over a darker band on phones: use the body text colour, which every look keeps at 4.5:1 or better */
:where(html[data-mode="light"]) input::placeholder, :where(html[data-mode="light"]) textarea::placeholder { color: var(--sp-text-dim); opacity: 0.85; }
:where(html[data-mode="light"]) tr:nth-child(even) td, :where(html[data-mode="light"]) tr.alt td { background: rgba(0,0,0,0.025); }
:where(html[data-mode="light"]) .sp-scrim { background: rgba(30,22,12,0.45); }
/* status buttons and badges: dark text on their pale tint */
:where(html[data-mode="light"]) .btn-success { color: var(--sp-success); }
:where(html[data-mode="light"]) .btn-success:hover { color: var(--sp-text-hi); }
:where(html[data-mode="light"]) .btn-danger { color: var(--sp-danger); }
:where(html[data-mode="light"]) .btn-danger:hover { color: var(--sp-text-hi); }
:where(html[data-mode="light"]) .badge-green { color: var(--sp-success); }
:where(html[data-mode="light"]) .badge-red { color: var(--sp-danger); }
:where(html[data-mode="light"]) .badge-yellow, :where(html[data-mode="light"]) .badge-warning { color: var(--sp-warning); }
:where(html[data-mode="light"]) a.edit:hover { color: var(--sp-warning); }
/* department colours: the same hues, deep enough to read on a light page */
:where(html[data-mode="light"]) .dept-header[data-dept*="command"]     { --dept-c: #8a6500; }
:where(html[data-mode="light"]) .dept-header[data-dept="navigation"],
:where(html[data-mode="light"]) .dept-header[data-dept*="helm"]        { --dept-c: #b3271a; }
:where(html[data-mode="light"]) .dept-header[data-dept*="tactical"],
:where(html[data-mode="light"]) .dept-header[data-dept*="security"],
:where(html[data-mode="light"]) .dept-header[data-dept*="weapon"],
:where(html[data-mode="light"]) .dept-header[data-dept*="combat"]      { --dept-c: #4b5361; }
:where(html[data-mode="light"]) .dept-header[data-dept*="engineering"],
:where(html[data-mode="light"]) .dept-header[data-dept*="operations"],
:where(html[data-mode="light"]) .dept-header[data-dept*="systems"]     { --dept-c: #7d5d00; }
:where(html[data-mode="light"]) .dept-header[data-dept*="science"]     { --dept-c: #00756a; }
:where(html[data-mode="light"]) .dept-header[data-dept*="medical"],
:where(html[data-mode="light"]) .dept-header[data-dept*="counsel"]     { --dept-c: #3d4654; }
:where(html[data-mode="light"]) .dept-header[data-dept*="general"],
:where(html[data-mode="light"]) .dept-header[data-dept*="crew"]        { --dept-c: #8a4b17; }
/* softer shadows on a light page */
:where(html[data-mode="light"]) .sp-dd__menu { box-shadow: 0 14px 32px rgba(40,28,12,0.18); }

/* ---- 9c. LCARS construction in light mode (a two-mode theme built on LCARS) ----
   The blocks keep bright fills with dark ink; the gaps between them take
   the page colour. In light mode --pp is a text colour, so the frame takes
   the accent's block colour (--lc-orange, App\Support\ThemeCss) and the
   dark menu blocks take a bright block colour instead. */
html[data-mode="light"] body.theme-lcars {
    --lcars-ink:        #120b02;
    --lcars-frame:      var(--lc-orange);
    --lcars-frame-lt:   var(--lc-blue);
    --lcars-frame-dk:   var(--lc-violet);
    --lcars-block-text: var(--lcars-ink);
}
html[data-mode="light"] body.theme-lcars :is(.sp-masthead__tag, .sp-footer__credit strong, .sp-rail__title) { color: var(--sp-mark); }
html[data-mode="light"] body.theme-lcars .sp-kicker { color: var(--sp-label-2); }
html[data-mode="light"] body.theme-lcars .menu-filter__status { color: var(--sp-label); }
html[data-mode="light"] body.theme-lcars :is(h1.page-head, .page-head) { color: var(--pp); }
html[data-mode="light"] body.theme-lcars :is(h2.page-subhead, .page-subhead) { color: var(--sp-label); }
:where(html[data-mode="light"] body.theme-lcars) .stat-number { color: var(--sp-mark); }
:where(html[data-mode="light"] body.theme-lcars) .btn-success { color: var(--lcars-ink); background: #43c99a; }
:where(html[data-mode="light"] body.theme-lcars) .btn-success:hover { color: var(--lcars-ink); background: #6fe0b9; }
:where(html[data-mode="light"] body.theme-lcars) .btn-danger { color: var(--lcars-ink); background: #ee8a86; }
:where(html[data-mode="light"] body.theme-lcars) .btn-danger:hover { color: var(--lcars-ink); background: #ee8a86; }
:where(html[data-mode="light"] body.theme-lcars) .badge-gray { color: var(--lcars-ink); background: #c9c0b2; }
:where(html[data-mode="light"] body.theme-lcars) .badge-green { color: var(--lcars-ink); background: #6fd9b2; }
:where(html[data-mode="light"] body.theme-lcars) .badge-red { color: var(--lcars-ink); background: #f09390; }
:where(html[data-mode="light"] body.theme-lcars) :is(.badge-yellow, .badge-warning) { color: var(--lcars-ink); background: #f7d25a; }

/* ---- 9d. text over pictures ----
   The banner (the theme's own art or a sim's upload) stays as it is in both modes;
   the sim's name written over it keeps the dark mode's light lettering. */
html[data-mode="light"] .sp-masthead {
    --sp-text-hi:  #fff8ee;
    --sp-text:     #f3e3cf;
    --sp-text-dim: #dccbb4;
    --sp-mark:     #ffb04a;
}

/* ---- 9e. views: colours written into a page's own <style> ----
   (a view's <style> comes after this file, so these carry html[data-mode] specificity) */
html[data-mode="light"] .main-mission-banner-season { color: var(--sp-label); }
html[data-mode="light"] .main-mission-banner-label { color: var(--sp-text-dim); }
/* inline style="color:var(--lc-...)": a colour block used as text */
:where(html[data-mode="light"]) :is([style*="color:var(--lc-violet)"], [style*="color: var(--lc-violet)"], [style*="color:var(--lc-lilac)"], [style*="color: var(--lc-lilac)"]):not([style*="background-color:var(--lc-"]) { color: var(--sp-label-2) !important; }
:where(html[data-mode="light"]) :is([style*="color:var(--lc-gold)"], [style*="color: var(--lc-gold)"], [style*="color:var(--lc-orange)"], [style*="color: var(--lc-orange)"], [style*="color:var(--lc-peach)"]):not([style*="background-color:var(--lc-"]) { color: var(--sp-mark) !important; }
:where(html[data-mode="light"]) :is([style*="color:var(--lc-tan)"], [style*="color: var(--lc-tan)"]):not([style*="background-color:var(--lc-"]) { color: var(--sp-label) !important; }
:where(html[data-mode="light"]) :is([style*="color:var(--lc-blue)"], [style*="color: var(--lc-blue)"]):not([style*="background-color:var(--lc-"]) { color: var(--sp-link) !important; }

/* LCARS: table heads, card headers and rail labels are colour blocks with ink (9b's
   text re-points are for the other themes' plain heads) */
:where(html[data-mode="light"] body.theme-lcars) th,
:where(html[data-mode="light"] body.theme-lcars) .card-header,
:where(html[data-mode="light"] body.theme-lcars) .panel-header { color: var(--lcars-ink); }
/* the dark ink is laid on these two colour blocks; a look whose violet or link colour is dark in the light version (they are text colours there) would give dark on dark:
   40% white lifts such a block so the ink reads 4.5:1, a block that is already bright only gets paler by a little */
:where(html[data-mode="light"] body.theme-lcars) :is(.card-header, .panel-header, th) { background: color-mix(in srgb, var(--lcars-frame-dk) 60%, #ffffff); }
:where(html[data-mode="light"] body.theme-lcars) .badge-purple { background: color-mix(in srgb, var(--lcars-frame-lt) 60%, #ffffff); }
