/* Impasto – palette inspired by Italian flour-mill recipe pages: red, cream, wheat gold. */
:root {
  --red: #C1252F;
  --red-dark: #9E1B24;
  --gold: #D0B589;
  --gold-2: #D7B56A;
  --green: #317F2E;
  --bg: #FFFCF7;
  --surface: #FFFFFF;
  --panel: #F3F3F3;
  --text: #141414;
  --muted: #6F6A62;
  --line: #E8E1D3;
  --warn-bg: #FDF1E4;
  --warn-text: #8A4B07;
  --error-bg: #FBE4E5;
  --error-text: #8E1720;
  --info-bg: #E8F0F2;
  --info-line: #7FA3AD;
  --dough: #F3E3C3;
  --dough-hi: #FBF3E2;
  --shadow: rgba(80, 55, 20, .12);
  --flour-dust: #E9DCC0;
  --focus: #C1252F;
  --radius: 14px;
  --font: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #E04B54; --red-dark: #F06A72; --gold: #C9AE80; --gold-2: #D7B56A; --green: #6CBF68;
    --bg: #17130F; --surface: #211C17; --panel: #2A241E; --text: #F4EDE2; --muted: #B3A895;
    --line: #3A3229; --warn-bg: #3A2A15; --warn-text: #F2C38B; --error-bg: #3E1A1C; --error-text: #FFB3B8; --info-bg: #1E2A2D; --info-line: #5E8691;
    --dough: #CDB68C; --dough-hi: #E2D0AE; --shadow: rgba(0, 0, 0, .35); --flour-dust: #5A4E3D; --focus: #F06A72;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red: #E04B54; --red-dark: #F06A72; --gold: #C9AE80; --gold-2: #D7B56A; --green: #6CBF68;
  --bg: #17130F; --surface: #211C17; --panel: #2A241E; --text: #F4EDE2; --muted: #B3A895;
  --line: #3A3229; --warn-bg: #3A2A15; --warn-text: #F2C38B; --error-bg: #3E1A1C; --error-text: #FFB3B8; --info-bg: #1E2A2D; --info-line: #5E8691;
  --dough: #CDB68C; --dough-hi: #E2D0AE; --shadow: rgba(0, 0, 0, .35); --flour-dust: #5A4E3D; --focus: #F06A72;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; margin: 0; }
a { color: var(--red); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--red); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 22px; letter-spacing: .5px; text-transform: uppercase; color: var(--red); }
.brand-name.small { font-size: 18px; }
.brand-sub { font-size: 13px; color: var(--muted); letter-spacing: .3px; }
.main-nav { display: flex; gap: 24px; margin-left: auto; }
.main-nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; text-transform: uppercase; letter-spacing: 1px; }
.main-nav a:hover { color: var(--red); }
.lang { display: flex; gap: 2px; }
.lang-btn {
  border: 0; background: none; padding: 6px 8px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--muted); letter-spacing: 1px; border-bottom: 2px solid transparent;
}
.lang-btn.active { color: var(--red); border-bottom-color: var(--red); }

