:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f1ea;
  --ink: #1b1714;
  --muted: #6b6158;
  --line: #e7ddcf;
  --tomato: #d63a21;
  --tomato-ink: #ffffff;
  --basil: #2e7d4f;
  --crust: #c98a3c;
  --warn-bg: #fff3dc;
  --warn-ink: #7a4b00;
  --recipe-bg: #c8341d;
  --recipe-ink: #ffffff;
  --recipe-muted: #ffe9e4;
  --recipe-line: rgba(255, 255, 255, 0.3);
  --basil-btn: #2e7d4f;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(27, 23, 20, 0.04), 0 12px 32px -12px rgba(27, 23, 20, 0.18);
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

/* Tema scuro: solo su scelta esplicita (pulsante nell'header) */
:root[data-theme='dark'] {
  --bg: #12100e;
  --surface: #1b1815;
  --surface-2: #24201c;
  --ink: #f3ece2;
  --muted: #a99d90;
  --line: #2f2924;
  --tomato: #ff5b3d;
  --tomato-ink: #1b0b06;
  --basil: #5cc28a;
  --crust: #e0a55c;
  --warn-bg: #2d2211;
  --warn-ink: #f3c77a;
  --recipe-bg: #a92b17;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--tomato); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.prose { max-width: 72ch; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 22px/1 var(--display); letter-spacing: -0.02em; white-space: nowrap; }
.logo svg { width: 30px; height: 30px; flex-shrink: 0; }
.nav { display: flex; align-items: center; gap: 4px; }
.theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; margin-left: 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun, :root[data-theme='dark'] .theme-toggle .moon { display: none; }
:root[data-theme='dark'] .theme-toggle .sun { display: block; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; padding: 8px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--ink); background: var(--surface-2); }
@media (max-width: 640px) {
  .nav a { padding: 8px; font-size: 14px; }
  .nav .hide-sm { display: none; }
}
@media (max-width: 400px) {
  .nav .hide-xs { display: none; }
  .site-header .wrap { gap: 8px; }
  .logo { font-size: 16px; gap: 8px; }
  .logo svg { width: 26px; height: 26px; }
  .nav a { padding: 8px 6px; }
}
@media (max-width: 360px) {
  .logo svg { display: none; }
}

/* Hero */
.hero { padding: 56px 0 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--basil); }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--basil); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(38px, 6.2vw, 76px); font-variation-settings: 'opsz' 144; }
h1 em, h2 em { font-style: italic; color: var(--tomato); font-weight: 500; }
h2 { font-size: clamp(28px, 3.6vw, 44px); margin-top: 1.6em; }
h3 { font-size: 22px; margin-top: 1.4em; }
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--muted); max-width: 60ch; margin: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }

/* Calcolatore */
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 32px; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form { padding: 8px 24px 24px; }
.step { padding: 20px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-title { display: flex; align-items: baseline; gap: 10px; font: 600 13px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.step-title b { font: 600 20px/1 var(--display); color: var(--tomato); letter-spacing: 0; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 14px; }
@media (max-width: 520px) { .seg { grid-template-columns: repeat(2, 1fr); } }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: grid; place-items: center; text-align: center; min-height: 44px; padding: 6px 8px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg input:focus-visible + label { outline: 3px solid var(--tomato); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
/* Temperature strette, infornata larga: data e ora devono leggersi per intero. */
.grid-bake { grid-template-columns: 1fr 1fr 2fr; }
@media (max-width: 520px) { .grid-bake { grid-template-columns: 1fr 1fr; } .grid-bake > :last-child { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 500; }
.field small { color: var(--muted); font-size: 13px; }
input[type='number'], input[type='datetime-local'], select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: 500 16px/1.2 var(--sans); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
input:focus, select:focus { border-color: var(--tomato); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tomato) 20%, transparent); }

.stepper { display: grid; grid-template-columns: 46px 1fr 46px; }
.stepper button { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 20px; cursor: pointer; }
.stepper button:first-child { border-radius: 12px 0 0 12px; }
.stepper button:last-child { border-radius: 0 12px 12px 0; }
.stepper input { border-radius: 0; text-align: center; border-inline: 0; }

.range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.range output { font: 600 20px/1 var(--display); min-width: 3.2ch; text-align: right; }
input[type='range'] { width: 100%; accent-color: var(--tomato); height: 28px; }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; font-size: 15px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--tomato); }

.specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.chip b { font-weight: 700; }
.chip.ok { color: var(--basil); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preset { font: 600 14px/1 var(--sans); padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.preset[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Ricetta */
.recipe { position: sticky; top: 84px; background: var(--recipe-bg); color: var(--recipe-ink); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); overflow: hidden; }
@media (max-width: 900px) { .recipe { position: static; } }
.recipe h2 { font-size: 26px; margin: 0 0 4px; color: var(--recipe-ink); }
.recipe .sub { color: var(--recipe-muted); font-size: 14px; margin: 0 0 18px; }
.ing { list-style: none; margin: 0; padding: 0; }
.ing li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--recipe-line); }
.ing .name { font-weight: 600; }
.ing .name small { display: block; font-weight: 400; color: var(--recipe-muted); font-size: 13px; }
.ing .qty { font: 600 30px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ing .qty span { font: 500 15px var(--sans); color: var(--recipe-muted); margin-left: 3px; }
.ing li.total { border-bottom: 0; color: var(--recipe-muted); }
.ing li.total .qty { font-size: 20px; color: var(--recipe-muted); }
.warns { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.warns li { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; }
.timeline { list-style: none; margin: 20px 0 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--recipe-line); }
.timeline li { position: relative; padding: 0 0 14px 30px; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--recipe-bg); border: 2px solid var(--recipe-muted); }
.timeline li:last-child::before { background: var(--basil-btn); border-color: #ffffff; }
.timeline time { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline span { color: var(--recipe-muted); font-size: 14px; }
.actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px; font: 600 15px/1 var(--sans); cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn-basil { background: var(--basil-btn); color: #ffffff; }
.btn-basil:hover { background: #256a42; }
.btn-light { background: var(--ink); color: var(--bg); }

/* Contenuti */
section.content { padding: 24px 0 48px; }
.answer { font-size: 19px; line-height: 1.6; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--tomato); border-radius: 12px; padding: 18px 20px; margin: 0 0 24px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin: 16px 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; }
caption { caption-side: bottom; text-align: left; padding: 10px 14px; color: var(--muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 16px 0; }
.tile { display: block; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; transition: transform 0.15s, border-color 0.15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--crust); }
.tile .brand { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tile h3 { margin: 4px 0 10px; font-size: 21px; }
.tile .specs { margin-top: 0; }

/* Shop */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 16px 0 32px; }
.product { display: flex; flex-direction: column; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.product-art { display: grid; place-items: center; height: 144px; margin: -4px -4px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink); }
.product-art svg { width: 124px; height: 124px; }
.product .brand { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.product h3 { margin: 4px 0 10px; font-size: 19px; }
.product .specs { margin: 0 0 16px; }
.product-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.product-link { font-size: 14px; font-weight: 600; }
.btn-amazon { background: #ffd814; color: #0f1111; min-height: 40px; padding: 8px 16px; font-size: 14px; white-space: nowrap; }
.btn-amazon:hover { background: #f7ca00; }
a.preset { text-decoration: none; display: inline-flex; }
[id] { scroll-margin-top: 84px; }
.buy { margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--recipe-line); border-radius: 12px; font-size: 14px; color: var(--recipe-muted); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.buy b { color: var(--recipe-ink); }
.buy a { color: var(--recipe-ink); font-weight: 600; }
.buy a.buy-all { color: var(--recipe-muted); font-weight: 500; margin-left: auto; }

.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; list-style: none; font: 600 19px/1.35 var(--display); padding: 14px 32px 14px 0; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 10px; font: 400 26px/1 var(--sans); color: var(--tomato); }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

.cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px; border-radius: var(--radius); background: var(--surface-2); margin: 24px 0; }
.cta p { margin: 0; font: 600 20px/1.3 var(--display); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.note { font-size: 14px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: grid; gap: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.consent { position: fixed; z-index: 50; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin-inline: auto; display: grid; gap: 12px; padding: 16px 18px; border-radius: 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); font-size: 14px; }
.consent[hidden] { display: none; }
.consent p { margin: 0; }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media print {
  .site-header, .form, .actions, .buy, .site-footer, .consent, section.content { display: none; }
  .calc { display: block; }
  .recipe { background: #fff; color: #000; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Le legend dei fieldset si comportano come titoli normali */
fieldset > legend { float: left; width: 100%; padding: 0; }
fieldset > legend + * { clear: both; }
