/* Weeknight Kitchen: a small recipe site a family reads on a phone in the
   kitchen. Warm, earthy tones, generous type, and cards that wrap to the
   width of any screen. The tokens in :root (and their dark twins) are the
   palette, type scale and shape; everything below spends them. */
:root {
  color-scheme: light dark;

  /* Palette. Warm earth tones with a paprika accent. */
  --ink: #2a211b;
  --muted: #8a7a6e;
  --line: #e8ddd0;
  --bg: #faf4ec;
  --surface: #fffaf2;
  --surface-2: #f4e9d8;
  --accent: #b8412e;
  --accent-ink: #fff8f0;
  --herb: #6b7a3a;

  /* Type scale. */
  --step-0: 0.9375rem; /* small print */
  --step-1: 1.0625rem; /* body */
  --step-2: 1.375rem; /* section headings */
  --step-3: clamp(2.25rem, 6vw, 3rem); /* the masthead */

  /* Shape. */
  --radius: 14px;
  --shadow: 0 1px 2px rgb(74 58 44 / 0.06), 0 8px 24px rgb(74 58 44 / 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3e9dc;
    --muted: #b3a399;
    --line: #3a312a;
    --bg: #18120e;
    --surface: #241c16;
    --surface-2: #2d241c;
    --accent: #e0685a;
    --accent-ink: #2a120c;
    --herb: #9fb05a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    var(--step-1) / 1.6 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.masthead,
main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* The product's name and its one sentence: the first thing a visitor reads,
   so it is the largest thing on the page, marked with the product's own
   colour rather than fenced off by a rule line. */
.masthead {
  padding-top: 4rem;
  padding-bottom: 2rem;
}

.masthead::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  margin-bottom: 1.25rem;
}

.masthead h1 {
  margin: 0 0 0.5rem;
  font-size: var(--step-3);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 750;
  text-wrap: balance;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: var(--step-1);
  max-width: 34rem;
  text-wrap: pretty;
}

main {
  padding-bottom: 3rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  font-weight: 650;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* One section wraps all the recipe cards, so they sit together under the
   masthead with a little breathing room. */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A recipe card: the warm surface, rounded corners and soft shadow. It
   fills the available width and never exceeds the viewport, so it reads
   well on a phone propped by the stove. */
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.recipe-card__photo {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.recipe-card__body {
  padding: 1.25rem 1.25rem 1.4rem;
}

.recipe-card__title {
  margin: 0 0 0.25rem;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  font-weight: 650;
  line-height: 1.2;
  text-wrap: balance;
}

.recipe-card__time {
  display: inline-block;
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.recipe-card__columns {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 30rem) {
  /* On a wider screen, ingredients and steps sit side by side; on a phone
     they stack, so nothing is fixed wider than the viewport. */
  .recipe-card__columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  }
}

.recipe-card__section h3 {
  margin: 0 0 0.5rem;
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.recipe-card__ingredients,
.recipe-card__steps {
  margin: 0;
  padding-left: 1.25rem;
  font-size: var(--step-1);
  line-height: 1.55;
}

.recipe-card__ingredients li,
.recipe-card__steps li {
  margin: 0.2rem 0;
  /* wrap long ingredient lines and step text rather than overflow */
  overflow-wrap: anywhere;
}

.recipe-card__steps {
  list-style: decimal;
}

/* An empty state is a designed state, not an absence. */
.empty {
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Each piece of the page below the masthead has its own block, so the three
   controls a person reaches for — the tonight suggestion, the filter and
   the surprise button — sit together at the top and the recipe list sits
   below. Nothing here introduces a new token: it all spends the palette,
   scale and shape declared above. */

.app__tonight,
.app__controls,
.surprise {
  margin-bottom: 1.5rem;
}

/* The tonight suggestion: the one dish for tonight, marked out from the
   rest of the list with the accent so a tired cook sees it first. */
.tonight {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0.3rem solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tonight__body {
  padding: 1.25rem 1.25rem 1.4rem;
}

.tonight__heading {
  margin: 0 0 0.5rem;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  font-weight: 650;
  line-height: 1.2;
  text-wrap: balance;
  padding: 1.25rem 1.25rem 0;
}

.tonight__heading .tonight__day {
  color: var(--accent);
}

.tonight__empty {
  margin: 0;
  padding: 1.25rem 1.25rem 1.4rem;
  color: var(--muted);
}

/* The filter and surprise controls sit in one row that wraps on a phone,
   so a thumb can reach either. */
.app__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 12rem;
}

.filter__label {
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter__select {
  appearance: none;
  font: inherit;
  font-size: var(--step-1);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 2rem 0.6rem 0.85rem;
  box-shadow: var(--shadow);
  /* A small chevron drawn in CSS, so no icon file is fetched. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.1rem) calc(50% - 0.15rem),
    calc(100% - 0.75rem) calc(50% - 0.15rem);
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

.filter__select:focus-visible {
  border-color: var(--accent);
}

/* The surprise button is the accent itself, so it reads as the one thing
   to press when nothing on the list sounds good. */
.surprise-me {
  font: inherit;
  font-size: var(--step-1);
  font-weight: 650;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  /* Stay pressable at phone width: never wider than its row. */
  max-width: 100%;
}

.surprise-me:active {
  transform: translateY(1px);
}

/* The surprise section: a heading for the random pick, and a highlighted
   card above the list, ringed in the accent so it stands apart from the
   recipes beneath it. */
.surprise__heading {
  margin: 0 0 0.75rem;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  font-weight: 650;
}

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

.surprise .recipe-card {
  border: 1px solid var(--accent);
  box-shadow:
    0 0 0 3px rgb(184 65 46 / 0.15),
    var(--shadow);
}
