/* Clash Display, servito da noi — 27/08/2026 (FIL-117 + SEC-2/F-24).
   Prima arrivava da api.fontshare.com con un <link> nell'index: ogni apertura
   della PWA raccontava a un terzo che qualcuno l'aveva aperta. I file sono gli
   stessi che usa la dashboard (src/app/fonts/), copiati qui perche' questa
   pagina e' HTML statico e non passa da next/font. */
@font-face {
  font-family: 'Clash Display';
  src: url('../fonts/ClashDisplay-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Clash Display';
  src: url('../fonts/ClashDisplay-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ─── Design Tokens ──────────────────────────────────────────────── */
/* Palette allineata 1:1 al monorepo — stessi valori di globals.css e
   tailwind.config.ts (bg/s1/s2/s3/wborder/wtext/wice/wmuted/wdim). Prima
   erano tutti "quasi uguali" ma non uguali: passando da Eventi/Portal a
   Foto WTC lo scarto si notava senza saperlo spiegare. Se cambia la palette
   di là, va cambiata anche qui. */
:root {
  --c-bg:         #0D0E14;  /* = bg      */
  --c-surface-01: #12131A;  /* = s1      */
  --c-surface-02: #181921;  /* = s2      */
  --c-surface-03: #1E202C;  /* = s3      */
  --c-border:     #2E3040;  /* = wborder */
  --c-border-dim: rgba(255,255,255,0.07);
  --c-text:       #F0F0F6;  /* = wtext — testo primario, NON bianco puro */
  --c-ice:        #D8D8E2;  /* = wice   */
  --c-text-muted: #8896A8;  /* = wmuted */
  --c-dim:        #556070;  /* = wdim   */
  --c-orange:     #F26522;
  --c-neon:       #FF7029;

  /* ── Raggi — scala Tailwind del monorepo ─────────────── */
  --radius-sm: 0.375rem;  /* 6px  = rounded-md  — voci di menu       */
  --radius-md: 0.5rem;    /* 8px  = rounded-lg  — bottoni, menu      */
  --radius-lg: 0.75rem;   /* 12px = rounded-xl  — righe, immagini    */
  --radius-xl: 1rem;      /* 16px = rounded-2xl — card, pannelli     */
  /* Le pill (999px) restano: il monorepo le usa ovunque, non sono
     un vezzo di quest'app. */

  /* ── Ombre — stessi valori del monorepo ──────────────── */
  --shadow-card:       inset 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.40), inset 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-menu:       0 16px 48px rgba(0,0,0,0.50);  /* = PlatformSwitcher */
  --shadow-float:      0 12px 40px rgba(0,0,0,0.50);
  --shadow-accent:     0 8px 28px rgba(242,101,34,0.45); /* = FloatingActionButton */
  --shadow-accent-sm:  0 4px 16px rgba(242,101,34,0.32);

  /* ── Superfici flottanti ─────────────────────────────── */
  /* Il monorepo non usa vetro colorato: superficie opaca + bordo hairline.
     Il blur resta SOLO dove serve leggibilità sopra contenuto arbitrario
     (come MobileHeader/BottomNav: bg-bg/70 + backdrop-blur-xl), ma senza
     saturate/brightness — quelli tingono lo sfondo e non esistono di là. */
  --surface-float:   rgba(24,25,33,0.92);   /* s2 @92% */
  --surface-scrim:   rgba(13,14,20,0.80);   /* bg @80% */
  --hairline:        rgba(255,255,255,0.07);
  --hairline-strong: rgba(255,255,255,0.11);
  --blur-chrome: blur(24px);  /* = backdrop-blur-xl */
  --blur-scrim:  blur(8px);   /* = backdrop-blur-sm */

  /* ── Tempi e curve ───────────────────────────────────── */
  /* Il monorepo ha DUE tempi distinti, non uno:
       · feedback immediato (hover, colore, opacità) → 0.12s
       · movimento (spring 340/30/0.9) → si assesta in ~0.30s
     Servono entrambi. Usare 0.12s anche per le cose che si spostano le fa
     sembrare "scattate": arrivano prima che l'occhio le segua. */
  --dur-fast: 0.12s;  /* colore, opacità, hover */
  --dur-base: 0.22s;  /* micro-spostamenti, uscite */
  --dur-slow: 0.30s;  /* entrate, sheet, pill che scorre */

  /* Decelerazione morbida ≈ risposta dello spring 340/30/0.9: ζ≈0.86, quindi
     sovraelongazione <1% (invisibile) e atterraggio dolce. Prima qui c'era la
     curva di CountUp, tarata su un conteggio da 0.9s: su uno spostamento da
     0.3s parte di scatto e poi striscia — è quello che non sembrava fluido. */
  --ease-out:  cubic-bezier(0.33, 1, 0.68, 1);
  /* Le uscite accelerano via: si tolgono di mezzo, non si fanno guardare. */
  --ease-in:   cubic-bezier(0.32, 0, 0.67, 0);
  --ease-snap: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Clash Display', system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em; /* = globals.css */
}

img, video { display: block; max-width: 100%; }
img[hidden] { display: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
p { line-height: 1.75; }
a { color: inherit; text-decoration: none; }

/* ─── Accessibility ──────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

::selection { background: rgba(242,101,34,0.25); color: #fff; }

:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ─── Background layers ──────────────────────────────────────────── */
/* Stessa griglia di /login e /piattaforme: 80px a 2.5%. Era 72px a 1.8% —
   passo e intensità diversi, quindi lo sfondo "non tornava" tra le app. */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
}

.ambient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.ambient-orb--top {
  top: -25%;
  right: -20%;
  width: 70vw;
  height: 65vh;
  background: radial-gradient(ellipse at center, rgba(242,101,34,0.06) 0%, transparent 65%);
  animation: drift-top 55s ease-in-out infinite;
}

.ambient-orb--bottom {
  bottom: -30%;
  left: -10%;
  width: 55vw;
  height: 55vh;
  background: radial-gradient(ellipse at center, rgba(242,101,34,0.03) 0%, transparent 65%);
  animation: drift-bottom 70s ease-in-out infinite;
}

@keyframes drift-top {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(-4%, 3%) scale(1.04); }
  66%       { transform: translate(3%, -2%) scale(0.97); }
}

@keyframes drift-bottom {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(5%, -4%) scale(1.05); }
  75%       { transform: translate(-3%, 2%) scale(0.96); }
}

