:root {
  color-scheme: light;
  --ink: #202826;
  --muted: #64706c;
  --line: #cbd1ce;
  --line-strong: #909a95;
  --paper: #f3f4f1;
  --panel: #fafbf8;
  --soft: #e8ece8;
  --green: #315e4c;
  --gold: #c3973c;
  --rust: #aa5842;
  --teal: #2f6970;
  --black: #18201e;
  --locked: #252d2a;
  --failed: #603f34;
  --page-width: 1680px;
  --page-gutter: 56px;
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
label,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
label:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(calc(100% - (var(--page-gutter) * 2)), var(--page-width));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin: 0 auto;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(243, 244, 241, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 700;
}

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rust);
}

.nav {
  display: flex;
  align-items: center;
  gap: 34px;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav a {
  position: relative;
  padding-bottom: 3px;
}

.nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--rust);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.nav a:hover {
  color: var(--ink);
}

.nav a:hover::after {
  transform: scaleX(1);
}

.hero,
.section {
  width: min(calc(100% - (var(--page-gutter) * 2)), var(--page-width));
  margin: 0 auto;
  border-bottom: 1px solid var(--line-strong);
}

.hero {
  padding: 88px 0 80px;
}

.hero-copy {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 32px 72px;
  align-items: end;
}

.hero-copy > div:first-child {
  grid-column: 1 / -1;
}

.eyebrow,
.panel-label,
.note-kicker {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--rust);
}

h1 {
  max-width: 23ch;
  margin: 0;
  font-size: 4.6rem;
  font-weight: 650;
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: 2.65rem;
  font-weight: 620;
  line-height: 1.04;
}

h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
}

.hero-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-byline strong {
  color: var(--ink);
}

.hero-byline a {
  border-bottom: 1px solid var(--gold);
}

.lede {
  max-width: 70ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-action,
.secondary-action,
.tab {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.primary-action {
  background: var(--ink);
  color: white;
}

.secondary-action {
  background: transparent;
  color: var(--ink);
}

.primary-action:hover,
.secondary-action:hover,
.tab:hover {
  transform: translateY(-2px);
}

.demo-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(410px, 0.72fr);
  margin-top: 68px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.upload-panel,
.run-panel {
  min-width: 0;
  padding: 34px 0;
}

.upload-panel {
  display: flex;
  flex-direction: column;
  padding-right: 38px;
}

.run-panel {
  display: flex;
  flex-direction: column;
  padding-left: 38px;
  border-left: 1px solid var(--line-strong);
}

.upload-panel h2,
.run-panel h2 {
  font-size: 1.5rem;
}

.panel-heading,
.run-header,
.sample-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.workspace-controls {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 10px;
}

.status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: var(--soft);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.preview-nav {
  display: inline-grid;
  grid-template-columns: 32px minmax(110px, auto) 32px;
  align-items: center;
  min-height: 36px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.preview-nav-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.preview-nav-button:hover:not(:disabled) {
  background: var(--ink);
  color: white;
}

.preview-nav-button:disabled {
  color: #a6aeaa;
  cursor: not-allowed;
}

.preview-nav-label {
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

#imageInput {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 500px;
  max-height: 760px;
  aspect-ratio: 72 / 46;
  margin: 26px 0 20px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--soft);
}

.drop-zone.dragging {
  border-color: var(--teal);
  outline: 3px solid rgba(47, 105, 112, 0.16);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
  background: rgba(250, 251, 248, 0.68);
}

.empty-state[hidden],
.empty-state.is-hidden,
.drop-zone.has-image .empty-state {
  display: none !important;
}

.format-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.format-strip span {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.format-strip span:last-child {
  border-right: 0;
}

.format-strip span::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
}

.cancel-button,
.skip-action,
.sample-choice {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
}

.cancel-button:hover,
.skip-action:hover,
.sample-choice:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.cancel-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 26px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  min-width: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  border-bottom-color: var(--rust);
  background: transparent;
  color: var(--ink);
}

.step-list {
  list-style: none;
  display: grid;
  margin: 26px 0 32px;
  padding: 0;
  border-top: 1px solid var(--line);
}

.step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 124px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  transition:
    background 160ms ease,
    color 160ms ease;
}

