:root {
  --page: #f6f7f2;
  --surface: #ffffff;
  --surface-warm: #fff8ee;
  --ink: #24211d;
  --muted: #6d6961;
  --line: rgba(36, 33, 29, 0.13);
  --tomato: #b33d2e;
  --tomato-dark: #8f2f24;
  --herb: #3f734d;
  --blue: #2f6f8f;
  --gold: #c98526;
  --shadow: 0 18px 42px rgba(40, 33, 25, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
p,
strong,
span,
small,
a,
button,
input,
textarea,
select {
  overflow-wrap: anywhere;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 70px;
  padding: 0 34px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.top-nav,
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 15px;
}

.top-nav a,
.footer-nav a {
  text-decoration: none;
}

.top-nav a:hover,
.footer-nav a:hover {
  color: var(--tomato);
}

.auth-mount {
  margin-left: auto;
  flex: 0 0 auto;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.button-ghost,
.button-danger,
.text-button,
.modal-close {
  min-height: 38px;
  background: transparent;
  color: var(--ink);
}

.button-ghost {
  border: 1px solid var(--line);
  padding: 0 12px;
}

.button-danger {
  border: 1px solid rgba(179, 61, 46, 0.35);
  padding: 0 12px;
  color: var(--tomato);
}

.button-ghost:hover,
.button-danger:hover,
.text-button:hover,
.modal-close:hover {
  background: #eef3ea;
  color: var(--ink);
}

.text-button {
  padding: 0;
  color: var(--tomato);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  padding: 0;
  font-size: 24px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 22, 18, 0.54);
}

.auth-modal {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-modal h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.auth-form,
.review-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-form label,
.review-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.auth-form .check-row {
  grid-template-columns: 20px 1fr;
  align-items: start;
  font-weight: 400;
}

.check-row input {
  min-height: auto;
  margin-top: 4px;
}

.check-row a {
  color: var(--tomato);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--tomato);
}

.is-hidden {
  display: none !important;
}

.hero {
  min-height: 640px;
  display: grid;
  align-items: end;
  padding: 92px 34px 44px;
  background:
    linear-gradient(90deg, rgba(24, 22, 18, 0.78), rgba(24, 22, 18, 0.36) 55%, rgba(24, 22, 18, 0.1)),
    url("assets/hero-table.png") center / cover;
  color: #fffaf2;
}

.hero__content {
  width: min(790px, 100%);
  min-width: 0;
}

.hero h1,
.recipe-detail h1 {
  margin: 8px 0 18px;
  font-size: 64px;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 0;
  font-size: 19px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-panel {
  width: min(690px, 100%);
  margin-top: 30px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.search-panel__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
button,
select,
textarea {
  min-height: 48px;
  border-radius: 8px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 118px;
  padding: 12px 14px;
  resize: vertical;
}

button {
  border: 0;
  padding: 0 18px;
  background: var(--tomato);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

button:hover,
button.is-active {
  background: var(--tomato-dark);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 68px 0;
}

.section--wide {
  width: min(1280px, calc(100% - 40px));
}

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section h2,
.recipe-detail h2 {
  margin: 4px 0 0;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 0;
}

.muted {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
}

.collection-card {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  display: grid;
  align-content: end;
  gap: 2px;
  padding: 16px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-align: left;
  box-shadow: 0 12px 28px rgba(40, 33, 25, 0.12);
}

.collection-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.76));
}

.collection-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.collection-card:hover img {
  transform: scale(1.05);
}

.collection-card span,
.collection-card small {
  position: relative;
  z-index: 1;
}

.collection-card span {
  font-size: 20px;
  font-weight: 900;
}

.collection-card small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.spotlight {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.72fr);
  gap: 26px;
  align-items: stretch;
}

.spotlight__main,
.spotlight__side,
.recipe-sidebar,
.recipe-detail__columns section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.spotlight__main {
  padding: 28px;
}

.spotlight__side {
  padding: 22px;
}

.featured-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(260px, 1fr);
  gap: 24px;
  margin-top: 20px;
  align-items: center;
}

.featured-card__image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-warm);
}

.featured-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card h3,
.recipe-card h3 {
  margin: 0 0 8px;
  line-height: 1.16;
}

.featured-card h3 {
  font-size: 32px;
}

.featured-card a,
.recipe-card h3 a,
.compact-recipe {
  text-decoration: none;
}

.featured-card p,
.recipe-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.compact-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.compact-recipe {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  color: var(--ink);
}

.compact-recipe img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
}

.compact-recipe strong,
.compact-recipe small {
  display: block;
}

.compact-recipe strong {
  line-height: 1.2;
}

.compact-recipe small {
  margin-top: 4px;
  color: var(--muted);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.category-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.category-tabs button:hover,
.category-tabs button.is-active {
  border-color: var(--herb);
  background: var(--herb);
  color: #fff;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.recipe-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(40, 33, 25, 0.08);
}

.recipe-card__image {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-warm);
}

.recipe-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card__body {
  padding: 18px;
}

