/* ==========================================================================
   OPERATOR / Electric Adaptability
   Portal stylesheet.

   The design tokens below are taken from the author's research portal at
   https://sehajr-singhs.github.io/website/ so the two read as one system:
   warm paper ground, near-black ink, a monospace body face with a serif
   display face reserved for the wordmark, hairline rules, and a single
   narrow reading measure. Nothing here is a new palette.
   ========================================================================== */

:root {
  --bg:     #f5f3ef;   /* warm paper ground */
  --ink:    #1a1a1a;   /* primary type */
  --muted:  #6f6f6a;   /* secondary type, rules of speech */
  --line:   #d8d5cd;   /* hairline rules */
  --box:    #ffffff;   /* raised panel */
  --tint:   #efece6;   /* code and data ground, a shade under the page */

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --mono:  "SF Mono", "JetBrains Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

  --measure: 700px;    /* prose reading measure */
  --column:  820px;    /* page column, wider than prose to seat the data table */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--column); margin: 0 auto; padding: 0 28px 120px; }
.measure { max-width: var(--measure); }

/* --------------------------------------------------------------------------
   Fixed header
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--column); margin: 0 auto; padding: 14px 28px;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-size: 20px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.1;
  white-space: nowrap;
}
.brand a { color: var(--ink); text-decoration: none; }
nav { display: flex; gap: 22px; font-size: 13px; }
nav a {
  color: var(--muted); text-decoration: none;
  padding-bottom: 3px; border-bottom: 1.5px solid transparent;
  transition: border-color .18s ease, color .18s ease;
}
nav a:hover, nav a.active { color: var(--ink); border-color: var(--ink); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding: 132px 0 8px; }
.eyebrow {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 22px;
}
h1 {
  font-family: var(--serif);
  font-size: 40px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.14;
  margin-bottom: 20px;
}
.standfirst { font-size: 15px; line-height: 1.7; max-width: var(--measure); }
.standfirst + .standfirst { margin-top: 14px; }
.byline { color: var(--muted); font-size: 13.5px; line-height: 1.7; margin-top: 24px; }
.byline a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.byline a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Sections and prose
   -------------------------------------------------------------------------- */
.sec-label {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  margin: 64px 0 22px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; margin-bottom: 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 26px 0 7px; }
p  { max-width: var(--measure); margin-bottom: 14px; }
p.tight { margin-bottom: 7px; }
.muted { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 600; }
code {
  font-family: var(--mono); font-size: 0.92em;
  background: var(--tint); border: 1px solid var(--line); border-radius: 2px;
  padding: 0.5px 4px;
}
pre {
  background: var(--tint); border: 1px solid var(--line); border-radius: 3px;
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6;
  max-width: var(--measure); margin-bottom: 14px;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }
ul { list-style: none; max-width: var(--measure); margin-bottom: 14px; }
ul li { position: relative; padding-left: 18px; margin-bottom: 9px; }
ul li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; background: var(--ink); border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Panels (three-pillar architecture, lineage)
   -------------------------------------------------------------------------- */
