/* ========================================
   Shilpa ki Rasoi — Base Styles
   Reset, Variables, Typography
   ======================================== */

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

:root {
  /* Color Palette */
  --c-saffron: #D4451A;
  --c-saffron-soft: #E8732A;
  --c-saffron-light: #F2A07B;
  --c-turmeric: #F5A623;
  --c-turmeric-pale: #FFF8EE;
  --c-turmeric-glow: #FCEBD0;
  --c-green: #2E7D32;
  --c-green-soft: #E8F5E9;
  --c-green-muted: #5A9E5E;
  --c-cream: #FDFBF7;
  --c-warm-white: #FFFDF9;
  --c-text: #2C1810;
  --c-text-secondary: #6D4C41;
  --c-text-muted: #9E8E82;
  --c-border: #E8DED4;
  --c-border-light: #F0E8DF;
  --c-card: #FFFFFF;
  --c-shadow: rgba(44, 24, 16, 0.06);
  --c-shadow-md: rgba(44, 24, 16, 0.1);
  --c-shadow-lg: rgba(44, 24, 16, 0.14);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50px;

  /* Fonts */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Layout */
  --max-w: 1200px;
  --max-w-recipe: 820px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s var(--ease-out);
  --transition-normal: 0.25s var(--ease-out);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--c-cream);
  color: var(--c-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Links */
a { color: inherit; text-decoration: none; }
a:focus-visible {
  outline: 2px solid var(--c-saffron);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol { padding-left: 1.5em; }

/* Selection */
::selection {
  background: var(--c-turmeric-glow);
  color: var(--c-text);
}

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text-muted); }

/* Typography Scale */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--c-text);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 600; }
h3 { font-size: clamp(1.05rem, 2vw, 1.2rem); font-weight: 600; }

/* Container */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}


/* ========================================
   Components — Cards, Badges, Buttons, Search
   ======================================== */

/* Category Card */
.cat-card {
  background: var(--c-card);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  user-select: none;
}
.cat-card:hover {
  border-color: var(--c-saffron-soft);
  box-shadow: 0 6px 20px var(--c-shadow);
  transform: translateY(-3px);
}
.cat-card.active {
  border-color: var(--c-saffron);
  background: var(--c-turmeric-pale);
  box-shadow: 0 4px 16px rgba(212, 69, 26, 0.1);
}
.cat-emoji {
  font-size: 1.6rem;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-turmeric-pale);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.cat-card.active .cat-emoji { background: rgba(255,255,255,0.7); }
.cat-text { min-width: 0; }
.cat-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-count {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  font-weight: 500;
  margin-top: 0.1rem;
}

/* Recipe Link */
.recipe-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--c-card);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--c-text);
  transition: all var(--transition-fast);
  text-decoration: none;
}
.recipe-link:hover {
  border-color: var(--c-saffron-soft);
  background: var(--c-turmeric-pale);
  padding-left: 1.2rem;
}
.recipe-link .r-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.recipe-link .r-arrow {
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--c-saffron);
  font-weight: 600;
}
.recipe-link:hover .r-arrow { opacity: 1; }

/* Category Badge */
.recipe-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-saffron);
  background: var(--c-turmeric-pale);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

/* Search Result Category Badge */
.search-result-cat {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--c-green);
  background: var(--c-green-soft);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Metadata Pills */
.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--c-text-secondary);
  background: var(--c-warm-white);
  border: 1px solid var(--c-border-light);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
}
.meta-pill svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

/* Search Bar */
.search-wrap {
  max-width: 560px;
  margin: -1.6rem auto 0;
  padding: 0 1.5rem;
  position: relative;
  z-index: 20;
}
.search-input-wrap {
  position: relative;
  background: var(--c-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px var(--c-shadow-md), 0 2px 8px var(--c-shadow);
  overflow: hidden;
}
.search-icon {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0.35;
}
.search-input {
  width: 100%;
  padding: 1rem 3rem 1rem 3.2rem;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  border: 2px solid transparent;
  background: transparent;
  outline: none;
  color: var(--c-text);
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--c-saffron-soft); }
.search-input::placeholder { color: var(--c-text-muted); }
.search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--c-border-light);
  color: var(--c-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.search-clear:hover { background: var(--c-border); }
.search-clear.visible { display: flex; }
.search-kbd {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--c-text-muted);
  background: var(--c-border-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  pointer-events: none;
}

/* Section Label */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-muted);
  margin-bottom: 1rem;
  padding-top: 2.5rem;
}

