/* ============================================================
   LIQUID GLASS SITE — palette dal logo
   azzurrino #8FE9F7 · blu #3B82D6 · viola #3D2B63 · navy #0A0E1E
   ============================================================ */

:root {
  --acc: 143, 233, 247; /* RGB accent: cambia col tema sezione */
  --cyan: rgb(var(--acc));
  --cyan-soft: rgba(var(--acc), 0.55);
  --cyan-faint: rgba(var(--acc), 0.18);
  --blue: #3B82D6;
  --violet: #3D2B63;
  --navy: #0A0E1E;
  --text: #EAF6FB;
  --text-dim: rgba(234, 246, 251, 0.55);

  /* spring/overshoot per i click, ease morbida per il resto */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.3, 1.18, 0.45, 1); /* overshoot leggero, piu' smooth */
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --glass-radius: 28px;
}

/* temi per sezione: dentro sezione 1 = verde, 2 = marrone, 3 = giallo */
body[data-accent="verde"]   { --acc: 108, 236, 158; }
body[data-accent="marrone"] { --acc: 222, 168, 106; }
body[data-accent="giallo"]  { --acc: 250, 216, 92; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip; /* piu' forte di hidden: blocca anche il pan laterale */
}

/* niente barra di scorrimento visibile (lo scroll funziona lo stesso) */
html {
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* vecchio Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;              /* Chrome / Safari / Android */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--navy);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; /* niente flash grigio al tap su mobile */
}

button {
  touch-action: manipulation; /* tap immediato, no zoom da doppio tap */
}

.media-card {
  touch-action: manipulation;
}

/* ============================================================
   SFONDO ANIMATO — deve muoversi bene per far vivere il glass
   ============================================================ */

.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  /* altezza = viewport GRANDE (barra browser nascosta): non cambia mai
     durante lo scroll -> lo sfondo non viene piu' ridimensionato/scattoso */
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  overflow: hidden;
  transform: translateZ(0); /* layer GPU dedicato: niente repaint durante lo scroll */
  /* lo sfondo vira sul colore della sezione aperta */
  transition: filter 1.3s var(--smooth);
}

body[data-accent="verde"] .bg {
  filter: hue-rotate(-58deg) saturate(1.05);
}

body[data-accent="marrone"] .bg {
  filter: hue-rotate(172deg) saturate(0.82) brightness(1.04);
}

body[data-accent="giallo"] .bg {
  filter: hue-rotate(-161deg) saturate(1.2) brightness(1.07);
}

.bg-gradient {
  position: absolute;
  inset: -20%;
  background:
    /* spotlight hero: luce che sale da dietro il contenuto */
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(var(--acc), 0.24), transparent 68%),
    /* nota azzurro chiaro in alto a sinistra */
    radial-gradient(ellipse 55% 45% at 8% 4%, rgba(120, 195, 255, 0.22), transparent 65%),
    /* nota blu chiaro grande in basso a destra */
    radial-gradient(ellipse 70% 55% at 90% 102%, rgba(96, 165, 240, 0.28), transparent 68%),
    /* azzurro tenue a meta' sinistra */
    radial-gradient(ellipse 45% 40% at -5% 58%, rgba(80, 150, 230, 0.14), transparent 65%),
    /* velo viola-blu profondo */
    radial-gradient(ellipse 70% 55% at 22% 14%, rgba(58, 60, 130, 0.30), transparent 62%),
    /* base navy spaziale, piu' chiara */
    linear-gradient(180deg, #0E1630 0%, #0A1226 55%, #081022 100%);
  animation: bgShift 44s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, -2%) scale(1.08); }
}

/* aurora: 3 blob oversized, blur statico, si muove SOLO transform */
.blob {
  position: absolute;
  filter: blur(90px) saturate(1.4);
  will-change: transform;
}

