/* Pizza Dough Generator — a warm pizzeria kitchen.
   Flour-cream and crust-brown, tomato red with basil green, rounded cards and
   pill controls. Fredoka for headings and numbers, Nunito for everything else.
   Every text colour meets WCAG AA (4.5:1) on its background in both themes. */

@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-style: normal; font-display: swap; }

:root {
  --flour: #fbf4e9;        /* page */
  --dough: #fffdf8;        /* cards */
  --dough-deep: #f5e9d8;   /* selected tiles, inset panels */
  --crust: #3a2416;        /* text */
  --crust-soft: #5c4434;
  --muted: #7a6352;
  --rule: #ead9c3;
  --rule-strong: #d7bf9f;
  --tomato: #c0331b;
  --tomato-soft: #f8ddd3;
  --basil: #2e6b30;
  --basil-soft: #dcebd6;
  --cheese: #f2c14e;       /* decoration only, never text on a light ground */
  --oven: #2b1a12;         /* header and footer */
  --oven-ink: #f6ead9;
  --oven-muted: #d9c4ad;
  --on-tomato: #ffffff;
  --warn-bg: #fdf0cf;
  --warn-ink: #6b4a0e;
  --shadow: 0 1px 2px rgba(58, 36, 22, .06), 0 8px 24px rgba(58, 36, 22, .08);

  --display: "Fredoka", "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 20px;
  --radius-sm: 12px;
  color-scheme: light;
}

/* Dark: the inside of a wood-fired oven. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --flour: #1b1411; --dough: #261c17; --dough-deep: #33251e; --crust: #f6ead9; --crust-soft: #e3d2bf; --muted: #c3ae98;
    --rule: #3d2e26; --rule-strong: #5a4436; --tomato: #ff7b5c; --tomato-soft: #4a2219; --basil: #86cf8a; --basil-soft: #1f3a21;
    --oven: #120d0b; --on-tomato: #1b1411; --warn-bg: #3a2f1a; --warn-ink: #f0d49a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --flour: #1b1411; --dough: #261c17; --dough-deep: #33251e; --crust: #f6ead9; --crust-soft: #e3d2bf; --muted: #c3ae98;
  --rule: #3d2e26; --rule-strong: #5a4436; --tomato: #ff7b5c; --tomato-soft: #4a2219; --basil: #86cf8a; --basil-soft: #1f3a21;
  --oven: #120d0b; --on-tomato: #1b1411; --warn-bg: #3a2f1a; --warn-ink: #f0d49a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--flour);
  color: var(--crust);
  font: 1.0625rem/1.6 var(--body);
  overflow-wrap: break-word;
}
::selection { background: var(--tomato); color: var(--on-tomato); }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
a { color: var(--tomato); text-decoration-thickness: 2px; text-decoration-color: var(--tomato-soft); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 3px; border-radius: 4px; }
button, input, textarea { font: inherit; color: inherit; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 10; padding: .5rem .9rem; border-radius: 999px; background: var(--tomato); color: var(--on-tomato); font-weight: 700; }
.skip:focus { top: .75rem; }
.wrap { width: min(100% - 2 * var(--gutter), 74rem); margin-inline: auto; }
output, .timer, .formula .num { font-variant-numeric: tabular-nums; }

/* Header: the oven, with a tablecloth hem ----------------------------------------- */
.top { background: var(--oven); color: var(--oven-ink); }
.top::after {
  content: ""; display: block; height: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(192, 51, 27, .9) 0 10px, transparent 10px 20px),
    repeating-linear-gradient(0deg, rgba(192, 51, 27, .55) 0 5px, #fffdf8 5px 10px);
}
.top__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; padding-block: .85rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--oven-ink); text-decoration: none; font: 600 1.2rem/1 var(--display); }
.brand svg { flex: none; width: 2.1rem; height: 2.1rem; }
.top__nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; font-size: .9375rem; }
.top__nav a, .top .linkish { color: var(--oven-muted); text-decoration: none; }
.top__nav a:hover, .top .linkish:hover { color: var(--oven-ink); }
.top .linkish { padding: .35rem .85rem; border: 1px solid rgba(246, 234, 217, .3); border-radius: 999px; }

.linkish { padding: .25rem 0; border: 0; background: none; color: var(--tomato); font-size: .9375rem; text-decoration: underline; text-decoration-color: var(--tomato-soft); text-decoration-thickness: 2px; text-underline-offset: .2em; cursor: pointer; }
.linkish:hover { text-decoration-color: currentColor; }

