:root {
  --bg: #030506;
  --bg-raised: #070a0c;
  --surface: #0b0f12;
  --surface-soft: #10161a;
  --text: #f2f4f4;
  --muted: #a2a8ab;
  --dim: #737d83;
  --line: #252d32;
  --line-bright: #566169;
  --steel: #7b858b;
  --amber: #e7a437;
  --amber-hot: #ffd27a;
  --header-height: 76px;
  --header-safe-offset: calc(var(--header-height) + clamp(16px, 2vh, 24px));
  --page-pad: clamp(24px, 4vw, 72px);
  --shell: 1540px;
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  /* Native wheel/touch and history restoration must not acquire another scroll
     animation. Explicit film controls still request smooth scroll themselves. */
  scroll-behavior: auto;
  scroll-padding-top: var(--header-safe-offset);
}

:where(main, section, article, h1, h2, h3)[id],
#production-app {
  scroll-margin-top: var(--header-safe-offset);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body.menu-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
svg { display: block; }
img { max-width: 100%; }

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

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

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

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}

.shell {
  width: min(100%, var(--shell));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.site-header {
  position: fixed;
  z-index: 80;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--header-height);
  padding: 0 var(--page-pad);
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid rgba(96, 108, 115, .38);
  background: rgba(3, 5, 6, .78);
  backdrop-filter: blur(16px);
}

.brand {
  flex: none;
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: .08em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 54px);
  margin: 0 auto;
  color: #bcc2c5;
  font-size: 14px;
}

.site-nav a {
  position: relative;
  padding: 29px 0;
  transition: color 180ms ease;
}

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

.site-nav a:hover,
.site-nav a[aria-current='page'] { color: var(--text); }

.site-nav a:hover::after,
.site-nav a[aria-current='page']::after { transform: scaleX(1); }

.menu-button {
  display: none;
  width: 48px;
  height: 48px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-button > span:not(.sr-only) {
  display: block;
  width: 24px;
  height: 1px;
  margin: 7px auto;
  background: currentColor;
  transition: transform 180ms ease;
}

.menu-button[aria-expanded='true'] > span:first-child { transform: translateY(4px) rotate(45deg); }
.menu-button[aria-expanded='true'] > span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

.eyebrow,
.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: #98a0a4;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow::before,
.section-label::before {
  width: 20px;
  height: 1px;
  content: '';
  background: var(--amber);
}

.route-transition {
  position: fixed;
  z-index: 160;
  inset: 0;
  display: grid;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(18, 23, 26, .32), transparent 42%),
    rgba(1, 2, 3, .94);
  opacity: 0;
  place-items: center;
}

.route-transition-line {
  position: absolute;
  top: 50%;
  right: clamp(32px, 8vw, 148px);
  left: clamp(32px, 8vw, 148px);
  height: 1px;
  overflow: hidden;
  background: rgba(105, 118, 125, .32);
}

.route-transition-line i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--line-bright) 16%, var(--amber) 62%, var(--amber-hot));
  box-shadow: 0 0 18px rgba(231, 164, 55, .3);
  transform: scaleX(0);
  transform-origin: left;
}

.route-transition-title {
  position: relative;
  z-index: 1;
  max-width: min(84vw, 1100px);
  padding: 16px clamp(22px, 3vw, 52px);
  background: #030506;
  color: var(--text);
  font-size: clamp(38px, 6vw, 86px);
  font-weight: 400;
  line-height: .94;
  letter-spacing: -.045em;
  opacity: 0;
  text-align: center;
  transform: translateY(14px);
}

.route-transition.is-leaving {
  visibility: visible;
  opacity: 1;
  transition: opacity 140ms ease-out;
}

.route-transition.is-leaving .route-transition-line i {
  transform: scaleX(1);
  transition: transform 240ms 30ms cubic-bezier(.65, 0, .24, 1);
}

.route-transition.is-leaving.has-title .route-transition-title {
  opacity: 1;
  transform: none;
  transition: opacity 150ms 70ms ease-out, transform 180ms 60ms cubic-bezier(.22, .68, .24, 1);
}

.chapter-ending {
  position: relative;
  min-height: 58svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #040607, #020304);
}

.chapter-ending::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  content: '';
  background: linear-gradient(90deg, transparent, var(--line-bright) 12%, var(--amber) 50%, var(--line-bright) 88%, transparent);
  opacity: .65;
}

.chapter-link {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: min(720px, calc(100vw - 48px));
  gap: 14px;
  padding: 40px;
  background: rgba(3, 5, 6, .94);
  text-align: center;
}

.chapter-link span {
  color: var(--muted);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.chapter-link strong {
  font-size: clamp(38px, 6vw, 86px);
  font-weight: 400;
  letter-spacing: -.045em;
}

.chapter-link i {
  color: var(--amber);
  font-size: 24px;
  font-style: normal;
  transition: transform 180ms ease;
}

.chapter-link:hover i { transform: translateX(8px); }

.chapter-ending[data-next-route] {
  --continuation-p: 0;
  --continuation-dark-p: 0;
  --continuation-line-p: 0;
  --continuation-title-p: 0;
  min-height: clamp(280px, 38svh, 440px);
  isolation: isolate;
}

html:not(.shell-ready) .chapter-ending[data-next-route] {
  --continuation-p: 1;
  --continuation-dark-p: 1;
  --continuation-line-p: 1;
  --continuation-title-p: 1;
}

.chapter-ending[data-next-route] > :not(.continuation-shade) {
  position: relative;
  z-index: 2;
}

.continuation-shade {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .5));
  opacity: var(--continuation-dark-p);
}