/* ─── App Shell ──────────────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
}

/* ─── Header ─────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.375rem;
  padding-top: calc(0.9375rem + env(safe-area-inset-top));
  padding-bottom: 0.9375rem;
  background: var(--c-surface-01);
  border-bottom: 1px solid var(--c-border-dim);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-logo {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.app-header-spacer { flex: 1; }

/* Switcher piattaforma WTC (copia monorepo) — visibile SOLO online; stile nativo,
   trigger minimale come il brand-trigger dell'app (niente vetro/plastica). */
.platform-switcher { position: relative; flex-shrink: 0; }
.platform-switcher[hidden] { display: none; }
.platform-trigger {
  display: flex; align-items: center; gap: 5px;
  height: 34px; padding: 6px 10px;
  border-radius: var(--radius-md);
  background: none; border: none;
  color: var(--c-ice);
  font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.platform-trigger:hover { color: var(--c-text); background: rgba(255,255,255,0.04); }
.platform-chevron { color: var(--c-dim); transition: transform var(--dur-base) var(--ease-out); }
.platform-trigger[aria-expanded="true"] .platform-chevron { transform: rotate(180deg); }
/* Stessi valori di PlatformSwitcher.tsx: s1, bordo bianco 9%, ombra 16/48,
   padding 4px, voci rounded-md. È lo stesso controllo in due app: se qui
   fosse diverso si noterebbe proprio nel momento del passaggio. */
.platform-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; z-index: 60;
  background: var(--c-surface-01);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-menu);
  padding: 4px;
}
.platform-menu[hidden] { display: none; }
.platform-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 0.875rem; color: var(--c-text-muted);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.platform-item:hover:not(.is-current) { background: rgba(255,255,255,0.04); color: var(--c-text); }
.platform-item.is-current { background: rgba(255,255,255,0.05); color: var(--c-text); font-weight: 500; }
.platform-name { flex: 1; }
.platform-dot { width: 6px; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.20); flex-shrink: 0; }
.platform-dot.is-orange { background: var(--c-orange); }

/* ─── Text gradient (hero heading) ──────────────────────────────── */
.text-orange-gradient {
  background: linear-gradient(135deg, #F26522 0%, #FF7029 50%, #F26522 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* ─── Splash screen ──────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Durate fuori scala di proposito: sono accoppiate ai timer di
     dismissSplash() in app.js (680ms prima di sfumare, 580ms prima di
     rimuovere il nodo). Se cambi qui, cambia anche là o si sfasano. */
  transition: opacity 0.55s var(--ease-out);
}

.splash.out { opacity: 0; }

.splash-logo {
  height: 36px;
  width: auto;
  animation: splash-in 0.65s var(--ease-out) both;
}

@keyframes splash-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ─── State machine ──────────────────────────────────────────────── */
.state        { display: none; flex: 1; flex-direction: column; }
.state.active {
  display: flex;
  animation: state-enter var(--dur-slow) var(--ease-out) both;
}

@keyframes state-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Empty State Hero ───────────────────────────────────────────── */
#state-empty.active {
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

/* Preview mockup */
.hero-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.preview-frame {
  position: relative;
  width: min(300px, 80vw);
  /* aspect-ratio set dynamically by JS from overlay image dimensions */
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Niente aloni arancioni diffusi: il monorepo usa il glow accent solo sui
     CTA (FloatingActionButton), mai come luce ambientale su un contenitore. */
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.07),
    0 32px 88px rgba(0,0,0,0.75),
    0 8px 24px rgba(0,0,0,0.5);
  transition: aspect-ratio var(--dur-slow) var(--ease-out);
}