.step.current {
  padding-right: 14px;
  padding-left: 14px;
  background: #e8eeea;
  box-shadow: inset 3px 0 0 var(--green);
}

.step.running {
  padding-right: 14px;
  padding-left: 14px;
  background: #f1e9d6;
  box-shadow: inset 3px 0 0 var(--gold);
}

.step.locked,
.step.done,
.step.failed,
.step.skipped {
  margin-top: -1px;
  padding-right: 14px;
  padding-left: 14px;
  border-color: #4a5350;
  background: var(--locked);
  color: rgba(255, 255, 255, 0.82);
}

.step.done,
.step.skipped {
  background: #33403a;
}

.step.failed {
  background: var(--failed);
}

.step-index {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
}

.step strong {
  display: block;
  font-size: 0.86rem;
}

.step p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.step-note {
  margin-top: 12px;
  border-top: 1px solid rgba(100, 112, 108, 0.28);
  padding-top: 8px;
}

.step-note summary {
  width: fit-content;
  cursor: pointer;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
}

.step-note p {
  margin-top: 8px;
  font-size: 0.72rem;
}

.step.locked p,
.step.done p,
.step.failed p,
.step.skipped p {
  color: rgba(255, 255, 255, 0.6);
}

.step.locked .step-note,
.step.done .step-note,
.step.failed .step-note,
.step.skipped .step-note {
  border-top-color: rgba(255, 255, 255, 0.16);
}

.step.locked .step-note summary,
.step.done .step-note summary,
.step.failed .step-note summary,
.step.skipped .step-note summary {
  color: rgba(255, 255, 255, 0.78);
}

.step.locked .step-index,
.step.done .step-index,
.step.failed .step-index,
.step.skipped .step-index {
  border-color: rgba(255, 255, 255, 0.34);
  color: rgba(255, 255, 255, 0.78);
}

.step-actions {
  display: grid;
  gap: 7px;
}

.step-action {
  min-width: 86px;
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: white;
  padding: 0 13px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.step-action:disabled {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.54);
  cursor: not-allowed;
}

.step.current .step-action:disabled {
  border-color: var(--line);
  background: #dde3df;
  color: var(--muted);
}

.step.running .step-action {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
}

.result-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 24px;
  min-width: 0;
  margin-top: auto;
  padding: 22px;
  border-radius: 2px;
  background: var(--ink);
  color: white;
}

.result-box .panel-label,
.confidence span:last-child {
  color: rgba(255, 255, 255, 0.62);
}

.result-main {
  min-width: 0;
}

#resultLabel {
  display: block;
  max-width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  font-style: italic;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.top-results {
  list-style: none;
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  margin: 16px 0 0;
  padding: 0;
}

.top-results li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 7px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
}

.top-results span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.top-results strong {
  color: white;
  white-space: nowrap;
}

.confidence {
  min-width: 82px;
  text-align: right;
}

.confidence span:first-child {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.confidence span:last-child {
  display: block;
  margin-top: 5px;
  font-size: 0.68rem;
}

.section {
  display: grid;
  grid-template-columns: minmax(260px, 0.38fr) minmax(0, 1fr);
  gap: 72px;
  padding: 92px 0;
}

.section-heading {
  max-width: 520px;
}

.section-heading h2 {
  font-size: 2.4rem;
}

.pipeline-grid,
.technical-grid {
  display: grid;
  min-width: 0;
}

.pipeline-grid {
  grid-template-columns: 1fr;
}

.pipeline-card {
  padding: 28px 0 34px;
  border-top: 1px solid var(--line-strong);
}

.pipeline-card:last-child {
  border-bottom: 1px solid var(--line-strong);
}

.card-topline {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.number {
  color: var(--rust);
}

.pipeline-card h3 {
  max-width: 34ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.72rem;
  font-weight: 500;
}

.pipeline-card > p {
  max-width: 82ch;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.72;
}

.pipeline-card details {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.pipeline-card summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}

.pipeline-card details p {
  max-width: 82ch;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.acknowledgement {
  grid-template-columns: minmax(260px, 0.38fr) minmax(0, 1fr);
}

.acknowledgement p:last-child {
  max-width: 82ch;
  margin: 0;
  padding-top: 3px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.78;
}

.technical-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
}

.technical-grid > div {
  min-height: 240px;
  padding: 28px 28px 34px 0;
  border-bottom: 1px solid var(--line);
}

.technical-grid > div:nth-child(even) {
  padding-right: 0;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.note-kicker {
  display: block;
  margin-bottom: 16px;
}

.technical-grid h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 500;
}

.technical-grid p {
  max-width: 64ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.72;
}

.sample-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(24, 32, 30, 0.62);
}

.sample-modal[hidden] {
  display: none;
}

.sample-dialog {
  width: min(1080px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(24, 32, 30, 0.2);
  padding: 28px;
}

.sample-header {
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-strong);
}

.sample-header h2 {
  font-size: 2rem;
}

.sample-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 26px;
  border-top: 1px solid var(--line);
}

