:root {
  --cream: #fdf7ee;
  --card: #fffdf9;
  --crust: #9a5f2e;
  --crust-dark: #6f4220;
  --ink: #32241a;
  --muted: #6b5848;
  --line: #e7dac7;
  /* Text-safe accent: 4.9:1 on cream, 5.1:1 on card - WCAG AA for body text */
  --accent: #a05b2c;
  /* Decorative only - rules, bars, dividers. Never used for text. */
  --accent-bright: #c9743b;
  --good: #46702f;
  --warn: #a83c27;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 19px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  /* Microsoft style guide: avoid lines ending in hyphens, and avoid widows/orphans */
  hyphens: none;
  orphans: 2;
  widows: 2;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

header.site {
  background: var(--crust);
  color: #fff6e9;
  padding: 1.5rem 1.25rem 1.75rem;
}

header.site .inner { max-width: 44rem; margin: 0 auto; }

header.site a.home {
  color: #fff6e9;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

header.site .tag {
  margin: 0.25rem 0 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

nav.main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

nav.main a {
  background: rgba(255, 255, 255, 0.14);
  color: #fff6e9;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  /* WCAG 2.5.8 target size: at least 24px; this lands around 40px tall */
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
}

nav.main a:hover, nav.main a[aria-current="page"] {
  background: #fff6e9;
  color: var(--crust-dark);
}

h1 { font-size: 2rem; line-height: 1.2; margin: 2rem 0 0.5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.4rem; }

.lede { font-size: 1.1rem; color: var(--muted); }

/* Links carry both colour and an underline, never colour alone */
a { color: var(--accent); }

.wrap p a,
.wrap li a,
.wrap td a,
.wrap dd a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  margin: 1rem 0;
}

.cta:hover { background: var(--crust-dark); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.panel.warn { border-left: 5px solid var(--warn); }
.panel.good { border-left: 5px solid var(--good); }
.panel.tip  { border-left: 5px solid var(--accent-bright); }
.panel h3 { margin-top: 0.25rem; }

.day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.25rem 1.25rem 1rem;
  margin: 1rem 0;
}

.day .label {
  display: inline-block;
  background: var(--crust);
  color: #fff6e9;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin: 1rem 0 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

/* A wide table scrolls inside its own box rather than pushing the whole
   page sideways. WCAG 1.4.10 allows this for data tables. */
.scroller {
  overflow-x: auto;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

.scroller table { margin: 0; min-width: 22rem; }

.scroller + .scrollnote {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 1rem;
}

/* ---- Revival tracker ---- */

.tracker {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.tracker > h3 { margin-top: 0; }

.tracker ol {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  counter-reset: feed;
}

.tracker li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.1rem;
  border-top: 1px solid var(--line);
  margin: 0;
}

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

.tracker input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.15rem 0 0;
  flex-shrink: 0;
  accent-color: var(--good);
  cursor: pointer;
}

.tracker label {
  cursor: pointer;
  flex: 1;
  min-height: 1.5rem;
}

.tracker label b { color: var(--crust-dark); }

.tracker .hint {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
}

.tracker li.done label { opacity: 0.55; }
.tracker li.done label b { text-decoration: line-through; }

.tracker .bar {
  height: 0.6rem;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0 0.3rem;
}

.tracker .bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--good);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.tracker .count { font-size: 0.9rem; color: var(--muted); margin: 0; }

.tracker .controls {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.btn-small {
  background: transparent;
  border: 2px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 2.4rem;
}

.btn-small:hover { border-color: var(--accent); color: var(--accent); }

.privacy {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0.8rem 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .tracker .bar span { transition: none; }
}

/* ---- Recipe scaling ---- */

.scale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0.4rem;
}

.scale .lbl { font-size: 0.9rem; color: var(--muted); }

.scale .group {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.scale button {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--line);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.45rem 1rem;
  cursor: pointer;
  min-height: 2.4rem;
}

.scale button:first-child { border-left: 0; }
.scale button:hover { background: var(--cream); color: var(--accent); }

.scale button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

td.scaled { font-variant-numeric: tabular-nums; }

.scalenote { font-size: 0.86rem; color: var(--muted); margin: 0.1rem 0 1rem; }

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

/* Sentence case, not all caps: Microsoft style guide says all-uppercase
   text loses the word shapes that help people scan. */
th { color: var(--muted); font-size: 0.88rem; font-weight: 700; }

td.num { text-align: right; white-space: nowrap; }

code {
  background: #f0e6d6;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

ul, ol { padding-left: 1.3rem; }
li { margin: 0.35rem 0; }

.cards { display: grid; gap: 1rem; margin: 1.5rem 0; }
@media (min-width: 34rem) { .cards { grid-template-columns: 1fr 1fr; } }

.cards a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
}

.cards a:hover { border-color: var(--accent); }
.cards a strong { display: block; color: var(--crust-dark); font-size: 1.05rem; }
.cards a span { color: var(--muted); font-size: 0.92rem; }

.illus {
  display: block;
  width: 100%;
  max-width: 24rem;
  height: auto;
  margin: 1.5rem auto;
}

.illus.wide { max-width: 32rem; }

.hero {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 0.5rem auto 1rem;
}

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

.meta li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.meta li b { color: var(--crust-dark); font-weight: 700; }

.tag-active, .tag-discard {
  display: inline-block;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.tag-active { background: #e2eddb; color: #2f4d25; }
.tag-discard { background: #f6e8da; color: #7d4718; }

.tag-tested, .tag-untested {
  display: inline-block;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

.tag-tested { background: #dce7f1; color: #2b4760; }
.tag-untested { background: #efe7da; color: #5f4f3f; }

footer.site {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 2rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

footer.site .inner { max-width: 44rem; margin: 0 auto; }

nav.sitemap {
  display: grid;
  gap: 1.5rem 2rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.75rem;
}

@media (min-width: 34rem) {
  nav.sitemap { grid-template-columns: repeat(3, 1fr); }
}

nav.sitemap h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--crust-dark);
  margin: 0 0 0.5rem;
}

nav.sitemap a {
  display: block;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  padding: 0.35rem 0;
  min-height: 1.6rem;
}

nav.sitemap a:hover { color: var(--accent); text-decoration: underline; }

footer.site .colophon {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  text-decoration: none;
  z-index: 10;
}

.skip:focus {
  left: 0;
  outline: 3px solid var(--crust-dark);
  outline-offset: 2px;
}

.totop {
  display: inline-block;
  margin: 2.5rem 0 0;
  padding: 0.6rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 2.5rem;
}

.totop:hover { background: var(--accent); color: #fff; }

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

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

/* Printing a recipe to use in the kitchen */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.4;
  }

  header.site nav.main,
  header.site .tag,
  footer.site,
  .skip,
  .cta,
  .promptbar,
  .namebox,
  .prompt { display: none; }

  header.site {
    background: none;
    color: #000;
    border-bottom: 1pt solid #999;
    padding: 0 0 0.4rem;
  }

  header.site a.home { color: #000; }

  .wrap { max-width: none; padding: 0; }

  h1 { font-size: 20pt; margin: 0.6rem 0 0.3rem; }
  h2 { font-size: 13pt; margin: 0.9rem 0 0.3rem; }
  h3 { font-size: 11pt; }

  .lede { color: #333; font-size: 11pt; }

  /* keep recipe steps and panels from splitting across pages */
  .day, .panel, table, .meta { break-inside: avoid; page-break-inside: avoid; }

  .day, .panel {
    background: none;
    border: 1pt solid #bbb;
    padding: 0.3rem 0.6rem;
    margin: 0.4rem 0;
  }

  .day .label {
    background: none;
    color: #000;
    font-weight: 700;
    padding: 0;
    margin: 0.3rem 0 0.1rem;
  }

  .meta li { border: 1pt solid #bbb; background: none; }

  .tag-active, .tag-discard, .tag-tested, .tag-untested {
    border: 1pt solid #999;
    background: none;
    color: #000;
  }

  .illus, .hero { max-width: 60%; }

  /* The tracker prints as a plain paper checklist */
  .tracker { border: 1pt solid #999; background: none; }
  .tracker .bar, .tracker .count, .tracker .controls, .tracker .privacy { display: none; }
  .tracker li { border-top: 0.5pt solid #ccc; break-inside: avoid; }
  .tracker li.done label { opacity: 1; }
  .tracker li.done label b { text-decoration: none; }
  .tracker input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14pt;
    height: 14pt;
    border: 1pt solid #555;
    border-radius: 2pt;
  }

  /* Print whatever batch size is on screen, and say which it is */
  .scale .group { display: none; }
  .scale .lbl::after { content: " (as shown)"; }

  a { color: #000; text-decoration: underline; }

  /* spell out link targets, since paper has no hover */
  .wrap a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555;
    word-break: break-all;
  }

  table { font-size: 10pt; }
  th, td { border-bottom: 0.5pt solid #ccc; }
}