/* Intro ---------------------------------------------------------------------------- */
.intro { display: grid; gap: .9rem; padding-block: clamp(2rem, 6vw, 3.25rem) clamp(1.5rem, 4vw, 2.25rem); }
.intro h1 { font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.4rem); font-weight: 600; letter-spacing: -.01em; }
.intro h1 span { color: var(--tomato); }
.intro__lede { max-width: 38rem; font-size: clamp(1.1rem, 1rem + .4vw, 1.25rem); color: var(--crust-soft); }
.notice { padding: 1rem 1.25rem; border-radius: var(--radius-sm); background: var(--tomato-soft); }

/* Settings and the live recipe, as two cards ---------------------------------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-bottom: clamp(2rem, 5vw, 3rem); align-items: start; }
@media (min-width: 60rem) {
  .layout { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 2rem; }
  .jump { display: none; }
}
.settings, .recipe, .panel { background: var(--dough); border-radius: var(--radius); box-shadow: var(--shadow); }

.settings { display: grid; gap: 0; align-content: start; padding: .5rem 1.25rem 1.25rem; }
.field { margin: 0; padding: 1.1rem 0; border: 0; border-bottom: 1px dashed var(--rule-strong); min-width: 0; }
.field:last-of-type { border-bottom: 0; }
.field > legend, .legend { display: flex; align-items: center; float: left; width: 100%; margin-bottom: .75rem; padding: 0; font: 600 1.15rem/1.2 var(--display); }
.field > legend + * { clear: both; }
.legend--split { justify-content: space-between; }
.legend--split label { display: inline-flex; align-items: center; }
.n {
  display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; margin-right: .55rem;
  border-radius: 50%; background: var(--tomato); color: var(--on-tomato); font: 600 .8rem/1 var(--display);
}
.optional { margin-left: .5rem; padding: .1rem .5rem; border-radius: 999px; background: var(--dough-deep); color: var(--muted); font: 700 .7rem/1.4 var(--body); text-transform: uppercase; letter-spacing: .04em; }
.hint { clear: both; margin-top: .55rem; color: var(--muted); font-size: .875rem; line-height: 1.5; }
output { padding: .15rem .6rem; border-radius: 999px; background: var(--tomato-soft); color: var(--crust); font: 600 .95rem/1.4 var(--display); }

/* Style: four rounded tiles. Oven and schedule: pill toggles. */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.option { position: relative; display: flex; flex-direction: column; padding: .75rem .85rem; border: 2px solid var(--rule); border-radius: var(--radius-sm); background: var(--dough); cursor: pointer; transition: border-color .15s, background-color .15s; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option__name { display: block; padding-right: 1rem; font: 600 1rem/1.25 var(--display); }
.option__desc { display: block; margin-top: .2rem; color: var(--muted); font-size: .825rem; line-height: 1.4; }
.option:hover { border-color: var(--rule-strong); }
.option:has(input:checked) { border-color: var(--tomato); background: var(--tomato-soft); }
.option:has(input:checked) .option__desc { color: var(--crust-soft); }
.option:has(input:checked)::after { content: "✓"; position: absolute; top: .5rem; right: .65rem; color: var(--tomato); font: 700 .85rem/1 var(--display); }
.option:has(input:focus-visible) { outline: 3px solid var(--tomato); outline-offset: 2px; }

.options--2, .options--3 { display: flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: var(--dough-deep); }
.options--2 .option, .options--3 .option { flex: 1; align-items: center; padding: .45rem .5rem; border: 0; border-radius: 999px; background: transparent; text-align: center; }
.options--2 .option__name, .options--3 .option__name { padding-right: 0; }
.options--2 .option__desc, .options--3 .option__desc { margin-top: 0; font-size: .75rem; }
.options--2 .option:has(input:checked), .options--3 .option:has(input:checked) { background: var(--tomato); color: var(--on-tomato); box-shadow: 0 2px 6px rgba(192, 51, 27, .25); }
.options--2 .option:has(input:checked) .option__desc, .options--3 .option:has(input:checked) .option__desc { color: var(--on-tomato); }
.options--2 .option:has(input:checked)::after, .options--3 .option:has(input:checked)::after { content: none; }
@media (max-width: 22rem) { .options { grid-template-columns: 1fr; } }

.stepper { display: inline-grid; grid-template-columns: 2.75rem 3.75rem 2.75rem; align-items: center; padding: .2rem; border-radius: 999px; background: var(--dough-deep); }
.stepper button { width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--dough); box-shadow: 0 1px 3px rgba(58, 36, 22, .15); font: 600 1.35rem/1 var(--display); cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--tomato); color: var(--on-tomato); }
.stepper button:disabled { color: var(--rule-strong); box-shadow: none; cursor: default; }
.stepper input { width: 100%; border: 0; background: transparent; text-align: center; font: 600 1.4rem/1 var(--display); -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

input[type="range"] { width: 100%; height: 2rem; margin: 0; background: transparent; accent-color: var(--tomato); cursor: pointer; }

.inline-field { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.inline-field label { font-size: .9375rem; }
.with-unit { display: inline-flex; align-items: center; border: 2px solid var(--rule); border-radius: 999px; background: var(--dough); }
.with-unit:focus-within { border-color: var(--tomato); }
.with-unit input { width: 4.25rem; padding: .4rem .25rem .4rem .75rem; border: 0; background: transparent; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.with-unit input::-webkit-inner-spin-button { -webkit-appearance: none; }
.with-unit input:focus-visible { outline: none; }
.with-unit span { padding-right: .8rem; color: var(--muted); font-size: .875rem; }
.check { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; font-weight: 700; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--basil); }
.jump { padding-top: 1rem; font-weight: 700; }

/* Recipe card ------------------------------------------------------------------------ */
.recipe { min-width: 0; overflow: hidden; outline: none; }
.recipe__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; padding: 1.4rem clamp(1.25rem, 3vw, 2rem) 1.25rem; background: var(--tomato); color: var(--on-tomato); }
.kicker { font: 800 .75rem/1 var(--body); letter-spacing: .08em; text-transform: uppercase; }
.recipe h2 { margin-top: .35rem; font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem); }
.recipe__meta { margin-top: .35rem; font-size: .875rem; }
.units { display: inline-flex; padding: .2rem; border-radius: 999px; background: rgba(0, 0, 0, .2); }
.units button { padding: .4rem .85rem; border: 0; border-radius: 999px; background: none; color: inherit; font-size: .875rem; font-weight: 800; cursor: pointer; }
.units button[aria-pressed="true"] { background: var(--dough); color: var(--crust); }
.units button:focus-visible { outline-color: var(--dough); }

