:root {
  --paper: #f1eee5;
  --ink: #141312;
  --muted: #6e685b;
  --line: rgba(20, 19, 18, 0.18);
  --line-soft: rgba(20, 19, 18, 0.1);
  --accent: #ef4518;
  --accent-deep: #b8370f;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1180px;
  --gutter: clamp(20px, 4.5vw, 56px);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--paper); }

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

a { color: inherit; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 5px;
  background: rgba(20, 19, 18, 0.06);
}

.nowrap { white-space: nowrap; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
}

/* Header */

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 22px;
  border-bottom: 1px solid var(--line);
}

.mark {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.top__right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lang {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang__btn {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang__btn[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent-deep);
}

.lang__btn:hover { color: var(--accent-deep); }

.lang__sep {
  color: var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

/* Hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 330px);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(54px, 9vw, 108px) var(--gutter) clamp(64px, 10vw, 118px);
}

.kicker { margin: 0 0 26px; }

.hero__title {
  margin: 0 0 30px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(54px, 8.7vw, 116px);
  line-height: 0.9;
  letter-spacing: -0.035em;
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.07em;
}

.line > span { display: block; }

.hero__lead {
  max-width: 47ch;
  margin: 0 0 34px;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.58;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
}

.btn {
  display: inline-block;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.btn:hover { color: var(--accent-deep); border-color: var(--accent-deep); }

.btn--quiet { color: var(--muted); border-color: var(--line); }

.btn--solid {
  padding: 12px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.btn--solid:hover {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: var(--paper);
}

.hero__wheel {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 320px;
}

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

.wheel__ring {
  fill: none;
  stroke: rgba(20, 19, 18, 0.42);
  stroke-width: 1;
}

.wheel__ring--inner {
  stroke-dasharray: 2 7;
  opacity: 0.55;
}

.wheel__spokes path {
  stroke: rgba(20, 19, 18, 0.2);
  stroke-width: 1;
}

.wheel__hub { fill: var(--ink); }
.wheel__orbit circle { fill: var(--accent); }

.rot {
  position: absolute;
  left: 0;
  bottom: -4px;
  margin: 0;
  color: var(--muted);
}

/* Sections */

.section {
  position: relative;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: clamp(22px, 4vw, 60px);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 82px) var(--gutter);
}

.hair {
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  height: 1px;
  background: var(--line);
  transform-origin: left center;
}

.section__head { position: relative; }

.num {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-deep);
}

.section h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 3.5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.022em;
}

.section__body {
  max-width: 720px;
  padding-top: 4px;
}

/* Download */

.download {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 16px;
  margin: 0 0 8px;
  padding: 18px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.download__tag {
  grid-column: 1;
  grid-row: 1 / span 2;
  color: var(--accent-deep);
}

.download__title {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--serif);
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.download__meta {
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
}

.download__arrow {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--accent-deep);
  font-size: 18px;
  line-height: 1;
}

.download:hover .download__title { color: var(--accent-deep); }

.rules {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 20px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line-soft);
}

.rules li:first-child { padding-top: 0; }
.rules li:last-child { border-bottom: 0; padding-bottom: 0; }

.rule__k {
  padding-top: 6px;
  color: var(--accent-deep);
}

.rules h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rules p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
}

/* How */

.how {
  max-width: 26ch;
  margin: 0 0 30px;
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.26;
  letter-spacing: -0.017em;
}

.how code { font-size: 0.78em; }

.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.flow .arrow { color: var(--accent); }

.how__note {
  max-width: 62ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* Steps and code */

.step {
  margin: 28px 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.section__body > p:first-child { margin-top: 0; }

.code {
  position: relative;
  background: var(--ink);
  color: #f4f0e6;
  padding: 18px 20px;
  overflow-x: auto;
}

.code pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
}

.code code {
  padding: 0;
  background: none;
  font-size: inherit;
  color: inherit;
}

.copy {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: rgba(244, 240, 230, 0.42);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease;
}

.copy:hover { color: var(--accent); }

.fine {
  max-width: 60ch;
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.fine a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.fine a:hover { color: var(--accent-deep); border-color: var(--accent-deep); }

/* Footer */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px var(--gutter) 36px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.foot a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.foot a:hover { color: var(--accent-deep); border-color: var(--accent-deep); }

/* Responsive */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    align-items: start;
  }

  .hero__wheel {
    justify-self: start;
    max-width: 190px;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .section__head {
    display: flex;
    align-items: baseline;
    gap: 16px;
  }

  .num { margin: 0; }
}

@media (max-width: 620px) {
  .top { flex-wrap: wrap; row-gap: 8px; }
  .top__right { gap: 14px; }
  .hero__title { font-size: clamp(46px, 14vw, 68px); }
  .rules li { grid-template-columns: 1fr; gap: 5px; }
  .rule__k { padding-top: 0; }
  .foot { flex-direction: column; gap: 8px; }
  .flow .arrow { display: none; }
  .flow { gap: 6px 14px; }
  .code { padding: 34px 16px 16px; }
  .code pre { white-space: pre-wrap; overflow-wrap: normal; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
