/* ============================================================
   Arroces — Valencian Kitchen design system
   Palette: saffron gold + Mediterranean blue
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Karla:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Playfair+Display+SC:wght@400;700&display=swap');

:root {
  /* Core palette */
  --bg:           #F9F6EF;   /* warm parchment */
  --surface:      #FFFFFF;
  --primary:      #B07D1A;   /* saffron gold */
  --primary-dark: #8A6010;   /* deep saffron */
  --accent:       #1E4D8C;   /* Mediterranean blue */
  --accent-light: #EEF3FB;   /* blue tint */
  --warm:         #C2500A;   /* paprika red (used sparingly) */
  --text:         #2C1A08;   /* espresso */
  --muted:        #7A6A50;
  --border:       #DDD0B8;
  --input-bg:     #F2EAD8;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(80, 50, 0, 0.08);
  --shadow-card:  0 2px 8px rgba(80, 50, 0, 0.07), 0 8px 24px rgba(80, 50, 0, 0.06);
  --shadow-hover: 0 12px 40px rgba(176, 125, 26, 0.20);
  --shadow-blue:  0 8px 32px rgba(30, 77, 140, 0.15);

  /* Geometry */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  28px;

  /* Motion */
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-head: 'Playfair Display SC', Georgia, serif;
  --font-body: 'Karla', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  /* Remove blue flash on tap (iOS/Android) */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: 1.15;
}

p { margin: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover { color: var(--primary); }

/* ============================================================
   PWA install card (floating bottom sheet)
   ============================================================ */
/* Install banner — all layout and visual styles are set inline in JS.
   Nothing needed here; the element is styled entirely at creation time. */

/* ============================================================
   Navigation
   ============================================================ */
.nav-toggle { display: none; }

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  /* Safe area: extend under notch on iPhone/Android */
  padding: 0 max(2rem, env(safe-area-inset-right)) 0 max(2rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  font-family: var(--font-head);
  font-size: 1.55rem;
  color: var(--primary);
  letter-spacing: 0.04em;
  font-weight: 700;
}
.nav-brand:hover { color: var(--primary-dark); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  position: relative;
  padding: 0.3rem 0;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: width var(--ease);
}
.nav-links a:hover { color: var(--primary); }
.nav-links a:hover::after { width: 100%; }

.nav-hamburger {
  display: none;
  cursor: pointer;
  color: var(--primary);
  /* 48×48 minimum touch target for oily/wet fingers */
  padding: 0.75rem;
  margin: -0.75rem -0.75rem -0.75rem 0;
  border-radius: var(--r-sm);
  transition: background var(--ease);
  touch-action: manipulation;
  user-select: none;
}
.nav-hamburger:hover { background: var(--input-bg); }
.nav-hamburger:active { background: var(--border); }

/* ============================================================
   Layout
   ============================================================ */
.page-container {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 3.5rem max(1.5rem, env(safe-area-inset-right)) 4rem max(1.5rem, env(safe-area-inset-left));
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}
.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  margin-bottom: 0.85rem;
}
.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}

.site-footer {
  text-align: center;
  /* Safe area: clear home bar on iPhone */
  padding: 1.75rem 1.5rem max(1.75rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.site-footer p { margin: 0; }

/* ============================================================
   Cards
   ============================================================ */
.calculator-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--shadow-card);
  max-width: 680px;
  margin: 0 auto;
  border: 1px solid var(--border);
}

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 1.5rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

select {
  width: 100%;
  /* 1rem = 16px at default — prevents iOS auto-zoom on focus */
  font-size: 1rem;
  padding: 0.8rem 2.5rem 0.8rem 1rem;
  min-height: 48px; /* accessible touch target */
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-weight: 500;
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23B07D1A'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.5em;
  touch-action: manipulation;
  transition: border-color var(--ease), box-shadow var(--ease);
}
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(176, 125, 26, 0.14);
}

.info-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
  margin: -0.5rem 0 1.75rem;
}