.blob-1 {
  width: 70vmax; height: 55vmax;
  top: -25%; left: -15%;
  border-radius: 58% 42% 47% 53% / 45% 58% 42% 55%;
  background: radial-gradient(closest-side, rgba(var(--acc), 0.34), transparent 70%);
  animation: drift1 42s ease-in-out infinite alternate;
}

.blob-2 {
  width: 60vmax; height: 60vmax;
  top: 20%; right: -22%;
  border-radius: 43% 57% 60% 40% / 55% 44% 56% 45%;
  background: radial-gradient(closest-side, rgba(70, 140, 220, 0.42), transparent 70%);
  animation: drift2 52s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

.blob-3 {
  width: 52vmax; height: 42vmax;
  bottom: -22%; left: 22%;
  border-radius: 52% 48% 41% 59% / 60% 43% 57% 40%;
  background: radial-gradient(closest-side, rgba(130, 190, 250, 0.26), transparent 70%);
  animation: drift3 34s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

@keyframes drift1 {
  from { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); }
  to   { transform: translate3d(6%, 5%, 0) rotate(9deg) scale(1.1); }
}
@keyframes drift2 {
  from { transform: translate3d(3%, -5%, 0) rotate(0deg) scale(1.06); }
  to   { transform: translate3d(-6%, 4%, 0) rotate(-7deg) scale(0.94); }
}
@keyframes drift3 {
  from { transform: translate3d(-4%, 3%, 0) rotate(-6deg) scale(1); }
  to   { transform: translate3d(5%, -4%, 0) rotate(5deg) scale(1.08); }
}

/* ============================================================
   GRIGLIA PROSPETTICA aqua (stile Spline/Webflow) — pavimento
   che sfuma in lontananza, scorrimento lento in avanti
   ============================================================ */

.bg-grid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  overflow: hidden;
  pointer-events: none;
  /* un'unica maschera radiale: dissolve in lontananza E ai lati = look infinito */
  -webkit-mask-image: radial-gradient(ellipse 115% 150% at 50% 108%, #fff 55%, transparent 96%);
  mask-image: radial-gradient(ellipse 115% 150% at 50% 108%, #fff 55%, transparent 96%);
  opacity: 0.6;
}

.bg-grid-plane {
  position: absolute;
  left: -260%;
  right: -260%;
  bottom: -34px;
  height: 520%; /* piu' lunga: sul telefono si vede bene fino all'orizzonte */
  background-image:
    linear-gradient(rgba(var(--acc), 0.26) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--acc), 0.26) 1px, transparent 1px);
  background-size: 40px 40px;
  /* statica: ruota attorno al bordo vicino, il piano recede all'orizzonte */
  transform-origin: 50% 100%;
  transform: perspective(700px) rotateX(58deg);
}

/* grana pre-cotta (PNG tile): materia senza costo CPU */
.bg-grain {
  position: absolute;
  inset: 0;
  background: url("../assets/noise-128.png") repeat;
  background-size: 128px;
  opacity: 0.05;
  mix-blend-mode: soft-light;
}

/* vignettatura: bordi scuri, centro vivo (profondita' cinematografica) */
.bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 42%, transparent 62%, rgba(3, 6, 18, 0.20) 100%),
    linear-gradient(180deg, rgba(3, 6, 18, 0.10), transparent 14%, transparent 86%, rgba(3, 6, 18, 0.14));
  pointer-events: none;
}

/* icone che salgono in loop (al posto delle palline) */
.particles { position: absolute; inset: 0; }

.particle {
  position: absolute;
  bottom: -36px;
  opacity: 0;
  animation: rise linear infinite;
  will-change: transform;
  filter: brightness(1.25) saturate(1.15);
}

@keyframes rise {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: var(--p-op, 0.4); }
  90%  { opacity: var(--p-op, 0.4); }
  100% { transform: translateY(-112vh) translateX(var(--p-sway, 30px)) rotate(var(--p-rot, 40deg)); opacity: 0; }
}

/* ============================================================
   GLASS — la ricetta base riutilizzata ovunque
   ============================================================ */

