/* ============================================================
   Smiling Pages Recipes — Main Stylesheet
   Mobile-first • Custom CSS Grid & Flexbox • No framework
   ============================================================ */

/* ── Google Fonts are loaded in layout.php <head> ── */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  --clr-primary:    #FF6B35;
  --clr-primary-dk: #e55a25;
  --clr-secondary:  #FFD166;
  --clr-accent:     #06D6A0;
  --clr-accent-dk:  #05b889;
  --clr-bg:         #FAFAFA;
  --clr-card:       #FFFFFF;
  --clr-text:       #2D3748;
  --clr-text-muted: #718096;
  --clr-border:     #E2E8F0;
  --clr-placeholder:#FFE8D6;
  --clr-easy:       #38A169;
  --clr-medium:     #DD6B20;
  --clr-hard:       #E53E3E;
  --clr-overlay:    rgba(0,0,0,.45);

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.07);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.08);
  --shadow-card: 0 2px 8px rgba(0,0,0,.08);

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-pill: 999px;

  --font-heading: 'Nunito', 'Segoe UI', sans-serif;
  --font-body:    'Lato', 'Helvetica Neue', Arial, sans-serif;

  --transition: 200ms ease;
  --transition-slow: 400ms ease;

  --max-w: 1280px;
  --header-h: 64px;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --clr-bg:         #1A202C;
    --clr-card:       #2D3748;
    --clr-text:       #F7FAFC;
    --clr-text-muted: #A0AEC0;
    --clr-border:     #4A5568;
    --clr-placeholder:#3D2B1F;
    --shadow-card:    0 2px 8px rgba(0,0,0,.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,.3);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--clr-text);
  background: var(--clr-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, video { max-width: 100%; display: block; }
a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; color: var(--clr-text); }

/* ── Utility Classes ────────────────────────────────────────── */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

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