/* Radio group — pill style */
.rice-type-group { margin-bottom: 1.75rem; }

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.radio-option { margin: 0; }

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-option span {
  display: block;
  padding: 0.7rem 1.25rem; /* taller: easier to tap while cooking */
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all var(--ease);
  white-space: nowrap;
}
.radio-option:hover span {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(176, 125, 26, 0.05);
}
.radio-option:active span {
  background: rgba(176, 125, 26, 0.12);
  border-color: var(--primary);
  transform: scale(0.97);
}
.radio-option input[type="radio"]:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(176, 125, 26, 0.30);
}
.radio-option input[type="radio"]:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(176, 125, 26, 0.25);
}

/* ============================================================
   Results — arroces secos
   ============================================================ */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.25rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1.5rem 0.75rem;
  background: var(--bg);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--border);
  transition: border-color var(--ease);
}
.result-item:hover { border-color: var(--primary); }

.result-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.result-value {
  font-family: var(--font-head);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.05;
}
.result-unit {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   Home: hero + feature cards
   ============================================================ */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 4.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(176,125,26,0.13) 0%, transparent 70%),
    linear-gradient(180deg, #FDF8EC 0%, #F9F3E0 50%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* Decorative saffron threads background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      -55deg,
      transparent,
      transparent 60px,
      rgba(176, 125, 26, 0.035) 60px,
      rgba(176, 125, 26, 0.035) 61px
    );
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.35rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  letter-spacing: 0.02em;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #D4A030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  font-weight: 400;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #fff;
  padding: 1rem 2.25rem;  /* slightly taller: easier to tap on phone */
  border-radius: 100px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(176, 125, 26, 0.35);
  touch-action: manipulation;
  user-select: none;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.hero-cta:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(176, 125, 26, 0.40);
}
.hero-cta:active {
  background: var(--primary-dark);
  color: #fff;
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(176, 125, 26, 0.30);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
  max-width: 1080px;
  margin: 3rem auto 2rem;
  padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
  flex: 1;
}

@media (max-width: 768px) {
  .features {
    gap: 1rem;
    margin-top: 2rem;
  }
}

.feature-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  border: 1.5px solid var(--border);
  touch-action: manipulation;
  user-select: none;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  display: flex;
  flex-direction: column;
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(176, 125, 26, 0.30);
  color: inherit;
}
.feature-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
  border-color: rgba(176, 125, 26, 0.40);
  background: rgba(176, 125, 26, 0.03);
}

.feature-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--input-bg);
  color: var(--primary);
  margin-bottom: 1.25rem;
  transition: background var(--ease);
}
.feature-card:hover .feature-icon { background: rgba(176, 125, 26, 0.12); }
.feature-icon svg { width: 28px; height: 28px; }

.feature-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
  color: var(--text);
}
.feature-card:hover h2 { color: var(--primary); }
.feature-card p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.6;
}

.feature-arrow {
  margin-top: 1.5rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.2rem;
  align-self: flex-end;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--ease), transform var(--ease);
}
.feature-card:hover .feature-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================================
   Recipe timeline
   ============================================================ */
.recipe-note {
  max-width: 800px;
  margin: 0 auto 2rem;
  padding: 1rem 1.25rem 1rem 1.5rem;
  background: var(--accent-light);
  border: 1px solid rgba(30, 77, 140, 0.15);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}
.recipe-note a { color: var(--primary); font-weight: 700; }
.recipe-note a:hover { color: var(--primary-dark); }

.timeline {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 820px;
  position: relative;
  padding: 0.5rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 88px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), rgba(176, 125, 26, 0.15));
}

.timeline-step {
  display: grid;
  grid-template-columns: 88px 44px 1fr;
  margin-bottom: 1.25rem;
  align-items: start;
}

.step-time {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--primary);
  padding-top: 1rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.step-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1.1rem;
}
.step-connector::before {
  content: '';
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
  flex-shrink: 0;
  transition: transform var(--ease);
}
.timeline-step:hover .step-connector::before {
  transform: scale(1.3);
}