.glass-panel,
.section-bar,
.media-card {
  position: relative;
  isolation: isolate; /* contiene blend e backdrop root */
  border-radius: var(--glass-radius);
  border: none;
  /* tinta leggera (mai oltre ~0.18) + velo alto + sheen diagonale */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 38%, transparent 60%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.025) 30%, transparent 55%),
    linear-gradient(160deg, rgba(var(--acc), 0.07), rgba(255, 255, 255, 0.03) 40%, rgba(8, 12, 24, 0.14));
  /* FROST: il saturate e' cio' che separa il vetro vero dal blur slavato */
  -webkit-backdrop-filter: blur(14px) saturate(170%) brightness(1.08);
  backdrop-filter: blur(14px) saturate(170%) brightness(1.08);
  /* rim light coerente (luce da alto-sx) + inner glow + doppia ombra */
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.40),
    inset 0 -1px 1px rgba(var(--acc), 0.12),
    inset 1px 0 1px rgba(255, 255, 255, 0.10),
    inset -1px 0 1px rgba(255, 255, 255, 0.07),
    inset 0 0 26px rgba(var(--acc), 0.22),
    inset 0 -16px 30px rgba(4, 8, 24, 0.20),
    0 0 16px rgba(var(--acc), 0.15),
    0 12px 36px rgba(0, 0, 0, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* bordo GRADIENTE (mai solid piatto): luce forte alto-sx, ripresa accent basso-dx */
.glass-panel::before,
.section-bar::before,
.media-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.06) 38%,
    rgba(var(--acc), 0.32) 82%,
    rgba(255, 255, 255, 0.28)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.3s var(--smooth);
}

.section-bar:hover::before,
.media-card:hover::before { opacity: 1; }

/* flash azzurro alla pressione — feedback di click su tutti i rettangoli */
.section-bar::after,
.media-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(var(--acc), 0.30),
    rgba(var(--acc), 0.10) 75%
  );
  opacity: 0;
  transition: opacity 0.28s var(--smooth);
  pointer-events: none;
}

.section-bar:active::after,
.media-card:active::after {
  opacity: 1;
  transition-duration: 0.04s; /* si accende all'istante, si spegne morbido */
}

/* ============================================================
   VISTE + transizioni home <-> sezione
   ============================================================ */

.view {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: clamp(20px, 4vw, 48px);
  /* safe area per notch e barra gesture */
  padding-left: max(clamp(20px, 4vw, 48px), env(safe-area-inset-left));
  padding-right: max(clamp(20px, 4vw, 48px), env(safe-area-inset-right));
  padding-bottom: max(clamp(20px, 4vw, 48px), env(safe-area-inset-bottom));
}

.view.is-active { display: flex; }

.view-home.is-active { animation: viewIn 0.42s var(--spring-soft) both; }
.view-section.is-active { animation: viewIn 0.42s var(--spring-soft) both; }

.view.is-leaving {
  display: flex;
  animation: viewOut 0.2s var(--smooth) both;
  pointer-events: none;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(22px) scale(0.975); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes viewOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-14px) scale(0.98); }
}

/* ============================================================
   HOME — logo + 3 barre glass strette
   ============================================================ */

.home-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: clamp(16px, 5vh, 56px) 0 clamp(28px, 5vh, 52px);
}

.logo-wrap {
  position: relative;
  width: clamp(150px, 22vw, 220px);
  aspect-ratio: 1;
  animation: logoFloat 6s ease-in-out infinite alternate;
}

@keyframes logoFloat {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}

.logo-halo {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--acc), 0.35), transparent 68%);
  filter: blur(18px);
  animation: haloPulse 3.4s ease-in-out infinite alternate;
}

@keyframes haloPulse {
  from { opacity: 0.55; transform: scale(0.96); }
  to   { opacity: 1;    transform: scale(1.06); }
}

.logo {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(10, 14, 30, 0.6));
  user-select: none;
}

