@font-face { font-family: 'Young Serif'; src: url('../fonts/ui/young-serif-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('../fonts/ui/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('../fonts/ui/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* Cover fonts: the same files the PDF uses, so the live cover matches the print */
@font-face { font-family: 'CS Montserrat'; src: url('../fonts/print/Montserrat_700Bold.ttf'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'CS SourceSans'; src: url('../fonts/print/SourceSans3_400Regular.ttf'); font-display: swap; }
@font-face { font-family: 'CS Lora'; src: url('../fonts/print/Lora_600SemiBold.ttf'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'CS Lora'; src: url('../fonts/print/Lora_400Regular_Italic.ttf'); font-style: italic; font-display: swap; }
@font-face { font-family: 'CS Nunito'; src: url('../fonts/print/Nunito_700Bold.ttf'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'CS Playfair'; src: url('../fonts/print/PlayfairDisplay_700Bold.ttf'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'CS Caveat'; src: url('../fonts/print/Caveat_600SemiBold.ttf'); font-display: swap; }

:root {
  --basil: #1E3A2B;
  --leaf: #4F6F43;
  --paper: #F4F6F1;
  --surface: #FFFFFF;
  --saffron: #F2B33D;
  --saffron-hover: #E5A42A;
  --saffron-ink: #2A1F05;
  --tomato: #A33A24;
  --ink: #1F2421;
  --muted: #59635C;
  --line: #D9DFD6;
  --line-strong: #B9C3B5;
  --tint: #E7EEE3;
  --radius: 10px;
  --display: 'Young Serif', Georgia, serif;
  --body: 'Atkinson', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--body); }
a { color: var(--leaf); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header and steps ---------- */
.top { background: var(--basil); color: #EAF0E6; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.brand { font-family: var(--display); color: #fff; text-decoration: none; font-size: 19px; }
.product { font-size: 15px; color: #BFD0B8; padding-left: 14px; border-left: 1px solid #3E5A49; }
.save { margin-left: auto; font-size: 14px; color: #BFD0B8; }
.back { color: #fff; font-size: 15px; }

.steps { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.steps-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; list-style: none; display: flex; gap: 4px; }
.steps button { background: none; border: 0; padding: 16px 14px 14px; cursor: pointer; font-size: 16px; color: var(--muted); display: flex; align-items: center; gap: 10px; border-bottom: 3px solid transparent; }
.steps button:hover { color: var(--ink); }
.steps .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; font-size: 14px; }
.steps button[aria-current="step"] { color: var(--basil); border-bottom-color: var(--basil); font-weight: 700; }
.steps button[aria-current="step"] .n { background: var(--basil); border-color: var(--basil); color: #fff; }
.steps button.done .n { background: var(--tint); border-color: var(--tint); color: var(--basil); }

/* ---------- layout ---------- */
.layout { max-width: 1180px; margin: 0 auto; padding: 32px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
main:focus { outline: none; }
.counter { position: sticky; top: 88px; }
.stats { margin: 22px 0 4px; font-size: 15px; color: var(--muted); text-align: center; }
.saved-note { margin: 0; font-size: 13.5px; color: var(--muted); text-align: center; }

h1 { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.15; color: var(--basil); margin: 0 0 6px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--basil); margin: 0; }
.lede { color: var(--muted); margin: 0 0 28px; max-width: 60ch; }

/* ---------- forms ---------- */
.field { margin: 0 0 22px; }
.field > label, .legend { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { display: block; font-size: 14.5px; color: var(--muted); margin: -2px 0 8px; }
.opt { font-weight: 400; color: var(--muted); font-size: 15px; }
input[type=text], select, textarea { width: 100%; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 11px 13px; font-size: 17px; line-height: 1.45; }
input[type=text]:hover, select:hover, textarea:hover { border-color: var(--leaf); }
input[type=text]:focus, select:focus, textarea:focus { outline: none; border-color: var(--basil); box-shadow: 0 0 0 3px rgba(242,179,61,.55); }
textarea { resize: vertical; min-height: 120px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.err { color: var(--tomato); font-size: 15px; margin: 6px 0 0; font-weight: 700; }
.invalid { border-color: var(--tomato) !important; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.panel + .panel { margin-top: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 1.5px solid var(--basil); background: var(--surface); color: var(--basil); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--tint); }
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: var(--saffron-ink); }
.btn.primary:hover { background: var(--saffron-hover); border-color: var(--saffron-hover); }
.btn.quiet { border-color: transparent; background: none; padding-left: 8px; padding-right: 8px; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { background: var(--tint); }
.btn.danger { color: var(--tomato); border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }
.actions .push { margin-left: auto; }

/* theme picker */
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; border: 0; padding: 0; margin: 0; }
.theme { position: relative; cursor: pointer; }
.theme input { position: absolute; opacity: 0; inset: 0; }
.theme .cv { border-radius: 3px; box-shadow: 0 0 0 1px var(--line); transition: transform .15s ease; }
.theme .tname { display: block; margin-top: 8px; font-weight: 700; font-size: 15px; }
.theme .tline { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.theme:hover .cv { transform: translateY(-2px); }
.theme input:checked + .cv { box-shadow: 0 0 0 3px var(--basil), 0 0 0 6px var(--paper), 0 0 0 7px var(--basil); }
.theme input:focus-visible + .cv { outline: 3px solid var(--saffron); outline-offset: 8px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; background: var(--tint); color: var(--basil); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: 1px; }

.photo-pick { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-pick .thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.choices { display: flex; gap: 20px; flex-wrap: wrap; }
.choices label { display: flex; gap: 8px; align-items: center; font-weight: 400; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--basil); }

/* ---------- recipes list ---------- */
.list-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.list-head .lede { margin: 0; }
.list-head .actions { margin: 0 0 0 auto; }
.chapter { margin-bottom: 30px; }
.ch-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--basil); padding-bottom: 8px; margin-bottom: 4px; }
.ch-head .count { color: var(--muted); font-size: 15px; }
.ch-head .tools { margin-left: auto; display: flex; gap: 2px; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; min-width: 38px; height: 38px; padding: 0 8px; cursor: pointer; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--tint); color: var(--basil); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.recipes { list-style: none; margin: 0; padding: 0; }
.rc { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rc .pic { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--tint); display: grid; place-items: center; font-family: var(--display); color: var(--leaf); font-size: 24px; }
.rc .t { font-weight: 700; font-size: 17.5px; line-height: 1.3; }
.rc .m { font-size: 14.5px; color: var(--muted); }
.rc .tools { display: flex; gap: 2px; align-items: center; }
.ch-empty { color: var(--muted); font-size: 15px; padding: 12px 0; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font-size: 13px; font-weight: 700; background: #F7E7DF; color: #7A2B19; border-radius: 999px; padding: 2px 10px; }
.allergen-box { background: #FBF1EC; border-radius: var(--radius); padding: 10px 14px; margin-top: 10px; font-size: 15px; color: #6B2616; }
.allergen-box.none { background: var(--tint); color: var(--basil); }

.empty { text-align: center; padding: 56px 28px; }
.empty .stack { display: flex; justify-content: center; margin-bottom: 18px; }
.empty .stack span { width: 46px; height: 60px; border-radius: 3px 6px 6px 3px; background: var(--basil); box-shadow: inset 5px 0 0 rgba(0,0,0,.25); margin: 0 -6px; transform: rotate(-8deg); }
.empty .stack span:nth-child(2) { background: var(--saffron); transform: translateY(-6px); z-index: 1; }
.empty .stack span:nth-child(3) { background: var(--leaf); transform: rotate(8deg); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 22px; }
.empty .actions { justify-content: center; margin-top: 0; }

/* ---------- preview ---------- */
.pv-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.pv-summary { font-size: 15.5px; color: var(--muted); margin: 0; }
.buy { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin-bottom: 16px; }
.check input { margin-top: 3px; flex: none; }
.price { font-family: var(--display); font-size: 28px; color: var(--basil); }
.notice { background: var(--tint); border-radius: var(--radius); padding: 12px 16px; margin-top: 16px; color: var(--basil); }
.pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 24px; }
.page { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 18px rgba(30,58,43,.10); aspect-ratio: 8.5 / 11; position: relative; }
.page.a4 { aspect-ratio: 210 / 297; }
.page canvas { width: 100%; height: 100%; display: block; }
.page .pn { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 13px; color: var(--muted); }
.working { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 24px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--tint); border-top-color: var(--basil); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the live cover (signature) ---------- */
.book { position: relative; margin: 0 auto; max-width: 300px; }
.book .cv { border-radius: 2px 4px 4px 2px;
  box-shadow: 1px 1px 0 #fff, 2px 2px 0 #DCD8CF, 3px 3px 0 #fff, 4px 4px 0 #D3CEC3, 5px 5px 0 #fff, 6px 6px 0 #CBC5B9, 0 18px 30px -10px rgba(30,58,43,.35); }
.book .cv::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3.5%; background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,.04) 70%, rgba(255,255,255,.18)); z-index: 3; pointer-events: none; }
.book .cv.updating { animation: settle .35s ease; }
@keyframes settle { from { transform: translateY(-3px); } to { transform: none; } }

.cv { position: relative; aspect-ratio: 612 / 792; container-type: inline-size; overflow: hidden; background: #fff; }
.cv .ph { position: absolute; background-size: cover; background-position: center; }
.cv .tx { position: absolute; left: 9.8%; right: 9.8%; }
.cv .ti { margin: 0; overflow-wrap: anywhere; }
.cv .su { margin: 0; }
.cv .by { position: absolute; left: 9.8%; right: 9.8%; margin: 0; }
/* modern */
.cv.modern { background: #1F2A37; }
.cv.modern .ph { left: 0; right: 0; top: 0; height: 62%; }
.cv.modern .tx { top: 50%; }
.cv.modern.has-photo .tx { top: 66.3%; }
.cv.modern .bar { width: 7.2cqi; height: .65cqi; background: #F2B33D; margin-bottom: 2.6cqi; }
.cv.modern .ti { font: 700 calc(7.2cqi * var(--k, 1))/1.05 'CS Montserrat', sans-serif; color: #fff; }
.cv.modern .su { font: 2.3cqi/1.3 'CS SourceSans', sans-serif; color: #C9D1DB; margin-top: 1.6cqi; }
.cv.modern .by { bottom: 7.2%; font: 700 1.5cqi 'CS Montserrat', sans-serif; letter-spacing: .33cqi; text-transform: uppercase; color: #F2B33D; }
/* garden */
.cv.garden { background: linear-gradient(#5E7D4F, #5E7D4F) top / 100% 1.8% no-repeat, #fff; }
.cv.garden .ph { left: 0; right: 0; top: 1.8%; height: 50.5%; }
.cv.garden .tx { top: 33%; }
.cv.garden.has-photo .tx { top: 55%; }
.cv.garden .sprig { width: 15.7cqi; height: 5.2cqi; margin-bottom: 2.9cqi; }
.cv.garden.has-photo .sprig { display: none; }
.cv.garden .ti { font: 600 calc(6.9cqi * var(--k, 1))/1.08 'CS Lora', serif; color: #2F3E28; }
.cv.garden .rl { width: 5.9cqi; height: .4cqi; background: #5E7D4F; margin: 2cqi 0 1.6cqi; }
.cv.garden .su { font: italic 2.3cqi/1.3 'CS Lora', serif; color: #66705F; }
.cv.garden .by { bottom: 7.4%; font: 700 1.4cqi 'CS Nunito', sans-serif; letter-spacing: .33cqi; text-transform: uppercase; color: #5E7D4F; }
/* farmhouse */
.cv.farmhouse { background: #F6EFE3; }
.cv.farmhouse::after { content: ''; position: absolute; inset: 3.8% 4.9%; border: .2cqi solid #A94F35; outline: .08cqi solid #A94F35; outline-offset: -1.2cqi; pointer-events: none; }
.cv.farmhouse .ph { left: 14.7%; right: 14.7%; top: 12%; aspect-ratio: 4 / 3; outline: .14cqi solid #A94F35; outline-offset: .8cqi; }
.cv.farmhouse .tx { top: 29%; text-align: center; }
.cv.farmhouse.has-photo .tx { top: 57%; }
.cv.farmhouse .eb { font: 1.4cqi 'CS SourceSans', serif; letter-spacing: .4cqi; color: #A94F35; margin-bottom: 2cqi; }
.cv.farmhouse .ti { font: 700 calc(7.5cqi * var(--k, 1))/1.08 'CS Playfair', serif; color: #3B2A20; }
.cv.farmhouse.has-photo .ti { font-size: calc(6.2cqi * var(--k, 1)); }
.cv.farmhouse .dm { width: 18cqi; height: 2cqi; margin: 2.3cqi auto 2cqi; }
.cv.farmhouse .su { font: italic 2.2cqi/1.3 'CS Lora', serif; color: #7A5B48; }
.cv.farmhouse .by { bottom: 11.6%; text-align: center; font: italic 2cqi 'CS Lora', serif; color: #3B2A20; }
/* heirloom */
.cv.heirloom { background: #FBF7EF; }
.cv.heirloom .snap { position: absolute; left: 25%; right: 25%; top: 12.6%; background: #fff; border: .1cqi solid #E3D6C6; padding: 1.5cqi 1.5cqi 4.2cqi; }
.cv.heirloom .snap .ph { position: static; aspect-ratio: 4 / 3; }
.cv.heirloom .tx { top: 29%; text-align: center; border-top: .14cqi dashed #7A2E3A; border-bottom: .14cqi dashed #7A2E3A; padding: 2.6cqi 0; }
.cv.heirloom.has-photo .tx { top: 54%; }
.cv.heirloom .ti { font: calc(10.1cqi * var(--k, 1))/0.95 'CS Caveat', cursive; color: #7A2E3A; }
.cv.heirloom.has-photo .ti { font-size: calc(8.5cqi * var(--k, 1)); }
.cv.heirloom .su { font: italic 2.1cqi/1.3 'CS Lora', serif; color: #6B5A50; margin-top: 1.6cqi; }
.cv.heirloom .by { bottom: 11.6%; text-align: center; font: 3.3cqi 'CS Caveat', cursive; color: #3A2E2A; }
.cv .placeholder { opacity: .5; }

/* ---------- footer ---------- */
.foot { max-width: 1180px; margin: 0 auto; padding: 20px 24px 40px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); display: flex; gap: 24px; justify-content: space-between; flex-wrap: wrap; }
.foot p { margin: 0; max-width: 70ch; }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 22px; }
  .counter { position: static; order: -1; display: none; }
  body[data-step="book"] .counter { display: block; }
  .book { max-width: 190px; }
  .stats { margin-top: 16px; }
  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .top-in { padding: 10px 16px; gap: 10px; }
  .product { display: none; }
  .back { font-size: 14px; }
  .save { order: 3; width: 100%; margin: 0; font-size: 13px; }
  .steps-in { padding: 0 8px; overflow-x: auto; }
  .steps button { padding: 12px 8px 10px; font-size: 15px; gap: 6px; white-space: nowrap; }
  .steps .n { width: 22px; height: 22px; font-size: 13px; }
  .steps .long { display: none; }
  .steps-in { justify-content: space-between; }
  .layout { padding: 18px 16px 40px; }
  h1 { font-size: 28px; }
  .panel { padding: 20px 16px; border-radius: 12px; }
  .row3 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .row3 .field { margin-bottom: 18px; }
  .rc { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .rc .pic { width: 52px; height: 52px; }
  .rc .tools { grid-column: 2; justify-content: flex-start; margin-left: -8px; }
  .pages { grid-template-columns: minmax(0, 1fr); }
  .pv-bar { grid-template-columns: minmax(0, 1fr); }
  .actions .btn { flex: 1 1 auto; }
  .actions .push { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
