:root {
  color-scheme: dark;
  --bg: #17191b;
  --surface: #222528;
  --surface-2: #2b2f32;
  --surface-3: #34393d;
  --text: #eceff1;
  --muted: #afb6bb;
  --line: #4a5055;
  --accent: #a7b4be;
  --accent-strong: #dbe4ea;
  --warm: #d58b3d;
  --success: #9ab19a;
  --max: 1240px;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent-strong);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 4px;
}
.skip-link:focus { top: 12px; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(23, 25, 27, .96);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--bg);
  background: var(--accent);
}
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: var(--muted);
  padding: 7px 10px;
  text-decoration: none;
  border-radius: 5px;
}
nav a:hover, nav a:focus-visible { color: var(--text); background: var(--surface); }

main { overflow: hidden; }
.hero, .guide-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px 24px;
}
.hero {
  min-height: 420px;
  display: flex;
  align-items: center;
}
.hero-copy { max-width: 920px; }
.hero h1 {
  margin: 10px 0 22px;
  max-width: 840px;
  font-size: clamp(2.55rem, 6vw, 5.2rem);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 550;
}
.hero-summary {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.1rem;
}
.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
  font-weight: 650;
}
.hero-actions, .detail-actions, .manual-link {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.button:hover, .button:focus-visible { background: var(--surface-3); border-color: var(--accent); }
.button.primary { background: var(--accent); color: #16191b; border-color: var(--accent); font-weight: 650; }
.button.primary:hover, .button.primary:focus-visible { background: var(--accent-strong); }
.button.small { min-height: 36px; padding: 7px 12px; }
.guide-section { border-top: 1px solid var(--line); }
.section-heading { max-width: 850px; margin-bottom: 38px; }
.section-heading h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  font-weight: 520;
}
.section-heading > p:last-child { color: var(--muted); font-size: 1.05rem; }

.tour-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; margin-bottom: 18px; }
.tour-tabs.compact { margin: 0; }
.segmented {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  cursor: pointer;
}
.segmented.active, .segmented[aria-pressed="true"] { color: #17191b; background: var(--accent); }
.tour-layout {
  display: grid;
  gap: 14px;
}
.tour-stage {
  position: relative;
  min-width: 0;
  background: #111;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.tour-stage img { display: block; width: 100%; height: auto; }
.hotspot-layer { position: absolute; inset: 0; }
.tour-hotspot {
  position: absolute;
  border-radius: 4px;
  border: 2px solid transparent;
  background: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0;
}
.tour-hotspot:hover, .tour-hotspot:focus-visible, .tour-hotspot.active {
  background: rgba(213,139,61,.30);
  border-color: var(--warm);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 0 18px rgba(213,139,61,.38);
}
.data-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
}
.tour-detail h3, .data-panel h3, .workflow-message h3, .residual-layout h3, .match-layout h3, .export-callout h3 {
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 7px 0 14px;
  font-weight: 550;
}
.step-count, .panel-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.detail-note, .note { color: var(--muted); }
.info-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.info-card-heading h3 { margin-bottom: 0; }
.tour-detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8,10,12,.80);
  backdrop-filter: blur(4px);
}
.tour-detail[hidden] { display: none; }
.tour-modal-card {
  width: min(720px, 100%);
  max-height: min(80vh, 760px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0,0,0,.58);
}
.tour-modal-content { padding: 24px; }
.tour-modal-content p:first-child { margin-top: 0; }
.tour-modal-content p:last-child { margin-bottom: 0; }
.modal-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover, .modal-close:focus-visible {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-2);
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.workflow-step {
  min-height: 62px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
}
.workflow-step:last-child { border-right: 0; }
.workflow-step span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.workflow-step:hover, .workflow-step:focus-visible { color: var(--text); background: var(--surface-2); }
.workflow-step.active { color: var(--text); background: var(--surface-3); }
.workflow-step.active span { background: var(--accent); color: #16191b; border-color: var(--accent); }
.workflow-message {
  padding: 18px 20px;
  margin-bottom: 28px;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(167,180,190,.12), transparent);
}
.workflow-message h3 { margin-bottom: 6px; }
.workflow-message p:last-child { margin-bottom: 0; color: var(--muted); }

