/* ==========================================================================
   style.css  –  Ninja Creami Protein Ice Cream Website
   ==========================================================================

   HOW THIS FILE IS ORGANISED
   --------------------------
   1.  CSS Custom Properties (variables)   ← Change colours / fonts here
   2.  Reset & Base
   3.  Typography
   4.  Top Navigation bar
   5.  Page Hero sections
   6.  Home page – feature cards
   7.  Recipes page – two-column layout (sidebar + content)
   8.  Recipe cards (photo + ingredients side-by-side)
   9.  Macro badge pills
   10. Ingredients table
   11. Instructions block
   12. Bio page
   13. Footer
   14. Utility classes
   15. Responsive / mobile overrides

   ========================================================================== */


/* ──────────────────────────────────────────────────────────────────────────
   1. CSS CUSTOM PROPERTIES
   Change these to restyle the whole site at once.
   ────────────────────────────────────────────────────────────────────────── */
:root {
  /* Colours */
  --color-bg-page:       #f0f4f8;   /* light grey-blue page background       */
  --color-bg-card:       #ffffff;   /* white recipe / feature cards          */
  --color-bg-hero:       #0f172a;   /* dark navy for hero sections           */
  --color-bg-sidebar:    #0f172a;   /* sidebar background                    */
  --color-bg-nav:        #0f172a;   /* top navigation bar background         */

  --color-text-primary:  #0f172a;   /* main body text (very dark navy)       */
  --color-text-secondary:#475569;   /* secondary / caption text              */
  --color-text-light:    #e2e8f0;   /* text on dark backgrounds              */
  --color-text-muted:    #94a3b8;   /* muted / placeholder text              */

  --color-accent:        #22c55e;   /* green accent – buttons, highlights    */
  --color-accent-dark:   #16a34a;   /* darker green for hover states         */
  --color-accent-glow:   rgba(34, 197, 94, 0.18); /* subtle glow             */

  --color-border:        #e2e8f0;   /* light border colour                   */
  --color-sidebar-active:#22c55e;   /* sidebar item that is currently active */

  /* Shadows */
  --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.08);  /* card drop shadow      */
  --shadow-nav:   0 2px 12px rgba(0, 0, 0, 0.18);  /* nav bar shadow        */

  /* Spacing */
  --space-xs:  0.25rem;   /*  4px */
  --space-sm:  0.5rem;    /*  8px */
  --space-md:  1rem;      /* 16px */
  --space-lg:  1.5rem;    /* 24px */
  --space-xl:  2rem;      /* 32px */
  --space-2xl: 3rem;      /* 48px */

  /* Border radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-pill: 999px;

  /* Layout */
  --sidebar-width: 280px;    /* width of the recipe sidebar on desktop       */
  --content-max:   900px;    /* max content width inside the main area       */
  --nav-height:    64px;     /* height of the top navigation bar             */

  /* Fonts  – loaded via Google Fonts in each HTML <head>                    */
  --font-heading: 'Poppins', sans-serif;
  --font-body:    'Inter',   sans-serif;
}


/* ──────────────────────────────────────────────────────────────────────────
   2. RESET & BASE
   ────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;   /* enables smooth scrolling when clicking links */
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
  line-height: 1.6;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}


/* ──────────────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY
   Change font sizes here if you want larger or smaller text.
   ────────────────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1rem; }

p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}


/* ──────────────────────────────────────────────────────────────────────────
   4. TOP NAVIGATION BAR
   The nav bar appears on every page. Edit links in each HTML file's <nav>.
   ────────────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;         /* sticks to the top as you scroll               */
  top: 0;
  z-index: 100;
  background: var(--color-bg-nav);
  box-shadow: var(--shadow-nav);
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* Site logo / name in the nav bar */
.navbar__logo {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.navbar__logo span {          /* the green accent dot or emoji in the logo   */
  color: var(--color-accent);
}

/* Nav link list */
.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.navbar__links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.navbar__links a:hover,
.navbar__links a.active {      /* add class="active" to the current page link */
  color: var(--color-accent);
}


/* ──────────────────────────────────────────────────────────────────────────
   5. PAGE HERO SECTIONS
   Used on the home page and bio page. Change the gradient in .hero--home
   if you want a different colour for the home hero.
   ────────────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--color-bg-hero);
  color: var(--color-text-light);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Decorative gradient blob behind hero text */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(34,197,94,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 70%, rgba(99,102,241,0.10) 0%, transparent 55%);
  pointer-events: none;
}

.hero__content {
  position: relative;   /* sits above the ::before gradient blob             */
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-2xl) 0;
}

