:root {
  color-scheme: dark;
  --bg: #0d0d0e;
  --surface: #151516;
  --surface-2: #1c1b19;
  --surface-3: #23211d;
  --line: #34312b;
  --line-strong: #51472f;
  --gold: #d4af58;
  --gold-soft: #ead08d;
  --ink: #f1eee7;
  --muted: #aaa49a;
  --green: #83c995;
  --blue: #83b7d8;
  --red: #e08a83;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(0,0,0,.32);
  --content: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(212,175,88,.12), transparent 34rem),
    radial-gradient(circle at 100% 20%, rgba(78,108,126,.10), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.62;
  max-width: 100%;
  overflow-x: hidden;
}

a { color: var(--gold-soft); }
a:hover { color: #fff0bd; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 99;
  background: #fff;
  color: #111;
  padding: 10px 14px;
  border-radius: 8px;
}
.skip-link:focus { left: 8px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(212,175,88,.16);
  background: rgba(13,13,14,.88);
  backdrop-filter: blur(14px);
}
.topbar__inner {
  width: min(calc(100% - 32px), var(--content));
  min-height: 66px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: .01em;
}
.brand__mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, #2d271a, #15140f);
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 20px;
  box-shadow: inset 0 0 0 3px rgba(212,175,88,.05);
}
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .92rem;
}
.topnav a:hover, .topnav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,.035);
}

.layout {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 42px;
  padding: 38px 0 80px;
}
.sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
}
.sidebar__label {
  margin: 0 0 11px;
  color: var(--gold);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.side-nav { display: grid; gap: 4px; }
.side-nav a, .side-nav span {
  display: block;
  border-left: 2px solid var(--line);
  padding: 8px 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
}
.side-nav a:hover { color: var(--ink); border-left-color: var(--gold); }
.side-nav a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(212,175,88,.10), transparent);
}
.side-nav span { opacity: .48; }
.side-nav small { display: block; margin-top: 2px; font-size: .72rem; }
.sidebar__note {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: .8rem;
}

