/* ==========================================================================
   Vision Lab — field notes in computer vision
   A light technical-lab system: paper, ink, ultramarine, orange, lime.
   ========================================================================== */

:root {
  --paper: #f3f1ea;
  --paper-2: #eae7dd;
  --paper-3: #dfdbcf;
  --white: #fcfbf7;
  --ink: #16181d;
  --ink-2: #292c34;
  --muted: #656961;
  --muted-2: #85887f;
  --line: #d5d1c4;
  --line-strong: #b7b2a3;
  --blue: #2f4bff;
  --blue-dark: #1f35ce;
  --blue-soft: #e3e7ff;
  --orange: #ff5b2e;
  --orange-dark: #d63b12;
  --orange-soft: #ffe4d8;
  --lime: #c9f24a;
  --lime-soft: #eff9c7;
  --teal: #0c9b87;
  --red: #d92f35;
  --dark: #14161c;
  --dark-2: #1b1e26;
  --dark-3: #242833;
  --dark-line: #343946;
  --dark-muted: #999eac;
  --dark-text: #e9e7de;
  --display: "Space Grotesk", "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --container: 1240px;
  --gutter: clamp(20px, 4.2vw, 58px);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --shadow-sm: 0 8px 24px rgba(22, 24, 29, 0.06);
  --shadow-md: 0 24px 60px rgba(22, 24, 29, 0.1);
  --shadow-lg: 0 40px 110px rgba(22, 24, 29, 0.16);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 78px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1000px 560px at 82% -6%, rgba(255, 255, 255, 0.92), transparent 62%),
    radial-gradient(720px 500px at 3% 28%, rgba(255, 255, 255, 0.38), transparent 70%);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.68;
  font-weight: 400;
  letter-spacing: -0.006em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body::selection {
  color: var(--ink);
  background: var(--lime);
}

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

p,
h1,
h2,
h3,
h4,
ul,
ol,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

strong {
  font-weight: 600;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.91em;
}

p code,
li code,
td code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.82em;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.icon {
  flex: 0 0 auto;
}

::selection {
  background: var(--lime);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  transition: transform 0.2s var(--ease);
}

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

/* --------------------------------------------------------------------------
   reveal / motion
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.75s var(--ease) var(--delay, 0ms),
    transform 0.75s var(--ease) var(--delay, 0ms);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   type & shared bits
   -------------------------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.eyebrow-index {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ink);
  color: var(--white);
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.eyebrow-on-dark {
  color: var(--dark-muted);
}

.eyebrow-on-dark .eyebrow-index {
  background: var(--lime);
  color: var(--ink);
}

.lead {
  max-width: 650px;
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.72;
  letter-spacing: -0.012em;
}

.section-title {
  margin-top: 15px;
  font-family: var(--display);
  font-size: clamp(38px, 4.7vw, 64px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.section-title-sm {
  margin-bottom: 18px;
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 50px;
  margin-bottom: 44px;
}

.section-aside {
  max-width: 370px;
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.section-aside-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 15px;
}

.mark {
  position: relative;
  display: inline;
  background-image: linear-gradient(transparent 61%, var(--lime) 61%, var(--lime) 94%, transparent 94%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.mark-orange {
  background-image: linear-gradient(transparent 61%, var(--orange) 61%, var(--orange) 94%, transparent 94%);
}

.orange-dot {
  color: var(--orange);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(12, 155, 135, 0.5);
  animation: live-pulse 2.4s infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(12, 155, 135, 0.45); }
  65% { box-shadow: 0 0 0 5px rgba(12, 155, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 155, 135, 0); }
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition: gap 0.2s var(--ease), color 0.2s var(--ease);
}

.text-link:hover {
  gap: 13px;
  color: var(--blue-dark);
}

.text-link-light {
  color: var(--lime);
}

.text-link-light:hover {
  color: var(--white);
}

/* --------------------------------------------------------------------------
   buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    transform 0.22s var(--ease),
    background-color 0.22s var(--ease),
    border-color 0.22s var(--ease),
    color 0.22s var(--ease),
    box-shadow 0.22s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(47, 75, 255, 0.22);
}

.btn-primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 12px 28px rgba(47, 75, 255, 0.3);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}

.btn-outline {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--ink);
  color: var(--white);
}

.btn-light {
  background: var(--white);
  color: var(--ink);
}

.btn-light:hover {
  background: var(--lime);
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.38);
  color: var(--white);
}

.btn-outline-light:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.btn-run {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 9px;
  background: var(--lime);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(201, 242, 74, 0.12);
}

.btn-run:hover {
  background: #d9ff6a;
  box-shadow: 0 12px 30px rgba(201, 242, 74, 0.18);
}

.btn-run:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

/* --------------------------------------------------------------------------
   header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-h);
  border-bottom: 1px solid rgba(183, 178, 163, 0.55);
  background: rgba(243, 241, 234, 0.82);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  transition: box-shadow 0.25s var(--ease), background-color 0.25s var(--ease);
}

.site-header.is-scrolled {
  background: rgba(243, 241, 234, 0.94);
  box-shadow: 0 10px 30px rgba(22, 24, 29, 0.06);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
}

.brand-name span {
  color: var(--blue);
}

.brand-sub {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.2;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav > a:not(.nav-cta) {
  position: relative;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 0;
  transition: color 0.2s var(--ease);
}

.site-nav > a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: right;
  background: var(--blue);
  transition: transform 0.25s var(--ease);
}

.site-nav > a:not(.nav-cta):hover,
.site-nav > a.is-active {
  color: var(--blue);
}

.site-nav > a:not(.nav-cta):hover::after,
.site-nav > a.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.nav-cta:hover {
  transform: translateY(-1px);
  background: var(--blue);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.menu-close {
  display: none;
}

/* --------------------------------------------------------------------------
   home hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(62px, 9vw, 118px) 0 0;
}

.hero-grid-lines {
  position: absolute;
  inset: 0 0 auto;
  height: 82%;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(22, 24, 29, 0.052) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 24, 29, 0.052) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 52% 34%, black 12%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 52% 34%, black 12%, transparent 78%);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.98fr);
  align-items: center;
  gap: clamp(36px, 6vw, 86px);
}

.hero-title {
  margin: 17px 0 24px;
  font-family: var(--display);
  font-size: clamp(66px, 8.4vw, 116px);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.hero-lead {
  max-width: 545px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.hero-meta strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hero-visual {
  min-width: 0;
}

.pipeline-card {
  position: relative;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(252, 251, 247, 0.76);
  box-shadow: var(--shadow-md);
}

.pipeline-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 18px;
  right: -16px;
  bottom: -16px;
  left: 18px;
  border-radius: var(--radius-lg);
  background: var(--blue);
  opacity: 0.07;
}

.pipeline-bar,
.pipeline-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.pipeline-bar {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.pipeline-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 0;
}

.pipeline-stage {
  min-width: 0;
}

.pipeline-img {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
}

.pipeline-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.pipeline-stage:hover .pipeline-img img {
  transform: scale(1.035);
}

.stage-corner {
  position: absolute;
  top: 7px;
  left: 7px;
  display: grid;
  width: 22px;
  height: 19px;
  place-items: center;
  border-radius: 3px;
  background: rgba(22, 24, 29, 0.82);
  color: var(--white);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.scanline {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(201, 242, 74, 0.9);
  box-shadow: 0 0 10px rgba(201, 242, 74, 0.7);
  opacity: 0.75;
  animation: scan 5.6s linear infinite;
  animation-delay: calc(var(--stage) * 0.7s);
}

@keyframes scan {
  0% { top: 4%; opacity: 0; }
  12% { opacity: 0.85; }
  78% { opacity: 0.6; }
  100% { top: 96%; opacity: 0; }
}

.pipeline-stage figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 1px 3px;
}

.pipeline-stage figcaption > span {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-stage figcaption small {
  overflow: hidden;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.hero-visual-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.hand-arrow {
  color: var(--orange);
  font-size: 22px;
  line-height: 0.7;
}

.hero-bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: clamp(48px, 7vw, 85px);
  padding: 16px 0;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
}

.hero-bottom-line {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 8px);
}

/* --------------------------------------------------------------------------
   home sections / path
   -------------------------------------------------------------------------- */

