/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg: #0e0d0a;
  --fg: #e7e3da;
  --muted: rgba(231, 227, 218, 0.55);
  --line: rgba(231, 227, 218, 0.22);
  --line-strong: rgba(231, 227, 218, 0.50);
  --accent: #c9ff3d;
  --font: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-weight: inherit; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
::selection { background: var(--accent); color: var(--bg); }

/* ── Base ───────────────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  color-scheme: dark;
}

/* Blueprint grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(231,227,218,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(231,227,218,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  z-index: 0;
}

/* ── Page transition ────────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  animation: pageIn 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.doc-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.hover-invert {
  cursor: pointer;
  padding: 4px 8px;
  transition: background 0.12s, color 0.12s;
  display: inline-block;
}
.hover-invert:hover { background: var(--fg); color: var(--bg); }

/* ── Live dot ───────────────────────────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 5px;
  vertical-align: 1px;
  animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(201,255,61,0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(201,255,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,255,61,0); }
}

/* ── Corner crops ───────────────────────────────────────────────────────── */
.crops {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crops::before, .crops::after,
.crops > span::before, .crops > span::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(231,227,218,0.5);
}
.crops::before  { top: 0; left: 0;  border-right: none; border-bottom: none; }
.crops::after   { top: 0; right: 0; border-left: none;  border-bottom: none; }
.crops > span { display: contents; }
.crops > span::before { bottom: 0; left: 0;  border-right: none; border-top: none; }
.crops > span::after  { bottom: 0; right: 0; border-left: none;  border-top: none; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 13px 22px;
  border: 1.5px solid var(--fg);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--fg); color: var(--bg); }

.btn-filled { background: var(--fg); color: var(--bg); }
.btn-filled:hover { background: transparent; color: var(--fg); }

.btn-group { display: inline-flex; }
.btn-group .btn:not(:first-child) { border-left: none; }

/* ── Chips ──────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--fg); }
.chip.is-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ── Keyboard ───────────────────────────────────────────────────────────── */
kbd {
  font-family: var(--font);
  font-size: 10px;
  border: 1px solid var(--line-strong);
  padding: 2px 6px;
  background: transparent;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); }

/* ── Top bar ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 12px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-strong);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar-status { justify-self: center; opacity: 0.6; }

.topbar-nav {
  justify-self: end;
  display: flex;
  gap: 24px;
}

.nav-link {
  cursor: pointer;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
  opacity: 0.55;
}
.nav-link:hover { opacity: 1; }
.nav-link.is-active { opacity: 1; border-bottom-color: currentColor; }

/* ── Banner ─────────────────────────────────────────────────────────────── */
.banner {
  position: relative;
  min-height: 720px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line-strong);
}

.side-rail {
  position: absolute;
  top: 44px;
  bottom: 44px;
  width: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
}
.side-rail--left  { left: 0;  border-right: 1px solid var(--line); }
.side-rail--right { right: 0; border-left:  1px solid var(--line); }

.banner-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  padding: 40px 56px 24px;
}

.banner-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
}

.banner-title {
  font-size: clamp(72px, 8vw, 110px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-top: 18px;
}

.banner-desc {
  font-size: 13px;
  opacity: 0.78;
  margin-top: 22px;
  max-width: 580px;
  line-height: 1.55;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.banner-actions { margin-top: 22px; }

/* ── Spec strip ─────────────────────────────────────────────────────────── */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 1.4fr;
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--fg);
  font-size: 11px;
  letter-spacing: 0.1em;
  margin-top: 32px;
}

.spec-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--fg);
}
.spec-cell:last-child { border-right: none; }

.spec-cell--link {
  cursor: pointer;
  transition: background 0.15s;
}
.spec-cell--link:hover { background: rgba(231,227,218,0.06); }

.spec-cell-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  opacity: 0.6;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.spec-val {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 4px;
  line-height: 1.15;
}
.spec-val--mono {
  font-size: 14px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.spec-val--sm { font-size: 16px; }

/* ── Banner footer ──────────────────────────────────────────────────────── */
.banner-footer {
  padding: 12px 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line-strong);
}

/* ── Hero plate ─────────────────────────────────────────────────────────── */
.hero-plate {
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.hero-cover {
  flex: 1;
  min-height: 360px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.hero-plate:hover .hero-cover { border-color: var(--fg); }

.hero-cover-fig {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 2;
}

.hero-cover-action {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 2;
}

.hero-cover-dim {
  position: absolute;
  bottom: 14px;
  right: 14px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 2;
}

/* ── Index section ──────────────────────────────────────────────────────── */
.index-section { padding: 48px 56px; }

.index-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--fg);
  gap: 24px;
}

.index-title {
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-top: 6px;
}

