/* The Karle Family Kitchen
   Deep pine, warm cream, brass. Fraunces for display, Inter for text. */

:root {
  --pine: #1d3a2a;
  --pine-deep: #122a1e;
  --pine-ink: #0e2117;
  --cream: #faf6ec;
  --cream-soft: #f4eedd;
  --card: #fffdf6;
  --ink: #232820;
  --ink-soft: #3c4238;
  --muted: #66705f;
  --brass: #b9903f;
  --brass-deep: #8a6c2a;
  --line: #e4dcc4;
  --tag-bg: #f1e9d2;
  --radius: 14px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  background: var(--cream);
}

::selection { background: var(--pine); color: #fff; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.4rem;
}

a { color: var(--pine); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header ---------- */

.site-header {
  background: var(--pine-deep);
  border-bottom: 3px solid var(--brass);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand:hover { color: #fff; }

.site-header nav { display: flex; gap: 1.4rem; }

.site-header nav a {
  color: #cfd6c6;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.site-header nav a:hover { color: #fff; }
.site-header nav a.active { color: var(--brass); }

/* ---------- Hero collage ---------- */

.hero-collage {
  position: relative;
  overflow: hidden;
  background: var(--pine-ink);
  color: #fff;
}

.collage-bg {
  position: absolute;
  inset: 0;
}

.collage-bg .ph {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.8s ease;
}

.collage-bg .ph.active { opacity: 1; }

.collage-bg .ph.active {
  animation: collageZoom 8s ease-out forwards;
}

@keyframes collageZoom {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 33, 23, 0.78) 0%,
    rgba(14, 33, 23, 0.55) 45%,
    rgba(14, 33, 23, 0.85) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 6.5rem 1.4rem 5.5rem;
  max-width: 46rem;
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--pine);
}

.eyebrow.light { color: var(--brass); }

.hero-content h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1.05;
  margin: 0 0 1.1rem;
  letter-spacing: 0.005em;
  color: #fff;
}

.hero-content .lede {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.12rem;
  max-width: 34rem;
  margin: 0 auto;
}

.cta-row {
  margin: 2rem 0 0;
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  background: var(--brass);
  color: var(--pine-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  border: 1px solid var(--brass);
  transition: background 0.18s, transform 0.18s;
}

.btn:hover { background: #c9a254; transform: translateY(-1px); }

.btn.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }

.stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  margin: 2.6rem 0 0;
}

.stats strong {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  color: #fff;
  line-height: 1.1;
}

.stats span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- Page head & section head ---------- */

.page-head { padding: 2.4rem 0 0.5rem; }
.page-head h1 { margin: 0 0 0.6rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.6rem 0 1.2rem;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 0; font-size: 0.95rem; }
.section-head a { text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

/* ---------- How it works ---------- */

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin: 2.6rem 0 0.6rem;
}

.how-step {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--pine);
  border-radius: var(--radius);
  padding: 1.5rem 1.3rem 1.35rem;
  text-align: center;
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.06);
}

.how-num {
  display: inline-flex;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--pine);
  color: #fff;
  font-family: var(--serif);
  font-size: 1.15rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.7rem;
}

.how-step h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.22rem;
  margin: 0 0 0.35rem;
}

.how-step p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Controls ---------- */

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 2.2rem auto 2.4rem;
  max-width: 640px;
}

#search {
  padding: 0.8rem 1.3rem;
  font-size: 1rem;
  font-family: var(--sans);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
  box-shadow: 0 2px 8px rgba(29, 58, 42, 0.05);
}

#search::placeholder { color: #a09a83; }

#search:focus {
  outline: 2px solid var(--pine);
  outline-offset: 1px;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; }

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.36rem 1.05rem;
  font-size: 0.86rem;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip:hover { border-color: var(--pine); color: var(--pine); }

.chip.active {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
  font-weight: 600;
}

/* ---------- Recipe grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1.7rem;
  padding-bottom: 4rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(29, 58, 42, 0.13);
}

.card-media {
  position: relative;
  overflow: hidden;
  background: var(--tag-bg);
}

.card-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.card:hover .card-media img { transform: scale(1.045); }

.card-media .view {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.6rem 1.1rem 0.85rem;
  background: linear-gradient(transparent, rgba(14, 33, 23, 0.8));
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card:hover .card-media .view,
.card:focus-visible .card-media .view { opacity: 1; }

.card-body { padding: 1.05rem 1.2rem 1.3rem; }

.card-tag {
  display: inline-block;
  color: var(--pine);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.42rem;
  line-height: 1.25;
  margin: 0 0 0.3rem;
}

.card .byline {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  font-family: var(--serif);
  margin: 0;
}

.example-ribbon {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-deep);
  border: 1px dashed var(--brass);
  border-radius: 6px;
  padding: 0.18rem 0.6rem;
  background: #fbf3df;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  padding: 2rem 0 4rem;
}

/* ---------- Recipe detail ---------- */

