/* ============================================================================
   SpaceFace · MENU FASCIA — title / pause / system-menu surfaces.

   RETIRING (2026-09-10): this file is the old "quiet neutral plate" skin. The visual
   rules that used to sit here (no glow, no gradient, no accent rails) are VOID — see
   design/frontend/direction/FIELD_HARDWARE_PROGRAM.md; every screen migrates to the
   asset-built kit and this stylesheet is deleted in packet P42. Do not add rules here.

   Key Architectural Rules:
   - Stable geometry for multi-tab consoles (Settings, Codex, Help, Save/Load).
     The outer chassis remains fixed in place while inner panes scroll smoothly.
   - Aerospace tactile controls: physical toggles, responsive slider thumbs,
     crisp keycap slots, and telemetry readouts.
   - Motion only where a state changes (LATCH <= 90 ms, SETTLE <= 180 ms): tab
     cross-fade and button press. Nothing loops.
   ============================================================================ */

/* ---- 1. Token remap: intro-signal values under the menu scope --------------- */

.screen.sf-menu {
  /* surfaces + lines (deep blue-black, hairlines) */
  --panel: #0b0f15;
  --panel-2: #10151d;
  --panel-edge: rgba(148, 178, 205, .16);
  --panel-edge-2: rgba(148, 178, 205, .30);
  /* ink (cool) */
  --ink: #e9eff4;
  --ink-dim: #a9b8c4;
  --ink-mute: #71828f;
  /* accent: one signal cyan, pale variants for secondary marks */
  --accent: #4f8fdd;
  --accent-2: #7fb3e6;
  --accent-3: #4f8fdd;
  --good: #5fc98f;
  --warn: #dfa04e;
  --danger: #e0665f;
  /* type */
  --mono: "Instrument Sans", "Segoe UI", system-ui, sans-serif; /* no monospace as a look (sheet §3); numerals are tabular */
  --mf-display: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mf-ui: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  /* fascia-only aliases */
  --mf-line-1: rgba(148, 178, 205, .10);
  --mf-line-2: rgba(148, 178, 205, .18);
  --mf-line-3: rgba(148, 178, 205, .32);
  --mf-ink-3: #5a6b78;
  --mf-stamp: #66778a;
  --mf-worklight-dim: rgba(78, 195, 230, .08);
}

/* ---- 2. The plate ------------------------------------------------------------
   A precision instrument chassis: deep aerospace backing, subtle backdrop blur,
   machined highlight trace along the top bezel, and rock-solid geometry. */

.screen.sf-menu {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 28px 20px;
  min-width: 360px;
  max-width: min(94vw, 1120px);
  max-height: 90vh;
  box-sizing: border-box;
  pointer-events: auto;
  font-family: var(--mf-ui);
  color: var(--ink);
  /* One flat surface (no blur stack, no inset highlight): the world behind a pause plate stays
     legible as a dimmed frame instead of smearing into a frosted card. */
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--mf-line-2);
  border-radius: 6px;
  box-shadow: none;
  /* max-height alone only promised to cap the panel; with no overflow the list simply drew past its
     own border and off the screen. On a 1152x720 laptop the Pause menu's last entry — MAIN MENU —
     was 18px below the viewport with nothing able to scroll to it, so a player could not quit to
     the main menu at all. The panel now holds its bounds and the list scrolls inside it. */
  overflow: hidden;
}
.screen.sf-menu > .sf-col {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The diegetic corner stamp ("MISSION CONTROL / STANDBY", "FLIGHT RECORDER / SAVE-LOAD") is
   flavour chrome the grammar bans (section 9). Screens still set data-stamp -- a route check reads
   the attribute to find a plate -- but nothing renders it. The top-edge accent sweep went with it: a
   0.4s decorative animation with no state variable behind it. */
.screen.sf-menu::before,
.screen.sf-menu::after { content: none; display: none; }

/* Width & layout variants.
   sf-menu-wide uses stable, non-jumping geometry across all tabs. */
.screen.sf-menu.sf-menu-narrow { min-width: 320px; width: 380px; }
.screen.sf-menu.sf-menu-wide {
  width: min(94vw, 1100px);
  height: min(88vh, 860px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- 3. Headings --------------------------------------------------------------
   Caps over a hairline divider. */

#screens .sf-menu h1 {
  margin: 4px 0 2px;
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mf-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink);
  text-shadow: none;
  border-bottom: 1px solid var(--mf-line-1);
}
#screens .sf-menu h1::before { content: none; }
#screens .sf-menu .sf-ng-header h1 { border-bottom: 0; padding-bottom: 0; }

.screen.sf-menu h2 {
  margin: 14px 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mf-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.screen.sf-menu h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--mf-line-2), transparent);
}

