/* ============================================================
   CoopInTouch · foundation
   Tema: light, bloccato. Accento unico: Rosso Coop.
   Forme: bottoni pill · card 16px · input 10px (regola globale)
   ============================================================ */

/* ---------- caratteri ----------
   Ospitati qui dentro: nessuna chiamata a terzi al caricamento, quindi
   nessun indirizzo IP dei visitatori che esce verso un CDN. Sono file
   variabili, uno per famiglia, tutti sotto SIL OFL 1.1 (assets/fonts/OFL.txt). */
@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo.woff2') format('woff2');
  font-weight: 100 900; font-stretch: 62% 125%;
  font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope.woff2') format('woff2');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  /* superfici e inchiostri */
  --paper: #F6F6F4;
  --surface: #FFFFFF;
  --ink: #1B1A17;
  --ink-2: #4A4843;
  --muted: #6E6B63;
  --line: #E4E2DC;
  --line-soft: #EEECE7;

  /* accento */
  --rosso: #E3001B;
  --rosso-press: #BF0117;
  --rosso-soft: #FDEDEE;

  /* categorie (semantiche) */
  --cat-sport: #0E8A62;
  --cat-cultura: #2D5BD1;
  --cat-tempo: #DD8500;
  --cat-sociale: #8C4BC9;
  --cat-sport-soft: #E2F3ED;
  --cat-cultura-soft: #E6EBFA;
  --cat-tempo-soft: #FBF0DC;
  --cat-sociale-soft: #F1E7FA;
  /* varianti "inchiostro" per testo piccolo: stesse tinte, contrasto AA */
  --cat-sport-ink: #0B6B4B;
  --cat-tempo-ink: #9A5C00;

  /* whatsapp (brand esterno, solo blocchi community) */
  --wa: #25D366;
  --wa-ink: #0B6E38;
  --wa-soft: #E6F9EE;

  /* tipografia */
  --font-display: 'Archivo', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Manrope', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* Archivo è più largo del carattere di prima: l'asse di larghezza
     riporta il titolo dell'hero su una riga sola a ogni viewport */
  --stretch-display: 86%;

  /* forme */
  --r-card: 16px;
  --r-input: 10px;
  --r-pill: 999px;

  /* ombre (tinte all'inchiostro, mai nero puro) */
  --shadow-1: 0 1px 2px rgba(27, 26, 23, .05), 0 4px 14px rgba(27, 26, 23, .06);
  --shadow-2: 0 2px 6px rgba(27, 26, 23, .07), 0 14px 34px rgba(27, 26, 23, .10);

  /* layout */
  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* ---------- reset essenziale ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* superfici del browser: anche ciò che non disegniamo porta il design */
