@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces_900Black.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

/*
 * A kitchen sheet: paper, ink, one orange. Colours from the app (src/theme/colors.ts).
 * Type: the system sans for words, the system mono for anything you would read off a scale.
 */
:root {
  --paper: #f7f1e6;
  --ink: #231a12;
  --muted: #7a6652;
  --rule: rgba(35, 26, 18, 0.16);
  --accent: #c2410c;
  --mark-top: #f8af66;
  --mark-middle: #ff7b14;
  --mark-front: #7c2d12;
  --flour: #d9b382;
  --water: #4ba3e3;
  --salt: #a8a29e;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

/* Dark: the reader's pick from the switch, or else the system's. */
:root[data-theme='dark'] {
  --paper: #171513;
  --ink: #efe8dc;
  --muted: #a8998a;
  --rule: rgba(239, 232, 220, 0.14);
  --accent: #fb923c;
  --mark-front: #fbf0e3;
  --flour: #e6c79c;
  --water: #64b5f0;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #171513;
    --ink: #efe8dc;
    --muted: #a8998a;
    --rule: rgba(239, 232, 220, 0.14);
    --accent: #fb923c;
    --mark-front: #fbf0e3;
    --flour: #e6c79c;
    --water: #64b5f0;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

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

img {
  display: block;
}

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

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

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
}

/* Small mono captions, the voice of the labels on a scale. */
.label,
.sections a,
.lang a,
.readout dt,
.note,
.features dt,
.ticks,
.thermo figcaption,
.marks b,
.colophon {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.label {
  margin: 0 0 32px;
  text-transform: uppercase;
  color: var(--muted);
}

.label::before {
  content: '— ';
  color: var(--accent);
}

section + section {
  border-top: 1px solid var(--rule);
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-top: 24px;
  padding-bottom: 24px;
}

/*
 * The app's mark (src/components/app-mark.tsx): the name in Fraunces Black three times, each layer
 * risen by an eighth of the size, like the icon's domes and the dough proving.
 */
.logo {
  --size: 30px;
  --rise: calc(var(--size) / 8);
  display: inline-grid;
  padding-top: calc(var(--rise) * 2);
  font: 900 var(--size) / 1.15 'Fraunces', ui-serif, Georgia, serif;
  letter-spacing: calc(var(--size) / -40);
  text-decoration: none;
}

.logo span {
  grid-area: 1 / 1;
  position: relative;
}

.logo .l3 {
  color: var(--mark-top);
  transform: translateY(calc(var(--rise) * -2));
  animation: rise 0.7s 0.55s ease-in-out both;
}

.logo .l2 {
  color: var(--mark-middle);
  transform: translateY(calc(var(--rise) * -1));
  animation: rise 0.7s 0.25s ease-in-out both;
}

.logo .l1 {
  color: var(--mark-front);
}

.logo:hover {
  color: inherit;
}

@keyframes rise {
  from {
    transform: translateY(0);
  }
}

.sections {
  display: flex;
  gap: 24px;
  margin-left: auto;
}

.sections a,
.lang a {
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

.sections a:hover,
.lang a:hover,
.lang a[aria-current='true'] {
  color: var(--ink);
}

.lang {
  display: flex;
  gap: 10px;
}

.lang a[aria-current='true'] {
  text-decoration: underline;
}

/* ---------- Intro ---------- */
.intro {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  align-items: end;
  padding-top: clamp(48px, 9vw, 120px);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.intro h1 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(64px, 12.5vw, 184px);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.055em;
}

.intro-side {
  grid-column: 9 / 13;
  margin-top: 40px;
  font-size: 19px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/*
 * The word that changes. Its letters rise one after the other, each trailed by two layers in the
 * mark's colours that close up under it as it settles, like the logo's three layers and the dough.
 * The old word's letters rise out the same way.
 */
.rot {
  display: inline-grid;
  vertical-align: top;
  color: var(--accent);
  /* Clip above and below the line only, so a longer word on its way out is never cut on the side. */
  clip-path: inset(0 -100vw -0.16em -100vw);
  transition: width 0.55s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.rot > span {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.rot .ch {
  display: inline-block;
  white-space: pre;
}

.rot .in .ch {
  animation: letter-in 0.8s cubic-bezier(0.2, 0.75, 0.15, 1) both;
  /* The new word waits for most of the old one to be gone, so they barely cross. */
  animation-delay: calc(0.28s + var(--i) * 32ms);
}

.rot .out .ch {
  animation: letter-out 0.42s cubic-bezier(0.55, 0, 0.75, 0.2) both;
  animation-delay: calc(var(--i) * 18ms);
}

@keyframes letter-in {
  from {
    transform: translateY(135%);
    text-shadow:
      0 0.1em var(--mark-middle),
      0 0.2em var(--mark-top);
  }
  55% {
    text-shadow:
      0 0.07em var(--mark-middle),
      0 0.14em var(--mark-top);
  }
  to {
    transform: none;
    text-shadow:
      0 0 transparent,
      0 0 transparent;
  }
}

@keyframes letter-out {
  to {
    transform: translateY(-135%);
    opacity: 0;
  }
}


.intro-side p {
  margin: 0;
  text-wrap: pretty;
}

/* ---------- The sentence calculator ---------- */
.scale {
  padding-top: clamp(56px, 8vw, 104px);
  padding-bottom: clamp(56px, 8vw, 104px);
}

.sentence {
  max-width: 22ch;
  margin: 0;
  font-size: clamp(28px, 4.4vw, 60px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.nb {
  white-space: nowrap;
}

.num {
  width: calc(var(--len, 3) * 1ch + 0.3ch);
  min-width: 1.6ch;
  padding: 0 0.05em;
  border: 0;
  border-bottom: 2px dashed var(--accent);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: -0.03em;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.num::-webkit-outer-spin-button,
.num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.num:hover,
.num:focus {
  border-bottom-style: solid;
  outline: none;
}

.readout {
  display: grid;
  grid-template-columns: 5fr 4fr 3fr;
  gap: 24px;
  margin: clamp(40px, 6vw, 72px) 0 0;
}

.readout dt {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  color: var(--muted);
}

.readout dt::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--swatch);
}

.readout .flour {
  --swatch: var(--flour);
}

.readout .water {
  --swatch: var(--water);
}

.readout .salt {
  --swatch: var(--salt);
}

.readout dd {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: clamp(44px, 8.4vw, 120px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ratio {
  display: flex;
  gap: 3px;
  height: 14px;
  margin-top: 32px;
}

.ratio span {
  min-width: 3px;
  transition: flex-grow 0.25s ease;
}

.readout dd small {
  margin-left: 0.12em;
  font-size: 0.32em;
  letter-spacing: 0;
  color: var(--muted);
}

#bar-flour {
  background: var(--flour);
}

#bar-water {
  background: var(--water);
}

#bar-salt {
  background: var(--salt);
}

.note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  margin: 16px 0 0;
  color: var(--muted);
}

.note b {
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Features ---------- */
.features {
  padding-top: clamp(56px, 8vw, 104px);
  padding-bottom: clamp(56px, 8vw, 104px);
}

.features dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 24px;
  margin: 0;
}

.features dl > div {
  padding-top: 16px;
  border-top: 1px solid var(--ink);
}

.features dt {
  margin-bottom: 10px;
  text-transform: uppercase;
  color: var(--accent);
}

.features dd {
  margin: 0;
  max-width: 34ch;
  text-wrap: pretty;
}

/* ---------- Sections with a heading ---------- */
.head {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.head h2 {
  grid-column: 1 / 8;
  margin: 0;
  font-size: clamp(36px, 5.4vw, 72px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.head p {
  grid-column: 9 / 13;
  margin: 0;
  color: var(--muted);
  text-wrap: pretty;
}

.styles,
.oven,
.faq {
  padding-top: clamp(64px, 9vw, 120px);
  padding-bottom: clamp(64px, 9vw, 120px);
}

/* Styles: seven pizzas on one shelf */
.styles ul {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.styles li {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 16px 20px;
  font-size: 15px;
}

.styles li + li {
  border-left: 1px solid var(--rule);
}

.styles img {
  width: 56px;
  height: 56px;
  transition: transform 0.3s ease;
}

.styles li:hover img {
  transform: rotate(-12deg);
}

/* Oven: a heat scale with the Neapolitan window and four ovens on it */
.thermo {
  position: relative;
  margin: 0;
  padding-top: 40px;
}

.track {
  position: relative;
  height: 6px;
  background: linear-gradient(90deg, #f5b266, #ff7b14 55%, #c2410c 80%, #7c2d12);
}

.band {
  position: absolute;
  left: var(--from);
  width: calc(var(--to) - var(--from));
  bottom: -10px;
  height: 26px;
  border: 1px solid var(--ink);
  background: repeating-linear-gradient(135deg, transparent 0 4px, var(--rule) 4px 5px);
}

.band em {
  position: absolute;
  bottom: calc(100% + 8px);
  left: -1px;
  font: 500 13px var(--sans);
  font-style: normal;
  white-space: nowrap;
}

.ticks {
  position: relative;
  height: 32px;
  color: var(--muted);
}

.ticks span {
  position: absolute;
  left: var(--at);
  top: 18px;
  transform: translateX(-50%);
}

.ticks span::after {
  content: ' °C';
}

.ticks span {
  white-space: nowrap;
}

.ticks span:first-child {
  transform: none;
}

.ticks span:last-child {
  transform: translateX(-100%);
}

.marks {
  position: relative;
  height: 220px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.marks li {
  --level: 0;
  position: absolute;
  left: var(--at);
  top: calc(var(--level) * 64px + 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  white-space: nowrap;
}

/* The pin from the scale down to each oven. */
.marks li::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 100%;
  height: calc(var(--level) * 64px + 52px);
  border-left: 1px solid var(--ink);
}

.marks li:nth-child(3) {
  --level: 1;
}

.marks li:nth-child(4) {
  --level: 2;
}

/* The hottest ovens hang to the left of their pin, so they stay inside the page. */
.marks li:nth-child(n + 2) {
  flex-direction: row-reverse;
  transform: translateX(-100%);
  text-align: right;
}

.marks li:nth-child(n + 2)::before {
  left: auto;
  right: 0;
}

.marks img {
  width: 44px;
  height: 44px;
}

.marks span {
  display: grid;
}

.marks b {
  font-weight: 400;
  color: var(--muted);
}

.thermo figcaption {
  margin-top: 24px;
  color: var(--muted);
}

/* ---------- Privacy ---------- */
.privacy {
  padding-top: clamp(64px, 9vw, 120px);
  padding-bottom: clamp(64px, 9vw, 120px);
}

.privacy p {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(30px, 4.4vw, 60px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.privacy a {
  display: block;
  margin-top: 28px;
  font: 400 12px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
}

.faq h2 {
  grid-column: 1 / 4;
  margin: 0;
  font-size: clamp(36px, 5.4vw, 72px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.qa {
  grid-column: 5 / 13;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 32px;
}

.qa h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.qa p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  text-wrap: pretty;
}

/* ---------- Colophon ---------- */
.colophon {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px 20px;
  padding-top: 32px;
  padding-bottom: 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.colophon img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #7c2d12;
}

.colophon p {
  margin: 0;
}

.colophon nav {
  display: flex;
  gap: 20px;
}

.colophon .copy {
  grid-column: 1 / 3;
}

.colophon .theme {
  justify-self: end;
}

.doc .label {
  margin: 48px 0 0;
}

.doc code {
  font: 0.9em var(--mono);
}

.doc .more {
  margin-top: 48px;
  font: 12px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Theme switch */
.theme {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.theme button {
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 12px var(--mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.theme button:hover {
  color: var(--ink);
}

.theme button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Long-form pages ---------- */
.page-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 40px;
  border-top: 1px solid var(--rule);
  font: 12px var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.page-foot nav {
  display: flex;
  gap: 20px;
}

.doc {
  max-width: 720px;
  padding-top: clamp(40px, 7vw, 88px);
  padding-bottom: clamp(64px, 9vw, 120px);
}

.doc h1 {
  margin: 0 0 24px;
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.doc h2 {
  margin: 40px 0 8px;
  font-size: 19px;
  font-weight: 600;
}

.doc .updated {
  margin: 0 0 40px;
  font: 12px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc p {
  color: var(--muted);
}

.doc .updated + p,
.doc .lead {
  color: var(--ink);
  font-size: 21px;
  line-height: 1.45;
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .intro h1,
  .intro-side,
  .head h2,
  .head p,
  .faq h2,
  .qa {
    grid-column: 1 / -1;
  }

  .intro-side {
    margin-top: 32px;
    max-width: 44ch;
    font-size: 17px;
  }

  .head p {
    margin-top: 16px;
    max-width: 44ch;
  }

  .faq h2 {
    margin-bottom: 40px;
  }

  .features dl {
    grid-template-columns: 1fr 1fr;
  }

  .styles ul {
    grid-template-columns: repeat(4, 1fr);
  }

  .styles li:nth-child(5) {
    border-left: 0;
  }

  .styles li:nth-child(n + 5) {
    border-top: 1px solid var(--rule);
  }
}

@media (max-width: 640px) {
  .sections {
    display: none;
  }

  .lang {
    margin-left: auto;
  }

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

  .readout div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
  }

  .readout dd {
    margin: 0;
    font-size: 48px;
  }

  .features dl,
  .qa {
    grid-template-columns: 1fr;
  }

  .styles ul {
    grid-template-columns: repeat(7, 112px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-right: calc(var(--gutter) * -1);
  }

  .styles li {
    scroll-snap-align: start;
    border-top: 0 !important;
  }

  .styles li:nth-child(5) {
    border-left: 1px solid var(--rule);
  }

  /* On a phone the ovens leave the scale and line up below it. */
  .marks {
    height: auto;
    display: grid;
    gap: 16px;
    margin-top: 8px;
  }

  .marks li,
  .marks li:nth-child(n + 2) {
    position: static;
    transform: none;
    flex-direction: row;
    text-align: left;
  }

  .marks li::before {
    display: none;
  }

  .ticks span:nth-child(even) {
    display: none;
  }
}