.home-section {
  padding: clamp(72px, 9vw, 118px) 0;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.path-card {
  display: flex;
  flex-direction: column;
  min-height: 255px;
  padding: 22px 22px 20px;
  border-top: 2px solid var(--ink);
  background: rgba(252, 251, 247, 0.3);
  transition:
    transform 0.28s var(--ease),
    background-color 0.28s var(--ease),
    border-color 0.28s var(--ease);
}

.path-card:hover {
  transform: translateY(-5px);
  border-top-color: var(--blue);
  background: var(--white);
}

.path-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
}

.path-num {
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
}

.path-count {
  font-size: 8px;
}

.path-card h3 {
  margin-top: 34px;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.path-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.path-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 22px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: gap 0.2s var(--ease), color 0.2s var(--ease);
}

.path-card:hover .path-link {
  gap: 11px;
  color: var(--blue);
}

/* --------------------------------------------------------------------------
   algorithm cards
   -------------------------------------------------------------------------- */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.algo-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.52);
  transition:
    transform 0.3s var(--ease),
    border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease),
    background-color 0.3s var(--ease);
}

.algo-card:hover {
  transform: translateY(-5px);
  border-color: rgba(47, 75, 255, 0.5);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.algo-thumb {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--line);
}

.algo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease);
}

.algo-card:hover .algo-thumb img {
  transform: scale(1.035);
}

.algo-num {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  min-width: 27px;
  height: 25px;
  padding-inline: 5px;
  place-items: center;
  border-radius: 4px;
  background: var(--ink);
  color: var(--white);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.algo-open {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 29px;
  height: 29px;
  transform: translateY(-4px);
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.algo-card:hover .algo-open {
  transform: translateY(0);
  opacity: 1;
}

.algo-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 19px 17px;
}

.algo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.algo-level {
  color: var(--blue);
}

.algo-body h3 {
  margin-top: 9px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.algo-body p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.62;
}

.algo-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 16px;
}

.algo-tags span:not(.algo-time) {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.35;
  letter-spacing: 0.025em;
}

.algo-time {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.catalog-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.catalog-more > span {
  color: var(--muted-2);
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   compare component
   -------------------------------------------------------------------------- */

.compare {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #0d0f14;
  cursor: ew-resize;
  touch-action: pan-y;
}

.compare:focus-within {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.compare-before,
.compare-after img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.compare-before {
  position: relative;
}

.compare-after {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 0 0 calc(100% - var(--pos, 50%)));
}

.compare-after img {
  position: absolute;
  inset: 0;
}

.compare-line {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: var(--pos, 50%);
  width: 2px;
  transform: translateX(-1px);
  background: var(--lime);
  box-shadow: 0 0 10px rgba(201, 242, 74, 0.6);
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--dark);
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
}

.compare-handle .icon {
  width: 11px;
  height: 11px;
  margin-inline: -2px;
}

.compare-handle > span {
  margin-inline: -1px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.compare-range {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}

.compare-range::-webkit-slider-thumb {
  width: 40px;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: ew-resize;
}

.compare-range::-moz-range-thumb {
  width: 40px;
  height: 100%;
  border: 0;
  cursor: ew-resize;
}

/* --------------------------------------------------------------------------
   home demo teaser
   -------------------------------------------------------------------------- */

.is-dark {
  background: var(--dark);
  color: var(--dark-text);
}

.demo-teaser {
  position: relative;
  overflow: hidden;
  padding: clamp(78px, 9vw, 116px) 0 0;
}

.demo-teaser::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -100px;
  width: 620px;
  height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  box-shadow:
    0 0 0 70px rgba(255, 255, 255, 0.015),
    0 0 0 140px rgba(255, 255, 255, 0.01);
  pointer-events: none;
}

.demo-teaser-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(44px, 6vw, 88px);
}

.demo-teaser .section-title {
  color: var(--white);
}

.demo-teaser .section-aside {
  color: #aeb2bd;
  font-size: 14px;
}

.compare-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.compare-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: transparent;
  color: #aeb2bd;
  font-size: 11.5px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.compare-tab span {
  font-size: 8px;
  color: #727887;
}

.compare-tab:hover {
  border-color: rgba(255, 255, 255, 0.38);
  color: var(--white);
}

.compare-tab.is-active {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
}

.compare-tab.is-active span {
  color: rgba(22, 24, 29, 0.55);
}

.compare-readout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  color: #737987;
  font-size: 8px;
}

.compare-divider {
  color: #4a4f5c;
}

.compare-note {
  min-height: 44px;
  margin-top: 9px;
  color: #aeb2bd;
  font-size: 12.5px;
  line-height: 1.65;
}

.compare-stage {
  min-width: 0;
}

.compare-frame {
  position: relative;
  padding: 12px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-lg);
  background: var(--dark-2);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.frame-label {
  position: absolute;
  z-index: 2;
  top: 22px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 8px;
  pointer-events: none;
}

.frame-label-left {
  left: 22px;
}

.frame-label-right {
  right: 22px;
}

.compare-large {
  border-radius: 11px;
  aspect-ratio: 4 / 3;
}

