/* =========================================================
   Cooperativa Sirena — Eventi
   Design system: "mare della Val Vibrata"
   Display: Bricolage Grotesque · Body: Inter
   ========================================================= */

:root {
  /* Palette marina */
  --sea-900: #0a3a44;
  --sea-800: #0b4854;
  --sea-700: #0b5563;   /* primario */
  --sea-500: #12798b;
  --sea-400: #2b97a8;
  --coral:   #f2724b;   /* accento / call to action */
  --coral-dk:#dd5a34;
  --sand:    #fbf7f0;   /* sfondo caldo */
  --aqua:    #e4f1f2;   /* tinta card */
  --aqua-dk: #cfe6e8;
  --ink:     #14282e;
  --muted:   #5b7178;
  --line:    #dfe7e7;
  --white:   #ffffff;
  --danger:  #c0392b;
  --ok:      #1e8a5b;

  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 10px 30px -12px rgba(11, 85, 99, .25);
  --shadow-lg:0 24px 60px -20px rgba(11, 58, 68, .35);
  --maxw: 1160px;

  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sand);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--sea-700); text-decoration: none; }
a:hover { color: var(--coral-dk); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .4em; color: var(--sea-900); font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.container { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 600; font-size: .98rem;
  padding: .8rem 1.4rem; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s ease, background .2s, box-shadow .2s, color .2s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 8px 20px -8px rgba(242,114,75,.7); }
.btn-primary:hover { background: var(--coral-dk); color: #fff; }
.btn-sea { background: var(--sea-700); color: #fff; }
.btn-sea:hover { background: var(--sea-800); color: #fff; }
.btn-ghost { background: transparent; color: var(--sea-700); border-color: var(--sea-700); }
.btn-ghost:hover { background: var(--sea-700); color: #fff; }
.btn-sm { padding: .5rem .95rem; font-size: .86rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251,247,240,.9);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand img { height: 52px; width: auto; }
.brand .brand-txt strong { font-family: var(--font-display); color: var(--sea-800); font-size: 1.02rem; display: block; letter-spacing: -.01em; }
.brand .brand-txt span { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sea-500); }
.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a { color: var(--sea-800); font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--coral-dk); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; color: #eaf7f8;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(43,151,168,.55), transparent 60%),
    linear-gradient(160deg, var(--sea-800), var(--sea-900));
}
.hero .container { position: relative; z-index: 2; padding: 4.5rem 0 6.5rem; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .18em; color: #9fdbe2; margin-bottom: 1rem; }
.hero .eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--coral); display: inline-block; }
.hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 16ch; }
.hero p { color: #cbe8ec; font-size: 1.12rem; max-width: 52ch; }
.hero .hero-cta { margin-top: 1.6rem; display: flex; gap: .8rem; flex-wrap: wrap; }
/* onda decorativa */
.hero .wave { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 1; line-height: 0; }
.hero .wave svg { width: 100%; height: 90px; display: block; }

/* ---------- section ---------- */
.section { padding: 3.5rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head .eyebrow { font-size: .76rem; text-transform: uppercase; letter-spacing: .18em; color: var(--sea-500); font-weight: 700; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin: .2rem 0 0; }

/* ---------- event grid / cards ---------- */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.6rem; }
.event-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .25s ease;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.event-card .thumb { position: relative; aspect-ratio: 4 / 3; background: var(--aqua); overflow: hidden; }
.event-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.event-card .date-badge {
  position: absolute; top: 12px; left: 12px; background: var(--white); color: var(--sea-800);
  border-radius: 12px; padding: .35rem .6rem; text-align: center; box-shadow: var(--shadow); min-width: 54px;
}
.event-card .date-badge .d { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; line-height: 1; }
.event-card .date-badge .m { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--coral-dk); font-weight: 700; }
.event-card .card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.event-card h3 { font-size: 1.22rem; margin: 0; }
.event-card .meta { font-size: .9rem; color: var(--muted); display: flex; flex-direction: column; gap: .25rem; }
.event-card .meta span { display: inline-flex; gap: .45rem; align-items: center; }
.event-card .card-foot { margin-top: auto; padding-top: .4rem; }
.ico { width: 16px; height: 16px; flex: none; color: var(--sea-500); }

/* stato vuoto */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty svg { width: 64px; height: 64px; opacity: .5; margin-bottom: 1rem; }

/* skeleton loading */
.skeleton { background: linear-gradient(100deg, #eef4f4 30%, #f6faf9 50%, #eef4f4 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
.skeleton-card { height: 360px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =========================================================
   Pagina dettaglio evento
   ========================================================= */
.event-hero { background: linear-gradient(160deg, var(--sea-800), var(--sea-900)); color: #eaf7f8; padding: 2.6rem 0 2.2rem; }
.event-hero .back { color: #9fdbe2; font-weight: 600; font-size: .9rem; display: inline-flex; gap: .4rem; align-items: center; margin-bottom: 1.2rem; }
.event-hero .back:hover { color: #fff; }
.event-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.4vw, 3rem); max-width: 20ch; }
.event-hero .chips { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #eaf7f8; padding: .5rem .9rem; border-radius: 999px; font-size: .92rem; font-weight: 500; }
.chip .ico { color: #9fdbe2; }

.event-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: start; padding: 3rem 0 4rem; }
.event-poster { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); background: var(--aqua); }
.event-poster img { width: 100%; height: auto; }
.event-desc h2 { font-size: 1.6rem; margin-top: 0; }
.event-desc { white-space: pre-line; font-size: 1.05rem; }
.event-info-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.4rem 1.6rem; }
.event-info-card h3 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sea-500); font-size: .82rem; }
.info-row { display: flex; gap: .8rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.info-row:last-child { border-bottom: none; }
.info-row .ico { margin-top: 3px; }
.info-row .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.info-row .val { font-weight: 600; color: var(--ink); }

/* =========================================================
   Form iscrizione
   ========================================================= */
.form-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.8rem; }
.form-wrap.attached { border-top: 4px solid var(--coral); }
.form-wrap h2 { font-size: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .9rem; }
.field label .req { color: var(--coral-dk); }
.field input, .field textarea, .field select {
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  padding: .75rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--sea-500); box-shadow: 0 0 0 3px rgba(18,121,139,.15);
}
.field .err-msg { color: var(--danger); font-size: .82rem; display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field.invalid .err-msg { display: block; }
/* honeypot nascosto */
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.form-consent { font-size: .82rem; color: var(--muted); display: flex; gap: .55rem; align-items: flex-start; margin: 1rem 0; }
.form-consent input { margin-top: 3px; }
.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* alert / feedback */
.alert { border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: 1rem; font-weight: 500; display: none; }
.alert.show { display: block; }
.alert-ok { background: #e6f6ee; color: #12603f; border: 1px solid #b7e3cd; }
.alert-err { background: #fdecea; color: #922b21; border: 1px solid #f2c1bb; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { background: var(--sea-900); color: #bcd7db; margin-top: 2rem; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; padding: 3rem 0 2rem; }
.site-footer h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 1rem; }
.site-footer a { color: #bcd7db; }
.site-footer a:hover { color: var(--coral); }
.footer-brand img { height: 60px; margin-bottom: 1rem; background: #fff; border-radius: 12px; padding: 6px 10px; }
.footer-contacts p { margin: .2rem 0; font-size: .92rem; }
.footer-social { display: flex; gap: .6rem; margin-top: 1rem; }
.footer-social a { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.footer-social a:hover { background: var(--coral); }
.footer-social svg { width: 18px; height: 18px; fill: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 1.1rem 0; font-size: .82rem; text-align: center; color: #8fb2b7; }

/* =========================================================
   Pannello amministrazione
   ========================================================= */
.admin-body { background: #eef3f3; }
.admin-topbar { background: var(--sea-800); color: #fff; }
.admin-topbar .container { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; }
.admin-topbar .brand strong { color: #fff; }
.admin-topbar .brand span { color: #9fdbe2; }
.admin-topbar .who { font-size: .9rem; color: #cfeef2; display: flex; align-items: center; gap: 1rem; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: linear-gradient(160deg, var(--sea-800), var(--sea-900)); }
.login-card { width: min(100%, 400px); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2.2rem; }
.login-card .brand { justify-content: center; margin-bottom: 1.4rem; }
.login-card h1 { font-size: 1.4rem; text-align: center; }

.admin-main { padding: 2rem 0 4rem; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.admin-toolbar h1 { font-size: 1.7rem; margin: 0; }

.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--line); font-size: .94rem; vertical-align: middle; }
.admin-table th { background: var(--aqua); color: var(--sea-800); font-family: var(--font-display); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .thumb-mini { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--aqua); }
.admin-table .row-actions { display: flex; gap: .4rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: var(--aqua-dk); color: var(--sea-800); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,58,68,.55); display: none; align-items: flex-start; justify-content: center; padding: 3vh 1rem; z-index: 60; overflow-y: auto; }
.modal-backdrop.show { display: flex; }
.modal { width: min(100%, 640px); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.8rem; }
.modal h2 { font-size: 1.35rem; }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal .close-x { background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.poster-preview { margin-top: .5rem; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: .6rem; text-align: center; background: var(--sand); }
.poster-preview img { max-height: 180px; margin: 0 auto; border-radius: 8px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .event-layout { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .nav { gap: .9rem; }
  .nav a.hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; }
  .brand .brand-txt span { display: none; }
  .hero .container { padding: 3rem 0 5rem; }
}

/* accessibilità */
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