/* Rettangolo bianco su cui si vede l'overlay, e basta. Prima era una finta
   foto fatta di cinque gradienti: colori sbagliati e, essendo l'elemento più
   saturo della schermata, tingeva di blu la pagina intera. Il bianco è
   neutro (C*=0) e mostra l'overlay per quello che è. */
.preview-photo-bg {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
}

/* Actual WTC overlay applied on top */
.preview-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom center;
}

/* Corner brackets */
.preview-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--c-orange);
  border-style: solid;
  opacity: 0.7;
  filter: drop-shadow(0 0 4px rgba(242,101,34,0.5));
}
.preview-corner--tl { top: 6px; left: 6px;  border-width: 2px 0 0 2px; border-radius: 2px 0 0 0; }
.preview-corner--tr { top: 6px; right: 6px; border-width: 2px 2px 0 0; border-radius: 0 2px 0 0; }
.preview-corner--bl { bottom: 6px; left: 6px;  border-width: 0 0 2px 2px; border-radius: 0 0 0 2px; }
.preview-corner--br { bottom: 6px; right: 6px; border-width: 0 2px 2px 0; border-radius: 0 0 2px 0; }

/* "Frame WTC Services" badge */
.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: rgba(242,101,34,0.1);
  border: 1px solid rgba(242,101,34,0.2);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(242,101,34,0.9);
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.preview-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-orange);
  animation: badge-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* Hero text */
.hero-text {
  text-align: center;
  max-width: 360px;
}

.hero-heading {
  font-size: clamp(1.875rem, 6vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 0.875rem;
}

.hero-sub {
  font-size: 0.875rem;
  color: var(--c-text-muted);
  line-height: 1.7;
  max-width: 280px;
  margin: 0 auto;
}

/* CTA area */
.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/* Hero primary button */
.btn-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.9375rem 2.25rem;
  min-height: 54px;
  background: var(--c-orange);
  color: #fff;
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), background var(--dur-fast);
  /* Stesso glow del FloatingActionButton del monorepo, ma statico: là non
     respira. L'animazione infinita era l'unica cosa che pulsava in pagina. */
  box-shadow: var(--shadow-accent);
  border: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-hero:hover {
  background: var(--c-neon);
  transform: translateY(-1px);
}

.btn-hero:active { transform: scale(0.95); }

/* ─── Results: toolbar ───────────────────────────────────────────── */
#state-results.active {
  overflow: hidden;
}

.results-toolbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem 0.5rem;
  flex-shrink: 0;
}

.results-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.results-count-badge {
  font-family: 'Clash Display', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--c-orange);
  line-height: 1;
}

.results-label {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
}

.btn-reset {
  margin-left: auto;
}

/* ─── Photo Grid ─────────────────────────────────────────────────── */
.photo-grid {
  columns: 2;
  column-gap: 0.625rem;
  column-fill: balance; /* equalize column heights — true masonry */
  padding: 0.875rem 0.625rem calc(8rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  flex: 1;
}

/* ─── Photo Card ─────────────────────────────────────────────────── */
.photo-card {
  position: relative;
  display: block;
  break-inside: avoid;
  margin-bottom: 0.625rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--c-surface-02);
  box-shadow: var(--shadow-card);
  animation: card-enter var(--dur-slow) var(--ease-out) both;
  cursor: pointer;
}

/* Stessa entrata degli StaggerItem del monorepo (y 14px, scale 0.98): entra
   da sotto e si assesta. Prima partiva da scale(0.85) con rimbalzo. */
@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* = .card-lift di globals.css */
.photo-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.photo-card:active { transform: scale(0.95); }

/* Image drives card height at its natural aspect ratio */
.photo-card-img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform var(--dur-slow) var(--ease-out);
}

.photo-card:hover .photo-card-img { transform: scale(1.04); }

/* Gradient overlay with action buttons */
.photo-card-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 0.625rem 0.625rem;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.75) 0%,
    rgba(0,0,0,0.3) 60%,
    transparent 100%
  );
  display: flex;
  gap: 0.375rem;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--dur-fast);
}

