/* ===================================================================
   ONE-LINE — design system
   A portfolio built as a substation one-line diagram: bus nav, nameplate
   hero, panel sections with drafting registration marks, title-block
   footer. Light, cool-toned engineering-drawing paper by default — not
   another dark-glass developer theme — with a genuine "night operations"
   dark mode (same semantic red/green/amber an EMS display keeps in both
   modes), not a naive inversion.
   =================================================================== */

:root {
  --paper:        #f3f5f8;
  --paper-alt:    #e9edf2;
  --panel:        #ffffff;
  --ink:          #12161c;
  --ink-dim:      #4b5563;
  --ink-faint:    #8891a0;
  --line:         #ccd2db;
  --line-strong:  #a4acb9;

  --red:          #c8402a;
  --red-ink:      #8f2a18;
  --red-dim:      #f3e4e0;

  --green:        #2f7a52;
  --green-dim:    #e2ede6;

  --amber:        #1a7a6b;
  --amber-dim:    #e3f0ec;

  --shadow: 0 2px 10px rgba(20,30,45,0.06);

  --font-display: 'Big Shoulders Display', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --max: 1180px;
}

/* Night operations — same semantic red/green/amber an EMS keeps in both
   modes; only the ground and ink invert. Follows system preference by
   default; an explicit toggle (data-theme) always wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #0c1015;
    --paper-alt:    #12171e;
    --panel:        #151b23;
    --ink:          #e7ebf1;
    --ink-dim:      #9aa5b5;
    --ink-faint:    #67707f;
    --line:         #262e39;
    --line-strong:  #3a4453;

    --red:          #e2543a;
    --red-ink:      #ff7a5c;
    --red-dim:      #2c1a17;

    --green:        #4ade80;
    --green-dim:    #16261c;

    --amber:        #45a897;
    --amber-dim:    #10231f;

    --shadow: 0 2px 14px rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"] {
  --paper:        #0c1015;
  --paper-alt:    #12171e;
  --panel:        #151b23;
  --ink:          #e7ebf1;
  --ink-dim:      #9aa5b5;
  --ink-faint:    #67707f;
  --line:         #262e39;
  --line-strong:  #3a4453;

  --red:          #e2543a;
  --red-ink:      #ff7a5c;
  --red-dim:      #2c1a17;

  --green:        #4ade80;
  --green-dim:    #16261c;

  --amber:        #45a897;
  --amber-dim:    #10231f;

  --shadow: 0 2px 14px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem;
  font-family: var(--font-mono); font-size: 0.8rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- status strip ---------- */
/* Follows the page theme like everything else — a normal-colored utility
   bar (paper-alt ground, ink text) with the red rail as its only accent,
   rather than a permanently inverted chip. */
.status-strip {
  background: var(--paper-alt);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 1.5rem;
  display: flex;
  gap: 1.75rem;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--red);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.status-strip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); display: inline-block; margin-right: 0.5rem;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.25);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.status-strip span.sep { color: var(--line-strong); }
.status-strip .freq { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- one-line bus navigation ---------- */
.ol-nav-wrap {
  background: var(--panel);
  position: sticky; top: 0; z-index: 100;
}
/* power rail — a current pulse travels the bus continuously */
.ol-power-rail {
  height: 2px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
}
.ol-power-rail::after {
  content: '';
  position: absolute;
  top: 0; left: -18%;
  width: 18%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--amber) 45%, var(--amber) 55%, transparent);
  box-shadow: 0 0 8px 1px var(--amber);
  animation: rail-flow 3.2s linear infinite;
}
@keyframes rail-flow {
  0%   { left: -18%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) { .ol-power-rail::after { animation: none; display: none; } }

/* vertical current pulse — reused by any dotted timeline rail (feed-ladder, act-timeline) */
@keyframes rail-flow-v {
  0%   { top: -18%; }
  100% { top: 100%; }
}
.rail-pulse {
  content: '';
  position: absolute;
  top: -18%; left: 0.4rem;
  width: 2px; height: 18%;
  background: linear-gradient(to bottom, transparent, var(--amber) 45%, var(--amber) 55%, transparent);
  box-shadow: 0 0 8px 1px var(--amber);
  animation: rail-flow-v 3.4s linear infinite;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .rail-pulse { animation: none; display: none; } }
.ol-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ol-nav::-webkit-scrollbar { display: none; }
.ol-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  padding: 0.9rem 1.25rem 0.9rem 0;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  border-right: 1px solid var(--line);
  margin-right: 0.75rem;
}
.ol-brand span { color: var(--red); }
.ol-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.9rem 0.9rem 0.7rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.ol-bus-seg {
  width: 100%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 10px);
}
.ol-node .ol-drop {
  width: 1px;
  height: 8px;
  background: var(--line-strong);
}
.ol-node .ol-breaker {
  width: 12px; height: 12px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s;
}
.ol-node .ol-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  transition: color 0.15s;
}
.ol-node:hover .ol-breaker,
.ol-node.active .ol-breaker { border-color: var(--red); background: var(--red); }
.ol-node:hover .ol-drop,
.ol-node.active .ol-drop { background: var(--red); }
.ol-node:hover .ol-label,
.ol-node.active .ol-label { color: var(--red-ink); font-weight: 700; }
.ol-node.active::after {
  content: '';
  position: absolute; bottom: -1px; left: 0.9rem; right: 0.9rem; height: 2px;
  background: var(--red);
}
.ol-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.7rem; flex-shrink: 0; }
.ol-cv-link {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em;
  border: 1px solid var(--ink); color: var(--ink); text-decoration: none;
  padding: 0.4rem 0.8rem; white-space: nowrap;
}
.ol-cv-link:hover { background: var(--ink); color: var(--paper); }

