/* Degustazione Jacquesson — stile ricavato dal libretto PDF.
   Colori misurati nel PDF: fondo #F8F5ED, testo #181816, rosso #AE211C,
   grigio note #706B64, filetti #B4ADA2.
   Caratteri: Bodoni 72 e Georgia se installati sul dispositivo (Apple, Windows);
   altrimenti Bodoni Moda e Gelasio (licenza OFL), sostituti visivamente vicini. */

@font-face { font-family: 'Bodoni Moda Sostituto'; src: url('/assets/fonts/bodoni-moda.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Gelasio Sostituto'; src: url('/assets/fonts/gelasio.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Gelasio Sostituto'; src: url('/assets/fonts/gelasio-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #F8F5ED;
  --ink: #181816;
  --red: #AE211C;
  --muted: #706B64;
  --rule: #B4ADA2;
  --rule-soft: #D9D3C7;
  --ok: #3F5E3A;
  --bodoni: 'Bodoni 72', 'Bodoni Moda Sostituto', 'Bodoni MT', serif;
  --georgia: Georgia, 'Gelasio Sostituto', serif;
  --gutter: 20px;
  --nav-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--georgia); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- tipografia editoriale ---------- */
.label { font-family: var(--georgia); font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.label.red { color: var(--red); }
.muted { color: var(--muted); }
.italic { font-style: italic; }
.red { color: var(--red); }
.bodoni { font-family: var(--bodoni); font-weight: 400; }
.num { font-family: var(--bodoni); font-weight: 400; color: var(--red); line-height: .92; display: inline-block; transform: scaleX(.66); transform-origin: left center; white-space: nowrap; letter-spacing: -.01em; }
.num.center { transform-origin: center; }
h1, h2, h3 { font-weight: 400; margin: 0; }
.h-bodoni { font-family: var(--bodoni); font-weight: 400; font-size: 30px; line-height: 1.1; }
.rule { border: 0; border-top: .5px solid var(--rule); margin: 0; }
.rule-strong { border: 0; border-top: 1px solid var(--ink); margin: 0; }
p { margin: 0 0 .6em; }

/* ---------- struttura ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.page { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--nav-h) + 40px); }
.page.narrow { max-width: 640px; }
.page.head { padding-bottom: 0; }

.masthead { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px 0 12px; border-bottom: .75px solid var(--ink); }
.masthead .wm { width: 124px; color: var(--ink); text-decoration: none; }
.masthead .meta { justify-self: end; text-align: left; font-size: 12px; line-height: 1.5; }
.masthead .meta b { display: block; font-size: 11px; letter-spacing: .04em; }
@media (min-width: 700px) { .masthead { grid-template-columns: 1fr 1fr; } .masthead .wm { width: 150px; } .masthead .meta { justify-self: start; font-size: 13px; } }

.banner { margin: 16px 0 0; padding: 12px 14px; border-top: 1px solid var(--ink); border-bottom: .5px solid var(--rule); font-size: 14px; }
.banner.alert { border-top-color: var(--red); }
.banner .label { margin-bottom: 4px; }
.demo-flag { background: var(--ink); color: var(--paper); text-align: center; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 6px var(--gutter); }

/* navigazione inferiore (smartphone) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); border-top: .75px solid var(--ink);
  display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { min-height: var(--nav-h); display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none;
  font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 4px; line-height: 1.25; }
.tabbar a[aria-current="page"] { color: var(--red); box-shadow: inset 0 2px 0 var(--red); }
@media (min-width: 900px) {
  .tabbar { position: static; max-width: 1120px; margin: 0 auto; border-top: 0; border-bottom: .5px solid var(--rule); display: flex; gap: 28px; padding: 0 var(--gutter); }
  .tabbar a { min-height: 48px; justify-content: flex-start; padding: 0; }
  .tabbar a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); }
  .page { padding-bottom: 60px; }
}

/* ---------- pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); border-radius: 2px; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 11px; }
.btn.block { width: 100%; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.linkbtn { background: none; border: 0; padding: 0 4px; min-height: 44px; min-width: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ---------- copertina / benvenuto ---------- */
.cover { max-width: 620px; margin: 0 auto; padding: 36px var(--gutter) 40px; text-align: center; display: flex; flex-direction: column; min-height: 100dvh; }
.cover .welcome { font-family: var(--bodoni); font-size: 24px; margin-bottom: 26px; }
.cover .champagne { font-family: var(--bodoni); letter-spacing: .32em; font-size: clamp(13px, 3.8vw, 17px); margin-bottom: 4px; padding-left: .32em; }
.cover .wordmark { width: min(88%, 460px); margin: 0 auto; color: var(--ink); }
.cover .range { font-size: clamp(44px, 13.5vw, 76px); transform: scaleX(.8); margin-top: 8px; display: block; }
.cover .range-plus { font-family: var(--bodoni); color: var(--red); font-size: 22px; margin-top: 4px; }
.cover .subtitle { font-family: var(--bodoni); font-size: 16px; letter-spacing: .02em; line-height: 1.45; margin-top: 18px; text-transform: uppercase; }
.cover .brush { width: calc(100% + 2 * var(--gutter)); max-width: none; margin: 18px calc(-1 * var(--gutter)) 8px; aspect-ratio: 1600 / 536; }
.cover .when { text-align: left; margin-top: auto; }
.cover .when .date { color: var(--red); font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.cover .when .place { font-size: 13px; letter-spacing: .02em; margin-top: 6px; }
.cover .degustatore { display: flex; align-items: baseline; gap: 14px; margin: 26px 0 24px; text-align: left; }
.cover .degustatore .line { flex: 1; border-bottom: .5px solid var(--rule); font-family: var(--bodoni); font-size: 20px; padding-bottom: 2px; }

/* ---------- elenco bottiglie (degustazione) ---------- */
.section { margin-top: 28px; }
.section > .label { margin-bottom: 10px; }
.progress { margin-top: 18px; }
.progress .bar { height: 3px; background: var(--rule-soft); margin-top: 8px; position: relative; overflow: hidden; }
.progress .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--red); }
.progress-text { font-size: 14px; }

.blist { list-style: none; margin: 0; padding: 0; }
.bitem { border-bottom: .5px solid var(--rule); }
.bitem a { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; text-decoration: none; min-height: 76px; padding: 8px 0; }
.bitem .num { font-size: 58px; }
.bitem .bname { font-size: 15px; line-height: 1.3; }
.bitem .bsub { font-size: 13px; color: var(--muted); }
.bitem .bscore { text-align: right; font-size: 13px; min-width: 76px; }
.bitem .bscore strong { font-family: var(--bodoni); color: var(--red); font-size: 30px; font-weight: 400; display: block; line-height: 1; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tag.todo { color: var(--muted); font-style: italic; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; }
.tag.draft { color: var(--red); }

.empty { padding: 34px 0; text-align: center; }
.empty .h-bodoni { margin-bottom: 8px; }
.empty .brush-sm { width: 70%; max-width: 320px; margin: 0 auto 14px; opacity: .9; }

/* griglia a due colonne come nel PDF (schermi grandi) */
.sheet-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .sheet-grid { grid-template-columns: 1fr 1fr; }
  .sheet-grid > * { padding: 18px 28px 22px 0; border-bottom: .5px solid var(--rule); }
  .sheet-grid > *:nth-child(2n) { padding: 18px 0 22px 28px; border-left: .5px solid var(--rule); }
}

.wide-only { display: none; }
@media (min-width: 900px) { .wide-only { display: block; } .narrow-only { display: none; } }
.grid-vote { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding-top: 10px; border-top: .5px solid var(--rule); }
.grid-vote .grid-score { font-family: var(--bodoni); color: var(--red); font-size: 34px; line-height: 1; }
.grid-vote .btn { margin-left: auto; }

/* ---------- scheda bottiglia ---------- */
.card-top { display: grid; grid-template-columns: 1fr 1fr; align-items: start; padding: 18px 0 12px; border-bottom: .75px solid var(--ink); }
.card-top .num { font-size: 104px; margin-top: 2px; }
.card-top .base { padding-top: 16px; }
.card-top .base .year { font-size: 28px; margin-top: 4px; }
.card-top .base .variant-year { font-family: var(--georgia); font-size: 22px; margin-top: 4px; }
.dt-title { color: var(--red); font-weight: 700; font-size: 15px; letter-spacing: .03em; text-transform: uppercase; margin: 14px 0 0; }
.tech { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 8px; margin: 14px 0 0; font-size: 14px; }
.tech dt { font-weight: 700; font-size: 13px; padding-top: 1px; }
.tech dd { margin: 0; white-space: pre-line; }
.tech dd .sub { display: block; font-style: italic; color: var(--muted); font-size: 13px; margin-top: 2px; }
.annata { margin-top: 18px; }
.annata p:not(.label) { font-style: italic; font-size: 15px; margin-top: 6px; }
.footnote { font-style: italic; color: var(--muted); font-size: 12px; margin-top: 14px; }

.card-layout { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .card-layout { grid-template-columns: 1fr 1fr; gap: 0; } .card-layout > :first-child { padding-right: 28px; } .card-layout > :last-child { padding-left: 28px; border-left: .5px solid var(--rule); } }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 10px; padding: 12px 0; }
.pager-top { border-bottom: .5px solid var(--rule); }
.pager-bottom { border-top: .75px solid var(--ink); margin-top: 28px; padding-top: 16px; }
.pager-btn { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: 8px 14px;
  border: 1px solid var(--ink); border-radius: 2px; text-decoration: none; background: transparent; touch-action: manipulation; }
.pager-btn.next { align-items: flex-end; text-align: right; }
.pager-btn:active { background: var(--ink); color: var(--paper); }
.pager-btn:active .pager-num { color: var(--paper); }
.pager-dir { font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.pager-num { font-family: var(--bodoni); color: var(--red); font-size: 28px; line-height: 1; }
.pager-num small { display: block; font-family: var(--georgia); font-size: 11px; color: var(--muted); margin-top: 2px; }
.pager-btn.list .pager-num small { margin-top: 4px; }
.pager-pos { align-self: center; text-align: center; font-family: var(--bodoni); font-size: 22px; min-width: 44px; }
.pager-pos small { display: block; font-family: var(--georgia); font-size: 11px; color: var(--muted); }

/* ---------- voto ---------- */
.vote { margin-top: 22px; }
.vote-display { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 12px; }
.vote-display .value { font-family: var(--bodoni); color: var(--red); font-size: 64px; line-height: 1; min-width: 120px; text-align: center; }
.vote-display .value.none { color: var(--muted); font-size: 22px; font-style: italic; font-family: var(--georgia); }
.stepper { width: 64px; height: 64px; border: 1px solid var(--ink); background: transparent; border-radius: 2px; font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper:disabled { opacity: .3; cursor: default; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale button { min-height: 52px; border: .5px solid var(--rule); background: transparent; border-radius: 2px; font-size: 20px; cursor: pointer; }
.scale button[aria-pressed="true"] { border: 1.5px solid var(--red); color: var(--red); }
.scale button:last-child { color: var(--red); }
.notes { margin-top: 20px; }
.notes textarea { width: 100%; min-height: 132px; margin-top: 8px; padding: 10px 2px; border: 0; border-top: .5px solid var(--rule); border-bottom: .5px solid var(--rule);
  background: transparent; resize: vertical; font-size: 16px; line-height: 1.6; }
.notes textarea:focus { outline: none; border-bottom-color: var(--ink); }
.save-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.save-status { font-size: 14px; min-height: 22px; }
.save-status.ok { color: var(--ok); }
.save-status.err { color: var(--red); }
.save-status.draft { color: var(--red); font-style: italic; }
.conflict { margin-top: 16px; padding: 12px 0; border-top: 1px solid var(--red); border-bottom: .5px solid var(--rule); font-size: 14px; }
.conflict dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; }
.conflict dt { font-weight: 700; }
.conflict dd { margin: 0; white-space: pre-wrap; }

/* ---------- valutazioni / risultati ---------- */
.mine-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; min-height: 64px; border-bottom: .5px solid var(--rule); padding: 6px 0; }
.mine-row .score { font-family: var(--bodoni); color: var(--red); font-size: 30px; min-width: 48px; text-align: right; }
.mine-row .score.none { font-family: var(--georgia); font-style: italic; font-size: 13px; color: var(--muted); }
.podium { display: grid; gap: 0; }
.podium .pos { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: .5px solid var(--rule); }
.podium .ord { font-family: var(--bodoni); color: var(--red); font-size: 34px; line-height: 1; }
.podium .who { font-size: 17px; }
.podium .who small { display: block; color: var(--muted); font-size: 13px; }
.ranking { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.ranking th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 6px 8px 0; border-bottom: .75px solid var(--ink); }
.ranking td { padding: 10px 6px 10px 0; border-bottom: .5px solid var(--rule); vertical-align: baseline; }
.ranking td.n, .ranking th.n { text-align: right; font-variant-numeric: tabular-nums; }
.ranking .avg { font-family: var(--bodoni); color: var(--red); font-size: 22px; }

/* ---------- moduli (organizzatore) ---------- */
.field { display: grid; gap: 4px; margin-top: 12px; }
.field > span { font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.field input, .field textarea, .field select { min-height: 44px; padding: 8px 10px; border: .5px solid var(--rule); background: #FFFDF8; border-radius: 2px; font-size: 16px; }
.field textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--red); }
.admin-tabs { display: flex; gap: 20px; overflow-x: auto; border-bottom: .5px solid var(--rule); margin-top: 6px; }
.admin-tabs a { min-height: 48px; display: inline-flex; align-items: center; text-decoration: none; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.admin-tabs a[aria-current="page"] { color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 10px 0; }
.kv dt { font-weight: 700; }
.kv dd { margin: 0; }
.panel { border-top: 1px solid var(--ink); padding: 16px 0 22px; margin-top: 26px; }
.panel > h2 { font-family: var(--bodoni); font-size: 24px; margin-bottom: 6px; }
.two-col { display: grid; gap: 0 36px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.link-box { margin-top: 12px; padding: 12px; border: .5px solid var(--ink); background: #FFFDF8; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.warn { color: var(--red); font-size: 13px; white-space: pre-line; }
.person { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: .5px solid var(--rule); }
.person .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.person .name { font-size: 17px; }
.bottle-admin summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; gap: 12px; border-bottom: .5px solid var(--rule); list-style: none; }
.bottle-admin summary::-webkit-details-marker { display: none; }
.bottle-admin summary .num { font-size: 44px; width: 60px; }
.bottle-admin .form { padding: 4px 0 20px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px); z-index: 30; background: var(--ink); color: var(--paper); padding: 12px 18px; font-size: 14px; max-width: calc(100% - 32px); border-radius: 2px; }
.net { position: sticky; top: 0; z-index: 25; background: var(--ink); color: var(--paper); font-size: 13px; padding: 8px var(--gutter); text-align: center; }

/* ---------- schermo condiviso ---------- */
.screen { max-width: none; padding: 3vh 4vw; min-height: 100vh; }
.screen .masthead .wm { width: min(22vw, 300px); }
.screen .masthead .meta { font-size: clamp(14px, 1.4vw, 22px); }
.screen .big-round { display: flex; align-items: flex-end; gap: 3vw; margin-top: 3vh; }
.screen .big-round .num { font-size: clamp(90px, 16vw, 260px); }
.screen .served { display: flex; flex-wrap: wrap; gap: 2vh 5vw; margin-top: 3vh; }
.screen .served .one { display: grid; }
.screen .served .one .num { font-size: clamp(80px, 13vw, 220px); }
.screen .served .one .cap { font-size: clamp(16px, 1.6vw, 26px); }
.screen .h-bodoni { font-size: clamp(28px, 3vw, 54px); }
.screen .podium .ord { font-size: clamp(40px, 5vw, 90px); }
.screen .podium .who { font-size: clamp(20px, 2.4vw, 40px); }
.screen .podium .pos { grid-template-columns: clamp(60px, 7vw, 130px) 1fr; }
.screen .ranking { font-size: clamp(14px, 1.3vw, 22px); }

.skeleton { padding: 60px 0; text-align: center; color: var(--muted); font-style: italic; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.screen .cover { min-height: 0; padding-top: 4vh; }
.live-label { margin-top: 20px; }

/* ---------- note per la maison (stampabili) ---------- */
.notes-doc { margin-top: 24px; }
.notes-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding-bottom: 12px; border-bottom: .75px solid var(--ink); font-size: 13px; }
.notes-intro { margin: 16px 0 4px; }
.notes-bottle { padding: 16px 0 10px; border-bottom: .5px solid var(--rule); break-inside: avoid-page; }
.notes-bhead { display: grid; grid-template-columns: 90px 1fr; align-items: end; gap: 8px; }
.notes-bhead .num { font-size: 64px; }
.notes-bhead p { margin: 0; }
.notes-list { list-style: none; padding: 0; margin: 10px 0 0; }
.notes-list li { padding: 8px 0; border-top: .5px solid var(--rule-soft); break-inside: avoid; }
.notes-list li p { margin: 0 0 2px; }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; }
  .demo-flag, .admin-tabs, .masthead, .no-print, .toast, .net, .tabbar { display: none !important; }
  .page { max-width: none; padding: 0; }
  .num { color: var(--red); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Cuvée con dicitura sovrapposta (739 Dégorgement Tardif): numero grigio, scritta rossa che lo attraversa, come sull'etichetta. */
.num-dt { position: relative; display: inline-block; line-height: .92; }
.num-dt .num { color: #9C968D; }
.num-dt .dt-overlay { position: absolute; top: 50%; left: -.1em; transform: translateY(-30%); white-space: nowrap;
  font-family: var(--georgia); font-weight: 700; color: var(--red); font-size: .145em; letter-spacing: 0; line-height: 1;
  pointer-events: none; }
.bitem .num-dt { font-size: 58px; }
.card-top .num-dt { font-size: 104px; margin-top: 2px; }
.notes-bhead .num-dt { font-size: 64px; }
.bottle-admin summary .num-dt { font-size: 44px; width: 60px; }
.num-dt .num { font-size: 1em !important; }