.step-content {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 0.9rem 1.2rem;
  margin-left: 0.25rem;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease);
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.step-body {
  flex: 1;
  min-width: 0;
}
.step-fire {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fire-indicator {
  display: block;
  width: 52px;
  height: 52px;
  overflow: visible;
}
.fr-2 {
  filter: drop-shadow(0 0 3px #E86010);
}
.fr-3 {
  filter: drop-shadow(0 0 5px #CC2008) drop-shadow(0 0 2px #FF4418);
}
@keyframes fire-flicker {
  0%, 100% { opacity: 1; }
  35%       { opacity: 0.72; }
  65%       { opacity: 0.88; }
}
.fire-intense {
  animation: fire-flicker 1.6s ease-in-out infinite;
}
.timeline-step.step-past .step-fire {
  opacity: 0.35;
}
.timeline-step:hover .step-content {
  border-color: rgba(176, 125, 26, 0.3);
  box-shadow: 0 2px 12px rgba(176, 125, 26, 0.08);
}

/* ============================================================
   Paella calculator results
   ============================================================ */
.results-table {
  margin-top: 2rem;
  border-top: 1.5px solid var(--border);
  padding-top: 1.75rem;
}
.results-table h2 { font-size: 1.3rem; margin-bottom: 1rem; }

.ingredient-grid { display: flex; flex-direction: column; gap: 0; }

.ingredient-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-sm);
  transition: background var(--ease);
}
.ingredient-row:nth-child(even) { background: var(--bg); }
.ingredient-row:hover { background: rgba(176, 125, 26, 0.05); }

.ingredient-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}
.ingredient-value {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  text-align: right;
}
.ingredient-unit {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 1.6rem;
  text-align: left;
}

.water-section { margin-top: 1.5rem; }
.water-section h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-family: var(--font-head);
}

.ingredient-row.total-row {
  background: var(--accent-light);
  border: 1px solid rgba(30, 77, 140, 0.12);
  border-radius: var(--r-md);
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
}
.ingredient-row.total-row .ingredient-label { font-weight: 700; color: var(--accent); }
.ingredient-row.total-row .ingredient-value { color: var(--accent); font-size: 1.35rem; }
.ingredient-row.total-row .ingredient-unit { color: var(--accent); }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.results-header h2 { margin-bottom: 0; }

.share-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
  box-shadow: 0 2px 8px rgba(176, 125, 26, 0.35);
}
.btn-share:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(176, 125, 26, 0.45);
  transform: translateY(-1px);
}
.btn-share:active { transform: translateY(0); }

.share-feedback {
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.loading {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 2rem;
  margin-top: 0.5rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .nav {
    padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
  }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    padding: 0.5rem 0 1rem;
  }
  .nav-links a {
    width: 100%;
    /* 52px tall — comfortable tap target for oily fingers */
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
  }
  .nav-links a::after { display: none; }
  .nav-toggle:checked ~ .nav .nav-links { display: flex; }

  /* Tighter hero — no wasted space when you just want to cook */
  .hero { padding: 2.5rem max(1.25rem, env(safe-area-inset-right)) 2.5rem max(1.25rem, env(safe-area-inset-left)); }
  .form-row { grid-template-columns: 1fr; gap: 1rem; }
  .calculator-card { padding: 1.5rem; border-radius: var(--r-lg); }

  /* Bigger result values — readable at a glance across the kitchen */
  .result-value { font-size: 2.75rem; }

  .timeline::before { left: 60px; }
  .timeline-step { grid-template-columns: 60px 36px 1fr; }
  .step-time { font-size: 0.78rem; }
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  /* Keep values large — don't shrink them on smaller screens */
  .result-value { font-size: 2.5rem; }
}

@media (max-width: 520px) {
  .results-grid {
    /* Horizontal rows: label | value | unit — one result per row */
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .result-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    /* Tall enough for oily fingers to tap without squinting */
    padding: 1.1rem 1.4rem;
  }
  /* Biggest values on the smallest screens — you need to read this mid-cook */
  .result-value { font-size: 3rem; }
  .result-label { font-size: 0.82rem; }

  .page-container {
    padding: 1.75rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
  }
  .hero { padding: 2rem max(1.25rem, env(safe-area-inset-right)) 2rem max(1.25rem, env(safe-area-inset-left)); }
  .hero h1 { font-size: 2.5rem; }

  .timeline::before { display: none; }
  .timeline-step { grid-template-columns: 56px 1fr; }
  .step-connector { display: none; }
}

