/* Altus — kitchen-first styles. Mobile-first, light default, dark override.
   No web fonts (fast first paint); large type and tap targets for counter use. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --fg: #1f1b16;
  --muted: #6f675c;
  --line: #e7e0d5;
  --accent: #b4531f;
  --accent-fg: #ffffff;
  --shadow: 0 1px 2px rgba(31, 27, 22, 0.06), 0 8px 24px rgba(31, 27, 22, 0.06);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --tap: 48px;
  --maxw: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --surface: #1e1d17;
    --fg: #f2ede3;
    --muted: #a39b8c;
    --line: #322f26;
    --accent: #e8853f;
    --accent-fg: #14140f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* Explicit user choice overrides the system preference. */
:root.theme-light {
  --bg: #faf7f2; --surface: #ffffff; --fg: #1f1b16; --muted: #6f675c;
  --line: #e7e0d5; --accent: #b4531f; --accent-fg: #ffffff;
  --shadow: 0 1px 2px rgba(31, 27, 22, 0.06), 0 8px 24px rgba(31, 27, 22, 0.06);
}
:root.theme-dark {
  --bg: #14140f; --surface: #1e1d17; --fg: #f2ede3; --muted: #a39b8c;
  --line: #322f26; --accent: #e8853f; --accent-fg: #14140f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding: 0 1.15rem calc(2.5rem + env(safe-area-inset-bottom));
}

a { color: inherit; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 0 0.75rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.theme-toggle {
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.theme-toggle__icon {
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--fg);
  box-shadow: inset -0.35rem -0.35rem 0 0 var(--surface);
}
:root.theme-dark .theme-toggle__icon,
.theme-toggle__icon { transition: none; }

/* ---------- Home ---------- */
.home, .recipe { max-width: var(--maxw); margin: 0 auto; }

.section-title, .block__title {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2rem 0 0.9rem;
}

.search { margin: 0.5rem 0 1.5rem; }
.search__label {
  display: block;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.search__input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  font-size: 1.1rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  box-shadow: var(--shadow);
}
.search__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search__empty { color: var(--muted); font-style: italic; }

.cards { display: grid; gap: 1rem; }
.card {
  display: block;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.card__title {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 0.4rem;
}
.card__summary { margin: 0; color: var(--muted); font-size: 1rem; }
.card[hidden] { display: none; }

/* ---------- Recipe ---------- */
.recipe__header { margin: 0.5rem 0 1rem; }
.recipe__title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1.1;
  margin: 0.5rem 0 0.75rem;
  text-wrap: balance;
}
.recipe__summary {
  font-size: 1.15rem; color: var(--fg); margin: 0 0 1.25rem;
  line-height: 1.55; text-wrap: pretty;
}

.meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.meta__item { display: flex; flex-direction: column; font-size: 1.05rem; font-weight: 600; }
.meta__label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}

.block { margin: 1.5rem 0; }

.ingredients, .equipment, .notes, .lessons { list-style: none; margin: 0; padding: 0; }
.ingredients .ing {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--line); font-size: 1.15rem;
}
.ingredients .ing:last-child { border-bottom: none; }
.ing__qty { font-weight: 700; min-width: 5rem; }
.ing__item { font-weight: 500; }
.ing__note { color: var(--muted); font-size: 1rem; width: 100%; padding-left: 5.4rem; }

.equipment li, .notes li {
  position: relative; padding: 0.6rem 0 0.6rem 1.4rem; font-size: 1.08rem;
  line-height: 1.5; border-bottom: 1px solid var(--line);
}
.equipment li:last-child, .notes li:last-child { border-bottom: none; }
.equipment li::before, .notes li::before {
  content: ""; position: absolute; left: 0.2rem; top: 1.2rem;
  width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent);
}

.directions { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.directions .step { display: flex; gap: 1.1rem; padding: 1.15rem 0; border-bottom: 1px solid var(--line); }
.directions .step:last-child { border-bottom: none; }
.step__num {
  flex: 0 0 auto; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-weight: 700; font-size: 1.05rem;
}
.step__text { font-size: 1.22rem; line-height: 1.5; padding-top: 0.2rem; text-wrap: pretty; }

/* ---------- Lessons Learned ---------- */
.block--lessons {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.85rem;
  padding: 0.1rem 1.15rem 0.9rem;
  box-shadow: var(--shadow);
}
.block--lessons .block__title { margin-top: 1.1rem; color: var(--accent); }
.lessons li {
  position: relative; padding: 0.6rem 0 0.6rem 1.4rem; font-size: 1.08rem;
  line-height: 1.5; border-bottom: 1px solid var(--line); text-wrap: pretty;
}
.lessons li:last-child { border-bottom: none; }
.lessons li::before {
  content: ""; position: absolute; left: 0.2rem; top: 1.2rem;
  width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent);
}

/* ---------- Kitchen Mode button ---------- */
.kitchen-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.25rem;
  min-height: var(--tap); padding: 0.75rem 1.4rem;
  font-size: 1.1rem; font-weight: 600;
  color: var(--accent-fg); background: var(--accent);
  border: none; border-radius: 0.85rem; cursor: pointer;
  box-shadow: var(--shadow);
}
.kitchen-btn__icon { font-size: 0.85rem; }

/* ---------- Kitchen Mode overlay ---------- */
.kitchen {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg); color: var(--fg);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 1.15rem calc(1.15rem + env(safe-area-inset-bottom));
}
.kitchen[hidden] { display: none; }
.kitchen__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.kitchen__title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.kitchen__exit {
  min-height: var(--tap); padding: 0 1.1rem; font-size: 1rem; font-weight: 600;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 0.75rem; cursor: pointer;
}
.kitchen__stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 1.25rem; padding: 1.5rem 0; text-align: left;
}
.kitchen__count {
  margin: 0; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.kitchen__step {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 7.5vw, 2.6rem);
  line-height: 1.32;
}
.kitchen__nav { display: flex; gap: 1rem; }
.kitchen__nav button {
  flex: 1; min-height: 4rem; font-size: 1.2rem; font-weight: 700;
  border-radius: 1rem; cursor: pointer; border: 1px solid var(--line);
}
.kitchen__prev { background: var(--surface); color: var(--fg); }
.kitchen__next { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.kitchen__nav button:disabled { opacity: 0.4; cursor: default; }

/* When Kitchen Mode is on, hide page chrome behind the overlay for focus. */
body.kitchen-on { overflow: hidden; }
