:root {
  --yellow: #f7ca0f;
  --orange: #f5891e;
  --red: #ef2d33;
  --lime: #a5cc3b;
  --green: #2bb24b;
  --ink: #11251a;
  --muted: #637069;
  --paper: #fffdf7;
  --white: #fff;
  --line: #dfe8e1;
  --soft-green: #eaf7e8;
  --shadow: 0 20px 50px rgba(20, 65, 34, .12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(1240px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: inline-flex; }
.brand img { display: block; width: min(360px, 45vw); height: 72px; object-fit: contain; object-position: left center; }

.reset-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.reset-button:hover { transform: translateY(-2px); }
.reset-button:focus-visible, .ingredient-card:has(input:focus-visible) { outline: 4px solid rgba(247, 202, 15, .55); outline-offset: 3px; }
.reset-button--top { padding: 13px 20px; background: var(--soft-green); color: #176b2a; }

.hero {
  position: relative;
  overflow: hidden;
  min-height: 400px;
  padding: 74px max(24px, calc((100vw - 1240px) / 2));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  align-items: center;
  color: var(--white);
  background: var(--green);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .16;
  background-image: radial-gradient(circle at 20px 20px, #fff 2px, transparent 2px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.hero__copy { position: relative; z-index: 1; }
.eyebrow, .section-kicker { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 900; color: #176b2a; }
.eyebrow { color: var(--yellow); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 22px; max-width: 780px; font-size: clamp(3rem, 7vw, 6.2rem); line-height: .9; letter-spacing: -.065em; }
h1 span { color: var(--yellow); }
.hero__intro { max-width: 580px; margin-bottom: 0; font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.6; color: rgba(255,255,255,.9); }

.hero__art { position: relative; min-height: 260px; }
.shape { position: absolute; display: block; filter: drop-shadow(0 20px 18px rgba(5,52,20,.17)); }
.shape--yellow { width: 148px; height: 148px; right: 31%; top: 42%; border-radius: 50%; background: var(--yellow); }
.shape--orange { width: 126px; height: 126px; right: 4%; top: 4%; border-radius: 26% 74% 63% 37% / 52% 33% 67% 48%; background: var(--orange); transform: rotate(18deg); }
.shape--red { width: 76px; height: 76px; right: 3%; bottom: 4%; border-radius: 50%; background: var(--red); }
.shape--green { width: 140px; height: 90px; left: 7%; top: 3%; border-radius: 90% 10% 90% 10%; background: var(--lime); transform: rotate(-18deg); }

.calculator {
  width: min(1240px, calc(100% - 40px));
  margin: 72px auto 96px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, .75fr);
  gap: 36px;
  align-items: start;
}

.builder { min-width: 0; }
.builder__toolbar { margin-bottom: 34px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.045em; }

.search { width: min(330px, 100%); padding: 0 17px; display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--white); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(43,178,75,.12); }
.search svg { width: 20px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; padding: 13px 0; border: 0; outline: none; color: var(--ink); background: transparent; }
.search input::placeholder { color: #87918b; }

.category { margin-bottom: 38px; }
.category[hidden] { display: none; }
.category__heading { margin-bottom: 15px; display: flex; align-items: center; gap: 12px; }
.category__heading h3 { margin: 0; font-size: 1.35rem; }
.category__count { padding: 4px 9px; border-radius: 999px; background: var(--soft-green); color: #176b2a; font-size: .72rem; font-weight: 900; }
.category__hint { margin: -6px 0 16px; color: var(--muted); font-size: .9rem; }

.ingredient-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.ingredient-card { position: relative; min-height: 102px; padding: 16px 15px; display: flex; flex-direction: column; justify-content: space-between; gap: 11px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; user-select: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.ingredient-card:hover { transform: translateY(-2px); border-color: #addab6; box-shadow: 0 10px 24px rgba(25, 91, 43, .08); }
.ingredient-card:has(input:checked), .ingredient-card.is-selected { border-color: var(--green); background: var(--soft-green); box-shadow: inset 0 0 0 1px var(--green); }
.ingredient-card:has(input:disabled) { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.ingredient-card[hidden] { display: none; }
.ingredient-card input { position: absolute; opacity: 0; pointer-events: none; }
.ingredient-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ingredient-card__name { font-weight: 850; line-height: 1.22; }
.ingredient-card__check { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid #b8c5bb; border-radius: 7px; background: var(--white); color: transparent; font-size: .8rem; }
.ingredient-card:has(input:checked) .ingredient-card__check { border-color: var(--green); color: var(--white); background: var(--green); }
.ingredient-card__meta { color: var(--muted); font-size: .8rem; font-weight: 700; }
.ingredient-card--quantity { cursor: default; }
.ingredient-card--quantity:hover { transform: none; }
.quantity-control { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; }
.quantity-button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 10px; color: var(--white); background: var(--green); cursor: pointer; font-size: 1.25rem; font-weight: 900; line-height: 1; transition: transform .16s ease, opacity .16s ease; }
.quantity-button:hover:not(:disabled) { transform: scale(1.06); }
.quantity-button:focus-visible { outline: 3px solid rgba(247, 202, 15, .7); outline-offset: 2px; }
.quantity-button:disabled { opacity: .25; cursor: not-allowed; }
.quantity-value { min-width: 28px; text-align: center; font-size: 1rem; font-weight: 950; }
.no-results { padding: 28px; border: 2px dashed var(--line); border-radius: var(--radius-md); color: var(--muted); text-align: center; }

.summary { position: sticky; top: 24px; padding: 28px; border-radius: var(--radius-lg); color: var(--white); background: var(--ink); box-shadow: var(--shadow); }
.summary__header { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.summary h2 { font-size: 2.2rem; }
.section-kicker--light { color: var(--lime); }
.selection-count { padding: 7px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; white-space: nowrap; font-size: .75rem; font-weight: 800; color: rgba(255,255,255,.78); }

.macro-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.macro { min-height: 128px; padding: 18px; display: flex; flex-direction: column; border-radius: var(--radius-md); color: #111; }
.macro--calories { background: var(--yellow); }
.macro--calories { grid-column: 1 / -1; min-height: 136px; }
.macro--protein { background: var(--lime); }
.macro--carbs { background: var(--orange); }
.macro--fat { background: var(--green); color: var(--white); }
.macro__value { margin-bottom: auto; overflow-wrap: anywhere; font-size: clamp(1.8rem, 3.6vw, 3.1rem); font-weight: 950; line-height: .9; letter-spacing: -.06em; }
.macro--calories .macro__value { font-size: clamp(2.6rem, 5vw, 4rem); }
.macro__label { font-size: .92rem; font-weight: 900; }
.macro__unit { margin-top: 2px; font-size: .7rem; font-weight: 700; opacity: .7; }

.selected-summary { margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.15); }
.selected-summary h3 { margin-bottom: 13px; font-size: 1rem; }
.selected-list { display: flex; flex-wrap: wrap; gap: 7px; }
.selected-list__empty { margin: 0; color: rgba(255,255,255,.55); font-size: .88rem; }
.selected-chip { padding: 6px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(255,255,255,.08); font-size: .76rem; font-weight: 700; }
.reset-button--summary { width: 100%; margin-top: 22px; padding: 14px 18px; background: var(--white); color: var(--ink); }
.nutrition-note { margin: 16px 4px 0; color: rgba(255,255,255,.55); font-size: .72rem; line-height: 1.5; text-align: center; }

footer { padding: 44px 20px 54px; text-align: center; background: var(--white); border-top: 1px solid var(--line); }
footer img { width: 116px; height: 90px; object-fit: contain; }
footer p { margin: 8px 0 0; color: var(--muted); font-size: .85rem; font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; max-width: calc(100% - 40px); padding: 12px 17px; border-radius: 999px; color: var(--white); background: var(--ink); box-shadow: var(--shadow); font-size: .85rem; font-weight: 800; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr .55fr; }
  .calculator { grid-template-columns: 1fr; }
  .summary { position: relative; top: 0; order: -1; }
  .macro-grid { grid-template-columns: repeat(3, 1fr); }
  .macro { min-height: 118px; }
  .ingredient-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .site-header { width: min(100% - 28px, 1240px); min-height: 78px; }
  .brand img { height: 60px; }
  .reset-button--top { display: none; }
  .hero { min-height: 0; padding: 48px 24px 52px; grid-template-columns: 1fr; }
  .hero__art { display: none; }
  .hero__copy { max-width: 650px; }
  .calculator { width: min(100% - 28px, 1240px); margin-top: 48px; gap: 34px; }
  .builder__toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .macro-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .macro { min-height: 112px; padding: 15px 12px; }
  .macro--calories { min-height: 124px; padding: 18px; }
  .macro__label { font-size: .82rem; }
  .macro__unit { font-size: .64rem; }
  .ingredient-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 450px) {
  .brand img { width: 138px; height: 64px; object-position: left center; }
  h1 { font-size: 3.15rem; }
  .hero { min-height: 0; padding-top: 42px; padding-bottom: 46px; }
  .calculator { width: min(100% - 22px, 1240px); }
  .summary { padding: 20px; border-radius: 22px; }
  .summary__header { align-items: flex-start; flex-direction: column; }
  .ingredient-grid { grid-template-columns: 1fr; }
  .ingredient-card { min-height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
