/* ============================================================
   THE RECIPE BOX — Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f4f7fb;
  --surface:     #ffffff;
  --hero-from:   #001a30;
  --hero-to:     #003a60;
  --accent:      #0072B2;   /* Okabe-Ito blue — safe for all colorblind types */
  --accent-lt:   #56B4E9;   /* Okabe-Ito sky blue */
  --accent-dk:   #004E7C;   /* Dark blue */
  --gold:        #E69F00;   /* Okabe-Ito orange — distinguishable from blue */
  --coral:       #CC79A7;   /* Okabe-Ito reddish-purple */
  --text:        #12151a;
  --text-muted:  #5a6270;
  --border:      #d4dde8;
  --tag-bg:      #e6eef7;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.07);
  --shadow-md:   0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 48px rgba(0,0,0,.16);
  --radius:      14px;
  --radius-lg:   22px;
  --transition:  .25s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.hidden { display: none !important; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--hero-from) 0%, #002244 40%, #003366 70%, var(--hero-to) 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Subtle noise texture */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0,114,178,.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(86,180,233,.12) 0%, transparent 50%);
  pointer-events: none;
}

/* Floating food decorations */
.hero-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.float {
  position: absolute;
  font-size: clamp(2rem, 5vw, 4rem);
  opacity: .13;
  animation: floatAnim linear infinite;
  user-select: none;
}
.float:nth-child(1)  { left:  5%; top: 10%; animation-duration: 18s; animation-delay: 0s;   font-size: 3.5rem; }
.float:nth-child(2)  { left: 20%; top: 70%; animation-duration: 22s; animation-delay: -4s;  font-size: 2.5rem; }
.float:nth-child(3)  { left: 40%; top: 15%; animation-duration: 16s; animation-delay: -8s;  font-size: 4rem;   }
.float:nth-child(4)  { left: 60%; top: 75%; animation-duration: 20s; animation-delay: -2s;  font-size: 3rem;   }
.float:nth-child(5)  { left: 75%; top: 25%; animation-duration: 24s; animation-delay: -6s;  font-size: 2.8rem; }
.float:nth-child(6)  { left: 90%; top: 60%; animation-duration: 19s; animation-delay: -10s; font-size: 3.2rem; }
.float:nth-child(7)  { left: 50%; top: 85%; animation-duration: 21s; animation-delay: -3s;  font-size: 2.2rem; }
.float:nth-child(8)  { left: 85%; top: 5%;  animation-duration: 17s; animation-delay: -7s;  font-size: 3.8rem; }

@keyframes floatAnim {
  0%   { transform: translateY(0px) rotate(0deg);   }
  33%  { transform: translateY(-20px) rotate(5deg);  }
  66%  { transform: translateY(10px) rotate(-3deg);  }
  100% { transform: translateY(0px) rotate(0deg);   }
}

/* Nav */
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.logo span { color: var(--accent-lt); }

.nav-links { display: flex; gap: 8px; }
.nav-link {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(6px);
}
.nav-link:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* Hero content */
.hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  position: relative;
  z-index: 5;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(230,159,0,.15);
  border: 1px solid rgba(230,159,0,.3);
  color: var(--gold);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 28px;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.8rem, 8vw, 6rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.05;
  margin-bottom: 24px;
  max-width: 780px;
}
.hero-title .accent { color: var(--accent-lt); font-style: italic; }
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,.7);
  max-width: 520px;
  margin-bottom: 48px;
  font-weight: 300;
  line-height: 1.7;
}
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 100px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,114,178,.45);
}
.btn-primary:hover {
  background: var(--accent-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,114,178,.55);
}
.btn-secondary {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(6px);
}
.btn-secondary:hover {
  background: rgba(255,255,255,.22);
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 10px 24px;
  font-size: .9rem;
}
.btn-ghost:hover { background: var(--accent); color: #fff; }

/* Hero stats */
.hero-stats {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 24px 48px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 40px;
  border-right: 1px solid rgba(255,255,255,.15);
}
.stat:last-child { border-right: none; }
.stat span {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-lt);
}
.stat label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  font-weight: 500;
}

/* ── Main App area ── */
.app { position: relative; }

/* ── Mode Selector (landing cards on scroll) ── */
.mode-selector {
  padding: 80px 0;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 12px;
}
.section-sub {
  color: var(--text-muted);
  margin-bottom: 48px;
  font-size: 1.05rem;
}
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.mode-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}
.mode-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--coral) 100%);
  opacity: 0;
  transition: var(--transition);
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.mode-card:hover::after { opacity: .06; }
.mode-icon { font-size: 3rem; margin-bottom: 20px; position: relative; z-index: 1; }
.mode-card h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; position: relative; z-index: 1; }
.mode-card p { color: var(--text-muted); font-size: .95rem; line-height: 1.6; position: relative; z-index: 1; }
.mode-card .arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}
.mode-card:hover .arrow { gap: 10px; }