/* Hero */
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; padding-top: 48px; padding-bottom: 40px; }
.hero-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.kicker { margin: 0; color: var(--red); font-weight: 600; text-transform: uppercase; letter-spacing: 2px; font-size: 14px; }
.recipe-select select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 30px 4px 14px; font-size: 14px;
}
.hero h1 { font-size: clamp(32px, 5vw, 56px); font-weight: 700; letter-spacing: -1px; }
.hero h1::after { content: ''; display: block; width: 72px; height: 4px; background: var(--red); margin-top: 16px; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 16px 0 24px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 0; }
.hero-facts dt { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.hero-facts dd { margin: 0; font-size: 26px; font-weight: 700; }
.hero-art svg { width: 100%; max-width: 380px; display: block; margin-left: auto; }

/* Calculator layout */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; padding-top: 32px; padding-bottom: 48px; align-items: start; }
.calc-main { display: grid; gap: 20px; min-width: 0; }
.side-sticky { position: sticky; top: 88px; display: grid; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 1px 2px var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.card-title .num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff;
  display: inline-grid; place-items: center; font-size: 16px; flex: none;
}
.help { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
small.help { display: block; margin: 4px 0 0; font-size: 12.5px; }
.notice { background: var(--warn-bg); color: var(--warn-text); padding: 10px 14px; border-radius: 10px; font-size: 14px; margin: 8px 0; border-left: 4px solid var(--gold-2); }
.notice.error { background: var(--error-bg); color: var(--error-text); border-left-color: var(--red); font-weight: 500; }
.notice.info { background: var(--info-bg); color: var(--text); border-left-color: var(--info-line); }
.water-big strong.impossible { text-decoration: line-through; text-decoration-thickness: 2px; }
.label, .field > span, .label-row { font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

/* Balls */
.balls-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: center; margin: 16px 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.big-out { font-size: 30px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; }
.range-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--red); height: 28px; cursor: pointer; }
input[type="range"]:disabled { opacity: .35; cursor: default; }
.wheel-field { text-align: center; }
.wheel-wrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.wheel {
  position: relative; width: 84px; height: 132px; overflow-y: scroll; scroll-snap-type: y mandatory;
  padding: 44px 0; border-radius: 12px; background: var(--panel); scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  overscroll-behavior: contain; cursor: ns-resize;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 44px; line-height: 44px; text-align: center; scroll-snap-align: center;
  font-size: 22px; color: var(--muted); transition: color .15s, font-size .15s; user-select: none;
}
.wheel-item.sel { color: var(--red); font-size: 32px; font-weight: 700; }
.wheel-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.wheel-btn:hover { border-color: var(--red); color: var(--red); }
.total-line {
  display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; margin-bottom: 12px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.total-line span { text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }
.total-line strong { font-size: 30px; color: var(--red); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch-ui::after { content: ''; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch-ui { background: var(--green); }
.switch input:checked + .switch-ui::after { left: 21px; }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Flours */
.flour-rows { display: grid; gap: 10px; margin: 12px 0; }
.flour-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.flour-row.extra { border-style: dashed; }
.flour-row-main { display: grid; grid-template-columns: minmax(0, 1fr) auto 80px auto auto; gap: 8px; align-items: center; }
.flour-select, .field input, .field select, .pct-input, .grams-input {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.flour-select { width: 100%; }
.flour-pct { display: flex; align-items: center; gap: 4px; }
.pct-input { width: 76px; text-align: right; }
.grams-input { width: 86px; text-align: right; font-weight: 600; }
.grams-input[readonly] { background: var(--panel); color: var(--muted); }
.flour-grams { font-weight: 700; text-align: right; }
.unit { color: var(--muted); font-size: 14px; }
.icon-btn { width: 32px; height: 32px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 18px; }
.icon-btn:hover { background: var(--panel); color: var(--red); }
.flour-row-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.tag { background: var(--panel); border-radius: 999px; padding: 1px 10px; font-size: 12px; }
.tag-extra { background: none; border: 1px dashed var(--gold); }
.tag-type { background: var(--gold); color: #3b2c10; }
.warn { color: var(--warn-text); font-weight: 500; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.flour-stats { font-size: 14px; color: var(--muted); margin: 12px 0 0; }

/* Ingredients */
.ing-rows { display: grid; gap: 4px; }
.ing-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ing-row:last-child { border-bottom: 0; }
.ing-row.off .ing-vals, .ing-row.off .help { opacity: .45; }
.ing-row .help { margin: 0; font-size: 13px; }
.ing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ing-name { font-weight: 600; font-size: 18px; }
.ing-vals { display: flex; align-items: center; gap: 6px; }
.pct-fixed { width: 76px; text-align: right; font-weight: 600; padding-right: 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--red); width: 18px; height: 18px; }

/* Temperature */
.temp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 12px 0 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.small > span { font-size: 12.5px; }
.field input { width: 100%; }
.water-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 16px 20px; border-radius: 12px;
  background: linear-gradient(135deg, var(--panel), var(--bg));
}
.water-big { display: flex; flex-direction: column; }
.water-big strong { font-size: 40px; color: var(--red); line-height: 1.1; }
.formula { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); }

/* Recipe table (sidebar) */
.recipe-card { border-top: 4px solid var(--red); }
.side-title { font-size: 26px; }
.side-sub { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.recipe-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.recipe-table th, .recipe-table td { padding: 7px 4px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 400; }
.recipe-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 500; }
.recipe-table tbody th { font-weight: 500; }
.recipe-table .num { text-align: right; white-space: nowrap; }
.recipe-table td.num:last-child { font-weight: 700; }
.recipe-table tr.flour th { padding-left: 4px; }
.recipe-table tr.subtotal th, .recipe-table tr.subtotal td { color: var(--muted); font-style: italic; }
.recipe-table tr.extra th::before { content: '+ '; color: var(--gold); }
.recipe-table tfoot th, .recipe-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--text); font-size: 18px; }
.save-actions { display: grid; gap: 8px; margin-top: 18px; }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; text-align: center; }
.clock-card { display: grid; gap: 2px; text-align: center; border-top: 4px solid var(--green); }
.clock-card strong { font-size: 36px; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border-radius: 999px; padding: 10px 20px; font-weight: 600; font-size: 15px; letter-spacing: .5px;
  border: 1px solid transparent; text-decoration: none; transition: background .15s, color .15s, transform .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border-color: var(--red); color: var(--red); }