::selection { background: var(--rosso); color: #fff; }
input, textarea, select { caret-color: var(--rosso); }
html { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
body {
  margin: 0;
  font-family: var(--font-body);
  /* si eredita, ma agisce solo su Archivo: gli altri due non hanno
     l'asse di larghezza e lo ignorano in fase di scelta del taglio */
  font-stretch: var(--stretch-display);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
.num, .mono, .datebox .d { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--rosso); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- header pubblico ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  text-decoration: none; color: var(--ink);
}
.wordmark b { font-weight: 800; color: var(--rosso); }
.wordmark .liguria { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: -3px; }
.site-header nav { display: flex; gap: 10px; align-items: center; }
.nav-link {
  text-decoration: none; font-weight: 700; font-size: 15px; color: var(--ink-2);
  padding: 8px 14px; border-radius: var(--r-pill);
  transition: background .2s ease, color .2s ease;
}
.nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-link.active { background: var(--ink); color: var(--surface); }

/* ---------- footer pubblico ---------- */
.site-footer {
  margin-top: clamp(48px, 8vw, 96px);
  background: var(--ink); color: #CFCCC5;
  padding: clamp(40px, 6vw, 64px) 0 28px;
}
.site-footer .cols {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px;
  padding-bottom: 36px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.site-footer .wordmark { color: #fff; }
.site-footer .wordmark .liguria { color: #A29F97; }
.site-footer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #8B887F; margin-bottom: 12px; font-family: var(--font-body); font-weight: 700; }
.site-footer a { color: #CFCCC5; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.site-footer .legal { padding-top: 20px; font-size: 13px; color: #8B887F; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
@media (max-width: 767px) {
  .site-footer .cols { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px; line-height: 1;
  padding: 14px 26px; border-radius: var(--r-pill); border: none;
  text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--rosso); color: #fff; }
.btn-primary:hover { background: var(--rosso-press); box-shadow: var(--shadow-1); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--surface); }
.btn-wa { background: var(--wa-ink); color: #fff; }
.btn-wa:hover { background: #095A2E; }
.btn[disabled], .btn.is-disabled { background: var(--line); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 10px 18px; font-size: 14.5px; }

/* ---------- badge e chip ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  padding: 5px 11px; border-radius: var(--r-pill);
}
.badge-aperte  { background: var(--cat-sport-soft); color: var(--cat-sport-ink); }
.badge-quasi   { background: var(--cat-tempo-soft); color: #8F5700; }
.badge-chiuse  { background: var(--line-soft); color: var(--muted); }
.badge-libero  { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.badge-wa      { background: var(--wa-soft); color: var(--wa-ink); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 700; color: var(--ink-2);
  background: var(--surface); border: 1.5px solid var(--line);
  padding: 9px 16px; border-radius: var(--r-pill);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.chip:hover { border-color: var(--ink-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip .dotcat { width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--muted)); }
.chip.active .dotcat { background: var(--surface); }

/* colore categoria via classe */
.cat-sport   { --cat: var(--cat-sport);   --cat-soft: var(--cat-sport-soft);   --cat-ink: var(--cat-sport-ink); }
.cat-cultura { --cat: var(--cat-cultura); --cat-soft: var(--cat-cultura-soft); }
.cat-tempo   { --cat: var(--cat-tempo);   --cat-soft: var(--cat-tempo-soft);   --cat-ink: var(--cat-tempo-ink); }
.cat-sociale { --cat: var(--cat-sociale); --cat-soft: var(--cat-sociale-soft); }
.cat-label { color: var(--cat-ink, var(--cat)); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- copertine duotone ----------
   Gradiente di categoria sotto + immagine in mix-blend-mode luminosity:
   la foto porta solo le luci, il colore lo decide la categoria.
   Se l'immagine non carica (offline) resta il gradiente. */
.cover {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(150deg, color-mix(in srgb, var(--cat, var(--ink-2)) 92%, #fff), color-mix(in srgb, var(--cat, var(--ink-2)) 55%, var(--ink)));
}
.cover img {
  width: 100%; height: 100%; object-fit: cover;
  mix-blend-mode: luminosity;
  filter: brightness(1.18) contrast(.98);
  opacity: .92;
}

/* la foto si "risolve" sul gradiente quando arriva, e respira all'hover */
@media (prefers-reduced-motion: no-preference) {
  html.motion .cover img { opacity: 0; transition: opacity .6s ease, transform .7s cubic-bezier(.16, 1, .3, 1); }
  html.motion .cover img.ld { opacity: .92; }
  html.motion .event-card:hover .cover img,
  html.motion .event-hero:hover .cover img { transform: scale(1.05); }
}
.cover .scrim { position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(to top, rgba(20,18,15,.62), transparent); z-index: 1; }

/* ---------- card evento ---------- */
.event-card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--shadow-1);
  text-decoration: none; color: inherit;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s ease;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.event-card:active { transform: scale(.99); }
.event-card .cover { aspect-ratio: 16 / 9; }
.event-card .body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.event-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-card h3 { font-size: 21px; font-weight: 800; }
.event-card .where { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.event-card .foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* blocco data tipografico */
.datebox { text-align: center; line-height: 1; flex-shrink: 0; }
.datebox .d { font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.datebox .m { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--rosso); }

/* card in evidenza (prima della griglia) */
.event-hero {
  display: grid; grid-template-columns: 1.25fr 1fr;
  background: var(--surface); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--shadow-1); text-decoration: none; color: inherit;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s ease;
}
.event-hero:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.event-hero .cover { min-height: 320px; }
.event-hero .body { padding: clamp(22px, 3.5vw, 40px); display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.event-hero h2, .event-hero h3 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
@media (max-width: 767px) {
  .event-hero { grid-template-columns: 1fr; }
  .event-hero .cover { min-height: 0; aspect-ratio: 16 / 9; }
}

/* griglia eventi */
.events-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 1023px) { .events-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px)  { .events-grid { grid-template-columns: 1fr; } }

/* ---------- barra filtri ---------- */
.filters {
  display: flex; gap: 10px; align-items: center;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-block: 4px;
}
.filters::-webkit-scrollbar { display: none; }
.filters .sep { width: 1px; height: 26px; background: var(--line); flex-shrink: 0; }
.select-pill {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-weight: 700; font-size: 14px; color: var(--ink-2);
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A4843' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: 9px 34px 9px 16px; cursor: pointer;
}
.select-pill:hover { border-color: var(--ink-2); }

/* stato vuoto */
.empty {
  text-align: center; padding: 64px 24px;
  background: var(--surface); border-radius: var(--r-card); border: 1.5px dashed var(--line);
}
.empty h3 { font-size: 22px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

/* ---------- form ---------- */
.field { display: grid; gap: 7px; }
.field label { font-weight: 700; font-size: 14.5px; }
.field .hint { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-input);
  padding: 13px 15px; width: 100%;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input::placeholder { color: #A5A29A; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(27,26,23,.08);
}
.field.has-error input { border-color: var(--rosso); }
.field .error { font-size: 13.5px; color: var(--rosso); font-weight: 500; display: none; }
.field.has-error .error { display: block; }

.check { display: flex; gap: 12px; align-items: flex-start; }
.check input[type="checkbox"] {
  width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--rosso); border-radius: 6px;
}
.check span { font-size: 14.5px; color: var(--ink-2); }

/* ---------- riquadri informativi ---------- */
.notice {
  border-radius: var(--r-card); padding: 18px 20px;
  display: flex; gap: 14px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.5;
}
.notice-privacy { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-2); }
.notice-wa { background: var(--wa-soft); color: var(--wa-ink); }
.notice strong { color: var(--ink); }

/* ---------- sezioni ---------- */
.section { padding-block: clamp(36px, 6vw, 72px); }
.section-head { margin-bottom: clamp(20px, 3vw, 32px); }
.section-head h2 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; }
.section-head p { color: var(--muted); margin-top: 6px; max-width: 60ch; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1); }
  .reveal.in { opacity: 1; transform: none; }
  .reveal-stagger > * { opacity: 0; transform: translateY(18px); transition: opacity .55s cubic-bezier(.16,1,.3,1), transform .55s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 60ms); }
  .reveal-stagger.in > * { opacity: 1; transform: none; }

  /* se il JS non parte, il contenuto emerge comunque da solo */
  html:not(.motion) .reveal,
  html:not(.motion) .reveal-stagger > * { animation: cit-forcein .5s ease .9s forwards; }

  /* feedback fisico su controlli e chip */
  .btn-primary:hover { transform: translateY(-1.5px); }
  .chip { transition: border-color .2s ease, background .2s ease, color .2s ease, transform .15s ease; }
  .chip:active { transform: scale(.95); }
  .btn:active { transform: scale(.98); }
  .field .error { animation: cit-errin .18s ease; }
}
@keyframes cit-forcein { to { opacity: 1; transform: none; } }
@keyframes cit-errin { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- fluidità tra pagine: view transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .2s; }
::view-transition-new(root) { animation-duration: .3s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-image-pair(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* utility */
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.hide-mobile { display: initial; }
@media (max-width: 639px) { .hide-mobile { display: none; } }