.text-center { text-align: center; }
.section-gap { margin-top: 3rem; }
@media (min-width: 768px) { .section-gap { margin-top: 4rem; } }

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--clr-text);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-title span { color: var(--clr-primary); }
@media (min-width: 768px) { .section-title { font-size: 1.875rem; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.4rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: .9375rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-dk); color: #fff; }

.btn-secondary { background: var(--clr-secondary); color: var(--clr-text); }
.btn-secondary:hover { background: #f0c050; color: var(--clr-text); }

.btn-accent { background: var(--clr-accent); color: #fff; }
.btn-accent:hover { background: var(--clr-accent-dk); color: #fff; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--clr-primary);
  color: var(--clr-primary);
}
.btn-outline:hover { background: var(--clr-primary); color: #fff; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .65rem;
  border-radius: var(--radius-pill);
  font-size: .75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  white-space: nowrap;
}
.badge-primary  { background: var(--clr-primary);  color: #fff; }
.badge-easy     { background: var(--clr-easy);     color: #fff; }
.badge-medium   { background: var(--clr-medium);   color: #fff; }
.badge-hard     { background: var(--clr-hard);     color: #fff; }
.badge-category { background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px); }

/* ── Header & Navigation ────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--clr-card);
  border-bottom: 2px solid var(--clr-border);
  box-shadow: var(--shadow-sm);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--clr-text);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; color: var(--clr-primary); }
.site-logo .logo-emoji { font-size: 1.6rem; line-height: 1; }
.site-logo .logo-text { display: none; }
.site-logo .logo-text-short { display: block; }
@media (min-width: 480px) {
  .site-logo .logo-text { display: block; }
  .site-logo .logo-text-short { display: none; }
}
.site-logo .logo-accent { color: var(--clr-primary); }

/* Header search bar */
.header-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: .5rem 1rem .5rem 2.6rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-pill);
  background: var(--clr-bg);
  color: var(--clr-text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header-search input:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}
.header-search input::placeholder { color: var(--clr-text-muted); }
.header-search .search-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-muted);
  font-size: 1rem;
  pointer-events: none;
}

/* Primary Nav */
.site-nav { display: none; }
@media (min-width: 768px) {
  .site-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
  }
}
.site-nav a, .nav-link {
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--clr-text);
  font-size: .925rem;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.site-nav a:hover, .nav-link:hover {
  background: rgba(255,107,53,.1);
  color: var(--clr-primary);
  text-decoration: none;
}
.site-nav a.active { color: var(--clr-primary); }

/* Categories dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--clr-text);
  font-size: .925rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle {
  background: rgba(255,107,53,.1);
  color: var(--clr-primary);
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  min-width: 220px;
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  z-index: 300;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font-heading);
  transition: background var(--transition);
}
.nav-dropdown-menu a:hover {
  background: rgba(255,107,53,.08);
  color: var(--clr-primary);
  text-decoration: none;
}

/* Mobile menu toggle */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(255,107,53,.1); color: var(--clr-primary); }
@media (min-width: 768px) { .nav-toggle { display: none; } }

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: var(--clr-card);
  z-index: 150;
  padding: 1rem;
  overflow-y: auto;
  border-top: 1px solid var(--clr-border);
  flex-direction: column;
  gap: .25rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--clr-text);
  font-family: var(--font-heading);
  transition: background var(--transition);
}
.mobile-menu a:hover { background: rgba(255,107,53,.1); color: var(--clr-primary); text-decoration: none; }
.mobile-menu .mobile-section-title {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-text-muted);
  font-weight: 700;
  padding: .5rem 1rem .25rem;
  margin-top: .5rem;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  overflow: hidden;
  display: none;
}
.autocomplete-dropdown.open { display: block; }
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .9rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--clr-border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.focused { background: rgba(255,107,53,.07); }
.autocomplete-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--clr-placeholder);
}
.autocomplete-title {
  font-weight: 600;
  font-family: var(--font-heading);
  font-size: .9rem;
  color: var(--clr-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.autocomplete-meta {
  font-size: .75rem;
  color: var(--clr-text-muted);
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--clr-primary) 0%, #ff8c5a 40%, var(--clr-secondary) 100%);
  color: #fff;
  padding: 3.5rem 1rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Ccircle cx='30' cy='30' r='30'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }
.hero-emoji { font-size: 3.5rem; display: block; margin-bottom: .5rem; animation: bounce 2s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hero-title {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.15);
  margin-bottom: .5rem;
}
.hero-tagline {
  font-size: 1.1rem;
  opacity: .92;
  margin-bottom: 2rem;
  font-weight: 400;
}
@media (min-width: 640px) {
  .hero { padding: 5rem 1.5rem 6rem; }
  .hero-title { font-size: 2.75rem; }
  .hero-emoji { font-size: 4.5rem; }
}
@media (min-width: 1024px) {
  .hero-title { font-size: 3.25rem; }
  .hero-tagline { font-size: 1.25rem; }
}

/* Hero search */
.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.hero-search-inner {
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: var(--radius-pill);
  padding: .3rem .3rem .3rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  align-items: center;
}
.hero-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--clr-text);
  font-size: 1rem;
  outline: none;
  padding: .4rem 0;
}
.hero-search-input::placeholder { color: var(--clr-text-muted); }
.hero-search-btn {
  background: var(--clr-primary);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: .6rem 1.25rem;
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: .95rem;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.hero-search-btn:hover { background: var(--clr-primary-dk); transform: scale(1.02); }
.hero-search .autocomplete-dropdown {
  border-radius: var(--radius-md);
  top: calc(100% + .5rem);
}

/* ── Recipe of the Day ──────────────────────────────────────── */
.rotd-section {
  background: linear-gradient(135deg, #fff8f0 0%, #fff3e0 100%);
  border-top: 3px solid var(--clr-secondary);
  border-bottom: 3px solid var(--clr-secondary);
  padding: 2.5rem 0;
}
@media (prefers-color-scheme: dark) {
  .rotd-section { background: linear-gradient(135deg, #2d2419 0%, #332a1a 100%); }
}
.rotd-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--clr-secondary);
  color: var(--clr-text);
  padding: .25rem .9rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: .85rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rotd-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 768px) {
  .rotd-card { grid-template-columns: 1fr 1fr; }
}
.rotd-image-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--clr-placeholder);
  box-shadow: var(--shadow-lg);
}
.rotd-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.rotd-content { display: flex; flex-direction: column; gap: 1rem; }
.rotd-title {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
}
@media (min-width: 768px) { .rotd-title { font-size: 2rem; } }
.rotd-description {
  color: var(--clr-text-muted);
  font-size: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rotd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--clr-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: .3rem .85rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--clr-text);
  box-shadow: var(--shadow-sm);
}