/* ---- 4. Buttons & Interactive Controls ----------------------------------------
   Ledger rows and action buttons with micro-spring tactile physics. */

.screen.sf-menu button.sf-btn {
  position: relative;
  width: 100%;
  padding: 10px 14px 10px 28px;
  font-family: var(--mf-ui);
  font-weight: 500;
  font-size: 12px;
  letter-spacing:.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--mf-line-1);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease, transform .08s ease;
}
.screen.sf-menu button.sf-btn::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 10px;
  height: 2px;
  transform: translateY(-50%);
  background: #45545f;
  transition: background .12s ease, width .12s ease;
}
.screen.sf-menu button.sf-btn:hover:not(:disabled) {
  color: var(--ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 68%);
  border-bottom-color: var(--mf-line-2);
}
.screen.sf-menu button.sf-btn:hover:not(:disabled)::before,
.screen.sf-menu button.sf-btn:focus-visible::before {
  width: 15px;
  background: var(--accent);
}
.screen.sf-menu button.sf-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  color: var(--ink);
}
.screen.sf-menu button.sf-btn:active:not(:disabled) {
  translate: 0 1px;
}
.screen.sf-menu button.sf-btn:disabled { opacity: .38; cursor: default; }

.screen.sf-menu .sf-foot button.sf-btn {
  border-bottom-color: transparent;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  border: 1px solid var(--mf-line-2);
  border-radius: 3px;
  padding: 8px 18px 8px 24px;
}
.screen.sf-menu .sf-foot button.sf-btn:hover:not(:disabled) {
  background: rgba(18, 26, 38, .85);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.screen.sf-menu .sf-foot button.sf-btn:active:not(:disabled) {
  translate: 0 1px;
}

/* Primary action (Continue / Resume / Launch): the one flat accent fill on the plate. */
.screen.sf-menu button.sf-btn--primary {
  background: var(--accent);
  border-bottom-color: transparent;
  border-radius: 3px;
  color: var(--bg);
  font-weight: 600;
}
.screen.sf-menu button.sf-btn--primary::before { background: color-mix(in srgb, var(--bg) 45%, transparent); }
.screen.sf-menu button.sf-btn--primary:hover:not(:disabled),
.screen.sf-menu button.sf-btn--primary:focus-visible {
  background: color-mix(in srgb, var(--accent) 84%, white);
  color: var(--bg);
}
.screen.sf-menu button.sf-btn--primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.screen.sf-menu button.sf-btn--primary:hover:not(:disabled)::before,
.screen.sf-menu button.sf-btn--primary:focus-visible::before { background: color-mix(in srgb, var(--bg) 60%, transparent); width: 10px; }

/* Destructive action: quiet red text + hairline. */
.screen.sf-menu button.sf-btn--danger {
  color: #e39892;
  border-bottom-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
.screen.sf-menu button.sf-btn--danger::before { background: color-mix(in srgb, var(--danger) 50%, transparent); }
.screen.sf-menu button.sf-btn--danger:hover:not(:disabled),
.screen.sf-menu button.sf-btn--danger:focus-visible {
  color: #f0b6b1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 8%, transparent), transparent 68%);
  border-bottom-color: color-mix(in srgb, var(--danger) 45%, transparent);
}
.screen.sf-menu button.sf-btn--danger:focus-visible { outline-color: var(--danger); }

/* ---- 5. Layout Primitives & Form Controls --------------------------------------
   Settings rows, sliders, dropdowns, and tab strips. */

.screen.sf-menu .sf-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid var(--mf-line-1);
}
.screen.sf-menu .sf-col > button.sf-btn:last-child { border-bottom-color: transparent; }

/* Dedicated scroll container for multi-tab consoles (Settings, Codex, Help). */
.screen.sf-menu .sf-settings-pane,
.screen.sf-menu #sf-settings-pane {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  margin-top: 4px;
  margin-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 35%, transparent) color-mix(in srgb, var(--panel) 60%, transparent);
  border-bottom: 0;
}

