:root {
  --cream: #FBF3E7;
  --cream-deep: #F3E5D3;
  --sage: #8FAE8B;
  --sage-deep: #6E9169;
  --sky: #DCEEF5;
  --sky-deep: #C3E1EC;
  --terracotta: #D98E73;
  --blush: #EFC1C7;
  --brown: #5B4636;
  --brown-soft: #8A7361;
  --sun: #F4D58D;
  --white: #FFFDF9;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 35%, var(--cream) 60%);
  color: var(--brown);
  min-height: 100vh;
}

/* Nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 253, 249, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(139, 115, 85, 0.15);
}

.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brown);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--brown-soft);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--sage-deep);
}

header {
  text-align: center;
  padding: 2.6rem 1.5rem 1rem;
}

header .brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.4rem;
  letter-spacing: 0.02em;
  color: var(--brown);
  margin: 0;
}

header .tagline {
  font-size: 1rem;
  color: var(--brown-soft);
  margin-top: 0.4rem;
}

.meal-toggle {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0.5rem;
}

.meal-toggle button {
  border: 1.5px solid var(--sage-deep);
  background: var(--white);
  color: var(--sage-deep);
  padding: 0.5rem 1.3rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.meal-toggle button.active,
.meal-toggle button:hover {
  background: var(--sage-deep);
  color: var(--white);
}

.stage-wrap {
  max-width: 960px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(60, 70, 50, 0.25);
}

.animal-icon {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 11%;
  aspect-ratio: 1 / 1;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(40, 30, 20, 0.25));
  transition: transform 0.25s ease;
}

.animal-icon svg,
.animal-icon img {
  width: 100%;
  height: 100%;
  overflow: visible;
  object-fit: contain;
  display: block;
}

.animal-icon:hover {
  transform: translate(-50%, -58%);
}

.animal-icon.dimmed {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.animal-icon.faded {
  opacity: 0.3;
}

.animal-icon.selected {
  transform: translate(-50%, -58%);
  filter: drop-shadow(0 8px 14px rgba(217, 142, 115, 0.55));
}

.animal-icon.selected::after {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  border: 3px solid var(--terracotta);
  opacity: 0.6;
  pointer-events: none;
}

.farm-decor {
  position: absolute;
  transform: translate(-50%, -50%);
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 4px 8px rgba(40, 30, 20, 0.15));
}

/* Password gate */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--sky) 0%, var(--cream) 100%);
  padding: 1.5rem;
}

.gate-card {
  background: var(--white);
  border-radius: 22px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(91, 70, 54, 0.18);
}

.gate-emoji {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.gate-card h1 {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  margin: 0 0 0.3rem;
  color: var(--brown);
}

.gate-card p {
  color: var(--brown-soft);
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
}

#gateForm {
  display: flex;
  gap: 0.5rem;
}

#gatePassword {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1.5px solid var(--sky-deep);
  font-size: 0.95rem;
}

#gateForm button {
  background: var(--sage-deep);
  color: var(--white);
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.gate-error {
  color: var(--terracotta);
  margin-top: 0.8rem !important;
}

.hint {
  text-align: center;
  color: var(--brown-soft);
  font-size: 0.85rem;
  margin-top: 0.8rem;
  margin-bottom: 1.5rem;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(91, 70, 54, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.card {
  background-color: #FBF3E1;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 30px,
      rgba(139, 115, 85, 0.16) 31px
    );
  background-position: 0 2.6rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 4px;
  padding: 2.4rem 2rem 2.2rem 3.2rem;
  position: relative;
  transform: translateY(20px) rotate(-0.6deg);
  transition: transform 0.25s ease;
  box-shadow: 0 20px 40px rgba(40, 38, 34, 0.3), 0 0 0 1px rgba(139, 115, 85, 0.15);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.1rem;
  width: 1.5px;
  background: rgba(196, 90, 90, 0.4);
  pointer-events: none;
}

.overlay.open .card {
  transform: translateY(0) rotate(-0.6deg);
}

.card .close {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-family: 'Patrick Hand', sans-serif;
  font-size: 1.3rem;
  color: var(--brown-soft);
  cursor: pointer;
  z-index: 1;
}

.card .who {
  font-family: 'Patrick Hand', sans-serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta);
  margin: 0 0 0.2rem;
  text-align: left;
}

.card h2 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 0.6rem;
  font-size: 2.5rem;
  line-height: 1.1;
  color: var(--brown);
  text-align: left;
}

.card .desc {
  font-family: 'Patrick Hand', sans-serif;
  color: var(--brown-soft);
  margin-bottom: 1.2rem;
  line-height: 1.7;
  font-size: 1.05rem;
  text-align: left;
}

.card h3 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  margin: 1.3rem 0 0.3rem;
  padding-bottom: 0.15rem;
  color: var(--sage-deep);
  border-bottom: 1.5px dashed rgba(139, 115, 85, 0.35);
}

.card ul, .card ol {
  margin: 0;
  padding-left: 1.3rem;
  line-height: 1.85;
  font-family: 'Patrick Hand', sans-serif;
  font-size: 1.02rem;
  color: var(--brown);
}