.site-name {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  /* gradiente che SCORRE dentro le lettere (estremi uguali = loop invisibile) */
  background: linear-gradient(
    100deg,
    var(--blue) 0%,
    #FFFFFF 22%,
    var(--cyan) 42%,
    #EAFBFF 52%,
    var(--cyan) 62%,
    var(--blue) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  animation: textFlow 7s linear infinite;
  /* glow azzurro (drop-shadow: funziona anche col testo sfumato) */
  filter:
    drop-shadow(0 0 14px rgba(var(--acc), 0.4))
    drop-shadow(0 0 44px rgba(var(--acc), 0.22));
}

@keyframes textFlow {
  to { background-position: -200% center; }
}

.tagline {
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  /* banda azzurra luminosa che scorre dentro le lettere */
  background: linear-gradient(
    100deg,
    rgba(234, 246, 251, 0.5) 0%,
    var(--cyan) 35%,
    #FFFFFF 50%,
    var(--cyan) 65%,
    rgba(234, 246, 251, 0.5) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text-dim); /* fallback */
  animation: textFlow 7s linear infinite;
  filter: drop-shadow(0 0 12px rgba(var(--acc), 0.35));
}

/* in edit mode i testi sfumati tornano pieni (serve vedere il cursore) */
body.edit-mode .site-name,
body.edit-mode .tagline {
  background: none;
  -webkit-text-fill-color: var(--text);
  animation: none;
  filter: none;
}

.tagline:empty { display: none; }

/* --- le 3 barre strette --- */

.section-bars {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.6vh, 24px);
  width: min(560px, 92vw);
  padding-bottom: 6vh;
}

.section-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px 26px;
  border-radius: 22px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
  transition:
    transform 0.32s var(--spring-soft),
    border-color 0.3s var(--smooth);
  transform-origin: center;
}

.section-bar:hover {
  transform: translateY(-4px) scale(1.025);
}

.section-bar:active {
  transform: translateY(0) scale(0.955);
  transition-duration: 0.08s;
}

/* click: press breve e morbido, poi la vista cambia */
.section-bar.is-pressed {
  animation: barPress 0.2s var(--spring-soft) both;
}

@keyframes barPress {
  0%   { transform: scale(1); }
  45%  { transform: scale(0.965); }
  100% { transform: scale(1.02); }
}

.bar-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  font-size: 1.25rem;
  color: var(--cyan);
  background: rgba(var(--acc), 0.10);
  border: 1px solid rgba(var(--acc), 0.42);
  text-shadow: 0 0 14px var(--cyan-soft);
  overflow: hidden;
  box-shadow:
    0 0 12px rgba(var(--acc), 0.28),
    inset 0 0 12px rgba(var(--acc), 0.2);
}

/* immagine dentro il riquadro-rombo (da media\icone\sezione-x.png) */
.bar-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.bar-text { flex: 1; min-width: 0; }

.bar-title {
  display: block;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bar-subtitle {
  display: block;
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.bar-arrow {
  color: var(--cyan);
  opacity: 0.7;
  transition: transform 0.4s var(--spring), opacity 0.3s;
}

.section-bar:hover .bar-arrow {
  transform: translateX(6px);
  opacity: 1;
}

/* ============================================================
   VISTA SEZIONE
   ============================================================ */

/* larghezza da telefono anche su desktop: colonna stretta come la home */
.view-section,
.view-item {
  align-items: stretch;
  gap: clamp(18px, 2.6vh, 26px);
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}

.view-item.is-active { animation: viewIn 0.42s var(--spring-soft) both; }

#item-content {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  align-self: center;
  padding-bottom: 4vh;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-radius: 22px;
}

.back-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  border: 1px solid rgba(var(--acc), 0.3);
  background: rgba(var(--acc), 0.08);
  color: var(--cyan);
  cursor: pointer;
  transition: transform 0.32s var(--spring-soft), background 0.3s;
  box-shadow:
    0 0 12px rgba(var(--acc), 0.28),
    inset 0 0 12px rgba(var(--acc), 0.2);
}

