/* Marquee — "Vintage Poster". Chiaro di default, scuro automatico via
   prefers-color-scheme (nessun toggle manuale - segue il sistema), mobile
   first. Tutti i colori passano da variabili qui sotto apposta: il blocco
   dark si limita a ridefinirle, nessun colore hardcoded altrove nel file. */
:root {
  --bg: #f3e8d3;
  --card: #fbf3e4;
  --card-border: rgba(43, 29, 18, .15);
  --shadow-paper: 2px 3px 0 rgba(43, 29, 18, .08);
  --text: #2b1d12;
  --text-secondary: #5c4630;
  --text-tertiary: #8a6a45;
  --accent: #b3421f; /* unico valore usato ovunque - cambialo qui per tutto il sito (light) */
  --on-accent: #fbf3e4; /* testo/icone sopra uno sfondo pieno --accent */
  --hairline: rgba(43, 29, 18, .4);
  --line-dashed: rgba(43, 29, 18, .25);
  --translucent-btn-bg: rgba(255, 255, 255, .55); /* bottone Maps: "sfondo bianco semi-trasparente" da spec */
  --translucent-btn-bg-soft: rgba(255, 255, 255, .4);
  --poster-gradient-start: #7a4326;
  --radius: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b130c;
    --card: #2a1f16;
    --card-border: rgba(243, 232, 211, .12);
    --shadow-paper: 2px 3px 0 rgba(0, 0, 0, .35);
    --text: #f3e8d3;
    --text-secondary: #c9ab84;
    --text-tertiary: #a98a63;
    --accent: #e2703c; /* piu' chiaro del light (#b3421f) per contrasto su sfondo scuro */
    --on-accent: #1b130c;
    --hairline: rgba(243, 232, 211, .3);
    --line-dashed: rgba(243, 232, 211, .25);
    --translucent-btn-bg: rgba(0, 0, 0, .3);
    --translucent-btn-bg-soft: rgba(0, 0, 0, .25);
    --poster-gradient-start: #4a2a17;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Vollkorn", Georgia, serif;
  touch-action: manipulation;
  overflow-x: hidden;
}
h1, h2, h3, .display-font { font-family: "Abril Fatface", Georgia, serif; font-weight: 400; line-height: 1.15; }
h1 { font-size: 30px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 20px 0 10px; color: var(--text-secondary); }
h3 { font-size: 17px; margin: 0; }
p { margin: 0 0 10px; }
em, .italic { font-style: italic; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

/* Striscia decorativa in cima a ogni pagina: barra piena 7px + linea sottile scura */
.top-strip { height: 7px; background: var(--accent); }
.top-strip + .top-hairline, .top-hairline { height: 1px; background: var(--hairline); }

#shell {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tab/segmented control persistente Cinemas | Home */
#section-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 0;
  margin: 14px 16px 0;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}
#section-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-family: "Abril Fatface", Georgia, serif;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
}
#section-tabs button.on { background: var(--accent); color: var(--on-accent); }

#app {
  flex: 1;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 40px);
}

/* Animazione di arrivo dopo swipe-back, identica a diario-ascolti (stesso
   nome di classe/keyframe/durata: e' lo stesso meccanismo, non solo lo
   stesso "sentimento") */
@keyframes sbIn { from { transform: translateX(-28px); opacity: .45; } }
#app.sb { animation: sbIn .26s ease-out; }
@media (prefers-reduced-motion: reduce) { #app.sb { animation: none; } }

/* Header di livello (cinema/film/ecc.) */
.level-header { margin-bottom: 14px; }
.level-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  margin-bottom: 10px;
  cursor: pointer;
}
.level-back svg { width: 16px; height: 16px; stroke: currentColor; fill: none; vertical-align: -2px; }
.level-header .addr { color: var(--text-secondary); font-size: 14px; margin: 2px 0 10px; }
.header-dashed-sep { border: 0; border-top: 1px dashed var(--line-dashed); margin: 14px 0; }

/* Bottone Maps: pillola, bordo tratteggiato, sfondo bianco semi-trasparente, icona pin SVG stroke */
.btn-maps {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--accent);
  border-radius: 999px;
  background: var(--translucent-btn-bg);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  padding: 7px 14px;
  text-decoration: none;
  cursor: pointer;
}
.btn-maps svg { width: 15px; height: 15px; stroke: var(--accent); fill: none; }

