* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --foreground-color: #111;
  --muted-color: #5c5a55;
  --background-color: #f0eee9;
  --paper-color: #f7f6f2;
  --brand-color: #FEC934;
  --rule: 0.5px solid var(--foreground-color);
  --font-sans: "Zalando Sans", sans-serif;
  --font-mono: "Geist Mono", monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);       /* entering and leaving */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);   /* lines drawing, things moving on screen */

  /* Spacing scale */
  --gutter: 24px;
  --inset: 20px;        /* inner padding of yellow surfaces, hangs into the gutter */
  --section-gap: 168px; /* space between chapters */
}

@media (max-width: 640px) {
  :root {
    --gutter: 20px;
    --inset: 16px;
    --section-gap: 112px;
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background-color);
  color: var(--foreground-color);
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 1px solid var(--foreground-color);
  outline-offset: 3px;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.container {
  max-width: 44rem;
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
  border-left: var(--rule);
  border-right: var(--rule);
}

/* ---------- Hero ---------- */

.hero {
  padding-bottom: 72px;
}

.box {
  background-color: var(--brand-color);
  padding: 4px var(--inset);
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

.row:not(:last-child) {
  border-bottom: var(--rule);
}

.row dd {
  text-align: right;
}

h1,
h2 {
  font-weight: 500;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(36px, 6.4vw, 56px);
  line-height: 1.06;
  margin: 120px 0 32px;
}

.lede {
  font-size: clamp(19px, 2.4vw, 22px);
  line-height: 1.5;
  max-width: 34rem;
  text-wrap: pretty;
}

.curve {
  margin-top: 72px;
}

.curve svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.curve-line {
  fill: none;
  stroke: var(--foreground-color);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.8s var(--ease-in-out) 0.3s forwards;
}

.curve circle {
  fill: var(--brand-color);
  stroke: var(--foreground-color);
  stroke-width: 1;
}

.curve text {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--foreground-color);
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- Nav ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 calc(-1 * var(--gutter));
  background-color: var(--background-color);
  border-top: var(--rule);
  border-bottom: var(--rule);
}

.nav {
  display: flex;
  overflow-x: auto;
  padding: 0 calc(var(--gutter) - 10px);
  scrollbar-width: none;
}

/* Scroll progress: the hero's geodesic, one pin per chapter. */
.track {
  padding: 0 var(--gutter) 8px;
}

.track svg {
  display: block;
  width: 100%;
  height: 22px;
  overflow: visible;
}

.track .base {
  fill: none;
  stroke: var(--foreground-color);
  stroke-opacity: 0.2;
  stroke-width: 1;
}

.track .done {
  fill: none;
  stroke: var(--foreground-color);
  stroke-width: 1;
}

.track .pin {
  fill: var(--background-color);
  stroke: var(--foreground-color);
  stroke-width: 0.75;
}

.track .pin.is-passed {
  fill: var(--foreground-color);
}

.track .dot {
  fill: var(--brand-color);
  stroke: var(--foreground-color);
  stroke-width: 1;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  padding: 16px 10px;
  white-space: nowrap;
}

.nav a {
  color: var(--muted-color);
  transition: color 150ms ease;
}

.nav a[aria-current="true"] {
  color: var(--foreground-color);
}

@media (hover: hover) and (pointer: fine) {
  .nav a:hover {
    color: var(--foreground-color);
  }
}

a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 0.5px;
}

.facts {
  margin-top: 40px;
}

.after-file {
  margin-top: 48px;
}

.after-file + .file {
  margin-top: 32px;
}

.guarantee {
  margin-top: 24px;
}

/* ---------- Chapters ---------- */

main section {
  padding-top: var(--section-gap);
  scroll-margin-top: 0;
}

main section:first-child {
  padding-top: 112px;
}