/* Always show on touch devices */
@media (hover: none) { .photo-card-actions { opacity: 1; } }
.photo-card:hover .photo-card-actions { opacity: 1; }

/* Bottoni sulle card — superficie opaca + hairline, come i controlli del
   monorepo. Il blur resta perché stanno sopra la foto dell'utente. */
.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
  background: var(--surface-float);
  backdrop-filter: var(--blur-scrim);
  -webkit-backdrop-filter: var(--blur-scrim);
  border: 1px solid var(--hairline-strong);
  transition: background 0.12s ease-out, transform 0.12s var(--ease-snap);
}

.card-btn:active { transform: scale(0.95); }

.card-btn-save {
  background: var(--c-orange);
  color: #fff;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card-btn-save:hover { background: var(--c-neon); }

.card-btn-share {
  color: var(--c-text);
}
.card-btn-share:hover { background: rgba(255,255,255,0.08); }

/* Remove button — top-right corner of each card */
.card-btn-remove {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.80);
  z-index: 10;
  transition: background 0.12s, transform 0.12s var(--ease-snap);
  -webkit-tap-highlight-color: transparent;
}
.card-btn-remove:hover  { background: rgba(200,40,40,0.65); color: #fff; }
.card-btn-remove:active { transform: scale(0.95); }

/* WTC badge on card */
.photo-card-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.45rem;
  background: rgba(13,14,20,0.72); /* = bg @72% (era il vecchio #0A0B0F) */
  border: 1px solid rgba(242,101,34,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(242,101,34,0.9);
  backdrop-filter: blur(6px);
}

/* ─── Ghost Cards (placeholder while processing) ─────────────────── */
.ghost-card {
  position: relative;
  aspect-ratio: 4 / 3;
  break-inside: avoid;
  margin-bottom: 0.625rem;
  border-radius: var(--radius-xl);
  background: var(--c-surface-01);
  border: 1px solid var(--hairline);
  overflow: hidden;
}

.ghost-card-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.06) 40%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.06) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: glass-shimmer 1.6s ease-in-out infinite;
}

@keyframes glass-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* ─── Card Shimmer (during reprocessAll) ─────────────────────────── */
.card-shimmer {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.06);
  backdrop-filter: var(--blur-scrim);
  -webkit-backdrop-filter: var(--blur-scrim);
  border-radius: var(--radius-xl);
  animation: card-shimmer-pulse 0.9s ease-in-out infinite;
  z-index: 5;
  pointer-events: none;
}

@keyframes card-shimmer-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* ─── Buttons (generic) ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5625rem 1.125rem;
  min-height: 40px;
  border-radius: var(--radius-md);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s, transform 0.12s;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
}

.btn:active { transform: scale(0.95); } /* = active:scale-95 del monorepo */

.btn-primary {
  background: var(--c-orange);
  color: #fff;
}
.btn-primary:hover {
  background: var(--c-neon);
  box-shadow: var(--shadow-accent-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover {
  color: var(--c-text);
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}

.btn-outline-subtle {
  background: transparent;
  color: var(--c-ice);
  border: 1px solid var(--c-border);
}
.btn-outline-subtle:hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  min-height: 34px;
  font-size: 0.625rem;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ─── Bottom Bar ─────────────────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  /* = BottomNav del monorepo: bg semitrasparente + blur, bordo bianco 5%.
     Niente saturate/brightness (tingevano la foto sotto) né rim speculare. */
  background: var(--surface-scrim);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  border-top: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
}

.btn-icon-only {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-orange);
  border: none;
  box-shadow: var(--shadow-accent-sm);
  color: #fff;
  flex-shrink: 0;
  transition: background 0.12s, box-shadow 0.12s, transform 0.12s var(--ease-snap);
}

.btn-icon-only:active {
  transform: scale(0.95);
  background: var(--c-neon);
}

.btn-save-all {
  flex: 1;
  min-height: 46px;
  font-size: 0.75rem;
  box-shadow: var(--shadow-accent-sm);
}

/* ─── Control Bar ────────────────────────────────────────────────── */
/* Era "liquid glass" (rifrazione SVG + rim speculare + saturate/brightness).
   Ora usa lo STESSO trattamento della bottom bar qui sotto: scrim su base bg
   + blur. Prima stava al 92% con 24px di blur — a quell'opacità del blur si
   vede l'8%, quindi non era né vetro né superficie piena: era un residuo, e
   due superfici flottanti sovrapposte con opacità e base diverse stonavano.
   Un solo trattamento per il "chrome che galleggia", come MobileHeader e
   BottomNav nel monorepo. La pill resta: il monorepo usa pill ovunque. */
.overlay-control-bar {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px;
  background: var(--surface-scrim);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--shadow-float);
  max-width: calc(100vw - 2.5rem);
}