/* Scroll-edge shadows: a clipped last row read as a broken layout on Settings, Help, Codex and the
   Crucible door. The cover gradients scroll with the content (attachment: local) and reveal a fixed
   shadow only while there is more to scroll in that direction -- pure CSS, no listener, no rAF. */
.screen.sf-menu .sf-settings-pane,
.screen.sf-menu #sf-settings-pane,
.screen.sf-menu > .sf-col {
  --sf-scroll-cover: color-mix(in srgb, var(--panel) 96%, transparent);
  background:
    linear-gradient(var(--sf-scroll-cover) 40%, transparent) center top / 100% 30px no-repeat local,
    linear-gradient(transparent, var(--sf-scroll-cover) 60%) center bottom / 100% 30px no-repeat local,
    linear-gradient(rgba(0, 0, 0, .55), transparent) center top / 100% 12px no-repeat scroll,
    linear-gradient(transparent, rgba(0, 0, 0, .55)) center bottom / 100% 12px no-repeat scroll;
}

/* Thin plate scrollbar. */
.screen.sf-menu ::-webkit-scrollbar { width: 6px; }
.screen.sf-menu ::-webkit-scrollbar-track { background: color-mix(in srgb, var(--panel) 60%, transparent); border-radius: 3px; }
.screen.sf-menu ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 3px; }
.screen.sf-menu ::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 60%, transparent); }

/* Settings row: modular aerospace instrument pod. */
.screen.sf-menu .sf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  margin-bottom: 5px;
  background: color-mix(in srgb, var(--panel-2) 50%, transparent);
  border: 1px solid rgba(148, 178, 205, .08);
  border-radius: 4px;
  box-sizing: border-box;
  transition: background-color .12s ease, border-color .12s ease;
}
.screen.sf-menu .sf-row:hover {
  background: color-mix(in srgb, var(--panel-2) 75%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}
.screen.sf-menu .sf-row > label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  flex: 0 0 38%;
  letter-spacing: .02em;
}

/* Sliders: aerospace glowing track and metallic thumb. */
.screen.sf-menu input[type=range] {
  flex: 1;
  height: 24px;
  accent-color: var(--accent);
  cursor: pointer;
  touch-action: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.screen.sf-menu input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 60%, transparent) var(--sf-range-fill, 0%),
    color-mix(in srgb, var(--panel) 90%, transparent) var(--sf-range-fill, 0%));
  border: 1px solid rgba(148, 178, 205, .2);
  box-shadow: none;
}
.screen.sf-menu input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 3px;
  background: var(--accent);
  border: 1px solid var(--bg);
  cursor: grab;
  transition: transform .12s ease, background-color .12s ease;
}
.screen.sf-menu input[type=range]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  background: color-mix(in srgb, var(--accent) 84%, white);
}
.screen.sf-menu input[type=range]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  background: var(--ink);
}
.screen.sf-menu input[type=range]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border: 1px solid rgba(148, 178, 205, .2);
}
.screen.sf-menu input[type=range]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 60%, transparent);
}
.screen.sf-menu input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--accent);
  border: 1px solid var(--bg);
}

