/* ==========================================
   lezione_01 · Hello, World!
   Stile ripreso da lezione-grid, ingrandito per il proiettore.
   ========================================== */

/* Colori dei gruppi (adesivi della Lego Duck), slide 13:
   fila 1 rosso, fila 2 giallo, fila 3 verde, fila 4 blu. */
:root {
  --colore-gruppo-1: #d62828;
  --colore-gruppo-2: #ffd60a;
  --colore-gruppo-3: #2a9d4b;
  --colore-gruppo-4: #1d4ed8;

  --nero: #000;
  --grigio-scuro: #333;
  --grigio: #666;
  --grigio-chiaro: #e0e0e0;
  --sfondo-tenue: #f5f5f5;
  --giallo-todo: #ffe14d;
  --rosso-avviso: #c8102e;
  --mono: 'SF Mono', Monaco, 'Cascadia Code', 'DejaVu Sans Mono', Consolas, monospace;
}

/* Reset e base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.4;
  color: var(--nero);
  background: #fff;
  font-size: 18px;
}

[hidden] {
  display: none !important;
}

strong {
  font-weight: 700;
}

code,
.code-inline {
  font-family: var(--mono);
}

/* ==========================================
   SISTEMA SLIDE
   Le misure delle slide sono in em: il corpo del testo dipende
   dalle dimensioni del contenitore, quindi la slide resta uguale
   su proiettore, portatile e vista relatore.
   ========================================== */

.slides-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #fff;
  container-type: size;
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  padding: 3.4em 4em 3em;
  background: #fff;
  font-size: min(1.6cqw, 2.85cqh);
}

.slide.active {
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(0.6em); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .slide.active { animation: none; }
}

.slide-content {
  width: 100%;
  max-width: 44em;
  margin: auto;
}

.slide-content-wide {
  max-width: 56em;
}

.notes {
  display: none;
}

/* Tipografia delle slide */
.slide h1 {
  font-size: 4.2em;
  font-weight: 700;
  line-height: 1.05;
}

.slide h2 {
  font-size: 2.1em;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.7em;
}

.slide h3 {
  font-size: 1.15em;
  font-weight: 700;
  margin-bottom: 0.35em;
}

.slide p {
  font-size: 1.15em;
  line-height: 1.4;
}

.slide .lead {
  font-size: 1.45em;
  line-height: 1.35;
  margin-top: 0.6em;
}

.slide .lead-strong {
  font-weight: 700;
}

.slide .lead-muted {
  color: var(--grigio);
}

.slide .kicker {
  font-family: var(--mono);
  font-size: 1.1em;
  color: var(--grigio);
  margin-bottom: 0.3em;
}

.code-title {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.slide .code-title-xl {
  font-size: 3.2em;
}

/* Elenchi grandi */
.big-list {
  font-size: 1.3em;
  line-height: 1.35;
  padding-left: 2em;
}

.big-list li {
  margin-bottom: 0.55em;
  padding-left: 0.3em;
}

.big-list li::marker {
  font-family: var(--mono);
  font-weight: 700;
}

.big-list .mystery {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.2em;
}

/* Riquadro di richiamo */
.slide .callout {
  font-size: 1.35em;
  font-weight: 700;
  border-left: 0.2em solid var(--nero);
  background: var(--sfondo-tenue);
  padding: 0.5em 0.8em;
  margin-top: 0.9em;
}

.slide .small-line {
  font-size: 1.1em;
  color: var(--grigio-scuro);
  margin-top: 0.8em;
}

/* Due colonne */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3em;
  align-items: center;
}

/* ==========================================
   COPERTINA
   ========================================== */

.cover-content {
  text-align: center;
}

.cover-content .code-title {
  font-size: 2em;
  color: var(--grigio);
}

.cover-content .cover-kicker {
  font-family: var(--mono);
  font-size: 1.8em;
  margin: 0.3em 0 0.2em;
}

.cover-content .colophon {
  margin-top: 3em;
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--grigio);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3em 1.6em;
}

/* ==========================================
   SLIDE DI FRASE (titolo grande, poche parole)
   ========================================== */

.slide-statement .slide-content {
  max-width: 46em;
}

.slide-statement h2 {
  font-size: 3.2em;
  line-height: 1.1;
  margin-bottom: 0.25em;
}

.slide-statement h2.statement {
  font-size: 3.4em;
}

.slide-question h2.question {
  font-size: 2.9em;
  line-height: 1.15;
  font-weight: 700;
}

