/* ==========================================================================
   GrinEvil — grinevil.it — design system multipagina
   Nero + rosso (#ff0000, come gli SVG delle mascotte) su fondo caldo.
   Due temi: chiaro (default) e scuro, automatico o forzato dal toggle.
   ========================================================================== */

:root {
  --font-display: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --content-width: 1000px;

  --bg: #fbf7f4;
  --surface: #ffffff;
  --surface-2: #f3ede8;
  --border: rgba(15, 12, 10, 0.14);
  --text: #14100e;
  --text-muted: #6b615b;
  --accent: #e60000;
  --accent-ink: #c20000;      /* rosso testo su fondo chiaro */
  --on-accent: #ffffff;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 12, 10, 0.12);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0a0d;
    --surface: #161318;
    --surface-2: #1f1b22;
    --border: #2c2630;
    --text: #f4f0ee;
    --text-muted: #a49aa0;
    --accent: #ff2a2a;
    --accent-ink: #ff6a6a;
    --on-accent: #12100f;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0a0d;
  --surface: #161318;
  --surface-2: #1f1b22;
  --border: #2c2630;
  --text: #f4f0ee;
  --text-muted: #a49aa0;
  --accent: #ff2a2a;
  --accent-ink: #ff6a6a;
  --on-accent: #12100f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-ink); }

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-inline: 22px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--on-accent);
  padding: .6rem 1rem; border-radius: 8px; z-index: 200;
}
.skip-link:focus { left: 1rem; top: 1rem; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  min-height: 62px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  flex-shrink: 0;
  text-decoration: none; color: var(--text);
  font-family: var(--font-display);
  font-weight: 900; font-size: 1.25rem; letter-spacing: -0.02em;
  text-transform: uppercase;
}
.brand-name { white-space: nowrap; }
.brand-evil { color: var(--accent-ink); }

.main-nav {
  display: flex; gap: 6px; margin-left: auto;
}
.main-nav a {
  text-decoration: none; color: var(--text);
  padding: 8px 12px; border-radius: 999px;
  font-weight: 600; font-size: .95rem;
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current="page"] {
  background: var(--accent); color: var(--on-accent);
}

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.theme-toggle {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.theme-toggle button {
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; background: transparent; color: var(--text-muted);
  border-radius: 999px; cursor: pointer;
}
.theme-toggle button svg { width: 16px; height: 16px; }
.theme-toggle button[aria-pressed="true"] {
  background: var(--surface); color: var(--accent-ink);
  box-shadow: var(--shadow);
}

.nav-toggle {
  display: none;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; margin: auto; }

.install-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); cursor: pointer;
  flex-shrink: 0;
}
.install-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.install-btn svg { width: 19px; height: 19px; }
.install-btn[hidden] { display: none; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  /* La nav esce dal flusso: senza il suo margin-left:auto le azioni
     resterebbero attaccate al brand. Le spingiamo a destra qui. */
  .header-actions { margin-left: auto; }
  .main-nav {
    position: absolute; inset: 62px 0 auto 0;
    flex-direction: column; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px 22px 16px;
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px; border-radius: 10px; }
}

/* Rete di sicurezza per schermi molto stretti (SE/mini, ~360-380px) o font
   di sistema ingranditi: comprime azioni e brand così l'header non tronca
   il logo. Sopra i 380px (la gran parte dei telefoni) resta tutto invariato. */
@media (max-width: 380px) {
  .header-inner { gap: 10px; }
  .header-actions { gap: 6px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 1.08rem; }
  .theme-toggle button { width: 25px; height: 25px; }
  .theme-toggle button svg { width: 15px; height: 15px; }
  .install-btn, .nav-toggle { width: 33px; height: 33px; }
}

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  padding: 54px 22px 22px;
  text-align: center;
  max-width: 760px;
}
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .72rem; font-weight: 700; color: var(--accent-ink);
}
.hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 900; letter-spacing: -0.03em; line-height: 1.02;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  text-transform: uppercase;
}
.tagline { margin: 0 auto; color: var(--text-muted); max-width: 52ch; }

/* ---- Mood picker ------------------------------------------------------- */
.mood {
  display: grid;
  grid-template-columns: minmax(0, 360px) 1fr;
  gap: 40px;
  align-items: start;
  padding-block: 24px 56px;
}
@media (max-width: 820px) {
  .mood { grid-template-columns: 1fr; gap: 28px; }
}

.mood-stage {
  position: sticky; top: 86px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
@media (max-width: 820px) { .mood-stage { position: static; } }

.mood-figure {
  width: 100%; aspect-ratio: 1;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 22px;
}
.mood-figure img { width: 100%; height: 100%; object-fit: contain; }

.mood-twin-toggle {
  display: inline-flex; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px;
}
.mood-twin-toggle button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-display); text-transform: uppercase;
  font-weight: 900; letter-spacing: .02em;
  color: var(--text-muted);
  padding: 7px 20px; border-radius: 999px;
}
.mood-twin-toggle button[aria-pressed="true"] {
  background: var(--accent); color: var(--on-accent);
}