.panel {
  background: var(--box); border: 1px solid var(--ink); border-radius: 3px;
  padding: 18px 20px; margin-bottom: 14px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; flex-wrap: wrap; margin-bottom: 6px;
}
.panel-title { font-weight: 600; font-size: 14.5px; letter-spacing: -0.005em; }
.panel-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.panel-body { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.panel-body code { font-size: 12.5px; }
.panel-links { margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.panel-links a {
  color: var(--ink); font-size: 12.5px; text-decoration: none;
  border-bottom: 1px solid var(--line); padding-bottom: 1px; transition: border-color .18s;
}
.panel-links a:hover { border-color: var(--ink); }
.tag {
  display: inline-block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 2px;
  padding: 1px 7px; margin-left: 4px; vertical-align: 1px; white-space: nowrap;
}

/* Cycle strip: design / deploy / adapt / improve */
.cycle { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 18px; border: 1px solid var(--line); }
.cycle .step { padding: 14px 16px; border-right: 1px solid var(--line); background: var(--box); }
.cycle .step:last-child { border-right: none; }
.cycle .step .n { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cycle .step .t { font-weight: 600; font-size: 13.5px; margin: 4px 0 5px; }
.cycle .step .d { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* --------------------------------------------------------------------------
   Data table (15-seed matrix)
   -------------------------------------------------------------------------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .lab { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.chip {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: var(--box); border: 1px solid var(--line); border-radius: 2px;
  padding: 3px 10px; cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink); }
.chip[aria-pressed="true"] { color: var(--box); background: var(--ink); border-color: var(--ink); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--box); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
caption {
  caption-side: bottom; text-align: left; color: var(--muted);
  font-size: 12.5px; line-height: 1.6; padding: 12px 2px 0; max-width: var(--measure);
}
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: right; white-space: nowrap; }
th {
  font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--tint); text-align: right;
}
th:first-child, th:nth-child(2), td:first-child, td:nth-child(2) { text-align: left; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: var(--tint); }
tbody tr.op { background: #fbfaf7; }
tbody tr.op:hover { background: var(--tint); }
tbody tr.op td:nth-child(2) { font-weight: 600; color: var(--ink); }
td .sd { color: var(--muted); font-size: 11px; }
td.na { color: var(--line); }
tr.scen-edge td, tr.scen-edge th { border-top: 1px solid var(--ink); }

/* Prose variant: comparison tables carry sentences, not figures, so they wrap and
   align left instead of inheriting the numeric table's right-aligned nowrap cells. */
.table-prose table { font-size: 12.5px; }
.table-prose th, .table-prose td {
  text-align: left; white-space: normal; vertical-align: top;
  line-height: 1.5; width: 33.33%;
}
.table-prose tbody tr.op td { font-weight: 600; color: var(--ink); }

/* Headline stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); margin: 22px 0; }
.stat { padding: 16px; border-right: 1px solid var(--line); background: var(--box); }
.stat:last-child { border-right: none; }
.stat .v { font-family: var(--serif); font-size: 27px; line-height: 1.1; letter-spacing: -0.01em; }
.stat .k { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 7px; }

/* --------------------------------------------------------------------------
   Figure
   -------------------------------------------------------------------------- */
figure { border: 1px solid var(--line); background: var(--box); padding: 18px; margin-bottom: 14px; }
figure img { display: block; width: 100%; height: auto; max-width: 100%; }
figcaption { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Engineering disclaimer */
.disclaimer {
  border: 1px solid var(--line); border-left: 2px solid var(--ink);
  background: var(--tint); padding: 16px 18px; margin-bottom: 14px;
}
.disclaimer .h { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.disclaimer p { font-size: 13px; line-height: 1.65; color: var(--ink); margin-bottom: 9px; max-width: none; }
.disclaimer p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer { margin-top: 80px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.9; }
footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
footer a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .cycle, .stats { grid-template-columns: repeat(2, 1fr); }
  .cycle .step:nth-child(2), .stats .stat:nth-child(2) { border-right: none; }
  .cycle .step:nth-child(-n+2), .stats .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 20px 80px; }
  .topbar-inner { padding: 12px 20px; }
  .hero { padding: 118px 0 4px; }
  h1 { font-size: 29px; }
  .cycle, .stats { grid-template-columns: 1fr; }
  .cycle .step, .stats .stat { border-right: none; border-bottom: 1px solid var(--line); }
  .cycle .step:last-child, .stats .stat:last-child { border-bottom: none; }
  nav { gap: 16px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto; } }

@media print {
  .topbar, .filters { display: none; }
  body { background: #fff; }
  .hero { padding-top: 0; }
  .panel, figure, .table-scroll { break-inside: avoid; }
}