.back { margin: 1.6rem 0 0; font-size: 0.92rem; }
.back a { text-decoration: none; }
.back a:hover { text-decoration: underline; }

.recipe-head { margin: 1.1rem 0 1.6rem; max-width: 46rem; }

.recipe-head .card-tag { margin-bottom: 0.6rem; }

.recipe-head h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.5vw, 2.9rem);
  line-height: 1.1;
  margin: 0 0 0.45rem;
}

.recipe-head .byline {
  color: var(--muted);
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
}

.recipe-head .desc {
  margin: 1.1rem 0 0;
  font-size: 1.06rem;
  color: var(--ink-soft);
}

.recipe-head .desc.lede {
  font-size: 1.06rem;
  color: var(--ink-soft);
}

.recipe-photo {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--tag-bg);
  display: block;
  margin-bottom: 2rem;
  box-shadow: 0 12px 34px rgba(29, 58, 42, 0.12);
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2.2rem;
  padding: 1.15rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--pine);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.05);
}

.meta-row div span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.meta-row div strong {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 500;
}

.two-col {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 2.4rem;
  padding-bottom: 1rem;
  align-items: start;
}

@media (max-width: 740px) {
  .two-col { grid-template-columns: 1fr; }
}

.two-col h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

ul.ingredients {
  list-style: none;
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.05);
}

ul.ingredients li {
  padding: 0.42rem 0 0.42rem 1.7rem;
  position: relative;
  border-bottom: 1px dotted var(--line);
}

ul.ingredients li:last-child { border-bottom: none; }

ul.ingredients li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.95rem;
  width: 7px;
  height: 7px;
  background: var(--brass);
  transform: rotate(45deg);
}

ol.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}

ol.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.3rem 3.4rem;
}

ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.15rem;
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--pine);
  width: 2.6rem;
}

ol.steps li::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 2.2rem;
  bottom: 0.1rem;
  width: 1px;
  background: var(--line);
}

ol.steps li:last-child::after { display: none; }

.note-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brass);
  border-radius: 0 10px 10px 0;
  padding: 1.1rem 1.35rem;
  margin: 0 0 2.2rem;
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.06);
  max-width: 46rem;
}

.note-box h3 {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--pine);
}

.note-box p { margin: 0.35rem 0; font-size: 0.96rem; }
.note-box .ref { font-weight: 700; }

.source-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  font-family: var(--serif);
  padding: 1.6rem 0 3.5rem;
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}

/* ---------- About page ---------- */

.about { padding: 2.6rem 0 3.5rem; max-width: 44rem; }

.about h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  margin: 0 0 1rem;
}

.about h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  margin: 2.2rem 0 0.6rem;
  color: var(--pine);
}

.about p { color: var(--ink-soft); }

.about .standfirst {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--ink);
  border-left: 3px solid var(--brass);
  padding-left: 1.1rem;
  margin: 1.4rem 0 2rem;
}

/* ---------- Family gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin: 1.4rem 0 0.4rem;
}

.gallery figure { margin: 0; }

.gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--tag-bg);
  display: block;
  box-shadow: 0 3px 14px rgba(29, 58, 42, 0.07);
  transition: transform 0.3s ease;
}

.gallery figure:hover img { transform: scale(1.03); }

.gallery-note {
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  margin: 1.4rem 0 0.4rem;
}

/* ---------- Read aloud ---------- */

.read-aloud { margin: 0 0 1.9rem; }

.read-aloud .btn {
  border: 1px solid var(--brass);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.92rem;
}

.read-aloud .btn::before {
  content: "\25B6\2002";
  font-size: 0.8em;
}

.read-aloud .btn[aria-pressed="true"]::before {
  content: "\25A0\2002";
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--pine-deep);
  border-top: 3px solid var(--brass);
  text-align: center;
  color: #b9c2ae;
  font-size: 0.9rem;
  padding: 2.2rem 1.2rem;
}

.site-footer .colophon {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--cream);
}

.site-footer p { margin: 0.3rem 0; }

.site-footer a { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: #ffffff; }

/* ---------- Cook mode: checkable ingredients & steps ---------- */

#recipe-body { scroll-margin-top: 96px; }

.jump-row {
  margin: 1.3rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

ul.ingredients li { cursor: pointer; }

ul.ingredients li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.78rem;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--brass-deep);
  border-radius: 4px;
  background: transparent;
  transform: none;
}