/* Precision inputs and selects. */
.screen.sf-menu select,
.screen.sf-menu input[type=text],
.screen.sf-menu input[type=number] {
  font-family: var(--mf-ui);
  font-size: 13px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  border: 1px solid var(--mf-line-2);
  border-radius: 3px;
  padding: 6px 12px;
  pointer-events: auto;
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.screen.sf-menu select:hover,
.screen.sf-menu input[type=text]:hover,
.screen.sf-menu input[type=number]:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--sf-surface) 95%, transparent);
}
.screen.sf-menu select:focus-visible,
.screen.sf-menu input[type=text]:focus-visible,
.screen.sf-menu input[type=number]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Numeric readout: DATA face, plain ink -- a percentage is a value, not a state. */
.screen.sf-menu input[type=number] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.screen.sf-menu .sf-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--mf-line-1);
}
.screen.sf-menu .sf-muted { color: var(--ink-mute); font-size: 12px; line-height: 1.5; }

/* Tabs (Settings / Help / Codex): console function selectors. */
.screen.sf-menu .sf-tabbar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--mf-line-1);
  padding-bottom: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.screen.sf-menu button.sf-tab {
  font-family: var(--mf-ui);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  border: 1px solid var(--mf-line-2);
  border-radius: 3px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease, transform .08s ease;
}
.screen.sf-menu button.sf-tab:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: rgba(18, 26, 38, .85);
}
.screen.sf-menu button.sf-tab:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  color: var(--ink);
}
.screen.sf-menu button.sf-tab:active {
  translate: 0 1px;
}
.screen.sf-menu button.sf-tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
/* An ON/OFF toggle is a control state, not a disabled one: keep OFF legible
   (the tab-strip default --ink-mute read as a dead button in Settings/Access). */
.screen.sf-menu button.sf-tab[aria-pressed="false"] {
  color: var(--ink-dim);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
}

/* Slots (pause flight brief, save slots, help cards): readout cards. */
.screen.sf-menu .sf-slot {
  display: flex;
  flex-shrink: 0; /* a constrained list scrolls; it never crushes a row into its neighbour */
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--panel) 65%, transparent);
  border: 1px solid var(--mf-line-2);
  border-radius: 4px;
  margin-bottom: 6px;
  box-sizing: border-box;
  transition: background-color .15s ease, border-color .15s ease;
}
.screen.sf-menu .sf-slot:hover {
  background: color-mix(in srgb, var(--panel-2) 85%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.screen.sf-menu .sf-slot.sel {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--panel-2) 90%, transparent);
}
.screen.sf-menu .sf-slot.empty {
  background: color-mix(in srgb, var(--panel) 35%, transparent);
  border-style: dashed;
  border-color: var(--mf-line-1);
}
.screen.sf-menu .sf-slot.empty:hover {
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
  border-color: var(--mf-line-2);
}
.screen.sf-menu .sf-slot-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.screen.sf-menu .sf-slot.empty .sf-slot-name { font-weight: 500; color: var(--ink-dim); }
.screen.sf-menu .sf-slot-sub { font-size: 12px; color: var(--ink-dim); font-family: var(--mf-ui); line-height: 1.45; }
.screen.sf-menu .sf-slot button.sf-tab,
.screen.sf-menu .sf-slot button.sf-btn {
  width: auto;
  flex-shrink: 0;
}

/* ---- 6.-7. (retired) The title screen's continue readout and title lockup moved to the
   frontend kit (styles/kit.css; src/ui/screens/mainMenu.js owns no CSS). ---- */
/* ---- 9. Accessibility hooks -------------------------------------------------------
   Dyslexia, motion reduction, and forced colors. */

html.sf-dyslexia .screen.sf-menu {
  --mf-display: "OpenDyslexic", "Atkinson Hyperlegible", "Comic Sans MS", "Verdana", system-ui, sans-serif;
  --mf-ui: "OpenDyslexic", "Atkinson Hyperlegible", "Comic Sans MS", "Verdana", system-ui, sans-serif;
}

@media (forced-colors: active) {
  html.sf-forced-colors .screen.sf-menu,
  html.sf-forced-colors .screen.sf-menu button.sf-btn { clip-path: none !important; filter: none !important; box-shadow: none !important; }
}
