:root {
  --paper: #f7f1e7;
  --cream: #fffaf1;
  --ink: #352f2a;
  --muted: #756a60;
  --peach: #c96546;
  --peach-dark: #9d442d;
  --sage: #64705b;
  --line: #ddcdbb;
  --shadow: 0 18px 50px rgba(66, 46, 31, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Georgia, 'Times New Roman', serif; line-height: 1.65; }
button, input { font: inherit; }

.hero { min-height: 370px; display: grid; place-items: center; padding: 58px 24px 82px; text-align: center; color: white; background: linear-gradient(135deg, rgba(76,54,39,.88), rgba(128,73,48,.72)), url('images/cream-cheese-peach-pie-front.jpg') center 38%/cover; }
.hero-layout { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(250px, 390px) minmax(0, 1fr); align-items: center; gap: clamp(30px, 6vw, 76px); }
.hero-family-photo { margin: 0; padding: 8px; background: rgba(255,250,241,.96); box-shadow: 0 18px 45px rgba(30,20,14,.3); transform: rotate(-1deg); }
.hero-family-photo img { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; object-position: center; }
.hero-inner { max-width: 800px; }
.hero h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.5rem); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.intro { margin: 22px 0 0; font-size: clamp(1.1rem, 2.4vw, 1.5rem); }
.collection-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.collection-nav a { padding: 11px 17px; color: white; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.72); border-radius: 999px; font: 700 .82rem Arial,sans-serif; text-decoration: none; transition: transform .18s ease; }
.collection-nav a:last-child { color: #59463a; background: var(--cream); border-color: var(--cream); }
.collection-nav a:hover, .collection-nav a:focus-visible { transform: translateY(-2px); }
.eyebrow { margin: 0 0 8px; font-family: Arial, sans-serif; font-size: .76rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }

main { width: min(1180px, calc(100% - 32px)); margin: -42px auto 70px; position: relative; }
.collection { padding: clamp(24px, 4vw, 48px); background: var(--cream); border: 1px solid rgba(120,83,58,.15); box-shadow: var(--shadow); }
.section-heading, .subheading { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
h2, h3, h4 { line-height: 1.15; }
h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; }
h3 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.65rem); font-weight: 500; }
h4 { margin: 30px 0 12px; color: var(--peach-dark); font-family: Arial, sans-serif; font-size: .92rem; letter-spacing: .12em; text-transform: uppercase; }
.search input { width: min(360px, 42vw); padding: 13px 16px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 999px; }
.collection-intro { margin: 8px 0 0; color: var(--muted); }
.category-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0; }
.filter-button { padding: 9px 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.filter-button.active { color: white; background: var(--peach-dark); border-color: var(--peach-dark); }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 24px; }
.recipe-tile { min-width: 0; overflow: hidden; color: var(--ink); background: white; border: 1px solid var(--line); text-decoration: none; box-shadow: 0 7px 22px rgba(66,46,31,.08); transition: transform .18s ease, box-shadow .18s ease; }
.recipe-tile:hover, .recipe-tile:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow); }
.thumbnail-wrap { height: 220px; display: block; overflow: hidden; background: #eee5d9; }
.thumbnail-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: top; }
.tile-copy { min-height: 170px; display: flex; align-items: flex-start; flex-direction: column; padding: 20px; }
.tile-copy strong { margin: 13px 0 8px; font-size: 1.35rem; line-height: 1.25; }
.tile-copy small { margin-top: auto; color: var(--peach-dark); font-family: Arial, sans-serif; font-weight: 700; }