.control-bar-segment {
  display: flex;
  align-items: center;
  position: relative;
  padding: 2px;
  gap: 0;
}

.control-bar-divider {
  width: 1px;
  height: 20px;
  background: var(--hairline-strong);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Brand trigger button (single pill that opens the logo picker sheet) */
.brand-trigger-btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--dur-fast) var(--ease-out);
  color: var(--c-text-muted);
}

.brand-trigger-logo {
  height: 18px;
  width: auto;
  max-width: 74px;
  object-fit: contain;
  display: block;
  /* loghi raster ridotti: downscaling liscio, niente pixel-snapping */
}

.brand-trigger-chevron {
  color: var(--c-dim);
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease-out);
}

.brand-trigger-btn[aria-expanded="true"] .brand-trigger-chevron {
  transform: rotate(180deg);
}

/* Position buttons */
.overlay-pos-btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  border-radius: 999px;
  color: var(--c-text-muted);
  transition: color var(--dur-fast) var(--ease-out);
  background: none;
  border: none;
}

.overlay-pos-btn.active {
  color: var(--c-text);
}

.overlay-pos-btn svg {
  opacity: 0.6;
  transition: opacity var(--dur-fast);
}

.overlay-pos-btn.active svg {
  opacity: 1;
}

/* Sliding glass indicator pill — moves via CSS custom properties set by JS */
.control-bar-indicator {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: var(--pill-left, 2px);
  width: var(--pill-width, 60px);
  /* Stessa evidenziazione della voce attiva nel menu del monorepo (bianco 5-7%),
     senza rim speculare. */
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  transition:
    left var(--dur-slow) var(--ease-out),
    width var(--dur-base) var(--ease-out);
  pointer-events: none;
  z-index: 1;
}

/* ─── Control bar accent colors ─────────────────────────────────── */

/* Position indicator: always WTC orange */
.control-bar-pos-indicator {
  background: rgba(242, 101, 34, 0.18);
}

.overlay-pos-btn.active { color: var(--c-orange); }
.overlay-pos-btn.active svg { opacity: 1; }

/* Reprocessing: trigger button pulses while canvas work happens */
.overlay-control-bar.reprocessing .brand-trigger-btn {
  animation: indicator-pulse 0.7s ease-in-out infinite;
}

@keyframes indicator-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* Context-aware: Save All hidden until photos exist */
#btn-save-all[hidden] { display: none; }

/* ─── Install Banner ─────────────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.875rem 1rem;
  padding-bottom: calc(0.875rem + env(safe-area-inset-bottom));
  background: rgba(18, 19, 26, 0.96); /* = s1 */
  border-top: 1px solid rgba(242,101,34,0.2);
  backdrop-filter: var(--blur-chrome);
  animation: slide-up var(--dur-slow) var(--ease-out);
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.install-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.install-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  background: rgba(242,101,34,0.1);
  border: 1px solid rgba(242,101,34,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-orange);
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--c-ice);
  line-height: 1.5;
}

.install-banner-text strong { color: var(--c-text); }

.icon-share {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: middle;
  margin: 0 1px;
  color: var(--c-orange);
}

.install-banner-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--c-text-muted);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast), color var(--dur-fast);
  flex-shrink: 0;
}

.install-banner-close:hover { background: rgba(255,255,255,0.12); color: var(--c-text); }

/* ─── Reset button ───────────────────────────────────────────────── */
.btn-reset:hover {
  color: #f87171;
  border-color: rgba(248,113,113,0.25);
  background: rgba(248,113,113,0.05);
}

/* ─── Update Banner ──────────────────────────────────────────────── */
.update-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.875rem 1rem;
  padding-bottom: calc(0.875rem + env(safe-area-inset-bottom));
  background: rgba(18, 19, 26, 0.96); /* = s1 */
  border-top: 1px solid rgba(242,101,34,0.25);
  backdrop-filter: var(--blur-chrome);
  animation: slide-up var(--dur-slow) var(--ease-out);
}

.update-banner-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.update-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  background: rgba(242,101,34,0.1);
  border: 1px solid rgba(242,101,34,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-orange);
  flex-shrink: 0;
}

.update-banner-text {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--c-ice);
  line-height: 1.5;
}

.update-banner-text strong { color: var(--c-text); }

/* ─── Lightbox ───────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: var(--blur-scrim);
  -webkit-backdrop-filter: var(--blur-scrim);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 4.5rem;
  max-width: 100vw;
  max-height: 100dvh;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(100dvh - 8rem);
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  display: block;
  animation: lb-enter var(--dur-base) var(--ease-out) both;
}

@keyframes lb-enter {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-close {
  position: absolute;
  top: calc(1rem + env(safe-area-inset-top));
  right: 1rem;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-float);
  border: 1px solid var(--hairline-strong);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast);
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}

.lightbox-close:hover { background: rgba(30,32,44,0.94); } /* = s3 @94% */

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-float);
  border: 1px solid var(--hairline-strong);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast);
  backdrop-filter: blur(4px);
}

