:root {
  --paper: #f4f7ff;
  --sheet: #fffdf7;
  --ink: #111830;
  --muted: #58627b;
  --cobalt: #1747e8;
  --blue-light: #c9d8ff;
  --orange: #ff5b35;
  --yellow: #ffdf42;
  --rule: #aeb9d2;
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --utility: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(23, 71, 232, 0.045) 50%, transparent calc(50% + 1px)),
    var(--paper);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: var(--cobalt);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--cobalt);
}

button,
select {
  font: inherit;
}

button,
a,
select,
[tabindex="0"] {
  outline-offset: 4px;
}

:focus-visible {
  outline: 3px solid var(--orange);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  transform: translateY(-180%);
}

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

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
  font-family: var(--utility);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.home-link {
  font-weight: 700;
  text-decoration: none;
}

.language-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.language-nav span[aria-current="page"] {
  padding: 6px 9px;
  color: white;
  background: var(--cobalt);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 28px;
  width: min(1240px, calc(100% - 48px));
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: clamp(68px, 9vw, 128px) 0 72px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 44px;
  right: 38.5%;
  width: 1px;
  height: calc(100% - 88px);
  background: var(--rule);
}

.hero-copy {
  position: relative;
  z-index: 2;
  grid-column: 1 / 8;
  align-self: center;
  max-width: 800px;
}

.eyebrow,
.section-mark {
  margin: 0 0 22px;
  color: var(--cobalt);
  font-family: var(--utility);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.94;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(4.2rem, 7.1vw, 7.2rem);
}

h2 {
  max-width: 950px;
  margin: 0;
  font-size: clamp(2.7rem, 5.2vw, 5.2rem);
}

.deck {
  max-width: 670px;
  margin: 32px 0 0;
  font-size: clamp(1.13rem, 1.6vw, 1.42rem);
  line-height: 1.46;
}

.trust-line {
  max-width: 650px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.fold-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin: 20px 0 0;
  color: var(--cobalt);
  font-family: var(--utility);
  font-size: 0.75rem;
  font-weight: 700;
}

.fold-sequence span,
.fold-sequence strong {
  color: white;
  background: var(--cobalt);
  padding: 3px 6px;
}

.fold-sequence small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.jump-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  margin-top: 28px;
  color: white;
  background: var(--ink);
  padding: 8px 14px;
  font-family: var(--utility);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.jump-link:hover {
  color: white;
  background: var(--cobalt);
}

.hero-finding {
  position: relative;
  z-index: 3;
  grid-column: 1 / 5;
  align-self: end;
  max-width: 390px;
  padding: 18px 20px 20px;
  color: var(--ink);
  background: var(--yellow);
  border-top: 5px solid var(--ink);
}

