:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2a2622;
  --muted: #6f665d;
  --border: #e6dfd5;
  --accent: #b5532a;
  --ing-bg: #f6e6d6;
  --cw-bg: #e3ecef;
  --timer-bg: #efe6f4;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --surface: #26231f;
    --text: #ece6de;
    --muted: #a59b90;
    --border: #3a352f;
    --accent: #e48a5f;
    --ing-bg: #4a3122;
    --cw-bg: #263a42;
    --timer-bg: #3d2d47;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
}

a {
  color: var(--accent);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
  margin: 0.25rem 0 0.75rem;
}

h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9em;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}

/* Recipe header */

.category a {
  color: inherit;
  text-decoration: none;
}

.category {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.description {
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0;
}

.meta div {
  min-width: 0;
}

.meta dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.keywords li {
  font-size: 0.85rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.recipe-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* Ingredients: tap a row to check it off */

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.checklist li + li {
  border-top: 1px solid var(--border);
}

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.checklist input {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}

.checklist label:has(input:checked) .item {
  color: var(--muted);
  text-decoration: line-through;
}

.amount {
  font-weight: 600;
  white-space: nowrap;
}

.note {
  color: var(--muted);
}

.cookware ul {
  padding-left: 1.25rem;
}

/* Steps */

.steps {
  padding-left: 1.75rem;
}

.steps li {
  margin-bottom: 1rem;
  padding-left: 0.25rem;
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.step-note {
  border-left: 3px solid var(--border);
  padding-left: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.ing,
.cw,
.timer {
  border-radius: 6px;
  padding: 0 0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.ing {
  background: var(--ing-bg);
}

.ing .amount {
  font-weight: 400;
  color: var(--muted);
}

.cw {
  background: var(--cw-bg);
}

.timer {
  background: var(--timer-bg);
  font-weight: 600;
}

.timer::before {
  content: "⏱ ";
}

/* Cook mode */

.cook-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0 0.5rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.cook-mode-toggle[hidden] {
  display: none;
}

.cook-mode-toggle[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .cook-mode-toggle[aria-pressed="true"] {
    color: var(--bg);
  }
}

/* Bigger steps while cooking, readable at arm's length. */
.cook-mode .steps,
.cook-mode .step-note {
  font-size: 1.3rem;
  line-height: 1.7;
}

/* Search */

.search-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.search-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.search-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .search-form button {
    color: var(--bg);
  }
}

/* Start page */

.chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin: 0 -1rem;
  padding: 0.25rem 1rem 0.5rem;
  scrollbar-width: none;
}

.chips a {
  flex: none;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.category-section {
  scroll-margin-top: 1rem;
}

.category-section h2 a {
  color: var(--text);
  text-decoration: none;
}

.count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

/* Recipe cards */

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-list li + li {
  border-top: 1px solid var(--border);
}

.card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.card:active {
  background: var(--bg);
}

.thumb {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 8px;
  object-fit: cover;
}

.thumb-empty {
  display: grid;
  place-items: center;
  background: var(--ing-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.3rem;
}

.card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-title {
  font-weight: 500;
  line-height: 1.3;
}

.card-sub {
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-list {
  padding-left: 1.25rem;
}

.link-list li {
  margin-bottom: 0.5rem;
}

/* Tips */

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.prose li {
  margin-bottom: 0.35rem;
}

.wikilink.broken {
  color: var(--muted);
  text-decoration: underline dotted;
}

@media (min-width: 48rem) {
  h1 {
    font-size: 2.5rem;
  }
}
