/* Ryejournal — small-batch baking notebook. Cocoa / tomato / cream. Change the six colours below for variants. */
:root {
  --paper: #f6efe3;
  --paper-2: #efe3cf;
  --ink: #3b241a;
  --ink-2: #2a1810;
  --muted: #7a5c4c;
  --tomato: #c1290f;
  --tomato-2: #d8341f;
  --rule: #d8c6ae;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1120px;
  --gutter: clamp(20px, 4vw, 40px);
  --section: clamp(72px, 10vw, 128px);
  --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  font-feature-settings: "kern", "liga";
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--tomato); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 3px; border-radius: 2px; }
button, input, select { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5em 0.6em; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.tomato { color: var(--tomato); }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  background: var(--ink-2); color: var(--paper); padding: 0.6em 1em;
}
.skip:focus { top: 8px; }

/* Masthead: sticky folio with a double rule */
.masthead {
  position: sticky; top: 0; z-index: 10; background: var(--paper);
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 2px 0 var(--paper), 0 3px 0 var(--ink);
}
.masthead__bar { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-size: 1.45rem; letter-spacing: -0.01em;
}
.brand svg { width: 28px; height: 28px; }
.masthead__tag { margin: 0; color: var(--muted); font-size: 0.9rem; }
.menu-btn {
  margin-left: auto; background: none; border: 1px solid var(--ink); padding: 0.4em 0.9em; cursor: pointer;
  display: none; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.menu-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-size: 0.92rem; padding: 0.3em 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="true"] { border-bottom-color: var(--tomato-2); }

/* Opener */
.opener { padding-block: clamp(40px, 6vw, 72px) var(--section); }
.opener__grid { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.dateline { display: flex; gap: 1rem; align-items: center; color: var(--tomato); margin-bottom: 1.2rem; }
.dateline::after { content: ""; flex: 1; height: 1px; background: var(--tomato-2); }
.opener h1 { font-size: clamp(2.4rem, 5.4vw, 4.4rem); max-width: 14ch; text-wrap: balance; }
.opener h1 em { font-style: italic; color: var(--tomato); }
.lede { font-size: 1.2rem; line-height: 1.5; max-width: 52ch; margin-top: 1.4rem; color: var(--ink); }
.opener__note { color: var(--muted); }
.opener__aside { border-top: 3px solid var(--ink); padding-top: 1rem; }
.opener__aside figure { margin: 0 0 1.2rem; }
.opener__aside svg { width: 100%; height: auto; display: block; }
.contents { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.contents li { counter-increment: toc; border-bottom: 1px solid var(--rule); }
.contents a {
  display: grid; grid-template-columns: 2.4rem 1fr auto; gap: 0.6rem; align-items: baseline;
  padding: 0.7em 0; color: var(--ink); text-decoration: none;
}
.contents a::before {
  content: counter(toc, decimal-leading-zero); font-family: var(--mono); color: var(--tomato); font-size: 0.8rem;
}
.contents a span:last-child { color: var(--muted); font-size: 0.82rem; }
.contents a:hover span:first-of-type { text-decoration: underline; text-decoration-color: var(--tomato-2); }

/* Sections */
.section { padding-block: var(--section); border-top: 1px solid var(--rule); }
.section__head {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.5rem; align-items: baseline; margin-bottom: 2.2rem;
}
.section__head .mono { color: var(--tomato); }
.section__head h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
.section__head p { grid-column: 2; margin: 0; max-width: var(--measure); color: var(--muted); }
.prose { max-width: var(--measure); }
.prose h3 { font-size: 1.35rem; margin: 1.4em 0 0.5em; }
.prose h3:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.35em; }
.callout {
  border-left: 3px solid var(--tomato-2); background: var(--paper-2); padding: 0.9rem 1.1rem; margin: 1.4rem 0 0;
  font-size: 0.95rem;
}
.callout strong { font-family: var(--serif); font-size: 1.05rem; display: block; margin-bottom: 0.2em; }

/* Guides: tabs */
.tablist { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--ink); margin-bottom: 2rem; flex-wrap: wrap; }
.tab {
  background: none; border: 0; padding: 0.7em 1em; cursor: pointer; font-family: var(--serif); font-size: 1.05rem;
  border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--tomato-2); }
.panel[hidden] { display: none; }
.guide { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(28px, 4vw, 56px); }
.guide .callout { margin-top: 0; }

