/* =========================================================
   ETNA TUNING CLUB · REUNION
   Per adattare i colori alle vostre grafiche basta
   cambiare le variabili qui sotto.
   ========================================================= */
:root {
  --basalto:   #2a2624;   /* sfondo pagina */
  --basalto-2: #36302c;   /* riquadri */
  --basalto-3: #4a423c;   /* bordi */
  --cenere:    #a39a90;   /* testo secondario */
  --testo:     #f1ebe3;   /* testo principale */
  --lava:      #ff5b1a;   /* colore d'accento */
  --lava-2:    #d9430b;
  --zolfo:     #f3c536;   /* cartellino indizio, focus */
  --carta:     #ece5d8;   /* cornice foto indizio */
  --inchiostro:#2a2624;

  --display: 'Saira Extra Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --body:    'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max: 1180px;
  /* margini laterali che rispettano notch e bordi curvi dei telefoni */
  --pad-l: max(1.5rem, env(safe-area-inset-left));
  --pad-r: max(1.5rem, env(safe-area-inset-right));
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 70% 55% at 88% -8%, rgba(255, 91, 26, .22), transparent 70%),
    var(--basalto);
  background-attachment: fixed;
  color: var(--testo);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(255, 91, 26, .25);
}

img { max-width: 100%; display: block; }
a { color: var(--zolfo); text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--zolfo); outline-offset: 3px; }

h1, h2 { font-family: var(--display); font-weight: 800; font-style: italic; line-height: .95; margin: 0 0 .5em; letter-spacing: .01em; }
h2 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
p { margin: 0 0 1em; }
.small { font-size: .92rem; color: var(--cenere); }

/* ---------- barra in alto ---------- */
.topbar {
  max-width: var(--max); margin: 0 auto;
  padding: max(1.1rem, env(safe-area-inset-top)) var(--pad-r) 1.1rem var(--pad-l);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 1.3rem; letter-spacing: .03em; color: var(--testo); text-decoration: none; }
.brand:hover { color: var(--testo); }
.brand-con-logo { display: block; line-height: 0; }
.brand-logo { height: 68px; width: auto; max-width: min(220px, 55vw); object-fit: contain; }
.logo-anteprima { display: inline-block; padding: 1rem; margin-bottom: 1rem; background: var(--basalto); border: 1px dashed var(--basalto-3); }
.logo-anteprima img { max-height: 90px; width: auto; }
.topbar-link { display: inline-block; padding: .35rem 0; color: var(--testo); font-weight: 600; margin-left: 1.2rem; text-decoration: none; border-bottom: 2px solid var(--lava); padding-bottom: 2px; }
.topbar-link:hover { color: var(--lava); }
.topbar-link:first-child { margin-left: 0; }

main { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad-r) 0 var(--pad-l); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 5vw, 5rem);
  align-items: start; padding: clamp(1.5rem, 5vw, 4rem) 0 clamp(3rem, 7vw, 6rem);
}
.kicker { font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 3vw, 2rem); color: var(--lava); margin: 0; }
h1 {
  font-size: clamp(3.6rem, 17vw, 11rem); line-height: .8; margin: 0 0 .25em -.04em;
  color: var(--testo);
  text-shadow: 0 .04em 0 var(--lava-2);
}
.lede { font-size: 1.2rem; max-width: 34ch; margin-bottom: 2rem; }

.facts { margin: 0 0 2.2rem; display: grid; gap: 0; border-top: 1px solid var(--basalto-3); }
.facts > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .95rem 0; border-bottom: 1px solid var(--basalto-3); }
.facts dt { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--cenere); line-height: 1.2; }
.facts dd { margin: 0; max-width: 40ch; overflow-wrap: anywhere; }
.countdown { display: inline-block; margin-top: .4rem; font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.4rem; color: var(--lava); line-height: 1; }

