:root {
  --cream: #f7f2e9;
  --paper: #fffdf8;
  --ink: #26352d;
  --muted: #6c756e;
  --terracotta: #c95f3c;
  --terracotta-dark: #a8492d;
  --sage: #8c9c82;
  --line: #dfd8cc;
  --yellow: #f0c65d;
  --shadow: 0 18px 50px rgba(55, 42, 31, 0.11);
  --sans: "DM Sans", sans-serif;
  --serif: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  width: min(1180px, calc(100% - 48px));
  height: 92px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 23px; letter-spacing: -.4px; }
.brand strong { font-weight: 600; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--terracotta); }
.brand-mark svg { width: 21px; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.desktop-nav { display: flex; align-items: center; gap: 38px; margin-left: 100px; }
.desktop-nav a, .desktop-nav button { border: 0; background: none; padding: 8px 0; color: #59635d; cursor: pointer; font-size: 14px; }
.desktop-nav .active { color: var(--ink); border-bottom: 1px solid var(--terracotta); }
.primary-button, .secondary-button, .text-button { border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; }
.primary-button { min-height: 46px; padding: 0 22px; border-radius: 7px; background: var(--terracotta); color: white; box-shadow: 0 7px 18px rgba(201, 95, 60, .18); }
.primary-button:hover { background: var(--terracotta-dark); transform: translateY(-1px); }
.header-add { font-size: 13px; min-height: 42px; }
.header-add svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.hero { width: min(1180px, calc(100% - 48px)); min-height: 605px; margin: auto; display: grid; grid-template-columns: .88fr 1.12fr; gap: 85px; align-items: center; padding: 55px 0 80px; }
.hero-copy { padding-left: 4px; }
.eyebrow { margin: 0 0 18px; color: var(--terracotta); font-size: 11px; font-weight: 700; letter-spacing: 2.2px; }
h1, h2, blockquote { font-family: var(--serif); font-weight: 500; }
h1 { max-width: 520px; margin: 0; font-size: clamp(52px, 5vw, 75px); line-height: .98; letter-spacing: -2.5px; }
h1 em { position: relative; color: var(--terracotta); font-weight: 500; }
h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; border-top: 2px solid var(--terracotta); border-radius: 50%; transform: rotate(-2deg); }
.hero-text { max-width: 475px; margin: 29px 0 28px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; gap: 28px; }
.text-button { padding: 12px 0; background: none; border-bottom: 1px solid #9ba19d; }
.text-button span { color: var(--terracotta); font-size: 20px; }
.hero-note { display: flex; align-items: center; gap: 12px; margin-top: 52px; color: #7a817d; font-size: 12px; }
.avatar-pair { display: flex; }
.avatar-pair i { position: relative; width: 43px; height: 43px; display: grid; place-items: center; margin-right: -5px; overflow: visible; border: 2px solid var(--cream); border-radius: 50%; background: var(--sage); color: white; font-size: 10px; font-style: normal; cursor: help; }
.avatar-pair i img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-pair i::after { content: attr(data-name); position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 8px); width: max-content; padding: 6px 9px; border-radius: 5px; background: var(--ink); color: white; font-family: var(--sans); font-size: 10px; font-weight: 600; opacity: 0; pointer-events: none; transform: translate(-50%, 4px); transition: .18s; }
.avatar-pair i:hover::after, .avatar-pair i:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.avatar-pair i:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }
.avatar-pair i:last-child { background: var(--yellow); color: #705a26; }
.avatar-pair i:nth-child(2) { border-color: #e2bc59; }
.avatar-pair i:nth-child(3) { border-color: #d89991; }
.avatar-pair i:nth-child(4) { border-color: #718b83; }
.avatar-pair i:nth-child(5) { border-color: var(--terracotta); }
.hero-visual { position: relative; min-height: 490px; }
.hero-image-wrap { position: absolute; inset: 0 0 0 35px; overflow: hidden; border-radius: 46% 46% 9% 9% / 24% 24% 9% 9%; box-shadow: var(--shadow); }
.hero-image-wrap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(140deg, transparent 60%, rgba(46, 56, 43, .14)); }
.hero-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.recipe-note-card { position: absolute; left: -28px; bottom: 48px; z-index: 2; width: 205px; padding: 18px 20px; transform: rotate(-3deg); background: #fffaf0; box-shadow: 0 10px 30px rgba(59, 40, 25, .18); }
.recipe-note-card::before { content: ""; position: absolute; width: 58px; height: 18px; top: -10px; left: 72px; background: rgba(230, 200, 148, .65); transform: rotate(2deg); }
.recipe-note-card span { display: block; color: #7a756e; font-size: 10px; letter-spacing: 1px; }
.recipe-note-card strong { display: block; margin: 9px 0 6px; font-family: var(--serif); font-size: 18px; }

.recipes-section { background: var(--paper); padding: 92px max(24px, calc((100vw - 1180px) / 2)) 100px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 34px; }
h2 { margin: 0; font-size: clamp(38px, 4vw, 52px); letter-spacing: -1px; }
.search-box { width: 315px; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.search-box:focus-within { border-color: var(--sage); outline: 3px solid rgba(140, 156, 130, .13); }
.search-box svg { width: 18px; fill: none; stroke: #878e89; stroke-width: 1.7; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.filter-row { display: flex; gap: 9px; margin-bottom: 34px; overflow-x: auto; scrollbar-width: none; }
.filter-chip { flex: 0 0 auto; min-width: 83px; padding: 9px 17px; border: 1px solid var(--line); border-radius: 30px; background: transparent; color: #68706b; cursor: pointer; font-size: 12px; }
.filter-chip:hover, .filter-chip.active { border-color: var(--ink); background: var(--ink); color: white; }
.filter-chip.safe-chip { border-color: #789177; color: #4f704f; }
.filter-chip.safe-chip.active, .filter-chip.safe-chip:hover { background: #587257; color: white; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 29px; }
.recipe-card { min-width: 0; cursor: pointer; }
.card-image { position: relative; height: 285px; overflow: hidden; border-radius: 12px; background: #e8e2d8; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.recipe-card:hover .card-image img { transform: scale(1.035); }
.category-label { position: absolute; left: 14px; top: 14px; padding: 7px 10px; border-radius: 4px; background: rgba(255, 253, 248, .92); color: var(--terracotta-dark); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; backdrop-filter: blur(5px); }
.safe-label { position: absolute; left: 14px; bottom: 14px; padding: 7px 10px; border-radius: 4px; background: rgba(75, 108, 75, .94); color: white; font-size: 9px; font-weight: 700; letter-spacing: .5px; }
.favorite-button { position: absolute; right: 13px; top: 13px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 253, 248, .92); cursor: pointer; }
.favorite-button svg { width: 18px; fill: transparent; stroke: var(--terracotta); stroke-width: 1.8; transition: .2s; }
.favorite-button.active svg { fill: var(--terracotta); }
.card-body { padding: 18px 3px 0; }
.card-body h3 { margin: 0 0 9px; font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -.3px; }
.card-body p { min-height: 42px; margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.card-meta { display: flex; gap: 18px; padding-top: 14px; border-top: 1px solid #e7e1d7; color: #737a75; font-size: 11px; }
.card-meta span { display: flex; align-items: center; gap: 6px; }
.card-meta svg { width: 15px; fill: none; stroke: var(--terracotta); stroke-width: 1.7; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state > span { font-size: 46px; }
.empty-state h3 { margin: 10px 0 5px; color: var(--ink); font-family: var(--serif); font-size: 26px; }
.empty-state p { margin: 0; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 48px; }
.load-more-wrap[hidden] { display: none; }
.load-more-wrap .secondary-button { min-width: 180px; background: var(--paper); }
.load-more-wrap .secondary-button:hover { border-color: var(--ink); }

.story-section { padding: 100px 24px; text-align: center; }
.story-section blockquote { max-width: 720px; margin: 0 auto 20px; font-size: clamp(32px, 4vw, 50px); line-height: 1.15; }
.story-section > p { color: var(--muted); }
.coco-memory { width: min(680px, 100%); margin: 60px auto 0; display: grid; grid-template-columns: 240px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); text-align: left; }
.coco-memory img { width: 100%; height: 100%; min-height: 270px; object-fit: cover; }
.coco-memory figcaption { display: flex; flex-direction: column; justify-content: center; padding: 35px 40px; }
.coco-memory figcaption span { color: var(--terracotta); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; }
.coco-memory figcaption strong { margin: 8px 0 12px; font-family: var(--serif); font-size: 42px; font-weight: 500; }
.coco-memory figcaption p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
footer { min-height: 95px; padding: 24px max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer .brand { color: var(--ink); font-size: 20px; }

dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(27, 34, 30, .6); }
dialog::backdrop { background: rgba(27, 34, 30, .6); backdrop-filter: blur(4px); }
.dialog-shell { position: relative; width: min(1000px, calc(100% - 40px)); max-height: calc(100vh - 40px); margin: 20px auto; overflow-y: auto; border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); cursor: pointer; font-size: 25px; line-height: 1; }
.dialog-close { position: absolute; z-index: 3; right: 18px; top: 18px; }
.detail-hero { display: grid; grid-template-columns: 1fr 1fr; min-height: 390px; }
.detail-hero img { width: 100%; height: 100%; min-height: 390px; object-fit: cover; }
.detail-intro { display: flex; flex-direction: column; justify-content: center; padding: 56px; }
.detail-intro h2 { font-size: 48px; line-height: 1; }
.detail-intro > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.detail-actions { display: flex; gap: 10px; margin-top: 27px; }
.allergen-notice { margin-top: 22px; padding: 13px 15px; border-radius: 7px; background: #f7e5dd; color: #86432f; font-size: 12px; line-height: 1.5; }
.allergen-notice.safe { background: #e5eee2; color: #476345; }
.allergen-notice strong { display: block; margin-bottom: 3px; }
.secondary-button { min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 7px; background: transparent; }
.detail-content { display: grid; grid-template-columns: .8fr 1.2fr; gap: 60px; padding: 55px; }
.detail-content h3 { margin: 0 0 25px; font-family: var(--serif); font-size: 30px; }
.ingredient-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { padding: 12px 0; border-bottom: 1px solid var(--line); color: #4f5a53; font-size: 14px; }
.detail-content .utensils-title { margin-top: 38px; margin-bottom: 15px; }
.utensil-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.utensil-list li { padding: 7px 10px; border-radius: 5px; background: #eee7dc; color: #5e675f; font-size: 11px; }
.steps-list { margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.steps-list li { position: relative; min-height: 54px; margin-bottom: 23px; padding-left: 52px; color: #4f5a53; line-height: 1.65; }
.steps-list li::before { counter-increment: steps; content: counter(steps); position: absolute; left: 0; top: -5px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #eee5d8; color: var(--terracotta); font-family: var(--serif); font-size: 19px; font-weight: 600; }

.form-dialog { overflow-y: auto; padding: 25px 0; }
.recipe-form { width: min(760px, calc(100% - 32px)); margin: auto; padding: 38px 45px; border-radius: 15px; background: var(--paper); }
.form-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 25px; }
.form-heading h2 { font-size: 42px; }
.photo-upload { position: relative; height: 180px; margin-bottom: 25px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed #b8b1a7; border-radius: 10px; cursor: pointer; color: var(--muted); }
.photo-upload input { position: absolute; opacity: 0; }
.photo-upload .upload-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 7px; border-radius: 50%; background: #eee6da; color: var(--terracotta); font-size: 22px; }
.photo-upload strong { color: var(--ink); font-size: 13px; }
.photo-upload small { margin-top: 4px; font-size: 10px; }
.photo-upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; color: #525b56; font-size: 12px; font-weight: 600; }
.field.full { grid-column: 1 / -1; }
.field small { color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: white; color: var(--ink); font-size: 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sage); outline: 3px solid rgba(140, 156, 130, .12); }
.allergen-field { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.allergen-field legend { padding: 0 5px; color: #525b56; font-size: 12px; font-weight: 700; }
.allergen-field p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.allergen-options { display: flex; flex-wrap: wrap; gap: 9px; }
.allergen-options label { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 6px; background: #f2ede4; color: #525b56; cursor: pointer; font-size: 11px; }
.allergen-options .none-option { background: #e5eee2; color: #476345; }
.allergen-options input { accent-color: var(--terracotta); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 28px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 25px; padding: 12px 18px; border-radius: 7px; background: var(--ink); color: white; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.user-button { min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); cursor: pointer; font-size: 12px; font-weight: 700; }
.auth-gate { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--cream); text-align: center; }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(520px, 100%); padding: 55px 45px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card .brand-mark { margin: 0 auto 25px; }
.auth-card h1 { font-size: clamp(42px, 7vw, 62px); }
.auth-card > p:not(.eyebrow, .auth-error) { margin: 25px auto; color: var(--muted); line-height: 1.65; }
.google-button { min-height: 50px; display: inline-flex; align-items: center; gap: 12px; padding: 0 22px; border: 1px solid var(--line); border-radius: 7px; background: white; cursor: pointer; color: #3c4540; font-weight: 700; }
.google-button:hover { box-shadow: 0 7px 20px rgba(55, 42, 31, .1); }
.google-button svg { width: 21px; }
.auth-error { min-height: 20px; margin: 15px 0 0; color: var(--terracotta-dark); font-size: 12px; }
.author-line { margin-top: 9px; color: var(--terracotta); font-size: 11px; font-weight: 700; }

@media (max-width: 850px) {
  .desktop-nav { display: none; }
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 45px; }
  .hero-copy { text-align: center; }
  .hero-text { margin-left: auto; margin-right: auto; }
  .hero-actions, .hero-note { justify-content: center; }
  .hero-visual { min-height: 520px; }
  .hero-image-wrap { left: 0; }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading { align-items: start; flex-direction: column; }
  .search-box { width: 100%; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-hero img { min-height: 300px; height: 300px; }
  .detail-content { gap: 35px; padding: 40px 30px; }
}

@media (max-width: 560px) {
  .site-header { width: calc(100% - 30px); height: 74px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 31px; height: 31px; }
  .header-add { width: 42px; min-height: 42px; padding: 0; font-size: 0; }
  .user-button { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .auth-card { padding: 40px 22px; }
  .hero { width: calc(100% - 32px); padding: 40px 0 62px; }
  h1 { font-size: 49px; }
  .hero-visual { min-height: 400px; }
  .hero-image-wrap { inset: 0; }
  .recipe-note-card { left: -8px; bottom: 20px; }
  .hero-doodle { display: none; }
  .hero-note { align-items: flex-start; }
  .coco-memory { grid-template-columns: 1fr; }
  .coco-memory img { height: 310px; min-height: 0; }
  .coco-memory figcaption { padding: 28px; text-align: center; }
  .recipes-section { padding-top: 65px; padding-bottom: 70px; }
  .recipe-grid { grid-template-columns: 1fr; gap: 38px; }
  .card-image { height: 300px; }
  footer { flex-direction: column; gap: 9px; text-align: center; }
  .dialog-shell { width: 100%; max-height: none; min-height: 100%; margin: 0; border-radius: 0; }
  .detail-hero img { min-height: 250px; height: 250px; }
  .detail-intro { padding: 35px 24px; }
  .detail-intro h2 { font-size: 39px; }
  .detail-content { grid-template-columns: 1fr; padding: 38px 24px; }
  .form-dialog { padding: 0; }
  .recipe-form { width: 100%; min-height: 100%; padding: 28px 20px; border-radius: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .photo-upload { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