/* Dark Mode Toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  background: var(--c-card);
  color: var(--c-text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.theme-toggle:hover {
  border-color: var(--c-saffron-soft);
  background: var(--c-turmeric-pale);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
}


/* ========================================
   Homepage — Hero, Category Grid, Panels
   ======================================== */

/* Hero Section */
.hero {
  background: linear-gradient(165deg, #B7300D 0%, var(--c-saffron) 40%, var(--c-saffron-soft) 70%, var(--c-turmeric) 100%);
  color: white;
  padding: 4rem 1.5rem 5.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 40%);
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--c-cream);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 16px rgba(0,0,0,0.12);
}
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: 0.92;
  font-weight: 400;
  margin-bottom: 1.5rem;
  font-style: italic;
  font-family: var(--font-display);
}
.hero-stats {
  display: inline-flex;
  gap: 1.5rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
}
.hero-stats span { opacity: 0.75; }

/* ---- Group Sections (hierarchical) ---- */
.groups-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.group-section {
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}
.group-section.expanded {
  box-shadow: 0 4px 24px var(--c-shadow);
}

/* Group Row (clickable header) */
.group-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: var(--c-card);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}
.group-section.expanded .group-row {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
  background: var(--c-turmeric-pale);
}
.group-row:hover {
  border-color: var(--c-saffron-soft);
  background: var(--c-warm-white);
}
.group-section.expanded .group-row:hover {
  background: var(--c-turmeric-pale);
}

.group-emoji {
  font-size: 1.8rem;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-turmeric-pale);
  border-radius: var(--radius-sm);
}
.group-section.expanded .group-emoji {
  background: rgba(255,255,255,0.6);
}

.group-info {
  flex: 1;
  min-width: 0;
}
.group-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.3;
}
.group-desc {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.group-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-text-secondary);
  white-space: nowrap;
}

.group-chevron {
  width: 20px;
  height: 20px;
  color: var(--c-text-muted);
  transition: transform 0.3s var(--ease-out);
  flex-shrink: 0;
}
.group-section.expanded .group-chevron {
  transform: rotate(180deg);
  color: var(--c-saffron);
}

/* Sub-categories panel (inside expanded group) */
.group-subcats {
  display: none;
  padding: 1rem 1.4rem 1.4rem;
  background: var(--c-card);
  border: 1px solid var(--c-border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.group-section.expanded .group-subcats {
  display: block;
  animation: fadeSlideIn 0.25s var(--ease-out);
}

.subcat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}

/* Category Grid (kept for sub-categories + search fallback) */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.8rem;
}

/* Recipe List Panel */
.recipes-panel {
  display: none;
  margin-top: 2rem;
  animation: fadeSlideIn 0.3s var(--ease-out);
}
.recipes-panel.open { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-text);
}
.panel-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.panel-close:hover {
  background: var(--c-saffron);
  color: white;
  border-color: var(--c-saffron);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
}

/* Search Results */
.search-results { display: none; margin-top: 2rem; }
.search-results.open { display: block; animation: fadeSlideIn 0.3s var(--ease-out); }
.search-info {
  font-size: 0.9rem;
  color: var(--c-text-secondary);
  margin-bottom: 1rem;
}
.search-info strong { color: var(--c-text); }

.no-results {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--c-text-muted);
}
.no-results .nr-emoji { font-size: 3.5rem; margin-bottom: 1rem; }
.no-results p { font-size: 1rem; }

/* Footer */
.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--c-text-muted);
  font-size: 0.85rem;
  margin-top: 4rem;
  border-top: 1px solid var(--c-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}
.site-footer a {
  color: var(--c-saffron);
  font-weight: 500;
  transition: opacity var(--transition-fast);
}
.site-footer a:hover { opacity: 0.7; }


/* ========================================
   Recipe Page — Layout, Ingredients, Method
   ======================================== */

/* Nav */
.recipe-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border-light);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: nowrap;
}
.nav-home {
  font-weight: 700;
  color: var(--c-saffron);
}
.nav-home:hover { text-decoration: underline; }
.nav-sep { color: var(--c-border); }
.nav-cat { color: var(--c-text-secondary); font-weight: 500; }
.nav-cat:hover { color: var(--c-saffron); }
.nav-current { color: var(--c-text-muted); }

/* Recipe Page Container */
.recipe-page {
  max-width: var(--max-w-recipe);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero Image */
.recipe-hero-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px var(--c-shadow-md);
  margin-bottom: 2rem;
}

/* Recipe Header */
.recipe-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--c-border-light);
}
.recipe-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
}