.finding-number {
  display: block;
  font-family: var(--display);
  font-size: clamp(4rem, 7vw, 6.8rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.78;
}

.finding-unit {
  display: block;
  margin-top: 12px;
  font-family: var(--utility);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-finding p {
  margin: 14px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.hero-paper {
  position: absolute;
  z-index: 1;
  top: clamp(72px, 8vw, 116px);
  right: 2%;
  width: min(34vw, 410px);
  aspect-ratio: 841 / 1189;
  color: white;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(255, 255, 255, 0.75) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, rgba(255, 255, 255, 0.6) 50%, transparent 50.3%),
    repeating-linear-gradient(0deg, transparent 0 32px, rgba(255, 255, 255, 0.11) 32px 33px),
    var(--cobalt);
  box-shadow: 20px 24px 0 var(--blue-light), 30px 36px 0 rgba(17, 24, 48, 0.16);
  transform: rotate(4deg);
}

.hero-paper::before,
.hero-paper::after {
  content: "";
  position: absolute;
  background: var(--orange);
}

.hero-paper::before {
  top: 0;
  right: 25%;
  width: 1px;
  height: 100%;
}

.hero-paper::after {
  top: 75%;
  left: 0;
  width: 100%;
  height: 1px;
}

.hero-paper-label {
  position: absolute;
  top: 20px;
  left: 22px;
  font-family: var(--display);
  font-size: clamp(5rem, 9vw, 8.2rem);
  font-weight: 900;
  line-height: 1;
}

.hero-paper-a4 {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  width: 25%;
  height: 25%;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border: 1px solid var(--ink);
  font-family: var(--utility);
  font-size: 0.75rem;
  font-weight: 800;
}

.dimension {
  position: absolute;
  font-family: var(--utility);
  font-size: 0.66rem;
  font-weight: 700;
}

.dimension-wide {
  bottom: -27px;
  left: 50%;
  color: var(--ink);
  transform: translateX(-50%);
}

.dimension-tall {
  top: 50%;
  right: -54px;
  color: var(--ink);
  transform: rotate(90deg) translateX(50%);
}

.fold-lab,
.proof-section,
.rounding-section,
.mass-section,
.scope-section,
.method-section {
  padding: clamp(80px, 11vw, 156px) max(24px, calc((100vw - 1240px) / 2));
}

.fold-lab {
  color: white;
  background: var(--cobalt);
}

.section-intro {
  max-width: 960px;
}

.section-intro > p:not(.section-mark) {
  max-width: 700px;
  margin: 28px 0 0;
  font-size: clamp(1.04rem, 1.4vw, 1.25rem);
}

.fold-lab .section-mark {
  color: var(--yellow);
}

.fold-machine {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) 1.1fr;
  gap: clamp(42px, 7vw, 108px);
  align-items: center;
  margin-top: clamp(54px, 8vw, 100px);
}

.paper-viewport {
  position: relative;
  display: grid;
  min-height: 620px;
  place-items: center;
  perspective: 1200px;
}

.paper-viewport::before {
  content: "";
  position: absolute;
  inset: 5% 10%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: repeating-linear-gradient(90deg, transparent 0 49px, rgba(255, 255, 255, 0.075) 49px 50px);
}

.paper-sheet {
  position: relative;
  z-index: 2;
  width: min(68vw, 365px);
  aspect-ratio: 210 / 297;
  transform-style: preserve-3d;
}

.paper-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(23, 71, 232, 0.25) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent calc(50% - 0.5px), rgba(23, 71, 232, 0.18) 50%, transparent calc(50% + 0.5px)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(23, 71, 232, 0.05) 27px 28px),
    var(--sheet);
  border: 1px solid rgba(17, 24, 48, 0.6);
  box-shadow: 14px 18px 0 rgba(8, 24, 94, 0.35);
}

.paper-face::before,
.paper-face::after {
  content: "";
  position: absolute;
  z-index: 4;
  width: 20px;
  height: 20px;
  border-color: var(--orange);
  border-style: solid;
}

.paper-face::before {
  top: 14px;
  left: 14px;
  border-width: 2px 0 0 2px;
}

.paper-face::after {
  right: 14px;
  bottom: 14px;
  border-width: 0 2px 2px 0;
}

.paper-code {
  position: absolute;
  top: 12%;
  left: 10%;
  font-family: var(--display);
  font-size: clamp(6rem, 12vw, 9.5rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
}

.paper-fraction {
  position: absolute;
  right: 10%;
  bottom: 10%;
  padding: 6px 8px;
  color: white;
  background: var(--ink);
  font-family: var(--utility);
  font-size: 0.72rem;
}

.paper-measure {
  position: absolute;
  z-index: 5;
  color: var(--cobalt);
  font-family: var(--utility);
  font-size: 0.7rem;
  font-weight: 800;
}

.paper-width {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.paper-height {
  top: 50%;
  right: -2px;
  transform: rotate(90deg) translateX(50%);
  transform-origin: right center;
}

.registration {
  position: absolute;
  z-index: 6;
  width: 9px;
  height: 9px;
  border: 1px solid var(--cobalt);
  border-radius: 50%;
}

.registration-one {
  top: 19px;
  left: 50%;
}

.registration-two {
  bottom: 19px;
  left: 19px;
}

.fold-flap {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, rgba(201, 216, 255, 0.95), rgba(255, 253, 247, 0.98));
  border-left: 1px solid rgba(23, 71, 232, 0.3);
  transform-origin: left center;
  backface-visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.paper-sheet.is-folding .fold-flap {
  opacity: 1;
  animation: fold-sheet 620ms cubic-bezier(0.3, 0.7, 0.2, 1) both;
}

@keyframes fold-sheet {
  0% { transform: rotateY(0deg); }
  55% { transform: rotateY(-86deg); }
  100% { transform: rotateY(-180deg); }
}

.fold-rail {
  position: absolute;
  z-index: 4;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fold-rail button {
  width: 48px;
  min-height: 44px;
  color: white;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.42);
  cursor: pointer;
  font-family: var(--utility);
  font-size: 0.72rem;
}

.fold-rail button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--yellow);
  font-weight: 900;
}

