/* ==========================================================
   Ricerche di Scienze — sistema grafico condiviso
   Slide 16:9 (1920×1080) per LIM, web e PDF
   ========================================================== */

:root {
  --night: #0b1030;
  --deep: #121a46;
  --indigo: #1f2a6e;
  --violet: #34237a;
  --ink: #ffffff;
  --muted: #b9c0ea;
  --faint: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .14);

  --orange: #ff8a3d;
  --yellow: #ffd23f;
  --pink: #ff4f8b;
  --teal: #22e0bf;
  --cyan: #3fc4ff;
  --red: #ff4b55;
  --purple: #a774ff;
  --green: #7be06b;
  --skin: #ffb48a;

  --acc: var(--cyan);
  --acc2: var(--teal);
  --acc3: var(--yellow);

  --display: "Outfit", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --s: 1;
}

body[data-theme="neuro"]   { --acc: #3fc4ff; --acc2: #22e0bf; --acc3: #ffd23f; --bg1: #0a1438; --bg2: #10307a; }
body[data-theme="drugs"]   { --acc: #ff5a4f; --acc2: #ffb03b; --acc3: #ffd23f; --bg1: #1a0b26; --bg2: #5a1640; }
body[data-theme="disease"] { --acc: #c77dff; --acc2: #ff4f8b; --acc3: #22e0bf; --bg1: #120b33; --bg2: #3d1c7a; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #05071a;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
body { overflow: hidden; }
body.mode-scroll { overflow: auto; }

/* ---------- frame & scaling ---------- */
.deck { position: relative; }
.frame {
  width: calc(1920px * var(--s));
  height: calc(1080px * var(--s));
  position: relative;
  overflow: hidden;
}
.mode-deck .frame {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  box-shadow: 0 0 120px rgba(0,0,0,.6);
}
.mode-deck .frame.active { display: block; }
.mode-scroll .deck { padding: 64px 0 90px; }
@media (max-width: 640px) { .ui button span { display: none; } .ui .count { min-width: 56px; } }
.mode-scroll .frame { margin: 0 auto 16px; border-radius: 10px; }

.slide {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  transform: scale(var(--s));
  overflow: hidden;
  padding: 110px 140px 120px;
  background:
    radial-gradient(1200px 800px at 85% 10%, color-mix(in srgb, var(--bg2) 75%, transparent), transparent 70%),
    radial-gradient(900px 700px at 5% 100%, color-mix(in srgb, var(--acc) 14%, transparent), transparent 70%),
    linear-gradient(160deg, var(--bg1), var(--night) 70%);
  display: flex; flex-direction: column;
}
.slide > * { position: relative; z-index: 2; }
.slide .notes { display: none !important; }
.slide .stars { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.slide .bgart { position: absolute; z-index: 1; pointer-events: none; }

/* chrome: chapter label + footer */
.slide .chrome-top {
  position: absolute; top: 46px; left: 140px; right: 140px; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  font: 600 18px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.slide .chrome-top b { color: var(--acc); font-weight: 700; }
.slide .chrome-bottom {
  position: absolute; bottom: 44px; left: 140px; right: 140px; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  font: 500 17px/1 var(--mono); color: rgba(255,255,255,.45); letter-spacing: .06em;
}
.slide .chrome-bottom .pg { color: var(--ink); font-weight: 700; }
.slide .chrome-bottom .pg::before {
  content: ""; display: inline-block; width: 46px; height: 3px; border-radius: 3px;
  background: var(--acc); vertical-align: middle; margin-right: 14px;
}
.slide.no-chrome .chrome-top, .slide.no-chrome .chrome-bottom { display: none; }

/* ---------- typography ---------- */
.kicker {
  font: 700 22px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 26px; display: flex; align-items: center; gap: 16px;
}
.kicker .n {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  background: var(--acc); color: var(--night); letter-spacing: 0; font-size: 20px;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; line-height: 1.02; }
h1 { font-size: 120px; }
h2 { font-size: 76px; margin-bottom: 28px; }
h3 { font-size: 40px; margin-bottom: 14px; line-height: 1.1; }
h4 { font-size: 28px; margin-bottom: 10px; font-weight: 700; letter-spacing: -.01em; }
p, li { font-size: 28px; line-height: 1.45; color: #e3e7ff; }
.lead { font-size: 34px; line-height: 1.4; color: var(--muted); max-width: 1250px; }
.small { font-size: 22px; line-height: 1.45; color: var(--muted); }
.tiny { font-size: 17px; line-height: 1.4; color: rgba(255,255,255,.5); }
em, .hl { font-style: normal; color: var(--acc3); }
.acc { color: var(--acc); } .acc2 { color: var(--acc2); } .acc3 { color: var(--acc3); }
strong { color: #fff; font-weight: 700; }
.grad {
  background: linear-gradient(95deg, var(--acc), var(--acc2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
ul.clean { list-style: none; }
ul.clean li { padding-left: 38px; position: relative; margin-bottom: 14px; }
ul.clean li::before {
  content: ""; position: absolute; left: 4px; top: .55em; width: 14px; height: 14px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--acc) 25%, transparent);
}
.mono { font-family: var(--mono); }

/* ---------- layout ---------- */
.row { display: flex; gap: 48px; }
.col { display: flex; flex-direction: column; gap: 24px; }
.grow { flex: 1; min-width: 0; }
.center { align-items: center; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.fill { flex: 1; min-height: 0; }
.mt { margin-top: 32px; } .mt2 { margin-top: 56px; } .mb { margin-bottom: 32px; }
.vcenter { justify-content: center; }

/* ---------- components ---------- */
.card {
  background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 34px 38px;
  position: relative;
}
.card.solid { background: var(--deep); }
.card.tint { background: color-mix(in srgb, var(--acc) 14%, transparent); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.card p { font-size: 25px; }
.card .ico { width: 64px; height: 64px; margin-bottom: 18px; }

.stat .num {
  font: 800 108px/0.95 var(--display); letter-spacing: -.04em;
  background: linear-gradient(95deg, var(--acc), var(--acc2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .num small { font-size: .45em; letter-spacing: -.01em; }
.stat .lbl { font-size: 24px; line-height: 1.35; color: var(--muted); margin-top: 10px; }
.stat.xl .num { font-size: 170px; }
.stat.sm .num { font-size: 76px; }

.fact {
  border-radius: 30px; padding: 30px 36px 30px 36px;
  background: linear-gradient(140deg, rgba(255,210,63,.18), rgba(255,138,61,.10));
  border: 1px solid rgba(255,210,63,.45);
}
.fact .tag, .link .tag, .warn .tag {
  font: 800 17px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 99px;
  background: var(--yellow); color: #2a1a00; margin-bottom: 16px;
}
.fact p { font-size: 25px; }
.link {
  border-radius: 30px; padding: 30px 36px;
  background: linear-gradient(140deg, rgba(34,224,191,.16), rgba(63,196,255,.08));
  border: 1px solid rgba(34,224,191,.45);
}
.link .tag { background: var(--teal); color: #002a22; }
.link p { font-size: 25px; }
.warn {
  border-radius: 30px; padding: 30px 36px;
  background: linear-gradient(140deg, rgba(255,75,85,.2), rgba(255,79,139,.08));
  border: 1px solid rgba(255,75,85,.55);
}
.warn .tag { background: var(--red); color: #fff; }
.warn p, .warn li { font-size: 25px; }

.pill {
  display: inline-flex; align-items: center; gap: 10px;
  font: 700 19px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 11px 18px; border-radius: 99px;
  background: rgba(255,255,255,.08); border: 1px solid var(--line); color: #fff;
}
.pill.a { background: var(--acc); color: var(--night); border: 0; }
.pill.b { background: var(--acc2); color: var(--night); border: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 12px; }

.photo {
  border-radius: 28px; overflow: hidden; position: relative;
  background: #000; border: 1px solid var(--line);
}
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 24px 16px;
  background: linear-gradient(transparent, rgba(5,7,26,.92));
  font-size: 19px; line-height: 1.35; color: #fff;
}
.photo figcaption .cr { display: block; font: 500 13px/1.3 var(--mono); color: rgba(255,255,255,.55); margin-top: 4px; }

.divider-num {
  font: 800 420px/0.8 var(--display); letter-spacing: -.06em;
  color: transparent; -webkit-text-stroke: 3px color-mix(in srgb, var(--acc) 60%, transparent);
}

/* table */
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 23px; }
table.t th {
  font: 700 17px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--acc);
  text-align: left; padding: 16px 18px; border-bottom: 2px solid var(--line);
}
table.t td { padding: 17px 18px; border-bottom: 1px solid rgba(255,255,255,.08); color: #e3e7ff; vertical-align: top; line-height: 1.35; }
table.t tr td:first-child { font-family: var(--display); font-weight: 700; font-size: 26px; color: #fff; }
table.t .y { color: var(--green); font-weight: 700; }
table.t .n { color: var(--red); font-weight: 700; }
table.t .m { color: var(--yellow); font-weight: 700; }

/* steps */
.steps { display: grid; gap: 26px; counter-reset: st; }
.step { display: flex; gap: 22px; align-items: flex-start; }
.step::before {
  counter-increment: st; content: counter(st);
  flex: 0 0 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font: 800 26px/1 var(--display); background: var(--acc); color: var(--night);
}
.step p { font-size: 25px; } .step h4 { margin-bottom: 4px; }

/* timeline */
.tl { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 0; right: 0; top: 23px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--acc), var(--acc2)); }
.tl .ev { position: relative; padding-top: 70px; padding-right: 26px; }
.tl .ev::before { content: ""; position: absolute; left: 0; top: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--night); border: 6px solid var(--acc); }
.tl .yr { font: 800 40px/1 var(--display); color: #fff; margin-bottom: 10px; }
.tl p { font-size: 22px; color: var(--muted); }

/* sources */
.src { columns: 2; column-gap: 60px; }
.src li { font-size: 19px; line-height: 1.45; color: var(--muted); margin-bottom: 10px; break-inside: avoid; }
.src li b { color: #fff; }

/* glossary */
.gloss { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px 40px; }
.gloss div b { display: block; font-family: var(--display); font-size: 26px; color: var(--acc); margin-bottom: 4px; }
.gloss div { font-size: 20px; line-height: 1.4; color: var(--muted); }

/* svg helpers */
svg text { font-family: var(--body); }
svg .lbl { font: 600 22px var(--body); fill: #fff; }
svg .lbl-s { font: 500 18px var(--body); fill: var(--muted); }
svg .lbl-m { font: 700 17px var(--mono); fill: var(--muted); letter-spacing: .08em; }

/* cover */
.cover .meta { font: 600 22px/1.6 var(--mono); color: var(--muted); letter-spacing: .06em; }
.cover .meta b { color: #fff; }
.chip-n { font: 800 22px/1 var(--mono); color: var(--acc); }

/* index */
.toc { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 60px; }
.toc a { text-decoration: none; display: flex; align-items: center; gap: 26px; padding: 22px 26px; border-radius: 24px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: #fff; }
.toc .tn { font: 800 44px/1 var(--display); color: var(--acc); width: 70px; }
.toc .tt { font: 700 30px/1.15 var(--display); }
.toc .ts { font-size: 19px; color: var(--muted); margin-top: 4px; }

/* ---------- motion (schermo, modalità presentazione) ---------- */
.mode-deck .frame .reveal { opacity: 0; transform: translateY(26px); }
.mode-deck .frame.active .reveal {
  opacity: 1; transform: none;
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.mode-deck .frame.active .reveal.d1 { transition-delay: .12s; }
.mode-deck .frame.active .reveal.d2 { transition-delay: .24s; }
.mode-deck .frame.active .reveal.d3 { transition-delay: .36s; }
.mode-deck .frame.active .reveal.d4 { transition-delay: .48s; }
.mode-deck .frame.active .reveal.d5 { transition-delay: .6s; }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }
@keyframes pulse { 0%,100% { opacity: .55 } 50% { opacity: 1 } }
@keyframes dash { to { stroke-dashoffset: -400; } }
.mode-deck .frame.active .float { animation: floaty 6s ease-in-out infinite; }
.mode-deck .frame.active .pulse { animation: pulse 2.4s ease-in-out infinite; }
.mode-deck .frame.active .flow { stroke-dasharray: 18 22; animation: dash 6s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .mode-deck .frame .reveal { opacity: 1; transform: none; }
  .float, .pulse, .flow { animation: none !important; }
}

/* ---------- UI (solo schermo) ---------- */
.ui {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 6px; padding: 6px;
  background: rgba(10,14,40,.82); border: 1px solid rgba(255,255,255,.14); border-radius: 99px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 600 13px/1 var(--mono); color: #fff;
  transition: opacity .4s;
}
.ui.idle { opacity: 0; }
.ui button {
  appearance: none; border: 0; background: transparent; color: #fff; cursor: pointer;
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: 99px; font: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.ui button:hover { background: rgba(255,255,255,.12); }
.ui button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.ui .count { padding: 0 10px; color: rgba(255,255,255,.75); min-width: 70px; text-align: center; }
.ui svg { width: 18px; height: 18px; }
.progress { position: fixed; left: 0; top: 0; height: 4px; z-index: 50; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .4s; }
.mode-scroll .progress { display: none; }
.home-link { position: fixed; top: 14px; left: 16px; z-index: 50; font: 600 13px/1 var(--mono); color: rgba(255,255,255,.6); text-decoration: none; padding: 10px 14px; border-radius: 99px; background: rgba(10,14,40,.6); border: 1px solid rgba(255,255,255,.1); }
.mode-deck .home-link { opacity: 0; transition: opacity .3s; }
.mode-deck .home-link:hover, .mode-deck .home-link:focus { opacity: 1; }

/* ---------- stampa / PDF ---------- */
@page { size: 1920px 1080px; margin: 0; }
@media print {
  html, body { background: var(--night); overflow: visible !important; }
  .ui, .progress, .home-link { display: none !important; }
  .deck { padding: 0 !important; }
  .frame {
    position: relative !important; left: auto !important; top: auto !important; transform: none !important;
    display: block !important; width: 1920px !important; height: 1080px !important;
    margin: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    break-after: page; page-break-after: always;
  }
  .frame:last-child { break-after: auto; page-break-after: auto; }
  .slide { transform: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  /* il testo sfumato lascia bordi sottili nei PDF: in stampa usiamo un colore pieno */
  .stat .num, .grad { background: none !important; color: var(--acc) !important; -webkit-text-fill-color: var(--acc); }
  .float, .pulse, .flow { animation: none !important; }
}