@media (max-width: 640px) {
  .fire-indicator { width: 36px; height: 36px; }
}
@media (max-width: 520px) {
  .fire-indicator { width: 30px; height: 30px; }
}
@media (max-width: 400px) {
  .fire-indicator { width: 24px; height: 24px; }
}

@media (max-width: 480px) {
  .ingredient-row {
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    /* Taller rows — easier to scan the ingredient list while cooking */
    padding: 0.8rem 0.85rem;
  }
  /* Don't shrink ingredient labels on mobile — keep them readable */
  .ingredient-label { font-size: 0.93rem; }
  .ingredient-value { font-size: 1.2rem; }
}

@media (max-width: 360px) {
  .page-container {
    padding: 1.25rem max(0.75rem, env(safe-area-inset-right)) 2rem max(0.75rem, env(safe-area-inset-left));
  }
  .calculator-card { padding: 1.25rem 1rem; }
  /* Still keep values large on very small screens */
  .result-value { font-size: 2.5rem; }
}

/* Respect user's motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.step-image {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 10px;
  margin-top: 1rem;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* ============================================================
   Recipe timer bar
   ============================================================ */
.timer-bar {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.5rem;
  margin: 0 auto 2rem;
  max-width: 820px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 68px;
  z-index: 100;
}

.timer-main {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
  min-width: 0;
}

.timer-absolute {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex-shrink: 0;
}

.timer-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.timer-clock {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-step-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.timer-step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.timer-mode {
  display: none;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  background: rgba(194, 80, 10, 0.12);
  color: var(--warm);
}
.timer-mode.visible { display: inline-block; }

.timer-step-times {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.timer-step-col {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.timer-step-value {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-sep {
  color: var(--border);
  font-size: 1.1rem;
  padding-bottom: 0.1rem;
}

.timer-nav {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-nav {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--ease);
  padding: 0;
}
.btn-nav:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(176, 125, 26, 0.05);
}
.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.timer-controls {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-timer {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--ease);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.btn-timer:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-timer.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(176, 125, 26, 0.25);
}
.btn-timer.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* Active / past step states */
.timeline-step.step-active .step-time { color: var(--warm); }
.timeline-step.step-active .step-connector::before {
  background: var(--warm);
  box-shadow: 0 0 0 4px rgba(194, 80, 10, 0.18);
  transform: scale(1.35);
}
.timeline-step.step-active .step-content {
  border-color: rgba(194, 80, 10, 0.35);
  box-shadow: 0 2px 16px rgba(194, 80, 10, 0.12);
  background: rgba(194, 80, 10, 0.03);
}
.timeline-step.step-past .step-time { color: var(--muted); opacity: 0.7; }
.timeline-step.step-past .step-connector::before {
  background: var(--muted);
  box-shadow: 0 0 0 2px var(--muted);
}
.timeline-step.step-past .step-content { opacity: 0.5; }

@media (max-width: 640px) {
  .timer-bar {
    /* Fixed at bottom — always visible while cooking */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: none;
    margin: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -4px 20px rgba(80, 50, 0, 0.14);
    padding: 0.9rem 1.25rem max(0.9rem, env(safe-area-inset-bottom));
    /* 2-row grid: timer info full-width, then nav left + controls right */
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem 0.5rem;
    align-items: center;
  }
  .timer-main {
    grid-column: 1 / -1;
    gap: 1rem;
  }
  .timer-nav {
    grid-column: 1;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
  }
  .timer-controls {
    grid-column: 2;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
  }
  .timer-clock { font-size: 1.5rem; }
}

/* ============================================================
   Footer — powered-by link
   ============================================================ */
.footer-powered {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--ease);
}
.footer-powered:hover { color: var(--primary); }
.footer-logo {
  height: 28px;
  width: auto;
  border-radius: 4px;
  vertical-align: middle;
}
