@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/montserrat-regular-webfont.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/montserrat-bold-webfont.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #0d1b3f;
  --muted: #526176;
  --line: #d7e0ea;
  --accent: #667eea;
  --accent-strong: #4f46e5;
  --accent-soft: #e8ecff;
  --on-accent: #ffffff;
  --code: #0d1b3f;
  --code-ink: #eef2ff;
  --shadow: 0 18px 54px rgba(13, 27, 63, 0.11);
  --radius: 18px;
  --font-display: "Montserrat", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-body: "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1518;
  --surface: #131f23;
  --surface-2: #1b2b30;
  --ink: #eef8f9;
  --muted: #a8b9bd;
  --line: #31464c;
  --accent: #35cbd4;
  --accent-strong: #73e1e6;
  --accent-soft: #123a3f;
  --on-accent: #071416;
  --code: #071013;
  --code-ink: #d8f7f8;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

#navBarContainer {
  min-height: 72px;
  background: #fff;
}

#navBarContainer .sticky-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

#navBarContainer img {
  width: auto;
  object-fit: contain;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-150%);
}

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

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 12px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand img {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 8px;
}

footer .brand img {
  height: 36px;
}

[data-theme="dark"] .brand img {
  filter: invert(1) brightness(1.3);
}

.brand b {
  color: var(--accent-strong);
}

.site-header nav {
  display: flex;
  justify-content: center;
  gap: 30px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--accent-strong);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}

.lang,
.theme-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.lang {
  padding: 8px 12px;
  text-decoration: none;
}

.theme-toggle {
  width: 40px;
  cursor: pointer;
}

.menu-toggle {
  display: none;
}

.hero {
  width: min(1240px, calc(100% - 48px));
  min-height: calc(100svh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(480px, 1.12fr);
  align-items: center;
  gap: clamp(38px, 6vw, 92px);
  padding: 58px 0 52px;
}

.kicker {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
}

.hero h1,
.section h2,
.level-intro h3,
.final-cta h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero h1,
.section h2,
.level-intro h3,
.final-cta h2 {
  word-break: keep-all;
  overflow-wrap: normal;
}

.hero h1 {
  max-width: 780px;
  font-size: clamp(2.9rem, 3.8vw, 3.75rem);
}

.hero-line {
  display: block;
  white-space: nowrap;
}

.hero-line.accent {
  color: var(--accent-strong);
}

.hero-lede {
  max-width: 620px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.55vw, 1.28rem);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--accent-strong);
  color: var(--surface);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.text-link {
  color: var(--accent-strong);
  font-weight: 800;
  text-underline-offset: 4px;
}