/* ── Cuisine Tag Link ───────────────────────────────────────── */
.cuisine-link {
  color: var(--clr-primary);
  text-decoration: none;
  font-weight: 600;
}
.cuisine-link:hover {
  text-decoration: underline;
}

/* ── Category Bar Partial ───────────────────────────────────── */
.category-bar {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: .75rem 0;
}
.category-bar::-webkit-scrollbar { display: none; }
.category-bar-inner {
  display: flex;
  gap: .6rem;
  padding: .25rem .5rem;
  width: max-content;
  min-width: 100%;
}
.cat-pill {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--clr-card);
  border: 2px solid var(--clr-border);
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: .875rem;
  color: var(--clr-text);
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.cat-pill:hover {
  border-color: var(--clr-primary);
  background: rgba(255,107,53,.07);
  color: var(--clr-primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.cat-pill.active {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}
.cat-pill-icon { font-size: 1.1rem; line-height: 1; }

/* ── Recipe Grid ────────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (min-width: 640px)  { .recipe-grid { gap: 1.25rem; } }
@media (min-width: 768px)  { .recipe-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
@media (min-width: 1024px) { .recipe-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .recipe-grid { grid-template-columns: repeat(4, 1fr); gap: 1.75rem; } }

/* ── Recipe Card ────────────────────────────────────────────── */
.recipe-card {
  background: var(--clr-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--clr-border);
}
.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.recipe-card-link { display: contents; }
.recipe-card-link:hover { text-decoration: none; }

.card-image-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--clr-placeholder);
  overflow: hidden;
  flex-shrink: 0;
}
.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.recipe-card:hover .card-image-wrap img { transform: scale(1.05); }
.card-image-wrap .badge-category {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 2;
  font-size: .7rem;
}
.card-image-wrap .badge-difficulty {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
  font-size: .7rem;
}

.card-body {
  padding: .85rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: .4rem;
}
@media (min-width: 640px) { .card-body { padding: 1rem; } }

.card-title {
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--clr-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (min-width: 640px) { .card-title { font-size: 1rem; } }

.card-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--clr-text-muted);
  font-size: .8rem;
  flex-wrap: wrap;
  margin-top: auto;
}
.card-meta-item {
  display: flex;
  align-items: center;
  gap: .2rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .85rem .85rem;
  border-top: 1px solid var(--clr-border);
  margin-top: .25rem;
}
@media (min-width: 640px) { .card-footer { padding: .5rem 1rem 1rem; } }

/* Vote button on card */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--clr-text-muted);
  font-size: .85rem;
  font-weight: 700;
  font-family: var(--font-heading);
  padding: .3rem .65rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--clr-border);
  background: var(--clr-bg);
  transition: all var(--transition);
  cursor: pointer;
}
.vote-btn:hover, .vote-btn.voted {
  border-color: #e53e3e;
  background: #fff5f5;
  color: #e53e3e;
}
.vote-btn .heart { font-size: 1rem; transition: transform var(--transition); }
.vote-btn.pop .heart { animation: heartPop .35s ease; }
@keyframes heartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5) rotate(-10deg); }
  70%  { transform: scale(.85); }
  100% { transform: scale(1); }
}

.card-time {
  font-size: .8rem;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: .2rem;
}

/* ── Category Cards Grid ────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 480px)  { .category-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .category-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; } }
@media (min-width: 1024px) { .category-grid { grid-template-columns: repeat(6, 1fr); } }

.category-card {
  background: var(--clr-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem .75rem;
  text-align: center;
  border: 2px solid var(--clr-border);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}
.category-card:hover {
  border-color: var(--clr-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.category-card-icon { font-size: 2.25rem; line-height: 1; }
.category-card-name {
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: .9rem;
  color: var(--clr-text);
}
.category-card-count {
  font-size: .78rem;
  color: var(--clr-text-muted);
}

/* ── Recipe Detail Page ─────────────────────────────────────── */
.recipe-hero {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  background: var(--clr-placeholder);
  position: relative;
}
.recipe-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 500px;
  display: block;
}
.recipe-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.6) 0%, transparent 50%);
}

.recipe-detail { padding: 1.5rem 0 3rem; }

