@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..700,50;1,9..144,300..600,50&family=Work+Sans:wght@400;500;600&display=swap");

/* Same palette and fonts as the e-book, so the page and the PDF look like one thing. */
:root {
  --paper: #f4ede1;
  --paper-light: #faf6ee;
  --paper-deep: #ebe0cd;
  --ink: #2a211c;
  --ink-soft: #5b4d43;
  --madder: #a5472a;
  --madder-dark: #87361e;
  --saffron: #d39a2f;
  --saffron-light: #f2c46d;
  --hearth: #3b2a20;
  --line: #d6c7ae;
  --serif: "Fraunces", Georgia, serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --sans: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 56px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: "SOFT" 50;
  font-size: 1.125rem;
  line-height: 1.65;
}

img { display: block; max-width: 100%; }
a { color: var(--madder); text-underline-offset: 3px; }
a:hover { color: var(--madder-dark); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }

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

h1, h2, h3 { font-weight: 420; line-height: 1.08; margin: 0; letter-spacing: -0.012em; }
h2 { font-size: clamp(2rem, 4vw, 2.9rem); }
p { margin: 0 0 1em; }

/* Photos, with a striped stand-in until the real image exists */
.photo { position: relative; background: var(--paper-deep); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.missing img { display: none; }
.photo.missing {
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(165, 71, 42, 0.08) 14px 15px),
    var(--paper-deep);
}
.photo.missing::after {
  content: attr(data-file);
  position: absolute;
  inset: auto 0 12px;
  text-align: center;
  font: 500 0.75rem/1 var(--sans);
  color: var(--ink-soft);
}

/* Buttons */
.button {
  display: inline-block;
  background: var(--madder);
  color: var(--paper-light);
  border: 0;
  border-radius: 4px;
  padding: 0.95em 1.5em;
  font: 600 1rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--madder-dark); color: var(--paper-light); }
.button:disabled { background: #b9a993; cursor: not-allowed; }

/* Top bar */
.topbar { padding: 22px 0; }
.topbar .wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.wordmark { font-size: 1.5rem; font-style: italic; color: var(--ink); text-decoration: none; }
.topbar nav a { font: 500 0.95rem var(--sans); color: var(--ink); }

/* Hero */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  padding-top: 8px;
  padding-bottom: clamp(40px, 6vw, 80px);
}
.hero .portrait { position: relative; }
.hero .portrait .photo { aspect-ratio: 4 / 5; border-radius: 2px; }
.note {
  position: absolute;
  right: -18px;
  bottom: -26px;
  max-width: 230px;
  background: var(--paper-light);
  padding: 14px 18px 12px;
  font-family: var(--hand);
  font-size: 1.65rem;
  line-height: 1.1;
  color: var(--ink);
  transform: rotate(-2.5deg);
  box-shadow: 0 1px 0 var(--line), 0 10px 24px -14px rgba(59, 42, 32, 0.6);
}
.note span { display: block; margin-top: 6px; font-size: 1.35rem; color: var(--madder); text-align: right; }

.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.6rem);
  font-variation-settings: "SOFT" 50, "opsz" 144;
  font-weight: 380;
  line-height: 1.02;
  margin-bottom: 0.45em;
  max-width: 13ch;
}
.hero .lede { font-size: 1.25rem; max-width: 34em; color: var(--ink); }
.buy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 30px; }
.buy-row .alt { font: 500 1rem var(--sans); color: var(--ink); }
.fine { font: 400 0.9rem/1.5 var(--sans); color: var(--ink-soft); margin-top: 14px; }

