/* optieye console — optical-bench metering aesthetic
   deep darkroom charcoal, cyan instrument light, amber/red on ISO breach.
   IBM Plex Serif (display) / Sans (body) / Mono (readouts). */

:root {
  --ink: #0a0e13;
  --ink-2: #0d131a;
  --panel: #121a22;
  --panel-2: #18222c;
  --line: #24313d;
  --line-soft: #1b2731;
  --text: #e9eff5;
  --muted: #7f8f9e;
  --muted-2: #566472;
  --cyan: #37e0cf;
  --cyan-dim: #1c9b90;
  --cyan-deep: #0e5c56;
  --amber: #ffb454;
  --red: #ff5d62;
  --glow: rgba(55, 224, 207, .22);
  --glow-red: rgba(255, 93, 98, .28);
  --radius: 4px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--ink);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding: clamp(14px, 2.5vw, 30px);
  position: relative;
  overflow-x: hidden;
}

/* --- atmosphere: optical-bench grid + a raking beam --- */
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: .32;
  mask-image: radial-gradient(120% 90% at 30% 0%, #000 30%, transparent 78%);
}
.beam {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 45% at 78% -5%, rgba(55,224,207,.10), transparent 60%),
    radial-gradient(50% 40% at 8% 4%, rgba(90,140,255,.06), transparent 55%);
}

body > *:not(.grid-overlay):not(.beam) { position: relative; z-index: 1; }

/* --- masthead --- */
.masthead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 16px; align-items: center; }
.lens-mark { width: 42px; height: 42px; flex: none; }
.lens-mark ellipse { fill: rgba(55,224,207,.08); stroke: var(--cyan); stroke-width: 1.3; }
.lens-mark line { stroke: var(--cyan-dim); stroke-width: 1; }
.brand h1 {
  font-family: var(--serif); font-weight: 600; font-size: 30px;
  letter-spacing: -.01em; line-height: 1;
}
.tagline {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  margin-top: 6px; letter-spacing: .01em; text-transform: uppercase;
}
.tagline span { color: var(--cyan-dim); padding: 0 2px; }

.verdict {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  transition: border-color .35s, background .35s, box-shadow .35s;
}
.verdict-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 0 0 var(--glow);
  transition: background .35s, box-shadow .35s;
}
.verdict-label {
  display: block; font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2);
}
.verdict-status {
  display: block; font-family: var(--mono); font-weight: 600; font-size: 15px;
  color: var(--cyan); margin-top: 1px; letter-spacing: .01em;
}
.verdict[data-state="breach"] {
  border-color: var(--red);
  box-shadow: 0 0 22px -6px var(--glow-red), inset 0 0 20px -14px var(--red);
}
.verdict[data-state="breach"] .verdict-dot {
  background: var(--red); animation: pulse 1.4s ease-in-out infinite;
}
.verdict[data-state="breach"] .verdict-status { color: var(--red); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow-red); }
  50% { box-shadow: 0 0 0 7px transparent; }
}

/* --- console grid --- */
.console {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  grid-template-areas: "controls readout" "controls surfaces";
  gap: 16px;
  align-items: start;
}
.controls { grid-area: controls; }
.readout  { grid-area: readout; }
.surfaces { grid-area: surfaces; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}
.panel::before {
  content: ""; position: absolute; top: -1px; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-dim), transparent);
  opacity: .5;
}
.panel-title {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text);
  margin-bottom: 18px;
}
.panel-title .ord { color: var(--muted-2); font-weight: 400; }

/* --- dials (range sliders) --- */
.dials { display: flex; flex-direction: column; gap: 17px; }
.dial label {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 8px;
}
.dial label .unit { margin-left: auto; font-family: var(--mono); color: var(--muted-2); font-size: 11px; }
.dial label .hint {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--cyan-dim);
  border: 1px solid var(--cyan-deep); border-radius: 2px; padding: 1px 4px;
}
.dial { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 14px; }
.dial label { grid-column: 1 / -1; }
.dial output {
  grid-column: 2; grid-row: 2;
  font-family: var(--mono); font-weight: 600; font-size: 19px; color: var(--cyan);
  min-width: 52px; text-align: right; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px var(--glow);
}