.lightbox-nav:hover { background: rgba(30,32,44,0.94); } /* = s3 @94% */
.lightbox-nav[hidden] { display: none; }
.lightbox-nav--prev { left: 0.75rem; }
.lightbox-nav--next { right: 0.75rem; }

/* Lightbox mini overlay picker */
.lightbox-overlay-picker {
  position: absolute;
  bottom: calc(3.25rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface-float);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-float);
  border-radius: 999px;
  padding: 4px;
  white-space: nowrap;
}

.lb-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, background 0.12s, transform 0.12s var(--ease-snap);
}
.lb-picker-btn.active {
  background: rgba(255,255,255,0.07);
  color: var(--c-text);
}
.lb-picker-btn:active { transform: scale(0.95); }

/* Brand logo images inside lightbox picker buttons */
.lb-brand-logo {
  height: 16px;
  width: auto;
  max-width: 64px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.5;
  transition: opacity var(--dur-fast), filter var(--dur-fast);
  /* loghi raster ridotti: downscaling liscio, niente pixel-snapping */
}

.lb-picker-btn.active .lb-brand-logo {
  filter: none;
  opacity: 1;
}

.lb-picker-divider {
  width: 1px;
  height: 18px;
  background: var(--hairline-strong);
  margin: 0 3px;
  flex-shrink: 0;
}

/* Sotto i 540px la riga non ci sta (misurato il 29/09: a 390px era larga 479px già
   con nove bottoni, 539px con undici, e ↖ ↗ restavano fuori dallo schermo). Va a capo
   sul divisore: i loghi sopra, le posizioni sotto. */
@media (max-width: 539px) {
  .lightbox-overlay-picker {
    flex-wrap: wrap;
    justify-content: center;
    width: max-content;
    max-width: calc(100vw - 1.5rem);
    border-radius: 20px;
    row-gap: 2px;
  }
  .lb-picker-divider {
    flex-basis: 100%;
    height: 0;
    margin: 0;
  }
}

.lightbox-counter {
  position: absolute;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 0.6875rem;
  color: var(--c-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ─── Animations: fade-in-down ───────────────────────────────────── */
@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
/* = globals.css */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-surface-02); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-border); }

/* ─── Reduced Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Control bar sopra le foto ──────────────────────────────────── */
/* Sopra la griglia lo sfondo può essere di qualsiasi colore (anche una foto
   chiarissima): stesso trattamento, solo più denso, per tenere leggibili
   loghi e icone. Unica differenza ammessa rispetto allo stato normale. */
.overlay-control-bar.over-photos {
  background: rgba(13, 14, 20, 0.92); /* = bg @92% */
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* ─── Bottom bar: button journey ─────────────────────────────────── */
/* Empty state: #btn-add is centered and pill-shaped with text */
.bottom-bar {
  justify-content: center;   /* centered when only one element */
}

.btn-add-pill {
  /* Override the circle from btn-icon-only */
  width: auto;
  min-width: 44px;
  height: 44px;
  padding: 0 1.375rem 0 1.125rem;
  border-radius: 999px;
  gap: 0.5rem;
  /* Smooth morph back to FAB */
  transition:
    width var(--dur-slow) var(--ease-out),
    padding var(--dur-slow) var(--ease-out),
    border-radius var(--dur-slow) var(--ease-out),
    box-shadow var(--dur-fast);
}

.btn-add-label {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  max-width: 140px;
  transition:
    max-width var(--dur-slow) var(--ease-out),
    opacity var(--dur-base) var(--ease-out);
}

/* Results state: pill collapses to FAB, Save All springs in */
.bottom-bar.has-photos {
  justify-content: space-between;
}

.bottom-bar.has-photos .btn-add-pill {
  width: 44px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}

.bottom-bar.has-photos .btn-add-label {
  max-width: 0;
  opacity: 0;
}

/* Save All enters with a spring from the right */
@keyframes save-all-enter {
  from { opacity: 0; transform: translateX(8px) scale(0.98); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

#btn-save-all.entering {
  animation: save-all-enter var(--dur-slow) var(--ease-out) both;
}

/* ─── Preview brand tabs ─────────────────────────────────────────── */
.preview-brand-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-float);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
}

.preview-brand-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s var(--ease-out);
}

.preview-brand-tab.active {
  background: rgba(242, 101, 34, 0.18);
}

