/* ============================================================
   Spooky Bites — "apothecary / occult editorial" theme
   Deep aubergine · bone paper · antique gold · Playfair Display
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  /* Light mode (default) — bone paper */
  --bg: #f2e9d6;
  --nav-bg: #241019;
  --nav-text: #efe4ce;
  --nav-highlight: #7a2438;
  --nav-highlight-text: #e6c680;
  --heading: #2c1a22;
  --text: #3f342a;
  --muted: #6f6152;
  --card-bg: #fbf4e4;
  --card-border: rgba(44, 26, 34, 0.16);
  --rule: rgba(44, 26, 34, 0.16);
  --ring: #7d5f1e;
  --gold: #7d5f1e;
  --plum: #2c1a22;
  --oxblood: #7a2438;
  --overlay: rgba(28, 15, 21, 0.62);
  --panel-bg: #241019;
  --panel-text: #efe4ce;
  --glow: rgba(176, 133, 47, 0.45);

  --tile-marigold: #e7d4a8;
  --tile-orange: #e3c4a4;
  --tile-purple: #d9c7d0;

  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --font-heading: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Ysabeau", "Segoe UI", system-ui, sans-serif;
}

/* Dark mode: follows system preference by default */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191016;
    --nav-bg: #120a0f;
    --nav-text: #ede1cb;
    --nav-highlight: #9a3350;
    --nav-highlight-text: #f2d7a6;
    --heading: #ece0c9;
    --text: #dccfbe;
    --muted: #a3927f;
    --card-bg: #241820;
    --card-border: rgba(231, 217, 186, 0.16);
    --rule: rgba(231, 217, 186, 0.18);
    --ring: #cfa557;
    --gold: #cfa557;
    --plum: #3d2531;
    --oxblood: #9a3350;
    --overlay: rgba(0, 0, 0, 0.68);
    --panel-bg: #241820;
    --panel-text: #ede1cb;
    --glow: rgba(207, 165, 87, 0.42);

    --tile-marigold: #342a1b;
    --tile-orange: #33221a;
    --tile-purple: #2c2029;
  }
}

/* Dark mode: explicit user toggle wins either direction */
:root[data-theme="dark"] {
  --bg: #191016;
  --nav-bg: #120a0f;
  --nav-text: #ede1cb;
  --nav-highlight: #9a3350;
  --nav-highlight-text: #e7c785;
  --heading: #ece0c9;
  --text: #dccfbe;
  --muted: #a3927f;
  --card-bg: #241820;
  --card-border: rgba(231, 217, 186, 0.16);
  --rule: rgba(231, 217, 186, 0.18);
  --ring: #cfa557;
  --gold: #cfa557;
  --plum: #3d2531;
  --oxblood: #9a3350;
  --overlay: rgba(0, 0, 0, 0.68);
  --panel-bg: #241820;
  --panel-text: #ede1cb;
  --glow: rgba(207, 165, 87, 0.42);

  --tile-marigold: #342a1b;
  --tile-orange: #33221a;
  --tile-purple: #2c2029;
}

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

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3.5rem;
  z-index: 200;
  background: var(--gold);
  color: #241019;
  padding: 0.6rem 1rem;
  border-radius: 0 0 0.25rem 0.25rem;
  text-decoration: none;
  font-family: var(--font-body);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

/* ---------- Visible keyboard focus (WCAG 2.4.7) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* On the dark nav / footer the gold ring is low-contrast — use the light ink */
.nav-brand:focus-visible,
.nav-links a:focus-visible,
.nav-toggle:focus-visible,
.theme-toggle:focus-visible,
.footer-nav a:focus-visible,
.footer-legal a:focus-visible {
  outline: 2px solid var(--nav-text);
  outline-offset: 2px;
}

:target {
  scroll-margin-top: 5rem;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Faint paper grain over the "unprinted" areas */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--paper);
  background-size: 120px 120px;
  opacity: 0.05;
  mix-blend-mode: overlay;
}