.recipe-header { margin-bottom: 1.5rem; }
.recipe-breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--clr-text-muted);
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.recipe-breadcrumb a { color: var(--clr-primary); font-weight: 600; }
.recipe-breadcrumb a:hover { text-decoration: underline; }
.recipe-breadcrumb .sep { color: var(--clr-border); }

.recipe-title-main {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: .75rem;
}
@media (min-width: 768px) { .recipe-title-main { font-size: 2.5rem; } }

.recipe-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.25rem;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--clr-border);
}

/* Large vote button */
.vote-btn-large {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--clr-border);
  background: var(--clr-card);
  color: var(--clr-text-muted);
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: all var(--transition);
}
.vote-btn-large:hover, .vote-btn-large.voted {
  border-color: #e53e3e;
  background: #fff5f5;
  color: #e53e3e;
}
.vote-btn-large .heart { font-size: 1.3rem; transition: transform var(--transition); }
.vote-btn-large.pop .heart { animation: heartPop .35s ease; }

/* Share buttons */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .5rem .9rem;
  border-radius: var(--radius-pill);
  font-size: .85rem;
  font-weight: 700;
  font-family: var(--font-heading);
  transition: transform var(--transition), opacity var(--transition);
  color: #fff;
  border: none;
  cursor: pointer;
}
.share-btn:hover { transform: translateY(-2px); opacity: .9; text-decoration: none; color: #fff; }
.share-x         { background: #000; }
.share-facebook  { background: #1877f2; }
.share-pinterest { background: #e60023; }
.share-whatsapp  { background: #25d366; }
.share-copy      { background: var(--clr-text-muted); }
.share-copy.copied { background: var(--clr-accent); }

/* Recipe body layout */
.recipe-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .recipe-body {
    grid-template-columns: 340px 1fr;
    gap: 2.5rem;
    align-items: start;
  }
  .recipe-aside { position: sticky; top: calc(var(--header-h) + 1rem); }
}

/* Ingredients */
.ingredients-box, .instructions-box, .nutrition-box, .recipe-info-box {
  background: var(--clr-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--clr-border);
}
.box-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--clr-secondary);
}

.ingredients-group-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--clr-text-muted);
  margin: 1rem 0 .4rem;
}
.ingredients-group-title:first-child { margin-top: 0; }

.ingredient-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .45rem .2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.ingredient-row:hover { background: rgba(255,107,53,.05); }
.ingredient-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--clr-accent);
  cursor: pointer;
  margin-top: 2px;
}
.ingredient-text { font-size: .95rem; line-height: 1.4; transition: opacity var(--transition); }
.ingredient-row.checked .ingredient-text {
  text-decoration: line-through;
  opacity: .5;
}
.ingredient-qty { font-weight: 700; color: var(--clr-primary); margin-right: .2rem; }
.ingredient-unit { color: var(--clr-text-muted); margin-right: .2rem; }

/* Instructions */
.instruction-step {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.instruction-step:last-child { margin-bottom: 0; }
.step-number {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-family: var(--font-heading);
  font-size: 1rem;
  flex-shrink: 0;
}
.step-text { font-size: 1rem; line-height: 1.7; padding-top: .35rem; }

/* Nutrition box */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  text-align: center;
}
.nutrition-item-label { font-size: .75rem; color: var(--clr-text-muted); font-weight: 600; text-transform: uppercase; }
.nutrition-item-val { font-size: 1.25rem; font-weight: 800; font-family: var(--font-heading); color: var(--clr-primary); }

/* Videos */
.video-section { margin-top: 2rem; }
.video-embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-md);
}
.video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Tags */
.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.5rem 0;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: .25rem .75rem;
  border-radius: var(--radius-pill);
  background: rgba(255,209,102,.2);
  border: 1px solid rgba(255,209,102,.5);
  color: var(--clr-text);
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--font-heading);
  transition: background var(--transition);
}
.tag-pill:hover {
  background: var(--clr-secondary);
  text-decoration: none;
  color: var(--clr-text);
}

/* Comments */
.comments-section { margin-top: 3rem; }
.comment-item {
  background: var(--clr-card);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid var(--clr-border);
  margin-bottom: 1rem;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}
.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}
.comment-name { font-weight: 700; font-family: var(--font-heading); font-size: .95rem; }
.comment-time { font-size: .78rem; color: var(--clr-text-muted); margin-left: auto; }
.comment-message { font-size: .95rem; line-height: 1.55; }

