/* ── VARIABLES ── */
:root {
  --bg: #141413;
  --text: #f0ede8;
  --text-soft: rgba(240, 237, 232, 0.68);
  --text-faint: rgba(240, 237, 232, 0.38);
  --rule: rgba(240, 237, 232, 0.1);
  --rule-mid: rgba(240, 237, 232, 0.18);
  --btn-fill: #f0ede8;
  --btn-text: #0d0d0d;
}

[data-theme="light"] {
  --bg: #f8f5f0;
  --text: #1a1916;
  --text-soft: rgba(26, 25, 22, 0.65);
  --text-faint: rgba(26, 25, 22, 0.38);
  --rule: rgba(26, 25, 22, 0.1);
  --rule-mid: rgba(26, 25, 22, 0.22);
  --btn-fill: #1a1916;
  --btn-text: #f8f5f0;
}

/* ── RESET ── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html { scroll-behavior: smooth; }
body {
  font-family: "EB Garamond", Georgia, serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.75;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── NAVIGATION ── */
nav {
  position: fixed; top: 0; left: 0; width: 100%;
  z-index: 100; padding: 0;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease;
}
nav.scrolled {
  background: rgba(20, 20, 19, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--rule);
}
[data-theme="light"] nav.scrolled {
  background: rgba(248, 245, 240, 0.92);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 1.1rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
}
.logo {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; color: var(--text);
}
.nav-links {
  display: flex; gap: 2.2rem; list-style: none; align-items: center;
}
.nav-links a {
  font-family: "Inter", sans-serif; font-size: 0.82rem;
  font-weight: 400; text-decoration: none;
  color: var(--text-soft); transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem; font-weight: 400;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--rule-mid);
  color: var(--text-soft);
  padding: 0.45rem 1rem;
  border-radius: 8px; cursor: pointer;
  transition: all 0.2s ease; white-space: nowrap;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 10rem 2rem 6rem;
  max-width: 900px; margin: 0 auto;
}
.hero-eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem; font-weight: 300;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 1.75rem;
  opacity: 0; animation: reveal 0.9s ease forwards 0.3s;
}
.hero h1 {
  font-family: "EB Garamond", serif;
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 400; line-height: 1.03;
  letter-spacing: -0.01em; margin-bottom: 2rem;
  opacity: 0; animation: reveal 0.9s ease forwards 0.5s;
}
.hero h1 em { font-style: italic; color: var(--text-soft); }
.hero-sub {
  max-width: 480px; font-size: 1.15rem;
  color: var(--text-soft); line-height: 1.7;
  margin-bottom: 3rem;
  opacity: 0; animation: reveal 0.9s ease forwards 0.7s;
}
.hero-actions {
  display: flex; gap: 1rem; align-items: center;
  opacity: 0; animation: reveal 0.9s ease forwards 0.9s;
}
.btn {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem; font-weight: 500;
  text-decoration: none; padding: 0.7rem 1.6rem;
  border-radius: 10px; transition: opacity 0.2s ease;
  display: inline-block;
}
.btn-primary { background: var(--btn-fill); color: var(--btn-text); }
.btn-primary:hover { opacity: 0.86; }
.btn-ghost {
  background: transparent; color: var(--text-soft);
  border: 1px solid var(--rule-mid);
}
.btn-ghost:hover { border-color: rgba(240,237,232,0.5); color: var(--text); }