.hero__eyebrow {          /* small label above the main heading              */
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.hero__heading {
  color: #ffffff;
  margin-bottom: var(--space-md);
}

.hero__subheading {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* Button used in hero sections */
.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(34,197,94,0.35);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34,197,94,0.45);
  background: var(--color-accent-dark);
}


/* ──────────────────────────────────────────────────────────────────────────
   6. HOME PAGE – FEATURE CARDS
   The three cards on the home page that highlight the site's value props.
   ────────────────────────────────────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-xl);
  max-width: var(--content-max);
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-xl);
}

.feature-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: transform 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
}

.feature-card__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.feature-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.feature-card__text {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* Preview grid of recipe photos on the home page */
.home-preview {
  max-width: 1100px;
  margin: 0 auto var(--space-2xl);
  padding: 0 var(--space-xl);
}

.home-preview__heading {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.home-preview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.preview-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease;
}

.preview-card:hover {
  transform: translateY(-4px);
}

.preview-card__img {
  width: 100%;
  height: 200px;
  object-fit: cover;      /* crop image to fill the box without stretching  */
}

.preview-card__body {
  padding: var(--space-md) var(--space-lg);
}

.preview-card__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.preview-card__macros {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.preview-card__link {
  display: block;
  text-align: center;
  margin-top: var(--space-md);
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.preview-card__link:hover { color: var(--color-accent-dark); }


/* ──────────────────────────────────────────────────────────────────────────
   7. RECIPES PAGE – TWO-COLUMN LAYOUT
   On desktop: left sidebar (fixed) + right scrollable content area.
   On mobile: sidebar collapses; a sticky toggle button shows/hides it.
   ────────────────────────────────────────────────────────────────────────── */

/* Wrapper that holds both columns */
.recipes-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height));
}

/* ---- LEFT SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;              /* never compress the sidebar                  */
  background: var(--color-bg-sidebar);
  position: sticky;
  top: var(--nav-height);      /* sticks just below the nav bar               */
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;            /* scrollable if many recipes don't all fit    */
  padding: var(--space-xl) 0;
  z-index: 50;

  /* custom scrollbar for webkit browsers */
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.sidebar__heading {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 var(--space-lg) var(--space-md);
  border-bottom: 1px solid #1e293b;
  margin-bottom: var(--space-sm);
}

.sidebar__list {
  list-style: none;
}

/* Each recipe link in the sidebar */
.sidebar__item a {
  display: block;
  padding: 0.6rem var(--space-lg);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  line-height: 1.4;
}

.sidebar__item a:hover {
  color: var(--color-text-light);
  background: rgba(255,255,255,0.05);
}

/* The 'active' class is added by JavaScript when a recipe is in view */
.sidebar__item a.active {
  color: var(--color-sidebar-active);
  border-left-color: var(--color-sidebar-active);
  background: rgba(34,197,94,0.08);
  font-weight: 600;
}

/* ---- RIGHT CONTENT AREA ---- */
.recipes-content {
  flex: 1;                     /* takes all remaining width                   */
  min-width: 0;                /* prevents flex blowout on narrow screens     */
  padding: var(--space-xl);
}

/* Mobile toggle button (hidden on desktop) */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 200;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.7rem 1.4rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(34,197,94,0.4);
}


/* ──────────────────────────────────────────────────────────────────────────
   8. RECIPE CARDS
   Each recipe is a card with:
     - Header (name + macros)
     - Two-column body: photo on left, ingredients on right
     - Instructions section below
   ────────────────────────────────────────────────────────────────────────── */

/* Outer card container – add margin between cards */
.recipe-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2xl);
  overflow: hidden;
  scroll-margin-top: calc(var(--nav-height) + 1rem); /* offset for sticky nav */
}

/* Card header row */
.recipe-card__header {
  padding: var(--space-xl) var(--space-xl) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.recipe-card__title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.recipe-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Two-column body: [photo] [ingredients] */
.recipe-card__body {
  display: grid;
  grid-template-columns: 1fr 1fr;  /* equal columns on desktop               */
  gap: 0;
}

/* ---- Photo column ---- */
.recipe-card__photo-col {
  position: relative;
  background: #e2e8f0;  /* fallback background if no photo                   */
  min-height: 280px;
}

.recipe-card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;    /* fill the box and crop – never stretch             */
  min-height: 280px;
}

