/* ── Reset & tokens ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0F0E0C;
  --bg-raised: #16140F;
  --fg: #F1ECDF;
  --fg-dim: #A39B8A;
  --fg-faint: #5C5648;
  --accent: #FC6D26;
  --accent-deep: #DB3B21;
  --rule: #2A2620;
  --shipped: #7AB87A;
  --queued: #C9A96E;
  --next: #FC6D26;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
em { font-style: italic; }

/* ── Grain overlay ───────────────────────────────── */
#grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ── Typography utilities ────────────────────────── */
.mono {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.accent { color: var(--accent); }

.lede {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--fg-dim);
  max-width: 60ch;
  line-height: 1.7;
  margin-top: 1.5rem;
}

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.badge.shipped { color: var(--shipped); }
.badge.queued  { color: var(--queued); }
.badge.next    { color: var(--next); }

/* ── Top bar ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2.5rem;
  background: var(--bg);
  border-bottom: 1px dashed var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-faint);
}

.topbar .domain { color: var(--fg); font-size: 13px; }
.topbar .meta   { color: var(--fg-faint); }

@media (max-width: 600px) {
  .topbar .meta { display: none; }
  .topbar { padding: 1rem 1.5rem; }
}

/* ── Divider ─────────────────────────────────────── */
.divider { max-width: 1200px; margin: 0 auto; padding: 0 2.5rem; }
.divider hr { border: none; border-top: 1px dashed var(--rule); }

/* ── Section label ───────────────────────────────── */
.label {
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  margin-bottom: 2rem;
}

/* ── Cursor blink ────────────────────────────────── */
.cursor {
  display: inline-block;
  width: 2px;
  height: 0.75em;
  background: var(--fg);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Reveal animation ────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal 0.8s ease forwards;
}

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

.reveal:nth-child(1)  { animation-delay: 0.0s; }
.reveal:nth-child(2)  { animation-delay: 0.1s; }
.reveal:nth-child(3)  { animation-delay: 0.2s; }
.reveal:nth-child(4)  { animation-delay: 0.3s; }
.reveal:nth-child(5)  { animation-delay: 0.4s; }
.reveal:nth-child(6)  { animation-delay: 0.5s; }
.reveal:nth-child(7)  { animation-delay: 0.6s; }
.reveal:nth-child(8)  { animation-delay: 0.7s; }

/* ── Hero section ────────────────────────────────── */
.hero {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 7rem 2.5rem 5rem;
}

.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 2rem;
}

.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  max-width: 16ch;
  margin-bottom: 0.5rem;
}

.hero h1 em { font-style: italic; color: var(--accent); }

/* ── Projects section ────────────────────────────── */
.projects {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2.5rem;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.projects-header .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-faint);
}

/* ── Cards ───────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--rule);
}

.card {
  background: var(--bg-raised);
  border: none;
  padding: 2rem;
  transition: transform 0.18s ease, border-top-color 0.18s ease;
  border-top: 3px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  transform: translateY(-2px);
  border-top-color: var(--accent);
  text-decoration: none;
}

.card .card-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  margin-bottom: 0.75rem;
}

.card h3 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.card h3 em { font-style: italic; color: var(--accent); }

.card .card-desc {
  font-size: 0.9rem;
  color: var(--fg-dim);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.card-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.card-links a:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────── */
footer {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px dashed var(--rule);
}

footer .sig {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--fg-dim);
}

footer .links {
  display: flex;
  gap: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

footer .links a {
  color: var(--fg-faint);
  transition: color 0.15s;
}

footer .links a:hover { color: var(--fg); text-decoration: none; }

/* ═══════════════════════════════════════════════════
   SUB-PAGE STYLES
═══════════════════════════════════════════════════ */

/* ── Sprint header ───────────────────────────────── */
.sprint-header {
  position: relative;
  z-index: 2;
  padding: 6rem 2.5rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.sprint-header h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 1.5rem 0 2rem;
  max-width: 18ch;
}

.sprint-header h1 em { font-style: italic; color: var(--accent); }

/* ── Zones ───────────────────────────────────────── */
.zone {
  position: relative;
  z-index: 2;
  padding: 5rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.zone h2 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 1.5rem 0 1.25rem;
}

.zone p {
  color: var(--fg-dim);
  max-width: 64ch;
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.zone p:last-child { margin-bottom: 0; }

/* ── Product zone ────────────────────────────────── */
.product-zone .repo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.6rem 1rem;
  margin-bottom: 2rem;
  transition: background 0.2s;
}

.product-zone .repo-link:hover { background: rgba(252,109,38,0.1); text-decoration: none; }

.product-zone pre,
.sql-block {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-dim);
  white-space: pre;
}

