/* ============================================================
   notruffa.it — Stylesheet (MOBILE-FIRST)
   Base styles = smartphone
   Tablet  → @media (min-width: 600px)
   Desktop → @media (min-width: 960px)
   Wide    → @media (min-width: 1280px)
   Fonts: Syne (display) + Source Serif 4 (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&display=swap');

:root {
  --red:       #E63946;
  --red-dark:  #C1121F;
  --red-light: #FDECEA;
  --navy:      #1D3557;
  --bg:        #F4F5F7;
  --surface:   #FFFFFF;
  --success:   #2DC653;
  --success-bg:#EBF9EF;
  --warn:      #FFB703;
  --warn-bg:   #FFF8E6;
  --text:      #1A1C22;
  --muted:     #6B7280;
  --border:    #E2E5EA;
  --r:         10px;
  --shadow:    0 2px 16px rgba(0,0,0,.08);
  --fd: 'Syne', sans-serif;
  --fb: 'Source Serif 4', Georgia, serif;

  /* Fluid type scale */
  --t-xs:   clamp(.72rem,  2.5vw, .82rem);
  --t-sm:   clamp(.82rem,  3vw,   .93rem);
  --t-base: clamp(.9rem,   3.5vw, 1rem);
  --t-md:   clamp(1rem,    4vw,   1.15rem);
  --t-lg:   clamp(1.2rem,  4.5vw, 1.5rem);
  --t-xl:   clamp(1.5rem,  6.5vw, 2.6rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--fb);
  font-size: var(--t-base);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a { color: var(--navy); text-decoration: none; }

/* ── Header — sticky on mobile ──────────────────────────────── */
.site-header {
  background: var(--navy);
  padding: .7rem clamp(.75rem, 4vw, 1.5rem);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.logo {
  font-family: var(--fd);
  font-size: clamp(1.2rem, 5vw, 1.75rem);
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .3rem;
  line-height: 1;
  text-decoration: none;
}
.logo span { color: var(--red); }
.tagline {
  font-size: var(--t-xs);
  color: rgba(255,255,255,.55);
  font-style: italic;
  display: none;
}
@media (min-width: 600px) { .tagline { display: block; } }

/* ── Banners ─────────────────────────────────────────────────── */
.banner-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .5rem clamp(.5rem, 3vw, 1rem);
}
/* Mobile: 320×50 */
#banner-top {
  width: min(320px, 100%);
  height: 50px;
  background: #e8eaee;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--t-xs);
  margin: 0 auto;
}
/* Tablet+: 728×90 */
@media (min-width: 600px) {
  #banner-top { width: min(728px, 100%); height: 70px; }
}
#banner-side {
  width: 100%;
  height: 250px;
  background: #e8eaee;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--t-xs);
}
#banner-risultato {
  width: min(728px, 100%);
  height: clamp(50px, 8vw, 70px);
  background: #e8eaee;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--t-xs);
  margin: .75rem auto;
}
#banner-interstitial {
  width: min(300px, 90vw);
  height: min(180px, 35vw);
  background: rgba(255,255,255,.06);
  border: 2px dashed rgba(255,255,255,.2);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.4);
  font-size: var(--t-xs);
}

/* ── Container ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-inline: clamp(.75rem, 4vw, 2rem);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: clamp(1.5rem, 5vw, 3rem) 0 clamp(1rem, 3vw, 2rem);
  text-align: center;
}
.hero h1 {
  font-family: var(--fd);
  font-size: var(--t-xl);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: .6rem;
}
.hero h1 em { font-style: normal; color: var(--red); }
.hero p {
  font-size: var(--t-sm);
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto clamp(1rem, 4vw, 1.75rem);
  font-weight: 300;
}

/* ── Search card ─────────────────────────────────────────────── */
.search-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: clamp(.9rem, 4vw, 1.75rem);
  border: 1px solid var(--border);
}
@media (min-width: 600px) { .search-card { max-width: 640px; margin: 0 auto; } }

/* Stacked on mobile, inline from 480px */
.input-group { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .65rem; }
@media (min-width: 480px) { .input-group { flex-direction: row; } }