/* ==========================================
   SCHEDE (patto d'aula, presentazione)
   ========================================== */

.cards {
  display: grid;
  gap: 1.6em 2.4em;
}

.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  border-top: 0.12em solid var(--nero);
  padding-top: 0.6em;
}

.card h3 {
  font-size: 1.3em;
}

.card h3.code-title {
  font-size: 1.15em;
}

.cards-3 .card p {
  font-size: 0.95em;
  line-height: 1.4;
}

.cards-2 .card p {
  font-size: 1.15em;
}

/* ==========================================
   PIANTA DELL'AULA (slide 13)
   ========================================== */

.aula {
  display: grid;
  gap: 0.6em;
}

.aula-cattedra {
  justify-self: center;
  width: 40%;
  border: 0.12em solid var(--nero);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.4em;
  margin-bottom: 0.8em;
}

.aula-fila {
  height: 2.6em;
  background: var(--fila);
  color: #fff;
  display: flex;
  align-items: center;
  padding-left: 0.8em;
  font-family: var(--mono);
  font-weight: 700;
}

.aula-fila-1 { --fila: var(--colore-gruppo-1); }
.aula-fila-2 { --fila: var(--colore-gruppo-2); color: #000; }
.aula-fila-3 { --fila: var(--colore-gruppo-3); }
.aula-fila-4 { --fila: var(--colore-gruppo-4); }

/* ==========================================
   RUOLI (slide 15-17)
   ========================================== */

.slide-role h2 {
  font-size: 2.8em;
}

.role-count {
  font-weight: 400;
  color: var(--grigio);
  font-size: 0.55em;
}

.role-block {
  border-left: 0.2em solid var(--nero);
  padding: 0.2em 0 0.2em 0.9em;
  margin-bottom: 1.1em;
}

.role-block h3 {
  font-size: 1.05em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grigio-scuro);
}

.role-block p,
.role-block ul {
  font-size: 1.35em;
  line-height: 1.35;
}

.role-block ul {
  padding-left: 1.1em;
}

.role-block li {
  margin-bottom: 0.2em;
}

.role-block-no {
  border-left-color: var(--rosso-avviso);
}

.role-block-no h3 {
  color: var(--rosso-avviso);
}

/* ==========================================
   MANCHE E PUNTEGGIO (slide 18-19)
   ========================================== */

.timeline {
  list-style: none;
  font-size: 1.25em;
  border-left: 0.15em solid var(--nero);
  margin-left: 0.4em;
}

.timeline li {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1em;
  padding: 0.35em 0 0.35em 1em;
  position: relative;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -0.42em;
  top: 0.75em;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--nero);
}

.timeline .timeline-pause {
  color: var(--grigio);
}

.timeline .timeline-pause::before {
  background: #fff;
  border: 0.12em solid var(--grigio);
}

.score-list {
  list-style: none;
  font-size: 1.35em;
  margin: 0.8em 0 0.4em;
}

.score-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin-bottom: 0.35em;
}

.score {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.15em;
  min-width: 2.4em;
  text-align: right;
}

.score-minus {
  color: var(--rosso-avviso);
}

/* ==========================================
   TIMER
   ========================================== */

.slide-timer .slide-content {
  text-align: center;
  max-width: 56em;
}

.slide-timer h2 {
  font-size: 2.6em;
  margin-bottom: 0.2em;
}

.slide-timer .timer-label {
  font-size: 1.4em;
  color: var(--grigio);
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0.3em auto;
}

.timer-display {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 11em;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--nero);
  background: none;
  border: 0.03em solid transparent;
  border-radius: 0.08em;
  padding: 0.04em 0.18em;
  cursor: pointer;
}

.timer-display:focus-visible {
  outline: 0.02em dashed var(--grigio);
  outline-offset: 0.02em;
}

/* In pausa: il timer è grigio finché non si avvia */
.timer:not(.is-running):not(.is-done) .timer-display {
  color: var(--grigio);
}

.timer.is-started:not(.is-running):not(.is-done) .timer-display {
  color: var(--grigio);
  border-color: var(--grigio-chiaro);
}

.timer-bar {
  width: 70%;
  height: 0.5em;
  background: var(--grigio-chiaro);
  margin-top: 0.4em;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--nero);
  transform-origin: left;
}

/* Ultimi minuti: rosso */
.timer.is-warning .timer-display {
  color: #fff;
  background: var(--rosso-avviso);
}

