:root {
  --bg: #0b0b0f;
  --card: #15151b;
  --text: #f3f0e8;
  --muted: #b1acba;
  --faint: #b7b2c2;
  --accent: #e8b86d;
  --accent-ink: #1c1408;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --radius: 16px;
  --font: "Inter", system-ui, sans-serif;
  --display: "Outfit", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --content: 1080px;
  --sidebar: 228px;
  --ease: 180ms ease;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; font-size: 18px; }
html.text-large { font-size: 20.7px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  padding-top: 62px;
}

img { max-width: 100%; height: auto; }

button, [role="button"] { cursor: pointer; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

a { color: var(--accent); text-underline-offset: 3px; }

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

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 80;
}

.skip:focus { top: 12px; }

.wrap {
  width: min(100% - 32px, var(--content));
  margin-inline: auto;
}

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.06);
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.top {
  position: fixed;
  top: 3px;
  left: 0;
  right: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: rgba(11, 11, 15, 0.94);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
}

.top-tools { display: flex; align-items: center; gap: 8px; }

.size-btn, .links-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--card);
}

.size-btn[aria-pressed="true"],
.links-btn[aria-expanded="true"],
.links-btn:hover,
.size-btn:hover { border-color: var(--accent); color: var(--accent); }

.links-btn { display: inline-flex; align-items: center; gap: 8px; }

.links-btn svg { width: 12px; height: 12px; }

.link-menu { position: relative; }

.links-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px;
  z-index: 36;
}

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

.links-panel a {
  display: block;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
}

.links-panel a:hover, .links-panel a:focus-visible { background: rgba(232, 184, 109, 0.12); }

.links-panel small { display: block; color: var(--muted); font-size: 0.85rem; }

.hero { padding: 56px 0 12px; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.03em; }

h1 {
  margin: 14px 0 16px;
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 600;
  line-height: 0.98;
  max-width: 12ch;
}

.lede {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  transition: background var(--ease), border-color var(--ease), filter var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { color: var(--text); }

.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }

.hint {
  margin: 14px 0 0;
  max-width: 36rem;
  color: var(--faint);
  font-size: 1rem;
}

.info {
  margin: 36px 0 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.info summary {
  min-height: 56px;
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info summary::-webkit-details-marker { display: none; }

.info summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-right: 4px;
}

.info[open] summary::after { transform: rotate(225deg); margin-top: 6px; }

.info p {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted);
}

.phases {
  display: grid;
  gap: 12px;
  margin: 28px 0 48px;
}

.phase {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 112px;
  transition: border-color var(--ease), background var(--ease);
}

.phase:hover { border-color: var(--line-strong); background: #191920; }

.phase span {
  display: block;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.phase strong {
  display: block;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.layout { display: block; }

.sidebar { display: none; }

.side-label {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-link, .sheet-link {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 1rem;
  min-height: 44px;
  border-left: 2px solid transparent;
}

.side-link small, .sheet-link small {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  width: 1.6rem;
}

.side-link.is-active, .sheet-link.is-active {
  color: var(--text);
  background: rgba(232, 184, 109, 0.12);
  border-left-color: var(--accent);
}

.side-group { margin-bottom: 18px; }

.steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.steps::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: var(--line-strong);
}

.step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  scroll-margin-top: 84px;
}

.dot {
  width: 32px;
  height: 32px;
  margin-top: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.step.is-active .dot,
.step.is-done .dot {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent);
}

.step.is-active .card { border-color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  min-width: 0;
  transition: border-color var(--ease);
}

.card:hover { border-color: var(--line-strong); }

.card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.check {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: transparent;
}

.check[aria-pressed="true"] {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.check svg { width: 18px; height: 18px; }

.num {
  display: block;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.card h3 {
  margin: 2px 0 0;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
}

.step-meta { margin: 0; color: var(--muted); font-size: 0.95rem; }

.brief {
  margin: 14px 0 0;
  max-width: 36rem;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(232, 184, 109, 0.1);
  border: 1px solid rgba(232, 184, 109, 0.35);
  color: var(--text);
}

.brief span {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.card > p, .card li, .prose { color: var(--muted); max-width: 36rem; }
.card > p.brief, .card li { color: var(--text); }
.card > p.fine { color: var(--faint); }
#links-list { list-style: none; margin: 0; padding: 0; }

.card ul { margin: 12px 0 0; padding-left: 1.1rem; color: var(--text); }

.card li + li { margin-top: 6px; }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  white-space: nowrap;
}

.out {
  display: inline-flex;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.tip {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(232, 184, 109, 0.35);
  background: rgba(232, 184, 109, 0.08);
  color: var(--text);
}

.shots {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.shot {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e0e13;
  text-align: left;
}

.shot img { display: block; width: 100%; height: auto; }

.zoom-hint {
  display: block;
  padding: 10px 12px 12px;
  color: var(--text);
  font-size: 0.95rem;
}

.step-pager { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.term {
  display: inline-block;
  font: inherit;
  color: inherit;
  min-height: 44px;
  padding: 8px 4px;
  border-bottom: 1px dotted var(--accent);
  vertical-align: middle;
}

.term-wrap { position: relative; display: inline; }

.term-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: min(280px, 70vw);
  z-index: 25;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
}

.term-pop p { margin: 0 0 8px; color: var(--text); max-width: none; }

.term-pop a { font-size: 0.95rem; }

.shot:hover { border-color: var(--line-strong); }

.fine {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 1rem;
  max-width: 36rem;
}

.phase-break {
  margin: 18px 0 6px 46px;
  padding-top: 12px;
}

.phase-break h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.05;
}

.phase-break p { margin: 0; color: var(--muted); }

.glossary, .close-note { margin-top: 64px; }

.glossary h2, .close-note h2 {
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 18px;
}

.terms {
  display: grid;
  gap: 10px;
  margin: 0;
}

.terms div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.terms dt { font-weight: 600; }

.terms dd { margin: 6px 0 0; color: var(--muted); }

.close-note p { color: var(--muted); max-width: 36rem; }

.footer {
  margin-top: 48px;
  padding: 28px 0 96px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}

.footer p { margin: 0 0 8px; max-width: 50rem; }

.fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.sheet[hidden], .lightbox[hidden] { display: none; }

.sheet, .lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 680px);
  overflow: auto;
  background: #121218;
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 8px 12px 28px;
}

.grab {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 8px auto 12px;
}

.sheet-panel h2 {
  margin: 0 12px 8px;
  font-size: 18px;
}

.lb-panel {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px;
}

.lb-bar, .lb-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(11, 11, 15, 0.8);
  color: var(--text);
}

.lb-figure {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 0;
}

.lb-figure img {
  max-width: min(1100px, 100%);
  max-height: calc(100vh - 150px);
  width: auto;
  height: auto;
  border-radius: 12px;
  touch-action: pan-y;
}

.lb-caption {
  margin: 0;
  text-align: center;
  color: var(--text);
  font-size: 0.95rem;
}

.lb-dots button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  position: relative;
}

.lb-dots button::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: block;
  margin: auto;
}

.lb-dots button[aria-current="true"]::after { background: var(--accent); }

@media (min-width: 768px) {
  .wrap { width: min(100% - 48px, var(--content)); }
  .phases { grid-template-columns: 1fr 1fr; }
  .card { padding: 26px 26px 18px; }
  .hero { padding-top: 72px; }
}

@media (min-width: 1100px) {
  .progress, .fab { display: none; }
  .layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }
  .sidebar {
    display: block;
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 92px);
    overflow: auto;
  }
  .footer { padding-bottom: 48px; }
}

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