.btn-ghost:hover { background: var(--red); color: #fff; }
.btn-link { background: none; border: 0; padding: 4px 0; color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: wait; }
.danger { color: var(--red); }
.timer-btn.running { background: var(--green); border-color: var(--green); color: #fff; }
.bounce { animation: bounce .7s; }
@keyframes bounce { 0%, 100% { transform: none; } 30% { transform: scale(1.06) rotate(-2deg); } 60% { transform: scale(.98) rotate(1deg); } }

/* Proceedings */
.method { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 56px 0; }
.section-title { font-size: clamp(30px, 4vw, 42px); font-weight: 700; margin-bottom: 28px; }
.section-title::after { content: ''; display: block; width: 56px; height: 4px; background: var(--red); margin-top: 12px; }
.need h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.need-list { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.need-list li { display: flex; flex-direction: column; padding: 14px 16px; background: var(--bg); border-radius: 12px; border-left: 3px solid var(--gold-2); }
.need-list strong { font-size: 24px; }
.need-list span { color: var(--muted); font-size: 15px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 4px; max-width: 860px; }
.step { counter-increment: step; position: relative; padding: 18px 0 18px 64px; border-bottom: 1px solid var(--line); }
.step::before {
  content: counter(step); position: absolute; left: 0; top: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--red); color: var(--red); display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.step h3 { font-size: 20px; margin-bottom: 4px; }
.step p { margin: 0; }
.step .v { color: var(--red); white-space: nowrap; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.timer-out { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }

/* Coming soon */
.soon { padding: 56px 0; }
.soon-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.soon-card { background: var(--surface); border: 1px dashed var(--gold); border-radius: var(--radius); padding: 24px; }
.soon-ico { font-size: 28px; }
.soon-card h3 { font-size: 20px; margin: 8px 0; }
.soon-card p { margin: 0; color: var(--muted); }

/* Footer */
.site-footer { background: var(--red); color: #fff; padding: 28px 0; }
.site-footer .brand-name { color: #fff; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.footer-inner p { margin: 0; opacity: .9; font-size: 14px; }

/* Dialogs */
.dialog {
  border: 0; border-radius: 18px; padding: 28px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialog::backdrop { background: rgba(20, 14, 8, .55); }
.dialog h2 { font-size: 26px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span2 { grid-column: span 2; }
.form-grid .help { margin: -6px 0 0; }
.form-grid em { text-transform: none; font-style: normal; opacity: .7; }
.save-to { border: 1px solid var(--line); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 14px; margin: 0; }
.save-to legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.save-to:disabled { opacity: .55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.wrap-actions { justify-content: flex-start; }
.wrap-actions #saves-close { margin-left: auto; }
.file-btn { cursor: pointer; }
.saves-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.saves-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--bg); border-radius: 12px; }
.saves-list li.empty { color: var(--muted); display: block; }
.save-info { display: flex; flex-direction: column; }
.save-info .help { margin: 0; }
.save-btns { display: flex; gap: 6px; align-items: center; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 500;
  transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); color: #fff; }

/* Responsive */
@media (max-width: 1000px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .side-sticky { position: static; }
  .calc-side { order: -1; }
  .recipe-card .note { text-align: left; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .main-nav { display: none; }
  .lang { margin-left: auto; }
  .brand-sub { display: none; }
  .hero-inner { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-art { display: none; }
  .card { padding: 18px 16px; }
  .balls-grid { grid-template-columns: 1fr; }
  .wheel-wrap { justify-content: center; }
  .flour-row-main { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .flour-row-main .flour-select { grid-column: 1 / -1; }
  .temp-grid { grid-template-columns: 1fr 1fr; }
  .soon-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .step { padding-left: 54px; }
  .step::before { width: 38px; height: 38px; font-size: 16px; }
  .dialog { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
