/* 0x13.cc — homepage. Tokens from the 0x13.cc design system (ds/0x13cc/tokens.json). */

:root,
.band-dark {
  --bg0: #07090a;
  --bg1: #0d1110;
  --bg2: #141a18;
  --inset: #050706;
  --line: #1f2a26;
  --line2: #2d3d36;
  --fg0: #e8f5ec;
  --fg1: #b8c9bf;
  --fg2: #6c8077;
  --fg3: #3d4d46;
  --accent: #00ff66;
  --accent-bright: #66ff99;
  --accent-ink: #001a08;
  --amber: #ffb020;
  --hero-hi: #0f1714;
  --glow: rgba(0, 255, 102, .45);
  --scan: rgba(255, 255, 255, .03);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg0: #f4f1ea;
  --bg1: #ffffff;
  --bg2: #ebe7dd;
  --inset: #ebe7dd;
  --line: #d5d0c2;
  --line2: #a39e8e;
  --fg0: #0a0e0c;
  --fg1: #2f3835;
  --fg2: #5d6661;
  --fg3: #8d958f;
  --accent: #006e2e;
  --accent-bright: #0a0e0c;
  --accent-ink: #ffffff;
  --amber: #8a5700;
  --hero-hi: #fbfaf6;
  color-scheme: light;
}

:root {
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Space Grotesk', ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Spectral', Georgia, serif;
  --gutter: clamp(16px, 3vw, 48px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* the always-dark band re-declares tokens, so it also needs its own ground */
.band-dark { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg0);
  color: var(--fg1);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
pre { font-family: var(--mono); }

a { color: var(--accent); }
a:hover { color: var(--accent-bright); }
a:focus-visible, button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 24px var(--glow);
}

/* ---------- utilities ---------- */
.wrap { max-width: 1360px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.accent { color: var(--accent); }
.amber { color: var(--amber); }
.fg0 { color: var(--fg0); }
.fg1 { color: var(--fg1); }
.dim { color: var(--fg2); }
.b800 { font-weight: 800; }
.grow { flex: 1 1 auto; }
.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;
}
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; }
.meta { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--fg2); margin: 0; }
.body-lg { margin: 0; font-size: 17px; max-width: 46ch; }
.h2 {
  margin: 0; font-family: var(--mono); font-weight: 700;
  font-size: clamp(26px, 3vw, 38px); letter-spacing: -.02em; color: var(--fg0);
}
.h3 { margin: 0; font-family: var(--mono); font-weight: 700; font-size: 26px; letter-spacing: -.02em; color: var(--fg0); }
.fade-right {
  overflow: hidden; white-space: pre;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .12em;
  text-decoration: none;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 24px rgba(0, 255, 102, .35); }
