:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f3ece0;
  --ink: #2b2622;
  --ink-soft: #6b625a;
  --line: #e6dccd;
  --accent: #b5532f;
  --accent-ink: #ffffff;
  --sage: #6b7f5e;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a17;
    --surface: #26221e;
    --surface-2: #2f2a25;
    --ink: #f1ebe3;
    --ink-soft: #b5aba0;
    --line: #3b352f;
    --accent: #e0805b;
    --accent-ink: #1d1a17;
    --sage: #9db08f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.6 var(--sans);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .4em; font-weight: 600; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 18px; font-weight: 600; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a.active { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 6px; text-decoration-thickness: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink) !important;
  border: 0; border-radius: 999px; padding: 12px 22px;
  font: 600 1rem var(--sans); text-decoration: none !important; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn { white-space: nowrap; }
@media (max-width: 440px) { .nav { gap: 12px; font-size: .95rem; } .nav .btn-small { padding: 7px 12px; } }
#nav-add .short { display: none; }
@media (max-width: 400px) { #nav-add .long { display: none; } #nav-add .short { display: inline; } }
.btn-ghost { background: transparent; color: var(--ink) !important; border: 1.5px solid var(--line); }
.btn-small { padding: 7px 16px; font-size: .95rem; }

.notice { background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: .95rem; text-align: center; padding: 8px 16px; }

main { padding-block: 32px 64px; min-height: 60vh; }
.loading, .empty { color: var(--ink-soft); text-align: center; padding: 64px 0; }

/* Hero */
.hero { text-align: center; padding: 24px 0 32px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.hero p { color: var(--ink-soft); font-size: 1.15rem; margin: 0 auto 24px; max-width: 34em; }
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-photo { padding-top: 8px; }
.family-photo { display: block; max-width: 1040px; margin: 0 auto 26px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.family-photo img { width: 100%; height: auto; transition: transform .6s ease; }
.family-photo:hover img { transform: scale(1.015); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 24px; }
.search {
  flex: 1 1 260px; min-width: 0;
  padding: 12px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
.search:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
select { padding: 11px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 5px 14px; font: 600 .9rem var(--sans); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Recipe cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: transform .15s ease;
}
.card:hover { transform: translateY(-3px); }
.card-img { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font: 700 4rem var(--serif); color: rgba(255, 255, 255, .9);
}
.card-body { padding: 16px 18px 18px; }
.card-body h3 { font-size: 1.3rem; margin-bottom: 4px; }
.meta { color: var(--ink-soft); font-size: .92rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sage); margin-bottom: 6px; }

/* Recipe page */
.back { display: inline-block; margin-bottom: 20px; text-decoration: none; font-weight: 600; }
.recipe-head { max-width: 760px; }
.recipe-head h1 { font-size: clamp(2rem, 5vw, 3rem); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-soft); margin: 10px 0 24px; }
.facts strong { color: var(--ink); font-weight: 600; }
.photos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 28px; }
.photos img { width: 100%; border-radius: var(--radius); max-height: 520px; object-fit: cover; }
.story {
  font-family: var(--serif); font-size: 1.2rem; font-style: italic;
  border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; margin: 0 0 32px; max-width: 760px;
}
.recipe-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 40px; }
@media (max-width: 760px) { .recipe-cols { grid-template-columns: 1fr; gap: 24px; } }
.panel { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients label { display: flex; gap: 10px; cursor: pointer; }
.ingredients input { accent-color: var(--accent); margin-top: 6px; flex: none; }
.ingredients input:checked + span { text-decoration: line-through; color: var(--ink-soft); }
.ingredients .subhead { font-weight: 700; border: 0; padding-top: 14px; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 48px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 700 .95rem var(--sans);
}
.notes { margin-top: 28px; background: var(--surface-2); border-radius: var(--radius); padding: 18px 22px; }
.notes h3 { font-size: 1.1rem; }
.recipe-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 0; }

.section-title { margin: 56px 0 18px; font-size: 1.7rem; }

/* Memories */
.memories { columns: 3 300px; column-gap: 22px; }
.memory {
  break-inside: avoid; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 0 0 22px; overflow: hidden;
}
.memory img { width: 100%; }
.memory-body { padding: 18px 20px 20px; }
.memory h3 { font-size: 1.25rem; }
.memory-text p { margin: 0 0 .8em; }
.memory .meta { margin-top: 10px; }
.recipe-link { display: inline-block; margin-top: 8px; font-weight: 600; font-size: .92rem; text-decoration: none; }

/* Share page */
.share { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; max-width: 860px; margin: 0 auto; }
.share .panel { text-align: center; padding: 36px 28px; }
.share .emoji { font-size: 2.6rem; }
.share p { color: var(--ink-soft); }

.site-footer { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .92rem; padding: 24px 0 40px; text-align: center; }