.theme-toggle {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-dim);
  cursor: pointer; padding: 0;
}
.theme-toggle:hover { border-color: var(--red-ink); color: var(--red-ink); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ---------- hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 2rem; } }
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em;
  color: var(--red-ink); margin: 0 0 0.75rem; text-transform: uppercase;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
  text-transform: uppercase;
  color: var(--ink);
}
.hero-role {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink-dim);
  margin: 0 0 1.75rem;
  letter-spacing: 0.02em;
  height: 1.6rem;
  overflow: hidden;
}
.hero-role strong { color: var(--ink); }
.hero-role-cycle {
  display: flex;
  flex-direction: column;
  line-height: 1.6rem;
  animation: hero-role-cycle 16s infinite;
}
@keyframes hero-role-cycle {
  0%,  18% { transform: translateY(0); }
  25%, 43% { transform: translateY(-1.6rem); }
  50%, 68% { transform: translateY(-3.2rem); }
  75%, 93% { transform: translateY(-4.8rem); }
  100%     { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .hero-role-cycle { animation: none; } .hero-role-cycle span:not(:first-child) { display: none; } }
.hero-desc {
  font-size: 1.02rem; color: var(--ink-dim); max-width: 56ch;
  margin: 0 0 2rem; line-height: 1.75;
}
.hero-cta { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em;
  padding: 0.85rem 1.5rem; text-decoration: none; display: inline-flex;
  align-items: center; gap: 0.5rem; border: 1.5px solid var(--ink);
  text-transform: uppercase;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn-outline { background: transparent; color: var(--ink); }
.btn-outline:hover { border-color: var(--red-ink); color: var(--red-ink); }

/* nameplate */
.nameplate, .hero-photo {
  border: 2px solid var(--ink);
  background: var(--panel);
  position: relative;
}
.hero-photo {
  overflow: hidden;
  line-height: 0;
  margin-top: 2.3rem;
}
@media (max-width: 860px) { .hero-photo { margin-top: 0; } }
.hero-photo img {
  width: 100%;
  height: auto;
  display: block;
}
.nameplate::before, .nameplate::after,
.hero-photo::before, .hero-photo::after,
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border-top: 2px solid var(--red);
  border-left: 2px solid var(--red);
  z-index: 1;
}
.nameplate::before, .hero-photo::before, .panel::before { top: -2px; left: -2px; }
.nameplate::after, .hero-photo::after, .panel::after {
  top: auto; bottom: -2px; right: -2px; left: auto;
  border-top: none; border-bottom: 2px solid var(--red);
  border-left: none; border-right: 2px solid var(--red);
}
.nameplate-head {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
  display: flex; justify-content: space-between;
}
.nameplate-body { padding: 0; }
.nameplate-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 1rem; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.74rem;
}
.nameplate-row dt { color: var(--ink-faint); letter-spacing: 0.05em; }
.nameplate-row dd { margin: 0; color: var(--ink); text-align: right; font-weight: 600; }

/* ---------- generic section scaffolding ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: 3.5rem 1.5rem; }
.section-alt { background: var(--paper-alt); }
.section-alt > .section { padding-top: 3.5rem; }
.bus-divider {
  height: 2px; max-width: var(--max); margin: 0 auto;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 10px, transparent 10px 16px);
}
.sec-label {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  color: var(--red-ink); text-transform: uppercase; margin: 0 0 0.6rem;
}
.sec-title {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 2rem; letter-spacing: -0.01em;
}
.sec-title::after { content: '.'; color: var(--red-ink); }
.sec-title.no-dot::after { content: ''; }

/* panel (replaces glass-card) */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 1.5rem;
}

