:root {
  --bg: #f5ede1;
  --surface: #fbf6ee;
  --ink: #2a1c13;
  --muted: #6b5545;
  --accent: #a4471f;
  --on-accent: #ffffff;
  --star: #b7791f;
  --rule: #e2d3bf;
  --field-border: #8f7a66;
  --shadow: rgb(60 30 10 / 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17110d;
    --surface: #211912;
    --ink: #f2e7d8;
    --muted: #b9a58f;
    --accent: #e5875a;
    --on-accent: #17110d;
    --star: #f0b429;
    --rule: #3a2c21;
    --field-border: #806a57;
    --shadow: rgb(0 0 0 / 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  line-height: 1.6;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) 1rem 5rem;
}

.masthead {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 10vw, 6.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 16px 40px -16px var(--shadow);
}

.frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.columns {
  display: grid;
  gap: clamp(3rem, 8vw, 4rem);
  margin-top: clamp(2.5rem, 7vw, 4rem);
}

@media (min-width: 840px) {
  .columns {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0 2rem;
  }

  .columns > section {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
  }

  .columns .card {
    margin-inline: 0;
  }

  .recipe .card {
    display: flex;
    flex-direction: column;
  }

  .recipe .ingredients {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }

  .recipe .ingredients li {
    flex-grow: 1;
    align-items: center;
  }
}

h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
}

.card {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
}

h3,
.stars legend {
  margin: 0 0 1rem;
  padding: 0;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredients li {
  display: flex;
  gap: 1rem;
  padding: 0.625rem 0;
  border-top: 1px solid var(--rule);
}

.ingredients li:first-child {
  padding-top: 0;
  border-top: 0;
}

.qty {
  flex: 0 0 5.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.review-summary {
  margin: 0 0 1rem;
  color: var(--muted);
  text-align: center;
}

.review-form {
  display: grid;
  gap: 1.25rem;
}

.review-form h3 {
  margin-bottom: 0;
}

.stars {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.stars legend {
  margin-bottom: 0.5rem;
  color: var(--ink);
  letter-spacing: 0.08em;
}

.stars label {
  cursor: pointer;
  border-radius: 6px;
}

.star::before {
  content: "☆";
  display: block;
  padding: 0 0.125rem;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
}

.stars label:has(input:checked) .star::before,
.stars label:has(~ label input:checked) .star::before {
  content: "★";
  color: var(--star);
}

.stars:has(label:hover) label .star::before {
  content: "☆";
  color: var(--muted);
}

.stars:has(label:hover) label:hover .star::before,
.stars:has(label:hover) label:has(~ label:hover) .star::before {
  content: "★";
  color: var(--star);
}

.stars label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field {
  display: grid;
  gap: 0.375rem;
}

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

.field input,
.field textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font: inherit;
}

.field textarea {
  min-height: 6rem;
  resize: vertical;
}

.char-count {
  justify-self: end;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.char-count.near-limit {
  color: var(--accent);
}

.field input:focus-visible,
.field textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.form-actions button {
  padding: 0.625rem 1.25rem;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.form-actions button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form-status {
  margin: 0;
  color: var(--muted);
}

.review-feed {
  margin-top: 2rem;
}

.reviews-status {
  margin: 0 0 1rem;
  color: var(--muted);
  text-align: center;
}

.review-box {
  position: relative;
  max-height: var(--visible-height, none);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--field-border) transparent;
  padding: 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
}

.review-box:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.review-sentinel {
  height: 1px;
}

.link-button {
  padding: 0;
  color: var(--accent);
  background: none;
  border: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.review-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.review {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.review:first-child {
  border-top: 0;
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.375rem;
}

.review-stars {
  color: var(--star);
  letter-spacing: 0.08em;
}

.review time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
}

.review-body {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.review-comment {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.review-more {
  flex-shrink: 0;
  white-space: nowrap;
}

.review.expanded .review-body {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.review.expanded .review-comment {
  display: block;
  overflow: visible;
}

.support {
  margin-top: clamp(2.5rem, 7vw, 4rem);
  text-align: center;
}

.support-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.support-link:hover {
  text-decoration: underline;
}

.support-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
