@font-face {
  font-family: "Ops Sans";
  src: url("/fonts/ops-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ops Mono";
  src: url("/fonts/ops-mono.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ops Serif";
  src: url("/fonts/ops-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ops Serif";
  src: url("/fonts/ops-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f2eee5;
  --panel: #e9e4d8;
  --ink: #15213b;
  --muted: #4d5770;
  --line: rgba(21, 33, 59, 0.16);
  --accent: #c23b22;
  --accent-copy: #b23820;
  --on-accent: #fff;
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #0d1526;
  --panel: #141e34;
  --ink: #ece7dc;
  --muted: #a4acbf;
  --line: rgba(236, 231, 220, 0.14);
  --accent: #f0603f;
  --accent-copy: #f0603f;
  --on-accent: #0d1526;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: "Ops Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: inherit; }
a:hover { color: var(--accent); }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent); color: var(--on-accent); }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
}

.header-inner,
.page-shell,
.footer-inner {
  width: min(100%, 1296px);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font: 500 15px/1 "Ops Mono", monospace;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-accent { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
  font-size: 14px;
}

.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
}

.theme-toggle {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: 400 12px/1 "Ops Mono", monospace;
}

.theme-toggle:hover,
.theme-toggle:focus-visible { border-color: var(--ink); color: var(--ink); }

.theme-dot {
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.page-shell { min-height: calc(100vh - 154px); }

.hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 32px;
  row-gap: 28px;
  align-items: start;
  padding-block: clamp(64px, 7vw, 96px) clamp(56px, 7vw, 96px);
}

.hero-kicker,
.hero-title { grid-column: 1 / -1; }

.hero-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--accent);
  font: 400 12px/1.5 "Ops Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-kicker-dot { width: 8px; height: 8px; background: var(--accent); }
.hero-kicker-place { color: var(--muted); font-size: 11px; }

.hero-title {
  max-width: 1200px;
  margin: 0;
  font: 400 clamp(54px, 5.2vw, 72px)/1.02 "Ops Serif", Georgia, serif;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-title em { color: var(--accent); font-style: italic; }
.hero-primary { white-space: nowrap; }

.hero-actions {
  grid-column: 1 / 5;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 11px 20px;
  text-decoration: none;
  font-size: 14px;
}

.button-primary { background: var(--ink); color: var(--paper); font-weight: 600; }
.button-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button-secondary:hover { background: var(--ink); color: var(--paper); }

.ledger {
  grid-column: 6 / -1;
  border: 1px solid var(--ink);
  background: var(--panel);
}

.ledger-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font: 400 11px/1.4 "Ops Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ledger-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-label { padding: 20px 18px; border-right: 1px solid var(--line); }
.ledger-copy { padding: 17px 20px; display: grid; gap: 6px; }
.ledger-copy strong { font: 400 24px/1.15 "Ops Serif", Georgia, serif; }
.ledger-copy small { color: var(--muted); font: 400 12px/1.5 "Ops Mono", monospace; }
.type-label { display: inline-block; padding: 3px 7px; border: 1px solid var(--ink); color: var(--ink); font: 500 11px/1.2 "Ops Mono", monospace; letter-spacing: 0.06em; }
.type-code { background: var(--ink); color: var(--paper); }
.type-llm { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.numbered-section {
  border-top: 1px solid var(--ink);
  padding-block: 28px clamp(72px, 8vw, 112px);
}

.section-heading-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}

.section-number { color: var(--muted); font: 400 12px/1.5 "Ops Mono", monospace; }
.section-title { margin: 0; font: 400 clamp(34px, 4vw, 54px)/1.05 "Ops Serif", Georgia, serif; letter-spacing: -0.02em; }
.section-intro { max-width: 70ch; margin: 12px 0 0; color: var(--muted); line-height: 1.65; }

.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.principle { min-height: 180px; padding: 28px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.principle-id { color: var(--accent); font: 400 11px/1.4 "Ops Mono", monospace; }
.principle h3 { margin: 30px 0 12px; font: 400 27px/1.15 "Ops Serif", Georgia, serif; }
.principle p { margin: 0; color: var(--muted); line-height: 1.65; }

.project-list { display: grid; gap: 18px; }
.project-card { display: grid; grid-template-columns: 82px minmax(0, 1fr); border: 1px solid var(--line); text-decoration: none; background: color-mix(in oklab, var(--panel) 45%, transparent); transition: border-color 0.15s ease, transform 0.15s ease; }
.project-card:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-2px); }
.project-index { padding: 26px 20px; border-right: 1px solid var(--line); color: var(--muted); font: 400 12px/1.5 "Ops Mono", monospace; }
.project-content { padding: 26px clamp(20px, 3vw, 38px); }
.project-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--muted); font: 400 11px/1.4 "Ops Mono", monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.project-content h3 { margin: 24px 0 10px; font: 400 clamp(28px, 3vw, 42px)/1.08 "Ops Serif", Georgia, serif; }
.project-content h3 em { color: var(--muted); font-style: italic; }
.project-content > p { max-width: 78ch; margin: 0; color: var(--muted); line-height: 1.65; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip { border: 1px solid var(--line); padding: 6px 9px; color: var(--muted); font: 400 11px/1.3 "Ops Mono", monospace; }
.project-cta { display: inline-block; margin-top: 24px; color: var(--accent-copy); font: 500 12px/1.3 "Ops Mono", monospace; }

.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.skill-group { padding: 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skill-group h3 { margin: 0 0 18px; color: var(--muted); font: 500 12px/1.4 "Ops Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.skill-group ul, .case-list { margin: 0; padding: 0; list-style: none; }
.skill-group li { padding-block: 6px; border-bottom: 1px solid var(--line); }
.skill-group li:last-child { border-bottom: 0; }

.contact-link {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font: italic 400 clamp(34px, 6vw, 76px)/1 "Ops Serif", Georgia, serif;
  letter-spacing: -0.03em;
  text-underline-offset: 10px;
}
.contact-note { max-width: 62ch; margin: 28px 0 0; color: var(--muted); line-height: 1.65; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { padding-block: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 36px; color: var(--muted); font: 400 12px/1.5 "Ops Mono", monospace; }
.privacy-note { flex: 1 0 100%; max-width: 90ch; }

.case-hero { padding-block: clamp(56px, 7vw, 96px) clamp(44px, 6vw, 72px); }
.back-link { display: inline-flex; min-height: 44px; align-items: center; color: var(--muted); text-decoration: none; font: 400 12px/1.4 "Ops Mono", monospace; }
.case-status { display: inline-flex; margin-top: 38px; border: 1px solid var(--line); padding: 6px 10px; color: var(--muted); font: 400 11px/1.3 "Ops Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.case-title { max-width: 1050px; margin: 22px 0 16px; font: 400 clamp(48px, 6vw, 82px)/0.98 "Ops Serif", Georgia, serif; letter-spacing: -0.03em; }
.case-tagline { max-width: 75ch; margin: 0; color: var(--muted); font-size: clamp(18px, 2vw, 22px); line-height: 1.55; }
.case-overview { max-width: 80ch; margin: 28px 0 0; padding-left: 20px; border-left: 2px solid var(--accent); font: italic 400 19px/1.6 "Ops Serif", Georgia, serif; }

.case-section { border-top: 1px solid var(--line); padding-block: 34px clamp(60px, 7vw, 88px); }
.case-section-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px 48px; }
.case-section h2 { margin: 0; color: var(--muted); font: 500 12px/1.5 "Ops Mono", monospace; letter-spacing: 0.1em; text-transform: uppercase; }
.case-copy { max-width: 850px; }
.case-list li { position: relative; padding: 0 0 14px 24px; line-height: 1.6; }
.case-list li::before { content: "·"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.case-body { display: grid; gap: 22px; }
.case-body p { margin: 0; font: 400 20px/1.65 "Ops Serif", Georgia, serif; text-wrap: pretty; }
.pipeline { display: grid; border: 1px solid var(--line); }
.pipeline-step { display: grid; grid-template-columns: 96px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.pipeline-step:last-child { border-bottom: 0; }
.pipeline-type { padding: 17px; border-right: 1px solid var(--line); }
.pipeline-copy { padding: 16px 20px; line-height: 1.55; }
.case-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.case-panel { border: 1px solid var(--line); padding: 24px; }
.case-panel-accent { border-color: color-mix(in oklab, var(--accent) 45%, transparent); background: color-mix(in oklab, var(--accent) 5%, transparent); }
.case-panel h3 { margin: 0 0 18px; color: var(--muted); font: 500 12px/1.5 "Ops Mono", monospace; letter-spacing: 0.08em; text-transform: uppercase; }

.error-page { min-height: 65vh; display: grid; place-content: center; text-align: center; padding-block: 80px; }
.error-code { color: var(--accent); font: 400 12px/1.5 "Ops Mono", monospace; }
.error-page h1 { margin: 18px 0 12px; font: 400 clamp(48px, 8vw, 90px)/1 "Ops Serif", Georgia, serif; }
.error-page p { max-width: 52ch; margin: 0 auto 28px; color: var(--muted); line-height: 1.6; }

@media (max-width: 1050px) {
  .hero-primary { white-space: normal; }
}

@media (max-width: 760px) {
  .header-inner { align-items: stretch; flex-wrap: wrap; gap: 0 16px; padding-block: 10px; }
  .brand { min-height: 44px; }
  .site-nav { order: 2; width: 100%; justify-content: space-between; gap: 4px; border-top: 1px solid var(--line); }
  .site-nav a { justify-content: center; flex: 1; font-size: 13px; }
  .theme-toggle { margin-left: auto; align-self: center; min-height: 40px; }
  .hero { grid-template-columns: minmax(0, 1fr); row-gap: 24px; padding-block: 48px 64px; }
  .hero-kicker, .hero-title, .hero-actions, .ledger { grid-column: 1 / -1; }
  .hero-title { font-size: clamp(44px, 13.5vw, 58px); line-height: 0.98; }
  .hero-actions { padding-top: 0; }
  .ledger { margin-top: 8px; }
  .section-heading-row { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
  .principles, .skills-grid, .case-columns { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 54px minmax(0, 1fr); }
  .project-index { padding: 22px 14px; }
  .project-content { padding: 22px 18px; }
  .case-section-grid { grid-template-columns: 1fr; gap: 24px; }
  .pipeline-step { grid-template-columns: 76px minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .header-inner, .page-shell, .footer-inner { padding-inline: 16px; }
  .brand { font-size: 13px; }
  .brand-mark { width: 24px; height: 24px; }
  .theme-toggle { padding-inline: 8px; }
  .site-nav a { font-size: 12px; }
  .hero-title { font-size: clamp(40px, 12.8vw, 52px); }
  .hero-kicker { font-size: 10px; }
  .hero-kicker-place { flex: 1 0 100%; }
  .ledger-head { padding-inline: 12px; }
  .ledger-row { grid-template-columns: 68px minmax(0, 1fr); }
  .ledger-label { padding: 16px 10px; }
  .ledger-copy { padding: 15px 14px; }
  .ledger-copy strong { font-size: 20px; }
  .section-heading-row { grid-template-columns: 1fr; }
  .section-title { font-size: 36px; }
  .project-card { grid-template-columns: 1fr; }
  .project-index { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .case-title { font-size: clamp(42px, 13vw, 58px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