.source-note {
  max-width: 580px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.hero-visual {
  position: relative;
  margin: 0;
  min-height: min(67vh, 680px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px 24px 56px 24px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.hero-visual::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 13px 13px 42px 13px;
  pointer-events: none;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  min-height: min(67vh, 680px);
  object-fit: cover;
  object-position: center;
}

.hero-visual figcaption,
.camera figcaption {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(7, 18, 21, 0.82);
  color: #edfafa;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.live-dot,
.repo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(10, 166, 180, 0.2);
}

.fact-strip {
  display: grid;
  /* Cell separators come from the 1px gap, so any number of facts wraps cleanly. */
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.fact-strip div {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px clamp(20px, 3vw, 40px);
  background: var(--surface);
}

.fact-strip strong {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  letter-spacing: -0.02em;
}

.fact-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.section {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(88px, 11vw, 150px) 0;
}

#why,
#workflow,
#levels,
#portfolio {
  scroll-margin-top: 84px;
}

.section h2 {
  max-width: 820px;
  font-size: clamp(2.3rem, 4.2vw, 4.15rem);
}

.section h2 + p,
.section-heading > p:last-child,
.github-copy > p,
.train > div > p,
.camera > div > p,
.safety > div > p {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.observe {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(460px, 1.1fr);
  align-items: center;
  gap: clamp(42px, 8vw, 108px);
}

.stage-readout {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 16px;
  margin: 38px 0 20px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.system-role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 28px;
}

.system-role-button {
  min-width: 0;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.system-role-button:hover,
.system-role-button:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.system-role-button[aria-pressed="true"] {
  border-color: var(--accent-strong);
  background: var(--ink);
  color: #fff;
}

.system-role-button span,
.system-role-button small {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.system-role-button b {
  margin-top: 3px;
  font-size: 0.82rem;
}

.system-role-button small {
  margin-top: 1px;
  opacity: 0.72;
}

.stage-readout > span {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.stage-readout strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.stage-readout p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.observe-copy label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.system-range-label,
.system-range {
  position: absolute;
  width: 1px !important;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.detection-demo {
  position: relative;
  min-height: 560px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detection-demo img {
  width: 100%;
  height: 560px;
  object-fit: cover;
}

.detection-demo::after {
  content: attr(data-overlay);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(79, 70, 229, 0.15);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 1;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.demo-box {
  position: absolute;
  z-index: 2;
  border: 3px solid var(--accent);
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
}

.demo-box b {
  position: absolute;
  top: -30px;
  left: -3px;
  padding: 3px 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 0.72rem/1.5 var(--font-display);
}

.box-a {
  top: 30%;
  left: 20%;
  width: 24%;
  height: 27%;
}

.box-b {
  right: 14%;
  bottom: 18%;
  width: 30%;
  height: 23%;
}

.detection-demo[data-stage="1"]::after,
.detection-demo[data-stage="2"]::after,
.detection-demo[data-stage="3"]::after,
.detection-demo[data-stage="4"]::after {
  opacity: 0;
}

.detection-demo[data-stage="1"] .box-a,
.detection-demo[data-stage="1"] .box-b,
.detection-demo[data-stage="2"] .box-a,
.detection-demo[data-stage="3"] .box-a,
.detection-demo[data-stage="3"] .box-b,
.detection-demo[data-stage="4"] .box-a,
.detection-demo[data-stage="4"] .box-b {
  opacity: 1;
}

.detection-demo[data-stage="2"] .box-a {
  transform: translateX(18%);
}

.detection-demo[data-stage="4"]::after {
  opacity: 1;
  background: rgba(13, 27, 63, 0.74);
  font-size: clamp(1.4rem, 4.3vw, 3.6rem);
  letter-spacing: 0.08em;
}

.detection-demo figcaption {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 12px;
  padding: 6px 9px;
  background: rgba(7, 18, 21, 0.76);
  color: #fff;
  font-size: 0.7rem;
}

.diagram-section {
  width: min(1280px, calc(100% - 48px));
  padding-top: 72px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 50px;
  align-items: end;
  margin-bottom: 46px;
}

.section-heading .kicker {
  grid-column: 1 / -1;
  margin-bottom: -30px;
}

.section-heading > p:last-child {
  margin: 0;
}

.diagram-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.diagram-frame iframe {
  display: block;
  width: 100%;
  height: 710px;
  border: 0;
  background: var(--surface);
}

.diagram-frame > a {
  display: block;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 800;
  text-align: right;
  text-underline-offset: 3px;
}

.levels {
  width: min(1200px, calc(100% - 48px));
}

.level-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.level-tab {
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 24px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.level-tab:last-child {
  border-right: 0;
}

.level-tab span {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.level-tab b {
  margin-top: 4px;
  font-size: 0.74rem;
}

.level-tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.level-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.level-panel[hidden] {
  display: none;
}

.level-intro {
  padding: clamp(30px, 5vw, 58px);
  border-right: 1px solid var(--line);
}

.level-intro h3 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.level-intro dl {
  margin: 40px 0 0;
}

.level-intro dl div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.level-intro dt {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-intro dd {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.session-list {
  max-height: 680px;
  overflow: auto;
  padding: 18px 28px;
}

.session-list details,
.faq-list details {
  border-bottom: 1px solid var(--line);
}

.session-list summary,
.faq-list summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  font-weight: 800;
}

.session-list summary::-webkit-details-marker,
.faq-list summary::-webkit-details-marker {
  display: none;
}

.session-list summary {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 17px 28px 17px 0;
}

.session-list summary::after,
.faq-list summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.session-list details[open] summary::after,
.faq-list details[open] summary::after {
  content: "−";
}

.session-list summary span {
  color: var(--accent-strong);
  font-family: var(--font-display);
}

.session-list details > div {
  padding: 0 28px 18px 54px;
  color: var(--muted);
  font-size: 0.9rem;
}

.lesson-system-grid {
  margin: 18px 0 3px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  list-style: none;
}

.lesson-system-grid li {
  display: grid;
  grid-template-columns: 58px 66px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.lesson-system-grid li:last-child {
  border-bottom: 0;
}

.lesson-system-grid span {
  color: var(--ink);
  font-weight: 900;
}

.lesson-system-grid small {
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
}

.lesson-system-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.lesson-system-grid .lesson-system-control {
  background: var(--accent-soft);
}

.session-list details p {
  margin: 0 0 9px;
}

.github {
  width: min(1200px, calc(100% - 48px));
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(440px, 1.05fr);
  gap: clamp(48px, 8vw, 100px);
  align-items: center;
}

.github .button {
  margin-top: 28px;
}

.version-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  font-size: 0.75rem;
}

.version-line > * {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.repo-map {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.repo-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
}

.repo-top small {
  margin-left: auto;
  color: var(--muted);
}

.repo-map ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.repo-map li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
}

.repo-map li:last-child {
  border-bottom: 0;
}

.repo-map li span {
  color: var(--accent-strong);
  font-family: ui-monospace, monospace;
  font-weight: 700;
}

.repo-map li p {
  margin: 0;
  color: var(--muted);
}

.train,
.camera {
  width: min(1200px, calc(100% - 48px));
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(46px, 8vw, 106px);
}

.train figure,
.camera figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.train figure img,
.camera figure img {
  width: 100%;
  height: 540px;
  object-fit: cover;
}

.train pre {
  margin: 30px 0 0;
  padding: 21px;
  overflow: auto;
  border-radius: 11px;
  background: var(--code);
  color: var(--code-ink);
  font: 0.82rem/1.75 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.code-note {
  font-size: 0.76rem !important;
}

.camera {
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, 0.92fr);
}

.camera figure {
  order: 2;
}

.boundary {
  display: grid;
  grid-template-columns: 1fr auto 1.25fr;
  gap: 14px;
  align-items: center;
  margin-top: 34px;
}

.boundary > div {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.boundary .future {
  border-style: dashed;
}

.boundary b {
  color: var(--accent-strong);
  font-size: 0.74rem;
}

.boundary span {
  margin-top: 8px;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.safety {
  display: grid;
  grid-template-columns: 42px minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 34px;
  align-items: start;
  padding: 58px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.safety > span {
  color: var(--accent);
  font-size: 2rem;
}

.safety ul {
  margin: 0;
  padding-left: 22px;
}

.safety li + li {
  margin-top: 13px;
}

.faq-list {
  width: min(820px, 100%);
  margin-left: auto;
}

.faq-list summary {
  padding: 22px 42px 22px 0;
  font-size: 1.05rem;
}

.faq-list details p {
  margin: 0;
  padding: 0 42px 22px 0;
  color: var(--muted);
}

.final-cta {
  width: min(1000px, calc(100% - 48px));
  margin-bottom: 100px;
  padding: clamp(58px, 8vw, 90px);
  border-radius: 24px;
  background: var(--ink);
  color: var(--bg);
  text-align: center;
}

.final-cta .kicker {
  color: var(--accent);
}

.final-cta h2 {
  margin-inline: auto;
  font-size: clamp(2.2rem, 4.2vw, 4rem);
}

.final-cta > p:not(.kicker) {
  max-width: 610px;
  margin: 22px auto 30px;
  color: color-mix(in srgb, var(--bg) 75%, transparent);
}

footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 28px max(24px, calc((100vw - 1240px) / 2));
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
}

footer p {
  text-align: center;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: auto auto 1fr;
  }

  .menu-toggle {
    width: 42px;
    height: 40px;
    display: grid;
    place-content: center;
    gap: 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .menu-toggle > span:not(.sr-only) {
    width: 18px;
    height: 2px;
    background: var(--ink);
  }

  .site-header nav {
    position: absolute;
    top: 71px;
    right: 18px;
    left: 18px;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .site-header nav[data-open="true"] {
    display: flex;
  }

  .site-header nav a {
    padding: 12px;
  }

  .header-tools {
    justify-self: end;
  }

  .hero,
  .observe,
  .github,
  .train,
  .camera {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 74px;
  }

  .hero-visual,
  .hero-visual img {
    min-height: 560px;
  }

  .level-panel {
    grid-template-columns: 1fr;
  }

  .level-intro {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .camera figure {
    order: initial;
  }

  .safety {
    grid-template-columns: 34px 1fr;
  }

  .safety ul {
    grid-column: 2;
  }
}

@media (max-width: 700px) {
  .site-header {
    min-height: 64px;
    gap: 9px;
    padding: 10px 16px;
  }

  .site-header .brand span {
    display: none;
  }

  .site-header nav {
    top: 63px;
  }

  .lang {
    padding-inline: 9px;
  }

  .hero,
  .section,
  .diagram-section,
  .levels,
  .github,
  .train,
  .camera,
  .final-cta {
    width: min(100% - 32px, 620px);
  }

  .hero {
    gap: 42px;
    padding: 54px 0 36px;
  }

  .hero h1 {
    font-size: clamp(2rem, 9.6vw, 2.6rem);
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .course-language {
    margin-top: -4px;
  }

  .hero-visual,
  .hero-visual img {
    min-height: 430px;
  }

  .hero-visual {
    border-radius: 18px 18px 38px 18px;
  }

  .fact-strip {
    grid-template-columns: 1fr 1fr;
  }

  .fact-strip div {
    min-height: 92px;
    padding: 16px;
  }

  .section {
    padding: 82px 0;
  }

  .section h2 {
    font-size: clamp(2.12rem, 10.6vw, 3.2rem);
  }

  .detection-demo,
  .detection-demo img {
    min-height: 420px;
    height: 420px;
  }

  .system-role-grid {
    gap: 5px;
  }

  .system-role-button {
    min-height: 66px;
    padding: 8px 6px;
  }

  .system-role-button b {
    font-size: 0.73rem;
  }

  .system-role-button small {
    font-size: 0.5rem;
  }

  .section-heading {
    display: block;
    margin-bottom: 30px;
  }

  .section-heading .kicker {
    margin-bottom: 16px;
  }

  .section-heading > p:last-child {
    margin-top: 20px;
  }

  .diagram-frame iframe {
    height: 520px;
  }

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

  .level-tab {
    min-height: 70px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .level-tab:last-child {
    border-bottom: 0;
  }

  .level-intro {
    padding: 28px 22px;
  }

  .session-list {
    max-height: none;
    padding: 10px 20px;
  }

  .session-list details > div {
    padding-left: 0;
  }

  .lesson-system-grid li {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 4px 10px;
  }

  .lesson-system-grid p {
    grid-column: 1 / -1;
    padding-top: 2px;
  }

  .repo-map li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .train figure img,
  .camera figure img {
    height: 420px;
  }

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

  .boundary i {
    transform: rotate(90deg);
    text-align: center;
  }

  .safety {
    grid-template-columns: 1fr;
    padding: 30px 24px;
  }

  .safety ul {
    grid-column: auto;
  }

  .final-cta {
    margin-bottom: 70px;
    padding: 54px 24px;
  }

  footer {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
  }

  footer p {
    margin: 0;
  }
}

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

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