:root {
  --ink: #241d23;
  --muted: #645b60;
  --cream: #f8f0e4;
  --paper: #fffaf3;
  --orange: #c9411d;
  --orange-dark: #bd3516;
  --plum: #4a233e;
  --sage: #b9c3a6;
  --line: #d9cdc2;
  --white: #fff;
  --shadow: 0 20px 60px rgba(61, 31, 46, 0.13);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--white);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.safety-ribbon {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 9px 20px;
  color: #fff8ed;
  background: var(--plum);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.safety-ribbon a {
  color: #ffb395;
  text-underline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(20px, 5vw, 76px);
  border-bottom: 1px solid rgba(90, 58, 50, 0.12);
  background: rgba(248, 240, 228, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--orange);
  font-family: Inter, sans-serif;
  font-size: 0.72rem;
  letter-spacing: -0.04em;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
  font-size: 0.88rem;
  font-weight: 650;
}

nav a {
  text-decoration: none;
}

.text-button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(228, 86, 43, 0.45);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.hero {
  position: relative;
  min-height: min(760px, calc(100vh - 108px));
  overflow: hidden;
  background: #f3e6d6;
}

.hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(248, 240, 228, 0.98) 0%, rgba(248, 240, 228, 0.94) 31%, rgba(248, 240, 228, 0.38) 56%, rgba(248, 240, 228, 0) 76%);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(660px, 55vw);
  padding: clamp(70px, 10vh, 120px) 0 60px clamp(24px, 7vw, 110px);
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--orange-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  max-width: 650px;
  margin-bottom: 24px;
  font-size: clamp(3.7rem, 7vw, 7.2rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.84;
}

h1 em {
  color: var(--orange);
  font-weight: 500;
}

.hero-lede {
  max-width: 560px;
  margin-bottom: 30px;
  color: #5f5559;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: var(--white);
  background: var(--orange);
  box-shadow: 0 10px 26px rgba(228, 86, 43, 0.22);
}

.button.primary:hover {
  background: var(--orange-dark);
}

.button.secondary {
  border-color: #a7978a;
  background: rgba(255, 250, 243, 0.68);
}

.button.full {
  width: 100%;
}

.hero-stats {
  display: flex;
  gap: 30px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
}

.hero-stats li {
  display: grid;
}

.hero-stats strong {
  font-family: Georgia, serif;
  font-size: 1.7rem;
  line-height: 1;
}

.hero-stats span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ticker {
  overflow: hidden;
  padding: 14px 0;
  color: var(--white);
  background: var(--orange);
}

.ticker div {
  display: flex;
  width: max-content;
  gap: 25px;
  align-items: center;
  padding-left: 4vw;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
}

.ticker i {
  font-family: sans-serif;
  font-style: normal;
  opacity: 0.6;
}

.quiz-section,
.library-section,
.how-it-works,
.safety-section {
  padding: clamp(80px, 10vw, 140px) clamp(20px, 7vw, 110px);
}

.quiz-section {
  background: var(--paper);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  max-width: 1340px;
  margin: 0 auto 48px;
}

.section-heading h2 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.section-heading > p {
  max-width: 350px;
  color: var(--muted);
}

.mode-switch,
.filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1e9df;
}

.mode-switch button,
.filters button {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.mode-switch button.active,
.filters button.active {
  color: var(--white);
  background: var(--plum);
}

.quiz-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  max-width: 1160px;
  margin: 0 auto;
}

.quiz-progress {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5ece2;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 750;
}

.progress-track {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfd3c7;
}

.progress-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 300ms ease;
}

.score-block {
  display: grid;
  margin: 50px 0 20px;
}

.score-block > span,
.score-block small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-block strong {
  font-family: Georgia, serif;
  font-size: 4.3rem;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}

.quiz-progress p {
  color: var(--muted);
  font-size: 0.82rem;
}

.quiet-button {
  margin-top: auto;
  padding: 10px 0 0;
  border: 0;
  border-bottom: 1px solid;
  color: var(--plum);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.quiet-button.danger {
  margin: 0;
  color: #9e2f25;
}

.quiz-card {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(320px, 0.85fr);
  min-height: 590px;
  overflow: hidden;
  border-radius: 30px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.quiz-photo-wrap {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  background: #ddd3c7;
}

.quiz-photo-wrap::after {
  position: absolute;
  inset: auto 0 0;
  height: 35%;
  content: "";
  background: linear-gradient(transparent, rgba(36, 29, 35, 0.36));
}

.quiz-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.category-pill {
  position: absolute;
  z-index: 1;
  top: 22px;
  left: 22px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--white);
  background: rgba(74, 35, 62, 0.86);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.quiz-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 58px);
}

