/* AETHRA site, robotic instrument system.
   A dark field is never flat here: a fine grid, a diagonal hatch, two wide glows and a light fall from the top sit
   under everything, and every panel carries corner brackets, a lamp and mono readouts, so the page reads as a
   machine interface rather than a poster. Grade colours arrive as one custom property per card. */

:root {
  --field: #05070a;
  --panel: #0a0e13;
  --panelSoft: #0d1218;
  --ink: #e9eef3;
  --dim: #8d98a5;
  --faint: #66717d;
  --rule: rgba(255, 255, 255, 0.09);
  --ruleStrong: rgba(255, 255, 255, 0.2);
  --cyan: #6fe3f5;
  --amber: #f0a92e;
  --display: "Rajdhani", "Arial Narrow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1180px;
  --rhythm: 86px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 16.5px;
  line-height: 1.55;
  background-color: var(--field);
  background-image:
    radial-gradient(880px 560px at 8% -8%, rgba(111, 227, 245, 0.12), transparent 62%),
    radial-gradient(760px 520px at 98% 6%, rgba(240, 169, 46, 0.10), transparent 60%),
    radial-gradient(900px 700px at 74% 108%, rgba(139, 92, 246, 0.10), transparent 64%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.030) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.030) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 420px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* a scanline sheet over the whole page, never over a control */
.scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, transparent 0, rgba(111, 227, 245, 0.05) 45%, transparent 55%);
  background-size: 100% 3px, 100% 240%;
  background-position: 0 0, 0 -120%;
  animation: sweep 14s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.55;
}
@keyframes sweep { to { background-position: 0 0, 0 220%; } }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--dim); }
.break { overflow-wrap: anywhere; word-break: break-word; }
.dot { color: var(--faint); }

/* header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 7, 10, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  transition: transform 0.26s ease;
}
.topbar.hidden { transform: translateY(-104%); }
.barInner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  padding-top: 8px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brandMark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: #04070a;
  background: var(--cyan);
  clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 22% 100%, 0 78%);
}
.brandWord { font-weight: 700; font-size: 19px; letter-spacing: 0.24em; white-space: nowrap; }
.menu { display: flex; gap: 20px; margin-right: auto; flex-wrap: wrap; }
.menu a {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.menu a:hover { color: var(--ink); border-bottom-color: var(--cyan); }
.burger {
  display: none;
  height: 34px; padding: 0 13px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 1px solid var(--ruleStrong); cursor: pointer;
}
.tags { display: flex; gap: 8px; }
.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  padding: 4px 10px; border: 1px solid var(--ruleStrong); white-space: nowrap;
}
.tagOpen { color: var(--cyan); border-color: rgba(111, 227, 245, 0.45); }
.tagClosed { color: var(--faint); }

/* hero */
.hero { padding: 74px 24px 0; }
.heroGrid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 42px; align-items: start; }
.serie { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--faint); margin-bottom: 18px; }
h1 {
  font-size: clamp(58px, 11vw, 128px);
  line-height: 0.92;
  letter-spacing: 0.03em;
  font-weight: 700;
  text-shadow: 1px 0 rgba(111, 227, 245, 0.55), -1px 0 rgba(240, 169, 46, 0.4);
}
.lede { max-width: 58ch; font-size: 19px; color: var(--dim); margin-top: 18px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: 0 22px;
  font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink); background: transparent; border: 1px solid var(--ruleStrong);
  cursor: pointer; transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.btn:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btnPrimary { background: var(--ink); color: #05070a; border-color: var(--ink); }
.btnPrimary:hover:not(:disabled) { background: var(--cyan); color: #04070a; border-color: var(--cyan); }
.btnGhost { color: var(--dim); }

.readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin: 34px 0 0; }
.readout .cell { background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 72%); background-color: var(--panelSoft); padding: 16px 15px 18px; }
.readout dt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.readout dd { margin: 8px 0 0; font-family: var(--mono); font-size: 26px; font-weight: 500; }
.readout .of { font-size: 13px; color: var(--faint); margin-left: 2px; }

/* instrument frame around the hero piece */
.instrument { margin: 0; }
.frame {
  position: relative;
  border: 1px solid var(--ruleStrong);
  padding: 14px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 70%);
  background-color: var(--panel);
}
.frame img { display: block; width: 100%; height: auto; }
.corner { position: absolute; width: 14px; height: 14px; border: 0 solid var(--cyan); }
.corner.tl { top: 5px; left: 5px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 5px; right: 5px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 5px; left: 5px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 5px; right: 5px; border-bottom-width: 2px; border-right-width: 2px; }
.crosshair { position: absolute; background: rgba(111, 227, 245, 0.22); }
.crosshair.h { left: 14px; right: 14px; top: 50%; height: 1px; }
.crosshair.v { top: 14px; bottom: 14px; left: 50%; width: 1px; }
.scale {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--faint);
  border-top: 1px solid var(--rule); padding: 6px 2px 0;
}
.scale span { position: relative; }
.scale span::before { content: ""; position: absolute; top: -7px; left: 0; width: 1px; height: 5px; background: var(--ruleStrong); }
.instrument figcaption {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule);
}
.capKey { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--faint); }
.capVal { font-family: var(--mono); font-size: 12.5px; color: var(--ink); grid-column: 2; margin-top: -1.35em; }
.instrument figcaption > span:nth-child(odd) { grid-column: 1; }