/* The woven band: pibiones, the raised knots of Sardinian weaving */
.weave {
  height: 64px;
  background-color: var(--paper-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='64' fill='%23a5472a'%3E%3Ccircle cx='4' cy='6' r='1.6'/%3E%3Ccircle cx='12' cy='6' r='1.6'/%3E%3Ccircle cx='20' cy='6' r='1.6'/%3E%3Ccircle cx='28' cy='6' r='1.6'/%3E%3Ccircle cx='36' cy='6' r='1.6'/%3E%3Ccircle cx='44' cy='6' r='1.6'/%3E%3Ccircle cx='4' cy='58' r='1.6'/%3E%3Ccircle cx='12' cy='58' r='1.6'/%3E%3Ccircle cx='20' cy='58' r='1.6'/%3E%3Ccircle cx='28' cy='58' r='1.6'/%3E%3Ccircle cx='36' cy='58' r='1.6'/%3E%3Ccircle cx='44' cy='58' r='1.6'/%3E%3Ccircle cx='24' cy='14' r='2'/%3E%3Ccircle cx='30' cy='20' r='2'/%3E%3Ccircle cx='36' cy='26' r='2'/%3E%3Ccircle cx='42' cy='32' r='2'/%3E%3Ccircle cx='36' cy='38' r='2'/%3E%3Ccircle cx='30' cy='44' r='2'/%3E%3Ccircle cx='24' cy='50' r='2'/%3E%3Ccircle cx='18' cy='44' r='2'/%3E%3Ccircle cx='12' cy='38' r='2'/%3E%3Ccircle cx='6' cy='32' r='2'/%3E%3Ccircle cx='12' cy='26' r='2'/%3E%3Ccircle cx='18' cy='20' r='2'/%3E%3Ccircle cx='24' cy='26' r='2'/%3E%3Ccircle cx='30' cy='32' r='2'/%3E%3Ccircle cx='24' cy='38' r='2'/%3E%3Ccircle cx='18' cy='32' r='2'/%3E%3Ccircle cx='24' cy='32' r='2.6' fill='%23d39a2f'/%3E%3Ccircle cx='0' cy='32' r='1.4'/%3E%3Ccircle cx='48' cy='32' r='1.4'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* What's in the book */
.inside { padding: clamp(56px, 8vw, 104px) 0; }
.inside .wrap {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.book { position: sticky; top: 32px; }
.book .photo {
  aspect-ratio: 2 / 3;
  border-radius: 1px 4px 4px 1px;
  box-shadow: inset 6px 0 8px -6px rgba(0, 0, 0, 0.35), 0 18px 34px -18px rgba(59, 42, 32, 0.7);
}
.book .caption { font: 400 0.9rem/1.5 var(--sans); color: var(--ink-soft); margin-top: 18px; }

.inside h2 { margin-bottom: 0.4em; }
.inside .intro { max-width: 34em; }
.menu {
  columns: 2 260px;
  column-gap: 48px;
  margin: 36px 0 12px;
}
.course { break-inside: avoid; margin-bottom: 28px; }
.course h3 {
  font-size: 1.35rem;
  font-style: italic;
  color: var(--madder);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.course ul { list-style: none; margin: 0; padding: 0; }
.course li { padding: 3px 0; line-height: 1.4; font-size: 1.05rem; }
.course li.star::after { content: " \2605"; color: var(--saffron); font-size: 0.85em; }
.legend { font: 400 0.9rem var(--sans); color: var(--ink-soft); }
.legend b { color: var(--saffron); font-weight: 400; }

.extras { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.extras h3 { font-size: 1.5rem; margin-bottom: 14px; }
.extras ul { margin: 0; padding-left: 1.1em; }
.extras li { margin-bottom: 8px; }
.extras li::marker { color: var(--madder); }

/* Letter */
.letter { background: var(--paper-light); padding: clamp(56px, 8vw, 104px) 0; border-top: 1px solid var(--line); }
.letter .wrap {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}
.letter .text { max-width: 33em; font-size: 1.2rem; }
.letter .greeting { font-family: var(--hand); font-size: 2.1rem; color: var(--madder); margin-bottom: 0.4em; }
.signoff { margin-top: 1.4em; }
.signoff .sign { display: block; font-family: var(--hand); font-size: 2.6rem; line-height: 1; color: var(--ink); }
.plates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plates .photo { aspect-ratio: 5 / 4; }
.plates .photo:first-child { grid-column: 1 / -1; }

/* Free recipes */
.free { background: var(--hearth); color: var(--paper); }
.free .weave { background-color: #4a362a; border-color: #5a4535; }
.free .wrap {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 5fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding-top: clamp(56px, 8vw, 96px);
  padding-bottom: clamp(56px, 8vw, 96px);
}
.free .photo { aspect-ratio: 2 / 3; max-width: 300px; box-shadow: 0 18px 34px -16px rgba(0, 0, 0, 0.7); }
.free .photo.missing { background-color: #5a4535; }
.free .photo.missing::after { color: var(--paper-deep); }
.free h2 { color: var(--paper-light); margin-bottom: 0.4em; }
.free p { max-width: 32em; }
.free form { margin-top: 26px; max-width: 520px; }
.free label { display: block; font: 500 0.95rem var(--sans); margin-bottom: 8px; }
.field { display: flex; gap: 10px; flex-wrap: wrap; }
.field input[type="email"] {
  flex: 1 1 240px;
  min-width: 0;
  font: 400 1.05rem var(--sans);
  padding: 0.85em 1em;
  border: 1px solid #6b5545;
  border-radius: 4px;
  background: var(--paper-light);
  color: var(--ink);
}
.free .button { background: var(--saffron-light); color: var(--hearth); }
.free .button:hover { background: #f6d38f; color: var(--hearth); }
.free .fine { color: #cbbba4; }
.free .fine a { color: var(--saffron-light); }
.form-msg { font: 500 1rem/1.5 var(--sans); margin-top: 14px; }
.form-msg.error { color: #ffb59e; }
.form-msg.done { font: 400 1.25rem/1.5 var(--serif); color: var(--paper-light); }
.honey { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { margin-top: 14px; }

/* Questions */
.faq { padding: clamp(56px, 8vw, 104px) 0; }
.faq .wrap { max-width: 820px; }
.faq h2 { margin-bottom: 28px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 36px 18px 0;
  font-size: 1.3rem;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 14px;
  font: 400 1.6rem var(--sans);
  color: var(--madder);
}
.faq details[open] summary::after { content: "\2212"; }
.faq details p { max-width: 38em; margin-bottom: 20px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font: 400 0.9rem/1.6 var(--sans); color: var(--ink-soft); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer a { color: var(--ink-soft); }

/* Checkout dialog */
.checkout-dialog {
  width: min(560px, 100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--paper-light);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
}
.checkout-dialog::backdrop { background: rgba(42, 33, 28, 0.6); }
.checkout-dialog[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .checkout-dialog[open] { animation: none; } }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px 26px 0; }
.dialog-head h2 { font-size: 1.7rem; }
.dialog-head .price { font: 500 1rem var(--sans); color: var(--ink-soft); margin: 6px 0 0; }
.close {
  background: none;
  border: 0;
  font: 400 1.9rem/1 var(--sans);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 4px;
}
.dialog-body { padding: 20px 26px 26px; }
.waiver {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 400 0.98rem/1.5 var(--sans);
  cursor: pointer;
}
.waiver input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--madder); }
.dialog-body .button { width: 100%; margin-top: 18px; }
.dialog-body .fine { text-align: center; }
#checkout { min-height: 120px; }
.loading { font: 400 1rem var(--sans); color: var(--ink-soft); text-align: center; padding: 28px 0; }
.dialog-error { font: 500 1rem/1.5 var(--sans); color: var(--madder-dark); margin-top: 14px; }

/* Plain text pages: thanks, terms, privacy, 404 */
.page { padding: clamp(32px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }
.page .wrap { max-width: 760px; }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 0.5em; }
.page h2 { font-size: 1.5rem; margin: 1.6em 0 0.5em; }
.page .updated { font: 400 0.9rem var(--sans); color: var(--ink-soft); }
.page .hand { font-family: var(--hand); font-size: 2rem; color: var(--madder); margin-top: 1.2em; }
.page .button { margin: 8px 0 18px; }

@media (max-width: 860px) {
  .hero .wrap, .inside .wrap, .letter .wrap, .free .wrap { grid-template-columns: 1fr; }
  .hero .portrait { max-width: 440px; }
  .note { right: 12px; bottom: -22px; }
  .hero .copy { padding-top: 22px; }
  .book { position: static; max-width: 260px; }
  .letter .plates { order: -1; }
  .free .photo { max-width: 200px; }
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .topbar nav a { font-size: 0.9rem; }
  .hero .lede { font-size: 1.125rem; }
  .buy-row .button { width: 100%; text-align: center; }
  .note { font-size: 1.4rem; max-width: 190px; }
  .dialog-head, .dialog-body { padding-left: 18px; padding-right: 18px; }
}