.btn-primary:hover { background: var(--accent-bright); color: var(--accent-ink); }
:root[data-theme="light"] .btn-primary { box-shadow: none; }
:root[data-theme="light"] .btn-primary:hover { color: var(--bg1); }
.btn-outline { border: 1px solid var(--line2); color: var(--fg0); }
.btn-outline:hover { border-color: var(--accent); color: var(--fg0); }
.btn-accent-outline { align-self: flex-start; border: 1px solid var(--accent); color: var(--accent); }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 2; border-bottom: 1px solid var(--line); }
.nav {
  padding-top: 8px; padding-bottom: 8px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 32px;
}
.brand { font-family: var(--mono); font-weight: 800; font-size: 17px; color: var(--fg0); text-decoration: none; padding: 12px 0; }
.brand:hover { color: var(--fg0); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; }
.nav-links a { color: var(--fg1); text-decoration: none; padding: 16px 0; }
.nav-links a.accent { color: var(--accent); }
.nav-links a:hover { color: var(--accent-bright); }
.theme-toggle {
  min-height: 44px; padding: 0 2px; background: none; border: 0; cursor: pointer; color: var(--fg1);
}
.theme-toggle:hover { color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, var(--hero-hi) 0%, var(--bg0) 65%);
}
.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scan) 0, var(--scan) 1px, transparent 1px, transparent 3px);
}
.hero-inner {
  position: relative;
  padding-top: clamp(48px, 7vw, 104px); padding-bottom: clamp(56px, 7vw, 96px);
  display: flex; flex-direction: column; gap: 48px;
}
.hero-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 32px 56px; }
.wordmark {
  margin: 0; font-family: var(--mono); font-weight: 800;
  font-size: clamp(104px, 17vw, 240px); line-height: .85; letter-spacing: -.06em; color: var(--fg0);
}
.hex-table {
  flex: 1 1 300px; max-width: 420px; margin: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  font-family: var(--mono); font-size: 13px; border-top: 1px solid var(--line2);
}
.hex-table dt, .hex-table dd { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hex-table dt { color: var(--fg2); letter-spacing: .12em; font-size: 11px; font-weight: 600; }
.hex-table dd { margin: 0; color: var(--fg0); }
.hex-table dd.accent { color: var(--accent); }
.hex-table .hex-note {
  grid-column: 1 / -1; padding: 10px 0 0; border: 0;
  font-family: var(--sans); font-size: 14px; color: var(--fg1);
}
.hero-bottom {
  display: flex; flex-wrap: wrap; gap: 32px 64px; align-items: flex-end;
  border-top: 1px solid var(--line); padding-top: 40px;
}
.hero-title {
  flex: 999 1 520px; min-width: 0; margin: 0;
  font-family: var(--mono); font-weight: 700; font-size: clamp(30px, 3.8vw, 52px);
  line-height: 1.12; letter-spacing: -.025em; color: var(--fg0);
}
.hero-ctas { flex: 1 1 320px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections ---------- */
.section { border-top: 1px solid var(--line); }
.section-raised { background: var(--bg1); }
.section-inner { padding-top: 88px; padding-bottom: 88px; display: flex; flex-direction: column; gap: 32px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }

/* ---------- work ---------- */
.group { display: flex; flex-direction: column; gap: 12px; }
.group-lab { margin-top: 24px; }
.rule-label { display: flex; align-items: center; gap: 16px; color: var(--fg2); }
.rule { flex: 1 1 auto; height: 1px; background: var(--line); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; margin-right: 8px; }
.dot-live { background: var(--accent); box-shadow: 0 0 8px rgba(0, 255, 102, .6); }
.dot-amber { background: var(--amber); }

.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.card { min-width: 0; background: var(--bg1); border: 1px solid var(--line); display: flex; flex-direction: column; }
.card-wide { flex: 2 1 560px; }
.card-narrow { flex: 1 1 320px; }
.card-kicker { padding: 14px 20px; color: var(--fg2); }
.card-media { margin: 0 20px; }
.card-media-frame { background: var(--bg2); border: 1px solid var(--line2); padding: 12px; }
.card-media-frame img { width: 100%; height: auto; aspect-ratio: 1200 / 627; object-fit: cover; border: 1px solid var(--line); }
.card-media-black { background: #000; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.card-media-black img { width: 100%; max-width: 360px; height: auto; }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.card-body > p { margin: 0; }
.card-link {
  align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em;
}
.term-well { margin-top: 6px; background: var(--inset); border: 1px solid var(--line); padding: 12px 14px; }
.term-well pre { margin: 0; font-size: 12px; line-height: 1.7; color: var(--fg1); }

.lab { padding: 20px; display: flex; flex-wrap: wrap; gap: 16px 24px; }
.lab-col { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.lab-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.lab-title { margin: 0; height: 40px; display: flex; align-items: center; }

/* Étudely keeps its own paper palette in both themes */
.etudely {
  flex: 1 1 auto; background: #FAF7F0; color: #1C1A17; border: 1px solid var(--line2);
  padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px;
}
.etudely-logo { height: 52px; width: auto; margin-left: -14px; }
.etudely-tagline { margin: 0; font-family: var(--serif); font-size: 23px; line-height: 1.3; color: #1C1A17; }
.etudely-tagline em { color: #4C4491; }
.etudely-body { margin: 0; font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 15px; line-height: 1.55; color: #3d3a33; }
.etudely-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #E6DFCE; }
.etudely-foot img { width: 100%; height: auto; }

.ledger {
  flex: 1 1 auto; background: var(--inset); border: 1px solid var(--line2);
  padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px;
}
.ledger > p { margin: 0; }
.ledger-title { font-family: var(--mono); font-weight: 800; font-size: 28px; letter-spacing: -.03em; color: var(--fg0); }
.ledger-tagline { font-family: var(--mono); font-size: 20px; line-height: 1.4; font-weight: 700; letter-spacing: -.01em; color: var(--fg0); }
.ledger-log { flex: 1 1 auto; display: flex; flex-direction: column; padding-top: 4px; }
.ledger-log pre {
  flex: 1 1 auto; margin: 0; padding: 14px 16px; background: var(--bg1); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.75; color: var(--fg1);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}

/* ---------- work with us ---------- */
.help {
  padding-top: 88px; padding-bottom: 88px;
  display: flex; flex-wrap: wrap; gap: 48px 64px; align-items: center;
}
.help-copy { flex: 1 1 380px; display: flex; flex-direction: column; gap: 20px; }
.help-copy .eyebrow { margin: 0; }
.help-title {
  margin: 0; font-family: var(--mono); font-weight: 700; font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.15; letter-spacing: -.02em; color: var(--fg0);
}
.terminal { flex: 999 1 520px; min-width: 0; margin: 0; border: 1px solid var(--line2); background: var(--inset); }
.terminal-bar { padding: 10px 16px; background: var(--bg2); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--fg1); }
.terminal pre { margin: 0; padding: 24px 20px; font-size: 14px; line-height: 1.85; color: var(--fg1); overflow-x: auto; }

/* ---------- approach (always dark) ---------- */
.band-dark { position: relative; overflow: hidden; background: var(--bg0); color: var(--fg1); border-top: 1px solid var(--line); }
.band-content { position: relative; z-index: 1; }
.approach { padding-top: 120px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 56px; }
.manifesto {
  margin: 0; font-family: var(--mono); font-weight: 800; font-size: clamp(36px, 6.4vw, 92px);
  line-height: 1; letter-spacing: -.04em; color: var(--fg0);
}
.quote { margin: -16px 0 0; display: flex; flex-direction: column; gap: 4px; max-width: 760px; }
.quote p { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.35; color: #A9A3E6; }
.quote a { align-self: flex-start; font-family: var(--serif); font-size: 18px; color: var(--fg1); text-decoration: none; padding: 10px 0; }
.quote a:hover { color: var(--accent-bright); }
.principles { display: flex; flex-wrap: wrap; gap: 16px; }
.principle {
  flex: 1 1 240px; min-width: 0; padding: 22px 22px 24px;
  background: var(--bg1); border: 1px solid var(--line); border-top-color: var(--line2);
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.principle:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(0, 255, 102, .25); }
.principle-num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.principle h3 { margin: 0; font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--fg0); }
.principle p { margin: 0; color: var(--fg1); }
.hexdump-wrap { padding-bottom: 32px; overflow: hidden; }
.hexdump {
  width: fit-content; max-width: 100%; margin: 0; overflow: hidden; white-space: pre;
  font-size: 12px; line-height: 1.75; color: var(--fg1);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 120px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 120px), transparent);
}

/* CRT glow on "learning" */
.crt-glow {
  display: inline-block;
  text-shadow: 0 0 6px rgba(0, 255, 102, .6), 0 0 24px rgba(0, 255, 102, .35);
  animation: crt-glow 5s ease-in-out infinite;
}
@keyframes crt-glow {
  0%, 100% { text-shadow: 0 0 6px rgba(0, 255, 102, .6), 0 0 24px rgba(0, 255, 102, .35); opacity: 1; }
  45% { text-shadow: 0 0 10px rgba(0, 255, 102, .85), 0 0 40px rgba(0, 255, 102, .55), 0 0 80px rgba(0, 255, 102, .2); opacity: 1; }
  88% { opacity: 1; }
  89% { opacity: .78; }
  90% { opacity: 1; }
  92% { opacity: .86; transform: translateX(1px); }
  93% { opacity: 1; transform: none; }
}

/* matrix rain */
.matrix { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 700ms var(--ease); }
.matrix.on { opacity: .3; }
.mx-col {
  position: absolute; top: 0; white-space: pre;
  font-family: var(--mono); font-size: 14px; line-height: 1.2; color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 255, 102, .55);
  animation: mx-fall linear infinite; animation-play-state: paused;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, .85) 85%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, .85) 85%, #000 100%);
}
.matrix.on .mx-col { animation-play-state: running; }
@keyframes mx-fall { from { transform: translateY(-100%); } to { transform: translateY(1800px); } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line2); background: var(--inset); }
.footer {
  padding-top: 48px; padding-bottom: 36px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px 32px;
}
.footer-cta { display: flex; flex-direction: column; gap: 6px; }
.footer-title { margin: 0; font-family: var(--mono); font-weight: 700; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.02em; color: var(--fg0); }
.footer-email { margin: 0; font-family: var(--mono); font-size: 18px; letter-spacing: -.01em; color: var(--fg1); }
.footer-email a { display: inline-block; padding: 10px 0; font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.footer-links a { color: var(--fg1); text-decoration: none; padding: 14px 0; }
.footer-links a:hover { color: var(--accent-bright); }
.footer-legal { flex: 1 1 100%; padding-top: 20px; border-top: 1px solid var(--line); }
.caret-blink { animation: caret-blink 1.1s steps(1) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .crt-glow, .caret-blink { animation: none; }
  .matrix { display: none; }
}