.timer.is-warning .timer-bar-fill {
  background: var(--rosso-avviso);
}

/* Tempo scaduto */
.timer.is-done .timer-display {
  color: #fff;
  background: var(--rosso-avviso);
  animation: timerDone 1s steps(2, start) infinite;
}

@keyframes timerDone {
  to { background: var(--nero); }
}

.slide .rules-reminder {
  margin-top: 1em;
  font-size: 1.15em;
  color: var(--grigio-scuro);
  border-top: 0.06em solid var(--grigio-chiaro);
  padding-top: 0.6em;
}

/* Timer accanto al testo (retrospettiva) */
.slide-timer-side .slide-content {
  text-align: left;
}

.slide-timer-side h2 {
  font-size: 2.1em;
  margin-bottom: 0.7em;
}

.split-timer {
  grid-template-columns: 1.5fr 1fr;
}

.timer-small .timer-display {
  font-size: 6.5em;
}

.timer-small .timer-bar {
  width: 90%;
}

/* ==========================================
   LISTE DI CONTROLLO (slide 22, 26, 31)
   ========================================== */

.slide-checklist h2 {
  margin-bottom: 0.45em;
}

.checklist {
  list-style: none;
  counter-reset: voce;
  font-size: 1.12em;
  line-height: 1.3;
}

.checklist[start="4"] {
  counter-reset: voce 3;
}

.checklist li {
  counter-increment: voce;
  display: grid;
  grid-template-columns: 1.8em 1fr;
  gap: 0.4em;
  padding: 0.32em 0;
  border-bottom: 0.05em solid var(--grigio-chiaro);
}

.checklist li::before {
  content: counter(voce);
  font-family: var(--mono);
  font-weight: 700;
  text-align: center;
  background: var(--nero);
  color: #fff;
  border-radius: 0.2em;
  height: 1.4em;
  line-height: 1.4em;
  margin-top: -0.05em;
}

.slide .checklist-score {
  margin-top: 0.7em;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05em;
}

.checklist-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4em;
}

.checklist-columns h3 {
  font-size: 1.05em;
  margin-bottom: 0.4em;
}

.slide-checklist .callout {
  font-size: 1.15em;
  margin-top: 0.7em;
}

/* ==========================================
   SCHEMI (slide 23, 32)
   ========================================== */

.slide-schema h2 {
  margin-bottom: 0.3em;
}

.schema-views {
  display: flex;
  justify-content: center;
  gap: 4em;
}

.schema-views figure {
  text-align: center;
}

.schema-views img {
  display: block;
  height: 24em;
  width: auto;
  margin: 0 auto;
}

.schema-views figcaption {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--grigio-scuro);
  margin-top: 0.3em;
}

/* ==========================================
   PONTE (slide 40-45)
   ========================================== */

.mapping div,
.definitions div {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 1em;
  align-items: baseline;
  padding: 0.6em 0;
  border-bottom: 0.06em solid var(--grigio-chiaro);
  font-size: 1.55em;
}

.mapping dd {
  padding-left: 1.3em;
  text-indent: -1.3em;
}

.mapping dt,
.definitions dt {
  font-weight: 700;
}

.mapping dd::before {
  content: "→ ";
  font-weight: 700;
}

.definitions div {
  grid-template-columns: 6.5em 1fr;
}

.slide-ponte h2 {
  font-size: 2.8em;
  margin-bottom: 0.6em;
}

.ponte-lines {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4em 0.6em;
  font-size: 1.6em;
}

.slide .ponte-line {
  display: contents;
  font-size: 1em;
}

.ponte-label {
  font-weight: 700;
}

.remains {
  margin-top: 0.5em;
}

.remains li {
  font-weight: 700;
  font-size: 1.15em;
}

#prossima-volta h2 {
  font-size: 2.8em;
}

/* ==========================================
   SONDAGGIO (slide 49)
   ========================================== */

.split-qr {
  grid-template-columns: 1.3fr 1fr;
}

.qr-placeholder {
  text-align: center;
}

.qr-box {
  width: 13em;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 0.15em dashed var(--grigio);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
  font-size: 1em;
}

.qr-placeholder figcaption {
  margin-top: 0.6em;
}

/* ==========================================
   SEGNAPOSTO DA VERIFICARE
   ========================================== */