/* Shown when there is no photo yet */
.recipe-card__no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  gap: var(--space-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.recipe-card__no-photo-icon {
  font-size: 3rem;
  opacity: 0.4;
}

/* ---- Ingredients column ---- */
.recipe-card__ingredients-col {
  padding: var(--space-xl);
  border-left: 1px solid var(--color-border);
}

.recipe-card__ingredients-col h3 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* Instructions section below the two-column body */
.recipe-card__instructions {
  padding: var(--space-xl);
  border-top: 1px solid var(--color-border);
  background: #fafbfc;  /* very slightly off-white to visually separate      */
}

.recipe-card__instructions h3 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.recipe-card__instructions p {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.95rem;
}


/* ──────────────────────────────────────────────────────────────────────────
   9. MACRO BADGE PILLS
   Small coloured pills that show kcal and protein at a glance.
   Add more badge types by following the same pattern (.badge--fat etc.).
   ────────────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.badge--kcal {
  background: #fff7ed;
  color: #c2410c;           /* warm orange – energy / calories               */
  border: 1px solid #fed7aa;
}

.badge--protein {
  background: #f0fdf4;
  color: #15803d;           /* green – protein                               */
  border: 1px solid #bbf7d0;
}

.badge--total {
  background: #f8fafc;
  color: #475569;           /* neutral grey – total weight                   */
  border: 1px solid #e2e8f0;
}


/* ──────────────────────────────────────────────────────────────────────────
   10. INGREDIENTS TABLE
   A clean list of ingredient – amount pairs.
   ────────────────────────────────────────────────────────────────────────── */
.ingredients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ingredients-table tr {
  border-bottom: 1px solid var(--color-border);
}

.ingredients-table tr:last-child {
  border-bottom: none;
}

.ingredients-table td {
  padding: 0.45rem 0;
  color: var(--color-text-primary);
  vertical-align: top;
}

/* Clickable ingredient links */
.ingredients-table td a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ingredients-table td a:hover {
  color: var(--color-accent-dark);
}

/* The amount column – right-aligned and slightly muted */
.ingredients-table td:last-child {
  text-align: right;
  color: var(--color-text-secondary);
  padding-left: var(--space-md);
  white-space: nowrap;     /* don't wrap "280.5 g" onto two lines           */
  font-variant-numeric: tabular-nums;
}

/* Total row at the bottom of the table */
.ingredients-table tr.total-row td {
  font-weight: 700;
  padding-top: var(--space-sm);
  color: var(--color-text-primary);
  border-top: 2px solid var(--color-border);
  border-bottom: none;
}


/* ──────────────────────────────────────────────────────────────────────────
   11. INSTRUCTIONS BLOCK
   Currently just holds a placeholder.  When you add real instructions,
   replace the placeholder <p> with a numbered <ol> list.
   ────────────────────────────────────────────────────────────────────────── */
.instructions-list {
  list-style: none;
  counter-reset: step-counter;   /* custom numbered steps                     */
  padding: 0;
}

.instructions-list li {
  counter-increment: step-counter;
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  line-height: 1.6;
}

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

.instructions-list li::before {
  content: counter(step-counter);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  min-width: 1.6rem;
  background: var(--color-accent-glow);
  border: 1px solid var(--color-accent);
  color: var(--color-accent-dark);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin-top: 0.1rem;
}


/* ──────────────────────────────────────────────────────────────────────────
   12. BIO PAGE
   ────────────────────────────────────────────────────────────────────────── */
.bio-page {
  max-width: 700px;
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-xl);
}

.bio-page__avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--space-xl);
  display: block;
  background: var(--color-border);   /* fallback while no photo               */
  border: 4px solid var(--color-accent);
}

/* Placeholder circle when no avatar photo is set yet */
.bio-page__avatar-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--color-border);
  border: 4px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto var(--space-xl);
  color: var(--color-text-secondary);
}

.bio-page__card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.bio-page__card h2 {
  margin-bottom: var(--space-lg);
}

.bio-page__card p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  font-style: italic;
}


/* ──────────────────────────────────────────────────────────────────────────
   13. FOOTER
   ────────────────────────────────────────────────────────────────────────── */
footer {
  background: var(--color-bg-hero);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-xl);
  font-size: 0.85rem;
  margin-top: var(--space-2xl);
}

footer a {
  color: var(--color-accent);
  transition: color 0.2s;
}

footer a:hover { color: var(--color-accent-dark); }


/* ──────────────────────────────────────────────────────────────────────────
   14. UTILITY CLASSES
   ────────────────────────────────────────────────────────────────────────── */