.chapter-ending[data-next-route]::before {
  z-index: 1;
  opacity: calc(.12 + (var(--continuation-line-p) * .76));
  transform: scaleX(calc(.08 + (var(--continuation-line-p) * .92)));
  transform-origin: left;
}

.chapter-ending[data-next-route]::after {
  position: absolute;
  z-index: 1;
  top: 0;
  left: calc(var(--continuation-line-p) * 100%);
  width: 1px;
  height: 100%;
  content: '';
  background: linear-gradient(180deg, transparent 6%, var(--amber) 50%, transparent 94%);
  box-shadow: 0 0 24px rgba(231, 164, 55, .25);
  opacity: calc(var(--continuation-line-p) * .72);
}

.chapter-ending[data-next-route] .chapter-link {
  opacity: calc(.18 + (var(--continuation-title-p) * .82));
  transform: translateY(calc((1 - var(--continuation-title-p)) * 24px));
  transition: color 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.chapter-ending[data-next-route] .tech-chapter-line span,
.chapter-ending[data-next-route] .quality-chapter-line span {
  transform: scaleX(var(--continuation-line-p));
  transform-origin: left;
}

.chapter-ending[data-next-route].tech-chapter-end::before {
  z-index: 0;
  opacity: .18;
  transform: none;
}

.chapter-ending[data-next-route].is-continuation-armed .chapter-link {
  color: var(--text);
}

.chapter-ending[data-next-route].is-continuation-confirming .chapter-link i {
  transform: translateX(8px);
  color: var(--amber-hot);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 128px;
  padding: 30px var(--page-pad);
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
}

.site-footer .brand { color: var(--text); }

html.runtime-lite .site-header {
  background: rgba(3, 5, 6, .97);
  backdrop-filter: none;
}

html.runtime-lite .chapter-ending[data-next-route]::after {
  display: none;
}

html.runtime-lite .route-transition {
  background: rgba(2, 3, 4, .92);
}

html.runtime-lite .route-transition-line i {
  box-shadow: none;
}

html.runtime-lite .route-transition.is-leaving {
  transition-duration: 90ms;
}

html.runtime-lite .route-transition.is-leaving .route-transition-line i {
  transition: transform 190ms 35ms ease-out;
}

html.runtime-lite .route-transition.is-leaving.has-title .route-transition-title {
  transition: opacity 140ms 110ms ease-out, transform 160ms 90ms ease-out;
}

.no-js-note {
  position: relative;
  z-index: 4;
  margin: 0;
  padding: 12px var(--page-pad);
  background: #14100a;
  color: #d8c7a9;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 900px) {
  :root { --header-height: calc(68px + env(safe-area-inset-top, 0px)); --page-pad: 24px; }

  .site-header { padding-inline: var(--page-pad); }
  .menu-button { display: none; }
  .site-nav {
    position: static;
    display: flex;
    width: 100%;
    height: auto;
    gap: 20px;
    margin-left: 24px;
    padding: 0;
    overflow-x: auto;
    background: transparent;
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .shell-ready .menu-button { display: block; }
  .shell-ready .site-nav {
    position: fixed;
    z-index: 79;
    top: var(--header-height);
    right: 0;
    left: 0;
    display: grid;
    align-content: start;
    gap: 0;
    width: auto;
    height: calc(100svh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    margin: 0;
    padding: 28px var(--page-pad) calc(40px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background: rgba(3, 5, 6, .985);
    opacity: 0;
    transform: translateY(-12px);
    visibility: hidden;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  }

  .shell-ready .site-nav.is-open { opacity: 1; transform: none; visibility: visible; }
  .shell-ready .site-nav:not(.is-open) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: none;
  }
  .site-nav a {
    flex: none;
    min-height: auto;
    padding: 8px 0;
    font-size: 14px;
  }
  .shell-ready .site-nav a { display: flex; align-items: center; min-height: 66px; padding: 0; border-bottom: 1px solid var(--line); font-size: clamp(24px, 7vw, 38px); }
  .site-nav a::after { display: none; }
  .site-nav a[aria-current='page'] { color: var(--amber-hot); }
  .chapter-ending { min-height: 48svh; }
  .chapter-ending[data-next-route] { min-height: clamp(340px, 52svh, 500px); }
  .chapter-link { padding: 32px 18px; }
  .route-transition-line { right: 24px; left: 24px; }
  .route-transition-title { max-width: calc(100vw - 48px); padding: 12px 18px; font-size: clamp(32px, 11vw, 52px); }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .route-transition { display: none; }
  .chapter-ending[data-next-route] {
    --continuation-p: 1;
    --continuation-dark-p: 1;
    --continuation-line-p: 1;
    --continuation-title-p: 1;
  }
}

html[data-motion='reduce'] { scroll-behavior: auto; }
html[data-motion='reduce'] *,
html[data-motion='reduce'] *::before,
html[data-motion='reduce'] *::after {
  scroll-behavior: auto !important;
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
html[data-motion='reduce'] .route-transition { display: none; }
html[data-motion='reduce'] .chapter-ending[data-next-route] {
  --continuation-p: 1;
  --continuation-dark-p: 1;
  --continuation-line-p: 1;
  --continuation-title-p: 1;
}