.comment-form {
  background: var(--clr-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--clr-border);
  margin-top: 1.5rem;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: .9rem;
  margin-bottom: .35rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: .65rem 1rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-bg);
  color: var(--clr-text);
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}
.form-group textarea { min-height: 110px; resize: vertical; }

/* ── Search Page ─────────────────────────────────────────────── */
.search-hero {
  background: linear-gradient(135deg, #fff8f0 0%, #fff3e0 100%);
  border-bottom: 2px solid var(--clr-border);
  padding: 2rem 0;
}
@media (prefers-color-scheme: dark) {
  .search-hero { background: linear-gradient(135deg, #2d2419 0%, #332a1a 100%); }
}
.search-page-bar {
  display: flex;
  gap: .5rem;
  max-width: 680px;
  margin: 0 auto;
}
.search-page-input {
  flex: 1;
  padding: .75rem 1.25rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-pill);
  background: var(--clr-card);
  color: var(--clr-text);
  font-size: 1rem;
  transition: border-color var(--transition);
}
.search-page-input:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.15);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 1.5rem;
}
.filter-bar label { font-size: .85rem; font-weight: 700; color: var(--clr-text-muted); }
.filter-select {
  padding: .45rem .9rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-pill);
  background: var(--clr-card);
  color: var(--clr-text);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--clr-primary); }

.results-meta {
  font-size: .9rem;
  color: var(--clr-text-muted);
  margin-bottom: 1rem;
}
.results-meta strong { color: var(--clr-text); }

.no-results {
  text-align: center;
  padding: 4rem 1rem;
}
.no-results-emoji { font-size: 5rem; display: block; margin-bottom: 1rem; }
.no-results h2 { font-size: 1.75rem; margin-bottom: .5rem; }
.no-results p { color: var(--clr-text-muted); margin-bottom: 1.5rem; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 .6rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: .9rem;
  border: 2px solid var(--clr-border);
  background: var(--clr-card);
  color: var(--clr-text);
  transition: all var(--transition);
  cursor: pointer;
}
.page-link:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  text-decoration: none;
}
.page-link.current {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}
.page-link.disabled {
  opacity: .4;
  pointer-events: none;
}
.page-ellipsis {
  color: var(--clr-text-muted);
  font-weight: 700;
  font-family: var(--font-heading);
  padding: 0 .25rem;
}

/* ── Category Page Header ───────────────────────────────────── */
.category-page-header {
  background: linear-gradient(135deg, var(--clr-primary) 0%, #ff8c5a 100%);
  color: #fff;
  padding: 2.5rem 0;
  text-align: center;
  margin-bottom: 2rem;
}
.category-page-icon { font-size: 3.5rem; display: block; margin-bottom: .5rem; }
.category-page-title { font-size: 1.75rem; font-weight: 900; color: #fff; }
.category-page-desc { opacity: .9; max-width: 560px; margin: .5rem auto 0; }
.category-count-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-pill);
  padding: .3rem .9rem;
  font-size: .85rem;
  font-weight: 700;
  margin-top: .75rem;
}
@media (min-width: 768px) { .category-page-title { font-size: 2.5rem; } }