/* sections */
.section { padding: var(--rhythm) 24px; border-top: 1px solid var(--rule); }
.head { max-width: 76ch; margin-bottom: 32px; }
.secNo { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cyan); margin-bottom: 14px; }
h2 { font-size: clamp(32px, 4.4vw, 48px); font-weight: 600; letter-spacing: 0.01em; }
.sub { color: var(--dim); margin-top: 12px; font-size: 17px; }
h3 { font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.body { color: var(--dim); font-size: 15.5px; margin-top: 8px; }
.fine { color: var(--faint); font-size: 13px; margin-top: 24px; max-width: 84ch; }
.label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }

.panel {
  position: relative;
  background-color: var(--panel);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 72%);
  border: 1px solid var(--rule);
  padding: 22px 20px 24px;
}
.panelHead { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.lamp { width: 8px; height: 8px; background: var(--faint); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.lampAmber { background: var(--amber); }
.step.current .lamp { background: var(--cyan); box-shadow: 0 0 10px rgba(111, 227, 245, 0.6); }
.step.current { border-color: rgba(111, 227, 245, 0.4); }

.console { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.console .panel { border: 0; }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.result { margin-top: 1px; }
.status { font-size: 16.5px; min-height: 24px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin-top: 18px; }
.fact { display: flex; flex-direction: column; gap: 3px; }
.fact .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.fact .v { font-size: 15px; }

/* grades */
.tierGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.tier { border: 1px solid var(--rule); background: rgba(255, 255, 255, 0.015); display: flex; flex-direction: column; }
.tierTop { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.tierNo { font-size: 11px; letter-spacing: 0.16em; color: var(--tier); }
.tierShare { font-size: 11px; letter-spacing: 0.1em; color: var(--faint); }
.tier img { display: block; width: 100%; height: auto; border-bottom: 1px solid var(--rule); }
.tierBody { padding: 16px 14px 20px; }
.tier h3 { color: var(--tier); letter-spacing: 0.05em; text-transform: uppercase; }
.share { font-family: var(--mono); font-size: 11.5px; color: var(--dim); margin-top: 8px; }
.proportion { position: relative; height: 6px; background: rgba(255, 255, 255, 0.07); margin: 12px 0 14px; }
.proportion span { display: block; height: 100%; background: var(--tier); min-width: 5px; }
.tierCopy { font-size: 14px; color: var(--dim); }

/* mechanism steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.steps li { position: relative; background-color: var(--panel); background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 70%); padding: 22px 20px 24px; }
.stepNo { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--cyan); margin-bottom: 12px; }
.notice { margin-top: 20px; }
.stateGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-bottom: 16px; }
.stateCell { background-color: var(--panelSoft); padding: 14px 13px 16px; display: flex; flex-direction: column; gap: 6px; }
.stateKey { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--faint); }
.stateVal { font-size: 15px; letter-spacing: 0.06em; }
.stateOpen { color: var(--cyan); }
.stateNote { font-size: 12.5px; color: var(--dim); }

/* specimens */
.pieceGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.pieceGrid figure { margin: 0; border: 1px solid var(--rule); background: rgba(255, 255, 255, 0.015); }
.pieceGrid img { display: block; width: 100%; height: auto; }
.pieceGrid figcaption {
  display: flex; gap: 10px; align-items: baseline;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
  padding: 10px 12px 12px; border-top: 1px solid var(--rule);
}
.pieceGrid figcaption .mono { color: var(--cyan); }

/* footer */
.foot { border-top: 1px solid var(--rule); padding: 38px 0 56px; margin-top: 24px; }
.footInner { display: flex; justify-content: space-between; gap: 26px; flex-wrap: wrap; }
.brandFoot { font-family: var(--mono); font-weight: 600; letter-spacing: 0.22em; margin-bottom: 8px; }
.footLinks { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.footLinks a { color: var(--dim); border-bottom: 1px solid var(--rule); padding-bottom: 2px; overflow-wrap: anywhere; }
.footLinks a:hover { color: var(--cyan); }
#contractLine { font-size: 12.5px; overflow-wrap: anywhere; }

/* responsive */
@media (max-width: 1040px) {
  .heroGrid { grid-template-columns: 1fr; gap: 34px; }
  .tierGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pieceGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  :root { --rhythm: 62px; }
  .burger { display: inline-flex; margin-left: auto; }
  .menu { display: none; width: 100%; order: 5; margin-right: 0; gap: 12px; padding: 6px 0 2px; flex-direction: column; }
  .menu.open { display: flex; }
  .hero { padding-top: 48px; }
  .console { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument figcaption { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .tagClosed { display: none; }
  .tierGrid { grid-template-columns: 1fr; }
  .pieceGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pieceGrid figcaption { flex-direction: column; gap: 2px; font-size: 10.5px; }
  .actions .btn { width: 100%; }
  .footInner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .topbar { transition: none; }
  .scan { animation: none; opacity: 0.35; }
}