/* Comments & photos */
.muted { color: var(--ink-soft); }
.comments { max-width: 760px; }
.comment-list { display: grid; gap: 16px; margin-bottom: 24px; }
.comment { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 4px; }
.comment-head span { color: var(--ink-soft); font-size: .9rem; }
.comment-text p { margin: 0 0 .6em; }
.comment-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.comment-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.site-form { display: grid; gap: 14px; }
.site-form h3 { font-size: 1.25rem; margin: 0; }
.site-form label { display: grid; gap: 6px; font-weight: 600; }
.site-form input:not([type=file]), .site-form textarea, .site-form select {
  font: 400 1rem var(--sans); color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.site-form textarea { resize: vertical; }
.site-form select { border-radius: 10px; }
.site-form input:focus, .site-form textarea:focus, .site-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.photo-pick {
  display: inline-flex !important; width: fit-content; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: 999px; padding: 9px 18px; color: var(--ink);
}
.photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-pick:focus-within { outline: 2px solid var(--accent); }
.previews { display: flex; flex-wrap: wrap; gap: 8px; }
.previews:empty { display: none; }
.preview { position: relative; width: 88px; height: 88px; }
.preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.preview button {
  position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: var(--ink); color: var(--bg); font-size: 1rem; line-height: 1; cursor: pointer;
}
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-row .btn:disabled { opacity: .6; cursor: wait; }
.status { color: var(--ink-soft); }
.hp { position: absolute; left: -9999px; }

.label { display: block; font-weight: 600; margin-bottom: 6px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.add-form { max-width: 760px; }
.hero-left { text-align: left; padding-top: 0; }
.hero-left p { margin-left: 0; }

/* Cover photo */
.cover { position: relative; margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.cover img { width: 100%; max-height: 520px; object-fit: cover; }
.cover-empty .placeholder { height: 200px; font-size: 5rem; }
.cover-btn {
  position: absolute; right: 14px; bottom: 14px;
  background: var(--surface) !important; color: var(--ink) !important; box-shadow: var(--shadow);
}
.cover-empty .cover-btn { right: 50%; bottom: 50%; transform: translate(50%, 50%); }
.cover-form { max-width: 760px; margin-bottom: 28px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick { padding: 0; border: 3px solid transparent; border-radius: 12px; background: none; cursor: pointer; overflow: hidden; }
.pick img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pick[aria-pressed="true"] { border-color: var(--accent); }

/* Gallery */
.hero-tight { padding-bottom: 20px; }
.g-search { margin-bottom: 18px; }
.g-search .search { width: 100%; }
.g-suggest { margin: 12px 0 0; }
.g-status { min-height: 1.6em; margin: 10px 0 0; font-size: .95rem; }
.g-show .empty { padding: 40px 0; }
.g-show .empty .btn { margin-left: 8px; }
.memory-photo { display: block; }
.gallery { outline: none; }
.g-stage {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: #14110f; height: min(72vh, 680px); min-height: 320px; box-shadow: var(--shadow);
}
.g-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.2s ease; }
.g-slide.active { opacity: 1; z-index: 1; }
.g-backdrop { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); max-width: none; object-fit: cover; filter: blur(32px) brightness(.55); }
.g-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* Slow "Ken Burns" drift on the showing photo; four directions so it doesn't feel repetitive. */
.g-slide.active .g-photo { animation: kb 9s ease-out both; }
.kb-1.active .g-photo { animation-name: kb1; }
.kb-2.active .g-photo { animation-name: kb2; }
.kb-3.active .g-photo { animation-name: kb3; }
.paused .g-slide.active .g-photo { animation-play-state: paused; }
@keyframes kb  { from { transform: scale(1.0) translate(0, 0); }      to { transform: scale(1.08) translate(-1.5%, -1%); } }
@keyframes kb1 { from { transform: scale(1.08) translate(1.5%, 0); }  to { transform: scale(1.0) translate(0, 0); } }
@keyframes kb2 { from { transform: scale(1.0) translate(0, 1%); }     to { transform: scale(1.08) translate(1.5%, -1%); } }
@keyframes kb3 { from { transform: scale(1.08) translate(0, -1%); }   to { transform: scale(1.02) translate(-1%, 1%); } }
.g-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 3; background: rgba(255,255,255,.15); }
.g-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.g-nav {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 17, 15, .45); color: #fff; font-size: 2rem; line-height: 1;
  display: grid; place-items: center; transition: background .2s;
}
.g-nav:hover { background: rgba(20, 17, 15, .75); }
.g-prev { left: 12px; } .g-next { right: 12px; }
.g-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; color: #fff;
  padding: 64px 28px 22px; background: linear-gradient(transparent, rgba(0,0,0,.78));
  opacity: 0; transform: translateY(12px);
}
.g-caption.in { animation: capIn .9s .25s ease forwards; }
@keyframes capIn { to { opacity: 1; transform: none; } }
.g-caption h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: 4px; }
.g-text { margin: 0 0 6px; max-width: 46em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-meta { font-size: .92rem; opacity: .85; }
.g-caption a { color: #fff; font-weight: 600; font-size: .95rem; display: inline-block; margin-top: 6px; }
.g-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; }
.g-count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.g-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.g-thumb { flex: none; width: 76px; height: 76px; padding: 0; border: 3px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); opacity: .6; transition: opacity .2s, border-color .2s; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-thumb:hover { opacity: .9; }
.g-thumb[aria-current="true"] { opacity: 1; border-color: var(--accent); }
.gallery:fullscreen { background: #000; padding: 0; display: flex; flex-direction: column; }
.gallery:fullscreen .g-stage { flex: 1; height: auto; border-radius: 0; }
.gallery:fullscreen .g-controls { padding: 0 16px; color: #fff; }
.gallery:fullscreen .g-controls .btn-ghost { color: #fff !important; border-color: rgba(255,255,255,.3); }
.gallery:fullscreen .g-thumbs { padding: 0 16px 12px; }
@media (max-width: 600px) {
  .g-stage { height: 62vh; }
  .g-nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .g-caption { padding: 48px 18px 16px; }
  .g-full { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .g-slide { transition-duration: .3s; }
  .g-slide.active .g-photo { animation: none; }
  .g-caption.in { animation-duration: .2s; animation-delay: 0s; }
}

@media print {
  .site-header, .site-footer, .notice, .back, .recipe-actions, .comments, .cover-btn, .cover-form, .cover-empty, .section-title, .memories, .card-memories { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .panel { box-shadow: none; padding: 0; }
  .photos { display: none; }
  .ingredients input { display: none; }
}
