/* ============================================
   Foundations — Mission-control HUD
   Pure black + signal red. Sharp edges.
============================================ */
:root {
  --bg:          #0a0a0a;
  --bg-soft:     #111111;
  --bg-panel:    #131313;
  --border:      #1f1f1f;
  --border-mid:  #2a2a2a;
  --border-hot:  #ff1a1a;
  --text:        #ededed;
  --text-muted:  #888888;
  --text-dim:    #555555;
  --sig:         #ff1a1a;
  --sig-strong:  #ff3838;
  --sig-low:     #1f0508;

  --display:     'Space Mono', 'JetBrains Mono', ui-monospace, monospace;
  --sans:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:        'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --easing:      cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mono,
.work-idx,
.work-stack,
.section-num,
.section-sub,
.hero-status,
.connect-key,
.connect-arrow,
.footer,
.site-footer,
.work-name-mono {
  font-family: var(--mono);
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--sig); color: #fff; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; background: transparent; border: 0; color: inherit; cursor: pointer; }

/* Quiet scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-mid); }
::-webkit-scrollbar-thumb:hover { background: var(--sig); }

:focus { outline: none; }
:focus-visible {
  outline: 1px solid var(--sig);
  outline-offset: 3px;
}

/* ============================================
   Screen-reader only
============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Layout
============================================ */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 600px) { main { padding: 0 22px; } }

.section {
  padding: 100px 0 30px;
  scroll-margin-top: 80px;
}
@media (max-width: 720px) {
  .section { padding: 70px 0 20px; }
}

/* Headings */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--text);
}

/* ============================================
   Site nav
============================================ */
.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  padding: 18px 0;
  background: rgba(10, 10, 10, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, padding 0.25s var(--easing);
}
.site-nav.scrolled {
  border-bottom-color: var(--border);
  padding: 12px 0;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
  color: var(--text);
}
.logo-mark {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--sig);
  font-weight: 700;
}
.logo-name {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
}
.nav-links a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
  transition: color 0.2s;
}
.nav-links a .n-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover .n-num { color: var(--sig); }
.nav-links a.active { color: var(--text); }
.nav-links a.active .n-num { color: var(--sig); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  width: 36px; height: 36px;
  position: relative;
}
.nav-toggle span {
  position: absolute;
  left: 8px; right: 8px;
  height: 1.5px;
  background: var(--text);
  border-radius: 0;
  transition: transform 0.3s var(--easing);
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle.open span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); background: var(--sig); }
.nav-toggle.open span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); background: var(--sig); }

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-inner { padding: 0 22px; }
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 60px 0 auto 0;
  z-index: 55;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 36px 32px 56px;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-12px);
  opacity: 0;
  transition:
    transform 0.3s var(--easing),
    opacity 0.3s var(--easing),
    visibility 0s linear 0.3s;
}
.mobile-menu.open {
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition:
    transform 0.3s var(--easing),
    opacity 0.3s var(--easing),
    visibility 0s linear 0s;
}
.mobile-close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: 0;
  font-size: 32px;
  font-weight: 200;
  cursor: pointer;
  color: var(--text-muted);
  width: 40px; height: 40px;
  line-height: 1;
}
.mobile-close:hover { color: var(--sig); }
.mobile-links { display: flex; flex-direction: column; gap: 18px; }
.mobile-links a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 8vw, 48px);
  letter-spacing: -0.005em;
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.4s var(--easing),
    transform 0.4s var(--easing),
    color 0.2s;
}
.mobile-links a .n-num {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
}
.mobile-links a:hover { color: var(--sig); }
.mobile-menu.open .mobile-links a {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(0.1s + var(--i, 0) * 0.07s);
}

/* ============================================
   Hero
============================================ */
.hero {
  position: relative;
  padding: 130px 0 80px;
}
@media (max-width: 720px) {
  .hero { padding: 100px 0 60px; }
}