/* ── Shared Section Layout ── */
.finder, .browser {
  padding: 60px 0 100px;
}
.section-header {
  margin-bottom: 40px;
}
.section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 8px;
}
.section-header p { color: var(--text-muted); font-size: 1rem; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  transition: var(--transition);
}
.back-btn:hover { gap: 10px; }

/* ── Ingredient Chips ── */
.ingredient-section { margin-bottom: 48px; }
.ingredient-section-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  padding: 8px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
  user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: #e8f3fb; }
.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,114,178,.35);
}

.ingredient-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.selected-count {
  font-size: .9rem;
  color: var(--text-muted);
}
.selected-count strong { color: var(--accent); }

/* ── Results Header ── */
.results-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
  padding-top: 20px;
  border-top: 2px solid var(--border);
}
.results-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
}
.results-count {
  font-size: .9rem;
  color: var(--text-muted);
}

/* ── Meal Tabs ── */
.meal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.meal-tab {
  padding: 10px 24px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}
.meal-tab:hover { border-color: var(--accent); color: var(--accent); }
.meal-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,114,178,.4);
}

/* ── Recipe Cards ── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}
.recipe-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.recipe-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.card-visual {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  position: relative;
  overflow: hidden;
}
.card-visual.card-photo {
  background-size: cover;
  background-position: center;
}
/* Prevent the blur pseudo-element from stacking over the photo */
.card-visual.card-photo::before {
  display: none;
}
.card-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  filter: blur(0px);
}
.recipe-card:nth-child(1) .card-visual { background: linear-gradient(135deg, #001a30 0%, #003a60 100%); } /* Navy blue */
.recipe-card:nth-child(2) .card-visual { background: linear-gradient(135deg, #004E7C 0%, #0072B2 100%); } /* Blue */
.recipe-card:nth-child(3) .card-visual { background: linear-gradient(135deg, #005a50 0%, #009E73 100%); } /* Bluish green */
/* Fallback for dynamically inserted cards */
.card-visual.color-0 { background: linear-gradient(135deg, #001a30 0%, #003a60 100%); } /* Navy */
.card-visual.color-1 { background: linear-gradient(135deg, #004E7C 0%, #0072B2 100%); } /* Blue */
.card-visual.color-2 { background: linear-gradient(135deg, #005a50 0%, #009E73 100%); } /* Teal */
.card-visual.color-3 { background: linear-gradient(135deg, #3a0050 0%, #7B2D8B 100%); } /* Purple */
.card-visual.color-4 { background: linear-gradient(135deg, #7a4400 0%, #E69F00 100%); } /* Amber */

.card-emoji {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.4));
}

/* Match badge */
.match-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}
.match-badge.high { background: #004E7C; color: #56B4E9; } /* Blue — safe for all colorblind types */
.match-badge.mid  { background: #7a4400; color: #E69F00; } /* Amber — distinguishable from blue */

.card-body { padding: 22px 24px 24px; flex: 1; display: flex; flex-direction: column; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.card-tag {
  background: var(--tag-bg);
  color: var(--accent-dk);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 10px;
  border-radius: 100px;
}
.card-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.card-desc { font-size: .875rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 18px; flex: 1; }
.card-meta {
  display: flex;
  gap: 16px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.meta-item { display: flex; align-items: center; gap: 5px; }
.meta-icon { font-size: .9rem; }

/* No results */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.no-results .big-icon { font-size: 3.5rem; margin-bottom: 16px; }
.no-results h3 { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.no-results p { font-size: .95rem; line-height: 1.6; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-close {
  position: sticky;
  top: 16px;
  float: right;
  margin: 16px 16px 0 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--tag-bg);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--accent); color: #fff; }

.modal-hero {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  position: relative;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  margin-top: -52px;
}
.modal-hero-photo {
  background-size: cover;
  background-position: center;
}
.modal-hero .modal-bg {
  position: absolute;
  inset: 0;
}

.modal-body { padding: 28px 36px 40px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.modal-tag {
  background: var(--tag-bg);
  color: var(--accent-dk);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 4px 12px;
  border-radius: 100px;
}
.modal-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
}
.modal-desc { color: var(--text-muted); font-size: 1rem; line-height: 1.7; margin-bottom: 24px; }
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px 24px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 32px;
}
.modal-meta-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.modal-meta-item .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 600; }
.modal-meta-item .value { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.modal-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.ingredients-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 36px;
}
.ingredient-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: .875rem;
}
.ingredient-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.ingredient-item .ing-amount { color: var(--text-muted); font-size: .8rem; }
.ingredient-item.matched { background: #e8f3fb; }
.ingredient-item.matched .dot { background: var(--accent-dk); }

.instructions-list { counter-reset: steps; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.instruction-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: .925rem;
  line-height: 1.65;
  counter-increment: steps;
}
.step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
}
footer strong { color: var(--accent); }

/* ── Main Ingredient Tiles (Phase 1) ── */
.mains-section { margin-bottom: 0; }

.picker-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 16px;
}

.mains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.main-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  line-height: 1;
}
.main-tile:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.main-tile.selected {
  border-color: var(--accent);
  background: #e8f3fb;
  box-shadow: 0 0 0 3px rgba(0,114,178,.18), var(--shadow-md);
  transform: translateY(-2px);
}
.main-tile-emoji { font-size: 2.4rem; line-height: 1; }
.main-tile-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.main-tile.selected .main-tile-label { color: var(--accent-dk); }

/* ── Extras Section (Phase 2) ── */
.extras-section {
  padding: 28px 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  animation: slideDown .3s cubic-bezier(.4,0,.2,1);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.extras-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.extras-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 8px;
  border-radius: 6px;
}
.extras-clear:hover { color: var(--accent); background: #e8f3fb; }
.extras-category { margin-bottom: 22px; }
.extras-category:last-child { margin-bottom: 0; }
.extras-cat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

/* ── Picker Actions bar ── */
.picker-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.selected-count { font-size: .9rem; color: var(--text-muted); }
.selected-count strong { color: var(--accent); }

/* ── Extra card color slots (8 recipes) ── */
.card-visual.color-5 { background: linear-gradient(135deg, #1a003a 0%, #4B0082 100%); } /* Indigo */
.card-visual.color-6 { background: linear-gradient(135deg, #003050 0%, #006080 100%); } /* Cyan-blue */
.card-visual.color-7 { background: linear-gradient(135deg, #005040 0%, #00897B 100%); } /* Teal-green */

/* ══════════════════════════════════════════════════════
   FONT SIZE ACCESSIBILITY
   Since nearly all sizes use rem, changing html font-size
   scales the entire page proportionally.
   ══════════════════════════════════════════════════════ */
html.text-md { font-size: 19px; }
html.text-lg { font-size: 22px; }

/* ── Font size control in nav ── */
.font-size-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 30px;
  padding: 5px 10px 5px 12px;
}
.font-sz-label {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  font-weight: 600;
  letter-spacing: .05em;
  margin-right: 4px;
  user-select: none;
}
.font-sz-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.65);
  font-family: inherit;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 20px;
  transition: background var(--transition), color var(--transition);
}
.font-sz-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
.font-sz-btn.active { color: #fff; background: rgba(255,255,255,.22); }
/* Visual size difference so users know what they're picking */
.font-sz-btn[data-size="normal"] { font-size: .78rem; }
.font-sz-btn[data-size="md"]     { font-size: .95rem; }
.font-sz-btn[data-size="lg"]     { font-size: 1.15rem; }

/* ══════════════════════════════════════════════════════
   SERVINGS SCALER (inside recipe modal)
   ══════════════════════════════════════════════════════ */
.serving-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.serving-selector-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: 4px;
  white-space: nowrap;
}
.serving-btn {
  padding: 6px 16px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.serving-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.serving-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.serving-note {
  font-size: .75rem;
  color: var(--text-muted);
  margin-left: auto;
  font-style: italic;
  white-space: nowrap;
}

/* ── Nutrition Panel ── */
.nutrition-panel {
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.nutrition-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.macro-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 8px;
  border-radius: 10px;
  gap: 3px;
}
.macro-val {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.macro-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
}
.macro-protein { background: #e8f4fd; color: #1a6fa8; }
.macro-carbs   { background: #fef3e2; color: #b35e00; }
.macro-fat     { background: #fde8f0; color: #a0244e; }
.macro-fiber   { background: #e8f7ee; color: #1a7a3e; }

@media (prefers-color-scheme: dark) {
  .macro-protein { background: rgba(26,111,168,.18); color: #6db8f5; }
  .macro-carbs   { background: rgba(179,94,0,.18);   color: #f5b86d; }
  .macro-fat     { background: rgba(160,36,78,.18);  color: #f586ab; }
  .macro-fiber   { background: rgba(26,122,62,.18);  color: #5fd88a; }
}

/* ── Page View Counter ── */
.view-counter {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 6px 14px 6px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
  font-size: .78rem;
  color: var(--text-muted);
  z-index: 99;
  pointer-events: auto;
  transition: opacity .3s;
}
.view-counter-icon  { font-size: .85rem; line-height: 1; }
.view-counter-num   { font-weight: 700; color: var(--text); font-size: .82rem; }
.view-counter-label { letter-spacing: .03em; }
.view-counter-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: .78rem;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  line-height: 1.6;
}
.view-counter-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 18px;
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.view-counter:hover .view-counter-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav { padding: 20px 20px; }
  .logo { font-size: 1.25rem; }
  .hero-stats { gap: 0; }
  .stat { padding: 0 20px; }
  .modal-body { padding: 20px 24px 32px; }
  .ingredients-list { grid-template-columns: 1fr; }
  .btn { padding: 12px 24px; font-size: .9rem; }
  .nav-links { display: none; }
  .font-sz-label { display: none; }
  .font-size-ctrl { padding: 5px 8px; }
}