/* Link Letterboxd: sottolineato, colore accento, freccia in fondo */
.link-letterboxd {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}
.link-letterboxd::after { content: " \2197"; }

/* Card generiche (film, showtime, mood, risultato Home) */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  padding: 12px;
  margin-bottom: 12px;
}
.card-list { display: flex; flex-direction: column; gap: 0; }

/* Card film (livello 2 Cinemas, e risultati Home) */
.film-card { display: flex; gap: 12px; cursor: pointer; }
.film-card.static { cursor: default; }
.poster-placeholder {
  flex: 0 0 auto;
  width: 64px;
  height: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, var(--poster-gradient-start), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-family: "Abril Fatface", Georgia, serif;
  font-size: 30px;
}
.poster-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 96px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  object-fit: cover;
  display: block;
  background: var(--card); /* mentre l'immagine carica (loading="lazy") */
}
.film-card-body { min-width: 0; flex: 1 1 auto; }
/* Pagina di condivisione: locandina piu' grande, contesto standalone
   (non una card in una lista) - stessa proporzione 2:3, taglia doppia. */
.poster-placeholder.large, .poster-thumb.large { width: 128px; height: 192px; font-size: 56px; }
.film-card-title { font-family: "Abril Fatface", Georgia, serif; font-size: 18px; margin: 0 0 2px; overflow-wrap: anywhere; }
.film-card-meta { color: var(--text-tertiary); font-size: 13px; font-style: italic; margin: 0 0 6px; }
.film-card-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 4px;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.film-card-desc.expanded { -webkit-line-clamp: unset; overflow: visible; }
.desc-toggle {
  display: inline-block;
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.film-card-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Badge lingua: MAI ruotato, bordo accento, maiuscolo, letter-spacing largo */
.badge-lang {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  white-space: nowrap;
}
.badge-watched {
  display: inline-block;
  border: 1px solid var(--text-tertiary);
  color: var(--text-tertiary);
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.badge-list-name {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
}

/* Righe cinema (livello 1) */
.cinema-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 4px;
  border-bottom: 1px dashed var(--line-dashed);
  cursor: pointer;
}
.cinema-row:last-child { border-bottom: 0; }
.cinema-row-name { font-family: "Abril Fatface", Georgia, serif; font-size: 19px; }
.cinema-row-count { color: var(--text-tertiary); font-size: 13px; font-style: italic; white-space: nowrap; }

/* Righe giorno (livello 3: programmazione film in un cinema) */
.day-group { margin-bottom: 16px; }
.day-group-heading { font-family: "Abril Fatface", Georgia, serif; font-size: 16px; color: var(--text-secondary); margin: 0 0 6px; }
.time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
}
.time-row .time { font-weight: 700; min-width: 52px; }

/* Livello 4: showtime selezionato */
.showtime-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-outline { background: var(--translucent-btn-bg-soft); border: 1px dashed var(--accent); color: var(--accent); }

/* Filtri sezione Cinemas */
.filters-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.filters-bar select, .filters-bar .chip {
  border: 1px solid var(--card-border);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.filters-bar .chip { cursor: pointer; }
.filters-bar .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Home — domande mood recommender */
.mood-grid, .source-grid { display: grid; gap: 12px; margin-top: 16px; }
.mood-option, .source-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  padding: 16px;
  font-family: "Abril Fatface", Georgia, serif;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
}
.home-question-label {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}

/* Home — risultati */
.result-card { }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.reshuffle-bar { display: flex; justify-content: center; margin: 16px 0 4px; }
.btn-reshuffle-all { background: var(--card); border: 1px dashed var(--accent); color: var(--accent); }

.empty-state {
  color: var(--text-secondary);
  background: var(--card);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 56ch;
}

.footer-disclaimer {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 11px;
  font-style: italic;
  padding: 16px 20px calc(env(safe-area-inset-bottom) + 16px);
  border-top: 1px dashed var(--line-dashed);
}

/* Pagina di condivisione singola proiezione (share.html, statica) */
.share-page .film-header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.share-page .film-header > div { min-width: 0; }
.share-page .film-meta { color: var(--text-secondary); font-size: 14px; font-style: italic; }
.share-page .share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.share-page .share-copied { color: var(--accent); font-weight: 600; font-size: 14px; }

/* titoli molto lunghi non sfondano mai il layout */
h1, .film-meta, .film-card-title { overflow-wrap: anywhere; word-break: break-word; }