/* Recipe Content Grid */
.recipe-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .recipe-content {
    grid-template-columns: 300px 1fr;
    gap: 2.5rem;
  }
}

/* Ingredients Card */
.ingredients-card {
  background: var(--c-turmeric-pale);
  border: 1px solid var(--c-turmeric-glow);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .ingredients-card {
    position: sticky;
    top: 60px;
    align-self: start;
  }
}

.ingredients-card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--c-turmeric-glow);
}

.ingredients-card h3 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-saffron);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.ingredients-card ul {
  list-style: none;
  padding: 0;
}
.ingredients-card li {
  padding: 0.4rem 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--c-text);
  border-bottom: 1px solid rgba(232, 222, 212, 0.4);
  position: relative;
  padding-left: 1rem;
}
.ingredients-card li:last-child { border-bottom: none; }
.ingredients-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-saffron-light);
}

/* Method Section */
.method-section h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 1.5rem;
}

.method-section ol {
  list-style: none;
  padding: 0;
  counter-reset: step;
}
.method-section ol > li {
  counter-increment: step;
  padding: 1rem 0 1rem 3.5rem;
  position: relative;
  font-size: 0.98rem;
  line-height: 1.75;
  border-bottom: 1px solid var(--c-border-light);
}
.method-section ol > li:last-child { border-bottom: none; }
.method-section ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--c-saffron);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}

/* Notes Section */
.notes-section {
  margin-top: 2rem;
  padding: 1.2rem 1.5rem;
  background: var(--c-green-soft);
  border-left: 4px solid var(--c-green-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
  color: var(--c-text-secondary);
  line-height: 1.7;
}
.notes-section h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
  color: var(--c-green);
}

/* Fallback: unstructured recipe body */
.recipe-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-text);
}
.recipe-body p { margin-bottom: 0.8rem; }
.recipe-body strong { font-weight: 700; color: var(--c-text); }
.recipe-body ul, .recipe-body ol { margin-bottom: 1rem; padding-left: 1.8rem; }
.recipe-body li { margin-bottom: 0.3rem; padding-left: 0.3rem; }
.recipe-body li::marker { color: var(--c-saffron-soft); }
.recipe-body img {
  margin: 1.5rem auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px var(--c-shadow-md);
  max-height: 500px;
  object-fit: contain;
}
.recipe-body h1, .recipe-body h2, .recipe-body h3 {
  font-family: var(--font-display);
  margin: 1.5rem 0 0.75rem;
  line-height: 1.3;
}
.recipe-body h2 { font-size: 1.4rem; }
.recipe-body h3 { font-size: 1.15rem; }

.recipe-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.recipe-body td, .recipe-body th {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--c-border);
  text-align: left;
}
.recipe-body th {
  background: var(--c-turmeric-pale);
  font-weight: 600;
}
.recipe-body tr:nth-child(even) td {
  background: rgba(0,0,0,0.015);
}

/* Back Link */
.recipe-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--c-text-secondary);
  transition: all var(--transition-fast);
}
.recipe-footer-link:hover {
  border-color: var(--c-saffron);
  color: var(--c-saffron);
  background: var(--c-turmeric-pale);
}


/* ========================================
   Responsive Breakpoints
   ======================================== */

@media (max-width: 768px) {
  .hero { padding: 3rem 1rem 4.5rem; }

  .group-row { padding: 0.9rem 1rem; gap: 0.75rem; }
  .group-emoji { width: 2.2rem; height: 2.2rem; font-size: 1.4rem; }
  .group-name { font-size: 1rem; }
  .group-desc { display: none; }
  .group-subcats { padding: 0.8rem 1rem 1rem; }
  .subcat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }

  .cat-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6rem;
  }
  .cat-card { padding: 0.85rem; }
  .cat-emoji { width: 2rem; height: 2rem; font-size: 1.3rem; }

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

  .recipe-page { padding: 1.5rem 1rem 3rem; }
  .recipe-hero-image { max-height: 280px; border-radius: var(--radius-md); }

  .recipe-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .ingredients-card {
    position: static;
  }

  .method-section ol > li {
    padding-left: 3rem;
  }
  .method-section ol > li::before {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.78rem;
  }

  .site-footer { flex-direction: column; gap: 0.5rem; }
}

@media (max-width: 480px) {
  .subcat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }

  .hero h1 { font-size: 2rem; }
  .hero-stats {
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.6rem 1.2rem;
  }

  .panel-title { font-size: 1.2rem; }

  .recipe-header h1 { font-size: 1.5rem; }

  .ingredients-card { padding: 1.2rem; }

  .recipe-meta { gap: 0.4rem; }
  .meta-pill { font-size: 0.78rem; padding: 0.3rem 0.65rem; }
}