#formula, .recipe > .warning, .recipe__sub, .steps, .recipe .actions, .status, .notes { margin-inline: clamp(1.25rem, 3vw, 2rem); }
.formula { width: 100%; border-collapse: collapse; margin-top: .75rem; }
.formula caption { padding: .6rem 0 .4rem; text-align: left; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.formula th, .formula td { padding: .55rem .25rem; border-bottom: 1px dashed var(--rule-strong); text-align: left; vertical-align: baseline; }
.formula thead th { padding-block: .35rem; border-bottom: 2px solid var(--rule-strong); color: var(--muted); font-size: .8125rem; font-weight: 800; }
.formula tbody th { font: 500 1.15rem/1.3 var(--display); }
.formula .num { text-align: right; white-space: nowrap; }
.formula tbody td.num:first-of-type { font: 600 1.35rem/1.2 var(--display); color: var(--crust); }
.formula td.num:last-child { width: 6rem; color: var(--basil); font-weight: 800; font-size: .9375rem; }
.formula .g { display: block; color: var(--muted); font: 400 .75rem/1.3 var(--body); }
.formula abbr { text-decoration: none; cursor: help; }
.formula tfoot th, .formula tfoot td { border-bottom: 0; padding-block: .4rem; color: var(--crust-soft); font: 700 .9375rem/1.4 var(--body); }
.formula tfoot tr:first-child th, .formula tfoot tr:first-child td { padding-top: .7rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 2rem; margin-top: 1rem; padding: .25rem 1rem 1rem; border-radius: var(--radius-sm); background: var(--dough-deep); }
.split .formula td.num:last-child, .split .formula thead th:last-child { display: none; }

.warning { margin-top: 1.25rem; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-ink); font-size: .95rem; }