.preview-tab-logo {
  height: 16px;
  width: auto;
  max-width: 66px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.38;
  transition: opacity var(--dur-base) var(--ease-out), filter var(--dur-base) var(--ease-out);
  /* loghi raster ridotti: downscaling liscio, niente pixel-snapping */
}

.preview-brand-tab.active .preview-tab-logo {
  filter: none;
  opacity: 1;
}

/* Dynamic gradient layer inside preview frame (non-WTC brands; WTC negli angoli in alto) */
.preview-dynamic-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.preview-dynamic-layer[hidden] { display: none; }

/* Gradient — default bottom anchor (centro / destra / sinistra) */
.preview-dynamic-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0) 42%);
  transition: background var(--dur-slow) var(--ease-out);
}

/* Gradient — top anchor (alto, e i due angoli in alto di FIL-287) */
.preview-dynamic-layer[data-position="alto"] .preview-dynamic-gradient,
.preview-dynamic-layer[data-position="alto-sinistra"] .preview-dynamic-gradient,
.preview-dynamic-layer[data-position="alto-destra"] .preview-dynamic-gradient {
  background: linear-gradient(to bottom, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0) 42%);
}

/* Logo — base: bottom-center */
.preview-dynamic-logo {
  position: absolute;
  bottom: 8%;
  top: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  height: 7%;
  width: auto;
  object-fit: contain;
  display: block;
  transition: bottom var(--dur-slow) var(--ease-out), top var(--dur-slow) var(--ease-out),
              left var(--dur-slow) var(--ease-out), right var(--dur-slow) var(--ease-out);
}

/* Logo — top-center (alto). FIL-287: i due angoli in alto prendono da qui
   l'altezza (top 5%); il lato lo danno le due regole di destra e sinistra
   qui sotto, che vengono DOPO e a parità di specificità vincono. */
.preview-dynamic-layer[data-position="alto"] .preview-dynamic-logo,
.preview-dynamic-layer[data-position="alto-sinistra"] .preview-dynamic-logo,
.preview-dynamic-layer[data-position="alto-destra"] .preview-dynamic-logo {
  bottom: auto;
  top: 5%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* Logo — bottom-right (destra), e in alto a destra */
.preview-dynamic-layer[data-position="destra"] .preview-dynamic-logo,
.preview-dynamic-layer[data-position="alto-destra"] .preview-dynamic-logo {
  left: auto;
  right: 4%;
  transform: none;
}

/* Logo — bottom-left (sinistra), e in alto a sinistra */
.preview-dynamic-layer[data-position="sinistra"] .preview-dynamic-logo,
.preview-dynamic-layer[data-position="alto-sinistra"] .preview-dynamic-logo {
  left: 4%;
  right: auto;
  transform: none;
}

/* ─── Logo picker backdrop + bottom sheet ────────────────────────── */
.logo-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdrop-in var(--dur-base) ease both;
}

.logo-picker-backdrop[hidden] { display: none; }

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Uscita: lo sheet scende e il velo sfuma, invece di sparire di colpo.
   Più rapida dell'entrata (0.22s contro 0.30s) e in accelerazione — una
   cosa che se ne va non deve farsi guardare. Vedi closeLogoPicker(). */
.logo-picker-backdrop.is-closing {
  animation: backdrop-out var(--dur-base) var(--ease-in) both;
}

@keyframes backdrop-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.logo-picker-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  z-index: 31;
  /* = pannello modale del monorepo (bg-s1, bordo bianco 10%, rounded-2xl).
     Via il rim speculare e il gradiente di "faccia": erano il vetro. */
  background: rgba(18, 19, 26, 0.97);
  border: 1px solid rgba(255,255,255,0.10);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  box-shadow: 0 -12px 60px rgba(0,0,0,0.65);
  animation: sheet-slide-up var(--dur-slow) var(--ease-out) both;
}

.logo-picker-sheet[hidden] { display: none; }

@keyframes sheet-slide-up {
  from { transform: translateX(-50%) translateY(100%); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.logo-picker-sheet.is-closing {
  animation: sheet-slide-down var(--dur-base) var(--ease-in) both;
}

@keyframes sheet-slide-down {
  from { transform: translateX(-50%) translateY(0);    opacity: 1; }
  to   { transform: translateX(-50%) translateY(100%); opacity: 0; }
}

.logo-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
  margin: 0.75rem auto 0.5rem;
  position: relative;
  z-index: 1;
}

.logo-sheet-list {
  padding: 0.25rem 0 0.5rem;
  position: relative;
  z-index: 1;
}

.logo-sheet-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  transition: background 0.12s;
}

.logo-sheet-item:last-child { border-bottom: none; }
.logo-sheet-item:active { background: rgba(255,255,255,0.04); }