.grain-grid, .mtf-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(300px, .9fr);
  gap: 18px;
  align-items: stretch;
}
.visual-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.panel-toolbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-toolbar strong { display: block; font-weight: 550; }
.patch-buttons, .frame-strip { display: flex; gap: 5px; flex-wrap: wrap; }
.patch-buttons button, .frame-strip button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 4px;
  min-width: 36px;
  height: 34px;
  cursor: pointer;
}
.patch-buttons button:hover, .patch-buttons button:focus-visible, .frame-strip button:hover, .frame-strip button:focus-visible { color: var(--text); border-color: var(--accent); }
.patch-buttons button.active, .frame-strip button.active { color: #17191b; background: var(--accent); border-color: var(--accent); }
.image-stage { position: relative; background: #101214; overflow: hidden; }
.image-stage img { width: 100%; height: auto; display: block; }
.roi-box {
  position: absolute;
  border: 2px solid var(--accent-strong);
  background: rgba(167,180,190,.08);
  color: var(--text);
  cursor: pointer;
}
.roi-box:hover, .roi-box:focus-visible { border-color: var(--warm); background: rgba(213,139,61,.12); }
.roi-box span {
  position: absolute;
  left: -2px;
  top: -28px;
  padding: 3px 7px;
  background: rgba(18,20,22,.92);
  border: 1px solid currentColor;
  white-space: nowrap;
  font-size: .72rem;
}
.grain-roi { left: 23.125%; top: 28.472%; width: 52.083%; height: 46.296%; cursor: default; pointer-events: none; }
.frame-strip { padding: 12px 16px 4px; }
.stage-caption { color: var(--muted); font-size: .82rem; padding: 8px 16px 14px; margin: 0; }
.measurements { margin: 18px 0; }
.measurements div { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.measurements dt { color: var(--muted); }
.measurements dd { margin: 0; text-align: right; }
.tip-box { margin-top: 22px; padding: 14px; background: var(--surface-2); border-left: 3px solid var(--accent); }
.tip-box strong, .tip-box span { display: block; }
.tip-box span { color: var(--muted); margin-top: 5px; font-size: .9rem; }

.residual-layout, .match-layout {
  margin-top: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr);
  gap: 30px;
  align-items: center;
}
.residual-image, .match-plot { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #111; }
.residual-image img, .match-plot img { display: block; width: 100%; height: auto; }
.export-callout {
  margin-top: 42px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.export-callout p { margin-bottom: 0; color: var(--muted); }

.source-roi { left: 47.370%; top: 13.056%; width: 2.839%; height: 26.204%; }
.target-roi-one { left: 43.125%; top: 60.602%; width: 14.505%; height: 6.991%; }
.target-roi-two { left: 47.604%; top: 12.407%; width: 2.682%; height: 26.944%; }
.mtf-roi span { top: auto; bottom: -28px; }
.target-roi-one span { left: 50%; transform: translateX(-50%); }
.hidden { display: none; }
.compact-measurements { margin-top: 14px; }

.reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.resolution-callout {
  margin-top: 26px;
  padding: 26px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.resolution-callout .eyebrow { margin-bottom: 10px; }
.resolution-callout h3 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); }
.resolution-callout > p:last-child { margin: 12px 0 0; color: var(--text); font-size: 1.08rem; line-height: 1.55; }
.reference-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.reference-grid h3 { margin-top: 0; font-weight: 550; }
.reference-grid p, .reference-grid li { color: var(--muted); }
.reference-grid ul { padding-left: 20px; margin-bottom: 0; }
footer { border-top: 1px solid var(--line); color: var(--muted); }
footer p { max-width: var(--max); margin: 0 auto; padding: 30px 24px; }

@media (max-width: 920px) {
  .hero { min-height: 0; }
  .grain-grid, .mtf-grid, .residual-layout, .match-layout { grid-template-columns: 1fr; }
  .workflow-step { border-bottom: 1px solid var(--line); }
  .workflow-step:last-child { border-bottom: 0; }
}

@media (max-width: 660px) {
  .site-header { position: static; }
  .header-inner { align-items: flex-start; flex-direction: column; padding-top: 14px; padding-bottom: 14px; }
  nav { width: 100%; }
  nav a { padding-left: 0; padding-right: 16px; }
  .hero, .guide-section { padding: 62px 16px; }
  .tour-tabs, .tour-tabs.compact { display: flex; width: 100%; }
  .segmented { flex: 1; }
  .panel-toolbar, .export-callout { align-items: flex-start; flex-direction: column; }
  .reference-grid { grid-template-columns: 1fr; }
  .roi-box span { display: none; }
  .tour-detail { padding: 14px; }
  .info-card-heading, .tour-modal-content { padding: 18px; }
}

@media (hover: none) {
  .tour-hotspot:active, .tour-hotspot:focus-visible {
    background: rgba(213,139,61,.30);
    border-color: var(--warm);
  }
}

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