/* STRATOS core - tokens, primitives, marks, components. Flat FUI: no glow,
   no blur, no radius, no gradient fades (hazard stripes are hard-stop strips).

   Two grounds. Black glass is the authored default and lives on bare :root;
   daylight glass is the same two neutrals swapped with the signal hue re-cut
   for a light ground. An OS light preference reaches daylight, and an explicit
   data-theme wins in both directions. */

:root {
  /* ---- black glass (default) ---- */
  --ground: #0b0b0b;
  --panel: #151515;
  --ink: #f4f2ee;
  --ink-dim: #9b9b9b;
  --signal: #ff6a00;
  --hairline: rgba(244, 242, 238, 0.22);
  --on-ink: #0b0b0b;
  --on-signal: #0b0b0b;
  color-scheme: dark;

  /* ---- type ---- */
  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --num-xl: clamp(64px, 9vw, 116px);
  --num-lg: 56px;
  --num-md: 44px;

  /* ---- layout ---- */
  --measure: 1240px;
  --gutter: 24px;
  --section-gap: 64px;

  /* ---- motion: two authored moments, everything else flips ---- */
  --t-blink: 1.4s;
  --t-scan: 8s;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    /* daylight glass */
    --ground: #f4f2ee;
    --panel: #e8e5de;
    --ink: #0b0b0b;
    --ink-dim: #595959;
    --signal: #b84300;
    --hairline: rgba(11, 11, 11, 0.22);
    --on-ink: #f4f2ee;
    --on-signal: #f4f2ee;
    color-scheme: light;
  }
}

/* explicit choice wins in both directions - the catalog has a toggle */
:root[data-theme="light"] {
  --ground: #f4f2ee;
  --panel: #e8e5de;
  --ink: #0b0b0b;
  --ink-dim: #595959;
  --signal: #b84300;
  --hairline: rgba(11, 11, 11, 0.22);
  --on-ink: #f4f2ee;
  --on-signal: #f4f2ee;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #0b0b0b;
  --panel: #151515;
  --ink: #f4f2ee;
  --ink-dim: #9b9b9b;
  --signal: #ff6a00;
  --hairline: rgba(244, 242, 238, 0.22);
  --on-ink: #0b0b0b;
  --on-signal: #0b0b0b;
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--ground);
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--signal);
  color: var(--on-signal);
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--ink);
}

/* ---------- type voices ---------- */

.v-display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.v-display-xl { font-size: clamp(56px, 9vw, 96px); }
.v-display-lg { font-size: clamp(30px, 5vw, 44px); }
.v-display-md { font-size: 24px; font-weight: 700; }

.v-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
}

.v-data {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}

.v-micro {
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.ink-dim { color: var(--ink-dim); }
.ink-signal { color: var(--signal); } /* 14px+ bold only */

/* ---------- marks: chips ---------- */

.s-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 4px 7px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.s-chip--ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.s-chip--signal {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--on-signal);
}

.s-chip--outline {
  border-color: var(--ink);
  color: var(--ink);
}

.s-chip--ghost {
  border-color: var(--hairline);
  color: var(--ink-dim);
}

/* status chips: signal = live, ink = ready, ghost = inactive */
.s-status { display: inline-flex; align-items: center; gap: 6px; }
.s-status .dot { width: 6px; height: 6px; background: currentColor; }
.s-status.is-active .dot { animation: s-blink var(--t-blink) steps(1, end) infinite; }

/* ---------- marks: hazard stripe ---------- */

.s-hazard {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--signal) 0,
    var(--signal) 8px,
    var(--ground) 8px,
    var(--ground) 16px
  );
}

.s-hazard--thin { height: 6px; }

/* ---------- marks: rules with end-cap ticks ---------- */

.s-rule {
  position: relative;
  height: 1px;
  background: var(--hairline);
}

.s-rule::before,
.s-rule::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--ink);
}

.s-rule::before { left: 0; }
.s-rule::after { right: 0; }

/* ---------- marks: corner-bracketed frame ---------- */
/* needs an inner <i class="s-frame-x" aria-hidden="true"></i> for the bottom pair */

.s-frame {
  position: relative;
}

.s-frame::before,
.s-frame::after,
.s-frame .s-frame-x::before,
.s-frame .s-frame-x::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--ink);
  pointer-events: none;
}