/* stat / nameplate readouts */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-strong); border: 1px solid var(--line-strong); }
@media (max-width: 700px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-cell { background: var(--panel); padding: 1.75rem 1.5rem; }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; color: var(--red-ink); line-height: 1; }
.stat-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-dim); text-transform: uppercase; margin-top: 0.4rem; }
.stat-desc { font-size: 0.84rem; color: var(--ink-dim); margin-top: 0.6rem; line-height: 1.55; }

/* domain / research grid */
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.1rem; }
.domain-panel { padding: 1.5rem; }
.domain-icon { width: 34px; height: 34px; color: var(--red-ink); margin-bottom: 0.9rem; }
.domain-title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; text-transform: uppercase; margin: 0 0 0.4rem; }
.domain-desc { font-size: 0.86rem; color: var(--ink-dim); margin: 0; line-height: 1.55; }

/* status badges — reuse energized/in-service/pending semantics */
.tag { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; padding: 0.22rem 0.6rem; text-transform: uppercase; border: 1px solid; display: inline-block; }
.tag-live    { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.tag-pending { color: var(--amber); border-color: var(--amber); background: var(--amber-dim); }
.tag-energized { color: var(--red-ink); border-color: var(--red); background: var(--red-dim); }

/* pub / feature cards */
.pub-panel { padding: 1.4rem 1.5rem; margin-bottom: 0.9rem; }
.pub-panel .pub-meta-row { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.pub-panel .pub-num { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); }
.pub-panel h3 { font-family: var(--font-body); font-weight: 700; font-size: 1rem; margin: 0 0 0.35rem; line-height: 1.4; }
.pub-panel .pub-venue { font-size: 0.85rem; color: var(--ink-dim); font-style: italic; margin: 0; }
.pub-panel .pub-link { font-family: var(--font-mono); font-size: 0.7rem; color: var(--red-ink); text-decoration: none; margin-top: 0.5rem; display: inline-block; }
.pub-panel .pub-link:hover { text-decoration: underline; }

/* testimonials */
.testi-panel {
  padding: 1.75rem;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.testi-panel:hover, .testi-panel:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 10px 28px rgba(20,30,45,0.14);
  border-color: var(--red-ink);
  z-index: 2;
}
:root[data-theme="dark"] .testi-panel:hover, :root[data-theme="dark"] .testi-panel:focus-visible { box-shadow: 0 10px 28px rgba(0,0,0,0.5); }
.testi-text {
  font-size: 0.92rem; color: var(--ink-dim); line-height: 1.7; margin: 0 0 1.25rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  transition: -webkit-line-clamp 0.1s;
}
.testi-panel.expanded .testi-text { -webkit-line-clamp: unset; }
.testi-expand-hint {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em; color: var(--red-ink);
  text-transform: uppercase; margin: -0.75rem 0 1rem;
}
.testi-panel.expanded .testi-expand-hint { display: none; }
.testi-author { display: flex; align-items: center; gap: 0.75rem; }
.testi-author img { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--ink); transition: transform 0.22s ease; }
.testi-panel:hover .testi-author img { transform: scale(1.12); }
.testi-name { font-weight: 700; font-size: 0.86rem; margin: 0; }
.testi-role { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); margin: 0; }

/* cta strip */
.cta-strip { text-align: center; padding: 4rem 1.5rem; }
.cta-strip .sec-title { margin-bottom: 1rem; }
.cta-strip p { color: var(--ink-dim); max-width: 46ch; margin: 0 auto 2rem; }

/* ---------- title-block footer ---------- */
.title-block {
  border-top: 2px solid var(--ink);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.tb-inner { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }
.tb-grid { display: grid; grid-template-columns: 2fr repeat(4, 1fr); }
@media (max-width: 900px) { .tb-grid { grid-template-columns: 1fr 1fr; } }
.tb-cell { border-right: 1px solid var(--line); border-top: 1px solid var(--line); padding: 0.9rem 1.1rem; }
.tb-cell:last-child { border-right: none; }
.tb-cell .tb-k { color: var(--ink-faint); letter-spacing: 0.08em; display: block; margin-bottom: 0.3rem; text-transform: uppercase; font-size: 0.64rem; }
.tb-cell .tb-v { color: var(--ink); }
.tb-cell a { color: var(--ink); text-decoration: none; }
.tb-cell a:hover { color: var(--red-ink); }
.tb-bottom { display: flex; justify-content: space-between; padding: 0.8rem 0; color: var(--ink-faint); border-top: 1px solid var(--line); flex-wrap: wrap; gap: 0.5rem; }

/* mobile nav toggle (simple, no JS drama) */
.ol-hamburger { display: none; }
@media (max-width: 640px) {
  .ol-nav-actions .ol-cv-link span.full { display: none; }
}