.recipe__sub { margin-top: 2rem; font-size: 1.5rem; }
.steps { padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: .9rem; padding-block: 1rem; border-bottom: 1px dashed var(--rule-strong); }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 50%; background: var(--basil-soft); color: var(--basil); font: 600 1rem/1 var(--display);
}
.steps h4 { padding-top: .35rem; font-size: 1.15rem; }
.steps p { margin-top: .3rem; max-width: 42rem; color: var(--crust-soft); }
.steps strong { color: var(--crust); font-weight: 800; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .55rem 1.15rem; border: 2px solid var(--tomato); border-radius: 999px; background: var(--tomato); color: var(--on-tomato); font-weight: 800; font-size: .9375rem; text-decoration: none; cursor: pointer; transition: transform .1s; }
.button:hover:not(:disabled) { filter: brightness(1.08); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button--quiet, .recipe .actions .button { background: transparent; color: var(--tomato); }
.button--quiet:hover:not(:disabled), .recipe .actions .button:hover { background: var(--tomato-soft); filter: none; }
.button:disabled { opacity: .45; cursor: default; }
.status { min-height: 1.5rem; margin-top: .6rem; color: var(--crust-soft); font-size: .875rem; }

.notes { margin-top: .75rem; margin-bottom: 1.5rem; padding: 1rem; border-radius: var(--radius-sm); background: var(--dough-deep); }
.notes label, .save label { display: block; margin-bottom: .4rem; font-weight: 800; font-size: .9375rem; }
textarea, .save input { width: 100%; padding: .65rem .8rem; border: 2px solid var(--rule); border-radius: var(--radius-sm); background: var(--dough); line-height: 1.5; resize: vertical; }
textarea:focus-visible, .save input:focus-visible { outline: none; border-color: var(--tomato); }

/* Saved recipes and timer ------------------------------------------------------------ */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.5rem 2rem; padding-bottom: clamp(2rem, 5vw, 3rem); }
.panel { padding: 1.4rem clamp(1.25rem, 3vw, 1.75rem); }
.panel h2 { margin-bottom: .9rem; font-size: 1.5rem; }
.save__row { display: flex; gap: .5rem; }
.save__row input { flex: 1; min-width: 0; border-radius: 999px; padding-inline: 1rem; }
.saved { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.saved li { display: flex; align-items: center; gap: 1rem; padding: .2rem .9rem; border-radius: var(--radius-sm); background: var(--dough-deep); }
.saved__load { flex: 1; min-width: 0; padding: .5rem 0; border: 0; background: none; text-align: left; cursor: pointer; }
.saved__load:hover .saved__name { color: var(--tomato); }
.saved__name { display: block; font: 600 1.05rem/1.3 var(--display); }
.saved__meta { display: block; color: var(--muted); font-size: .8125rem; }
.saved__delete { flex: none; font-size: .875rem; }
#saved-empty { margin-top: 1rem; }

.timer { display: inline-block; padding: .35rem 1.1rem; border-radius: var(--radius-sm); background: var(--oven); color: var(--cheese); font: 600 clamp(2.1rem, 1.7rem + 2vw, 2.8rem)/1.15 var(--display); letter-spacing: .03em; }
.timer-custom { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.timer-custom .with-unit input { width: 3.25rem; }

/* Notes from the kitchen ---------------------------------------------------------------- */
.reference { padding-bottom: clamp(3rem, 7vw, 4.5rem); }
.reference h2 { margin-bottom: 1rem; font-size: 1.75rem; }
.reference__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: .75rem 1.25rem; align-items: start; }
.reference details { padding: 0 1.25rem; border-radius: var(--radius-sm); background: var(--dough); box-shadow: var(--shadow); }
.reference summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1rem; font: 600 1.15rem/1.3 var(--display); cursor: pointer; list-style: none; }
.reference summary::-webkit-details-marker { display: none; }
.reference summary::after { content: "+"; display: grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--tomato-soft); color: var(--tomato); font: 600 1.1rem/1 var(--display); }
.reference details[open] summary::after { content: "–"; }
.reference summary:hover { color: var(--tomato); }
.reference dl { margin: 0 0 1.25rem; }
.reference dt { margin-top: .75rem; font-weight: 800; }
.reference dd { margin: .1rem 0 0; color: var(--crust-soft); }

/* Footer --------------------------------------------------------------------------------- */
.foot { background: var(--oven); color: var(--oven-muted); font-size: .9375rem; }
.foot__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; padding-block: 1.75rem 2.25rem; }
.foot ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.foot a { color: var(--oven-ink); text-decoration-color: rgba(246, 234, 217, .35); }

/* Print: just the recipe, in black on white. ----------------------------------------------- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .top, .intro__lede, .settings, .tools, .reference, .foot, .skip, .units, .actions, .status, .notes:not(:has(textarea:not(:placeholder-shown))), noscript { display: none !important; }
  .layout { display: block; padding: 0; }
  .intro { padding: 0 0 .5rem; }
  .intro h1 { font-size: 14pt; }
  .recipe { box-shadow: none; border-radius: 0; }
  .recipe__head { padding: 0 0 .5rem; background: none; color: #000; }
  #formula, .recipe > .warning, .recipe__sub, .steps, .notes { margin-inline: 0; }
  .steps li { break-inside: avoid; }
  a { text-decoration: none; }
  :root { --crust: #000; --crust-soft: #222; --muted: #555; --rule: #bbb; --rule-strong: #888; --tomato: #000; --basil: #000; --basil-soft: #eee; --dough: #fff; --dough-deep: #fff; --flour: #fff; --shadow: none; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

@media (forced-colors: active) {
  .units button[aria-pressed="true"], .options--2 .option:has(input:checked), .options--3 .option:has(input:checked) { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .option:has(input:checked) { outline: 2px solid Highlight; }
  .n, .steps li::before { forced-color-adjust: none; border: 1px solid CanvasText; }
}