.recipe-card { margin-top: 32px; border: 1px solid var(--line); background: white; }
.card-opener { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; text-align: left; color: var(--ink); background: transparent; border: 0; cursor: pointer; }
.card-opener strong, .card-opener small { display: block; }
.card-opener strong { margin-top: 8px; font-size: 1.45rem; }
.card-opener small { color: var(--muted); }
.tag { padding: 5px 9px; color: white; background: var(--sage); border-radius: 999px; font: 700 .68rem Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.open-label { color: var(--peach-dark); font: 700 .84rem Arial, sans-serif; text-transform: uppercase; }

.recipe-detail { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); border-top: 1px solid var(--line); }
.detail-header { padding: 44px max(24px, calc((100vw - 1180px) / 2)); color: white; background: #59463a; }
.detail-header h1 { max-width: 900px; margin: 10px 0; font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 500; line-height: 1; }
.detail-header p:last-child { margin: 0; color: #eadfd4; }
.back-link { color: white; font-family: Arial, sans-serif; font-size: .86rem; font-weight: 700; text-decoration: none; }
.detail-main { width: min(1180px, calc(100% - 32px)); margin: 40px auto 70px; }
.recipe-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.recipe-nav-link { min-width: 0; padding: 14px 18px; color: var(--ink); background: var(--cream); border: 1px solid var(--line); text-decoration: none; box-shadow: 0 5px 18px rgba(66,46,31,.07); }
.recipe-nav-link:hover, .recipe-nav-link:focus-visible { border-color: var(--peach); }
.recipe-nav-link span, .recipe-nav-link strong { display: block; }
.recipe-nav-link span { color: var(--peach-dark); font: 700 .72rem Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.recipe-nav-link strong { margin-top: 4px; overflow: hidden; font-size: 1.05rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.recipe-nav-next { text-align: right; }
.standalone { border: 1px solid var(--line); box-shadow: var(--shadow); }
.standalone h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.65rem); font-weight: 500; line-height: 1.15; }
.standalone .transcription h3 { margin: 30px 0 12px; color: var(--peach-dark); font-family: Arial, sans-serif; font-size: .92rem; letter-spacing: .12em; text-transform: uppercase; }
.original, .transcription { padding: clamp(24px, 4vw, 42px); }
.original { background: #eee5d9; }
.transcription { background: #fff; }
.image-tabs { display: flex; gap: 5px; }
.image-tab { padding: 8px 13px; color: var(--ink); background: transparent; border: 1px solid #bba995; border-radius: 999px; cursor: pointer; }
.image-tab.active { color: white; background: var(--peach-dark); border-color: var(--peach-dark); }
.card-image-button { width: 100%; margin-top: 24px; padding: 0; position: relative; background: white; border: 0; box-shadow: 0 14px 35px rgba(65,45,32,.18); cursor: zoom-in; }
.card-image-button img { width: 100%; max-height: 720px; display: block; object-fit: contain; }
.card-image-button span { position: absolute; right: 12px; bottom: 12px; padding: 7px 10px; color: white; background: rgba(45,37,31,.82); border-radius: 4px; font: 700 .73rem Arial, sans-serif; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.recipe-meta span { padding: 6px 10px; color: var(--sage); background: #edf0e8; border-radius: 4px; font: 700 .75rem Arial, sans-serif; }
.transcription li { margin-bottom: 8px; padding-left: 5px; }
.gracie-note { margin-top: 28px; padding: 20px; background: #fff5e5; border-left: 4px solid var(--peach); }
.transcription-pending { margin-top: 28px; padding: 20px; background: #edf0e8; border-left: 4px solid var(--sage); }
.transcription-pending p { margin: 5px 0 0; }
.gracie-note strong { color: var(--peach-dark); }
.gracie-note p { margin: 5px 0 0; }
.print-button { margin-top: 24px; padding: 12px 18px; color: white; background: var(--peach-dark); border: 0; border-radius: 4px; cursor: pointer; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }
.printed-callout { margin-top: 28px; padding: clamp(24px,4vw,42px); display: flex; align-items: center; justify-content: space-between; gap: 30px; color: white; background: #59463a; box-shadow: var(--shadow); }
.printed-callout p:last-child { margin-bottom: 0; color: #eadfd4; }
.collection-link { flex: 0 0 auto; padding: 13px 18px; color: #59463a; background: var(--cream); border-radius: 4px; font: 700 .86rem Arial,sans-serif; text-decoration: none; }
.printed-main { margin-top: 40px; }
.printed-copy { min-height: 155px; }
.printed-view { padding: clamp(20px,4vw,44px); background: #eee5d9; border: 1px solid var(--line); box-shadow: var(--shadow); }
.printed-view .card-image-button { width: min(900px,100%); margin: 0 auto; display: block; }
footer { padding: 36px 24px; text-align: center; color: #e9ded2; background: #3f352e; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

dialog { width: min(1000px, 94vw); padding: 14px; background: #302a25; border: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(25,19,16,.82); }
dialog img { width: 100%; max-height: 88vh; display: block; object-fit: contain; }
.close-dialog { position: absolute; top: 20px; right: 20px; width: 42px; height: 42px; color: white; background: rgba(30,25,22,.85); border: 1px solid rgba(255,255,255,.5); border-radius: 50%; font-size: 1.7rem; cursor: pointer; }

@media (max-width: 820px) {
  .section-heading, .subheading { align-items: stretch; flex-direction: column; }
  .search input { width: 100%; }
  .recipe-detail { grid-template-columns: 1fr; }
  .hero { min-height: 300px; }
  .hero-layout { grid-template-columns: 1fr; gap: 26px; }
  .hero-family-photo { width: min(330px, 86vw); margin: 0 auto; }
  .recipe-navigation { grid-template-columns: 1fr; }
  .recipe-nav-next { text-align: left; }
  .printed-callout { align-items: flex-start; flex-direction: column; }
  main { margin-top: -28px; }
}

@media print {
  .hero, .detail-header, .recipe-navigation, .section-heading, .original, .card-opener, .print-button, footer { display: none !important; }
  body, main, .collection, .recipe-card, .transcription { margin: 0; padding: 0; background: white; box-shadow: none; border: 0; }
  .recipe-detail { display: block; border: 0; }
}
