/* =========================================================
   ImproChef — main stylesheet
   ========================================================= */

:root {
  --cream: #fbf8f1;
  --paper: #ffffff;
  --ink: #1f2a24;
  --ink-soft: #5b675f;
  --line: #e7e2d6;
  --green: #2f7d4f;
  --green-dark: #1f5b39;
  --green-soft: #e3f1e7;
  --tomato: #e8573c;
  --tomato-soft: #fde8e2;
  --lemon: #f4c542;
  --lemon-soft: #fdf4d3;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 36, .05), 0 8px 24px rgba(31, 42, 36, .07);
  --shadow-lg: 0 2px 4px rgba(31, 42, 36, .06), 0 18px 40px rgba(31, 42, 36, .12);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1160px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-weight: 650; }
h3 { font-size: 1.3rem; font-weight: 600; }

p { margin: 0 0 1em; }

.container {
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.section { padding: clamp(56px, 8vw, 96px) 0; }
.section--tint { background: var(--paper); border-block: 1px solid var(--line); }

.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tomato);
  margin-bottom: .75rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.section-head p { color: var(--ink-soft); max-width: 52ch; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: .8em 1.4em;
  border-radius: 999px;
  border: 2px solid transparent;
  font: 600 1rem var(--font-body);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(47, 125, 79, .28); }
.btn--primary:hover { background: var(--green-dark); color: #fff; }
.btn--ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--ink); color: var(--cream); }
.btn--small { padding: .5em 1em; font-size: .9rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 248, 241, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .4em;
}
.logo:hover { color: var(--ink); }
.logo span { color: var(--tomato); }
.logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 1.2rem;
  transform: rotate(-6deg);
}

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: block;
  padding: .5em 1em;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 500;
  transition: background .2s ease;
}
.nav-links a:hover { background: var(--green-soft); }
.nav-links a[aria-current="page"] { background: var(--ink); color: var(--cream); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 12px 16px 20px;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 8vw, 100px) 0 clamp(56px, 8vw, 96px); overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 56px;
  align-items: center;
}
.hero h1 em { font-style: italic; color: var(--green); }
.hero-lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 46ch; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 36px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats strong { display: block; font-family: var(--font-display); font-size: 1.8rem; }
.hero-stats span { color: var(--ink-soft); font-size: .9rem; }

.hero-art {
  position: relative;
  aspect-ratio: 1;
  max-width: 460px;
  justify-self: center;
  width: 100%;
}
.plate {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 0 55%, #f1ece0 56% 62%, #fff 63%);
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 14vw, 8rem);
}
.float {
  position: absolute;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: .9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: bob 5s ease-in-out infinite;
}
.float--1 { top: 4%; left: -2%; }
.float--2 { top: 40%; right: -6%; animation-delay: -1.6s; }
.float--3 { bottom: 4%; left: 6%; animation-delay: -3.2s; }
@keyframes bob { 50% { transform: translateY(-10px); } }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 340px; }
  .float--2 { right: 0; }
}

/* ---------- Pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.pillar {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.pillar-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  margin-bottom: 16px;
}
.pillar p { color: var(--ink-soft); font-size: .97rem; margin: 0; }
@media (max-width: 960px) { .pillars { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .pillars { grid-template-columns: 1fr; } }

/* ---------- Cards (recipes & posts) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--ink); }

.card-media {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  font-size: 4.5rem;
  position: relative;
}
.card-media .badge { position: absolute; top: 12px; left: 12px; }

.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin-bottom: .35em; }
.card-body p { color: var(--ink-soft); font-size: .95rem; margin-bottom: 1rem; }
.card-meta {
  margin-top: auto;
  display: flex;
  gap: 16px;
  font-size: .85rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: .25em .75em;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink);
}
.badge--match { background: var(--green); color: #fff; }

/* Media tints */
.tint-green  { background: var(--green-soft); }
.tint-tomato { background: var(--tomato-soft); }
.tint-lemon  { background: var(--lemon-soft); }
.tint-sky    { background: #e3eef8; }
.tint-plum   { background: #efe5f3; }

/* ---------- Page header ---------- */
.page-hero { padding: clamp(48px, 7vw, 80px) 0 32px; }
.page-hero p { color: var(--ink-soft); font-size: 1.15rem; max-width: 58ch; }

/* ---------- Filters ---------- */
.toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
}
.search {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  padding: .75em 0;
  width: 100%;
  color: var(--ink);
}
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: .45em 1em;
  font: 500 .9rem var(--font-body);
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
  grid-column: 1 / -1;
}