.compare-tech {
  position: absolute;
  z-index: 2;
  right: 22px;
  bottom: 22px;
  padding: 5px 7px;
  border-radius: 3px;
  background: rgba(20, 22, 28, 0.72);
  color: var(--lime);
  font-size: 7.5px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.demo-teaser-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(42px, 6vw, 70px);
  padding: 18px 0;
  border-top: 1px solid var(--dark-line);
  color: #737987;
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   method
   -------------------------------------------------------------------------- */

.method-section {
  background: rgba(252, 251, 247, 0.22);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.method-card {
  display: flex;
  flex-direction: column;
  min-height: 290px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.5);
}

.method-num {
  color: var(--muted-2);
  font-size: 8px;
}

.method-card h3 {
  margin-top: 29px;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.method-card p {
  max-width: 310px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.method-viz {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 66px;
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.method-viz-1 span {
  width: 28%;
  border-radius: 2px 2px 0 0;
  background: var(--ink);
}

.method-viz-1 span:nth-child(1) { height: 38%; opacity: 0.38; }
.method-viz-1 span:nth-child(2) { height: 72%; background: var(--blue); }
.method-viz-1 span:nth-child(3) { height: 53%; opacity: 0.65; }

.method-viz-2 {
  display: block;
  padding: 11px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-transform: none;
}

.method-viz-3 {
  align-items: center;
  padding-top: 28px;
}

.demo-bar {
  position: relative;
  width: 100%;
  height: 2px;
  background: var(--line-strong);
}

.demo-bar::before {
  content: "";
  position: absolute;
  inset: 0 38% 0 0;
  background: var(--blue);
}

.demo-knob {
  position: absolute;
  bottom: 16px;
  left: 58%;
  width: 17px;
  height: 17px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 1px var(--ink);
}

/* --------------------------------------------------------------------------
   lab CTA
   -------------------------------------------------------------------------- */

.lab-cta {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 9vw, 114px) 0;
  background: var(--blue);
  color: var(--white);
}

.lab-cta::after {
  content: "";
  position: absolute;
  right: -12vw;
  bottom: -38vw;
  width: 70vw;
  height: 70vw;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 0 8vw rgba(255, 255, 255, 0.035),
    0 0 0 16vw rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.lab-cta-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: end;
  gap: 55px;
}

.lab-cta h2 {
  margin-top: 18px;
  font-family: var(--display);
  font-size: clamp(40px, 5.3vw, 74px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.06em;
}

.lab-cta .mark-orange {
  color: var(--ink);
  background-image: linear-gradient(transparent 61%, var(--orange) 61%, var(--orange) 94%, transparent 94%);
}

.lab-cta-side {
  padding-bottom: 5px;
}

.lab-cta-side > p {
  max-width: 360px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13.5px;
  line-height: 1.75;
}

.lab-cta-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.lab-cta-note {
  display: block;
  margin-top: 26px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding: 65px 0 28px;
  background: var(--ink);
  color: var(--paper);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 0.9fr;
  gap: 45px;
  padding-bottom: 50px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-footer .brand-mark {
  background: var(--lime);
  color: var(--ink);
}

.brand-footer .brand-name span {
  color: var(--lime);
}

.brand-footer .brand-sub {
  color: #7c8079;
}

.footer-tagline {
  max-width: 310px;
  margin-top: 20px;
  color: #9b9c94;
  font-size: 12px;
  line-height: 1.75;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: #72756d;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.footer-label {
  margin-bottom: 8px;
  color: #63675f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-column a,
.footer-column > span {
  color: #a9aaa2;
  font-size: 11.5px;
  line-height: 1.5;
  transition: color 0.2s var(--ease);
}

.footer-column a:hover {
  color: var(--lime);
}

.footer-wordmark {
  overflow: hidden;
  padding: 30px 0 20px;
  color: #2a2c32;
  font-family: var(--display);
  font-size: clamp(58px, 14vw, 190px);
  font-weight: 600;
  line-height: 0.78;
  letter-spacing: -0.085em;
  white-space: nowrap;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #72756d;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.footer-bottom a {
  color: #a9aaa2;
  transition: color 0.2s var(--ease);
}

.footer-bottom a:hover {
  color: var(--lime);
}

/* --------------------------------------------------------------------------
   catalog page
   -------------------------------------------------------------------------- */

.catalog-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 82px) 0 clamp(40px, 6vw, 66px);
}

.catalog-hero::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -12%;
  width: 54vw;
  height: 54vw;
  border: 1px solid rgba(22, 24, 29, 0.06);
  border-radius: 50%;
  box-shadow: 0 0 0 5vw rgba(22, 24, 29, 0.015), 0 0 0 10vw rgba(22, 24, 29, 0.01);
  pointer-events: none;
}

.catalog-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(370px, 0.92fr);
  align-items: center;
  gap: clamp(42px, 6vw, 84px);
}

.catalog-title {
  margin: 17px 0 24px;
  font-family: var(--display);
  font-size: clamp(57px, 7.5vw, 108px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.catalog-hero .lead {
  max-width: 600px;
}

.catalog-stats {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.catalog-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.catalog-stats strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: -0.03em;
}

.catalog-index-card {
  overflow: hidden;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-md);
}

.index-card-head,
.index-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  color: #858981;
  font-size: 8px;
}

.index-card-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.index-card-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  font-size: 7px;
}

.index-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.index-cell {
  display: flex;
  min-height: 66px;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  color: #aaa991;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.index-cell:nth-child(3n) {
  border-right: 0;
}

.index-cell:hover {
  background: var(--blue);
  color: var(--white);
}

.index-cell .mono {
  color: var(--lime);
  font-size: 8px;
}

.index-cell small {
  display: block;
  overflow: hidden;
  color: #75796f;
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}

.index-cell:hover small {
  color: rgba(255, 255, 255, 0.72);
}

.catalog-body {
  padding-bottom: clamp(70px, 9vw, 110px);
}

.catalog-tools {
  position: sticky;
  z-index: 30;
  top: calc(var(--header-h) + 10px);
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 45px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(243, 241, 234, 0.92);
  box-shadow: 0 7px 22px rgba(22, 24, 29, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  min-height: 35px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--muted-2);
}

.search-box .icon {
  width: 15px;
  height: 15px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}

.search-box input::placeholder {
  color: var(--muted-2);
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.filter-chip span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.filter-chip.is-active span {
  color: var(--lime);
}

.filter-count {
  margin-left: auto;
  padding-right: 5px;
  color: var(--muted-2);
  font-size: 8px;
  white-space: nowrap;
}

.catalog-group {
  scroll-margin-top: calc(var(--header-h) + 80px);
}

.catalog-group + .catalog-group {
  margin-top: 56px;
}

.group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 21px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.group-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.group-num {
  padding-top: 5px;
  color: var(--blue);
  font-size: 10px;
}

.group-head h2 {
  font-family: var(--display);
  font-size: 29px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.group-head p {
  max-width: 550px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.group-count {
  padding-bottom: 5px;
  color: var(--muted-2);
  font-size: 8px;
  white-space: nowrap;
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-mark {
  display: block;
  color: var(--blue);
  font-family: var(--display);
  font-size: 60px;
  line-height: 1;
}

.empty-state h2 {
  margin-top: 12px;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.empty-state p {
  max-width: 430px;
  margin: 10px auto 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.catalog-note {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 25px;
  margin-top: 70px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.catalog-note > .mono {
  color: var(--muted-2);
  font-size: 8px;
}

.catalog-note p {
  max-width: 610px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   lesson hero
   -------------------------------------------------------------------------- */

.reading-progress {
  position: fixed;
  z-index: 90;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--orange);
  transition: width 0.1s linear;
}

.algo-hero {
  position: relative;
  overflow: hidden;
  padding: 29px 0 clamp(58px, 7vw, 85px);
  border-bottom: 1px solid var(--line);
}

.algo-hero::before {
  content: "";
  position: absolute;
  top: 10%;
  right: -15%;
  width: 58vw;
  height: 58vw;
  border: 1px solid rgba(22, 24, 29, 0.055);
  border-radius: 50%;
  box-shadow: 0 0 0 5vw rgba(22, 24, 29, 0.012), 0 0 0 10vw rgba(22, 24, 29, 0.008);
  pointer-events: none;
}

.breadcrumb {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(36px, 5vw, 62px);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.breadcrumb a {
  transition: color 0.2s var(--ease);
}

.breadcrumb a:hover {
  color: var(--blue);
}

.breadcrumb span[aria-current] {
  color: var(--ink);
}

.algo-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  align-items: center;
  gap: clamp(40px, 6vw, 78px);
}

.algo-title {
  margin: 15px 0 20px;
  font-family: var(--display);
  font-size: clamp(47px, 6.1vw, 87px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.072em;
}

.algo-hero .lead {
  max-width: 650px;
}

.algo-meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.025em;
  line-height: 1.3;
  text-transform: uppercase;
}

.chip-mono {
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.chip-demo {
  border-color: transparent;
  background: var(--lime-soft);
  color: var(--ink);
}

.algo-actions {
  margin-top: 26px;
}

.algo-cover {
  position: relative;
}

.algo-cover-img {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-sm);
}

.algo-cover-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.algo-cover-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(22, 24, 29, 0.3));
  pointer-events: none;
}

.cover-index {
  position: absolute;
  z-index: 2;
  top: 11px;
  left: 11px;
  padding: 5px 7px;
  border-radius: 3px;
  background: var(--lime);
  color: var(--ink);
  font-size: 8px;
}

.cover-scan {
  position: absolute;
  z-index: 2;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(201, 242, 74, 0.8);
  box-shadow: 0 0 12px rgba(201, 242, 74, 0.8);
  animation: cover-scan 6s ease-in-out infinite;
}

@keyframes cover-scan {
  0%, 12% { top: 8%; opacity: 0; }
  20% { opacity: 0.8; }
  78% { opacity: 0.6; }
  90%, 100% { top: 92%; opacity: 0; }
}

.algo-cover figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 0;
  color: var(--muted-2);
}

.algo-cover figcaption .mono {
  font-size: 8px;
}

.cover-caption {
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   lesson body
   -------------------------------------------------------------------------- */

.lesson {
  padding: clamp(58px, 7vw, 92px) 0 clamp(80px, 9vw, 120px);
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 215px;
  align-items: start;
  gap: clamp(38px, 5vw, 72px);
}

.lesson-main {
  min-width: 0;
  max-width: 880px;
}

.lesson-section {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 22px;
  padding: 44px 0;
  scroll-margin-top: calc(var(--header-h) + 28px);
  border-top: 1px solid var(--line);
}

.lesson-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.section-marker {
  padding-top: 8px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-marker span {
  display: block;
  margin-bottom: 6px;
  color: var(--orange);
  font-size: 11px;
}

.section-body {
  min-width: 0;
}

.section-title-sm {
  margin-top: -4px;
}

.prose {
  max-width: 700px;
  margin-top: 15px;
  color: #444740;
  font-size: 15.5px;
  line-height: 1.82;
}

.prose + .prose {
  margin-top: 13px;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose em {
  color: var(--ink-2);
}

.prose code {
  font-size: 0.8em;
}

.pull-quote {
  position: relative;
  max-width: 680px;
  margin-top: 26px;
  padding: 21px 24px 21px 28px;
  border-left: 3px solid var(--lime);
  background: rgba(255, 255, 255, 0.5);
}

.pull-mark {
  position: absolute;
  top: -3px;
  left: 8px;
  color: var(--blue);
  font-family: var(--display);
  font-size: 48px;
  line-height: 1;
  opacity: 0.23;
}

.pull-quote p {
  position: relative;
  color: var(--ink-2);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 24px;
}

.formula-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.68);
}

.formula-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 17px 0;
}

.formula-card-head .mono {
  color: var(--orange);
  font-size: 7.5px;
}

.formula-card-head h3 {
  color: var(--ink-2);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.025em;
  text-align: right;
}

.formula {
  overflow-x: auto;
  margin: 9px 15px 0;
  padding: 17px 14px;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
  font-size: 1.03rem;
  text-align: center;
}

.formula .katex-display {
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 0;
}

.formula-legend {
  display: flex;
  gap: 7px 18px;
  flex-wrap: wrap;
  padding: 13px 17px 0;
}

.formula-legend li {
  position: relative;
  padding-left: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.formula-legend li::before {
  content: "";
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--blue);
}

.formula-note {
  padding: 11px 17px 15px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.6;
}

.step-list {
  margin-top: 22px;
}

.step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  padding: 17px 0;
  border-bottom: 1px dashed var(--line);
}

.step:first-child {
  padding-top: 0;
}

.step:last-child {
  border-bottom: 0;
}

.step-num {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--blue);
  font-size: 8px;
}

.step h3 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.step p {
  max-width: 640px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.params-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(230px, 0.82fr);
  align-items: start;
  gap: 20px;
  margin-top: 23px;
}

.param-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.55);
}

.param-table {
  width: 100%;
  min-width: 450px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.55;
}

.param-table th,
.param-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.param-table th {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.param-table td {
  color: var(--muted);
}

.param-table td:first-child code {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 10px;
}

.param-table td:last-child {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.param-table tr:last-child td {
  border-bottom: 0;
}

.pitfalls {
  padding: 15px 16px 13px;
  border: 1px solid #f2c4b1;
  border-radius: var(--radius);
  background: var(--orange-soft);
}

.pitfalls .eyebrow {
  color: var(--orange-dark);
  font-size: 8px;
}

.pitfalls .eyebrow-index {
  background: var(--orange);
  color: var(--ink);
}

.pitfalls ul {
  margin-top: 12px;
}

.pitfalls li {
  position: relative;
  padding-left: 11px;
  color: #6d392b;
  font-size: 10.5px;
  line-height: 1.6;
}

.pitfalls li + li {
  margin-top: 8px;
}

.pitfalls li::before {
  content: "!";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--orange-dark);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   code
   -------------------------------------------------------------------------- */

.code-card {
  overflow: hidden;
  margin-top: 22px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: var(--dark);
  color: var(--dark-text);
}

.code-top,
.code-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 15px;
  background: var(--dark-2);
  color: #8d929f;
  font-size: 8px;
}

.code-top {
  border-bottom: 1px solid var(--dark-line);
}

.code-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--lime);
  vertical-align: 1px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid #3d4250;
  border-radius: 4px;
  background: transparent;
  color: #b7bac3;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.copy-btn:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.copy-btn.is-copied {
  border-color: var(--lime);
  color: var(--lime);
}