.search-input {
  width: 100%;
  padding: .9rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--r);
  font-size: var(--t-md);
  font-family: var(--fb);
  color: var(--text);
  background: #FAFBFC;
  outline: none;
  min-height: 52px;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.search-input:focus { border-color: var(--red); background: #fff; }
.search-input::placeholder { color: #AAB0BB; }

.btn-verify {
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: .9rem 1.5rem;
  font-family: var(--fd);
  font-size: var(--t-md);
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  white-space: nowrap;
  transition: background .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 480px) { .btn-verify { width: auto; } }
.btn-verify:hover  { background: var(--red-dark); }
.btn-verify:active { transform: scale(.97); }

.search-hint {
  font-size: var(--t-xs);
  color: var(--muted);
  text-align: center;
  font-style: italic;
  min-height: 1.3em;
}

/* ── Pills ───────────────────────────────────────────────────── */
.pills { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; margin-top: clamp(.75rem, 3vw, 1.25rem); }
.pill  { background: var(--navy); color: rgba(255,255,255,.85); font-size: var(--t-xs); padding: .25rem .7rem; border-radius: 50px; }

/* ── Stats — 1 col phone, 3 col 360px+ ──────────────────────── */
.stats-row { display: grid; grid-template-columns: 1fr; gap: .6rem; margin: clamp(.75rem,3vw,1.25rem) 0; }
@media (min-width: 360px) { .stats-row { grid-template-columns: repeat(3, 1fr); } }
.stat-card { background: var(--surface); border-radius: var(--r); border: 1px solid var(--border); padding: clamp(.6rem,3vw,1rem); text-align: center; }
.stat-card .num { font-family: var(--fd); font-size: var(--t-lg); font-weight: 800; color: var(--red); line-height: 1.1; }
.stat-card .lbl { font-size: var(--t-xs); color: var(--muted); margin-top: .2rem; }

/* ── Advice box ──────────────────────────────────────────────── */
.advice-box { background: var(--surface); border-radius: var(--r); border: 1px solid var(--border); padding: clamp(.85rem,3vw,1.25rem); margin-top: .75rem; }
.advice-box h3 { font-family: var(--fd); font-size: var(--t-base); color: var(--navy); margin-bottom: .65rem; }
.advice-box ul { padding-left: 1.1rem; display: flex; flex-direction: column; gap: .4rem; font-size: var(--t-sm); }

/* ── Layout: single col mobile, 2 col desktop ───────────────── */
.content-wrap { display: block; padding: clamp(.75rem,3vw,1.25rem) 0 clamp(1.5rem,5vw,2.5rem); }
@media (min-width: 960px)  { .content-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; align-items: start; } }
@media (min-width: 1280px) { .content-wrap { grid-template-columns: 1fr 340px; gap: 2.5rem; } }

/* Sidebar: hidden on mobile */
.sidebar { display: none; }
@media (min-width: 960px) { .sidebar { display: block; } }

/* ── Result ──────────────────────────────────────────────────── */
.result-term { font-family: var(--fd); font-size: var(--t-lg); color: var(--navy); margin: clamp(.75rem,3vw,1.25rem) 0 .6rem; word-break: break-all; line-height: 1.3; }
.result-term span { font-size: var(--t-sm); color: var(--red); font-family: var(--fb); font-weight: 700; }

.result-box { border-radius: 14px; padding: clamp(.9rem,4vw,1.6rem); border-left: 5px solid transparent; box-shadow: var(--shadow); margin-bottom: .75rem; }
.result-box.danger  { background: var(--red-light);  border-color: var(--red);     }
.result-box.warning { background: var(--warn-bg);    border-color: var(--warn);    }
.result-box.safe    { background: var(--success-bg); border-color: var(--success); }

.result-status { font-family: var(--fd); font-size: var(--t-lg); font-weight: 800; margin-bottom: .35rem; line-height: 1.2; }
.danger  .result-status { color: var(--red-dark); }
.warning .result-status { color: #b45309; }
.safe    .result-status { color: #166534; }

/* Meta: 1 col mobile, 2 col 480px+ */
.result-meta { margin-top: .75rem; display: grid; grid-template-columns: 1fr; gap: .2rem; font-size: var(--t-sm); }
@media (min-width: 480px) { .result-meta { grid-template-columns: auto 1fr; gap: .25rem .9rem; } }
.result-meta dt { color: var(--muted); font-style: italic; margin-top: .3rem; }
.result-meta dd { font-weight: 600; word-break: break-all; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: block; width: 100%; padding: .85rem 1.25rem; border-radius: var(--r); font-family: var(--fd); font-weight: 700; font-size: var(--t-sm); text-align: center; cursor: pointer; border: 2px solid transparent; min-height: 50px; transition: background .2s; -webkit-tap-highlight-color: transparent; }
@media (min-width: 480px) { .btn { display: inline-block; width: auto; } }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-row { display: flex; flex-direction: column; gap: .6rem; margin-top: clamp(.75rem,3vw,1.25rem); }
@media (min-width: 480px) { .btn-row { flex-direction: row; flex-wrap: wrap; } }

/* ── Interstitial ────────────────────────────────────────────── */
#interstitial-overlay {
  position: fixed; inset: 0;
  background: rgba(29,53,87,.97);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(.75rem, 3vw, 1.5rem);
  color: #fff;
  padding: 1rem;
}
#interstitial-overlay.active { display: flex; }
#countdown-text { font-family: var(--fd); font-size: clamp(3rem, 15vw, 5rem); font-weight: 800; color: var(--warn); animation: pulse 1s ease-in-out infinite; line-height: 1; }
#interstitial-msg { font-size: var(--t-sm); color: rgba(255,255,255,.65); font-style: italic; text-align: center; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  margin-top: auto;
  background: var(--navy);
  color: rgba(255,255,255,.55);
  padding: clamp(.85rem,3vw,1.5rem) clamp(.75rem,4vw,1.5rem);
  padding-bottom: calc(clamp(.85rem,3vw,1.5rem) + env(safe-area-inset-bottom));
  font-size: var(--t-xs);
  text-align: center;
  line-height: 1.9;
}
footer strong { color: rgba(255,255,255,.9); }
footer a { color: rgba(255,255,255,.7); }
footer a:hover { color: var(--red); }

/* ── Animations ──────────────────────────────────────────────── */
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .site-header, .banner-bar, .btn-row, footer,
  #banner-risultato, .sidebar { display: none !important; }
  body { background: #fff; color: #000; }
  .result-box { border: 2px solid #333 !important; background: #fff !important; }
}