.content { min-width: 0; max-width: 100%; }
.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 20px;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(28px, 5vw, 58px);
  background:
    linear-gradient(130deg, rgba(212,175,88,.11), transparent 48%),
    linear-gradient(320deg, rgba(76,111,128,.09), transparent 50%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "✦";
  position: absolute;
  right: clamp(20px, 6vw, 70px);
  top: 14px;
  color: rgba(212,175,88,.12);
  font-family: Georgia, serif;
  font-size: clamp(90px, 15vw, 180px);
  line-height: 1;
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.16; }
h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 6vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -.035em;
}
.hero__lead {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 20px 0 0;
  color: #c7c2b8;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}
.hero__meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.tag {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(0,0,0,.18);
  color: var(--gold-soft);
  font-size: .78rem;
}

.section { scroll-margin-top: 90px; margin-top: 58px; }
.section__head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  margin-bottom: 18px;
}
.section__number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  font-family: Georgia, serif;
}
h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 600; }
h3 { margin: 0 0 8px; font-size: 1.02rem; }
.section > p, .section__intro { color: #bbb6ad; }

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 16px;
  background: rgba(212,175,88,.055);
}
.callout__icon { color: var(--gold); font-size: 1.2rem; }
.callout p { margin: 0; color: #c9c3b7; }
.callout > * { min-width: 0; }

.flow {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}
.flow::before {
  content: "";
  position: absolute;
  left: 8%; right: 8%; top: 27px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.flow__step {
  position: relative;
  z-index: 1;
  text-align: center;
}
.flow__dot {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin: 0 auto 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--gold-soft);
  font-weight: 800;
  box-shadow: 0 0 0 7px var(--bg);
}
.flow__step b { display: block; font-size: .86rem; }
.flow__step small { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.35; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.025), transparent), var(--surface);
}
.info-card--wide { grid-column: 1 / -1; }
.info-card__kicker { color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.info-card p { margin: 7px 0 0; color: var(--muted); }
.info-card ul { margin: 11px 0 0; padding-left: 20px; color: #c4beb4; }
.info-card li + li { margin-top: 5px; }

.steps { display: grid; gap: 13px; counter-reset: tutorial-step; }
.step {
  counter-increment: tutorial-step;
  display: grid;
  grid-template-columns: 54px minmax(0,1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
}
.step::before {
  content: counter(tutorial-step, decimal-leading-zero);
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .83rem;
  font-weight: 800;
}
.step p { margin: 6px 0 0; color: var(--muted); }
.step__hint { margin-top: 9px; color: var(--blue); font-size: .83rem; }

.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.mode {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface-2);
}
.mode__icon { font-size: 1.45rem; }
.mode p { color: var(--muted); }
.mode strong { color: var(--gold-soft); }

.do-dont { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.rule-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; background: var(--surface); }
.rule-box--yes { border-top: 3px solid var(--green); }
.rule-box--no { border-top: 3px solid var(--red); }
.rule-box ul { padding-left: 20px; color: #c3bdb3; }

.pipeline { display: grid; gap: 8px; }
.pipeline__row {
  display: grid;
  grid-template-columns: 34px 170px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}
.pipeline__icon { color: var(--green); }
.pipeline__code { color: var(--gold-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; }
.pipeline__desc { color: var(--muted); font-size: .88rem; }
.pipeline__status { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }

details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
details + details { margin-top: 8px; }
summary { cursor: pointer; padding: 15px 17px; font-weight: 720; }
details p { margin: 0; padding: 0 17px 17px; color: var(--muted); }

.next-modules { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.module {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
}
.module b { display: block; color: #d0cbc1; margin-bottom: 5px; }
.module--active { border-style: solid; background: rgba(212,175,88,.05); }
.module--active b { color: var(--gold-soft); }

.footer {
  border-top: 1px solid var(--line);
  margin-top: 72px;
  padding: 24px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 18px; padding-top: 20px; }
  .sidebar { position: static; }
  .side-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .side-nav a, .side-nav span { border-left: 0; border-bottom: 2px solid var(--line); }
  .sidebar__note { display: none; }
  .flow { grid-template-columns: 1fr; gap: 8px; }
  .flow::before { left: 27px; right: auto; top: 20px; bottom: 20px; width: 1px; height: auto; }
  .flow__step { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; text-align: left; column-gap: 12px; row-gap: 1px; }
  .flow__dot { grid-row: 1 / 3; margin: 0; box-shadow: 0 0 0 5px var(--bg); }
  .flow__step b { grid-column: 2; align-self: end; }
  .flow__step small { grid-column: 2; align-self: start; }
}

@media (max-width: 650px) {
  .topbar__inner { width: min(calc(100% - 22px), var(--content)); }
  .topnav { display: none; }
  .layout { width: min(calc(100% - 22px), var(--content)); }
  .hero { padding: 27px 20px; border-radius: 16px; }
  .hero::after { opacity: .6; }
  h1 { font-size: clamp(2rem, 11vw, 3rem); overflow-wrap: anywhere; }
  h2 { overflow-wrap: anywhere; }
  .hero__meta { align-items: flex-start; }
  .tag { max-width: 100%; }
  .cards, .mode-grid, .do-dont, .next-modules { grid-template-columns: 1fr; }
  .callout { grid-template-columns: 22px minmax(0, 1fr); gap: 9px; }
  .callout p, .step p, .info-card p, .mode p, .module { overflow-wrap: anywhere; }
  .pipeline__row { grid-template-columns: 28px 1fr; }
  .pipeline__desc, .pipeline__status { grid-column: 2; }
  .step { grid-template-columns: 42px 1fr; padding: 15px; gap: 12px; }
  .step::before { width: 40px; height: 40px; }
  .side-nav { grid-template-columns: 1fr; }
}

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