/* Estetica ripresa dall'app Next originale: scuro, serif, teatrale.
   Le molle di framer-motion (stiffness 80, damping 20) sono approssimate con
   cubic-bezier — vedi docs/adr/0002. */

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/playfair-display-92cdd45e.woff2") format("woff2");
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/geist-a83ed939.woff2") format("woff2");
}

:root {
  --bg: #000;
  --fg: #fff;
  --muted: #9ca3af;
  --muted-strong: #d1d5db;
  --line: rgba(255, 255, 255, 0.2);
  --card: rgba(0, 0, 0, 0.4);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, Arial, sans-serif;
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

/* Senza questo, qualunque regola di display su una classe rende inefficace
   l'attributo hidden: la stessa specificita', ma l'autore batte lo UA. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* --- Sfondo a tutta pagina ------------------------------------------------ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
}

.backdrop--gradient { filter: none; }

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@media (min-width: 768px) { .stage { padding: 2rem; } }

.stage__inner { width: 100%; max-width: 56rem; }
.stage__inner--narrow { max-width: 42rem; }
.stage__inner--wide { max-width: 64rem; }

/* --- Tipografia ----------------------------------------------------------- */

.display {
  font-family: var(--serif);
  font-weight: 300;
  text-align: center;
  text-wrap: balance;
  margin: 0 0 0.75rem;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  text-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.display--hero { font-size: clamp(3rem, 9vw, 4.5rem); margin-bottom: 1.5rem; }

.lede {
  text-align: center;
  color: var(--muted);
  font-size: 1.125rem;
  margin: 0 0 3rem;
}

.quote {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 5vw, 3rem);
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
  margin: 0;
  text-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.byline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.byline__name { font-size: 1.25rem; font-weight: 500; color: var(--muted-strong); margin: 0; }

.avatar {
  width: 6rem;
  height: 6rem;
  border-radius: 9999px;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.avatar--sm { width: 2.5rem; height: 2.5rem; border-width: 2px; }

/* --- Superfici ------------------------------------------------------------ */

.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) { .card { padding: 2rem; } }

.card + .card { margin-top: 1rem; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn--lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn--primary { background: #fff; color: #000; }
.btn--primary:hover { background: #e5e7eb; }
.btn--outline { background: transparent; border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.btn--outline:hover { background: rgba(255, 255, 255, 0.1); }
.btn--ghost { background: transparent; color: #fff; }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn--danger { background: transparent; border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.btn--danger:hover { background: rgba(248, 113, 113, 0.12); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn-row--start { justify-content: flex-start; }

/* --- Form ----------------------------------------------------------------- */

.field { margin-bottom: 1.5rem; }
.field > label { display: block; font-size: 1rem; font-weight: 500; margin-bottom: 0.5rem; }
.field__hint { display: block; color: var(--muted); font-size: 0.8125rem; margin-top: 0.375rem; }

.input, .textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: inherit;
  font-size: 1rem;
}

.input:focus, .textarea:focus { outline: 2px solid rgba(255, 255, 255, 0.5); outline-offset: 1px; }
.textarea { min-height: 8rem; resize: vertical; }
input[type="file"] { color: var(--muted); font-size: 0.875rem; }

.errors {
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.errors ul { margin: 0; padding-left: 1.25rem; }

/* --- Header --------------------------------------------------------------- */

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}

.masthead__brand { font-family: var(--serif); font-size: 1.25rem; text-decoration: none; }
.masthead__nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.masthead__nav a, .masthead__nav button { font-size: 0.875rem; }

.flash {
  position: relative;
  z-index: 2;
  margin: 1rem auto;
  max-width: 56rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9375rem;
}

.flash--alert { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.1); color: #fca5a5; }

/* --- Elenchi -------------------------------------------------------------- */

.page { position: relative; z-index: 1; max-width: 56rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page--wide { max-width: 64rem; }

.section-title { font-family: var(--serif); font-weight: 300; font-size: 1.5rem; margin: 2.5rem 0 1rem; }
.section-title:first-of-type { margin-top: 1rem; }

.empty { color: var(--muted); font-style: italic; }

.filtro {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 2rem;
}

.filtro .input { flex: 1; }

.phrase-card { display: flex; gap: 1.25rem; align-items: flex-start; }
.phrase-card__thumb {
  width: 6rem;
  height: 6rem;
  flex: none;
  border-radius: 0.5rem;
  background-size: cover;
  background-position: center;
}
.phrase-card__body { flex: 1; min-width: 0; }
.phrase-card__quote { font-family: var(--serif); font-size: 1.375rem; font-weight: 300; margin: 0 0 0.5rem; }
.phrase-card__meta { color: var(--muted); font-size: 0.875rem; margin: 0 0 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.phrase-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.phrase-card__owner { color: var(--muted); font-size: 0.875rem; }

.badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.badge--draft { background: rgba(250, 204, 21, 0.15); color: #fde68a; }
.badge--public { background: rgba(74, 222, 128, 0.15); color: #bbf7d0; }

.roster { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.roster li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.625rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.roster li:last-child { border-bottom: 0; }
.roster time { color: var(--muted); font-size: 0.875rem; }

/* --- Animazioni ----------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .enter { animation: enter 0.6s var(--spring) both; }
  .enter-up { animation: enter-up 0.7s var(--spring) both; }
  .enter-pop { animation: enter-pop 0.7s var(--spring) both; }
  .delay-1 { animation-delay: 0.2s; }
  .delay-2 { animation-delay: 0.35s; }
  .delay-3 { animation-delay: 0.5s; }
  .delay-4 { animation-delay: 0.7s; }
  .pulse { animation: pulse 3s ease-in-out infinite; }
}

@keyframes enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes enter-up { from { opacity: 0; transform: translateY(50px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes enter-pop { from { opacity: 0; transform: scale(0) rotate(-180deg); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1) rotate(0); } 33% { transform: scale(1.1) rotate(5deg); } 66% { transform: scale(1.1) rotate(-5deg); } }

/* --- Ruota ---------------------------------------------------------------- */

.wheel { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 1.5rem; padding: 2rem 0 3rem; }
.wheel__name { font-family: var(--serif); font-weight: 300; font-size: clamp(2.25rem, 7vw, 3.75rem); text-align: center; text-wrap: balance; margin: 0; text-shadow: 0 25px 50px rgba(0, 0, 0, 0.5); }
.wheel__label { display: inline-block; padding: 0.25rem 1rem; border-radius: 9999px; background: rgba(255, 255, 255, 0.2); backdrop-filter: blur(8px); margin-bottom: 1rem; }
.wheel__trophy { font-size: 3.5rem; line-height: 1; }
.wheel[data-spinning="true"] .wheel__name { opacity: 0.85; }