/* ---------- Fridge Raid ---------- */
.fridge {
  background: var(--green);
  color: #fff;
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(28px, 5vw, 48px);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.fridge::after {
  content: "🧊";
  position: absolute;
  right: -20px;
  bottom: -40px;
  font-size: 12rem;
  opacity: .08;
  pointer-events: none;
}
.fridge h2 { color: #fff; }
.fridge p { color: rgba(255, 255, 255, .85); }
.fridge .eyebrow { color: var(--lemon); }

.fridge-box {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius);
  padding: 20px;
}
.fridge-input {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.fridge-input input {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: .75em 1.2em;
  font: inherit;
  min-width: 0;
}
.fridge-input input:focus { outline: 3px solid var(--lemon); }
.fridge .btn--primary { background: var(--lemon); color: var(--ink); box-shadow: none; }
.fridge .btn--primary:hover { background: #ffd65c; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: .3em .5em .3em .9em;
  font-size: .9rem;
  font-weight: 500;
}
.tag button {
  border: 0;
  background: var(--line);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
  font-size: .8rem;
}
.fridge-hint { font-size: .85rem; margin: 12px 0 0; opacity: .8; }
.quick-adds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick-adds button {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, .5);
  color: #fff;
  border-radius: 999px;
  padding: .25em .8em;
  font: .85rem var(--font-body);
  cursor: pointer;
}
.quick-adds button:hover { background: rgba(255, 255, 255, .12); }

@media (max-width: 860px) { .fridge { grid-template-columns: 1fr; } }

/* ---------- Tip / quote band ---------- */
.tip-band {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  background: var(--lemon-soft);
  border-radius: var(--radius);
  padding: 28px 32px;
}
.tip-band .big { font-size: 3rem; }
.tip-band h3 { margin-bottom: .2em; }
.tip-band p { margin: 0; color: var(--ink-soft); }
@media (max-width: 700px) { .tip-band { grid-template-columns: 1fr; text-align: left; } }

/* ---------- Newsletter ---------- */
.newsletter {
  background: var(--ink);
  color: var(--cream);
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
}
.newsletter h2 { color: var(--cream); }
.newsletter p { color: rgba(251, 248, 241, .75); max-width: 50ch; margin-inline: auto; }
.newsletter form {
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin: 24px auto 0;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter input {
  flex: 1 1 220px;
  border: 0;
  border-radius: 999px;
  padding: .8em 1.3em;
  font: inherit;
}
.form-note { font-size: .9rem; margin-top: 12px; min-height: 1.4em; color: var(--lemon); }

/* ---------- Recipe detail ---------- */
.breadcrumb { font-size: .9rem; color: var(--ink-soft); margin-bottom: 20px; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--green); }

.recipe-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 40px 0 48px;
}
.recipe-hero .card-media { border-radius: var(--radius); font-size: 8rem; box-shadow: var(--shadow); }
.recipe-hero .lead { font-size: 1.15rem; color: var(--ink-soft); }
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.fact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.fact span { display: block; font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.fact strong { font-size: 1.05rem; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-row .badge { background: var(--green-soft); color: var(--green-dark); }

.recipe-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 48px;
  align-items: start;
  padding-bottom: 80px;
}
.panel {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.ingredients-panel { position: sticky; top: 96px; }

.servings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  margin-bottom: 18px;
  font-weight: 500;
}
.servings-ctrl { display: flex; align-items: center; gap: 8px; }
.servings-ctrl button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: var(--cream);
  font-size: 1.1rem;
  cursor: pointer;
}
.servings-ctrl output { min-width: 1.5em; text-align: center; font-weight: 700; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { border-bottom: 1px dashed var(--line); }
.check-list li:last-child { border-bottom: 0; }
.check-list label {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  cursor: pointer;
}
.check-list input { accent-color: var(--green); transform: translateY(2px); }
.check-list input:checked + span { text-decoration: line-through; color: var(--ink-soft); }
.qty { font-weight: 600; }

.steps { list-style: none; padding: 0; margin: 0 0 40px; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 28px 64px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -4px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  display: grid;
  place-items: center;
  font: 700 1.1rem var(--font-display);
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 44px;
  bottom: 4px;
  border-left: 2px dotted var(--line);
}

.callouts { display: grid; gap: 16px; }
.callout {
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  border-left: 4px solid;
}
.callout h4 { font-family: var(--font-body); font-size: 1rem; margin-bottom: .5em; }
.callout ul { margin: 0; padding-left: 1.1em; }
.callout li { margin-bottom: .3em; }
.callout--swap { background: var(--green-soft); border-color: var(--green); }
.callout--waste { background: var(--lemon-soft); border-color: var(--lemon); }
.callout--impro { background: var(--tomato-soft); border-color: var(--tomato); }

@media (max-width: 900px) {
  .recipe-hero, .recipe-body { grid-template-columns: 1fr; }
  .ingredients-panel { position: static; }
}

/* ---------- Blog ---------- */
.featured-post {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--ink);
  margin-bottom: 40px;
  transition: box-shadow .2s ease;
}
.featured-post:hover { box-shadow: var(--shadow-lg); color: var(--ink); }
.featured-post .card-media { aspect-ratio: auto; min-height: 320px; font-size: 7rem; }
.featured-post .card-body { padding: clamp(24px, 4vw, 44px); justify-content: center; }
.featured-post h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
@media (max-width: 800px) {
  .featured-post { grid-template-columns: 1fr; }
  .featured-post .card-media { min-height: 220px; }
}