.mood-caption { margin: 0; text-align: center; }
.mood-caption-label {
  display: block;
  font-family: var(--font-display); text-transform: uppercase;
  font-weight: 900; font-size: 1.3rem; letter-spacing: -0.01em;
}
.mood-caption-hint { display: block; color: var(--text-muted); font-size: .95rem; }

.btn {
  display: inline-block; cursor: pointer;
  font: inherit; font-weight: 700;
  padding: 11px 20px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid transparent; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn--ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}

/* ---- Menu Condividi (js/share.js) + toast (js/toast.js) ------------- */
.share-menu { position: relative; display: inline-flex; }
.share-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 700; cursor: pointer;
}
.share-trigger:hover { filter: brightness(1.06); }
.share-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.share-menu-panel {
  position: fixed; z-index: 500;
  display: flex; flex-direction: column;
  min-width: 190px; padding: 6px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.share-menu-panel[hidden] { display: none; }
.share-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; width: 100%;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.share-option:hover { background: var(--surface-2); }
.share-option svg { width: 18px; height: 18px; flex-shrink: 0; }

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  margin: 0; padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: .875rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 600;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.mood-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.mood-picker button {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer; color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.mood-picker button:hover { transform: translateY(-3px); }
.mood-picker button img { width: 64px; height: 64px; object-fit: contain; }
.mood-picker button span {
  font-family: var(--font-display); text-transform: uppercase;
  font-weight: 900; font-size: .82rem; letter-spacing: .01em;
}
.mood-picker button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ---- Strip cards ----------------------------------------------------- */
.strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; padding-block: 10px 64px;
}
.strip-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.strip-card h2 {
  margin: 0 0 8px; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: -0.01em; font-size: 1.15rem;
}
.strip-card p { margin: 0 0 12px; color: var(--text-muted); }
.strip-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Photostrip (home, scroll orizzontale) ----------------------- */
.photostrip { padding-block: 8px 56px; }
.photostrip-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.photostrip-head h2 {
  margin: 0; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: -0.01em; font-size: 1.3rem;
}
.photostrip-controls { display: flex; gap: 8px; flex: 0 0 auto; }
.photostrip-arrow {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.photostrip-arrow:hover:not(:disabled) {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
}
.photostrip-arrow:disabled { opacity: .35; cursor: default; }
.photostrip-arrow svg { width: 18px; height: 18px; }

.photostrip-track {
  list-style: none; margin: 0; padding: 4px 2px 16px;
  display: flex; gap: 16px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 2px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.photostrip-track::-webkit-scrollbar { height: 8px; }
.photostrip-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.photostrip-track:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photostrip-track.is-dragging { scroll-snap-type: none; cursor: grabbing; }

.photostrip-item {
  flex: 0 0 auto;
  width: clamp(200px, 62vw, 260px);
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.photostrip-item img {
  width: 100%; height: 300px; object-fit: cover;
  background: var(--surface-2);
  user-select: none; -webkit-user-drag: none;
}
/* Foto di gruppo, cover telefono, tazzine: intere, con bordo. */
.photostrip-item--contain img { object-fit: contain; padding: 12px; }
.photostrip-cap {
  display: block; padding: 10px 14px;
  font-size: .85rem; color: var(--text-muted);
}
.photostrip-foot { margin: 12px 0 0; }
.photostrip-foot a { font-weight: 700; color: var(--accent-ink); text-decoration: none; }
.photostrip-foot a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .photostrip-controls { display: none; } /* su touch si scorre col dito */
}
@media (prefers-reduced-motion: reduce) {
  .photostrip-track { scroll-behavior: auto; }
}

/* ---- Gallery ------------------------------------------------------- */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px; padding-block: 14px 40px;
}
.gallery-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.gallery-figure {
  display: grid; place-items: center;
  background: var(--surface-2);
  padding: 26px; aspect-ratio: 4 / 3;
}
/* Gli SVG delle mascotte hanno solo viewBox (nessuna dimensione intrinseca):
   servono larghezza/altezza esplicite o l'<img> collassa. */
.gallery-figure img { width: 100%; height: 100%; object-fit: contain; }
/* Il logo è un asset unico (nero + rosso + bianco), senza variante scura:
   plate chiara fissa così resta leggibile anche in tema scuro. */
.gallery-card--single .gallery-figure { background: #f4efe9; }
.gallery-meta { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; }
.gallery-meta strong {
  font-family: var(--font-display); text-transform: uppercase;
  font-size: 1rem; letter-spacing: -0.01em;
}
.gallery-meta span { color: var(--text-muted); font-size: .9rem; }
.gallery-cta { color: var(--accent-ink) !important; font-weight: 700; margin-top: 4px; }

/* ---- Video (video.php, click-to-load) --------------------------- */
.video-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px; align-items: start;
  padding-block: 14px 40px;
}
@media (max-width: 760px) {
  .video-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; }
}
.video-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.video-facade, .video-frame {
  display: block; width: 100%; border: 0;
  background: var(--surface-2);
}
.video-card--16-9 .video-facade,
.video-card--16-9 .video-frame { aspect-ratio: 16 / 9; }
.video-card--9-16 .video-facade,
.video-card--9-16 .video-frame { aspect-ratio: 9 / 16; }

.video-facade {
  position: relative; padding: 0; cursor: pointer;
}
.video-facade img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .25s ease, filter .25s ease;
}
.video-facade:hover img { transform: scale(1.03); filter: brightness(.85); }
.video-play {
  position: absolute; inset: 0; margin: auto;
  width: 66px; height: 66px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow);
  transition: transform .2s ease;
}
.video-facade:hover .video-play { transform: scale(1.08); }
.video-play svg { width: 30px; height: 30px; margin-left: 3px; }