.back-btn:hover { transform: scale(1.1); background: rgba(var(--acc), 0.18); }
.back-btn:active { transform: scale(0.9); transition-duration: 0.1s; }

.section-header-text {
  flex: 1;
  min-width: 0;
  text-align: center; /* nome sezione centrato tra back e logo */
}

.section-header-text h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.section-header-text span {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* sottotitolo vuoto = non occupa spazio (in edit mode riappare col placeholder) */
#section-subtitle:empty { display: none; }
body.edit-mode #section-subtitle { display: inline-block; min-width: 140px; min-height: 1.2em; }
body.edit-mode #section-subtitle:empty::before { content: "tocca per il sottotitolo"; opacity: 0.35; }

.section-mini-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(10, 14, 30, 0.5));
  transition: filter 0.8s var(--smooth);
}

/* logo tintato col colore della sezione (resta ben leggibile) */
body[data-accent="verde"] .section-mini-logo {
  filter: hue-rotate(-52deg) saturate(1.15) brightness(1.05)
          drop-shadow(0 0 10px rgba(108, 236, 158, 0.5));
}

body[data-accent="marrone"] .section-mini-logo {
  /* seppia piena + spinta verso il rosso + scurito = marrone caldo */
  filter: sepia(1) saturate(2.6) hue-rotate(-20deg) brightness(0.8) contrast(1.05)
          drop-shadow(0 0 10px rgba(190, 120, 70, 0.55));
}

body[data-accent="giallo"] .section-mini-logo {
  filter: sepia(0.75) saturate(1.9) hue-rotate(10deg) brightness(1.15)
          drop-shadow(0 0 10px rgba(250, 216, 92, 0.5));
}

/* --- barre numerate: rettangoli lunghi e stretti, uno sopra l'altro --- */

.cards-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.2vh, 20px);
  width: min(560px, 100%);
  align-self: center;
  padding-bottom: 2vh;
}

.media-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 14px;
  cursor: pointer;
  border-radius: 22px; /* stessa roundness delle barre della home */
  transition: transform 0.32s var(--spring-soft), border-color 0.3s var(--smooth);
  /* entrata a cascata (leggera: transform+opacity) su tutti i device */
  animation: cardIn 0.45s var(--spring-soft) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* quadrato arrotondato per foto/video */
.slot-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(10, 14, 30, 0.35);
  border: 1px solid rgba(var(--acc), 0.2);
}

.slot-media img,
.slot-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* numero fantasma nel quadrato vuoto */
.slot-media .ph-num {
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(160deg, rgba(255,255,255,0.6), var(--cyan) 60%, var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.4;
}

.slot-media .card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* testo di descrizione sotto il quadrato */
.slot-desc {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  padding: 0 6px 4px;
  white-space: pre-line; /* rispetta gli a capo scritti dall'utente */
}

/* bandierine PNG inline al posto delle emoji 🇺🇸/🇲🇦 (Windows non le mostra) */
.flag-inline {
  display: inline-block;
  height: 1em;
  width: 1.38em;
  object-fit: contain;
  vertical-align: -0.12em;
}

/* in edit mode il quadrato diventa zona upload */
body.edit-mode .slot-media,
body.edit-mode .bar-icon {
  cursor: pointer;
  outline: 1.5px dashed rgba(var(--acc), 0.55);
  outline-offset: 3px;
}

body.edit-mode .slot-media::after {
  content: "＋ tocca per foto/video";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(10, 14, 30, 0.68);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.media-card:hover {
  transform: translateY(-3px) scale(1.02);
}

.media-card:active { transform: scale(0.955); transition-duration: 0.08s; }

/* barra sotto-sezione: rettangolo lungo e stretto, testo centrato */
.media-card.is-bar {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 16px 20px;
}

/* ✕ elimina sotto-sezione (solo in edit mode) */
.bar-del {
  display: none;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 120, 130, 0.55);
  background: rgba(255, 80, 90, 0.14);
  color: #FF97A0;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.25s var(--spring-soft), background 0.2s;
}

body.edit-mode .bar-del { display: grid; place-items: center; }
.bar-del:hover { background: rgba(255, 80, 90, 0.3); transform: translateY(-50%) scale(1.12); }

/* barra "＋ Aggiungi" in fondo alla lista (solo in edit mode) */
.add-bar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  border-radius: 22px;
  border: 1.5px dashed rgba(var(--acc), 0.5);
  background: rgba(var(--acc), 0.05);
  color: var(--cyan);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.32s var(--spring-soft), background 0.25s;
}

