:root {
  --primary: #0f766e;
  --secondary: #f59e0b;
  --background: #f7f6f1;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --border: #d9ded8;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --accent: #fdf3d3;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

body,
button {
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.header-inner,
.section-inner,
.hero-inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a {
  text-decoration: none;
}

.nav a:hover {
  color: var(--primary);
}

.hero {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.94), rgba(31, 41, 51, 0.9)),
    radial-gradient(circle at 85% 20%, rgba(245, 158, 11, 0.4), transparent 24rem);
  color: #fff;
  padding: 4.5rem 0 3rem;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  align-items: center;
  gap: 2rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.95;
  max-width: 760px;
}

.hero p {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button-primary,
.button-secondary,
.hero a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.8rem 1rem;
  font-weight: 800;
  text-decoration: none;
}

.button-primary,
.hero a:first-child {
  background: var(--secondary);
  color: #221806;
}

.button-secondary,
.hero a:last-child {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 1.25rem;
}

.hero-panel strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
}

.hero-panel span {
  color: rgba(255, 255, 255, 0.82);
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.trust-row div {
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  padding-top: 0.8rem;
}

.section {
  padding: 3.5rem 0;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.1;
}

.section-lede {
  max-width: 760px;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1.25rem;
  align-items: start;
}

.builder-panel,
.summary-panel,
.preset-card,
.content-box,
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.builder-panel {
  padding: 1.25rem;
}

.builder-group {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
}

.builder-group:first-child {
  padding-top: 0;
}

.builder-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.group-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.group-heading h3,
.preset-card h3,
.content-box h3 {
  margin: 0;
  font-size: 1.05rem;
}

.group-heading p,
.preset-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.choice-button {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.8rem;
  text-align: left;
}

.choice-button span {
  display: block;
  font-weight: 800;
}

.choice-button small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.choice-button[aria-pressed="true"],
.portion-row.is-selected {
  border-color: var(--primary);
  background: #ecfdf5;
}

.portion-list {
  display: grid;
  gap: 0.65rem;
}

.portion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.8rem;
}

.portion-row strong,
.portion-row span {
  display: block;
}

.portion-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stepper {
  display: grid;
  grid-template-columns: 42px 34px 42px;
  align-items: center;
  gap: 0.35rem;
}

.stepper button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 800;
}

.stepper output {
  text-align: center;
  font-weight: 800;
}

.summary-panel {
  position: sticky;
  top: 88px;
  padding: 1.25rem;
}

.summary-eyebrow,
.eyebrow {
  display: inline-flex;
  margin: 0 0 0.6rem;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calorie-total {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.calorie-total strong {
  font-size: clamp(3.2rem, 10vw, 4.7rem);
  line-height: 1;
}

.calorie-total span {
  color: var(--muted);
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
}

.metric span,
.macro-label span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metric strong,
.macro-label strong {
  display: block;
  font-size: 1.05rem;
}

.macro-bars {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.macro-label,
.source-row div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #e6e9e5;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.summary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.summary-actions button,
.preset-card button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.summary-actions button:last-child {
  background: #fff;
  color: var(--primary);
}

.notice {
  margin: 1rem 0 0;
  border-left: 4px solid var(--warning);
  background: var(--accent);
  padding: 0.85rem;
  color: #5f3f05;
  font-size: 0.92rem;
}

.breakdown-wrap {
  margin-top: 1.25rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem;
  text-align: left;
}

thead th {
  color: var(--muted);
  font-size: 0.84rem;
}

.calorie-source {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.source-row {
  display: grid;
  gap: 0.35rem;
}

.presets-grid,
.content-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.preset-card,
.content-box,
.faq-item {
  padding: 1rem;
}

.preset-card button {
  width: 100%;
  margin-top: 0.75rem;
}

.content-grid {
  grid-template-columns: repeat(2, 1fr);
}

.content-box ul,
.content-box ol {
  padding-left: 1.2rem;
}

.content-box p,
.content-box li,
.faq-item p {
  color: var(--muted);
}

.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-item h3 {
  margin: 0;
  font-size: 1rem;
}

.faq-item p {
  margin: 0.45rem 0 0;
}

.data-note {
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.legal-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 0 2rem;
}

.legal-hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1;
}

.legal-hero p {
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.legal-content {
  max-width: 820px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 4vw, 2rem);
}

.legal-content h2 {
  margin-top: 2rem;
  font-size: 1.35rem;
}

.legal-content h2:first-of-type {
  margin-top: 1rem;
}

.legal-content p {
  color: var(--muted);
}

.legal-content a {
  color: var(--primary);
  font-weight: 800;
}

.footer {
  background: var(--text);
  color: #fff;
  padding: 2rem 0;
}

.footer a,
.footer p {
  color: rgba(255, 255, 255, 0.78);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.compact-calories {
  display: none;
}

.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;
}

@media (max-width: 980px) {
  .hero-inner,
  .calculator-layout,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }

  .presets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.8rem 0;
  }

  .nav {
    justify-content: flex-start;
    font-size: 0.9rem;
  }

  .hero {
    padding: 3rem 0 2rem;
  }

  .hero-panel,
  .trust-row {
    display: none;
  }

  .section {
    padding: 2.4rem 0;
  }

  .group-heading,
  .portion-row,
  .macro-label,
  .source-row div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .choice-grid,
  .summary-grid,
  .presets-grid {
    grid-template-columns: 1fr;
  }

  .portion-row {
    gap: 1rem;
  }

  .stepper {
    width: 100%;
    grid-template-columns: 48px 1fr 48px;
  }

  .stepper button {
    width: 48px;
    height: 48px;
  }

  .summary-actions {
    grid-template-columns: 1fr;
  }

  .compact-calories {
    position: sticky;
    bottom: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary);
    color: #fff;
    padding: 0.7rem 1rem;
    font-weight: 900;
  }
}