.logo-sheet-logo {
  height: 22px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.45;
  transition: opacity var(--dur-fast), filter var(--dur-fast);
  flex-shrink: 0;
  /* loghi raster ridotti: downscaling liscio, niente pixel-snapping */
}

.logo-sheet-item.active .logo-sheet-logo {
  filter: none;
  opacity: 1;
}

.logo-sheet-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--c-text-muted);
  transition: color var(--dur-fast);
}

.logo-sheet-item.active .logo-sheet-name {
  color: var(--c-text);
}

.logo-sheet-check {
  color: var(--c-orange);
  opacity: 0;
  transition: opacity var(--dur-fast);
  flex-shrink: 0;
}

.logo-sheet-item.active .logo-sheet-check {
  opacity: 1;
}

/* ─── Tablet / Desktop ───────────────────────────────────────────── */
@media (min-width: 540px) {
  #state-empty.active { gap: 3rem; padding: 3rem 2rem; }

  .preview-frame { width: min(380px, 80vw); }

  .hero-heading { font-size: clamp(2.25rem, 5vw, 3rem); }

  .hero-sub { max-width: 340px; }

  .overlay-control-bar { max-width: 480px; }
}

@media (min-width: 768px) {
  #state-empty.active {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    padding: 2rem 4rem;
  }

  .hero-preview { order: 2; }
  .hero-text    { text-align: left; order: 1; }
  .hero-cta     { align-items: flex-start; order: 1; }

  /* Combine text + cta on left side */
  #state-empty .hero-text,
  #state-empty .hero-cta { max-width: 380px; }

  .photo-grid {
    columns: 3;
    column-gap: 1rem;
    padding: 1.25rem 1.5rem calc(7rem + env(safe-area-inset-bottom));
  }

  .bottom-bar {
    max-width: 600px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 1rem 1rem 0 0;
  }

  .overlay-control-bar {
    max-width: 560px;
  }
}

@media (min-width: 1024px) {
  .photo-grid { columns: 4; }
  .results-toolbar { padding: 1rem 1.75rem; }
}

@media (min-width: 540px) {
  .brand-trigger-btn { padding: 6px 14px; }
  .brand-trigger-logo { height: 14px; max-width: 60px; }
}

/* ─── Small iPhones (<=374px: SE 2/3, 375px) ─────────────────────
   Hero is tight but readable; control bar scales to ~240px width.
─────────────────────────────────────────────────────────────────── */
@media (max-width: 374px) {

  /* Slightly smaller position buttons */
  .overlay-pos-btn {
    width: 32px;
    height: 32px;
  }

  /* Tighter hero vertical rhythm */
  #state-empty.active {
    gap: 1.5rem;
    padding: 1.25rem 1rem;
  }

  /* Heading stays readable on 320px */
  .hero-heading {
    font-size: clamp(1.625rem, 8vw, 2rem);
  }

  /* Sub text fills narrow column */
  .hero-sub {
    max-width: 100%;
    font-size: 0.8125rem;
  }

  /* Preview frame fits without overflow */
  .preview-frame {
    width: min(240px, 88vw);
  }

  /* Splash proportional on small screen */
  .splash-logo { height: 28px; }

  /* Tighter header and bars */
  .app-header { padding-left: 1rem; padding-right: 1rem; }
  .bottom-bar { padding-left: 1rem; padding-right: 1rem; }

  /* Control bar max-width */
  .overlay-control-bar {
    max-width: calc(100vw - 1.5rem);
    padding: 3px;
  }

  .brand-trigger-btn { padding: 5px 8px; }
  .brand-trigger-logo { height: 11px; max-width: 46px; }

  .overlay-pos-btn {
    width: 28px;
    height: 28px;
  }

  .control-bar-divider { margin: 0 1px; }

  /* Grid fills narrow viewport */
  .photo-grid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    column-gap: 0.5rem;
  }
}

/* ─── iPhone SE 1st gen / very small (<=374px) ───────────────────── */
@media (max-width: 374px) {

  /* Further tighten header */
  .app-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Stack hero vertically with minimal gap */
  #state-empty.active {
    gap: 1.25rem;
    padding: 1.25rem 1rem;
  }

  /* Prevent heading overflowing 320px */
  .hero-heading {
    font-size: clamp(1.625rem, 8vw, 2rem);
  }

  /* Bottom bar tighter on 320px */
  .bottom-bar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Control bar: even tighter padding */
  .overlay-control-bar {
    padding: 3px;
    max-width: calc(100vw - 1.5rem);
  }

  .brand-trigger-btn { padding: 5px 6px; }
  .brand-trigger-logo { height: 10px; max-width: 42px; }

  .overlay-pos-btn {
    width: 28px;
    height: 28px;
  }

  .control-bar-divider {
    margin: 0 1px;
  }
}