:root[data-theme="dark"] body::before {
  opacity: 0.08;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    opacity: 0.08;
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-optical-sizing: auto;
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.005em;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Shared "letterpress" label treatment */
.feature-kicker,
.item-rank,
.tombstone-label,
.recipe-meta span,
.planner-count {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  padding: 0.7rem 1.4rem;
  background: var(--oxblood);
  color: #f6ecd8;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  background: #8f2c43;
}

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

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.btn-secondary {
  background: transparent;
  color: var(--heading);
  border: 1px solid var(--heading);
}

.btn-secondary:hover {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
}

.btn-glow:hover,
.btn-glow:focus-visible {
  box-shadow:
    0 0 0 1px var(--gold),
    0 10px 26px -8px var(--glow);
}

.btn-glow:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

/* ---------- Navigation ---------- */
.site-nav {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--gold);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--nav-text);
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  align-items: center;
}

.nav-links a {
  display: inline-block;
  text-decoration: none;
  color: var(--nav-text);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.6rem;
  border-radius: 0.2rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a:active {
  background: var(--nav-highlight);
  color: var(--nav-highlight-text);
}

.nav-links a[aria-current="page"] {
  color: var(--nav-highlight-text);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.footer-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--nav-text);
  color: var(--nav-text);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.account-toggle {
  background: transparent;
  border: 1px solid var(--nav-text);
  color: var(--nav-text);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.account-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.toggle {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.toggle button {
  background: none;
  border: none;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}

/* ---------- Account / settings pages ---------- */
.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.4rem;
  padding: 2rem;
  max-width: 440px;
  margin: 0 auto 1.5rem;
}

.profile-card h2 {
  margin-bottom: 0.5rem;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.avatar-preview {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border);
  background: var(--bg);
  flex: 0 0 auto;
}

.avatar-actions input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.avatar-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.switch-row:last-of-type {
  border-bottom: none;
}

.switch-copy .switch-label {
  font-weight: 500;
  display: block;
}

.switch-copy .switch-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 2.6rem;
  height: 1.5rem;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  left: 0.2rem;
  top: 0.2rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-slider {
  background: var(--oxblood);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(1.1rem);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.signed-out-prompt {
  text-align: center;
}

.section-hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.muted-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.simple-list {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
}

.simple-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

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

.simple-list .item-title {
  font-weight: 500;
}

.simple-list .item-body {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
  white-space: pre-wrap;
}

.list-remove {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  flex: 0 0 auto;
}

.list-remove:hover {
  color: var(--oxblood);
}

.photo-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0 0;
  padding: 0;
}

.photo-grid li {
  position: relative;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  display: block;
}

.photo-grid .photo-caption {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.3rem;
  text-align: center;
}

.photo-grid .list-remove {
  display: block;
  margin: 0.2rem auto 0;
}

/* ---------- Recipe page: reader photo gallery ---------- */
.reader-gallery {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0 0;
  padding: 0;
}

.reader-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  display: block;
}

.reader-gallery .photo-by {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  text-align: center;
}

/* ---------- Mobile hamburger nav ---------- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--nav-text);
  color: var(--nav-text);
  border-radius: 0.2rem;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.nav-toggle:active {
  transform: scale(0.95);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--nav-text);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .nav-brand {
    order: 1;
  }

  .nav-toggle {
    display: inline-flex;
    order: 2;
  }

  .theme-toggle {
    order: 3;
  }

  .nav-links {
    order: 4;
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    margin-top: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 0.65rem 0.6rem;
  }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
  position: relative;
  z-index: 1;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--gold);
}

.hero h1 {
  font-size: 2.9rem;
  font-weight: 700;
  color: var(--panel-text);
}

.tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--nav-highlight-text);
  margin-top: 0.6rem;
}

.page-hero {
  text-align: center;
  padding: 3.25rem 1.5rem 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.page-hero h1 {
  font-size: 2.3rem;
  font-weight: 700;
}

.page-hero p {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0.65rem auto 0;
}

/* ---------- Main / sections ---------- */
main {
  position: relative;
  z-index: 1;
}

main.container,
main.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

main.container:not(.page-content) {
  max-width: none;
}

section {
  margin-bottom: 3rem;
}

section h2 {
  margin-bottom: 0.85rem;
}

/* Short antique-gold rule under section headings */
section > h2::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 2px;
  background: var(--gold);
  margin: 0.65rem auto 0;
}