ul.ingredients li.done::before { background: var(--pine); border-color: var(--pine); }

ul.ingredients li.done::after {
  content: "\2713";
  position: absolute;
  left: 0.32rem;
  top: 0.52rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

ul.ingredients li.done span {
  text-decoration: line-through;
  color: var(--muted);
}

ol.steps li { cursor: pointer; border-radius: 8px; }

ol.steps li.done::before {
  content: "\2713";
  color: var(--brass-deep);
  font-size: 1.6rem;
  top: 0;
}

ol.steps li.done .step-text {
  color: var(--muted);
  text-decoration: line-through;
}

.cook-hint {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
  margin: 0 0 1rem;
}

/* ---------- Print: recipes print cleanly ---------- */

@media print {
  .site-header,
  .hero-collage,
  .controls,
  .back,
  .read-aloud,
  .jump-row,
  .site-footer,
  .example-ribbon,
  .cook-hint { display: none !important; }

  body { background: #fff; font-size: 11pt; }

  .wrap { max-width: none; }

  a { color: inherit; text-decoration: none; }

  .recipe-photo { max-height: 240px; box-shadow: none; }

  .two-col { grid-template-columns: 1fr; gap: 1.2rem; }

  .card, .how-step, ul.ingredients, .note-box, .meta-row { box-shadow: none; }

  ol.steps li::after { display: none; }

  ul.ingredients li, ol.steps li { cursor: default; }
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 1rem; }
  .header-inner {
    flex-wrap: wrap;
    gap: 0.55rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }
  .brand { font-size: 1.15rem; }
  .site-header nav { gap: 1rem; flex-wrap: wrap; }
  .site-header nav a { font-size: 0.76rem; }
  .hero-content { padding: 4.2rem 1.2rem 3.6rem; }
  .hero-content h1 { font-size: 2.4rem; }
  .hero-content .lede { font-size: 1rem; }
  .cta-row { flex-direction: column; align-items: stretch; }
  .cta-row .btn { text-align: center; }
  .stats { gap: 1.8rem; }
  .how { grid-template-columns: 1fr; gap: 0.9rem; margin-top: 1.8rem; }
  .controls { margin: 1.6rem auto 1.8rem; }
  #search { font-size: 16px; padding: 0.85rem 1.2rem; }
  .chip { min-height: 44px; font-size: 0.9rem; }
  .grid { grid-template-columns: 1fr; gap: 1.2rem; padding-bottom: 3rem; }
  .card-media img { aspect-ratio: 16 / 10; }
  .recipe-photo { max-height: 300px; margin-bottom: 1.4rem; }
  .meta-row { padding: 1rem 1.1rem; gap: 0.7rem; }
  .two-col { gap: 1.6rem; }
  ol.steps li { padding-left: 2.9rem; padding-bottom: 1.1rem; }
  ol.steps li::before { font-size: 1.5rem; width: 2.1rem; }
  ol.steps li::after { left: 0.68rem; }
  .btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
  .read-aloud .btn { width: 100%; }
  .about { padding: 1.8rem 0 2.8rem; }
  .site-footer { padding: 1.8rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card-media img, .card-media .view, .gallery img, .btn { transition: none; }
  .card:hover { transform: none; }
  .collage-bg .ph { transition: none; }
  .collage-bg .ph.active { animation: none; }
}

.btn.outline {
  background: transparent;
  color: var(--pine-ink);
  border: 1px solid var(--pine);
}

.btn.outline:hover { background: rgba(27, 58, 46, 0.08); }

.edit-form {
  display: grid;
  gap: 1.1rem;
  margin: 1.6rem 0 2rem;
}

.edit-field { display: grid; gap: 0.4rem; }

.edit-field > span {
  font-weight: 600;
  font-size: 0.92rem;
}

.edit-field > span em {
  font-weight: 400;
  font-style: italic;
  opacity: 0.7;
}

.edit-field input,
.edit-field textarea {
  font: inherit;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(27, 58, 46, 0.35);
  border-radius: 0.6rem;
  background: #fff;
  color: var(--pine-ink);
  width: 100%;
  box-sizing: border-box;
}

.edit-field textarea { resize: vertical; line-height: 1.5; }

.edit-field input:focus,
.edit-field textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
  border-color: var(--pine);
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.edit-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

@media (max-width: 640px) {
  .edit-grid { grid-template-columns: 1fr; }
}
