/* ---------- Font (self-hosted: nessuna richiesta a Google, nessun blocco al rendering) ---------- */
/* Archivo è un font variabile: un solo file copre tutti i pesi 400–900 */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/spacemono-400-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/spacemono-400-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/spacemono-700-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/spacemono-700-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Base ---------- */
:root {
  --accent: #EBB069;
  --ink: #F1F2EE;
  --muted: #93A6BC;
  --bg: #142a40;
  --tile: #1A2F47;
  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Archivo', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
/* grana leggera sopra tutto */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: .03;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMjAnIGhlaWdodD0nMTIwJz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMC45JyBudW1PY3RhdmVzPScyJy8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9JzEwMCUnIGhlaWdodD0nMTAwJScgZmlsdGVyPSd1cmwoI24pJy8+PC9zdmc+");
}
::selection { background: var(--accent); color: #15273C; }

/* ---------- Palco trascinabile ---------- */
.stage {
  position: fixed; inset: 0; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
  background: var(--bg);
  background-image:
    radial-gradient(120% 90% at 74% 6%, rgba(235,176,105,.16), transparent 55%),
    radial-gradient(140% 120% at 16% 100%, rgba(40,68,99,.6), transparent 60%),
    linear-gradient(160deg, #142a40 0%, #193453 55%, #1d3a5c 100%);
}
.stage.grabbing { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; z-index: 1; will-change: transform; transform-origin: 0 0; }
/* sfumatura scura in alto e in basso: nome, link e suggerimento restano leggibili sopra i video */
.stage::after {
  content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(12,24,38,.82), rgba(12,24,38,0) calc(104px + env(safe-area-inset-top, 0px))),
    linear-gradient(to top, rgba(12,24,38,.72), rgba(12,24,38,0) calc(90px + env(safe-area-inset-bottom, 0px)));
}
.stage-msg {
  position: fixed; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; font-family: var(--mono); font-size: 13px; color: var(--muted);
}

/* ---------- Riquadri ---------- */
.tile {
  position: absolute; left: 0; top: 0;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 12px 34px rgba(0,0,0,.38);
  background: var(--tile);
  transform-origin: center center;
  cursor: pointer;
  contain: layout paint;
}
/* bordo disegnato sopra il contenuto (e non come vero bordo): così video e copertina
   occupano tutto il riquadro e restano allineati ai pixel insieme alla cornice */
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10);
}
.tile.focus {
  box-shadow: 0 22px 56px rgba(0,0,0,.5), 0 0 0 2px var(--accent);
}
.tile.focus::after { border-color: var(--accent); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tile .grad,
.tile img,
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tile img, .tile video { object-fit: cover; }
.tile img { opacity: 0; transition: opacity .45s ease; }
.tile img.ready { opacity: 1; }
.tile video { opacity: 0; transition: opacity .3s ease; }
.tile video.playing { opacity: 1; }
.tile .shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(13,25,40,.48), transparent 56%); }
.tile .play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,38,60,0.55); border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.tile.focus .play, .tile:hover .play { opacity: 1; }
/* etichetta sui video caricati di recente */
.badge-new {
  position: absolute; top: 10px; left: 10px; z-index: 1; pointer-events: none;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #15273C; background: var(--accent); padding: 4px 8px 3px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

/* ---------- Intestazione ---------- */
.brand {
  position: fixed; z-index: 5; pointer-events: none;
  top: calc(20px + env(safe-area-inset-top, 0px)); left: 24px;
  display: flex; align-items: center; gap: 11px;
}
.brand img { height: 34px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-name {
  font-family: 'Archivo Expanded', var(--sans);
  font-weight: 700; font-size: 13px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink); line-height: 1;
}
.brand-tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); line-height: 1;
}
.links {
  position: fixed; z-index: 5; pointer-events: none;
  top: calc(22px + env(safe-area-inset-top, 0px)); right: 24px;
  display: flex; align-items: center; gap: 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
}
.links a { color: var(--muted); text-decoration: none; pointer-events: auto; transition: color .2s; display: inline-flex; align-items: center; }
.links a:hover, .links a:focus-visible { color: var(--accent); }
.links svg { display: none; width: 20px; height: 20px; }
/* telefono: icone al posto del testo, così c'è spazio e l'email resta raggiungibile */
@media (max-width: 600px) {
  .links { gap: 6px; top: calc(16px + env(safe-area-inset-top, 0px)); right: 12px; }
  .links a { width: 40px; height: 40px; justify-content: center; border-radius: 50%; color: var(--ink); background: rgba(12,24,38,.35); }
  .links .label { display: none; }
  .links svg { display: block; }
}