.article { max-width: 720px; margin-inline: auto; padding: 32px 0 80px; }
.article-header { text-align: center; margin-bottom: 36px; }
.article-header .card-meta { justify-content: center; }
.article-cover {
  border-radius: var(--radius);
  aspect-ratio: 16 / 8;
  display: grid;
  place-items: center;
  font-size: 7rem;
  margin-bottom: 40px;
}
.article-content { font-size: 1.12rem; }
.article-content h2 { font-size: 1.7rem; margin-top: 1.8em; }
.article-content blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 24px;
  border-left: 4px solid var(--tomato);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-style: italic;
}
.article-content ul { padding-left: 1.2em; }
.article-content li { margin-bottom: .4em; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 56px 0 28px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-grid h4 { font-family: var(--font-body); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .5em; }
.footer-grid a { color: var(--ink); }
.footer-grid a:hover { color: var(--green); }
.footer-grid p { color: var(--ink-soft); font-size: .95rem; max-width: 34ch; }
.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Page helpers ---------- */
.page-top { padding-top: 32px; }
.result-count { color: var(--ink-soft); font-size: .9rem; }
.blog-list { padding-bottom: 40px; }
.blog-list #categories { margin-bottom: 28px; }
.prose { max-width: 720px; margin-inline: auto; }

/* ---------- Print (recipe cards) ---------- */
@media print {
  .site-header, .site-footer, .section--tint, .breadcrumb, .btn, .servings-ctrl button { display: none !important; }
  body { background: #fff; }
  .recipe-hero .card-media { display: none; }
  .recipe-hero, .recipe-body { grid-template-columns: 1fr; padding: 0; gap: 16px; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mt-lg { margin-top: 40px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