.question-number {
  margin-bottom: 12px;
  color: var(--orange-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.quiz-content h3 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.serving {
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 0.87rem;
}

#guess-form label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 800;
}

#guess-form label span {
  color: var(--muted);
  font-weight: 500;
}

.guess-control {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  margin: 12px 0 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}

.guess-control button {
  border: 0;
  color: var(--orange-dark);
  background: #f7eee5;
  font-size: 1.4rem;
  cursor: pointer;
}

.guess-control input {
  width: 100%;
  padding: 12px;
  border: 0;
  border-inline: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  background: var(--white);
  font-family: Georgia, serif;
  font-size: 2rem;
  text-align: center;
  -moz-appearance: textfield;
}

.guess-control input::-webkit-inner-spin-button {
  appearance: none;
}

.reveal-number {
  display: grid;
  margin-bottom: 12px;
}

.reveal-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reveal-number > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.reveal-number strong {
  color: var(--orange);
  font-family: Georgia, serif;
  font-size: clamp(2.6rem, 4vw, 4rem);
  font-weight: 500;
  line-height: 1;
}

.ingredient-breakdown {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.reveal-number small {
  font-size: 1.25rem;
}

.reveal-plan {
  margin-bottom: 14px;
  padding: 13px 15px;
  border-left: 3px solid var(--sage);
  background: #f2f4ec;
  font-size: 0.8rem;
}

.reveal-plan:empty {
  display: none;
}

.result-message {
  margin-bottom: 10px;
  font-weight: 800;
}

.variation-note {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.75rem;
}

.how-it-works {
  color: var(--white);
  background: var(--plum);
}

.how-it-works .eyebrow {
  color: #ff9c77;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 1340px;
  margin: 0 auto;
  border-block: 1px solid rgba(255, 255, 255, 0.2);
}

.steps article {
  min-height: 260px;
  padding: 32px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.steps article:last-child {
  border: 0;
}

.steps > article > span {
  display: block;
  margin-bottom: 65px;
  color: #ff9c77;
  font-size: 0.76rem;
  font-weight: 800;
}

.steps h3 {
  margin-bottom: 8px;
  font-size: 1.8rem;
  font-weight: 500;
}

.steps p {
  max-width: 300px;
  color: #d7c6d1;
  font-size: 0.88rem;
}

.library-section {
  background: var(--cream);
}

.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1340px;
  margin: 0 auto 18px;
}

.search {
  flex: 1;
  max-width: 370px;
}

.search input,
.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: var(--white);
}

.search input:focus,
.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(228, 86, 43, 0.12);
}

.filters {
  overflow-x: auto;
}

.result-count {
  max-width: 1340px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 0.76rem;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1340px;
  margin: 0 auto;
}

.food-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  color: var(--white);
  background: #403238;
  box-shadow: 0 8px 24px rgba(50, 32, 40, 0.09);
  cursor: pointer;
  text-align: left;
  aspect-ratio: 4 / 3;
}

.food-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 350ms ease;
}

.food-card:hover img {
  transform: scale(1.045);
}

.food-card::after {
  position: absolute;
  inset: 45% 0 0;
  content: "";
  background: linear-gradient(transparent, rgba(25, 16, 21, 0.89));
}

.food-card-copy {
  position: absolute;
  z-index: 2;
  inset: auto 18px 17px;
}

.food-card-copy small {
  display: block;
  margin-bottom: 6px;
  color: #ffd7c8;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.food-card-copy strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.05;
}

.food-card-copy span {
  display: block;
  max-height: 0;
  overflow: hidden;
  color: #ffcab6;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  opacity: 0;
  transition: max-height 220ms ease, opacity 220ms ease, margin 220ms ease;
}

.food-card.revealed .food-card-copy span {
  max-height: 50px;
  margin-top: 8px;
  opacity: 1;
}

.load-more {
  display: flex;
  margin: 34px auto 0;
}

.safety-section {
  padding-top: 20px;
  background: var(--cream);
}

.safety-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  max-width: 1340px;
  margin: 0 auto;
  padding: clamp(35px, 6vw, 80px);
  border-radius: 28px;
  background: var(--sage);
}

.safety-card h2 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.96;
}