.s-frame::before { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.s-frame::after { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.s-frame .s-frame-x::before { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.s-frame .s-frame-x::after { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- marks: small geometry ---------- */

.s-square {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--signal);
  flex: none;
}

.s-square--ink { background: var(--ink); }
.s-square--outline { background: none; border: 1px solid var(--hairline); }
.s-square--lg { width: 14px; height: 14px; }

.s-cross {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: none;
  color: var(--ink-dim);
}

.s-cross::before,
.s-cross::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.s-cross::before { left: 4px; top: 0; width: 1px; height: 9px; }
.s-cross::after { left: 0; top: 4px; width: 9px; height: 1px; }

.s-tri {
  display: inline-block;
  width: 0;
  height: 0;
  flex: none;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--ink);
}

.s-tri--signal { border-top-color: var(--signal); }
.s-tri--right {
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--ink);
  border-right: 0;
}
.s-tri--right.s-tri--signal { border-left-color: var(--signal); border-top-color: transparent; }

/* ---------- marks: segmented bar ---------- */

.s-seg {
  display: flex;
  gap: 3px;
}

.s-seg i {
  width: 9px;
  height: 14px;
  border: 1px solid var(--hairline);
  flex: none;
}

.s-seg i.on {
  background: var(--ink);
  border-color: var(--ink);
}

.s-seg--signal i.on {
  background: var(--signal);
  border-color: var(--signal);
}

.s-seg--tall i { height: 22px; }

/* ---------- marks: big numeric readout ---------- */

.s-num {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.s-num--xl { font-size: var(--num-xl); }
.s-num--lg { font-size: var(--num-lg); }
.s-num--md { font-size: var(--num-md); }
.s-num--signal { color: var(--signal); }

/* ---------- marks: schematic placeholder ---------- */

.s-schem {
  position: relative;
  border: 1px solid var(--hairline);
}

.s-schem svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.s-schem svg line {
  stroke: var(--hairline);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.s-schem .pip {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--signal);
}

/* ---------- marks: feed rows ---------- */

.s-feed {
  list-style: none;
}

.s-feed li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.s-feed li:hover,
.s-feed li.is-hot {
  background: var(--panel);
}

.s-feed .mk {
  align-self: center;
}

.s-feed .lbl {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  white-space: nowrap;
}

.s-feed .lead {
  flex: 1;
  min-width: 12px;
  border-bottom: 1px dotted var(--hairline);
  transform: translateY(-3px);
}

.s-feed .val {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.s-feed .val.ink-signal {
  font-weight: 700;
  font-size: 14px; /* signal text floor: 14px bold */
  line-height: 1;
  align-self: center;
}

/* ---------- components: buttons ---------- */

.s-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  background: none;
  border: none;
  color: var(--ink);
  padding: 6px 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.s-btn--bracket {
  border: 1px solid transparent; /* reserved so the hover flip is layout-stable */
  padding: 6px 8px;
}

.s-btn--bracket::before { content: "["; }
.s-btn--bracket::after { content: "]"; }

.s-btn--bracket:hover:not(:disabled) {
  background: var(--panel);
  border-color: var(--ink);
}

.s-btn--solid {
  background: var(--ink);
  color: var(--on-ink);
  padding: 8px 14px;
}

.s-btn--solid:hover:not(:disabled) {
  background: var(--signal);
  color: var(--on-signal);
}

.s-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.s-btn:disabled {
  color: var(--ink-dim);
  background: none;
  border: 1px dashed var(--hairline);
  cursor: not-allowed;
  padding: 7px 13px;
}

.s-btn--bracket:disabled {
  padding: 6px 8px;
}

/* ---------- components: toggle pair (paired ticks) ---------- */

.s-toggle {
  display: inline-flex;
  gap: 18px;
  border: none;
}

.s-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
  position: relative;
}

.s-toggle input {
  /* visually hidden, still focusable */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.s-toggle .tick {
  width: 10px;
  height: 10px;
  border: 1px solid var(--hairline);
  flex: none;
}

.s-toggle input:checked ~ .tick {
  background: var(--signal);
  border-color: var(--signal);
}

.s-toggle input:checked ~ .txt {
  color: var(--ink);
}

.s-toggle input:focus-visible ~ .tick {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* ---------- components: input ---------- */

.s-field {
  display: block;
}

.s-field .flabel {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-dim);
}

.s-input {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  padding: 5px 2px;
  width: 100%;
  caret-color: var(--signal);
  text-transform: uppercase;
}

.s-input::placeholder {
  color: var(--ink-dim);
  opacity: 1;
}

.s-input:focus {
  border-bottom-color: var(--ink);
  outline: none;
}

.s-input:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.s-input:disabled {
  color: var(--ink-dim);
  border-bottom-style: dashed;
  cursor: not-allowed;
}

/* static specimen caret: blinking block */
.s-caret {
  display: inline-block;
  width: 7px;
  height: 12px;
  background: var(--signal);
  vertical-align: -2px;
  animation: s-blink var(--t-blink) steps(1, end) infinite;
}

/* ---------- motion ---------- */

@keyframes s-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

/* flat scan column sweeping a .s-scan-host once per --t-scan */
.s-scan-host {
  position: relative;
  overflow: hidden;
}

.s-scan {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -18%;
  width: 90px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--signal) 35%, transparent);
  pointer-events: none;
  animation: s-scan var(--t-scan) linear infinite;
}

@keyframes s-scan {
  0% { left: -18%; }
  32% { left: 104%; }
  100% { left: 104%; }
}

@media (prefers-reduced-motion: reduce) {
  .s-scan { display: none; }
  .s-status.is-active .dot,
  .s-caret { animation: none; }
  * { transition: none !important; }
}
