:root {
  --cream: #fbf6ec;
  --olive: #4f592f;
  --terra: #954526;
  --ink: #322b20;
  --line: #dcd0bb;
  --paper: #fffbf2;
}

body {
  background: radial-gradient(ellipse at 82% 4%, #f0e3ce 0, transparent 34rem), var(--cream);
}

header {
  padding: 13px clamp(16px, 4vw, 52px);
  gap: 12px;
  background: var(--paper);
}

.brand { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: transparent; font-size: clamp(20px, 2vw, 26px); }
.brand-mark { font-size: 32px; line-height: 1; }
header nav { flex: 1; justify-content: center; gap: 4px; }
header nav button { padding: 9px 8px; border-color: transparent; background: transparent; white-space: nowrap; font-size: 14px; }
header nav button.active { color: var(--terra); background: transparent; border-color: transparent; box-shadow: inset 0 -2px var(--terra); }
header nav .add-recipe, header nav .add-recipe.active { color: white; background: var(--terra); border-color: var(--terra); box-shadow: none; }
header select { max-width: 140px; }
button.primary { background: var(--terra); border-color: var(--terra); }
.hero { background: linear-gradient(110deg, #f3e6cf, #e8ead8); }
.hero h1, .cookbook-intro h1 { color: var(--terra); font-style: italic; }
.panel { background: var(--paper); }

.cookbook-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .94fr); align-items: center; gap: clamp(22px, 6vw, 78px); padding: 22px 12px 30px; }
.cookbook-intro h1 { margin: 0; font-size: clamp(49px, 6.8vw, 92px); line-height: .99; letter-spacing: -.045em; }
.cookbook-sprig { color: var(--olive); font: 49px/1 Georgia, serif; margin: 12px 0 10px; }
.cookbook-search { display: flex; align-items: center; gap: 15px; margin: 0; padding: 0 14px; background: var(--paper); border: 1px solid #aa9c7e; border-radius: 12px; }
.cookbook-search:focus-within { outline: 2px solid var(--terra); outline-offset: 3px; }
.cookbook-search input { margin: 0; background: transparent; border: 0; min-width: 0; min-height: 51px; padding: 8px 0; outline: none; font-size: 16px; }
.search-glass { position: relative; flex: 0 0 17px; height: 17px; border: 2px solid var(--olive); border-radius: 100%; }
.search-glass::after { content: ''; position: absolute; width: 8px; height: 2px; top: 13px; left: 11px; background: var(--olive); transform: rotate(45deg); }
.cookbook-postcard { display: block; width: 100%; min-width: 0; padding: 11px 11px 8px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 12px 25px #5b422325; transform: rotate(2deg); }
.postcard-image { display: block; aspect-ratio: 1.68; overflow: hidden; border-radius: 3px; }
.postcard-image img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 53%; }
.postcard-caption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 9px; padding: 7px 5px 3px; text-align: left; font: italic clamp(16px, 2.1vw, 25px) Georgia, serif; }
.postcard-caption small, .recipe-postcard figcaption { color: #625649; font: 11px system-ui,sans-serif; }
.cookbook-categories { display: flex; flex-wrap: wrap; gap: 9px; margin: 4px 0 27px; }
.cookbook-categories button { display: flex; align-items: center; gap: 8px; padding: 7px 15px; border-color: transparent; border-radius: 24px; background: transparent; font: 18px Georgia, serif; }
.cookbook-categories button[aria-pressed="true"] { background: #f3e3c9; color: #713517; }
.cookbook-categories button span { color: var(--olive); font-size: 21px; }
.cookbook-section-title { display: flex; align-items: center; gap: 18px; margin: 0 0 16px; color: var(--terra); font-size: clamp(29px, 4vw, 45px); font-style: italic; }
.cookbook-section-title::after { content: ''; flex: 1; border-bottom: 1px solid #b4a582; }
.cookbook-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); align-items: start; }
.cookbook-card { position: relative; min-width: 0; padding: 9px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 12px #5b422311; }
.cookbook-card-link { display: block; width: 100%; background: transparent; border: 0; padding: 0; text-align: left; }
.cookbook-card-link img, .cookbook-card-placeholder { display: block; width: 100%; aspect-ratio: 1.9; object-fit: cover; border-radius: 5px; }
.cookbook-card-placeholder { display: grid; place-items: center; background: #e7e8d6; color: var(--olive); font: 58px Georgia, serif; }
.cookbook-card-copy { display: grid; gap: 3px; padding: 9px 4px 5px; }
.cookbook-card-title { font: 23px/1.15 Georgia, serif; overflow-wrap: anywhere; }
.cookbook-heart { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: var(--paper); color: var(--terra); font: 26px/1 system-ui,sans-serif; }
.recipe-postcard { min-width: 0; margin: 0; padding: 9px; border: 1px solid var(--line); background: var(--paper); border-radius: 5px; box-shadow: 0 5px 12px #5b42231f; transform: rotate(1.5deg); }
.recipe-postcard img { display: block; border-radius: 3px; }
.recipe-postcard figcaption { margin: 5px 2px 0; text-align: right; }
.hide-photo .recipe-postcard { margin-block: 0; }

@media (max-width: 850px) {
  header nav { order: 3; width: 100%; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 640px) {
  header nav { flex-wrap: wrap; gap: 4px; }
  header nav button { padding: 5px 8px; font-size: 13px; }
  .cookbook-hero { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 12px 3px 22px; }
  .cookbook-intro h1 { font-size: clamp(45px, 11vw, 60px); }
  .cookbook-sprig { font-size: 34px; margin: 5px 0 7px; }
  .cookbook-postcard { transform: rotate(1deg); }
  .cookbook-grid { grid-template-columns: minmax(0, 1fr); }
  .cookbook-categories { gap: 2px; }
  .cookbook-categories button { padding: 7px 10px; font-size: 16px; }
}

@media print {
  body { background: white; }
  main:has(.printbrand) { padding: 4mm; }
  main:has(.printbrand)::before {
    content: '';
    position: fixed;
    inset: 0;
    border: 3px double var(--olive);
    border-radius: 3mm;
    pointer-events: none;
  }
  main:has(.printbrand) .printbrand { justify-content: center; gap: 2mm; border-bottom: 0; margin: 0 0 2mm; padding: 0; }
  main:has(.printbrand) .detailhead h1 { color: var(--terra); font: italic 27pt/1.06 Georgia, serif; }
  main:has(.printbrand) .detailhead p { font-family: Georgia, serif; font-style: italic; }
  main:has(.printbrand) .detailhead,
  main:has(.printbrand) .detailhead:not(:has(img)),
  .hide-photo main:has(.printbrand) .detailhead {
    min-height: 40mm;
    gap: 5mm;
    grid-template-columns: minmax(0, 1fr) 57mm;
  }
  .recipe-postcard { padding: 1.5mm; box-shadow: 0 1mm 2mm #5b422318; transform: rotate(2deg); }
  .recipe-postcard img { height: 34mm; }
  .recipe-postcard figcaption { font-size: 6pt; }
  .hide-photo .recipe-postcard { display: none; }
  main:has(.printbrand) .meta { margin: 3mm 0 2.8mm; padding: 2mm 2.5mm; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  main:has(.printbrand) .columns { gap: 3mm; grid-template-columns: minmax(0, 1fr) minmax(0, 1.85fr); }
  main:has(.printbrand) .columns .panel { border: 0; background: transparent; border-radius: 0; padding: 1mm 0 0; }
  main:has(.printbrand) .columns .ingredients-panel { border-right: 1px solid var(--line); padding-right: 3mm; }
  main:has(.printbrand) .columns h2 { display: table; padding: 1mm 3mm; border: 0; border-radius: 2mm 1mm 2mm 1mm; background: #f1e3ca; font: italic 16pt/1.08 Georgia, serif; }
  main:has(.printbrand) .columns .checkline { font-size: 9pt; padding: 1.15mm 0; }
  main:has(.printbrand) .notes { background: #f1e3ca; border: 0; margin-top: 3mm !important; }
  main:has(.printbrand) .notes h3 { font-style: italic; }
}