.safety-card .eyebrow {
  color: var(--plum);
}

.safety-card p {
  line-height: 1.7;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(36, 29, 35, 0.25);
  font-size: 0.75rem;
  font-weight: 800;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 30px clamp(20px, 7vw, 110px);
  color: #cbbbc5;
  background: #281621;
  font-size: 0.75rem;
}

footer p {
  margin: 0;
}

footer .brand {
  color: var(--white);
}

dialog {
  width: min(750px, calc(100vw - 32px));
  max-height: calc(100vh - 30px);
  padding: clamp(25px, 5vw, 54px);
  overflow-y: auto;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 40px 120px rgba(28, 14, 23, 0.45);
}

dialog::backdrop {
  background: rgba(35, 19, 29, 0.72);
  backdrop-filter: blur(8px);
}

.dialog-close-form {
  position: sticky;
  z-index: 2;
  top: -20px;
  display: flex;
  justify-content: flex-end;
  height: 0;
}

.dialog-close {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

.dialog-heading {
  padding-right: 45px;
}

.dialog-heading h2 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5vw, 3.7rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}

.dialog-heading > p:last-child {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px 0;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  font-size: 0.73rem;
  font-weight: 800;
}

.form-grid label span {
  color: var(--muted);
  font-weight: 500;
}

fieldset {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

legend {
  padding: 0 7px;
  font-size: 0.78rem;
  font-weight: 800;
}

.radio-card,
.confirmation {
  display: flex;
  gap: 11px;
  align-items: start;
}

.radio-card input,
.confirmation input {
  margin-top: 4px;
  accent-color: var(--orange);
}

.radio-card span {
  display: grid;
}

.radio-card small {
  color: var(--muted);
}

.confirmation {
  padding: 16px;
  border-radius: 14px;
  background: #f0e7dc;
  font-size: 0.75rem;
}

.form-error {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: #a02b24;
  font-size: 0.78rem;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
}

.credits-list {
  display: grid;
  gap: 8px;
  margin-top: 25px;
}

.credit {
  display: grid;
  grid-template-columns: 35px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
}

.credit img {
  width: 35px;
  height: 35px;
  border-radius: 8px;
  object-fit: cover;
}

.credit strong,
.credit span {
  display: block;
}

.credit span {
  color: var(--muted);
}

.credit a {
  color: var(--orange-dark);
  font-weight: 800;
}

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

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid #7b4ed8;
  outline-offset: 3px;
}

@media (max-width: 1050px) {
  .hero-copy {
    width: 67vw;
  }

  .quiz-shell {
    grid-template-columns: 1fr;
  }

  .quiz-progress {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .progress-track {
    grid-column: 1 / -1;
  }

  .score-block {
    grid-row: 1 / 3;
    grid-column: 2;
    margin: 0 0 0 30px;
  }

  .score-block strong {
    font-size: 2.5rem;
  }

  .quiz-progress p,
  .quiz-progress .quiet-button {
    display: none;
  }

  .food-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .library-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .safety-ribbon {
    justify-content: space-between;
    font-size: 0.68rem;
  }

  .safety-ribbon a {
    display: none;
  }

  .site-header {
    min-height: 64px;
  }

  nav a {
    display: none;
  }

  .hero {
    min-height: 790px;
  }

  .hero::after {
    background: linear-gradient(180deg, rgba(248, 240, 228, 0.99) 0%, rgba(248, 240, 228, 0.92) 55%, rgba(248, 240, 228, 0.08) 100%);
  }

  .hero-image {
    object-position: 65% center;
  }

  .hero-copy {
    width: auto;
    padding: 65px 22px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(2.65rem, 11vw, 3.4rem);
    line-height: 0.9;
  }

  .hero-lede {
    font-size: 0.95rem;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    max-width: 280px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .quiz-card {
    grid-template-columns: 1fr;
  }

  .quiz-photo-wrap {
    min-height: 350px;
    aspect-ratio: 4 / 3;
  }

  .reveal-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .quiz-content {
    padding: 28px 24px 32px;
  }

  .quiz-content h3 {
    font-size: 2.6rem;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .steps article {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .steps > article > span {
    margin-bottom: 28px;
  }

  .food-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .food-card-copy {
    inset: auto 12px 12px;
  }

  .food-card-copy strong {
    font-size: 1rem;
  }

  .safety-card {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  footer {
    align-items: start;
    flex-direction: column;
  }

  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

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