/* SQL syntax colours */
.sql-comment { color: var(--fg-faint); }
.sql-keyword { color: var(--accent); }
.sql-string  { color: var(--shipped); }

/* ── Signal columns (VoC) ────────────────────────── */
.signal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  background: var(--rule);
  margin: 2rem 0;
}

.signal-col {
  background: var(--bg-raised);
  padding: 1.5rem;
}

.signal-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.signal-col p {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 0.9rem;
  color: var(--fg-dim);
  line-height: 1.6;
  font-style: italic;
}

@media (max-width: 640px) {
  .signal-columns { grid-template-columns: 1fr; }
}

/* ── Pipeline stages ─────────────────────────────── */
.pipeline-stages {
  display: grid;
  gap: 1px;
  background: var(--rule);
  margin: 2rem 0;
}

.stage-row {
  background: var(--bg-raised);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.stage-row .stage-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 0.2rem;
}

.stage-row .stage-desc {
  font-size: 0.9rem;
  color: var(--fg-dim);
  line-height: 1.6;
}

/* ── Back link ───────────────────────────────────── */
.back-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--fg-faint);
  transition: color 0.15s;
}

.back-link:hover { color: var(--fg); text-decoration: none; }

/* ── Slider controls ─────────────────────────────── */
.calc-slider-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.calc-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.calc-slider-header label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.calc-slider-value {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  color: var(--accent);
}

input[type="range"].calc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--rule);
  outline: none;
  cursor: pointer;
  border-radius: 1px;
}

input[type="range"].calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"].calc-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.calc-slider-range {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
}

.calc-slider-desc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
  margin-top: 0.1rem;
}

/* ── Progress bar ────────────────────────────────── */
.calc-bar-wrap {
  margin: 2rem 0;
}

.calc-bar-header {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calc-bar-track {
  width: 100%;
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.calc-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.calc-bar-caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-faint);
  margin-top: 0.5rem;
}

/* ── Calculator ──────────────────────────────────── */
.calc-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.calc-input {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 0.6rem 0.8rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.calc-input:focus { border-color: var(--accent); }
.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.calc-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--rule);
  margin-bottom: 2rem;
}

.calc-output-card {
  background: var(--bg-raised);
  padding: 1.5rem;
}

.calc-output-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.75rem;
}

.calc-output-value {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--fg);
  line-height: 1.1;
}

.calc-output-value.positive { color: var(--shipped); }

.calc-breakdown {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.calc-breakdown-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 1rem;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  align-items: baseline;
}

.breakdown-row:last-child { border-bottom: none; }
.breakdown-row .year { color: var(--fg-faint); }
.breakdown-row .cost { color: var(--fg-dim); }
.breakdown-row .saving { color: var(--shipped); }
.breakdown-row .net { color: var(--fg); font-weight: 700; }

.assumptions-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--fg-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1rem;
}

.assumptions-toggle:hover { background: var(--bg-raised); color: var(--fg); }

.assumptions-panel {
  display: none;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.assumptions-panel.open { display: block; }

.assumptions-panel p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

/* ── Contact form ────────────────────────────────── */
.contact-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
}

.contact-form {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact-intro {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--fg-dim);
  line-height: 1.65;
  max-width: 52ch;
  margin-bottom: 0.5rem;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.contact-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contact-field input,
.contact-field textarea {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  color: var(--fg);
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s ease;
  resize: vertical;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--fg-faint);
}

.contact-field input:focus,
.contact-field textarea:focus {
  border-color: var(--accent);
}

.contact-submit {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--accent);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.contact-submit:hover {
  background: rgba(252,109,38,0.08);
  transform: translateY(-1px);
}

.calc-caveats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-faint);
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  line-height: 1.7;
}