.chapter {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.chapter span {
  display: inline-block;
  background-color: var(--brand-color);
  padding: 4px 8px;
  line-height: 1;
}

/* ---------- Chapter figures ---------- */

.fig {
  margin: 8px 0 48px;
  min-height: 150px;
}

.fig svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.fig path,
.fig ellipse {
  stroke: var(--foreground-color);
  stroke-width: 0.75;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.fig .t  { fill: #fbfaf6; }
.fig .l  { fill: #e3dfd6; }
.fig .r  { fill: #cbc6bb; }
.fig .a  { fill: var(--brand-color); }
.fig .al { fill: #efb820; }
.fig .ar { fill: #d8a312; }
.fig .ink { fill: none; }
.fig .ink-soft { fill: none; stroke-opacity: 0.35; }
.fig .thread { fill: none; stroke-width: 1.5; }

h2 {
  font-size: clamp(28px, 4.4vw, 38px);
  line-height: 1.12;
  margin-bottom: 36px;
  max-width: 36rem;
}

.prose p {
  text-wrap: pretty;
}

.prose p + p {
  margin-top: 1.1em;
}

h3 {
  font-weight: 500;
}

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 72px 0 20px;
}

.note {
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted-color);
  margin-top: 16px;
}

/* ---------- Lists ---------- */

.lines {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.45;
}

.lines li {
  padding: 13px 0;
  border-top: var(--rule);
}

.lines li:first-child {
  border-top: 0;
}

/* ---------- Folds ----------
   Padding and borders are identical open and closed;
   opening only changes the background, so nothing moves. */

.fold {
  margin: 56px calc(-1 * var(--inset)) 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
}

.fold + .fold {
  margin-top: 0;
  border-top: 0;
}

.fold[open] {
  background-color: var(--brand-color);
}

.fold summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px var(--inset);
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
}

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

.fold > .lines {
  margin: 0 var(--inset);
  border-top: var(--rule);
  padding-bottom: 8px;
}

.fold > .note {
  margin: 0 var(--inset);
  padding: 4px 0 20px;
  color: var(--foreground-color);
}

.mark::after {
  content: "+";
}

.fold[open] .mark::after {
  content: "–";
}

/* ---------- design.md file ---------- */

.file {
  margin: 56px calc(-1 * var(--inset)) 0;
  background-color: var(--paper-color);
  border: var(--rule);
}

.file figcaption {
  display: flex;
  justify-content: space-between;
  padding: 12px var(--inset);
  background-color: var(--brand-color);
  border-bottom: var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
}

.file figcaption span + span {
  color: var(--muted-color);
}

.file ol {
  list-style: none;
  padding: 12px var(--inset) 16px;
}

.file li {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 4px 24px;
  padding: 12px 0;
  font-size: 15px;
  line-height: 1.5;
}

.file li + li {
  border-top: 0.5px dashed rgba(17, 17, 17, 0.35);
}

.file li code {
  font-size: 13px;
  line-height: 1.7;
}

.file li span {
  color: var(--muted-color);
}

@media (max-width: 640px) {
  .file li {
    grid-template-columns: 1fr;
  }
}

/* ---------- Process steps ---------- */

.steps {
  list-style: none;
  margin-top: 56px;
  border-top: var(--rule);
}

.steps li {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  padding: 24px 0;
  border-bottom: var(--rule);
}

.steps .num {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.9;
}

.steps h3 {
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.steps p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted-color);
}

.steps + .fold {
  margin-top: 40px;
}

/* ---------- Price ---------- */

.price {
  margin: 0 calc(-1 * var(--inset));
  padding: 36px var(--inset) 12px;
  background-color: var(--brand-color);
}

.sum {
  font-family: var(--font-mono);
  font-size: clamp(40px, 7vw, 60px);
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 32px;
}

.price .lines {
  border-top: var(--rule);
}

/* ---------- Epilogue & footer ---------- */

.epilogue {
  margin-top: var(--section-gap);
  padding-top: 64px !important;
  border-top: var(--rule);
}

.epilogue h2 {
  margin-bottom: 24px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 120px;
  padding-top: 16px;
  border-top: var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
}

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

  .curve-line {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* ---------- Intro ----------
   Yellow screen: an old mark gives way to a new one, the cover draws,
   "Proposal" writes itself, then the screen fades out and the hero rises in.
   Once per session. Reduced motion gets the finished cover, still, then a fade. */

.intro {
  display: none;
}

html.intro-on body {
  overflow: hidden;
}

html.intro-on .intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--brand-color);
  cursor: pointer;
  animation: intro-exit 0.5s var(--ease-out) 4.5s forwards;
}

.intro svg {
  width: min(80vmin, 440px);
  height: auto;
  overflow: visible;
}

.intro .ln {
  fill: none;
  stroke: var(--foreground-color);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.intro .old      { animation: ln-in 0.6s var(--ease-in-out) forwards, ln-out 0.4s var(--ease-in-out) 0.75s forwards; }
.intro .sphere   { animation: ln-in 0.7s var(--ease-in-out) 0.95s forwards, thicken 0.55s var(--ease-in-out) 2.25s forwards; }
.intro .equator  { animation: ln-in 0.55s var(--ease-in-out) 1.3s forwards, thicken 0.55s var(--ease-in-out) 2.25s forwards; }
.intro .geodesic { animation: ln-in 0.65s var(--ease-in-out) 1.5s forwards, thicken 0.55s var(--ease-in-out) 2.25s forwards; }
.intro .frame    { animation: ln-in 0.7s var(--ease-in-out) 2.4s forwards; }

.intro .mark {
  transform-box: view-box;
  transform-origin: 200px 200px;
  animation: mark-up 0.55s var(--ease-in-out) 2.25s forwards;
}

.intro .write {
  font-family: var(--font-sans);
  font-size: 68px;
  font-weight: 500;
  letter-spacing: -0.03em;
  fill: transparent;
  stroke: var(--foreground-color);
  stroke-width: 0.9;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: write 1.25s var(--ease-in-out) 2.65s forwards, fill-in 0.4s var(--ease-out) 3.65s forwards;
}

.intro .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--foreground-color);
  opacity: 0;
  animation: fade-in 0.4s var(--ease-out) 3.8s forwards;
}

/* Reduced motion: the finished cover, no drawing, then a short fade. */
html.intro-still .intro {
  animation: intro-exit 0.4s var(--ease-out) 1.6s forwards;
}

html.intro-still .intro .ln,
html.intro-still .intro .write,
html.intro-still .intro .meta,
html.intro-still .intro .mark {
  animation: none;
}

html.intro-still .intro .sphere,
html.intro-still .intro .equator,
html.intro-still .intro .geodesic,
html.intro-still .intro .frame,
html.intro-still .intro .write {
  stroke-dashoffset: 0;
}

html.intro-still .intro .mark { transform: translateY(-64px) scale(0.5); }
html.intro-still .intro .mark .ln { stroke-width: 2.5; }
html.intro-still .intro .write { fill: var(--foreground-color); }
html.intro-still .intro .meta { opacity: 1; }

/* Skip on click, key or scroll. Comes last so it wins over both variants above. */
html.intro-skip .intro {
  animation: intro-exit 0.25s var(--ease-out) forwards;
}

/* Hero rises in as the yellow fades. Transitions, so a skip mid-way just retargets. */
html.intro-ran .hero > * {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

html.intro-ran.hero-in .hero > * {
  opacity: 1;
  transform: none;
}

html.intro-ran .hero > :nth-child(2) { transition-delay: 60ms; }
html.intro-ran .hero > :nth-child(3) { transition-delay: 120ms; }
html.intro-ran .hero > :nth-child(4) { transition-delay: 180ms; }

html.intro-ran:not(.hero-in) .curve-line {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  html.intro-ran .hero > * {
    transform: none;
  }
}

@keyframes ln-in    { to { stroke-dashoffset: 0; } }
@keyframes ln-out   { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1; } }
@keyframes write    { to { stroke-dashoffset: 0; } }
@keyframes fill-in  { to { fill: var(--foreground-color); } }
@keyframes fade-in  { to { opacity: 1; } }
@keyframes thicken  { to { stroke-width: 2.5; } } /* keeps the emblem's lines as heavy as the frame once it is scaled to half */
@keyframes mark-up  { to { transform: translateY(-64px) scale(0.5); } }
@keyframes intro-exit { to { opacity: 0; visibility: hidden; } }
