:root {
  --bg: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Image ratios (width / height). Every device shares one height, see tools/build-images.py. */
  --open: 1.3413;
  --closed: 0.7402;
  --spread: 1.3028;
  --pair: calc(var(--open) + var(--closed));
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

h1, h2, .lede, .note { text-wrap: balance; }

.intro {
  text-align: center;
  padding: clamp(80px, 16vh, 160px) 0 clamp(24px, 4vh, 48px);
}

.hero {
  width: calc(100% * var(--closed) / var(--pair));
  margin: clamp(40px, 7vh, 64px) auto 0;
}

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

h1 {
  font-weight: 600;
  font-size: clamp(44px, 6vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lede {
  font-size: clamp(19px, 2.2vw, 24px);
  color: var(--muted);
  letter-spacing: -0.01em;
  margin-top: 12px;
}

.cta {
  display: inline-block;
  margin-top: 28px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink);
}

section {
  padding-top: clamp(96px, 16vh, 160px);
}

h2 {
  text-align: center;
  font-weight: 600;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.note {
  text-align: center;
  color: var(--muted);
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.45;
  max-width: 640px;
  margin: 12px auto 0;
}

/* The images carry their own shadow and breathing room, so rows sit edge to edge.
   Each figure grows by its ratio, which gives every image in a row the same height. */
.row {
  display: flex;
  justify-content: center;
  margin-top: clamp(24px, 4vh, 40px);
}

.row + .row { margin-top: 0; }

.row figure { min-width: 0; }
.row .w { flex: var(--open) 1 0; }
.row .t { flex: var(--closed) 1 0; }

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

/* Single shots match the height of a pair, so devices keep one scale down the page. */
.row.wide figure { width: calc(100% * var(--spread) / var(--pair)); }
.row.tall figure { width: calc(100% * var(--closed) / var(--pair)); }

/* Wear slider: the aged cover fades in over the new one (see age.js). */
.age {
  width: calc(100% * var(--closed) / var(--pair));
  margin: clamp(24px, 4vh, 40px) auto 0;
}

.age-stack {
  position: relative;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.age-stack img { display: block; width: 100%; height: auto; }
.age-stack .aged { position: absolute; inset: 0; opacity: var(--age); }

/* Inset to the device's edges, not the shadow's. */
.age input,
.age-labels { margin-inline: 7.2%; width: 85.6%; }

.age input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  height: 28px;
  margin-top: 4px;
  background: transparent;
  cursor: pointer;
}

.age input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ink) calc(var(--age) * 100%), var(--line) 0);
}

.age input::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ink) calc(var(--age) * 100%), var(--line) 0);
}

.age input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .5px rgb(0 0 0 / .14), 0 2px 8px rgb(0 0 0 / .18);
}

.age input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .5px rgb(0 0 0 / .14), 0 2px 8px rgb(0 0 0 / .18);
}

.age input:focus-visible { outline: none; }
.age input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgb(0 113 227 / .35), 0 2px 8px rgb(0 0 0 / .18); }
.age input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgb(0 113 227 / .35), 0 2px 8px rgb(0 0 0 / .18); }

.age-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px 40px;
  max-width: 960px;
  margin: clamp(40px, 6vh, 64px) auto 0;
}

.features li {
  flex: 0 1 290px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.features h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.features p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  margin-top: 4px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: clamp(96px, 16vh, 160px) 16px 40px;
}

footer .fine {
  font-size: 12px;
  margin-top: 8px;
}

/* Phones: stack. Widths stay proportional so a closed phone is still half an open one. */
@media (max-width: 720px) {
  .row { flex-direction: column; align-items: center; }
  .row .w { flex: none; width: 100%; }
  .row .t,
  .row.tall figure { flex: none; width: calc(100% * var(--closed) / var(--open)); }
  .row.wide figure { width: calc(100% * var(--spread) / var(--open)); }
  .hero,
  .age { width: calc(100% * var(--closed) / var(--open)); }
  .features { gap: 24px; }
  .features li { flex-basis: 100%; }
}