.card img {
  display: block;
  width: 62%;
  margin: 0.3rem auto 1.3rem;
  border-radius: 3px;
  border: 8px solid var(--white);
  border-bottom-width: 26px;
  object-fit: cover;
  aspect-ratio: 1 / 1;
  max-height: 210px;
  transform: rotate(1.2deg);
  box-shadow: 0 8px 18px rgba(40, 38, 34, 0.25);
}

/* Recipes section */
.recipes-section {
  max-width: 1040px;
  margin: 0.5rem auto 4rem;
  padding: 0 1.5rem;
  text-align: center;
}

.section-title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--brown);
  margin: 0 0 0.2rem;
}

.section-sub {
  color: var(--brown-soft);
  font-size: 0.95rem;
  margin: 0 0 2.2rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2rem 1.6rem;
  text-align: left;
}

.recipe-empty {
  color: var(--brown-soft);
  font-size: 0.95rem;
  margin-top: 1.5rem;
}

.recipe-card {
  background-color: #FBF3E1;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 27px,
    rgba(139, 115, 85, 0.14) 28px
  );
  background-position: 0 3.6rem;
  border: none;
  border-radius: 4px;
  padding: 1rem 1.1rem 1.3rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(60, 50, 40, 0.16), 0 0 0 1px rgba(139, 115, 85, 0.12);
  transform: rotate(var(--rot, -0.6deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font: inherit;
  display: flex;
  flex-direction: column;
}

.recipe-card:hover,
.recipe-card:focus-visible {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 0 16px 30px rgba(60, 50, 40, 0.22), 0 0 0 1px rgba(139, 115, 85, 0.15);
}

.recipe-card:nth-child(3n+1) { --rot: -1deg; }
.recipe-card:nth-child(3n+2) { --rot: 0.8deg; }
.recipe-card:nth-child(3n+3) { --rot: -0.4deg; }

.recipe-card.dimmed {
  opacity: 0.4;
}

.recipe-card-photo {
  width: 100%;
  aspect-ratio: 1 / 0.85;
  overflow: hidden;
  border-radius: 3px;
  border: 6px solid var(--white);
  border-bottom-width: 16px;
  box-shadow: 0 4px 10px rgba(40, 38, 34, 0.18);
  margin-bottom: 0.85rem;
}

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

.recipe-card-who {
  font-family: 'Patrick Hand', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--terracotta);
  margin: 0 0 0.15rem;
}

.recipe-card-title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--brown);
  margin: 0 0 0.35rem;
  line-height: 1.15;
}

.recipe-card-desc {
  font-family: 'Patrick Hand', sans-serif;
  font-size: 0.92rem;
  color: var(--brown-soft);
  line-height: 1.5;
  margin: 0;
}

footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  color: var(--brown-soft);
  font-size: 0.8rem;
  border-top: 1px solid rgba(139, 115, 85, 0.15);
  margin-top: 1rem;
}

.footer-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  color: var(--brown);
  margin: 0 0 0.5rem;
}

/* ---------------------------------------------------------
   Mobile
--------------------------------------------------------- */
@media (max-width: 640px) {
  .nav-inner {
    padding: 0.65rem 1rem;
  }

  .nav-brand {
    font-size: 0.85rem;
  }

  .nav-links {
    gap: 0.8rem;
  }

  .nav-links a {
    font-size: 0.78rem;
  }

  header {
    padding: 1.8rem 1rem 0.5rem;
  }

  header .brand {
    font-size: 1.7rem;
  }

  header .tagline {
    font-size: 0.85rem;
    padding: 0 0.5rem;
  }

  .meal-toggle {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.1rem 0 0.4rem;
    padding: 0 0.5rem;
  }

  .meal-toggle button {
    padding: 0.42rem 0.9rem;
    font-size: 0.8rem;
  }

  .hint {
    font-size: 0.78rem;
    padding: 0 0.8rem;
  }

  .stage-wrap {
    margin: 1rem auto 2rem;
    padding: 0 0.6rem;
  }

  .stage {
    border-radius: 14px;
  }

  .animal-icon {
    width: 13%;
  }

  .section-title {
    font-size: 1.9rem;
  }

  .section-sub {
    font-size: 0.85rem;
    padding: 0 0.5rem;
  }

  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem 0.7rem;
  }

  .recipe-card {
    padding: 0.75rem 0.8rem 1rem;
  }

  .recipe-card-title {
    font-size: 1.3rem;
  }

  .recipe-card-desc {
    font-size: 0.82rem;
  }

  .gate-card {
    padding: 2rem 1.5rem;
  }

  .overlay {
    padding: 0.7rem;
  }

  .card {
    padding: 2rem 1.3rem 1.6rem 1.9rem;
    max-height: 88vh;
  }

  .card::before {
    left: 1.15rem;
  }

  .card h2 {
    font-size: 1.9rem;
  }

  .card img {
    width: 72%;
    max-height: 170px;
  }

  .card .desc {
    font-size: 0.95rem;
  }

  .card h3 {
    font-size: 1.3rem;
  }

  footer {
    padding: 2rem 1rem 2.5rem;
  }
}

@media (max-width: 380px) {
  .nav-brand {
    font-size: 0.75rem;
  }

  .nav-links a {
    font-size: 0.72rem;
  }

  header .brand {
    font-size: 1.45rem;
  }

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