.recipe-card__category {
  margin: 0 0 8px;
  color: var(--tomato);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.recipe-card h3 {
  font-size: 22px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.meta-row span,
.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  background: #eef3ea;
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.meta-row--large span {
  min-height: 36px;
  background: #fff;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span {
  background: rgba(47, 111, 143, 0.12);
  color: var(--blue);
}

.empty-state {
  padding: 30px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.ad-slot {
  width: min(1180px, calc(100% - 40px));
  min-height: 110px;
  margin: 28px auto;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.ad-slot[hidden] {
  display: none;
}

.ad-slot--in-feed {
  width: 100%;
  margin: 0 0 24px;
}

.ad-slot--bottom {
  width: 100%;
  margin-top: 40px;
}

.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cookie-banner p {
  margin: 4px 0;
  color: var(--muted);
}

.cookie-banner a {
  color: var(--tomato);
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.legal-page {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 76px;
}

.legal-page h1 {
  margin: 0 0 18px;
  font-size: 48px;
  line-height: 1.05;
}

.legal-page h2 {
  margin-top: 34px;
  font-size: 26px;
}

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

.recipe-detail {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 76px;
}

.recipe-detail__hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1fr);
  gap: 38px;
  align-items: center;
}

.recipe-detail__hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.recipe-detail__hero p {
  color: var(--muted);
  font-size: 18px;
}

.recipe-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  margin-top: 48px;
  align-items: start;
}

.reviews-section {
  margin-top: 48px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reviews-section .section__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  align-items: start;
  gap: 20px;
}

.reviews-section .section__head .muted {
  justify-self: end;
  padding-top: 30px;
  text-align: right;
}

.review-login {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 20px 22px;
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-login strong {
  line-height: 1.25;
}

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

.review-login button {
  min-width: 150px;
  justify-self: end;
  white-space: nowrap;
}

.reviews-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.review-card {
  padding: 18px;
  background: #f8faf5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.review-card span {
  color: var(--gold);
  white-space: nowrap;
}

.review-card p {
  margin: 10px 0;
}

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

.recipe-detail__columns {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(320px, 1.18fr);
  gap: 24px;
}

.recipe-detail__columns section,
.recipe-sidebar {
  padding: 24px;
}

.recipe-sidebar {
  position: sticky;
  top: 96px;
}

.ingredient-list,
.step-list {
  padding-left: 22px;
}

.ingredient-list li + li,
.step-list li + li {
  margin-top: 10px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  background: #23211d;
  color: #fffaf2;
}

.site-footer .brand,
.site-footer a {
  color: #fffaf2;
}

.site-footer p {
  margin: 6px 0 0;
  color: rgba(255, 250, 242, 0.72);
}

@media (max-width: 1020px) {
  .site-header {
    gap: 18px;
    padding: 0 24px;
  }

  .top-nav {
    gap: 12px;
  }

  .collection-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .spotlight,
  .recipe-layout,
  .recipe-detail__columns {
    grid-template-columns: 1fr;
  }

  .recipe-sidebar {
    position: static;
  }

  .reviews-section .section__head,
  .review-login {
    grid-template-columns: 1fr;
  }

  .reviews-section .section__head .muted {
    justify-self: start;
    padding-top: 0;
    text-align: left;
  }

  .review-login button {
    justify-self: start;
  }
}

@media (max-width: 780px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .site-header {
    gap: 12px;
  }

  .brand {
    font-size: 19px;
  }

  .top-nav,
  .footer-nav {
    gap: 10px 14px;
    font-size: 14px;
  }

  .auth-user {
    flex-wrap: wrap;
  }

  .auth-mount {
    margin-left: 0;
    width: 100%;
  }

  .auth-mount .button-ghost,
  .auth-mount .button-danger {
    min-height: 36px;
  }

  .hero {
    min-height: 660px;
    padding: 70px 20px 34px;
  }

  .hero h1,
  .recipe-detail h1 {
    font-size: 42px;
  }

  .hero p,
  .recipe-detail__hero p {
    font-size: 17px;
  }

  .search-panel__row,
  .featured-card,
  .recipe-detail__hero,
  .cookie-banner {
    grid-template-columns: 1fr;
  }

  .cookie-banner__actions {
    justify-content: stretch;
  }

  .cookie-banner {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .section,
  .section--wide,
  .recipe-detail {
    width: min(100% - 28px, 1180px);
    padding: 46px 0;
  }

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

  .section h2,
  .recipe-detail h2 {
    font-size: 30px;
  }

  .reviews-section {
    margin-top: 36px;
    padding: 20px;
  }

  .review-login {
    padding: 18px;
  }

  .review-login button,
  .review-form button,
  .search-panel button,
  .cookie-banner button {
    width: 100%;
  }

  .collection-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
  }

  .collection-card {
    min-width: 220px;
    scroll-snap-align: start;
  }
}

@media (max-width: 520px) {
  input,
  button,
  select,
  textarea {
    min-height: 46px;
  }

  .hero {
    min-height: 600px;
  }

  .hero__content {
    width: min(330px, 100%);
  }

  .hero h1,
  .recipe-detail h1 {
    font-size: 28px;
    line-height: 1.05;
  }

  .hero h1 {
    max-width: 100%;
  }

  .section h2,
  .recipe-detail h2 {
    font-size: 26px;
  }

  .recipe-detail {
    width: min(100% - 24px, 1180px);
  }

  .recipe-detail__columns section,
  .recipe-sidebar,
  .spotlight__main,
  .spotlight__side {
    padding: 18px;
  }

  .review-card div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
