:root {
  --bg: #faf9f7;
  --text: #1a1a1a;
  --text-muted: #6b6660;
  --accent: #4a6741;
  --border: #e8e4df;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1100px;
  --content-width: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Site Header ─────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-logo {
  display: flex;
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.site-logo:hover {
  opacity: 0.7;
}

/* ─── Main & Footer ───────────────────────────── */

main {
  flex: 1;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Homepage Hero ───────────────────────────── */

.home-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  border-bottom: 1px solid var(--border);
}

.home-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.home-hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* ─── Tag Filter ──────────────────────────────── */

.tag-filter {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-pill {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tag-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

/* ─── Recipe Grid ─────────────────────────────── */

.recipe-grid {
  max-width: var(--max-width);
  margin: 1.5rem auto 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

/* ─── Recipe Card ─────────────────────────────── */

.recipe-card {
  background: var(--bg);
  display: flex;
  flex-direction: row;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  box-shadow: inset 0 -1px 0 0 var(--border);
  height: 220px;
}

.recipe-card:hover {
  background: #fff;
}

.recipe-card[hidden] {
  display: none;
}

.recipe-card__body {
  flex: 0 0 66.666%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.recipe-card:not(:has(.recipe-card__image)) .recipe-card__body {
  flex: 1;
}

.recipe-card__image {
  flex: 1;
  overflow: hidden;
}

.recipe-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s ease;
}

.recipe-card:hover .recipe-card__image img {
  transform: scale(1.05);
}

@media (max-width: 559px) {
  .recipe-card {
    flex-direction: column;
    height: auto;
  }

  .recipe-card__body {
    flex: 1;
  }

  .recipe-card__image {
    order: -1;
    flex: none;
    aspect-ratio: 16 / 9;
  }
}

.recipe-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.recipe-card__tag {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.recipe-card__tag + .recipe-card__tag::before {
  content: "·";
  margin-right: 0.3rem;
  color: var(--border);
}

.recipe-card__title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

.recipe-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.recipe-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

/* ─── Recipe Page ─────────────────────────────── */

.recipe-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--accent);
}

.recipe-header {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.recipe-header__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.recipe-header__tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.recipe-header__tag + .recipe-header__tag::before {
  content: "·";
  margin-right: 0.4rem;
  color: var(--border);
}

.recipe-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.recipe-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.75rem;
  max-width: 52ch;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.recipe-meta__item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.recipe-meta__label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.recipe-meta__value {
  font-size: 1rem;
  font-weight: 400;
}

/* ─── Recipe Image ────────────────────────────── */

.recipe-image {
  position: relative;
  margin: 0 -1.5rem 3rem;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.recipe-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  .recipe-image {
    margin: 0 0 3rem;
  }
}

/* ─── Recipe Body: two-column on tablet+ ─────── */

.recipe-body {
  display: grid;
  gap: 3rem;
}

@media (min-width: 640px) {
  .recipe-body {
    grid-template-columns: 200px 1fr;
    align-items: start;
  }
}

/* ─── Serving Counter ─────────────────────────── */

.serving-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.serving-counter__label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.serving-counter__controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.serving-counter__btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.serving-counter__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.serving-counter__value {
  font-size: 1rem;
  font-weight: 500;
  min-width: 1.5rem;
  text-align: center;
  color: var(--text);
}

/* ─── Ingredients ─────────────────────────────── */

.recipe-ingredients h2 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.recipe-ingredients ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.recipe-ingredients li {
  font-size: 0.9rem;
  line-height: 1.5;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border);
  color: var(--text);
}

/* ─── Recipe Content (Markdown body) ─────────── */

.recipe-content h2 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.recipe-content h2:first-child {
  margin-top: 0;
}

.recipe-content ol {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding-left: 1.5rem;
}

.recipe-content ol li {
  font-size: 0.95rem;
  line-height: 1.7;
  padding-left: 0.4rem;
}

.recipe-content ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 1.25rem;
}

.recipe-content ul li {
  font-size: 0.9rem;
  line-height: 1.6;
}

.recipe-content p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.recipe-content p + p {
  margin-top: 0.75rem;
}

/* ─── Print ───────────────────────────────────── */

@media print {
  .site-header,
  .site-footer,
  .back-link {
    display: none;
  }

  .recipe-page {
    padding: 0;
    max-width: 100%;
  }

  body {
    background: white;
    font-size: 11pt;
  }

  .recipe-body {
    grid-template-columns: 180px 1fr;
  }
}






/* ─── Recipe meta: menu button in row ────────── */

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.recipe-menu-btn {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.recipe-menu-btn:hover {
  border-color: var(--text);
  color: var(--text);
  background: #fff;
}

.recipe-menu-btn:active {
  transform: scale(0.94);
}

/* ─── Bottom sheet ────────────────────────────── */

.recipe-sheet {
  position: fixed;
  inset: 0;
  z-index: 9000;
}

.recipe-sheet[hidden] { display: none; }

.recipe-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.32s ease;
}

.recipe-sheet.is-open .recipe-sheet__backdrop {
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.recipe-sheet__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 540px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 0 1.75rem 2rem;
  height: 78vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.recipe-sheet.is-open .recipe-sheet__panel {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .recipe-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .recipe-sheet__panel {
    position: relative;
    border-radius: 16px;
    height: auto;
    max-height: 78vh;
    max-width: calc(var(--content-width) * 0.75);
    width: 100%;
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.28s ease;
  }
  .recipe-sheet.is-open .recipe-sheet__panel {
    transform: translateY(0);
    opacity: 1;
  }
  .recipe-sheet__handle {
    display: none;
  }
}

/* Handle */
.recipe-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 1rem auto 0;
  flex-shrink: 0;
  cursor: grab;
}

/* Header: title left, PDF right */
.recipe-sheet__header {
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recipe-sheet__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.recipe-sheet__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  flex: 1;
}


/* Serving row */
.recipe-sheet__serving {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.recipe-sheet__serving-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.recipe-sheet__serving-value {
  font-size: 1rem;
  font-weight: 500;
  min-width: 1.5rem;
  text-align: center;
  color: var(--text);
}

/* Ingredient list — scrollable middle section */
.recipe-sheet__list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  margin: 0 -1.75rem;
  padding: 0 1.75rem;
  -webkit-overflow-scrolling: touch;
}

.recipe-sheet__item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.recipe-sheet__item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.recipe-sheet__item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.recipe-sheet__item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.recipe-sheet__item label {
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
  transition: color 0.15s;
}

.recipe-sheet__item:has(input:not(:checked)) label {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Actions: two buttons side by side */
.recipe-sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding-top: 1.25rem;
  flex-shrink: 0;
}

.recipe-sheet__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 0.75rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  border: none;
  white-space: nowrap;
}

.recipe-sheet__btn:active { transform: scale(0.97); }

.recipe-sheet__btn--notes {
  background: var(--accent);
  color: #fff;
}
.recipe-sheet__btn--notes:hover { opacity: 0.88; }

.recipe-sheet__btn--share {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.recipe-sheet__btn--share:hover { background: #fff; border-color: var(--text-muted); }

/* Close button */
.recipe-sheet__close {
  margin-top: 0.6rem;
  width: 100%;
  padding: 0.65rem;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.recipe-sheet__close:hover { background: var(--border); color: var(--text); }