body.edit-mode .add-bar { display: flex; }
body.edit-mode .sub-label { max-width: calc(100% - 56px); } /* spazio per la ✕ */
.add-bar:hover { background: rgba(var(--acc), 0.12); transform: scale(1.015); }
.add-bar:active { transform: scale(0.97); }

.sub-label {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  /* glow molto diffuso: niente "banda" chiara dietro le scritte lunghe */
  text-shadow: 0 0 34px rgba(var(--acc), 0.22);
  /* 'pre': il testo NON va mai a capo da solo, solo dove c'e' Invio */
  white-space: pre;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}

/* hint cartella sotto la griglia */
.folder-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding-bottom: 6vh;
}

.folder-hint code {
  color: var(--cyan);
  background: rgba(var(--acc), 0.08);
  padding: 2px 8px;
  border-radius: 8px;
}

.card-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy);
  background: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-soft);
}

/* --- stato vuoto --- */

.empty-state {
  align-self: center;
  text-align: center;
  padding: clamp(28px, 6vw, 48px) clamp(24px, 7vw, 56px);
  margin-top: 4vh;
  max-width: min(440px, 100%);
}

.empty-icon { font-size: 2.6rem; margin-bottom: 14px; }

.empty-state p { font-size: 1.05rem; font-weight: 600; }

.empty-hint {
  margin-top: 10px;
  font-size: 0.88rem !important;
  font-weight: 400 !important;
  color: var(--text-dim);
  line-height: 1.7;
}

.empty-hint code {
  color: var(--cyan);
  background: rgba(var(--acc), 0.08);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.85em;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(6, 9, 22, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--smooth);
}

.lightbox.is-open { opacity: 1; pointer-events: auto; }

.lightbox-content {
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  padding: 14px;
  transform: scale(0.9);
  transition: transform 0.45s var(--spring);
}

.lightbox.is-open .lightbox-content { transform: scale(1); }

.lightbox-content img,
.lightbox-content video {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 28px);
  border-radius: calc(var(--glass-radius) - 12px);
}

.lightbox-close {
  position: absolute;
  top: clamp(14px, 3vw, 30px);
  right: clamp(14px, 3vw, 30px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.4s var(--spring), background 0.3s;
}

.lightbox-close:hover { transform: scale(1.12) rotate(90deg); background: rgba(var(--acc), 0.2); }

/* tasto schermo intero (in alto a sinistra) */
.lightbox-fs {
  position: absolute;
  top: clamp(14px, 3vw, 30px);
  left: clamp(14px, 3vw, 30px);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.4s var(--spring), background 0.3s;
  z-index: 2;
}

.lightbox-fs:hover { transform: scale(1.12); background: rgba(var(--acc), 0.2); }

/* su telefono: media a TUTTO schermo, senza cornice */
@media (max-width: 700px) {
  .lightbox { padding: 0; }

  .lightbox-content {
    max-width: 100vw;
    max-height: 100dvh;
    width: 100vw;
    padding: 0;
    border-radius: 0;
    background: #000;
    border: none;
    box-shadow: none;
  }

  .lightbox-content::before { display: none; }

  .lightbox-content img,
  .lightbox-content video {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    object-fit: contain;
    border-radius: 0;
  }
}

/* ============================================================
   MODALITÀ MODIFICA — tocca i testi e riscrivili
   ============================================================ */

.edit-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  gap: 10px;
  align-items: center;
}