mark.todo,
mark.proposta {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 700;
  color: #000;
  background: var(--giallo-todo);
  padding: 0.05em 0.35em;
  border-radius: 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

mark.todo::before,
mark.proposta::before { content: "["; }
mark.todo::after,
mark.proposta::after { content: "]"; }

mark.proposta {
  background: #cfe8ff;
}

/* ==========================================
   INTESTAZIONI FISSE SU TUTTE LE SLIDE
   ========================================== */

.slide-header-left,
.slide-header-right,
.slide-footer-left {
  position: fixed;
  font-family: var(--mono);
  font-size: clamp(11px, 0.75vw, 16px);
  color: #777;
  z-index: 1000;
}

.slide-header-left { top: 16px; left: 24px; }
.slide-header-right { top: 16px; right: 24px; }
.slide-footer-left { bottom: 16px; left: 24px; }

/* ==========================================
   NAVIGAZIONE
   ========================================== */

.nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  width: 48px;
  height: 48px;
  font-size: 22px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.12;
  transition: opacity 0.2s;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  opacity: 1;
}

.nav-prev { left: 16px; }
.nav-next { right: 16px; }

.nav-btn:disabled {
  opacity: 0.05;
  cursor: not-allowed;
}

.progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grigio-chiaro);
  z-index: 1000;
}

.progress-fill {
  height: 100%;
  background: #000;
  transition: width 0.3s ease;
  width: 0;
}

.slide-indicator {
  position: fixed;
  bottom: 16px;
  right: 24px;
  font-size: clamp(12px, 0.8vw, 16px);
  color: #777;
  z-index: 1000;
  font-family: var(--mono);
}

/* ==========================================
   NOTE DEL DOCENTE (tasto N)
   ========================================== */

.notes-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 45vh;
  overflow-y: auto;
  z-index: 2000;
  background: #111;
  color: #fff;
  padding: 20px 32px 28px;
  font-size: clamp(15px, 1.15vw, 22px);
  line-height: 1.45;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.notes-panel .notes-meta {
  font-family: var(--mono);
  font-size: 0.8em;
  color: #aaa;
  margin-bottom: 0.6em;
}

.notes-panel ul {
  padding-left: 1.2em;
}

.notes-panel li {
  margin-bottom: 0.4em;
}

.notes-panel code {
  background: #333;
  padding: 0 0.3em;
  border-radius: 3px;
}

.notes-panel .passaggio {
  margin-top: 0.8em;
  padding-top: 0.6em;
  border-top: 1px solid #444;
  font-style: italic;
}

.notes-panel .passaggio::before {
  content: "Passaggio: ";
  font-style: normal;
  font-weight: 700;
  color: #aaa;
}

.notes-panel mark.todo,
.notes-panel mark.proposta {
  font-size: 0.85em;
}

/* ==========================================
   VISTA RELATORE (tasto P, finestra separata)
   ========================================== */

body.presenter {
  background: #1a1a1a;
}

body.presenter .slide-header-left,
body.presenter .slide-header-right,
body.presenter .slide-footer-left,
body.presenter .nav-btn {
  display: none;
}

body.presenter .slides-container {
  inset: auto;
  left: 1.5vw;
  top: 1.5vw;
  width: 58vw;
  height: calc(58vw * 9 / 16);
  outline: 1px solid #555;
}

body.presenter .notes-panel {
  display: block !important;
  left: 61vw;
  top: 0;
  max-height: none;
  box-shadow: none;
  border-left: 1px solid #333;
  font-size: clamp(16px, 1.35vw, 26px);
}

.presenter-info {
  position: fixed;
  left: 1.5vw;
  width: 58vw;
  top: calc(3vw + 58vw * 9 / 16);
  color: #ddd;
  font-family: var(--mono);
  font-size: clamp(14px, 1.2vw, 22px);
  display: grid;
  gap: 0.5em;
}

.presenter-info .presenter-clock {
  font-size: 2.2em;
  font-weight: 700;
  color: #fff;
}

.presenter-info .presenter-next {
  color: #aaa;
}

body.presenter .slide-indicator {
  left: 1.5vw;
  right: auto;
  color: #aaa;
}

/* ==========================================
   AIUTO E SCHERMO NERO
   ========================================== */

.help-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: #fff;
  border: 2px solid #000;
  padding: 24px 32px;
  font-size: clamp(14px, 1vw, 20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
}

.help-panel h2 {
  font-size: 1.3em;
  margin-bottom: 0.6em;
}

.help-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35em 1.4em;
}

.help-panel dt {
  font-family: var(--mono);
  font-weight: 700;
}

.blackout {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2500;
}
