/* =====================================================================
   SEMIANALYSIS 2026 · NEO INDUSTRIAL — PRIMITIVES & COMPONENTS
   Depends on tokens.css (load tokens.css first). These are the reusable
   building blocks: display type, the mono kicker, the // slash mark,
   wordmark, buttons, corner brackets, status dots, blueprint grid, and
   the circuit-trace background.
   ===================================================================== */

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

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--ft-body);
  font-weight: 450;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.55;
  font-size: 15px;
  letter-spacing: 0.005em;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }

/* ---- Display type ---- */
.display {
  font-family: var(--ft-display);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

/* ---- Mono caps "kicker" label — the neo-industrial signature ---- */
.kicker {
  font-family: var(--ft-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--tx-muted);
}
.kicker--amber { color: var(--sa-amber); }
.kicker--cobalt { color: var(--sa-cobalt); }

.mono { font-family: var(--ft-mono); font-variant-numeric: tabular-nums; }

/* ---- Hairline blueprint grid background ---- */
.grid-bg {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
}
.grid-bg--fine {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---- Wordmark: semi (cobalt) + analysis (amber) ---- */
.wordmark {
  font-family: var(--ft-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 19px;
}
.wordmark .semi { color: var(--sa-cobalt); }
.wordmark .analysis { color: var(--sa-amber); }

/* ---- Buttons ---- */
.btn {
  font-family: var(--ft-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--tx);
  cursor: pointer;
  transition: all 180ms var(--ease);
}
.btn:hover { border-color: var(--amber-line); transform: translateY(-1px); }
.btn--amber {
  background: var(--sa-amber);
  color: #0A0A0F;
  border-color: var(--sa-amber);
}
.btn--amber:hover { box-shadow: 0 8px 24px rgba(247,176,65,0.28); }

/* ---- Technical corner brackets (for framed panels) ---- */
.brackets { position: relative; }
.brackets::before, .brackets::after {
  content: ""; position: absolute; width: 12px; height: 12px;
  border-color: var(--amber-line); border-style: solid;
}
.brackets::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.brackets::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ---- Status dot ---- */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot--live { background: var(--sa-mint); box-shadow: 0 0 8px var(--sa-mint); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.up { color: var(--sa-mint); }
.down { color: var(--sa-coral); }

/* ---- SLASH MARK "//" — the SemiAnalysis brand device (cobalt + amber pair) ---- */
/* Usage: <span class="slashes"></span>  (inline). Scales with font-size. */
.slashes {
  display: inline-flex; gap: 0.18em; align-items: center;
  width: 0.86em; height: 0.92em; vertical-align: -0.06em; flex-shrink: 0;
}
.slashes::before, .slashes::after {
  content: ""; width: 0.18em; height: 100%; border-radius: 1px;
  transform: skewX(-22deg);
}
.slashes::before { background: var(--sa-cobalt); }
.slashes::after  { background: var(--sa-amber); }
/* larger standalone mark: set font-size on the element */
.slashes--lg { width: 1.7em; height: 1.8em; gap: 0.34em; }

/* a horizontal divider terminated by the slash mark */
.slash-rule { display: flex; align-items: center; gap: 14px; }
.slash-rule::before { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---- Circuit-trace background (rounded amber PCB traces) ---- */
.circuit-bg {
  background-image: url("../assets/circuit.svg");
  background-repeat: no-repeat;
  background-position: right top;
  background-size: 60% auto;
}
/* low-alpha wash variant: place the trace in a child with opacity for subtlety */
.circuit-faint { position: relative; }
.circuit-faint > .circuit-layer {
  position: absolute; inset: 0; background: url("../assets/circuit.svg") right top / 56% auto no-repeat;
  opacity: 0.10; pointer-events: none; z-index: 0;
}

/* ---- Chip-octagon background pattern (echoes the box-logo silhouette) ----
   Fill a rect with url(#sa-chip-octagon); stroke takes the active accent.
   Opacity 0.04 (paper grain) → 0.07 (ambient) → 0.11 (visible motif). */

/* ---- Selection ---- */
::selection { background: rgba(247,176,65,0.25); color: var(--tx); }

/* ---- Thin scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1c1f2b; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #262a39; }

/* =====================================================================
   INTERACTION LAYER — focus, links, form controls, states
   Added to complete the web system. All accent = amber/cobalt/mint/coral
   tokens; controls sit on --surface with hairline borders.
   ===================================================================== */

/* ---- Visible focus (keyboard) — amber ring, never removed silently ---- */
:focus-visible { outline: 2px solid var(--sa-amber); outline-offset: 2px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }

/* ---- Links ---- */
.link {
  color: var(--sa-cobalt); border-bottom: 1px solid var(--cobalt-line);
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}
.link:hover { color: var(--blue-300); border-bottom-color: var(--blue-300); }
.link:visited { color: var(--blue-500); }
.link--amber { color: var(--sa-amber); border-bottom-color: var(--amber-line); }
.link--amber:hover { color: #ffd27a; border-bottom-color: #ffd27a; }
.link--quiet { border-bottom-color: transparent; }
.link--quiet:hover { border-bottom-color: var(--cobalt-line); }

/* ---- Fields: label + control + hint/error ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-family: var(--ft-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tx-muted); }
.input, .textarea, .select {
  font-family: var(--ft-body); font-size: 14px; color: var(--tx); width: 100%;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 10px 13px; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--tx-dim); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--tx-dim); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--sa-amber); box-shadow: 0 0 0 3px var(--amber-wash); }
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; }
.input--error, .textarea--error { border-color: var(--sa-coral); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(224,99,71,0.16); }
.field__hint { font-size: 12px; color: var(--tx-dim); }
.field__error { font-size: 12px; color: var(--sa-coral); }

/* search input (icon slot handled by padding + an absolutely-positioned svg) */
.search { position: relative; }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; opacity: 0.6; }
.search .input { padding-left: 34px; }

/* ---- Checkbox / radio ---- */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: var(--tx); }
.check input { appearance: none; -webkit-appearance: none; width: 17px; height: 17px; flex-shrink: 0;
  border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface);
  display: grid; place-content: center; transition: all 150ms var(--ease); cursor: pointer; }
.check input[type="radio"] { border-radius: 50%; }
.check input:hover { border-color: var(--tx-dim); }
.check input:checked { background: var(--sa-amber); border-color: var(--sa-amber); }
.check input[type="checkbox"]:checked::after { content: ""; width: 5px; height: 9px; margin-top: -2px;
  border: solid #0A0A0F; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check input[type="radio"]:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #0A0A0F; }

/* ---- Toggle ---- */
.toggle { width: 38px; height: 22px; border-radius: 11px; background: var(--surface);
  border: 1px solid var(--line-2); position: relative; cursor: pointer; flex-shrink: 0;
  transition: background 160ms var(--ease), border-color 160ms var(--ease); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--tx-muted); transition: all 160ms var(--ease); }
.toggle.is-on { background: var(--sa-mint); border-color: var(--sa-mint); }
.toggle.is-on::after { left: 18px; background: #06070C; }

/* ---- Inline alert / banner ---- */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 9px; font-size: 13.5px;
  color: var(--tx-muted); background: var(--surface); border: 1px solid var(--line-2); border-left-width: 3px; }
.alert strong { color: var(--tx); }
.alert--error { border-left-color: var(--sa-coral); }
.alert--info  { border-left-color: var(--sa-cobalt); }
.alert--ok    { border-left-color: var(--sa-mint); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { font-family: var(--ft-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tx-muted); padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer;
  background: transparent; transition: color 150ms var(--ease), border-color 150ms var(--ease); }
.tab:hover { color: var(--tx); }
.tab.is-active { color: var(--sa-amber); border-bottom-color: var(--sa-amber); }

/* ---- Loading skeleton (honors reduced motion below) ---- */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--raised) 37%, var(--surface) 63%);
  background-size: 400% 100%; border-radius: 6px; animation: skeleton 1.4s ease infinite; }
@keyframes skeleton { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 34px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--tx-muted); }

/* ---- Tooltip (static bubble for docs; JS toggles .is-open in product) ---- */
.tip__bubble { display: inline-block; font-family: var(--ft-mono); font-size: 11px; letter-spacing: 0.02em;
  color: var(--tx); background: var(--raised); border: 1px solid var(--line-2); border-radius: 7px;
  padding: 7px 10px; box-shadow: var(--shadow-card); }

/* ---- Icon convention: line icons match the mark (rounded joins, ~1.75 stroke) ---- */
.icon { width: 20px; height: 20px; display: inline-block; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; stroke-width: 1.6; }

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .dot--live { animation: none; }
  .skeleton { animation: none; }
}