/* Recipes: ruled spreads */
.recipe {
  display: grid; grid-template-columns: 5fr 7fr; gap: clamp(28px, 4vw, 64px); padding-block: 2.6rem;
  border-top: 1px solid var(--rule);
}
.recipe:first-of-type { border-top: 0; padding-top: 0; }
.recipe__title { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 0.4rem; }
.recipe__meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 1.2rem; padding: 0; list-style: none;
  color: var(--muted); font-size: 0.9rem;
}
.recipe__meta b { color: var(--ink); font-weight: 600; }
.recipe table { font-size: 0.95rem; }
.recipe caption {
  text-align: left; caption-side: bottom; color: var(--muted); font-size: 0.82rem; padding-top: 0.5rem;
}
.recipe__body p { max-width: var(--measure); }
details { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
summary {
  cursor: pointer; padding: 0.8em 0; font-family: var(--serif); font-size: 1.15rem; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--mono); color: var(--tomato); font-size: 1.3rem; }
details[open] summary::after { content: "\2212"; }
details ol { margin: 0 0 1.2rem; padding-left: 1.3em; }
details li { margin-bottom: 0.6em; max-width: var(--measure); }

/* Calculator band */
.calc-band { background: var(--ink-2); color: var(--paper); border-top: 0; }
.calc-band .section__head p, .calc-band .mono { color: var(--paper-2); }
.calc-band .section__head .mono { color: #ff8a70; }
.calc-band a { color: #ffb3a0; }
.calc { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(28px, 4vw, 64px); align-items: start; }
.calc__controls { display: grid; gap: 1.1rem; }
.calc__controls label {
  display: block; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.35rem;
  color: var(--paper-2);
}
.calc__controls select, .calc__controls input {
  width: 100%; padding: 0.6em 0.7em; background: var(--paper); color: var(--ink); border: 1px solid var(--paper);
  border-radius: 2px;
}
.calc__controls input { font-family: var(--mono); font-size: 1.15rem; }
.calc__presets { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.calc__presets button {
  background: none; border: 1px solid var(--paper-2); color: var(--paper); padding: 0.45em 0.9em; cursor: pointer;
  border-radius: 2px; font-size: 0.9rem;
}
.calc__presets button:hover { background: var(--paper); color: var(--ink-2); }
.calc__yield { font-family: var(--serif); font-size: 1.35rem; margin: 0.4rem 0 0; }
.calc__yield small {
  display: block; font-family: var(--sans); font-size: 0.85rem; color: var(--paper-2); margin-top: 0.3rem;
}
.calc__out th, .calc__out td { border-bottom-color: #5a3a2c; }
.calc__out th { color: var(--paper-2); }
.calc__out td.hint { color: var(--paper-2); font-size: 0.85rem; }
.calc__out tfoot td { border-bottom: 0; color: var(--paper-2); font-size: 0.85rem; }
.calc__out td.num { color: #fff; }

/* Reference tables */
.ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 64px); }
.ref-grid h3 { font-size: 1.3rem; margin-bottom: 0.8rem; }
.ref-grid table { font-size: 0.95rem; }
.ref-grid p { font-size: 0.9rem; color: var(--muted); margin-top: 0.8rem; }

/* Footer */
.footer { border-top: 3px double var(--ink); padding-block: 2.6rem 3rem; font-size: 0.92rem; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.footer h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.footer p { max-width: var(--measure); color: var(--muted); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { padding: 0.3em 0; border-bottom: 1px solid var(--rule); }
.footer .colophon { margin-top: 1.6rem; font-size: 0.82rem; }

/* Motion (only colour and underline) */
@media (prefers-reduced-motion: no-preference) {
  a, .tab, .site-nav a, .calc__presets button { transition: color 0.15s, border-color 0.15s, background-color 0.15s; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Responsive */
@media (max-width: 900px) {
  .opener__grid, .recipe, .calc, .guide, .ref-grid, .footer__grid { grid-template-columns: 1fr; }
  .opener h1 { max-width: none; }
  .guide { gap: 1.6rem; }
  .masthead__tag { display: none; }
}
@media (max-width: 680px) {
  .menu-btn { display: inline-block; }
  .site-nav { flex-basis: 100%; margin: 0; display: none; padding-bottom: 0.8rem; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li { border-top: 1px solid var(--rule); }
  .site-nav a { display: block; padding: 0.7em 0; font-size: 1rem; }
  .section__head { grid-template-columns: 1fr; gap: 0.4rem; }
  .section__head p { grid-column: 1; }
  .tablist { gap: 0; }
  .tab { font-size: 0.95rem; padding: 0.6em 0.7em; }
  .recipe__meta { font-size: 0.85rem; }
  th, td { padding: 0.45em 0.4em; }
}