.code-body {
  overflow: auto;
  max-height: 570px;
  margin: 0;
  padding: 18px 19px;
  color: #d8d7cf;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  tab-size: 4;
}

.code-body code {
  font-size: inherit;
}

.code-body .highlight {
  color: #d8d7cf;
}

.code-body .k,
.code-body .kd,
.code-body .kn,
.code-body .kr { color: #ff9678; }
.code-body .s,
.code-body .s1,
.code-body .s2,
.code-body .se,
.code-body .sb { color: #c9f24a; }
.code-body .c,
.code-body .c1,
.code-body .cm { color: #737987; font-style: normal; }
.code-body .nf,
.code-body .fm { color: #9bb3ff; }
.code-body .nc,
.code-body .nn { color: #f1c87a; }
.code-body .n,
.code-body .nv,
.code-body .na { color: #e7e5dc; }
.code-body .mi,
.code-body .mf,
.code-body .m { color: #f3a96b; }
.code-body .o,
.code-body .ow { color: #c2a6ff; }
.code-body .nb,
.code-body .bp { color: #8ee4d5; }
.code-body .nd { color: #ffb8d1; }
.code-body .p { color: #aeb2bb; }

.code-foot {
  border-top: 1px solid var(--dark-line);
  font-size: 7px;
}


/* --------------------------------------------------------------------------
   demo intro + bench
   -------------------------------------------------------------------------- */

.demo-section {
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.demo-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.demo-intro .prose {
  max-width: 570px;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin-top: 5px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.demo-bench {
  overflow: hidden;
  margin-top: 23px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-lg);
  background: var(--dark);
  color: var(--dark-text);
  box-shadow: 0 20px 50px rgba(22, 24, 29, 0.12);
}

.bench-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--dark-line);
  background: var(--dark-2);
}

.bench-head-left {
  display: flex;
  align-items: baseline;
  gap: 11px;
  min-width: 0;
}

.bench-kicker {
  color: var(--lime);
  font-size: 7.5px;
  white-space: nowrap;
}

.bench-head strong {
  overflow: hidden;
  color: #dcdad2;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bench-status {
  color: #8b909d;
  font-size: 7.5px;
  white-space: nowrap;
}

.bench-status.is-running {
  color: var(--lime);
}

.bench-status.is-error {
  color: #ff9678;
}

.bench-grid {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  align-items: stretch;
}

.bench-controls {
  min-width: 0;
  padding: 18px 16px;
  border-right: 1px solid var(--dark-line);
  background: #181b22;
}

.bench-group + .bench-group {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #2c303a;
}

.bench-label {
  margin-bottom: 10px;
  color: #797e8b;
  font-size: 7px;
}

/* source pickers (generated by demo.js) */
.sample-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.sample-option {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  border: 1px solid #303440;
  border-radius: 5px;
  background: transparent;
  color: #8c909c;
  text-align: left;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.sample-option:hover {
  border-color: #666d7e;
  color: #d9d8d0;
}

.sample-option.is-active {
  border-color: var(--lime);
  background: rgba(201, 242, 74, 0.07);
  color: var(--lime);
}

.sample-option img {
  width: 100%;
  height: 42px;
  border-radius: 2px;
  object-fit: cover;
  opacity: 0.76;
}

.sample-option.is-active img {
  opacity: 1;
}

.sample-option span {
  overflow: hidden;
  padding: 0 1px;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  margin-top: 6px;
  padding: 7px;
  border: 1px dashed #3b404c;
  border-radius: 5px;
  color: #8c909c;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.02em;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--lime);
  color: var(--lime);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.upload-name {
  overflow: hidden;
  max-width: 145px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.pair-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px;
  border: 1px solid #303440;
  border-radius: 5px;
  background: transparent;
  color: #8c909c;
  text-align: left;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.pair-option:hover,
.pair-option.is-active {
  border-color: var(--lime);
  color: var(--lime);
}

.pair-option img {
  width: 56px;
  height: 39px;
  flex: 0 0 56px;
  border-radius: 2px;
  object-fit: cover;
}

.pair-option span {
  display: block;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-option small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #717683;
  font-family: var(--mono);
  font-size: 6.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* params (generated by demo.js) */
.control {
  margin-bottom: 12px;
}

.control:last-child {
  margin-bottom: 0;
}

.control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.control-label {
  color: #b6b8c1;
  font-size: 10px;
  line-height: 1.4;
}

.control-value {
  color: var(--lime);
  font-family: var(--mono);
  font-size: 8px;
}

.control input[type="range"] {
  display: block;
  width: 100%;
  height: 16px;
  margin: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

.control select {
  display: block;
  width: 100%;
  min-height: 31px;
  padding: 0 8px;
  border: 1px solid #3b404c;
  border-radius: 4px;
  outline: 0;
  background: #20232c;
  color: #d8d7cf;
  font-size: 10px;
  cursor: pointer;
}

.control select:focus-visible {
  border-color: var(--lime);
}

.check-control {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  color: #b6b8c1;
}

.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-box {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 2px;
  border: 1px solid #4b505e;
  border-radius: 3px;
  background: #1c1f27;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.check-control input:checked + .check-box {
  border-color: var(--lime);
  background: var(--lime);
}

.check-control input:checked + .check-box::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  transform: rotate(40deg);
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

.check-control input:focus-visible + .check-box {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.check-control strong {
  display: block;
  color: #c9c9c2;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.check-control small {
  display: block;
  margin-top: 2px;
  color: #777c89;
  font-size: 8.5px;
  line-height: 1.4;
}

.bench-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 17px;
}

.bench-elapsed {
  color: #8b909d;
  font-size: 8px;
  white-space: nowrap;
}

.bench-hint {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed #303440;
  color: #818693;
  font-size: 9px;
  line-height: 1.6;
}

.bench-error {
  margin-top: 11px;
  padding: 8px;
  border: 1px solid rgba(255, 91, 46, 0.35);
  border-radius: 4px;
  background: rgba(255, 91, 46, 0.1);
  color: #ffb19a;
  font-size: 9px;
  line-height: 1.5;
}

.bench-loading-line {
  height: 42px;
  margin-bottom: 5px;
  border-radius: 4px;
  background: #242832;
  animation: skeleton 1.5s ease-in-out infinite;
}

.bench-loading-line.short {
  height: 24px;
  width: 66%;
}

@keyframes skeleton {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.bench-main {
  min-width: 0;
  padding: 15px 15px 17px;
}

.bench-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #757a87;
  font-size: 7px;
}

.bench-view {
  position: relative;
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #2d313c;
  border-radius: 8px;
  background: #0d0f14;
}

.bench-placeholder {
  position: relative;
  width: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.bench-placeholder > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: saturate(0.6);
}

.placeholder-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.placeholder-cross {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 9px;
  place-items: center;
  border: 1px solid #4d5361;
  border-radius: 50%;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 300;
  line-height: 1;
}

.placeholder-overlay strong {
  color: #d8d7cf;
  font-size: 12px;
  font-weight: 500;
}

.placeholder-overlay > span:last-child {
  margin-top: 4px;
  color: #777c89;
  font-size: 10px;
}

.bench-view .compare {
  width: 100%;
  border-radius: 7px;
}

.bench-view .compare-before {
  height: auto;
  max-height: 470px;
  object-fit: contain;
}

.bench-view .compare-after img {
  object-fit: contain;
}

.bench-view .compare-tech {
  bottom: 8px;
  right: 8px;
  font-size: 6.5px;
}

.bench-view .result-frame {
  width: 100%;
  padding: 6px;
  background: #0f1117;
}

.bench-view .result-frame img {
  width: 100%;
  max-height: 470px;
  object-fit: contain;
  border-radius: 4px;
}

.bench-view .result-frame .result-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 2px 0;
  color: #777c89;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pair-source {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 6px;
}

.pair-source-item {
  position: relative;
  overflow: hidden;
  border: 1px solid #303440;
  border-radius: 4px;
  background: #0f1117;
}

.pair-source-item img {
  width: 100%;
  height: 73px;
  object-fit: cover;
}

.pair-source-item span {
  position: absolute;
  bottom: 4px;
  left: 5px;
  padding: 2px 4px;
  border-radius: 2px;
  background: rgba(13, 15, 20, 0.78);
  color: var(--lime);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.02em;
}

.bench-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 9px;
}

.metric {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #2d313c;
  border-radius: 4px;
  background: #181b22;
}

.metric span {
  display: block;
  color: #777c89;
  font-size: 6.5px;
  line-height: 1.4;
}

.metric strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #d5d4cc;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bench-log {
  overflow: hidden;
  margin-top: 9px;
  border: 1px solid #2d313c;
  border-radius: 4px;
  background: #0c0e12;
}

.bench-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-bottom: 1px solid #242832;
  color: #737986;
  font-size: 6.5px;
}

.bench-log-dots {
  display: flex;
  gap: 3px;
}

.bench-log-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #424854;
}

.bench-log-dots i:first-child { background: #ff7959; }
.bench-log-dots i:nth-child(2) { background: #e8c25f; }
.bench-log-dots i:last-child { background: #8dcd76; }

.bench-log pre {
  overflow: auto;
  max-height: 132px;
  margin: 0;
  padding: 9px 10px;
  color: #a9dcaa;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.stage-gallery-wrap {
  padding: 14px 15px 17px;
  border-top: 1px solid var(--dark-line);
}

.stage-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #737986;
  font-size: 7px;
}

.stage-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.stage-card {
  overflow: hidden;
  border: 1px solid #303440;
  border-radius: 5px;
  background: #181b22;
}

.stage-card img {
  width: 100%;
  height: 83px;
  object-fit: cover;
  background: #0d0f14;
}

.stage-card-body {
  padding: 6px 7px 7px;
}

.stage-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
}

.stage-card-head span:first-child {
  overflow: hidden;
  color: #c9c9c2;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.03em;
  line-height: 1.4;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-card-head span:last-child {
  color: var(--lime);
  font-family: var(--mono);
  font-size: 6px;
}

.stage-card p {
  overflow: hidden;
  margin-top: 2px;
  color: #777c89;
  font-size: 7.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-skeleton {
  height: 128px;
  border: 1px solid #2d313c;
  border-radius: 5px;
  background: #181b22;
  animation: skeleton 1.5s ease-in-out infinite;
}

.stage-card-empty {
  display: grid;
  min-height: 128px;
  place-items: center;
  border: 1px dashed #303440;
  border-radius: 5px;
  color: #666c79;
  font-family: var(--mono);
  font-size: 7px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   applications / lesson end / next
   -------------------------------------------------------------------------- */

.application-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.application-hint {
  margin-top: 9px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.55;
}

.modern-block {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 28px);
}

.modern-head > .mono {
  color: var(--orange);
  font-size: 8px;
}

.modern-head h3 {
  margin-top: 8px;
}

.modern-head .prose {
  max-width: 660px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.65;
}

.modern-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}

.modern-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
}

.modern-card > .mono {
  color: var(--orange);
  font-size: 7px;
}

.modern-card h4 {
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.modern-card p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.modern-card small {
  display: block;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
}

.modern-card small strong {
  color: var(--blue);
  font-weight: 600;
}

.modern-card.is-clickable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 240px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.modern-card.is-clickable:hover {
  border-color: var(--blue);
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(28, 34, 32, 0.08);
}

.modern-card.is-clickable:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.modern-card-title {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.modern-card-copy {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.modern-card-fit {
  display: block;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
}

.modern-card-fit strong {
  color: var(--blue);
  font-weight: 600;
}

.modern-card.is-clickable .application-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 8px;
}

.app-detail-copy h3 {
  margin-top: 18px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}

.app-detail-copy h3:first-child {
  margin-top: 0;
}

.application-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
}

.application-card.is-clickable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 148px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.application-card.is-clickable:hover {
  border-color: var(--blue);
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(28, 34, 32, 0.08);
}

.application-card.is-clickable:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.application-card .mono {
  color: var(--orange);
  font-size: 7px;
}

.application-card strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.application-card-title {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.application-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.application-card-copy {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.application-card .application-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 13px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 8px;
}

.app-dialog {
  width: min(690px, calc(100vw - 32px));
  max-height: min(82vh, 780px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(11, 15, 14, 0.28);
}

.app-dialog::backdrop {
  background: rgba(14, 18, 17, 0.58);
  backdrop-filter: blur(4px);
}

.app-dialog-panel {
  position: relative;
  max-height: inherit;
  padding: 34px 36px 38px;
  overflow: auto;
}

.app-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.app-dialog-close:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.app-detail .mono {
  color: var(--orange);
  font-size: 8px;
}

.app-detail h2 {
  max-width: 560px;
  margin-top: 9px;
  font-family: var(--display);
  font-size: clamp(25px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.app-detail-summary {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.app-detail-copy {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.app-detail-copy p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.72;
}

.app-detail-copy p:first-child {
  margin-top: 0;
}

.app-detail-copy ul {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-left: 18px;
}

.app-detail-copy li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.app-detail-copy li::marker {
  color: var(--orange);
}

body.app-dialog-open {
  overflow: hidden;
}

.lesson-end {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.lesson-end > .mono {
  color: var(--muted-2);
  font-size: 7.5px;
}

.lesson-end-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.lesson-toc {
  min-width: 0;
}

.toc-inner {
  position: sticky;
  top: calc(var(--header-h) + 27px);
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.toc-label {
  margin-bottom: 14px;
  color: var(--muted-2);
  font-size: 7.5px;
}

.toc-inner nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-inner nav a {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.toc-inner nav a span {
  color: var(--muted-2);
  font-size: 7px;
  transition: color 0.2s var(--ease);
}

.toc-inner nav a:hover {
  color: var(--ink);
  transform: translateX(2px);
}

.toc-inner nav a.is-active {
  color: var(--blue);
}

.toc-inner nav a.is-active span {
  color: var(--orange);
}

.toc-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 6.5px;
}

.next-section {
  padding: 0 0 clamp(70px, 9vw, 110px);
}

.next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 35px;
  padding: clamp(25px, 4vw, 43px);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--white);
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.next-card:hover {
  transform: translateY(-3px);
  background: var(--blue);
}

.next-card-copy > .mono {
  color: var(--lime);
  font-size: 8px;
}

.next-card h2 {
  margin-top: 13px;
  font-family: var(--display);
  font-size: clamp(28px, 3.8vw, 47px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.next-card p {
  max-width: 440px;
  margin-top: 9px;
  color: #a7a9a2;
  font-size: 12px;
  line-height: 1.65;
}

.next-card:hover p {
  color: rgba(255, 255, 255, 0.72);
}

.next-arrow {
  display: grid;
  width: clamp(55px, 7vw, 79px);
  height: clamp(55px, 7vw, 79px);
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 50%;
  color: var(--lime);
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.next-card:hover .next-arrow {
  transform: rotate(-35deg);
  background: var(--lime);
  color: var(--ink);
}


/* --------------------------------------------------------------------------
   playground
   -------------------------------------------------------------------------- */

.playground-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 82px) 0 clamp(46px, 6vw, 68px);
  border-bottom: 1px solid var(--line);
}

.playground-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  align-items: center;
  gap: clamp(40px, 6vw, 80px);
}

.playground-hero .lead {
  max-width: 600px;
}

.playground-note {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.66);
  box-shadow: var(--shadow-sm);
}

.playground-note > .mono {
  color: var(--orange);
  font-size: 7.5px;
}

.pipeline-formula {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 13px;
}

.pipeline-formula span {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-2);
  font-size: 8px;
  letter-spacing: 0.01em;
  text-transform: none;
}

.pipeline-formula i {
  color: var(--orange);
  font-family: var(--body);
  font-size: 11px;
  font-style: normal;
}

.playground-note > p {
  margin-top: 13px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.playground-note-foot {
  display: block;
  margin-top: 18px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  color: var(--muted-2);
  font-size: 7px;
}

.playground-body {
  padding: clamp(45px, 6vw, 68px) 0 clamp(70px, 8vw, 100px);
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}

.preset-row > .mono {
  color: var(--muted-2);
  font-size: 7.5px;
}

.preset-btn {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.preset-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.preset-btn.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.preset-hint {
  margin-left: 4px;
  color: var(--muted-2);
  font-size: 10px;
}

.pipeline-bench .bench-view {
  min-height: 380px;
}

.pipeline-steps {
  margin-top: 2px;
}

.mini-range {
  margin: 1px 0 5px 22px;
  padding-bottom: 4px;
}

.mini-range label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1px;
  color: #818693;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.015em;
}

.mini-range output {
  color: var(--lime);
  font-family: var(--mono);
  font-size: 7.5px;
}

.mini-range input[type="range"] {
  display: block;
  width: 100%;
  height: 14px;
  margin: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

.playground-footnote {
  padding: 48px 0 65px;
  border-top: 1px solid var(--line);
  background: rgba(252, 251, 247, 0.34);
}

.footnote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 35px;
  margin-bottom: 35px;
}

.footnote-grid .mono {
  color: var(--orange);
  font-size: 7px;
}

.footnote-grid h3 {
  margin-top: 10px;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.footnote-grid p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   reference
   -------------------------------------------------------------------------- */

.reference-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 82px) 0 clamp(46px, 6vw, 66px);
  border-bottom: 1px solid var(--line);
}

.reference-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.92fr);
  align-items: center;
  gap: clamp(40px, 6vw, 80px);
}

.reference-hero .lead {
  max-width: 600px;
}

.reference-card {
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.reference-card > .mono {
  color: var(--orange);
  font-size: 7.5px;
}

.rule-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

.rule-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.rule-row > .mono {
  color: var(--blue);
  font-size: 8px;
}

.rule-row p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.rule-row p code {
  font-size: 0.78em;
}

.reference-body {
  padding: 26px 0 clamp(70px, 9vw, 110px);
}

.reference-jump {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 42px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
}

.reference-jump > .mono {
  font-size: 7px;
}

.reference-jump a {
  color: var(--muted);
  font-size: 11px;
  transition: color 0.2s var(--ease);
}

.reference-jump a:hover {
  color: var(--blue);
}

.reference-block {
  padding: 38px 0;
  scroll-margin-top: calc(var(--header-h) + 30px);
  border-top: 1px solid var(--line);
}

.reference-block:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.reference-block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 35px;
  margin-bottom: 21px;
}

.reference-block-head .mono {
  color: var(--orange);
  font-size: 7px;
}

.reference-block-head h2 {
  margin-top: 7px;
  font-family: var(--display);
  font-size: clamp(28px, 3.3vw, 42px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.reference-block-head > p {
  max-width: 365px;
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.api-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 251, 247, 0.54);
}

.api-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.55;
}

.api-table th,
.api-table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.api-table th {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.api-table td {
  color: var(--muted);
}

.api-table td:first-child {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.api-table td:nth-child(2) code {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 9.5px;
}

.api-table tr:last-child td {
  border-bottom: 0;
}

.formula-grid-ref {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.glossary-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.glossary-item h3 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.glossary-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
}

.checklist-item > .mono {
  color: var(--orange);
  font-size: 8px;
}

.checklist-item p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.checklist-item p code {
  font-size: 0.78em;
}

.reference-cta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 30px;
}

/* --------------------------------------------------------------------------
   error page
   -------------------------------------------------------------------------- */

.error-page {
  display: grid;
  min-height: 62vh;
  padding: 70px 0;
  place-items: center;
}

.error-inner {
  max-width: 600px;
  text-align: center;
}

.error-code {
  color: var(--blue);
  font-family: var(--display);
  font-size: clamp(100px, 18vw, 190px);
  font-weight: 600;
  line-height: 0.76;
  letter-spacing: -0.09em;
}

.error-page h1 {
  margin-top: 26px;
  font-family: var(--display);
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.error-page p {
  max-width: 430px;
  margin: 13px auto 25px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   additional compare variant used by generated demos
   -------------------------------------------------------------------------- */

.compare-demo {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.compare-demo .compare-before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d0f14;
}

.compare-demo .compare-after img {
  object-fit: contain;
  background: #0d0f14;
}

.bench-view .compare-demo .compare-before {
  height: 100%;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1120px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
    gap: 40px;
  }

  .hero-title {
    font-size: clamp(59px, 8.2vw, 90px);
  }

  .stage-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lesson-layout {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 42px;
  }

  .lesson-section {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 18px;
  }

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

  .footer-top {
    grid-template-columns: 1.3fr 0.8fr 0.8fr;
  }

  .footer-top .footer-column:last-child {
    display: none;
  }
}

@media (max-width: 980px) {
  :root {
    --header-h: 70px;
  }

  .menu-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(243, 241, 234, 0.98);
    box-shadow: 0 20px 35px rgba(22, 24, 29, 0.09);
  }

  .site-nav > a:not(.nav-cta) {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
  }

  .site-nav > a:not(.nav-cta)::after {
    display: none;
  }

  .nav-cta {
    min-height: 43px;
    justify-content: center;
    margin-top: 12px;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .site-nav {
    display: flex;
  }

  body.nav-open .menu-open {
    display: none;
  }

  body.nav-open .menu-close {
    display: block;
  }

  .hero-grid,
  .catalog-hero-grid,
  .algo-hero-grid,
  .playground-hero-grid,
  .reference-hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    max-width: 720px;
  }

  .hero-visual {
    width: min(640px, 100%);
  }

  .catalog-hero-copy,
  .playground-hero > .container > div:first-child,
  .reference-hero-grid > div:first-child {
    max-width: 760px;
  }

  .catalog-index-card {
    width: min(600px, 100%);
  }

  .algo-hero-grid {
    align-items: start;
  }

  .algo-cover {
    width: min(560px, 100%);
  }

  .demo-teaser-grid,
  .lab-cta-inner {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .demo-teaser-copy {
    max-width: 700px;
  }

  .compare-stage {
    width: min(700px, 100%);
  }

  .lab-cta-side {
    padding-bottom: 0;
  }

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

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

  .method-card:last-child {
    grid-column: 1 / -1;
    min-height: 235px;
  }

  .footer-top {
    grid-template-columns: 1.15fr 0.85fr 0.85fr;
    gap: 30px;
  }

  .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 900px;
  }

  .lesson-toc {
    display: none;
  }

  .lesson-main {
    max-width: none;
  }

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

  .bench-controls {
    border-right: 0;
    border-bottom: 1px solid var(--dark-line);
  }

  .bench-controls .sample-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bench-controls .pair-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .reference-block-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .reference-block-head > p {
    max-width: 600px;
    padding: 0;
  }

  .footnote-grid {
    gap: 22px;
  }
}

@media (max-width: 760px) {
  .container {
    width: calc(100% - var(--gutter) * 2);
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 30px;
  }

  .section-aside {
    max-width: 560px;
    padding: 0;
  }

  .section-aside-action {
    gap: 11px;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-title {
    margin-top: 13px;
    font-size: clamp(53px, 14vw, 80px);
  }

  .hero-lead {
    font-size: 15.5px;
  }

  .hero-meta {
    gap: 12px;
    margin-top: 23px;
  }

  .hero-visual {
    width: 100%;
  }

  .pipeline-card {
    padding: 9px;
    border-radius: 17px;
  }

  .pipeline-stage figcaption small {
    display: none;
  }

  .hero-bottom {
    margin-top: 44px;
  }

  .hero-bottom .mono:last-child {
    display: none;
  }

  .path-grid,
  .method-grid,
  .catalog-grid,
  .catalog-grid-all {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .path-card {
    min-height: 225px;
    padding: 17px;
  }

  .path-card h3 {
    margin-top: 25px;
    font-size: 22px;
  }

  .algo-card {
    border-radius: 11px;
  }

  .algo-body {
    padding: 13px;
  }

  .algo-body h3 {
    font-size: 18px;
  }

  .algo-body p {
    font-size: 11px;
  }

  .algo-tags span:nth-child(2) {
    display: none;
  }

  .method-card {
    min-height: 255px;
    padding: 17px;
  }

  .method-card h3 {
    margin-top: 20px;
    font-size: 21px;
  }

  .method-viz-2 {
    font-size: 7.5px;
  }

  .lab-cta h2 {
    font-size: clamp(36px, 8vw, 55px);
  }

  .lab-cta-actions .btn {
    white-space: normal;
    text-align: center;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-top .footer-column:last-child {
    display: flex;
    grid-column: 1 / -1;
  }

  .footer-wordmark {
    padding-top: 22px;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .catalog-tools {
    position: relative;
    top: 0;
    gap: 10px;
    padding: 9px;
  }

  .search-box {
    width: 100%;
  }

  .filter-count {
    order: 4;
    margin-left: 0;
    padding-left: 3px;
  }

  .catalog-note {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .catalog-note > .mono {
    font-size: 7px;
  }

  .catalog-note .text-link {
    margin-top: 5px;
  }

  .group-title-wrap {
    gap: 9px;
  }

  .group-head h2 {
    font-size: 24px;
  }

  .group-head p {
    font-size: 11px;
  }

  .group-count {
    display: none;
  }

  .catalog-group + .catalog-group {
    margin-top: 42px;
  }

  .algo-hero {
    padding-top: 20px;
  }

  .algo-title,
  .catalog-title {
    font-size: clamp(47px, 12vw, 75px);
  }

  .algo-hero .lead {
    font-size: 15px;
  }

  .algo-cover {
    width: 100%;
  }

  .lesson {
    padding-top: 42px;
  }

  .lesson-section {
    display: block;
    padding: 31px 0;
  }

  .section-marker {
    margin-bottom: 14px;
    padding-top: 0;
  }

  .section-marker span {
    display: inline;
    margin-right: 5px;
  }

  .section-title-sm {
    font-size: 27px;
  }

  .prose {
    font-size: 14.5px;
    line-height: 1.75;
  }

  .pull-quote {
    padding: 17px 17px 17px 20px;
  }

  .pull-quote p {
    font-size: 16px;
  }

  .formula-card-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .formula-card-head h3 {
    text-align: left;
  }

  .formula {
    margin-inline: 10px;
    padding: 13px 9px;
    font-size: 0.94rem;
  }

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

  .param-table {
    min-width: 520px;
  }

  .code-body {
    max-height: 440px;
    padding: 14px;
    font-size: 10.5px;
  }

  .demo-intro {
    flex-direction: column;
    gap: 9px;
  }

  .demo-badge {
    margin: 0;
  }

  .bench-controls {
    padding: 15px 13px;
  }

  .bench-controls .sample-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bench-main {
    padding: 11px;
  }

  .bench-view {
    min-height: 240px;
  }

  .bench-placeholder {
    min-height: 240px;
  }

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

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

  .stage-card img {
    height: 105px;
  }

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

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

  .lesson-end-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .next-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
  }

  .next-arrow {
    width: 50px;
    height: 50px;
  }

  .playground-note {
    width: 100%;
  }

  .preset-row {
    align-items: flex-start;
  }

  .preset-hint {
    width: 100%;
    margin: 2px 0 0;
  }

  .footnote-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .formula-grid-ref,
  .glossary-grid,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .reference-block {
    padding: 30px 0;
  }

  .reference-block-head h2 {
    font-size: 29px;
  }

  .reference-cta {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .api-table {
    font-size: 10px;
  }

  .api-table th,
  .api-table td {
    padding: 9px 10px;
  }
}

@media (max-width: 520px) {
  .path-grid,
  .method-grid,
  .catalog-grid,
  .catalog-grid-all,
  .application-grid,
  .modern-grid {
    grid-template-columns: 1fr;
  }

  .app-dialog {
    width: calc(100vw - 20px);
    max-height: 88vh;
  }

  .app-dialog-panel {
    padding: 26px 21px 28px;
  }

  .application-card.is-clickable {
    min-height: 0;
  }

  .method-card:last-child {
    grid-column: auto;
  }

  .algo-card {
    border-radius: var(--radius);
  }

  .algo-body h3 {
    font-size: 21px;
  }

  .algo-body p {
    font-size: 12px;
  }

  .algo-tags span:nth-child(2) {
    display: inline;
  }

  .hero-actions,
  .algo-actions,
  .lab-cta-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .btn,
  .algo-actions .btn,
  .lab-cta-actions .btn,
  .lesson-end-actions .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  .hero-meta {
    gap: 8px 13px;
  }

  .pipeline-grid {
    gap: 5px;
  }

  .pipeline-bar,
  .pipeline-foot {
    font-size: 7.5px;
  }

  .pipeline-stage figcaption {
    display: block;
    padding-top: 5px;
  }

  .pipeline-stage figcaption > span {
    font-size: 8.5px;
  }

  .hero-visual-note {
    margin-top: 11px;
    font-size: 10.5px;
  }

  .compare-tabs {
    gap: 5px;
  }

  .compare-tab {
    min-height: 32px;
    padding: 0 8px;
    font-size: 10px;
  }

  .compare-frame {
    padding: 7px;
    border-radius: 13px;
  }

  .frame-label {
    top: 14px;
  }

  .frame-label-left { left: 14px; }
  .frame-label-right { right: 14px; }

  .compare-tech {
    right: 14px;
    bottom: 14px;
    font-size: 6px;
  }

  .demo-teaser-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .catalog-stats {
    gap: 10px 16px;
  }

  .catalog-index-card {
    border-radius: 14px;
  }

  .index-cell {
    min-height: 55px;
    padding: 7px;
  }

  .index-cell small {
    font-size: 7px;
  }

  .filter-chips {
    gap: 2px;
  }

  .filter-chip {
    min-height: 29px;
    padding: 0 7px;
    font-size: 10px;
  }

  .filter-chip span {
    font-size: 7px;
  }

  .spec-card,
  .reference-card {
    padding: 15px;
  }

  .algo-title {
    font-size: clamp(42px, 12.5vw, 61px);
  }

  .algo-meta-row {
    gap: 5px;
  }

  .chip {
    font-size: 7px;
  }

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

  .step h3 {
    font-size: 15.5px;
  }

  .step p {
    font-size: 12px;
  }

  .bench-head {
    padding: 11px;
  }

  .bench-head-left {
    gap: 7px;
  }

  .bench-head strong {
    font-size: 12px;
  }

  .bench-kicker {
    font-size: 6.5px;
  }

  .bench-status {
    font-size: 6.5px;
  }

  .bench-log pre {
    font-size: 7px;
  }

  .stage-card img {
    height: 88px;
  }

  .stage-card-body {
    padding: 5px;
  }

  .stage-card-head span:first-child {
    font-size: 5.8px;
  }

  .stage-card p {
    font-size: 6.5px;
  }

  .next-card h2 {
    font-size: 31px;
  }

  .preset-row {
    gap: 5px;
  }

  .preset-btn {
    min-height: 29px;
    padding: 0 8px;
    font-size: 9.5px;
  }

  .playground-note {
    padding: 15px;
  }

  .reference-jump {
    gap: 10px 14px;
  }

  .reference-jump a {
    font-size: 10px;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-brand,
  .footer-top .footer-column:last-child {
    grid-column: auto;
  }

  .footer-wordmark {
    font-size: 19vw;
  }
}


/* Nguồn tham khảo (chương 32–46 từ CS 4476) */
.lesson-sources { margin: 2rem 0 1.5rem; padding: 1rem 1.25rem; border: 1px solid var(--line, #d9d6cc); border-radius: 12px; }
.lesson-sources ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.lesson-sources li { margin: .25rem 0; overflow-wrap: anywhere; }
.lesson-sources p { margin: .6rem 0 0; font-size: .85rem; opacity: .75; }
