:root {
  color-scheme: light;
  --bg: #fffdf8;
  --surface: #ffffff;
  --surface-2: #f6f1e8;
  --line: #ded8cb;
  --line-strong: #746f66;
  --text: #201e1a;
  --muted: #746f66;
  --accent: #df562d;
  --accent-dark: #bd4525;
  --accent-soft: #f9e3dc;
  --accent-2: #397468;
  --accent-2-soft: #e6f0ed;
  --purple: #7f5a78;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.shell { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(20px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,.9);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; background: var(--text); color: #fff; font-weight: 900;
}
.brand > span:last-child { display: flex; align-items: baseline; gap: 8px; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
nav { display: flex; gap: 28px; color: var(--muted); font-size: .9rem; }
nav a:hover, nav a:focus-visible { color: var(--text); }

.hero { padding: 92px 0 70px; }
.eyebrow, .section-kicker {
  color: var(--accent-dark); font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 900px; margin: 22px 0; font-size: clamp(3rem, 7.2vw, 6.8rem); line-height: .94; letter-spacing: -.065em; }
h1 em { color: var(--accent); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-copy { max-width: 710px; color: var(--muted); font-size: clamp(1.05rem, 1.7vw, 1.3rem); }
.hero-actions { display: flex; gap: 12px; margin: 32px 0 64px; }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text); cursor: pointer;
}
.button:hover, .icon-button:hover, .button:focus-visible, .icon-button:focus-visible { border-color: var(--accent); outline: none; }
.button-primary { border-color: var(--text); background: var(--text); color: #fff; font-weight: 800; }

.rewrite-summary {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1.25fr; align-items: stretch; gap: 18px;
  padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.rewrite-summary > div { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.rewrite-summary span { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.rewrite-summary code { color: var(--text); font-size: .9rem; }
.rewrite-summary small { color: var(--muted); }
.rewrite-summary .summary-featured { border-radius: 10px; background: var(--accent-soft); }
.summary-arrow { align-self: center; color: var(--accent) !important; font-size: 1.4rem !important; }

.demo-section { padding: 88px 0; background: var(--surface-2); border-block: 1px solid var(--line); }
.example-selector {
  display: inline-flex; align-items: center; gap: 6px; margin: 20px 0 8px; padding: 5px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.example-selector > span { padding: 0 9px; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.example-selector button {
  min-height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 700;
}
.example-selector button:hover, .example-selector button:focus-visible { border-color: var(--line-strong); outline: none; }
.example-selector button[aria-selected="true"] { border-color: var(--text); background: var(--text); color: white; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin: 10px 0 32px; }
h2 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.06; letter-spacing: -.045em; }
.section-heading p, .results-intro { max-width: 680px; margin-bottom: 0; color: var(--muted); }

.plan-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.plan-tabs button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 104px; padding: 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left;
}
.plan-tabs button:hover, .plan-tabs button:focus-visible { border-color: var(--line-strong); outline: none; }
.plan-tabs button[aria-selected="true"] { border-color: var(--text); background: var(--surface); box-shadow: 0 4px 16px rgba(28,25,20,.07), inset 0 3px 0 var(--accent); }
.plan-tabs span { color: var(--accent-dark); font-size: .72rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.plan-tabs strong { font-size: 1.03rem; }
.plan-tabs small { color: var(--muted); }

.plan-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.expression-row { display: flex; align-items: center; gap: 18px; min-height: 66px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.expression-row span { color: var(--accent-dark); font-size: .72rem; font-weight: 900; letter-spacing: .13em; }
.expression-row code { overflow-x: auto; white-space: nowrap; color: var(--text); font-size: .9rem; }
.execution-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px; border-bottom: 1px solid var(--line);
}
.execution-toolbar > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.inspector-label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stage-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-button:disabled { cursor: not-allowed; opacity: .35; }
.operator-trace { margin: 0; padding: 0; list-style: none; }
.operator-step { position: relative; border-bottom: 1px solid var(--line); }
.operator-step:last-child { border-bottom: 0; }
.operator-step::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 40px; width: 1px; background: var(--line);
}
.operator-step[data-status="complete"]::before { background: var(--accent-2); }
.step-trigger {
  position: relative; display: grid; grid-template-columns: 42px minmax(120px, .42fr) 1fr auto;
  align-items: center; gap: 16px; width: 100%; min-height: 82px; padding: 14px 20px;
  border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left;
}
.step-trigger:hover, .step-trigger:focus-visible { background: var(--surface-2); outline: none; }
.step-trigger:disabled { cursor: not-allowed; opacity: .52; }
.step-number {
  z-index: 1; display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface);
  color: var(--muted); font-size: .72rem; font-weight: 900;
}
.operator-step[data-status="complete"] .step-number { border-color: var(--accent-2); background: var(--accent-2); color: white; }
.operator-step[data-status="ready"] .step-number { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent-dark); }
.step-operator { display: flex; flex-direction: column; }
.step-operator strong { font-size: 1rem; }
.step-operator span, .step-summary { color: var(--muted); font-size: .82rem; }
.step-status {
  min-width: 72px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase;
}
.operator-step[data-status="complete"] .step-status { border-color: #a8c8c1; background: var(--accent-2-soft); color: var(--accent-2); }
.operator-step[data-status="ready"] .step-status { border-color: #efb09c; background: var(--accent-soft); color: var(--accent-dark); }
.operator-step.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.step-body { padding: 0 26px 28px 78px; }
.step-description { max-width: 830px; margin-bottom: 20px; color: var(--muted); }
.contract-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.contract-card { padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.contract-card span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.contract-card ul, .parameter-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.contract-card li, .parameter-list li { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: .78rem; }
.dataflow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 18px; }
.dataflow > div { min-width: 0; padding: 12px; border-left: 3px solid var(--purple); background: #f4edf2; }
.dataflow span { display: block; color: var(--muted); font-size: .66rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.dataflow code { display: block; overflow-wrap: anywhere; margin-top: 4px; color: var(--text); }
.dataflow-arrow { color: var(--accent); font-weight: 900; }
.artifact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.artifact-panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.artifact-panel.is-wide { grid-column: 1 / -1; }
.artifact-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 14px; }
.artifact-heading > div { display: flex; flex-direction: column; gap: 4px; }
.artifact-heading span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.artifact-heading strong { font-size: .95rem; }
.artifact-note { margin: 0; color: var(--muted); font-size: .82rem; }
.source-view { align-self: center; }
.source-view-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.source-view-header div { display: flex; flex-direction: column; }
.source-view-header span { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; }
.source-view-header > strong { color: var(--accent-dark); font-size: .88rem; }
.timeline-labels { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: .75rem; }
.timeline { position: relative; height: 46px; }
.timeline-track { position: absolute; inset: 13px 0; border-radius: 999px; background: var(--line); }
.timeline-window { position: absolute; top: 9px; bottom: 9px; border: 2px solid var(--accent-2); border-radius: 6px; background: var(--accent-2-soft); min-width: 5px; }
.timeline-window.unpadded { border-color: var(--purple); background: #f4edf2; }
.timeline-legend { display: flex; gap: 18px; margin-top: 12px; color: var(--muted); font-size: .78rem; }
.timeline-legend span { display: flex; align-items: center; gap: 7px; }
.timeline-legend i { display: block; width: 18px; height: 6px; border-radius: 3px; }
.legend-window { background: var(--accent-2); }
.candidate-rationale { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--purple); background: #f4edf2; color: var(--text); font-size: .85rem; }
.transcript-scroll { max-height: 300px; overflow-y: auto; padding-right: 8px; scrollbar-color: var(--line-strong) transparent; }
.transcript-segment { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 9px 10px; border-radius: 7px; color: var(--muted); font-size: .84rem; }
.transcript-segment + .transcript-segment { margin-top: 2px; }
.transcript-segment time { color: var(--muted); font-variant-numeric: tabular-nums; }
.transcript-segment.candidate { background: #f4edf2; color: var(--text); }
.transcript-segment.prediction { box-shadow: inset 3px 0 0 var(--accent-2); }
.source-player { overflow: hidden; position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; background: #161616; }
.source-player iframe { width: 100%; height: 100%; border: 0; }
.source-facade { position: absolute; inset: 0; display: grid; place-items: end start; overflow: hidden; padding: 22px; background: #161616 center / cover no-repeat; color: white; }
.source-facade::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.82)); }
.source-facade > div { z-index: 1; max-width: 620px; }
.source-facade span { display: block; margin-bottom: 6px; color: #e5e1da; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.source-facade strong { display: block; margin-bottom: 14px; font-size: clamp(1rem, 2vw, 1.35rem); }
.source-facade .button { border-color: white; background: white; color: #201e1a; }
.video-frame { overflow: hidden; position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; background: #02040a; }
.video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
.media-fallback { display: grid; position: absolute; inset: 0; place-items: center; padding: 26px; color: var(--muted); text-align: center; }
.media-fallback[hidden] { display: none; }
.source-unavailable {
  display: grid; min-height: 240px; place-items: center; padding: 34px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface-2); color: var(--muted); text-align: center;
}
.clip-selector { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.clip-selector button {
  min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.clip-selector button[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: white; }
.detail-timeline { position: relative; height: 58px; margin-top: 16px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.detail-timeline::before, .detail-timeline::after { position: absolute; bottom: 5px; color: var(--muted); font-size: .68rem; }
.detail-timeline::before { content: "0:00"; left: 6px; }
.detail-timeline::after { content: "2:10"; right: 6px; }
.detail-marker { position: absolute; border-radius: 4px; min-width: 3px; }
.detail-marker.prediction { top: 18px; height: 18px; border: 2px solid var(--accent-2); background: var(--accent-2-soft); cursor: pointer; }
.detail-marker.prediction:hover, .detail-marker.prediction:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.detail-legend { display: flex; gap: 18px; margin-top: 8px; color: var(--muted); font-size: .75rem; }
.detail-legend span { display: flex; align-items: center; gap: 6px; }
.detail-legend i { width: 18px; height: 6px; border-radius: 4px; }
.legend-prediction { border: 2px solid var(--accent-2); background: var(--accent-2-soft); }
.media-credit { margin: 12px 0 0; color: var(--muted); font-size: .72rem; }
.retained-meter { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.retained-meter-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.retained-meter-header span { color: var(--muted); font-size: .78rem; }
.retained-meter-track { overflow: hidden; position: relative; height: 12px; border-radius: 999px; background: var(--line); }
.retained-meter-fill { position: absolute; top: 0; bottom: 0; min-width: 3px; border-radius: inherit; background: var(--accent-2); }
.retained-meter-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.prediction-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.prediction-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.prediction-card-content { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
button.prediction-card-content { cursor: pointer; }
button.prediction-card-content:hover strong, button.prediction-card-content:focus-visible strong { color: var(--accent-dark); }
button.prediction-card-content:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.prediction-card span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.prediction-card strong { display: block; margin: 5px 0; font-variant-numeric: tabular-nums; }
.prediction-card p { overflow: hidden; display: -webkit-box; margin: 0; color: var(--muted); font-size: .78rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.empty-artifact { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: .82rem; text-align: center; }

.results-section { padding: 90px 0; }
.results-intro { margin-bottom: 30px; }
.metric-spotlight { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 34px; }
.metric-spotlight article { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.metric-spotlight span, .metric-spotlight small { display: block; color: var(--muted); }
.metric-spotlight strong { display: block; margin: 7px 0; color: var(--accent); font-size: 2rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 810px; font-size: .88rem; }
caption { padding-bottom: 12px; color: var(--muted); text-align: left; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
tr.highlight td { background: var(--accent-soft); font-weight: 700; }
td.best { color: var(--accent-dark); font-weight: 800; }

.paper-section { padding: 0 0 90px; }
.paper-card { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 36px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.paper-card h2 { max-width: 820px; margin-top: 8px; font-size: clamp(1.5rem, 3vw, 2.4rem); }
.paper-card p { margin-bottom: 0; color: var(--muted); }
footer { padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
footer .shell { display: flex; justify-content: space-between; }

@media (max-width: 820px) {
  nav { gap: 16px; }
  .rewrite-summary { grid-template-columns: 1fr; }
  .summary-arrow { transform: rotate(90deg); justify-self: center; }
  .plan-tabs { grid-template-columns: 1fr; }
  .plan-tabs button { min-height: 84px; }
  .step-trigger { grid-template-columns: 42px 1fr auto; }
  .step-summary { grid-column: 2 / -1; }
  .contract-grid, .artifact-grid { grid-template-columns: 1fr; }
  .artifact-panel.is-wide { grid-column: auto; }
  .prediction-list { grid-template-columns: 1fr; }
  .metric-spotlight { grid-template-columns: repeat(2, 1fr); }
  .paper-card, .section-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .site-header { min-height: 62px; }
  .brand small, nav a:nth-child(2) { display: none; }
  .hero { padding-top: 62px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .example-selector { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .example-selector > span { grid-column: 1 / -1; padding-top: 5px; }
  .metric-spotlight { grid-template-columns: 1fr; }
  .execution-toolbar { align-items: flex-start; flex-direction: column; }
  .step-trigger { grid-template-columns: 38px 1fr auto; gap: 10px; padding-inline: 14px; }
  .step-body { padding: 0 16px 22px; }
  .step-summary { display: none; }
  .dataflow { grid-template-columns: 1fr; }
  .dataflow-arrow { transform: rotate(90deg); justify-self: center; }
  .source-view-header { flex-direction: column; }
  footer .shell { flex-direction: column; gap: 4px; }
}

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