.container {                  /* generic centered container                    */
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section-title {             /* section heading with green underline           */
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
  margin-top: 6px;
}


/* ──────────────────────────────────────────────────────────────────────────
   15. RESPONSIVE / MOBILE OVERRIDES
   Breakpoints:
     – Desktop: > 900px (two-column recipe body, sidebar visible)
     – Tablet:  600–900px (single-column recipe body, sidebar collapsible)
     – Mobile:  < 600px (compact spacing, full-width everything)
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  /* Switch sidebar off the page; show it only when toggled */
  .sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    transform: translateX(-100%);   /* hidden off-screen by default           */
    transition: transform 0.3s ease;
    height: calc(100vh - var(--nav-height));
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    z-index: 90;
  }

  /* When JavaScript adds 'sidebar--open', slide it in */
  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  .recipes-content {
    width: 100%;
  }

  /* Show the toggle button on mobile */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  /* Stack photo and ingredients vertically */
  .recipe-card__body {
    grid-template-columns: 1fr;
  }

  .recipe-card__ingredients-col {
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
}

@media (max-width: 600px) {
  :root {
    --space-xl: 1rem;
    --space-2xl: 2rem;
  }

  .navbar__links {
    gap: var(--space-md);
  }

  .navbar__links a {
    font-size: 0.8rem;
  }

  .hero__content {
    padding: var(--space-xl) 0;
  }
}


/* ──────────────────────────────────────────────────────────────────────────
   16. RECIPE CONTROLS BAR  (size × unit toggles)
   Sticky just below the nav bar; two button groups separated by a gap.
   ────────────────────────────────────────────────────────────────────────── */
.recipe-controls {
  position: sticky;
  top: var(--nav-height);
  z-index: 60;
  background: var(--color-bg-page);
  padding: var(--space-sm) 0 var(--space-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xl);           /* wide gap between the two groups           */
  border-bottom: 1px solid var(--color-border);
}

.recipe-controls__group {
  display: flex;
  gap: var(--space-xs);
}

.ctrl-btn {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ctrl-btn:hover:not(.ctrl-btn--active) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.ctrl-btn--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

@media (max-width: 600px) {
  .recipe-controls {
    gap: var(--space-md);
  }
  .ctrl-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
  }
}

/* "Build Your Own" button in the recipe-controls bar */
.recipe-controls__group--right {
  margin-left: auto;
}

.ctrl-btn--calc {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #4338ca;
}

.ctrl-btn--calc:hover {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}


/* ──────────────────────────────────────────────────────────────────────────
   17. CALCULATOR PAGE
   ────────────────────────────────────────────────────────────────────────── */

/* Compact dark header banner */
.calc-header {
  background: var(--color-bg-hero);
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

.calc-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(34,197,94,0.13) 0%, transparent 65%);
  pointer-events: none;
}

.calc-header__content {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
}

.calc-header__title {
  color: #ffffff;
  margin: var(--space-sm) 0;
}

.calc-header__sub {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin: 0;
}

/* Main container */
.calc-container {
  max-width: 860px;
  margin: var(--space-2xl) auto var(--space-2xl);
  padding: 0 var(--space-xl);
}

/* Unit toggle bar */
.calc-unit-bar {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.calc-unit-hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

.calc-unit-hint strong {
  color: var(--color-text-secondary);
}

/* Ingredient table */
.calc-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  background: var(--color-bg-card);
  margin-bottom: var(--space-md);
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.calc-th {
  padding: 0.65rem var(--space-md);
  text-align: left;
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.calc-th--ingredient { width: 36%; min-width: 150px; }
.calc-th--num        { width: 18%; min-width: 115px; }
.calc-th--del        { width: 44px; min-width: 44px; }

.calc-row td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.calc-row:last-child td {
  border-bottom: none;
}

.calc-input {
  width: 100%;
  padding: 0.42rem 0.6rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.87rem;
  color: var(--color-text-primary);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.calc-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.calc-input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Remove-row button */
.calc-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.calc-del-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Action buttons row */
.calc-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.calc-add-btn {
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

/* Results card */
.calc-results {
  margin-top: var(--space-2xl);
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
  border-left: 4px solid var(--color-accent);
}

.calc-results__heading {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
}

.calc-results__section {
  margin-bottom: var(--space-lg);
}

.calc-results__section:last-child {
  margin-bottom: 0;
}

.calc-results__section-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.calc-results__pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Slightly larger badges in the results area */
.calc-results .badge {
  font-size: 0.88rem;
  padding: 0.4rem 1rem;
}

/* Mobile */
@media (max-width: 600px) {
  .calc-th--ingredient { min-width: 120px; }
  .calc-th--num        { min-width: 95px; }

  .calc-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .calc-add-btn,
  .calc-actions .btn {
    text-align: center;
    width: 100%;
  }

  .recipe-controls__group--right {
    margin-left: 0;
  }
}