#countdown,
#about,
#features {
  text-align: center;
}

#about,
#features {
  background: var(--panel-bg);
  color: var(--panel-text);
  padding: 2rem 1.5rem;
  border: 1px solid var(--gold);
  border-radius: 0.35rem;
}

#about p {
  color: var(--panel-text);
}

#about h2,
#features h2 {
  color: var(--panel-text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.countdown-tombstones {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.tombstone {
  --stone: #cabb9f;
  --stone-dark: #8d7d63;
  width: 84px;
  min-height: 100px;
  background: linear-gradient(180deg, #ded1b6, var(--stone));
  border: 1px solid var(--stone-dark);
  border-radius: 50% 50% 4px 4px / 48px 48px 4px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1.4rem 0.5rem 0.8rem;
  box-shadow: inset 0 -7px 11px rgba(0, 0, 0, 0.12), 0 3px 7px rgba(0, 0, 0, 0.22);
}

.tombstone-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.7rem;
  color: #2b2116;
  line-height: 1;
}

.tombstone-label {
  font-size: 0.62rem;
  color: #443c2d;
}

@media (max-width: 480px) {
  .tombstone {
    width: 70px;
    min-height: 88px;
  }

  .tombstone-value {
    font-size: 1.4rem;
  }
}

/* ---------- Footer ---------- */
footer {
  background: var(--nav-bg);
  color: var(--nav-text);
  text-align: center;
  padding: 2rem 1.5rem 2.25rem;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--gold);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.footer-nav,
.footer-legal {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.footer-nav {
  margin-bottom: 0.5rem;
}

.footer-legal {
  margin-bottom: 1rem;
  font-size: 0.78rem;
}

.footer-nav a,
.footer-legal a {
  display: inline-block;
  text-decoration: none;
  color: var(--nav-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.2rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.footer-legal a {
  letter-spacing: 0.06em;
}

.footer-nav a:hover,
.footer-nav a:focus-visible,
.footer-nav a:active,
.footer-legal a:hover,
.footer-legal a:focus-visible,
.footer-legal a:active {
  background: var(--nav-highlight);
  color: var(--nav-highlight-text);
}

.footer-copyright {
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ---------- Generic cards ---------- */
.costume-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.costume-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.3rem;
  padding: 1.25rem 1rem;
  text-align: center;
}

.costume-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.costume-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.costume-card p {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Feature cards ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-top: 2px solid transparent;
  border-radius: 0.35rem;
  padding: 1.6rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover,
.feature-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 16px 30px -16px rgba(0, 0, 0, 0.4);
}

.feature-card:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.feature-card .feature-kicker {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.45rem;
}

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

.feature-card .feature-emoji {
  font-size: 1.9rem;
  display: block;
  margin-bottom: 0.55rem;
  filter: sepia(0.35) saturate(0.85);
}

/* ---------- Newsletter modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 0.4rem;
  padding: 2.25rem;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.modal-close:hover {
  background: var(--card-border);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-box h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.modal-box p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ---------- Forms ---------- */
.form-field {
  margin-bottom: 1rem;
  text-align: left;
}

.form-field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.form-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.form-field input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.form-checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--oxblood);
}

.form-success {
  background: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 0.35rem;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form-success[hidden] {
  display: none;
}

.form-error {
  background: var(--card-bg);
  border: 1px solid var(--oxblood);
  border-left: 3px solid var(--oxblood);
  border-radius: 0.35rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-error[hidden] {
  display: none;
}

.form-success {
  background: var(--card-bg);
  border: 1px solid var(--gold);
  border-left: 3px solid var(--gold);
  border-radius: 0.35rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-success[hidden] {
  display: none;
}

/* ---------- Quiz ---------- */
.quiz-question {
  border: none;
  margin-bottom: 2rem;
}

.quiz-question legend {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--heading);
  font-size: 1.15rem;
  margin-bottom: 0.7rem;
  padding: 0;
}

.quiz-options {
  display: grid;
  gap: 0.5rem;
}

.quiz-option {
  display: block;
}

.quiz-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.quiz-option span {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quiz-option input:checked + span {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.quiz-option input:focus-visible + span {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

#quiz-result {
  background: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 0.4rem;
  padding: 1.75rem;
  text-align: center;
}

#quiz-result[hidden] {
  display: none;
}

#quiz-result h3 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

/* ---------- Filter bar (recipe list) ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-field.filter-search {
  flex: 1 1 12rem;
}

.filter-field label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.filter-field input,
.filter-field select {
  padding: 0.5rem 0.65rem;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.filter-field input:focus-visible,
.filter-field select:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.filter-bar .btn-secondary {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.filter-bar .btn-secondary[hidden] {
  display: none;
}

.filter-count {
  flex-basis: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.filter-empty {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--muted);
  padding: 1rem 0;
}

.filter-empty[hidden] {
  display: none;
}

/* ---------- List pages (recipes) ---------- */
.item-list {
  display: grid;
  gap: 1.5rem;
}

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

.item-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.15rem;
  align-items: start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.35rem;
  padding: 1.15rem;
}

.item-rank {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
}

.item-card h3 {
  font-size: 1.2rem;
  margin: 0.2rem 0 0.4rem;
}

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

/* ---------- Favourite-a-recipe button ---------- */
.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.fav-btn .fav-heart {
  font-size: 1rem;
  line-height: 1;
  color: var(--oxblood);
}

.fav-btn:hover {
  color: var(--oxblood);
  border-color: var(--oxblood);
}

.fav-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.fav-btn[aria-pressed="true"] {
  color: var(--oxblood);
  border-color: var(--oxblood);
  font-weight: 600;
}

.fav-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.item-card .fav-btn {
  margin-top: 0.75rem;
}

.recipe-fav {
  margin: 0 0 1.5rem;
}

/* ---------- Emoji tiles (stand in for recipe photos) ---------- */
.emoji-tile {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  line-height: 1;
  background: var(--tile-marigold);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  filter: sepia(0.28) saturate(0.82);
}

.item-photo {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 0.3rem;
  border: 1px solid var(--card-border);
  object-fit: cover;
  display: block;
}

.emoji-tile.tile-orange {
  background: var(--tile-orange);
}

.emoji-tile.tile-purple {
  background: var(--tile-purple);
}

.article-figure .emoji-tile {
  aspect-ratio: 16 / 9;
  font-size: 3rem;
}

@media (max-width: 640px) {
  .emoji-tile {
    font-size: 2rem;
  }
}

article.page-article {
  max-width: 680px;
  margin: 0 auto;
}

article.page-article p {
  margin-bottom: 1rem;
}

article.page-article h2 {
  margin-top: 2.25rem;
  font-size: 1.6rem;
}

article.page-article h2::after,
.recipe h2::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 2px;
  background: var(--gold);
  margin: 0.55rem 0 0;
}

.page-article a:not(.btn),
.recipe a:not(.btn) {
  color: var(--gold);
  text-underline-offset: 2px;
}

.article-figure {
  margin: 1.75rem 0;
}

.article-figure figcaption {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ---------- Recipe detail pages ---------- */
.recipe {
  max-width: 680px;
  margin: 0 auto;
}

.recipe-back {
  margin-bottom: 1.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.recipe-back a {
  text-decoration: none;
  color: var(--gold);
  font-weight: 600;
}

.recipe-back a:hover,
.recipe-back a:focus-visible {
  text-decoration: underline;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.recipe-meta span {
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.66rem;
  color: var(--muted);
}

.recipe > p {
  margin-bottom: 1rem;
}

.recipe h2 {
  margin: 2rem 0 0.85rem;
  font-size: 1.5rem;
}

.recipe-ingredients {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.recipe-ingredients li {
  padding-left: 1.3rem;
  position: relative;
}

.recipe-ingredients li::before {
  content: "\2726"; /* four-pointed star */
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.72rem;
  top: 0.28em;
}

.recipe-method {
  display: grid;
  gap: 1.1rem;
  padding-left: 1.35rem;
}

.recipe-method li {
  padding-left: 0.4rem;
}

.recipe-method li::marker {
  color: var(--gold);
  font-family: var(--font-heading);
  font-weight: 700;
}

.recipe-note {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--gold);
  border-radius: 0.25rem;
  padding: 1.1rem 1.2rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.item-more {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.item-more a {
  text-decoration: none;
  color: var(--gold);
  font-weight: 600;
}

.item-more a:hover,
.item-more a:focus-visible {
  text-decoration: underline;
}

/* ---------- Menu planner ---------- */
.planner {
  max-width: 680px;
  margin: 0 auto;
}

.planner-intro {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.planner-group {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.35rem;
  padding: 1.2rem 1.35rem;
  margin-bottom: 1.1rem;
}

.planner-group > h2 {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.planner-group > p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.planner-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  cursor: pointer;
}

.planner-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.18rem;
  flex-shrink: 0;
  accent-color: var(--oxblood);
}

.planner-check input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.planner-check input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.planner-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.75rem;
}

.planner-count {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Floating background decorations ---------- */
.floaters {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floater {
  position: absolute;
  bottom: -10%;
  font-size: 1.6rem;
  opacity: 0.13;
  filter: sepia(0.6) saturate(0.6) brightness(0.85);
  animation: float-up linear infinite;
}

.f1 { left: 8%;  animation-duration: 19s; animation-delay: 0s; }
.f2 { left: 25%; animation-duration: 24s; animation-delay: 3s; }
.f3 { left: 50%; animation-duration: 16s; animation-delay: 6s; }
.f4 { left: 70%; animation-duration: 26s; animation-delay: 1.5s; }
.f5 { left: 88%; animation-duration: 21s; animation-delay: 8s; }

@keyframes float-up {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.13;
  }
  90% {
    opacity: 0.13;
  }
  to {
    transform: translateY(-110vh) rotate(14deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .floater {
    animation: none;
    display: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .feature-card:hover,
  .feature-card:focus-visible {
    transform: none;
  }

  .btn:active,
  .theme-toggle:active,
  .nav-toggle:active,
  .modal-close:active {
    transform: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .item-card {
    grid-template-columns: 90px 1fr;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .page-hero h1 {
    font-size: 1.95rem;
  }
}

/* ---------- Print (recipe pages especially) ---------- */
@media print {
  .site-nav,
  footer,
  .floaters,
  .skip-link,
  .theme-toggle,
  .nav-toggle,
  .recipe-back,
  .modal-overlay,
  body::before {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    line-height: 1.4;
  }

  .page-hero {
    padding: 0 0 0.75rem;
    text-align: left;
    border-bottom: 1px solid #000;
  }

  .page-hero p {
    color: #000;
  }

  .page-hero h1,
  h1, h2, h3 {
    color: #000;
  }

  article.page-article h2::after,
  .recipe h2::after,
  section > h2::after {
    background: #000;
  }

  main.page-content,
  main.container {
    max-width: none;
    padding: 0;
  }

  .recipe,
  .page-article {
    max-width: none;
  }

  .recipe-meta span {
    border: 1px solid #999;
    color: #000;
  }

  .recipe-ingredients li::before,
  .recipe-method li::marker {
    color: #000;
  }

  .recipe-note {
    border: 1px solid #999;
    border-left: 3px solid #000;
    color: #000;
  }

  .recipe-method li,
  .recipe-ingredients li {
    page-break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .recipe a[href^="http"]::after,
  .page-article a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}