.video-meta { padding: 14px 16px 16px; }
.video-kind {
  display: inline-block; margin-bottom: 4px;
  font-family: var(--font-display); text-transform: uppercase;
  font-size: .68rem; letter-spacing: .14em; color: var(--accent-ink);
}
.video-meta h2 {
  margin: 0; font-size: 1rem; line-height: 1.35;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: -0.01em;
}

/* ---- Theme-aware image swap (SVG chiari vs scuri) ------------------- */
.mood-img--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mood-img--light { display: none; }
  :root:not([data-theme="light"]) .mood-img--dark { display: block; }
}
:root[data-theme="dark"] .mood-img--light { display: none; }
:root[data-theme="dark"] .mood-img--dark { display: block; }
:root[data-theme="light"] .mood-img--light { display: block; }
:root[data-theme="light"] .mood-img--dark { display: none; }

/* ---- Footer ------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 34px 0 40px;
  text-align: center;
}
.footer-social {
  display: flex; justify-content: center; gap: 10px; margin: 0 0 16px;
}
.footer-social-link {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--text);
}
.footer-social-link:hover { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.footer-social-link svg { width: 19px; height: 19px; }
.footer-links { margin: 0 0 6px; color: var(--text-muted); font-size: .9rem; }
.footer-links a { color: var(--text-muted); }
.footer-copy { margin: 0; color: var(--text-muted); font-size: .82rem; }
.footer-linkbtn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--text-muted); text-decoration: underline;
}
.footer-linkbtn:hover { color: var(--accent-ink); }

/* ---- Banner cookie (js/consent.js) --------------------------------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 18px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 32px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 700;
}
/* `display:flex` batte lo stile UA di [hidden]: va rimesso a mano,
   altrimenti il banner non si chiude mai. */
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; flex: 1 1 260px; font-size: .875rem; color: var(--text-muted); }
.cookie-banner-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.cookie-btn {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--surface); color: var(--text);
}
.cookie-btn--ghost:hover { background: var(--surface-2); }
.cookie-btn--accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.cookie-btn--accent:hover { filter: brightness(1.06); }

/* ---- Pagina legale (privacy.php) --------------------------------- */
.legal-page { max-width: 760px; padding-block: 40px 64px; }
.legal-page h1 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: -0.02em; }
.legal-page h2 { margin-top: 2em; font-size: 1.2rem; }
.legal-page h3 { margin-top: 1.4em; font-size: 1rem; }
.legal-page p { color: var(--text); }
.legal-page .updated { color: var(--text-muted); font-size: .85rem; margin-top: -.4em; }
.legal-page code {
  background: var(--surface-2); padding: .1em .4em;
  border-radius: 5px; font-size: .9em;
}
.legal-page .disclaimer {
  margin-top: 2.4em; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; font-size: .85rem; color: var(--text-muted);
}
.table-wrap { overflow-x: auto; margin: 1.2em 0; }
.legal-page table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.legal-page th, .legal-page td {
  border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
}
.legal-page th { background: var(--surface-2); }

/* ---- Pagina 404 (404.php) -------------------------------------- */
.error-page { padding-block: 56px 64px; }
.error-figure {
  margin: 26px auto 4px;
  width: 180px; aspect-ratio: 1;
  display: grid; place-items: center;
  background: var(--surface-2); border-radius: var(--radius);
  padding: 20px;
}
.error-figure img { width: 100%; height: 100%; object-fit: contain; }
.error-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; margin-top: 22px;
}

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