/* ============================================================
   Data Roast — palette frontek, un po' di registro di classe
   ============================================================ */

@font-face { font-family: "Roast Serif"; src: url("../assets/fonts/noto-serif-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Roast Serif"; src: url("../assets/fonts/noto-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Roast Serif"; src: url("../assets/fonts/noto-serif-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Roast Serif"; src: url("../assets/fonts/noto-serif-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root{
  --teal:#2A9D8F; --coral:#E76F51; --dark:#264653; --gold:#E9C46A; --red:#c0392b;

  --bg:#f4f2ea; --card:#ffffff; --line:#e4e0d4;
  --ink:#21333b; --muted:#5a6b73; --faint:#8a979c;
  --shadow:0 1px 2px rgba(38,70,83,.06), 0 6px 20px rgba(38,70,83,.06);
  --accent:#1f7a6f;
  --serif:"Roast Serif", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0f1a1f; --card:#17272e; --line:#24373f;
    --ink:#e8efee; --muted:#9db0b6; --faint:#6f8189;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 26px rgba(0,0,0,.32);
    --accent:#4fc1b2;
  }
}
:root[data-theme="dark"]{
  --bg:#0f1a1f; --card:#17272e; --line:#24373f;
  --ink:#e8efee; --muted:#9db0b6; --faint:#6f8189;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 26px rgba(0,0,0,.32);
  --accent:#4fc1b2;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; min-height:100vh;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(1100px 560px at 10% -10%, rgba(231,111,81,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(42,157,143,.09), transparent 55%),
    var(--bg);
  display:flex; flex-direction:column;
}
a{ color:var(--accent); }
h1,h2,h3{ line-height:1.15; }
[hidden]{ display:none !important; }
code{ font-size:.9em; background:rgba(127,127,127,.14); padding:1px 5px; border-radius:5px; }

/* ---- barra ---- */
.top{ display:flex; align-items:center; gap:12px; padding:14px clamp(16px,4vw,34px); flex-wrap:wrap; }
.brand{ font-size:1.02rem; letter-spacing:.16em; font-weight:800; color:var(--ink); text-decoration:none; }
.brand span{ color:var(--coral); }
.top__spacer{ flex:1 1 auto; }
.tone{ display:inline-flex; border:1px solid var(--line); background:var(--card); border-radius:999px; padding:3px; box-shadow:var(--shadow); }
.tone button{ border:0; background:transparent; color:var(--muted); font:inherit; font-size:.88rem; font-weight:650; padding:7px 14px; border-radius:999px; cursor:pointer; }
.tone button[aria-checked="true"]{ background:var(--dark); color:#fff; }
.tone button[data-tono="s"][aria-checked="true"]{ background:var(--red); }

.wrap{ width:100%; max-width:1060px; margin:0 auto; padding:8px 16px 40px; flex:1 0 auto; }
.card{ background:var(--card); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow); }

/* ---- bottoni ---- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; border:0; border-radius:12px;
  background:var(--dark); color:#fff; font:inherit; font-weight:650; padding:11px 18px; cursor:pointer; text-decoration:none; text-align:center; }
.btn:hover{ filter:brightness(1.08); }
.btn:focus-visible, .chip:focus-visible, .tone button:focus-visible, .tab:focus-visible, .drop:focus-visible{ outline:3px solid var(--teal); outline-offset:2px; }
.btn--big{ font-size:1.05rem; padding:14px 26px; }
.btn--sm{ padding:7px 12px; font-size:.9rem; border-radius:10px; }
.btn--gold{ background:var(--gold); color:#2b2412; }
.btn--ghost{ background:transparent; color:var(--ink); border:1px solid var(--line); }
.btn[disabled]{ opacity:.5; cursor:not-allowed; }
.chip{ border:1px solid var(--line); background:var(--card); color:var(--ink); font:inherit; font-size:.9rem; font-weight:600; padding:7px 14px; border-radius:999px; cursor:pointer; }
.chip:hover{ border-color:var(--teal); }

/* ---- ingresso ---- */
.hero{ text-align:center; padding:26px 0 8px; }
.hero__title{ font-family:var(--serif); font-style:italic; font-size:clamp(2.1rem,6vw,3.5rem); margin:0 0 12px; }
.hero__sub{ max-width:680px; margin:0 auto; color:var(--muted); font-size:1.06rem; line-height:1.55; }

.drop{ margin:26px auto 0; max-width:640px; padding:30px 20px; text-align:center; border:2px dashed var(--line); cursor:pointer; transition:border-color .15s, background .15s; }
.drop.is-over{ border-color:var(--teal); background:rgba(42,157,143,.07); }
.drop__icon{ color:var(--dark); display:block; margin:0 auto; }
:root[data-theme="dark"] .drop__icon{ color:var(--muted); }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .drop__icon{ color:var(--muted); } }
.drop__title{ font-weight:750; font-size:1.15rem; margin:6px 0 4px; }
.drop__hint{ color:var(--muted); margin:0 0 16px; font-size:.95rem; }
.drop__status{ margin:14px 0 0; color:var(--muted); font-size:.95rem; }
.drop__status.is-error{ color:var(--red); }

.samples{ display:flex; flex-direction:column; align-items:center; gap:10px; margin:18px 0 0; color:var(--muted); font-size:.95rem; text-align:center; }
.samples__btns{ display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }

.points{ list-style:none; padding:0; margin:34px 0 0; display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.points li{ background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px 18px; }
.points b{ display:block; margin-bottom:4px; }
.points span{ color:var(--muted); font-size:.93rem; line-height:1.5; }

.guide{ margin-top:38px; }
.guide h2{ font-family:var(--serif); font-size:1.6rem; margin:0 0 14px; }
.guide details{ margin-bottom:10px; padding:0 18px; }
.guide summary{ cursor:pointer; padding:15px 0; font-weight:650; display:flex; align-items:center; gap:10px; list-style:none; }
.guide summary::-webkit-details-marker{ display:none; }
.guide summary::after{ content:"+"; margin-left:auto; font-size:1.3rem; color:var(--muted); }
.guide details[open] summary::after{ content:"–"; }
.guide ol{ margin:0 0 16px; padding-left:22px; line-height:1.6; color:var(--ink); }
.guide li{ margin-bottom:6px; }
.src{ display:inline-block; font-size:.78rem; font-weight:800; letter-spacing:.04em; padding:3px 9px; border-radius:999px; color:#fff; }
.src--spotify{ background:#1a7f43; } .src--whatsapp{ background:#167a5b; }
.src--youtube{ background:#b3261e; } .src--netflix{ background:#8e1b1b; }

/* ---- risultati ---- */
.tabs{ display:flex; flex-wrap:wrap; gap:8px; margin:6px 0 14px; }
.tab{ border:1px solid var(--line); background:var(--card); color:var(--ink); font:inherit; font-weight:650; padding:8px 16px; border-radius:999px; cursor:pointer; }
.tab[aria-selected="true"]{ background:var(--dark); color:#fff; border-color:var(--dark); }
.notice{ background:rgba(233,196,106,.18); border:1px solid rgba(233,196,106,.6); padding:10px 14px; border-radius:12px; font-size:.93rem; line-height:1.5; }

.rhead{ display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:14px; margin:8px 0 18px; }
.rhead__kicker{ margin:0 0 4px; color:var(--muted); font-size:.82rem; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.rhead__title{ margin:0; font-family:var(--serif); font-size:clamp(1.7rem,4.5vw,2.4rem); }
.who{ display:flex; flex-direction:column; gap:4px; font-size:.85rem; color:var(--muted); font-weight:600; }
.who select, .inp{ font:inherit; font-size:1rem; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:10px; padding:9px 11px; min-width:0; max-width:100%; }

.numbers{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:14px; }
.num{ padding:18px 18px 16px; display:flex; flex-direction:column; gap:6px; }
.num__v{ font-family:var(--serif); font-weight:700; font-size:1.85rem; line-height:1.1; overflow-wrap:anywhere; }
.num__l{ color:var(--muted); font-size:.92rem; line-height:1.4; overflow-wrap:anywhere; }
.num__r{ margin:6px 0 0; padding-top:10px; border-top:1px dashed var(--line); font-family:var(--serif); font-style:italic; font-size:1.02rem; line-height:1.45; }

.ranks{ display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:14px; margin-top:14px; }
.rank{ padding:16px 18px; }
.rank h3{ margin:0 0 10px; font-size:1rem; }
.rank ol{ margin:0; padding-left:22px; }
.rank li{ display:list-item; padding:5px 0; border-bottom:1px solid var(--line); font-size:.95rem; }
.rank li:last-child{ border-bottom:0; }
.rank__row{ display:flex; justify-content:space-between; gap:12px; }
.rank__name{ overflow-wrap:anywhere; }
.rank__val{ color:var(--muted); white-space:nowrap; font-variant-numeric:tabular-nums; }

.report{ margin-top:22px; padding:22px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.05fr); gap:24px; align-items:start; }
.report h2{ margin:0 0 8px; font-family:var(--serif); font-size:1.7rem; }
.report__lead{ margin:0 0 16px; color:var(--muted); line-height:1.5; }
.field{ display:flex; flex-direction:column; gap:5px; font-size:.88rem; color:var(--muted); font-weight:600; margin-bottom:14px; }
.report__btns{ display:flex; flex-direction:column; gap:10px; }
.report__note{ margin:14px 0 0; color:var(--muted); font-size:.88rem; line-height:1.5; }
.report__preview canvas{ display:block; width:100%; height:auto; border-radius:6px; box-shadow:0 10px 30px rgba(0,0,0,.18); background:#f8f4e9; }

.again{ text-align:center; margin-top:26px; }

/* ---- dialog ---- */
.dialog{ border:0; padding:0; border-radius:18px; width:min(520px, calc(100vw - 32px)); max-height:calc(100vh - 32px); background:var(--card); color:var(--ink); box-shadow:0 20px 60px rgba(0,0,0,.35); }
.dialog::backdrop{ background:rgba(10,20,25,.55); }
.dialog__body{ padding:24px 22px 20px; position:relative; }
.dialog h2{ margin:0 0 14px; font-family:var(--serif); font-size:1.5rem; padding-right:30px; }
.dialog__x{ position:absolute; top:14px; right:14px; border:0; background:transparent; color:var(--muted); font-size:1.2rem; cursor:pointer; width:36px; height:36px; border-radius:10px; }
.steps{ margin:0 0 14px; padding-left:22px; display:flex; flex-direction:column; gap:14px; }
.steps li > b{ display:block; margin-bottom:4px; }
.steps li > span{ display:block; color:var(--muted); font-size:.9rem; line-height:1.45; margin-bottom:8px; }
.code{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.code span{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:1.25rem; font-weight:700; letter-spacing:.06em; background:rgba(127,127,127,.12); padding:6px 12px; border-radius:10px; }
.paystate{ margin:6px 0 8px; font-weight:650; }
.paystate.is-ok{ color:var(--teal); }
.paystate.is-warn{ color:var(--coral); }
.havecode{ margin-top:14px; font-size:.92rem; }
.havecode summary{ cursor:pointer; color:var(--muted); }
.havecode__form{ display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.havecode__form .inp{ flex:1 1 180px; text-transform:uppercase; }
.fine{ margin:16px 0 0; color:var(--muted); font-size:.82rem; line-height:1.5; }

.toast{ position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:var(--dark); color:#fff; padding:10px 18px; border-radius:12px; box-shadow:0 8px 24px rgba(0,0,0,.25); font-weight:600; z-index:10; max-width:calc(100vw - 32px); text-align:center; }

.foot{ text-align:center; padding:24px 16px 30px; color:var(--muted); font-size:.88rem; line-height:1.5; }
.foot p{ margin:0 0 4px; }
.foot__small{ font-size:.8rem; color:var(--faint); }

@media (max-width:760px){
  .report{ grid-template-columns:1fr; padding:18px; }
  .report__preview{ order:-1; }
}
@media (max-width:420px){
  .tone button{ padding:6px 10px; }
  .num__v{ font-size:1.6rem; }
}