.machine-console {
  align-self: stretch;
  padding: 32px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
}

.fold-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 34px;
}

.action-button {
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid white;
  cursor: pointer;
  font-family: var(--utility);
  font-size: 0.78rem;
  font-weight: 800;
}

.action-button.primary {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--yellow);
}

.action-button.secondary {
  color: white;
  background: transparent;
}

.action-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.readout div {
  min-height: 100px;
  padding: 18px 18px 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.readout div:nth-child(odd) {
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.readout div:nth-child(even) {
  padding-left: 18px;
}

.readout dt {
  color: var(--blue-light);
  font-family: var(--utility);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.readout dd {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 800;
  line-height: 1.05;
}

.noscript-note {
  max-width: 680px;
  margin-top: 32px;
  padding: 14px;
  color: var(--ink);
  background: var(--yellow);
}

.proof-section {
  background: var(--sheet);
}

.proof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(42px, 8vw, 120px);
  align-items: center;
  margin-top: clamp(54px, 8vw, 96px);
}

.proof-diagram {
  position: relative;
  aspect-ratio: 1.414 / 1;
  color: white;
  background: var(--cobalt);
  border: 1px solid var(--ink);
  box-shadow: 15px 18px 0 var(--blue-light);
  font-family: var(--utility);
  font-size: 0.78rem;
  font-weight: 700;
}

.proof-cut {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: var(--yellow);
}

.proof-original,
.proof-half {
  position: absolute;
  padding: 7px 9px;
  color: var(--ink);
  background: var(--yellow);
}

.proof-original {
  top: 16px;
  left: 16px;
}

.proof-half {
  right: 16px;
  bottom: 16px;
  transform: rotate(-90deg);
}

.proof-copy {
  max-width: 620px;
}

.proof-copy p {
  margin: 0 0 24px;
}

.proof-copy .equation {
  padding: 24px 0;
  color: var(--cobalt);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--utility);
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  font-weight: 800;
}

.rounding-section {
  background: var(--paper);
}

.table-wrap {
  max-width: 100%;
  margin-top: 64px;
  overflow-x: auto;
  border-top: 4px solid var(--ink);
}

table {
  width: 100%;
  min-width: 770px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 17px 14px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 0;
  text-align: left;
}

thead th {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody th {
  color: var(--cobalt);
  font-family: var(--display);
  font-size: 1.5rem;
}

.highlight-row {
  background: var(--yellow);
}

.scale-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.8fr);
  gap: clamp(40px, 8vw, 120px);
  align-items: end;
  padding: clamp(80px, 10vw, 140px) max(24px, calc((100vw - 1240px) / 2));
  color: white;
  background: var(--ink);
  overflow: hidden;
}

.scale-number {
  margin-bottom: -0.12em;
  color: var(--yellow);
  font-family: var(--display);
  font-size: clamp(6rem, 16vw, 15rem);
  font-weight: 900;
  letter-spacing: -0.09em;
  line-height: 0.68;
  white-space: nowrap;
}

.scale-copy {
  position: relative;
  z-index: 2;
}

.scale-copy .section-mark {
  color: var(--orange);
}

.scale-copy h2 {
  font-size: clamp(2.6rem, 4.6vw, 4.7rem);
}

.scale-copy p:last-child {
  margin: 28px 0 0;
  color: #d5d9e5;
}

.mass-section {
  background: var(--sheet);
}

.mass-calculator {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(0, 1fr);
  gap: 24px 40px;
  align-items: end;
  margin-top: 54px;
  padding: 30px 0;
  border-top: 4px solid var(--cobalt);
  border-bottom: 1px solid var(--rule);
}