.hint {
  position: fixed; z-index: 5; pointer-events: none;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(147,166,188,.9); white-space: nowrap;
}
@media (max-width: 480px) { .hint { font-size: 9.5px; letter-spacing: .08em; } }
/* telefono in orizzontale: poco spazio in altezza → niente suggerimento, privacy in un angolo */
@media (max-height: 460px) {
  .hint { display: none; }
  .legal { left: auto; right: 24px; transform: none; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 9.5px; }
}
/* su touch screen il suggerimento cita anche lo zoom col pizzico */
.hint-touch { display: none; }
@media (hover: none) { .hint-mouse { display: none; } .hint-touch { display: inline; } }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(8,15,25,.92);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .35s, visibility 0s .35s;
  cursor: default;
}
.lightbox.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .35s; }
.lb-close {
  position: fixed; top: calc(18px + env(safe-area-inset-top, 0px)); right: 20px;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08);
  color: #fff; font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-close:hover { background: rgba(255,255,255,0.16); }
/* frecce precedente/successivo (computer); sul telefono si scorre col dito */
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08);
  color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding-bottom: 3px;
}
.lb-nav:hover { background: rgba(255,255,255,0.16); }
.lb-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
@media (hover: none) { .lb-nav { display: none; } }
.lb-inner.from-right { animation: lb-in-right .32s ease-out; }
.lb-inner.from-left { animation: lb-in-left .32s ease-out; }
@keyframes lb-in-right { from { opacity: 0; transform: translateX(48px); } }
@keyframes lb-in-left { from { opacity: 0; transform: translateX(-48px); } }
.lb-hint {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  color: var(--ink); background: rgba(12,24,38,.7); padding: 8px 14px; border-radius: 999px;
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.lb-hint.show { opacity: 1; }
.lb-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-inner { position: relative; }
.lb-inner video {
  /* svh = altezza con le barre del browser visibili (iPhone): il video non finisce sotto la barra */
  max-width: 92vw; max-height: calc(100vh - 140px); max-height: calc(100svh - 140px); width: auto; height: auto;
  border-radius: 16px; display: block; background: #000;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
@media (max-height: 500px) and (orientation: landscape) {
  .lb-inner video { max-height: calc(100vh - 32px); max-height: calc(100svh - 32px); max-width: calc(100vw - 150px); }
}
.lb-spin {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: var(--accent);
  animation: lb-spin .9s linear infinite; pointer-events: none;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }
.lb-msg {
  text-align: center; font-family: var(--mono); color: var(--ink);
  max-width: 520px; padding: 40px 28px; line-height: 1.7;
  border: 1px dashed rgba(255,255,255,0.22); border-radius: 18px; background: rgba(255,255,255,0.04);
}

.noscript {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); color: var(--muted);
}
@media (max-width: 380px) {
  .brand { left: 16px; gap: 9px; }
  .brand-name { font-size: 11.5px; }
  .links { right: 16px; font-size: 11px; }
}
/* telefoni molto stretti (320 px): logo e icone un po' più compatti, così il nome non le tocca */
@media (max-width: 340px) {
  .brand { left: 12px; gap: 7px; }
  .brand img { height: 28px; }
  .brand-name { font-size: 11px; letter-spacing: .01em; }
  .links { right: 8px; gap: 2px; }
  .links a { width: 36px; height: 36px; }
}

/* ---------- Link legale (home) ---------- */
.legal {
  position: fixed; z-index: 5;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)); right: 24px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(147,166,188,.75); text-decoration: none; transition: color .2s;
}
.legal:hover, .legal:focus-visible { color: var(--accent); }
@media (max-width: 760px) {
  /* su schermi stretti sta centrato sopra la scritta "Trascina per esplorare" */
  .legal { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(44px + env(safe-area-inset-bottom, 0px)); font-size: 9.5px; }
}

/* ---------- Pagine di testo (privacy) ---------- */
body.doc-page { overflow: auto; height: auto; min-height: 100%; }
.doc-head {
  max-width: 760px; margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 20px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.doc-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.doc-brand img { height: 30px; width: auto; display: block; }
.doc-back { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; }
.doc-back:hover, .doc-back:focus-visible { color: var(--accent); }
.doc {
  max-width: 760px; margin: 0 auto; padding: 40px 20px calc(80px + env(safe-area-inset-bottom, 0px));
  font-size: 16px; line-height: 1.7; color: #d9dee6;
}
.doc h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 800; line-height: 1.15; color: var(--ink); margin-bottom: 14px; }
.doc h2 { font-size: 19px; font-weight: 700; color: var(--ink); margin: 40px 0 10px; }
.doc h3 { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 18px 0 6px; }
.doc p, .doc ul { margin-bottom: 12px; }
.doc ul { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc strong { color: var(--ink); }
.doc a { color: var(--accent); text-underline-offset: 3px; }
.doc code { font-family: var(--mono); font-size: .9em; color: var(--ink); }
.doc-lead { font-size: 17px; color: var(--muted); }
.doc-updated { margin-top: 48px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); font-family: var(--mono); font-size: 12px; color: var(--muted); }