/* Corner brackets framing the hero */
.hero-frame {
  position: absolute;
  inset: 60px 0 0 0;
  pointer-events: none;
}
.hero-frame::before,
.hero-frame::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--border-mid);
}
.hero-frame::before {
  top: 0; left: 0;
  border-top: 1px solid;
  border-left: 1px solid;
}
.hero-frame::after {
  top: 0; right: 0;
  border-top: 1px solid;
  border-right: 1px solid;
}
@media (max-width: 720px) { .hero-frame { display: none; } }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-mid);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.status-pulse {
  width: 8px; height: 8px;
  background: var(--sig);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 0 rgba(255, 26, 26, 0.55);
  animation: pulse-red 2.4s var(--easing) infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 26, 26, 0.55); }
  50%      { box-shadow: 0 0 0 9px rgba(255, 26, 26, 0); }
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(56px, 12vw, 128px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
  margin-bottom: 26px;
  color: var(--text);
  text-shadow: 0 0 36px rgba(255, 26, 26, 0.10);
}
.hero-glitch {
  position: relative;
  display: inline-block;
}
.hero-glitch::before,
.hero-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
.hero-glitch.glitching::before {
  color: var(--sig);
  z-index: 1;
  animation: glitch-shift-a 0.5s steps(2) 1;
  opacity: 1;
}
.hero-glitch.glitching::after {
  color: #3399ff;
  z-index: 1;
  animation: glitch-shift-b 0.5s steps(2) 1;
  opacity: 1;
}
@keyframes glitch-shift-a {
  0%   { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  20%  { transform: translate(-2px, 1px); clip-path: inset(0 0 60% 0); }
  40%  { transform: translate(2px, -1px); clip-path: inset(40% 0 20% 0); }
  60%  { transform: translate(-1px, 2px); clip-path: inset(70% 0 0 0); }
  80%  { transform: translate(1px, -2px); clip-path: inset(20% 0 40% 0); }
  100% { transform: translate(0, 0); clip-path: inset(0 0 0 0); opacity: 0; }
}
@keyframes glitch-shift-b {
  0%   { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  20%  { transform: translate(2px, -1px); clip-path: inset(60% 0 0 0); }
  40%  { transform: translate(-2px, 1px); clip-path: inset(20% 0 40% 0); }
  60%  { transform: translate(1px, -2px); clip-path: inset(0 0 70% 0); }
  80%  { transform: translate(-1px, 2px); clip-path: inset(40% 0 20% 0); }
  100% { transform: translate(0, 0); clip-path: inset(0 0 0 0); opacity: 0; }
}
.hero-slash {
  color: var(--sig);
  font-weight: 700;
}

.hero-tag {
  max-width: 620px;
  color: var(--text-muted);
  font-family: 'Chakra Petch', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.012em;
  margin-bottom: 38px;
}

/* Status table */
.hero-status {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.st {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}
.st:last-child { border-right: 0; }
.st dt {
  color: var(--text-dim);
  font-size: 10px;
  margin-bottom: 6px;
  letter-spacing: 0.12em;
}
.st dd { color: var(--text); font-weight: 500; }

@media (max-width: 720px) {
  .hero-status { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .hero-status { grid-template-columns: 1fr; }
}

/* ============================================
   Sections
============================================ */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 36px;
}
.section-num {
  font-size: 13px;
  color: var(--sig);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.section-title {
  font-family: var(--display);
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-right: auto;
}
.section-title::after {
  content: '[/]';
  color: var(--sig);
  font-family: var(--mono);
  font-size: 0.65em;
  margin-left: 14px;
  font-weight: 400;
  letter-spacing: 0;
  vertical-align: middle;
  opacity: 0.7;
}
.section-sub {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
@media (max-width: 600px) {
  .section-sub { display: none; }
}

/* ============================================
   Work list — HUD rows
============================================ */
.work-list {
  list-style: none;
  counter-reset: work-item 0;
}
.work-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 28px 24px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  margin-bottom: 16px;
  position: relative;
  transition: border-color 0.25s, background 0.25s, transform 0.3s var(--easing);
}
.work-row:hover {
  border-color: var(--border-mid);
  background: var(--bg-soft);
}
.work-row.private { opacity: 0.85; }

.work-link {
  display: flex;
  align-items: baseline;
  gap: 18px;
  text-decoration: none;
  color: inherit;
}
.work-link.is-private { cursor: default; }
.work-link:hover { color: var(--text); }
.work-link:hover .work-name { color: var(--sig); }

.work-idx {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.work-link:hover .work-idx { color: var(--sig); }

.work-name {
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-right: auto;
  transition: color 0.25s;
}

.work-badge {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  border: 1px solid var(--border-mid);
  padding: 4px 8px;
  transition: color 0.25s, border-color 0.25s;
}
.work-link:hover .work-badge { color: var(--sig); border-color: var(--sig); }
.work-badge.contributor,
.work-badge.legacy { color: var(--text-dim); border-color: var(--border-mid); background: transparent; }
.work-row.legacy { opacity: 0.7; }
.work-row.legacy:hover { opacity: 1; }

/* [LOAD] cell with progress bar */
.load-bar-cell { display: flex; align-items: center; gap: 8px; }
.load-bar {
  flex: 1 1 auto;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.load-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--sig), var(--sig-strong));
  box-shadow: 0 0 6px rgba(255, 26, 26, 0.5);
  transition: width 0.18s linear;
}
.load-pct {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--sig);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.work-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 70ch;
  padding-left: 60px;
}
.work-stack {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding-left: 60px;
  margin-top: 2px;
}

@media (max-width: 600px) {
  .work-row { padding: 22px 18px; }
  .work-desc, .work-stack { padding-left: 0; }
  .work-link { gap: 12px; flex-wrap: wrap; }
}

/* ============================================
   About
============================================ */
.prose p {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 16px;
  max-width: 64ch;
  line-height: 1.7;
}
.prose p + p { color: var(--text-muted); }

/* ============================================
   Connect
============================================ */
.connect-list {
  list-style: none;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.connect-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: baseline;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, padding 0.3s var(--easing);
}
.connect-row:last-child { border-bottom: 0; }
.connect-row:hover {
  background: var(--bg-panel);
  padding-left: 30px;
}
.connect-row:hover .connect-key { color: var(--sig); }
.connect-row:hover .connect-arrow { color: var(--sig); transform: translateX(4px); }

.connect-key {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  transition: color 0.2s;
}
.connect-val {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.connect-val:hover { color: var(--sig); }
.connect-val.plain { color: var(--text); }
.connect-arrow {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.2s, transform 0.3s var(--easing);
}

@media (max-width: 600px) {
  .connect-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .connect-key { font-size: 10px; grid-column: 1 / -1; }
}

/* ============================================
   Footer
============================================ */
.site-footer {
  max-width: 1100px;
  margin: 90px auto 32px;
  padding: 24px 32px 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.site-footer a {
  color: var(--text);
  border-bottom: 1px solid var(--border-mid);
  transition: color 0.2s, border-color 0.2s;
}
.ping-live {
  color: var(--sig);
  font-variant-numeric: tabular-nums;
}
.footer-clock {
  color: var(--sig);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px rgba(255, 26, 26, 0.35);
}
.site-footer a:hover { color: var(--sig); border-bottom-color: var(--sig); }
@media (max-width: 600px) {
  .site-footer {
    padding: 22px 22px 0;
    flex-direction: column;
    gap: 8px;
  }
}

/* ============================================
   Reveal
============================================ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--easing), transform 0.55s var(--easing);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"] { transition-delay: 0.04s; }
.reveal[data-delay="2"] { transition-delay: 0.08s; }
.reveal[data-delay="3"] { transition-delay: 0.12s; }
.reveal[data-delay="4"] { transition-delay: 0.16s; }
.reveal[data-delay="5"] { transition-delay: 0.20s; }
.reveal[data-delay="6"] { transition-delay: 0.24s; }
.reveal[data-delay="7"] { transition-delay: 0.28s; }

/* ============================================
   Boot scanline + terminal cursor
============================================ */
.boot-scanline {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sig) 25%, var(--sig) 75%, transparent);
  box-shadow: 0 0 6px rgba(255, 26, 26, 0.7);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  animation: scanline-sweep 1.4s var(--easing) forwards;
}
@keyframes scanline-sweep {
  0%   { transform: translateY(0);     opacity: 0; }
  8%   {                                opacity: 1; }
  92%  {                                opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.95em;
  background: var(--sig);
  vertical-align: text-bottom;
  margin-left: 0.2em;
  border-radius: 0;
  animation: cursor-blink 1.1s steps(2) infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ============================================
   Body scanline overlay (2030)
============================================ */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 26, 26, 0.025) 0px,
    rgba(255, 26, 26, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
}

/* ============================================
   Permanent status bar + accent glows
============================================ */
.status-bar-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--sig);
  z-index: 4;
  pointer-events: none;
  opacity: 0.85;
  box-shadow: 0 0 10px rgba(255, 26, 26, 0.5);
}

#clock {
  text-shadow: 0 0 8px rgba(255, 26, 26, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .boot-scanline { display: none; }
  .cursor { display: none; }
  body::after { display: none; }
  .load-bar-fill { transition: none !important; }
  .hero-glitch::before, .hero-glitch::after { display: none; }
}