input[type="range"] {
  grid-column: 1; grid-row: 2;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px; background: var(--line);
  border-radius: 2px;
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -6px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--cyan);
  box-shadow: 0 0 0 3px rgba(55,224,207,.12), 0 0 14px var(--glow);
  transition: transform .12s, box-shadow .2s;
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--cyan);
  box-shadow: 0 0 0 3px rgba(55,224,207,.12), 0 0 14px var(--glow);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(55,224,207,.28); }
input[type="range"]:focus { outline: none; }

/* --- selects --- */
.selects { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.field label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 7px;
}
.field .slot, .field .axis-tag {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); border: 1px dashed var(--line); border-radius: 2px; padding: 1px 5px;
}
select {
  width: 100%; font-family: var(--mono); font-size: 13px;
  color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan-dim) 50%),
                    linear-gradient(135deg, var(--cyan-dim) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select:focus { outline: none; border-color: var(--cyan-dim); }
.registry-note {
  margin-top: 14px; font-size: 11px; line-height: 1.55; color: var(--muted-2);
  border-left: 2px solid var(--cyan-deep); padding-left: 10px;
}
.registry-note em { color: var(--cyan-dim); font-style: normal; font-weight: 600; }

/* --- readout --- */
.readout {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.metric {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 9px;
  min-height: 104px;
}
.metric--primary { grid-column: span 2; background: linear-gradient(150deg, #16232c, #101820); }
.metric--primary .metric-value b { font-size: 42px; }
.metric-label {
  font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.axis-tag {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--cyan-dim); border: 1px solid var(--cyan-deep); border-radius: 2px; padding: 1px 5px;
}
.tri, .metric-label .hint {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted-2); border: 1px solid var(--line); border-radius: 2px; padding: 1px 5px;
}
.metric-value {
  font-family: var(--mono); font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1; margin-top: auto;
  display: flex; align-items: baseline; gap: 3px;
}
.metric-value b { font-size: 28px; font-weight: 600; }
.metric-value i { font-style: normal; font-size: 14px; color: var(--muted); font-weight: 400; }
.metric-sub {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted-2);
  min-height: 14px; letter-spacing: .01em;
}
.metric.hot .metric-value b { color: var(--red); text-shadow: 0 0 16px var(--glow-red); }
.metric.warm .metric-value b { color: var(--amber); }
.metric.lit .metric-value b { color: var(--cyan); text-shadow: 0 0 16px var(--glow); }

/* --- surfaces / plots --- */
.surfaces { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plot-card { padding: 15px 15px 13px; }
.plot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.plot-head h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; }
.plot-key { font-family: var(--mono); font-size: 10px; color: var(--muted-2); text-align: right; text-transform: uppercase; letter-spacing: .04em; }
.plot { width: 100%; height: 300px; }
.plot-note { font-size: 11px; line-height: 1.5; color: var(--muted-2); margin-top: 8px; }
.plot-note em { color: var(--cyan-dim); font-style: normal; }

/* --- colophon --- */
.colophon {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.colophon-line { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.chip {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--cyan); border: 1px solid var(--cyan-deep); border-radius: 2px; padding: 3px 7px; white-space: nowrap;
}
.colophon code { font-family: var(--mono); color: var(--text); font-size: 11.5px; }
.colophon-links { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11.5px; }
.colophon-links a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid var(--cyan-deep); padding-bottom: 1px; }
.colophon-links a:hover { border-color: var(--cyan); }
.colophon-links .sep { color: var(--muted-2); }
.engine-stat { color: var(--muted-2); }

/* --- loader --- */
.loader {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; color: var(--cyan);
  background: var(--panel-2); border: 1px solid var(--cyan-deep); border-radius: var(--radius);
  padding: 9px 16px; z-index: 20; box-shadow: 0 8px 30px -8px rgba(0,0,0,.6);
}
.loader[hidden] { display: none; }
.loader span {
  width: 12px; height: 12px; border: 2px solid var(--cyan-deep); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- entrance stagger --- */
.masthead, .controls, .readout, .surfaces, .colophon { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.controls { animation-delay: .06s; } .readout { animation-delay: .12s; }
.surfaces { animation-delay: .18s; } .colophon { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* --- responsive --- */
@media (max-width: 940px) {
  .console { grid-template-columns: 1fr; grid-template-areas: "controls" "readout" "surfaces"; }
  .surfaces { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .readout { grid-template-columns: 1fr 1fr; }
  .metric--primary { grid-column: span 2; }
  .metric--primary .metric-value b { font-size: 34px; }
  .masthead { gap: 14px; }
  .verdict { width: 100%; }
}