/* ── Trending Page ───────────────────────────────────────────── */
.trending-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 2.5rem 0;
  text-align: center;
  margin-bottom: 2rem;
}
.trending-header h1 { color: #fff; font-size: 2rem; }
@media (min-width: 768px) { .trending-header h1 { font-size: 2.75rem; } }
.trending-sub { opacity: .8; margin-top: .4rem; font-size: 1.05rem; }
.trending-fire { font-size: 4rem; display: block; margin-bottom: .5rem; animation: flicker 1.5s ease-in-out infinite alternate; }
@keyframes flicker {
  0%   { transform: scale(1) rotate(-3deg); }
  100% { transform: scale(1.1) rotate(3deg); }
}

/* ── 404 Page ────────────────────────────────────────────────── */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--clr-bg);
}
.page-404-emoji { font-size: 7rem; display: block; margin-bottom: 1rem; animation: wobble 2s ease-in-out infinite; }
@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}
.page-404 h1 { font-size: 2rem; margin-bottom: .5rem; }
@media (min-width: 640px) { .page-404 h1 { font-size: 3rem; } }
.page-404 .code { font-size: 6rem; font-weight: 900; color: var(--clr-primary); opacity: .15; position: absolute; top: 2rem; left: 50%; transform: translateX(-50%); pointer-events: none; }
.page-404-inner { position: relative; max-width: 480px; }
.page-404 p { font-size: 1.1rem; color: var(--clr-text-muted); margin-bottom: 2rem; }
.page-404-links { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: #1a1a2e;
  color: #cbd5e0;
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (min-width: 640px)  { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }

.footer-brand .site-logo { color: #fff; font-size: 1.35rem; }
.footer-brand .site-logo:hover { color: var(--clr-secondary); }
.footer-brand p {
  margin-top: .75rem;
  font-size: .9rem;
  color: #a0aec0;
  line-height: 1.6;
}

.footer-col h4 {
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  margin-bottom: .75rem;
}
.footer-col ul { display: flex; flex-direction: column; gap: .35rem; }
.footer-col a {
  color: #a0aec0;
  font-size: .9rem;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.footer-col a:hover { color: var(--clr-secondary); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  color: #718096;
}
.footer-bottom a { color: #a0aec0; }
.footer-bottom a:hover { color: var(--clr-secondary); text-decoration: none; }
.footer-love { color: #a0aec0; }
.footer-love .heart { color: #e53e3e; }

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--clr-text);
  color: #fff;
  padding: .7rem 1.5rem;
  border-radius: var(--radius-pill);
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font-heading);
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease, toastOut .3s ease 2.5s forwards;
  pointer-events: auto;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(.9); }
}

/* ── Related Recipes ────────────────────────────────────────── */
.related-section { margin-top: 3rem; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 640px)  { .related-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .related-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }

/* ── Loading skeleton ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--clr-border) 25%, var(--clr-bg) 50%, var(--clr-border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Image placeholder ──────────────────────────────────────── */
img.lazy { background: var(--clr-placeholder); }

/* ── Jump to recipe ─────────────────────────────────────────── */
.jump-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--clr-primary);
  padding: .4rem .9rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--clr-primary);
  transition: background var(--transition), color var(--transition);
}
.jump-link:hover { background: var(--clr-primary); color: #fff; text-decoration: none; }

/* ── Responsive helpers ─────────────────────────────────────── */
.hide-mobile  { display: none; }
@media (min-width: 768px) {
  .hide-mobile  { display: initial; }
  .hide-desktop { display: none; }
}

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .vote-btn, .vote-btn-large,
  .share-buttons, .related-section, .comments-section,
  .category-bar, .recipe-hero-overlay, .video-section,
  .tag-pill, .jump-link, .recipe-actions { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .recipe-hero img { max-height: 240px; }
  .recipe-body { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .recipe-aside { position: static; }
  .ingredients-box, .instructions-box, .nutrition-box {
    box-shadow: none;
    border: 1pt solid #ccc;
  }
  a { color: #000; text-decoration: none; }
  h1,h2,h3 { page-break-after: avoid; }
  .ingredient-row, .instruction-step { page-break-inside: avoid; }
}

/* ── Smooth transitions for theme ───────────────────────────── */
body, .site-header, .site-footer, .recipe-card, .category-card,
.ingredients-box, .instructions-box, .nutrition-box {
  transition: background-color .3s ease, border-color .3s ease;
}

/* ── Accessibility focus styles ─────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible { border-radius: var(--radius-sm); }

/* ── Source attribution ─────────────────────────────────────── */
.source-credit {
  font-size: .8rem;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.source-credit a { color: var(--clr-primary); font-weight: 600; }

/* ── Recipe info box ────────────────────────────────────────── */
.recipe-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.info-item { text-align: center; }
.info-item-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--clr-text-muted);
  font-weight: 700;
  display: block;
}
.info-item-val {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--clr-text);
  display: block;
}

/* ── Scroll-to-top ──────────────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 100;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top:hover { background: var(--clr-primary-dk); }

/* ── Misc ───────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: 1.5rem 0;
}
.view-all-wrap { text-align: center; margin-top: 2rem; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--clr-text-muted);
}
.empty-state-emoji { font-size: 3rem; display: block; margin-bottom: .75rem; }