.btn {
  display: inline-block; font: inherit; font-family: var(--display); font-weight: 800; font-style: italic;
  font-size: 1.45rem; letter-spacing: .02em; line-height: 1;
  padding: .75rem 1.6rem .8rem; border: 0; cursor: pointer; text-decoration: none;
  background: var(--lava); color: #1b1310;
  clip-path: polygon(0.6rem 0, 100% 0, calc(100% - .6rem) 100%, 0 100%);
}
.btn:hover { background: var(--zolfo); color: #1b1310; }
.btn-sec { background: var(--basalto-3); color: var(--testo); font-size: 1.15rem; }
.btn-link { background: none; border: 0; padding: 0; color: var(--lava); font: inherit; font-size: .9rem; cursor: pointer; text-decoration: underline; }

/* ---------- indizio (foto reperto) ---------- */
.hero-clue { padding-top: 1.5rem; }
.reperto {
  position: relative; margin: 0; background: var(--carta); color: var(--inchiostro);
  padding: .9rem .9rem 1rem; transform: rotate(-2deg);
  box-shadow: 0 2px 0 rgba(0,0,0,.25), 0 40px 70px -28px rgba(255, 91, 26, .55);
  animation: posa .9s cubic-bezier(.2,.9,.25,1.15) .15s both;
}
.reperto img { width: 100%; height: auto; background: #cfc6b6; }
.reperto figcaption { font-family: var(--display); font-weight: 600; font-size: 1.35rem; padding-top: .7rem; line-height: 1.1; }
.tag {
  position: absolute; top: -1rem; right: -.8rem; z-index: 2;
  background: var(--zolfo); color: #1b1310;
  font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.3rem; line-height: 1;
  padding: .55rem .9rem .55rem 1.6rem; transform: rotate(5deg);
  clip-path: polygon(.7rem 0, 100% 0, 100% 100%, .7rem 100%, 0 50%);
  box-shadow: 0 6px 14px rgba(0,0,0,.3);
}
.tag::before { /* foro del cartellino */
  content: ""; position: absolute; left: .75rem; top: 50%; width: .4rem; height: .4rem; margin-top: -.2rem;
  border-radius: 50%; background: var(--basalto);
}
.reperto-vuoto { min-height: 320px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 3rem 2rem; }
.reperto-vuoto p { font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.15; max-width: 16ch; margin: 0; }
.clue-text { margin: 1.8rem 0 0; }
.clue-note { margin: 1.6rem 0 0; color: var(--cenere); font-size: .95rem; max-width: 42ch; }

@keyframes posa {
  from { opacity: 0; transform: translateY(-24px) rotate(4deg); }
  to   { opacity: 1; transform: translateY(0) rotate(-2deg); }
}

.archivio { margin-top: 1.8rem; }
.archivio p { font-family: var(--display); font-weight: 600; font-size: 1.2rem; margin-bottom: .6rem; }
.archivio ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .7rem; }
.archivio a { display: block; width: 84px; text-decoration: none; color: var(--cenere); font-size: .85rem; }
.archivio img { width: 84px; height: 84px; object-fit: cover; border: 3px solid var(--carta); filter: grayscale(.6); }
.archivio a:hover img { filter: none; }

/* ---------- modulo ---------- */
.partecipa {
  display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(3rem, 6vw, 5rem) 0; border-top: 4px solid var(--lava);
}
.partecipa-intro p { max-width: 38ch; }
.modulo { background: var(--basalto-2); padding: clamp(1.3rem, 3vw, 2.2rem); display: grid; gap: 1.15rem; }
.modulo-chiuso p { font-family: var(--display); font-size: 1.6rem; margin: 0; }
.campo { display: grid; gap: .35rem; }
.campo > span { font-weight: 600; }
.campo small { color: var(--cenere); font-size: .85rem; }
.campo-doppio { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=date], input[type=time], textarea {
  color-scheme: dark;
  width: 100%; font: inherit; color: var(--testo);
  background: var(--basalto); border: 1px solid var(--basalto-3); border-bottom: 2px solid var(--cenere);
  padding: .7rem .8rem; border-radius: 0;
}
input::placeholder, textarea::placeholder { color: #7c736a; }
input:focus, textarea:focus { outline: none; border-bottom-color: var(--zolfo); background: #231f1d; }
input[type=file] { font: inherit; color: var(--cenere); }
.check { display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin: .2rem 0 0; accent-color: var(--lava); flex: none; }
.modulo .btn { justify-self: start; margin-top: .3rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.avviso { padding: .9rem 1.1rem; border-left: 4px solid; }
.avviso p { margin: 0; }
.avviso p + p { margin-top: .35rem; }
.avviso-errore { background: rgba(255, 91, 26, .12); border-color: var(--lava); }
.avviso-ok { background: rgba(243, 197, 54, .12); border-color: var(--zolfo); margin-bottom: 1.2rem; }

/* ---------- tabella pubblica ---------- */
.lista { padding: clamp(3rem, 6vw, 5rem) 0; border-top: 1px solid var(--basalto-3); }
.lista-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.contatore { color: var(--cenere); margin: 0; }
.contatore strong { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 3rem; color: var(--lava); margin-right: .2rem; line-height: 1; }
.tabella-wrap { overflow-x: auto; margin-top: 1rem; }
.tabella { width: 100%; border-collapse: collapse; font-size: 1rem; }
.tabella th {
  text-align: left; font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: var(--cenere);
  padding: .6rem .8rem; border-bottom: 2px solid var(--lava); white-space: nowrap;
}
.tabella td { padding: .75rem .8rem; border-bottom: 1px solid var(--basalto-3); vertical-align: top; }
.tabella td:first-child { color: var(--cenere); width: 3rem; }
.tabella .nick { font-weight: 600; color: var(--zolfo); overflow-wrap: anywhere; min-width: 7rem; }
.tabella td:nth-child(2) { white-space: nowrap; }
.tabella .sospetto { font-style: italic; min-width: 9rem; }
.tabella tr.nuovo td { background: rgba(243, 197, 54, .1); }
.muto { color: #7c736a; font-style: normal; }
.vuoto { color: var(--cenere); font-size: 1.1rem; }

/* ---------- footer / disclaimer ---------- */
.footer { background: #221f1d; border-top: 1px solid var(--basalto-3); margin-top: 2rem; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 3rem var(--pad-r) max(4rem, calc(2rem + env(safe-area-inset-bottom))) var(--pad-l); columns: 2 22rem; column-gap: 3rem; }
.footer h2 { font-size: 2rem; column-span: all; margin-bottom: 1.2rem; }
.footer p { color: var(--cenere); font-size: .95rem; break-inside: avoid; }
.footer .canali { color: var(--testo); }
.footer .privacy { font-size: .85rem; }

/* ---------- admin ---------- */
.admin-main { max-width: 900px; padding-bottom: 4rem; }
.admin-box { margin: 2rem 0; }
.login { max-width: 420px; margin: 4rem auto; }
.login h1 { font-size: 3rem; }
.admin-indizi { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.admin-indizi li { display: flex; gap: 1rem; align-items: center; background: var(--basalto-2); padding: .6rem; }
.admin-indizi img { width: 90px; height: 90px; object-fit: cover; }
.admin-indizi form { margin-top: .3rem; }
.admin .avviso { margin: 1rem 0; }

/* ---------- responsive ---------- */

/* Tablet, fold aperti, telefoni in orizzontale: una colonna */
@media (max-width: 860px) {
  .hero, .partecipa { grid-template-columns: 1fr; }
  .hero { padding-top: 1rem; }
  .hero-clue { max-width: 560px; width: 100%; padding-top: 0; justify-self: center; }
  .partecipa-intro p { max-width: none; }
}

/* Fold aperti in verticale e telefoni: la tabella diventa una lista di schede */
@media (max-width: 760px) {
  .tabella thead { position: absolute; left: -9999px; }
  .tabella, .tabella tbody, .tabella tr, .tabella td { display: block; width: 100%; }
  .tabella-wrap { overflow: visible; }
  .tabella tr { border-bottom: 1px solid var(--basalto-3); padding: .9rem 0; }
  .tabella td { border: 0; padding: .2rem 0; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .6rem; }
  .tabella td::before { content: attr(data-label); color: var(--cenere); font-size: .88rem; font-weight: 400; font-style: normal; padding-top: .1rem; }
  .tabella td:first-child { display: block; font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.3rem; color: var(--lava); line-height: 1; padding-bottom: .35rem; }
  .tabella td:first-child::before { content: "#"; font: inherit; color: inherit; }
  .tabella tr.nuovo { background: rgba(243, 197, 54, .1); }
  .tabella tr.nuovo td { background: none; }

  .tabella td { overflow-wrap: anywhere; white-space: normal; }
}

/* Fold aperti: schede su due colonne */
@media (min-width: 560px) and (max-width: 760px) {
  .tabella tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.5rem; }
}

/* Telefoni */
@media (max-width: 640px) {
  body { font-size: 1rem; background-attachment: scroll; } /* fixed su iOS scatta */
  :root { --pad-l: max(1.1rem, env(safe-area-inset-left)); --pad-r: max(1.1rem, env(safe-area-inset-right)); }

  .brand { font-size: 1.15rem; }
  .brand-logo { height: 54px; }
  .topbar-link { margin-left: .9rem; }
  .lede { font-size: 1.1rem; }

  .facts > div { grid-template-columns: 1fr; gap: .15rem; }
  .facts dt { font-size: 1.15rem; }

  /* bottoni pieni, più facili da toccare col pollice */
  .hero .btn, .modulo .btn { display: block; width: 100%; justify-self: stretch; text-align: center; padding: 1rem 1.2rem; }

  .reperto { transform: rotate(-1deg); padding: .6rem .6rem .8rem; }
  .reperto img { max-height: 72vh; object-fit: contain; }
  .tag { right: .4rem; top: -.9rem; font-size: 1.15rem; }
  @keyframes posa {
    from { opacity: 0; transform: translateY(-16px) rotate(2deg); }
    to   { opacity: 1; transform: translateY(0) rotate(-1deg); }
  }

  .campo-doppio { grid-template-columns: 1fr; }
  .modulo { margin: 0 calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l)); padding: 1.4rem var(--pad-r) 1.6rem var(--pad-l); }
  .check { font-size: 1rem; }
  .check input { width: 1.4rem; height: 1.4rem; }

  .contatore strong { font-size: 2.4rem; }

  .admin-indizi li { flex-wrap: wrap; }
  .btn-link { padding: .4rem 0; font-size: 1rem; }
}

/* Schermi stretti: fold chiusi, iPhone SE / mini */
@media (max-width: 360px) {
  .brand { font-size: 1.05rem; }
  .brand-logo { height: 46px; }
  .tabella td { grid-template-columns: 6.2rem minmax(0, 1fr); }
  .tag { font-size: 1.05rem; padding-left: 1.4rem; }
}

/* Telefono in orizzontale: titolo meno invadente */
@media (max-height: 500px) and (orientation: landscape) {
  h1 { font-size: clamp(3.6rem, 10vw, 6rem); }
  .reperto img { max-height: 85vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reperto { animation: none; }
}