/* ========================================
   Print Styles
   ======================================== */

@media print {
  .recipe-nav,
  .site-footer,
  .search-wrap,
  .recipe-footer-link,
  .theme-toggle { display: none !important; }

  body {
    background: white;
    color: #111;
    font-size: 11pt;
    line-height: 1.5;
  }

  .recipe-page { padding: 0; max-width: 100%; }

  .recipe-hero-image {
    max-height: 200px;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .recipe-header {
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
  }

  .recipe-header h1 { font-size: 1.6rem; }

  /* Two-column ingredients on print */
  .recipe-content {
    display: block;
  }

  .ingredients-card {
    background: #f9f6f2;
    border: 1px solid #ddd;
    position: static;
    margin-bottom: 1.5rem;
    break-inside: avoid;
  }
  .ingredients-card ul {
    columns: 2;
    column-gap: 2rem;
  }
  .ingredients-card li {
    break-inside: avoid;
    border-bottom: none;
  }

  .method-section ol > li {
    break-inside: avoid;
  }
  .method-section ol > li::before {
    background: #333;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .notes-section {
    background: #f5f5f5;
    border-left-color: #666;
  }

  .recipe-body img { box-shadow: none; }

  /* Print URL at bottom */
  .recipe-page::after {
    content: "Source: " attr(data-url);
    display: block;
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ccc;
    font-size: 9pt;
    color: #666;
  }
}


/* ========================================
   Dark Mode
   ======================================== */

/* Auto dark mode via prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-saffron: #E8732A;
    --c-saffron-soft: #F2944D;
    --c-saffron-light: #F5B07D;
    --c-turmeric: #E8A020;
    --c-turmeric-pale: #2A2318;
    --c-turmeric-glow: #352B1E;
    --c-green: #4CAF50;
    --c-green-soft: #1A2A1A;
    --c-green-muted: #66BB6A;
    --c-cream: #1A1410;
    --c-warm-white: #1E1814;
    --c-text: #E8DED4;
    --c-text-secondary: #B8A89C;
    --c-text-muted: #7D6E62;
    --c-border: #3A3028;
    --c-border-light: #2E261E;
    --c-card: #252018;
    --c-shadow: rgba(0, 0, 0, 0.2);
    --c-shadow-md: rgba(0, 0, 0, 0.3);
    --c-shadow-lg: rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme="light"]) .hero {
    background: linear-gradient(165deg, #6B1E0A 0%, #8B3515 40%, #A04520 70%, #8B6B20 100%);
  }

  :root:not([data-theme="light"]) .recipe-nav {
    background: rgba(26, 20, 16, 0.92);
  }

  :root:not([data-theme="light"]) .search-input-wrap {
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  }

  :root:not([data-theme="light"]) .method-section ol > li::before {
    background: var(--c-saffron);
  }

  :root:not([data-theme="light"]) .ingredients-card li::before {
    background: var(--c-saffron-light);
  }
}

/* Manual dark mode override */
[data-theme="dark"] {
  --c-saffron: #E8732A;
  --c-saffron-soft: #F2944D;
  --c-saffron-light: #F5B07D;
  --c-turmeric: #E8A020;
  --c-turmeric-pale: #2A2318;
  --c-turmeric-glow: #352B1E;
  --c-green: #4CAF50;
  --c-green-soft: #1A2A1A;
  --c-green-muted: #66BB6A;
  --c-cream: #1A1410;
  --c-warm-white: #1E1814;
  --c-text: #E8DED4;
  --c-text-secondary: #B8A89C;
  --c-text-muted: #7D6E62;
  --c-border: #3A3028;
  --c-border-light: #2E261E;
  --c-card: #252018;
  --c-shadow: rgba(0, 0, 0, 0.2);
  --c-shadow-md: rgba(0, 0, 0, 0.3);
  --c-shadow-lg: rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hero {
  background: linear-gradient(165deg, #6B1E0A 0%, #8B3515 40%, #A04520 70%, #8B6B20 100%);
}

[data-theme="dark"] .recipe-nav {
  background: rgba(26, 20, 16, 0.92);
}

[data-theme="dark"] .search-input-wrap {
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="dark"] .method-section ol > li::before {
  background: var(--c-saffron);
}

[data-theme="dark"] .ingredients-card li::before {
  background: var(--c-saffron-light);
}