/* ── SECTIONS (base) ── */
section {
  scroll-margin-top: 5rem;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
section.visible { opacity: 1; transform: translateY(0); }

/* ── FILTER BAR ── */
.recipe-container {
  max-width: 1100px; margin: 0 auto;
  padding: 0 2rem 8rem;
}
.controls-bar {
  display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
  padding-top: 4rem; margin-bottom: 3rem;
}
.filter-bar {
  display: flex; gap: 0.6rem; flex-shrink: 0;
}
.search-input {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem; font-weight: 300;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  width: 220px;
  outline: none;
  transition: border-color 0.2s ease;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { border-color: var(--rule-mid); }
.filter-btn {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text-faint);
  padding: 0.45rem 1.25rem;
  border-radius: 8px; cursor: pointer;
  transition: all 0.2s ease;
}
.filter-btn.active,
.filter-btn:hover { border-color: var(--rule-mid); color: var(--text); }

/* ── RECIPE GRID ── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.recipe-card {
  text-decoration: none; color: var(--text);
  display: block;
  border: 1px solid var(--rule);
  border-radius: 12px; overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
  background: transparent;
}
.recipe-card:hover { border-color: var(--rule-mid); transform: translateY(-3px); }

.card-image {
  aspect-ratio: 4/3;
  position: relative; overflow: hidden;
}
.card-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.card-placeholder.dolci { background: linear-gradient(135deg, #2a1e14 0%, #3d2c1e 100%); }
.card-placeholder.salato { background: linear-gradient(135deg, #141e2a 0%, #1e2c3d 100%); }
[data-theme="light"] .card-placeholder.dolci { background: linear-gradient(135deg, #f0e4d0 0%, #e2d0b5 100%); }
[data-theme="light"] .card-placeholder.salato { background: linear-gradient(135deg, #d0e4f0 0%, #b5d5e8 100%); }
.card-emoji { font-size: 3rem; opacity: 0.6; }

.card-image img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.recipe-card:hover .card-image img { transform: scale(1.05); }

.card-body {
  padding: 1.1rem 1.25rem 1.3rem;
  border-top: 1px solid var(--rule);
}
.card-meta {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 0.5rem;
}
.card-category {
  font-family: "Inter", sans-serif;
  font-size: 0.63rem; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
}
.card-time {
  font-family: "DM Mono", monospace;
  font-size: 0.65rem; font-weight: 300; color: var(--text-faint);
}
.card-title {
  font-family: "EB Garamond", serif;
  font-size: 1.2rem; font-weight: 500;
  line-height: 1.25; color: var(--text);
  margin-bottom: 0.2rem;
}
.card-portions {
  font-family: "Inter", sans-serif;
  font-size: 0.68rem; color: var(--text-faint); margin-top: 0.2rem;
}
.grid-loading, .grid-empty {
  grid-column: 1 / -1;
  font-family: "Inter", sans-serif; font-size: 0.85rem;
  color: var(--text-faint); text-align: center; padding: 5rem 0;
  letter-spacing: 0.04em;
}

/* ── RECIPE DETAIL — HERO ── */
.recipe-hero {
  position: relative;
  height: 62vh; min-height: 380px; max-height: 580px;
  display: flex; align-items: flex-end; overflow: hidden;
}
.recipe-hero-bg { position: absolute; inset: 0; }
.recipe-hero-img {
  width: 100%; height: 100%; object-fit: cover;
}
.recipe-hero-placeholder {
  width: 100%; height: 100%;
}
.recipe-hero-placeholder.dolci { background: linear-gradient(135deg, #2a1e14 0%, #3d2c1e 100%); }
.recipe-hero-placeholder.salato { background: linear-gradient(135deg, #141e2a 0%, #1e2c3d 100%); }
[data-theme="light"] .recipe-hero-placeholder.dolci { background: linear-gradient(135deg, #e8d5b5 0%, #d4c0a0 100%); }
[data-theme="light"] .recipe-hero-placeholder.salato { background: linear-gradient(135deg, #b5d5e8 0%, #a0c0d4 100%); }

.recipe-hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20,20,19,0.95) 0%, rgba(20,20,19,0.35) 55%, transparent 100%);
}
[data-theme="light"] .recipe-hero-gradient {
  background: linear-gradient(to top, rgba(248,245,240,0.95) 0%, rgba(248,245,240,0.4) 55%, transparent 100%);
}
.recipe-hero-content {
  position: relative; z-index: 2;
  width: 100%; max-width: 1100px;
  margin: 0 auto; padding: 0 2rem 3.5rem;
}
.recipe-hero-emoji {
  font-size: 2.5rem; margin-bottom: 0.6rem; display: block;
}
.recipe-hero-meta {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.8rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
}
.recipe-hero-meta span::after { content: "·"; margin-left: 1.5rem; opacity: 0.4; }
.recipe-hero-meta span:last-child::after { content: ""; }
.recipe-hero-title {
  font-family: "EB Garamond", serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 400; line-height: 1.05;
  letter-spacing: -0.01em; color: var(--text);
}

/* ── RECIPE DETAIL — CONTENT ── */
.recipe-detail-wrapper {
  display: grid; grid-template-columns: 260px 1fr;
  max-width: 1100px; margin: 0 auto; padding: 0 2rem;
}
.recipe-ingredients-col { padding-right: 2rem; }
.recipe-ingredients-inner {
  position: sticky; top: 5.5rem; padding: 4rem 0;
}
.recipe-steps-col {
  border-left: 1px solid var(--rule);
  padding-left: 4rem; padding-top: 4rem; padding-bottom: 7rem;
}
.recipe-section-label {
  font-family: "Inter", sans-serif;
  font-size: 0.68rem; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 1.75rem;
}

/* Ingredients */
.ingredient-list { list-style: none; display: flex; flex-direction: column; }
.ingredient-item {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 0.75rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--rule);
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-name {
  font-family: "EB Garamond", serif; font-size: 1rem;
  color: var(--text-soft); flex: 1;
}
.ingredient-qty {
  font-family: "DM Mono", monospace;
  font-size: 0.68rem; font-weight: 300;
  color: var(--text-faint); white-space: nowrap;
}

/* Prep steps */
.prep-steps { display: flex; flex-direction: column; }
.prep-step {
  display: grid; grid-template-columns: 48px 1fr;
  gap: 1.5rem; padding: 2.25rem 0;
  border-bottom: 1px solid var(--rule);
}
.prep-step:last-child { border-bottom: none; }
.step-num {
  font-family: "DM Mono", monospace;
  font-size: 0.63rem; font-weight: 300;
  color: var(--text-faint); padding-top: 0.3rem;
}
.step-text {
  font-family: "EB Garamond", serif;
  font-size: 1.1rem; color: var(--text-soft); line-height: 1.8;
}

/* Recipe note */
.recipe-note {
  margin-top: 2.5rem; padding: 1.25rem 1.5rem;
  border: 1px solid var(--rule); border-radius: 8px;
  font-family: "EB Garamond", serif; font-size: 0.95rem;
  color: var(--text-faint); font-style: italic; line-height: 1.7;
}

/* Empty state */
.recipe-empty {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem; color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* Back link */
.back-link {
  font-family: "Inter", sans-serif; font-size: 0.75rem;
  color: var(--text-faint); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: color 0.2s ease; letter-spacing: 0.04em;
}
.back-link:hover { color: var(--text-soft); }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--rule); }
.footer-inner-simple {
  max-width: 1100px; margin: 0 auto;
  padding: 2rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-note {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem; font-weight: 300;
  color: var(--text-faint); letter-spacing: 0.04em;
}

/* ── ANIMATIONS ── */
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .nav-links { gap: 1.2rem; }
  .nav-links li:not(:last-child):not(:nth-last-child(2)) { display: none; }
  .hero { padding: 9rem 1.25rem 5rem; }
  .recipe-container { padding: 0 1.25rem 6rem; }
}
@media (max-width: 600px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .recipe-detail-wrapper { grid-template-columns: 1fr; }
  .recipe-ingredients-col { padding-right: 0; }
  .recipe-ingredients-inner { position: static; padding: 3rem 0 0; }
  .recipe-steps-col { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 3rem; }
  .recipe-hero { height: 55vh; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; order: -1; }
  .filter-bar { flex-wrap: wrap; }
}