.mass-calculator label {
  align-self: center;
  font-family: var(--utility);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mass-calculator select {
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--ink);
  border-radius: 0;
}

.mass-result {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding-top: 30px;
}

.mass-result span {
  display: block;
}

.mass-result strong {
  display: block;
  color: var(--cobalt);
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.limit-note {
  max-width: 700px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.scope-section,
.method-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(50px, 10vw, 150px);
}

.scope-section {
  color: white;
  background: var(--cobalt);
}

.scope-section .section-mark {
  color: var(--yellow);
}

.scope-copy,
.method-copy {
  max-width: 700px;
}

.scope-copy p,
.method-copy p {
  margin: 0 0 26px;
}

.method-section {
  background: var(--paper);
}

.source-list {
  margin: 34px 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.source-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.access-date {
  color: var(--muted);
  font-family: var(--utility);
  font-size: 0.74rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 110px;
  padding: 24px max(24px, calc((100vw - 1240px) / 2));
  color: white;
  background: var(--ink);
  font-family: var(--utility);
  font-size: 0.74rem;
}

.error-page {
  display: grid;
  align-content: center;
  width: min(860px, calc(100% - 40px));
  min-height: 100svh;
  margin: 0 auto;
}

.error-page h1 {
  max-width: 780px;
}

.error-page > p:not(.eyebrow) {
  margin: 28px 0 0;
  font-size: 1.1rem;
}

.error-page .jump-link {
  justify-self: start;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: auto;
    padding-top: 72px;
  }

  .hero::before {
    display: none;
  }

  .hero-copy,
  .hero-finding {
    grid-column: 1;
  }

  .hero-paper {
    right: -70px;
    width: 300px;
    opacity: 0.18;
  }

  .hero-finding {
    margin-top: 44px;
  }

  .fold-machine,
  .proof-grid,
  .scale-section,
  .scope-section,
  .method-section {
    grid-template-columns: 1fr;
  }

  .scale-section {
    align-items: start;
  }

  .scale-number {
    font-size: clamp(6rem, 28vw, 12rem);
  }

  .paper-viewport {
    min-height: 600px;
  }

  .fold-rail {
    right: max(0px, calc(50% - 260px));
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .site-header,
  .hero {
    width: min(100% - 32px, 1240px);
  }

  .site-header {
    min-height: 66px;
  }

  .language-nav {
    gap: 8px;
  }

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

  h1 {
    font-size: clamp(3.15rem, 15vw, 4.2rem);
  }

  h2 {
    font-size: clamp(2.55rem, 12.5vw, 3.8rem);
  }

  .deck {
    margin-top: 25px;
    font-size: 1.06rem;
  }

  .trust-line {
    font-size: 0.8rem;
  }

  .jump-link {
    margin-top: 20px;
  }

  .hero-finding {
    width: calc(100% - 48px);
    margin-top: 36px;
  }

  .hero-paper {
    top: 430px;
    right: -105px;
    width: 265px;
    opacity: 0.14;
  }

  .fold-lab,
  .proof-section,
  .rounding-section,
  .mass-section,
  .scope-section,
  .method-section,
  .scale-section {
    padding: 78px 20px;
  }

  .fold-machine {
    gap: 48px;
  }

  .paper-viewport {
    min-height: 520px;
    place-items: center start;
  }

  .paper-sheet {
    width: min(72vw, 280px);
    margin-left: 4px;
  }

  .paper-viewport::before {
    inset: 4% 0;
  }

  .fold-rail {
    right: 0;
  }

  .fold-rail button {
    width: 44px;
  }

  .paper-code {
    font-size: 6rem;
  }

  .readout {
    grid-template-columns: 1fr;
  }

  .readout div,
  .readout div:nth-child(even) {
    min-height: 82px;
    padding: 15px 0;
    border-right: 0;
  }

  .readout div:nth-child(odd) {
    border-right: 0;
  }

  .proof-grid {
    margin-top: 46px;
  }

  .scale-number {
    font-size: 24vw;
  }

  .mass-calculator,
  .mass-result {
    grid-template-columns: 1fr;
  }

  .mass-result {
    gap: 34px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