.edit-fab button {
  display: grid;
  place-items: center;
  min-width: 50px;
  height: 50px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(var(--acc), 0.3);
  background: rgba(20, 28, 52, 0.65);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  color: var(--cyan);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(4, 8, 24, 0.5), inset 0 0 16px rgba(var(--acc), 0.12);
  transition: transform 0.32s var(--spring-soft), background 0.25s;
}

.edit-fab button[hidden] { display: none; }

/* sul sito pubblicato (statico) la modifica non esiste: matita nascosta */
body.static-site .edit-fab { display: none; }

.edit-fab button:hover { transform: scale(1.08); background: rgba(var(--acc), 0.16); }
.edit-fab button:active { transform: scale(0.94); transition-duration: 0.1s; }

.fab-save { color: #0A0E1E !important; background: var(--cyan) !important; box-shadow: 0 0 24px var(--cyan-soft) !important; }
.fab-cancel { width: 50px; padding: 0 !important; }

/* testi editabili evidenziati */
body.edit-mode [data-edit] {
  outline: 1.5px dashed rgba(var(--acc), 0.55);
  outline-offset: 4px;
  border-radius: 6px;
  cursor: text;
  min-width: 30px;
}

body.edit-mode [data-edit]:focus {
  outline-style: solid;
  outline-color: var(--cyan);
  background: rgba(var(--acc), 0.07);
}

/* in edit mode la tagline vuota si vede, con placeholder */
body.edit-mode .tagline { display: block !important; min-height: 1.3em; min-width: 180px; }
body.edit-mode .tagline:empty::before { content: "tocca per scrivere la tagline"; opacity: 0.35; }

/* in edit mode le barre non navigano: si naviga solo con la freccia */
body.edit-mode .section-bar { cursor: default; }
body.edit-mode .section-bar .bar-arrow { cursor: pointer; opacity: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
  transform: translateX(-50%) translateY(20px);
  z-index: 70;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(var(--acc), 0.35);
  background: rgba(20, 28, 52, 0.85);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--smooth), transform 0.4s var(--spring-soft);
}

.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 560px) {
  .section-bar { padding: 16px 18px; }
  .bar-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .media-card img, .media-card video { aspect-ratio: 1; }
}

/* ============================================================
   PERFORMANCE MOBILE — meno blur, meno layer, zero scatti
   ============================================================ */

@media (max-width: 700px) {
  /* blur ridotto (il costo cresce col quadrato del raggio) */
  .glass-panel,
  .section-bar {
    -webkit-backdrop-filter: blur(9px) saturate(150%) brightness(1.06);
    backdrop-filter: blur(9px) saturate(150%) brightness(1.06);
  }

  /* liste lunghe: NIENTE backdrop-filter (max 3-5 superfici blur su mobile).
     Il vetro e' simulato con fondo semi-opaco + stessi rim/bordi: identico a occhio. */
  .media-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 38%, transparent 60%),
      linear-gradient(120deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02) 30%, transparent 55%),
      linear-gradient(160deg, rgba(var(--acc), 0.10), rgba(20, 28, 52, 0.62) 45%, rgba(10, 15, 30, 0.72));
  }

  /* aurora: 2 blob, blur minore */
  .blob { filter: blur(64px) saturate(1.3); }
  .blob-3 { display: none; }
}

/* foto/video/icone appaiono con dissolvenza, mai di colpo */
.slot-media img,
.slot-media video,
.bar-icon img {
  opacity: 0;
  transition: opacity 0.45s var(--smooth);
}

.slot-media img.is-ready,
.slot-media video.is-ready,
.bar-icon img.is-ready {
  opacity: 1;
}

/* titolo della sotto-sezione: centrato, max 2 righe bilanciate */
.view-item .section-mini-logo { display: none; }

.view-item .section-header-text {
  text-align: center;
  padding-right: 44px; /* bilancia otticamente il tasto back a sinistra */
}

#item-title {
  font-size: 1.25rem; /* il JS la riduce finché il nome sta in UNA riga */
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
