:root {
  --ink: #203126;
  --ink-soft: #647067;
  --cream: #f5f0e6;
  --paper: #fffdf8;
  --sage: #dfe5d3;
  --sage-dark: #4f6652;
  --lime: #d6e85b;
  --orange: #e78746;
  --line: rgba(32, 49, 38, 0.16);
  --shadow: 0 16px 48px rgba(43, 50, 34, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.site-header {
  height: 76px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; width: max-content; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.03em; }
.brand i { color: var(--orange); font-family: "DM Serif Display", serif; font-weight: 400; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); }
.brand-mark svg { width: 20px; fill: var(--lime); }
nav { display: flex; gap: 34px; font-size: 13px; font-weight: 600; }
nav a { position: relative; padding: 28px 0 24px; }
nav a::after { content: ""; position: absolute; height: 2px; left: 0; right: 100%; bottom: 20px; background: var(--orange); transition: right .2s; }
nav a:hover::after, nav a.active::after { right: 0; }
.icon-button { justify-self: end; display: grid; place-items: center; width: 39px; height: 39px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

main { overflow: hidden; }
.hero { max-width: 1240px; margin: 0 auto; min-height: 365px; padding: 72px 34px 54px; display: flex; justify-content: space-between; align-items: center; }
.eyebrow { margin: 0 0 19px; text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 700; }
.eyebrow span { display: inline-block; width: 26px; height: 1px; margin: 0 9px 3px 0; background: var(--orange); }
h1, .nutrition-heading h2, .guide-section > h2 { margin: 0; font: 400 clamp(51px, 7vw, 82px)/.96 "DM Serif Display", serif; letter-spacing: -.04em; }
h1 em, .nutrition-heading h2 em, .guide-section > h2 em { color: var(--orange); font-weight: 400; }
.hero-copy { max-width: 520px; margin: 24px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.7; }
.hero-stamp { width: 142px; height: 142px; margin: 20px 4vw 0 30px; flex: 0 0 auto; animation: float 4s ease-in-out infinite; }
.hero-stamp svg { overflow: visible; width: 100%; }
.hero-stamp text { fill: var(--ink); font-size: 8px; font-weight: 700; letter-spacing: 2.1px; }
.stamp-leaf { fill: var(--sage-dark); }
@keyframes float { 50% { transform: translateY(-8px) rotate(2deg); } }

.workspace { max-width: 1240px; margin: 0 auto 110px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(350px, .85fr); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.food-browser, .meal-panel { padding: 34px; }
.meal-panel { display: flex; flex-direction: column; min-height: 650px; background: #e5eadb; border-left: 1px solid var(--line); }
.section-heading, .section-heading > div, .micro-card-heading, .micro-card-heading > div { display: flex; align-items: center; }
.section-heading { justify-content: space-between; margin-bottom: 26px; }
.section-heading > div, .micro-card-heading > div { gap: 13px; }
.step { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--ink); border-radius: 50%; font-size: 10px; font-weight: 700; }
h2, h3, p { margin-top: 0; }
.section-heading h2 { margin: 0; font: 400 25px "DM Serif Display", serif; }
.food-count { color: var(--ink-soft); font-size: 12px; }
.text-button { padding: 4px; border: 0; border-bottom: 1px solid currentColor; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button:disabled { opacity: .35; cursor: default; }
.search-box { height: 52px; padding: 0 15px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: var(--sage-dark); box-shadow: 0 0 0 3px rgba(79, 102, 82, .1); }
.search-box svg { width: 19px; fill: none; stroke: var(--ink-soft); stroke-width: 1.7; }
.search-box input { width: 100%; outline: 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: #949b91; }
kbd { padding: 3px 7px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 5px; font: 10px inherit; }
.category-tabs { margin: 22px 0; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { padding: 8px 13px; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.category-tab:hover, .category-tab.active { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.food-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.food-card { min-width: 0; padding: 14px; display: grid; grid-template-columns: 42px 1fr 25px; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: transparent; cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.food-card:hover { transform: translateY(-2px); border-color: var(--sage-dark); background: #f8f7f0; }
.food-emoji { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--food-bg, var(--sage)); font-size: 23px; }
.food-info { min-width: 0; }
.food-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.food-info small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.add-icon { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 50%; font-size: 16px; transition: .18s; }
.food-card:hover .add-icon { color: var(--paper); background: var(--ink); }
.empty-state { margin: 70px 0; color: var(--ink-soft); text-align: center; font-size: 13px; }

.meal-list { display: flex; flex-direction: column; gap: 9px; }
.meal-item { padding: 12px; display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; background: rgba(255,255,255,.58); border: 1px solid rgba(32,49,38,.1); border-radius: 11px; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-5px); } }
.meal-item .food-emoji { width: 38px; height: 38px; font-size: 20px; }
.meal-item strong { display: block; font-size: 12px; }
.portion-control { display: flex; align-items: center; gap: 3px; margin-top: 4px; color: var(--ink-soft); }
.portion-control input { width: 53px; padding: 2px 4px; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; font-size: 11px; font-weight: 700; }
.portion-control small { font-size: 10px; }
.remove-button { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 18px; }
.meal-empty { margin: auto; padding: 50px 20px; text-align: center; }
.empty-plate { width: 86px; height: 86px; margin: 0 auto 22px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; box-shadow: inset 0 0 0 8px #e5eadb, inset 0 0 0 9px var(--line); }
.empty-plate span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 19px; }
.meal-empty h3 { margin-bottom: 7px; font: 400 19px "DM Serif Display", serif; }
.meal-empty p { max-width: 210px; margin: auto; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.meal-footer { margin-top: auto; padding-top: 24px; }
.meal-total-row { margin-bottom: 12px; display: flex; justify-content: space-between; font-size: 12px; }
.primary-button { width: 100%; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; color: var(--paper); border: 0; border-radius: 8px; background: var(--ink); font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .2s, background .2s; }
.primary-button:hover { transform: translateY(-1px); background: var(--sage-dark); }
.primary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.nutrition-section { padding: 105px max(34px, calc((100vw - 1172px)/2)) 115px; color: #f7f2e8; background: var(--ink); }
.nutrition-heading { margin-bottom: 48px; display: flex; justify-content: space-between; align-items: flex-end; }
.nutrition-heading .eyebrow { color: var(--lime); }
.nutrition-heading h2 { font-size: clamp(46px, 6vw, 70px); }
.nutrition-heading h2 em { color: var(--lime); }
.meal-summary { padding-left: 20px; border-left: 1px solid rgba(255,255,255,.25); }
.meal-summary span { display: block; margin-bottom: 5px; color: #aab4aa; text-transform: uppercase; font-size: 9px; letter-spacing: .15em; }
.meal-summary strong { max-width: 320px; display: block; font-size: 12px; }
.macro-grid { margin-bottom: 15px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border-radius: var(--radius); background: rgba(255,255,255,.12); }
.macro-card { padding: 27px 25px; background: #2a3d30; }
.macro-card:first-child { background: var(--lime); color: var(--ink); }
.macro-top { display: flex; justify-content: space-between; align-items: center; }
.macro-top span { color: #b8c1b8; text-transform: uppercase; letter-spacing: .14em; font-size: 9px; font-weight: 700; }
.macro-card:first-child .macro-top span { color: var(--ink); }
.macro-icon { font-size: 15px; }
.macro-value { margin: 20px 0 4px; font: 400 40px "DM Serif Display", serif; }
.macro-value small { font: 500 12px "DM Sans", sans-serif; }
.macro-card > small { color: #8e9d91; font-size: 10px; }
.macro-card:first-child > small { color: #536342; }
.micro-card { padding: 32px; border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); background: #26392d; }
.micro-card-heading { justify-content: space-between; margin-bottom: 30px; }
.micro-card-heading .step { border-color: rgba(255,255,255,.5); }
.micro-card-heading h3 { margin: 0; font: 400 23px "DM Serif Display", serif; }
.micro-card-heading p { margin: 0; color: #8e9d91; text-transform: uppercase; letter-spacing: .14em; font-size: 8px; }
.info { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid currentColor; border-radius: 50%; text-transform: none; cursor: help; }
.micro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px 30px; }
.micro-label { margin-bottom: 9px; display: flex; justify-content: space-between; font-size: 11px; }
.micro-label span:last-child { color: #9da99f; }
.progress-track { height: 4px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.1); }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--lime); transition: width .45s ease; }
.micro-amount { margin-top: 6px; color: #78877c; font-size: 8px; }
.nutrition-note { margin: 18px 0 0; color: #7f8e82; font-size: 9px; text-align: right; }

.guide-section { max-width: 1172px; margin: 0 auto; padding: 110px 0 120px; }
.guide-section > h2 { font-size: clamp(45px, 6vw, 68px); }
.guide-grid { margin-top: 55px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.guide-grid article { padding: 27px 34px 0 0; }
.guide-grid article + article { padding-left: 34px; border-left: 1px solid var(--line); }
.guide-grid span { color: var(--orange); font-size: 10px; font-weight: 700; }
.guide-grid h3 { margin: 20px 0 9px; font: 400 22px "DM Serif Display", serif; }
.guide-grid p { color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

footer { padding: 28px clamp(22px, 5vw, 76px); display: flex; justify-content: space-between; align-items: center; color: #aeb7af; background: #19261e; font-size: 10px; }
footer .brand { color: #f7f2e8; font-size: 13px; }
footer p { margin: 0; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 25px; padding: 11px 17px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); border-radius: 999px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-size: 11px; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.dark { --ink: #eef2e8; --ink-soft: #aab5aa; --cream: #172019; --paper: #202c23; --sage: #394839; --sage-dark: #98ae91; --line: rgba(238,242,232,.15); --shadow: 0 16px 48px rgba(0,0,0,.25); }
body.dark .meal-panel { background: #2b392d; }
body.dark .empty-plate { box-shadow: inset 0 0 0 8px #2b392d, inset 0 0 0 9px var(--line); }
body.dark .food-card:hover { background: #273329; }
body.dark .meal-item { background: rgba(0,0,0,.12); }
body.dark .nutrition-section { color: #f7f2e8; background: #111c15; }
body.dark .nutrition-section .nutrition-heading h2 { color: #f7f2e8; }
body.dark footer { background: #0b120d; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .hero-stamp { width: 110px; }
  .workspace { margin-inline: 20px; grid-template-columns: 1fr; }
  .meal-panel { min-height: 430px; border-top: 1px solid var(--line); border-left: 0; }
  .food-grid { grid-template-columns: repeat(2, 1fr); }
  .micro-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-section { padding-inline: 32px; }
}
@media (max-width: 620px) {
  .site-header { height: 65px; }
  .hero { min-height: 410px; padding: 62px 24px 40px; align-items: flex-start; }
  .hero-stamp { display: none; }
  h1 { font-size: 52px; }
  .workspace { margin-inline: 12px; margin-bottom: 70px; }
  .food-browser, .meal-panel { padding: 24px 18px; }
  .food-grid { grid-template-columns: 1fr; }
  .meal-panel { min-height: 390px; }
  .nutrition-section { padding: 75px 22px 85px; }
  .nutrition-heading { display: block; }
  .meal-summary { margin-top: 28px; }
  .macro-grid { grid-template-columns: repeat(2, 1fr); }
  .micro-grid { grid-template-columns: 1fr; gap: 20px; }
  .micro-card { padding: 25px 20px; }
  .guide-section { padding: 80px 24px; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-grid article, .guide-grid article + article { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  footer { flex-direction: column; gap: 18px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
