/* ==========================================================================
   Ricordi — token di design
   Palette ispirata a un tramonto da festa: inchiostro/prugna profondi con
   un bagliore ambrato, come la luce calda di un flash o del sole al calare
   della sera. Titoli in Fraunces (serif calda, da "copertina di album"),
   testo in Inter.
   ========================================================================== */

:root {
  --ink-deep: #140d22;
  --ink: #1d1330;
  --plum: #3a2350;
  --plum-soft: #4d3164;
  --amber: #f0a154;
  --amber-soft: #f7c78a;
  --rose: #e4637d;
  --cream: #fbf2e7;
  --paper: #fffaf3;
  --text-dim: rgba(251, 242, 231, 0.72);
  --text-faint: rgba(251, 242, 231, 0.5);

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow-soft: 0 20px 50px rgba(10, 6, 20, 0.45);
  --shadow-card: 0 12px 28px rgba(10, 6, 20, 0.35);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--cream);
  background:
    radial-gradient(circle at 20% -10%, rgba(240, 161, 84, 0.18), transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(228, 99, 125, 0.12), transparent 40%),
    linear-gradient(180deg, var(--ink-deep) 0%, var(--ink) 45%, var(--plum) 100%);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
}

input[type="text"],
input[type="password"] {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(251, 242, 231, 0.25);
  background: rgba(251, 242, 231, 0.06);
  color: var(--cream);
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-faint);
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--amber-soft);
  background: rgba(251, 242, 231, 0.1);
}

/* --------------------------------------------------------------------------
   Bottoni
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--amber-soft);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--amber);
  color: var(--ink-deep);
  box-shadow: 0 10px 24px rgba(240, 161, 84, 0.3);
}

.btn-primary:hover {
  background: var(--amber-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 1.5px solid rgba(251, 242, 231, 0.35);
}

.btn-ghost:hover {
  border-color: var(--amber-soft);
  color: var(--amber-soft);
}

.btn-small {
  padding: 9px 18px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}

.btn-warning {
  background: #d98c3f;
  color: #fff;
}

/* --------------------------------------------------------------------------
   Layout pagina pubblica
   -------------------------------------------------------------------------- */

#page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 22px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 14px;
}

.hero-subtitle {
  color: var(--text-dim);
  font-size: 1.02rem;
  max-width: 46ch;
  margin: 0 auto;
}

.no-event {
  max-width: 520px;
  margin: 18vh auto 0;
  text-align: center;
  padding: 0 24px;
}

.no-event h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 12px;
}

.no-event p {
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Sezione di caricamento — il pulsante "otturatore"
   -------------------------------------------------------------------------- */

.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 12px 0 36px;
}

.shutter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.shutter-ring {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 5px solid var(--amber-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 34px rgba(240, 161, 84, 0.32);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.shutter-dot {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, var(--amber-soft), var(--amber) 55%, #c97a30 100%);
}

.shutter-btn:active .shutter-ring {
  transform: scale(0.9);
  box-shadow: 0 6px 16px rgba(240, 161, 84, 0.4);
}

.shutter-btn:focus-visible .shutter-ring {
  outline: 2px solid var(--amber-soft);
  outline-offset: 4px;
}

.shutter-label {
  font-weight: 600;
  color: var(--cream);
  font-size: 0.98rem;
}

.selection-info {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Barra di avanzamento
   -------------------------------------------------------------------------- */

.progress-section {
  text-align: center;
  padding: 8px 0 32px;
}

.progress-section p {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(251, 242, 231, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--rose));
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* --------------------------------------------------------------------------
   Esito caricamento
   -------------------------------------------------------------------------- */

.result-section {
  text-align: center;
  padding: 8px 0 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.result-section p {
  font-size: 1.05rem;
  margin: 0;
  max-width: 40ch;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 500;
}

.flash-overlay.flash-anim {
  animation: flashPulse 0.6s ease-out;
}

@keyframes flashPulse {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Galleria — carte in stile "polaroid"
   -------------------------------------------------------------------------- */

.gallery-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0 0 18px;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 20px;
  padding-bottom: 20px;
}

.polaroid {
  background: var(--paper);
  padding: 8px 8px 22px;
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.polaroid:hover,
.polaroid:focus-visible {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 0 18px 34px rgba(10, 6, 20, 0.45);
}

.polaroid img,
.polaroid video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  background: #000;
}

.polaroid .badge {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 0.62rem;
  background: rgba(28, 19, 48, 0.75);
  color: var(--cream);
  padding: 2px 9px;
  border-radius: 20px;
}

/* --------------------------------------------------------------------------
   Modali (inserimento nome, lightbox)
   -------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 20, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}

.modal-card {
  background: var(--ink);
  border: 1px solid rgba(251, 242, 231, 0.12);
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.modal-card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.modal-card p {
  color: var(--text-dim);
  margin: 0 0 20px;
  font-size: 0.92rem;
}

.modal-card input {
  margin-bottom: 16px;
  text-align: center;
}

.modal-card .btn {
  width: 100%;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 450;
  padding: 30px 16px;
}

.lightbox-content {
  max-width: 100%;
  max-height: 100%;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  box-shadow: var(--shadow-soft);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: rgba(251, 242, 231, 0.1);
  border: none;
  color: var(--cream);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(251, 242, 231, 0.2);
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
  #page {
    padding-top: 64px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Movimento ridotto
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
