:root {
  --cream: #fdf6ec;
  --cream-dark: #f5ead6;
  --brown-dark: #4a2f22;
  --brown: #7a4a30;
  --cinnamon: #b5651d;
  --apple-red: #c0392b;
  --apple-green: #7d9d5c;
  --gold: #d9a441;
  --card-bg: #ffffff;
  --border-soft: #eadfca;
  --shadow: 0 10px 30px rgba(74, 47, 34, 0.12);
  --radius: 18px;
  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --cream: #221812;
  --cream-dark: #2b1f17;
  --brown-dark: #f5ead6;
  --brown: #d9c8b3;
  --card-bg: #2f2319;
  --border-soft: #43342554;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #221812;
    --cream-dark: #2b1f17;
    --brown-dark: #f5ead6;
    --brown: #d9c8b3;
    --card-bg: #2f2319;
    --border-soft: #43342554;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--brown-dark);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3 {
  font-family: var(--font-head);
  color: var(--brown-dark);
}

.hero {
  background:
    radial-gradient(circle at 15% 20%, rgba(192, 57, 43, 0.10), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(217, 164, 65, 0.18), transparent 45%),
    linear-gradient(180deg, var(--cream-dark), var(--cream));
  padding-bottom: 3rem;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 6vw;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}

.navbar.scrolled {
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(74, 47, 34, 0.08);
}

.logo {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brown-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 26px;
  height: 26px;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--brown);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--apple-red);
}

.nav-links .back-link {
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  font-size: 0.88rem;
}

.nav-links .back-link:hover {
  border-color: var(--gold);
  color: var(--cinnamon);
}

.hero-inner {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 0 6vw;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
}

.hero-content {
  text-align: left;
}

.badge {
  display: inline-block;
  background: rgba(217, 164, 65, 0.18);
  color: var(--cinnamon);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1.2rem;
}

.hero-content h1 {
  font-weight: 800;
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  line-height: 1.15;
  margin-bottom: 1.2rem;
}

.hero-content > p {
  font-size: 1.15rem;
  color: var(--brown);
  max-width: 480px;
  margin: 0 0 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  font-family: var(--font-body);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--apple-red);
  color: white;
  box-shadow: 0 8px 20px rgba(192, 57, 43, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 10px 26px rgba(192, 57, 43, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--brown);
  border: 2px solid var(--border-soft);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--cinnamon);
}

.btn-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.hero-meta {
  display: flex;
  gap: 2.2rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  font-size: 0.95rem;
}

.meta-icon {
  font-size: 1.8rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-illustration {
  width: 100%;
  max-width: 420px;
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(74, 47, 34, 0.18));
}

.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 6vw;
}

.section.alt {
  max-width: 100%;
  background: var(--cream-dark);
}

.section.alt > * {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  display: block;
  text-align: center;
  color: var(--cinnamon);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

.section h2 {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.section h2::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 0.8rem auto 0;
  border-radius: 2px;
}

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.icon-badge svg {
  width: 20px;
  height: 20px;
}

.icon-badge.badge-lg {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
}

.icon-badge.badge-lg svg {
  width: 28px;
  height: 28px;
}

.badge-brown { background: var(--brown); }
.badge-red { background: var(--apple-red); }
.badge-gold { background: var(--gold); }
.badge-green { background: var(--apple-green); }

.servings-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  font-weight: 600;
  color: var(--brown);
}

.servings-control button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--card-bg);
  color: var(--cinnamon);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.servings-control button:hover {
  background: var(--gold);
  color: white;
}

.servings-control button:active {
  transform: scale(0.92);
}

#servings-count {
  min-width: 2ch;
  text-align: center;
  font-size: 1.1rem;
  color: var(--brown-dark);
}

.ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.ingredient-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.ingredient-card h3 {
  color: var(--cinnamon);
  font-size: 1.15rem;
}

.ingredient-list {
  list-style: none;
}

.ingredient-list li {
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-soft);
}

.ingredient-list li:last-child {
  border-bottom: none;
}

.ingredient-list label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}

.ingredient-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--apple-green);
  cursor: pointer;
  flex-shrink: 0;
}

.ingredient-list input[type="checkbox"]:checked + span {
  text-decoration: line-through;
  color: #b0a08c;
}

.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.steps li {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--apple-red);
  color: white;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.35);
}