.sample-card {
  display: grid;
  gap: 12px;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--line);
}

.sample-card h3 {
  font-size: 0.9rem;
}

.sample-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.sample-list {
  display: grid;
  gap: 7px;
}

.sample-choice {
  width: 100%;
  text-align: left;
}

@media (min-width: 1900px) {
  :root {
    --page-gutter: 88px;
  }

  .hero {
    padding-top: 112px;
  }

  .drop-zone {
    min-height: 620px;
  }
}

@media (max-width: 1080px) {
  :root {
    --page-gutter: 36px;
  }

  h1 {
    font-size: 3.7rem;
  }

  .hero {
    padding-top: 76px;
  }

  .demo-shell {
    grid-template-columns: 1fr;
  }

  .upload-panel {
    padding-right: 0;
  }

  .run-panel {
    padding-left: 0;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .section {
    grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr);
    gap: 48px;
  }
}

@media (max-width: 1280px) and (min-width: 1081px) {
  :root {
    --page-gutter: 36px;
  }

  h1 {
    font-size: 4rem;
  }

  .demo-shell {
    grid-template-columns: minmax(0, 1.32fr) minmax(390px, 0.78fr);
  }

  .upload-panel {
    padding-right: 26px;
  }

  .run-panel {
    padding-left: 26px;
  }

  .section {
    grid-template-columns: minmax(220px, 0.32fr) minmax(0, 1fr);
    gap: 48px;
  }
}

@media (max-width: 900px) {
  :root {
    --page-gutter: 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .nav {
    width: 100%;
    gap: 22px;
    overflow-x: auto;
    padding-bottom: 4px;
    white-space: nowrap;
  }

  .hero {
    padding: 64px 0;
  }

  .hero-copy,
  .section,
  .acknowledgement {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    gap: 28px;
  }

  h1 {
    max-width: none;
    font-size: 3.35rem;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .demo-shell {
    margin-top: 64px;
  }

  .section {
    gap: 42px;
    padding: 72px 0;
  }

  .section-heading {
    max-width: 660px;
  }

  .technical-grid > div {
    min-height: 0;
  }
}

@media (max-width: 680px) {
  :root {
    --page-gutter: 18px;
  }

  body {
    font-size: 15px;
  }

  .topbar {
    position: relative;
    padding-top: 20px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    font-size: 0.74rem;
    overflow: visible;
    white-space: normal;
  }

  h1 {
    font-size: 2.3rem;
  }

  h2,
  .section-heading h2 {
    font-size: 2rem;
  }

  .hero-actions,
  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .panel-heading,
  .run-header {
    flex-direction: column;
  }

  .workspace-controls {
    align-items: stretch;
    width: 100%;
  }

  .preview-nav {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .drop-zone {
    min-height: 300px;
    aspect-ratio: 4 / 3;
  }

  .format-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .format-strip span:nth-child(2) {
    border-right: 0;
  }

  .format-strip span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .mode-tabs {
    grid-template-columns: 1fr;
  }

  .step {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .step-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .step-action,
  .skip-action {
    width: 100%;
  }

  .result-box {
    grid-template-columns: 1fr;
  }

  .confidence {
    text-align: left;
  }

  .technical-grid {
    grid-template-columns: 1fr;
  }

  .technical-grid > div,
  .technical-grid > div:nth-child(even) {
    padding: 24px 0;
    border-left: 0;
  }

  .sample-modal {
    padding: 14px;
  }

  .sample-dialog {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