.index-meta {
  font-size: 10px;
  margin-top: 6px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.filter-row { display: flex; }
.filter-row .chip:not(:first-child) { border-left: none; }

/* ── Card grid ──────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.empty-message {
  grid-column: 1 / -1;
  padding: 48px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.2s;
}

.card-grid.is-hovering .card:not(:hover) { filter: opacity(0.5); }
.card:hover { transform: translateY(-3px); }
.card:hover .card-cover { border-color: var(--fg); }
.card:hover .card-overlay { opacity: 1; }

.card--deprecated { opacity: 0.55; }
.card--deprecated:hover { opacity: 0.8; }

.card-cover {
  position: relative;
  overflow: hidden;
  height: 220px;
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.card-cover--sm { height: 140px; }

.card-cover-fig {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14,13,10,0.86);
  border: 1.5px solid var(--fg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.card-overlay-meta {
  font-size: 9px;
  letter-spacing: 0.18em;
  opacity: 0.6;
  text-transform: uppercase;
}

.card-overlay-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.05;
  margin-top: 6px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.card-overlay-tagline {
  font-size: 10px;
  opacity: 0.78;
  margin-top: 6px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.card-overlay-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-overlay-status {
  font-size: 9px;
  letter-spacing: 0.12em;
  opacity: 0.7;
  text-transform: uppercase;
}

.card-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Footer bar ─────────────────────────────────────────────────────────── */
.footer-bar {
  padding: 14px 56px;
  border-top: 1px solid var(--line-strong);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-top { cursor: pointer; transition: color 0.15s; }
.footer-top:hover { color: var(--fg); }

/* ── Detail (record) page ───────────────────────────────────────────────── */
.record-crumb {
  padding: 14px 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  gap: 24px;
}

.record-crumb-left,
.record-crumb-right {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.record-crumb-sep { opacity: 0.5; }
.record-crumb-adj { opacity: 0.55; }

.record-header {
  padding: 40px 56px 24px;
  border-bottom: 1px solid var(--line-strong);
}

.record-title {
  font-size: clamp(56px, 7vw, 110px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-top: 16px;
}

.record-tagline {
  font-size: 14px;
  opacity: 0.78;
  margin-top: 18px;
  max-width: 720px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.record-body {
  padding: 40px 56px;
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 40px;
  border-bottom: 1px solid var(--line-strong);
}

.record-section { margin-top: 36px; }

.record-desc {
  font-size: 15px;
  line-height: 1.65;
  margin-top: 12px;
  letter-spacing: 0.02em;
}

/* ── Embed ──────────────────────────────────────────────────────────────── */
.embed-plate {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  margin-top: 12px;
  overflow: hidden;
}

.embed-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
}

.embed-placeholder-cover {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.embed-load-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.embed-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.embed-stop-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
}

.embed-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 4px 0;
}

/* ── Spec table ─────────────────────────────────────────────────────────── */
.spec-table {
  border: 1px solid var(--fg);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-strong);
  gap: 12px;
}
.spec-row--last { border-bottom: none; }
.spec-row-key { opacity: 0.55; flex-shrink: 0; }
.spec-row-val { font-weight: 600; text-align: right; }

/* ── Record aside ───────────────────────────────────────────────────────── */
.record-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
}
.record-actions .btn:not(:first-child) { border-top: none; }

.key-hint {
  margin-top: 28px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key-hint-label {
  opacity: 0.6;
  margin-bottom: 4px;
}

.key-hint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.key-hint-row span:last-child { opacity: 0.7; }

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ── Related records ────────────────────────────────────────────────────── */
.related-section {
  padding: 36px 56px;
  border-bottom: 1px solid var(--line-strong);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 14px;
}

/* ── Info page ──────────────────────────────────────────────────────────── */
.info-body {
  padding: 40px 56px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  border-bottom: 1px solid var(--line-strong);
}

.id-plate {
  position: relative;
  height: 260px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(135deg, #0a120a, #1a2e0a);
}

.id-plate-fig {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-section { margin-top: 36px; }
.info-section:first-child { margin-top: 0; }

/* ── Git feed ───────────────────────────────────────────────────────────── */
.git-feed {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.feed-row {
  display: grid;
  grid-template-columns: 42px 120px 60px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  align-items: baseline;
}

.feed-when  { opacity: 0.55; }
.feed-repo  { opacity: 0.85; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-kind  { opacity: 0.65; }
.feed-msg   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }

.feed-empty {
  opacity: 0.45;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 16px 0;
}

/* ── Game overlay ───────────────────────────────────────────────────────── */
#game-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
}

#game-overlay iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.overlay-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10000;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 22, 0.82);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #e7e3da;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.overlay-close:hover { opacity: 1; }

/* ── Home page ──────────────────────────────────────────────────────────── */
.home-hero {
  padding: 64px 56px 56px;
  border-bottom: 1px solid var(--line);
}

.home-title {
  font-size: clamp(42px, 7vw, 72px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 12px 0 20px;
  text-transform: uppercase;
}

.home-tagline {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
  max-width: 520px;
  line-height: 1.6;
  margin: 0 0 32px;
}

.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 1px solid var(--line);
}

.home-stat {
  padding: 32px 56px;
  border-right: 1px solid var(--line);
}

.home-stat:last-child { border-right: none; }

.home-stat-val {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .home-stats { grid-template-columns: 1fr; }
  .home-stat  { border-right: none; border-bottom: 1px solid var(--line); padding: 24px 0; }
  .home-stat:last-child { border-bottom: none; }
}