.step-text h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
  color: var(--brown-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.step-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--cinnamon);
  stroke-width: 1.6;
  flex-shrink: 0;
}

.step-text p {
  color: var(--brown);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(74, 47, 34, 0.2);
}

.gallery-illustration {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-card figcaption {
  padding: 1.2rem 1.4rem 1.5rem;
}

.gallery-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: var(--brown-dark);
}

.gallery-card p {
  font-size: 0.9rem;
  color: var(--brown);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.tip-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s;
}

.tip-card:hover {
  transform: translateY(-4px);
}

.tip-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  color: var(--cinnamon);
}

.tip-card p {
  font-size: 0.95rem;
  color: var(--brown);
}

footer {
  text-align: center;
  padding: 2.5rem 6vw;
  color: var(--brown);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.footer-icon {
  width: 28px;
  height: 28px;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-content {
    text-align: center;
  }
  .hero-content > p {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions,
  .hero-meta {
    justify-content: center;
  }
  .hero-visual {
    order: -1;
    max-width: 280px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .navbar {
    justify-content: center;
    text-align: center;
  }
  .nav-links {
    gap: 1.2rem;
    font-size: 0.9rem;
  }
  .hero-meta {
    gap: 1.5rem;
  }
  .steps li {
    gap: 1rem;
  }
}

@media print {
  .navbar, .hero-visual, .hero-actions, .badge,
  #galerie, footer, .gallery-grid, .eyebrow {
    display: none !important;
  }
  .hero {
    background: none;
    padding-bottom: 0;
  }
  body {
    background: white;
    color: black;
  }
  .section {
    padding: 0.5rem 0;
    max-width: 100%;
  }
  .ingredient-card, .tip-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  a[href]::after {
    content: "";
  }
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  background: linear-gradient(90deg, var(--apple-red), var(--gold));
  z-index: 300;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
}

.hero {
  position: relative;
}

#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-visual {
  perspective: 900px;
}

.tilt-scene {
  transform-style: preserve-3d;
  will-change: transform;
}

.hero-illustration {
  animation: floaty 6s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.tilt {
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.6s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.tilt:hover {
  box-shadow: 0 20px 44px rgba(74, 47, 34, 0.24);
}

.tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.35), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.tilt:hover::after {
  opacity: 1;
}

.reveal.is-visible .step-number {
  animation: spinIn3d 0.8s cubic-bezier(0.3, 0.8, 0.3, 1.1);
}

@keyframes spinIn3d {
  0% {
    transform: rotateY(-180deg) scale(0.4);
    opacity: 0;
  }
  100% {
    transform: rotateY(0) scale(1);
    opacity: 1;
  }
}

.gallery-grid {
  perspective: 1400px;
}

.gallery-card {
  aspect-ratio: 4 / 3;
  transform-style: preserve-3d;
  transition: opacity 0.6s ease, transform 0.75s cubic-bezier(0.35, 0.9, 0.3, 1);
  cursor: pointer;
  overflow: visible;
}

.gallery-card:hover,
.gallery-card:focus-visible,
.gallery-card.flipped {
  transform: rotateY(180deg);
}

.gallery-card.reveal {
  transform: translateY(24px);
}

.gallery-card.reveal.is-visible {
  transform: translateY(0);
}

.gallery-card.reveal.is-visible:hover,
.gallery-card.reveal.is-visible.flipped {
  transform: translateY(0) rotateY(180deg);
}

.gallery-illustration {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius);
}

.gallery-card::before {
  content: "↻";
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.75);
  color: var(--cinnamon);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50%;
  backface-visibility: hidden;
  box-shadow: 0 2px 8px rgba(74, 47, 34, 0.18);
}

.gallery-card figcaption {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 15%, rgba(217, 164, 65, 0.16), transparent 50%),
    var(--card-bg);
  border: 2px solid var(--border-soft);
}

.gallery-card figcaption h3 {
  font-size: 1.25rem;
}

.gallery-card figcaption p {
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  .hero-illustration,
  .reveal.is-visible .step-number {
    animation: none;
  }
  .tilt,
  .tilt-scene {
    transition: none;
    transform: none !important;
  }
  .gallery-card {
    transition: opacity 0.01s;
  }
  #particles {
    display: none;
  }
}

@media print {
  #progress-bar,
  #particles {
    display: none !important;
  }
}
