/* ==========================================================================
   GERICO KIT — componenti portabili
   HTML + CSS puri. Nessun WordPress, nessun Elementor, nessun jQuery.

   Uso:
     <link rel="stylesheet" href="tokens/gerico-tokens.css">
     <link rel="stylesheet" href="gerico-kit.css">
     <script src="gerico-kit.js" defer></script>

   ⚠️ Questo file è DERIVATO dal sito, non sincronizzato con esso: se il sito
   cambia, va riallineato a mano. La fonte di verità resta gericoagency.com
   (child theme `hello-elementor-child`). Vedi 00-CLAUDE.md.
   ========================================================================== */

/* ── FONT ─────────────────────────────────────────────────────────────────
   I nomi delle famiglie sono NEUTRI ("BaseNeue Gerico"), non i nomi dei file:
   così il giorno in cui il font display verrà sostituito con quello corretto
   (vedi 05-FONT.md → il file in uso è un falso) cambia solo questo blocco.

   font-display:block sul display → il testo appare già col font giusto, non
   prima in quello di sistema. Sul corpo swap: leggibilità prima di tutto.   */

@font-face {
  font-family: "BaseNeue Gerico";
  src: url("assets/fonts/BaseNeue-CondensedBlack.woff2") format("woff2"),
       url("assets/fonts/BaseNeue-CondensedBlack.woff")  format("woff");
  font-weight: 400 900; font-style: normal; font-display: block;
}
@font-face {
  font-family: "Silver Editorial Gerico";
  src: url("assets/fonts/SLTFTheSilverEditorial-ExtraLightItalic.woff2") format("woff2"),
       url("assets/fonts/SLTFTheSilverEditorial-ExtraLightItalic.woff")  format("woff");
  font-weight: 400; font-style: italic; font-display: swap;
}
/* Il corpo NON ha un @font-face: è Helvetica, un font di sistema.
   Nessun file da scaricare, nessuna licenza da rispettare, zero peso in rete.
   Lo stack completo è in tokens/gerico-tokens.css (--g-font-body).
   ⚠️ Il SITO usa Suisse Intl; il kit no, per la ragione spiegata in 05-FONT.md.
   Se un giorno si compra la licenza, il blocco @font-face va rimesso QUI. */

/* ── BASE ───────────────────────────────────────────────────────────────── */

.g-root *, .g-root *::before, .g-root *::after { box-sizing: border-box; }
.g-root {
  margin: 0;
  background: var(--g-black);
  color: var(--g-paper);
  font-family: var(--g-font-body);
  font-size: var(--g-t-body);
  line-height: var(--g-lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
.g-root h1, .g-root h2, .g-root h3, .g-root h4 { margin: 0; font-weight: 400; }
.g-root p { margin: 0; }
.g-root a { color: inherit; }

/* ── TIPOGRAFIA ───────────────────────────────────────────────────────────
   Tre ruoli, tre classi. Non si mescolano mai.                              */

.g-monument, .g-colossal, .g-display, .g-statement, .g-title {
  font-family: var(--g-font-display);
  text-transform: uppercase;
  font-weight: 400;
  margin: 0;
}
.g-monument  { font-size: var(--g-t-monument);  line-height: var(--g-lh-monument); }
.g-colossal  { font-size: var(--g-t-colossal);  line-height: var(--g-lh-monument); }
.g-display   { font-size: var(--g-t-display);   line-height: var(--g-lh-display); color: var(--g-paper); }
.g-statement { font-size: var(--g-t-statement); line-height: var(--g-lh-display); letter-spacing: -0.32px; }
.g-title     { font-size: var(--g-t-card);      line-height: var(--g-lh-tight); letter-spacing: var(--g-ls-tight); }

/* Il sussurro: corsivo editoriale. Non è mai uppercase, non è mai un titolo. */
.g-whisper {
  font-family: var(--g-font-editorial);
  font-style: italic;
  font-size: var(--g-t-lead);
  line-height: 1;
  color: var(--g-paper);
}
.g-whisper--sm { font-size: clamp(0.95rem, 1.2vw, 1.2rem); line-height: 1.2; }
.g-whisper--accent { color: var(--g-yellow); }

.g-body  { font-family: var(--g-font-body); font-size: var(--g-t-body);  line-height: var(--g-lh-body); }
.g-lede  { font-family: var(--g-font-body); font-size: var(--g-t-small); line-height: var(--g-lh-loose); max-width: var(--g-maxw-text); }
.g-micro { font-family: var(--g-font-body); font-size: var(--g-t-micro); color: var(--g-muted); letter-spacing: var(--g-ls-label); }

/* ── LA FASCIA GIALLA ─────────────────────────────────────────────────────
   L'unico posto dove il giallo è una superficie: la fascia-manifesto.
   Testo nero, display, mai arrotondata.                                     */
.g-band {
  background: var(--g-yellow);
  color: var(--g-ink);
  border-radius: var(--g-r-flat);
  padding: var(--g-space-6) var(--g-pad-x);
  text-align: center;
}
.g-band .g-display, .g-band .g-colossal { color: var(--g-ink); }

/* ══════════════════════════════════════════════════════════════════════════
   BOTTONE FLIP — il componente firma
   Due copie sovrapposte nella STESSA cella CSS Grid (sovrapposizione
   pixel-perfect senza calcoli JS). La copia gialla è clippata dall'alto e si
   scopre dal basso; dentro, il testo fa un flip 3D su perspective 6em.
   La coreografia a tre tempi la applica gerico-kit.js.

   Markup:
     <span class="g-btn-flip">
       <a class="g-btn" href="#"><span class="g-btn-t">PARLACI</span></a>
     </span>
   Il resto (copia alt, seconda etichetta) lo costruisce il JS.
   ══════════════════════════════════════════════════════════════════════════ */

.g-btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--g-font-display);
  font-size: 21.6px;              /* [SITO] misura reale di "PARLACI DEL TUO PROGETTO" */
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: var(--g-ls-wide);
  text-decoration: none;
  background: var(--g-black);
  color: var(--g-white);
  border: 0;
  border-radius: var(--g-r-button);
  padding: 14.4px 28.8px;         /* [SITO] */
  cursor: pointer;
  white-space: nowrap;
}
/* Secondario: sul fondo nero della home il nero non stacca → #1A1A1A */
.g-btn--secondary { background: var(--g-panel); }
/* Giallo pieno: è già il "secondo stato", usalo solo dove non c'è flip */
.g-btn--accent { background: var(--g-yellow); color: var(--g-ink); }
/* Fantasma: bordo sottile, per l'azione secondaria accanto alla primaria */
.g-btn--ghost { background: transparent; color: var(--g-paper); border: 1px solid rgba(235,235,235,.28); }
/* Pill piccola: contatti, cookie, etichette cliccabili */
.g-btn--pill { border-radius: var(--g-r-pill); font-size: 12.96px; padding: 10px 24px; }

.g-btn-flip {
  position: relative; overflow: hidden;
  display: inline-grid; grid-template-rows: 1fr; grid-template-columns: 1fr;
  vertical-align: top; line-height: 0; max-width: 100%;
}
.g-btn-flip > .g-btn { grid-row: 1; grid-column: 1; margin: 0; }

/* Stato di rest: la copia gialla è clippata OLTRE il 100%.
   ⚠️ 2px oltre, non 100% esatto: con inset(100%) la regione visibile collassa
   a una riga di altezza 0 sul bordo inferiore e, quando il bottone cade su una
   frazione di pixel, il browser arrotonda e dipinge ~1px di giallo sotto la
   pillola nera (striscia intermittente). Bug reale, trovato in produzione.   */
.g-btn-flip > .g-flip-alt {
  clip-path: inset(calc(100% + 2px) 0 0 0);
  -webkit-clip-path: inset(calc(100% + 2px) 0 0 0);
  transition: clip-path var(--g-dur-flip) var(--g-ease-pill),
      -webkit-clip-path var(--g-dur-flip) var(--g-ease-pill);
  pointer-events: none;
  background: var(--g-yellow); color: var(--g-ink);
}
.g-btn-flip.is-flipping > .g-flip-alt {
  clip-path: inset(0 0 0 0); -webkit-clip-path: inset(0 0 0 0);
  pointer-events: auto;
}

/* Flip 3D del testo dentro ciascuna copia */
.g-btn { perspective: 6em; }
.g-btn-t {
  display: inline-block;
  transform-origin: top;
  /* ⚠️ Safari: dentro un contesto perspective la faccia frontale (senza
     transform a riposo) NON viene dipinta al primo paint → il bottone resta
     vuoto finché un hover non forza il repaint, e su mobile non accade mai.
     translateZ(0) + backface-visibility la promuovono a layer compositato.
     No-op visivo su Chrome. NON RIMUOVERE. */
  transform: translateZ(0);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: transform var(--g-dur-flip) var(--g-ease-flip), opacity 0.2s linear 0.1s;
}
.g-btn.is-open .g-btn-t:nth-child(1) {
  opacity: 0; transform: rotateX(90deg) scaleX(.9) translate3d(0, -10px, 0);
}
.g-btn-t:nth-child(2) {
  position: absolute; top: 0; left: 0; width: 100%;
  display: flex; align-items: center; justify-content: center; height: 100%;
  opacity: 0; transform: rotateX(-90deg) scaleX(.9) translate3d(0, 10px, 0);
  transform-origin: bottom;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: transform var(--g-dur-flip) var(--g-ease-flip), opacity 0.2s linear 0.1s;
}
.g-btn.is-open .g-btn-t:nth-child(2) {
  opacity: 1; transform: rotateX(0deg) scaleX(1) translateZ(0);
  transition: transform 0.35s var(--g-ease-flip), opacity 0.2s linear 0.15s;
}

/* ══════════════════════════════════════════════════════════════════════════
   CLIP-TEXT — il testo che si svela dall'ombra del giallo
   Due copie sovrapposte: sotto l'ocra (l'ombra), sopra il chiaro, scoperto
   dal basso mentre scrolli.

   Markup:  <h2 class="g-clip" data-clip-text="COME LO FACCIAMO">COME LO FACCIAMO</h2>

   ⚠️ Gli pseudo-elementi con content:attr() NON vengono tradotti da Google
   Translate né dai plugin di traduzione: se la pagina è multilingua, il JS
   deve risincronizzare l'attributo (gerico-kit.js lo fa con un MutationObserver).
   ══════════════════════════════════════════════════════════════════════════ */

.g-clip {
  position: relative;
  color: var(--g-clip-base, var(--g-yellow-shadow));
  --g-clip-value: 100%;
}
.g-clip::before {
  content: attr(data-clip-text);
  position: absolute; top: 0; left: 0; width: 100%;
  color: var(--g-clip-reveal, var(--g-paper));
  clip-path: inset(0 0 var(--g-clip-value) 0);
  will-change: clip-path;
  pointer-events: none;
  white-space: pre-line;   /* rispetta gli a-capo, come il livello sotto */
}
/* Variante del titolone: la base è grigia, non ocra */
.g-clip--grey { --g-clip-base: var(--g-clip-grey); }

/* ══════════════════════════════════════════════════════════════════════════
   CARD PROGETTO — la gerarchia invertita
   Il nome del cliente è un sottotitolo italic piccolo; il RISULTATO è il
   titolo grande. Il risultato batte il nome: è la regola del sito.
   ══════════════════════════════════════════════════════════════════════════ */

.g-work-grid { display: flex; flex-direction: column; gap: var(--g-space-5); padding: 2vw; }
.g-work-row  { display: flex; gap: var(--g-space-3); }
@media (max-width: 1024px) { .g-work-row { flex-direction: column; gap: var(--g-space-4); } }

.g-work-card { flex: 1; display: flex; flex-direction: column; gap: var(--g-space-2); text-decoration: none; color: inherit; }
.g-work-card__media {
  aspect-ratio: 4/3; overflow: hidden;
  border-radius: var(--g-r-card); background: var(--g-panel);
}
.g-work-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-work-card__client {
  font-family: var(--g-font-editorial); font-style: italic;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem); line-height: 1.2;
  color: var(--g-white); opacity: .85;
}
.g-work-card__result {
  font-family: var(--g-font-display); text-transform: uppercase;
  font-size: var(--g-t-card); line-height: var(--g-lh-tight);
  letter-spacing: var(--g-ls-tight); color: var(--g-white);
  margin-top: -0.7rem;   /* stringe la coppia cliente+risultato */
}

/* ══════════════════════════════════════════════════════════════════════════
   HEADER + PANNELLO MENU
   Logo a sinistra, pill MENU a destra, un pannello solo che entra da destra.
   Dentro: WORK + progetti, CONTATTACI, lingua.
   ══════════════════════════════════════════════════════════════════════════ */

.g-header {
  --g-pill-h: clamp(2rem, 3.125vw, 2.8rem);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(1rem, 2.6vw, 2.4rem) var(--g-pad-x);
  transition: margin-top var(--g-dur-slow) var(--g-ease-out);
}
/* Si ritira arrivati al footer, torna scrollando su */
.g-header.is-hidden { margin-top: -160px; pointer-events: none; }
/* Il logo è alto quanto la pill. ⚠️ Il wordmark è 333x74 (4.5:1): dargli solo
   height non basta se qualcosa gli blocca la larghezza — si impone anche la
   width ricavata dal rapporto reale, così è l'INCHIOSTRO a essere alto quanto
   la pill, non il contenitore. */
.g-header__logo { height: calc(var(--g-pill-h) * 0.55); width: auto; display: block; }
.g-header__toggle {
  font-family: var(--g-font-display); text-transform: uppercase;
  font-size: 18.72px; line-height: 1;
  background: var(--g-black); color: var(--g-white);
  border: 0; border-radius: var(--g-r-pill);
  min-height: var(--g-pill-h); padding: 0 1.4em; cursor: pointer;
}
.g-header__toggle[aria-expanded="true"] { background: var(--g-yellow); color: var(--g-ink); }

.g-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 99;
  width: min(33rem, 100%);
  background: var(--g-black);
  padding: clamp(5rem, 8vw, 7rem) var(--g-pad-x) var(--g-space-5);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--g-dur-slow) var(--g-ease-out);
}
.g-panel.is-open { transform: none; }
/* I contenuti entrano in sequenza, DOPO che il pannello si è aperto: se
   entrano mentre si apre l'effetto è sporco (0.45s, non 0.25s). */
.g-panel > * { opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }
.g-panel.is-open > * { opacity: 1; transform: none; }
.g-panel.is-open > *:nth-child(1) { transition-delay: .30s; }
.g-panel.is-open > *:nth-child(2) { transition-delay: .35s; }
.g-panel.is-open > *:nth-child(3) { transition-delay: .40s; }
.g-panel.is-open > *:nth-child(4) { transition-delay: .45s; }
.g-panel.is-open > *:nth-child(5) { transition-delay: .50s; }
.g-panel.is-open > *:nth-child(6) { transition-delay: .55s; }

.g-panel__heading {
  font-family: var(--g-font-display); text-transform: uppercase;
  font-size: 2rem; line-height: 1; color: var(--g-yellow);
  margin-bottom: var(--g-space-3);
}
.g-menu-item {
  display: flex; align-items: center; gap: clamp(.5rem, 1vw, .875rem);
  padding: clamp(.35rem, .7vw, .6rem) 0; text-decoration: none;
  border-bottom: 1px solid rgba(253, 197, 46, .12);
  transition: opacity var(--g-dur-base) ease;
}
.g-menu-item:hover { opacity: .75; }
.g-menu-item:last-of-type { border-bottom: 0; }
.g-menu-item__thumb {
  width: clamp(2.5rem, 3.5vw, 3.2rem); height: clamp(2.5rem, 3.5vw, 3.2rem);
  border-radius: var(--g-r-thumb); overflow: hidden; flex-shrink: 0; background: var(--g-line);
}
.g-menu-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-menu-item__client {
  display: block; font-family: var(--g-font-editorial); font-style: italic;
  font-size: clamp(.6rem, .8vw, .78rem); line-height: 1.2; color: var(--g-yellow);
}
.g-menu-item__result {
  display: block; font-family: var(--g-font-display); text-transform: uppercase;
  font-size: clamp(1rem, 1.55vw, 1.4rem); line-height: 1.1;
  letter-spacing: -0.02em; color: var(--g-white);
}
.g-menu-all {
  display: block; margin-top: clamp(.5rem, 1vw, .875rem);
  padding: clamp(.4rem, .7vw, .6rem) 0;
  border-top: 1px solid rgba(253, 197, 46, .25);
  font-family: var(--g-font-display); text-transform: uppercase;
  font-size: clamp(.75rem, 1vw, .9rem); letter-spacing: var(--g-ls-wide);
  color: var(--g-yellow); text-decoration: none;
}
.g-lang { display: flex; align-items: center; gap: .5rem; margin-top: var(--g-space-3); }
.g-lang a {
  font-family: var(--g-font-display); font-size: 1rem; line-height: 1;
  letter-spacing: 0.02em; color: var(--g-white); opacity: .55; text-decoration: none;
  transition: opacity var(--g-dur-base) ease, color var(--g-dur-base) ease;
}
.g-lang a:hover, .g-lang a[aria-current] { opacity: 1; color: var(--g-yellow); }
.g-lang span { color: var(--g-white); opacity: .35; }

/* ══════════════════════════════════════════════════════════════════════════
   FORM — campi scuri, INVIA è una pillola gialla
   ⚠️ Leggi 06-SICUREZZA.md prima di collegarlo a qualcosa che manda email.
   ══════════════════════════════════════════════════════════════════════════ */

.g-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; max-width: 640px; }
.g-form > .g-field--full, .g-form > .g-form__actions { grid-column: 1 / -1; }
@media (max-width: 1024px) { .g-form { grid-template-columns: 1fr; max-width: 420px; } }

.g-label { display: block; color: var(--g-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.g-input, .g-textarea {
  width: 100%; background: var(--g-field);
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--g-r-field);
  color: var(--g-white); padding: 0 16px; height: 46px;
  font-size: 14px; font-family: var(--g-font-body);
}
.g-textarea { height: 84px; min-height: 84px; padding: 12px 16px; resize: vertical; }
.g-input::placeholder, .g-textarea::placeholder { color: var(--g-placeholder); }
.g-input:focus, .g-textarea:focus { outline: none; border-color: var(--g-yellow); }
.g-form__actions { display: flex; justify-content: center; }
.g-submit {
  background: var(--g-yellow); color: var(--g-ink);
  border: 1.5px solid transparent; border-radius: var(--g-r-button);
  padding: 14.4px 44px; cursor: pointer;
  font-family: var(--g-font-display); text-transform: uppercase;
  font-size: 21.6px; letter-spacing: var(--g-ls-wide); line-height: 1;
  transition: transform .15s ease;
}
.g-submit:hover { transform: translateY(-2px); }
.g-form__note { font-family: var(--g-font-editorial); font-style: italic; color: var(--g-muted); font-size: 12px; }
.g-form__error { color: var(--g-danger); font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════════
   TRANSIZIONE DI PAGINA — due tratti che coprono e si ritirano
   Uno giallo, uno nero: si "disegnano" ingrossando lo stroke fino a coprire
   lo schermo; al caricamento della pagina nuova si ritirano dall'altro lato.
   Markup e SVG: vedi 04-MOTION.md. Il JS è in gerico-kit.js.
   ══════════════════════════════════════════════════════════════════════════ */

.g-page-transition {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  width: 100%; height: 100%;
  pointer-events: none; z-index: 99999;
  will-change: transform;
  /* Coperto di default: su mobile il render del path complesso può arrivare
     dopo il pageload, e senza questo si vede il flash della pagina nuova. */
  background-color: var(--g-ink-deep);
}
.g-page-transition svg { width: 100%; height: 100%; display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   CURSORE CUSTOM — solo dove esiste un mouse vero
   ⚠️ La regola imparata il 21/07: mai mostrare insieme quello custom e quello
   nativo. Le due media query devono restare speculari.
   ══════════════════════════════════════════════════════════════════════════ */

@media (hover: hover) and (pointer: fine) {
  html.g-cursor-on, html.g-cursor-on body, html.g-cursor-on * { cursor: none !important; }
}
@media not all and (hover: hover) and (pointer: fine) {
  .g-cursor { display: none !important; }
}
.g-cursor {
  position: fixed; top: 0; left: 0; width: 20px; height: 20px;
  margin: -10px 0 0 -10px; pointer-events: none; z-index: 2147483647;
  transition: opacity .18s ease;
}
.g-cursor.is-out { opacity: 0; }
.g-cursor img {
  position: absolute; display: block; pointer-events: none; user-select: none;
  transition: opacity var(--g-dur-fast) ease, transform var(--g-dur-fast) ease;
  transform-origin: center center;
}
.g-cursor__default { width: 30px; height: 43px; top: 8px; left: 8px; opacity: 1; transform: scale(1); }
.g-cursor__pointer { width: 37px; height: 44px; top: 10px; left: 0;  opacity: 0; transform: scale(.6); }
.g-cursor.is-hover .g-cursor__default { opacity: 0; transform: scale(.6); }
.g-cursor.is-hover .g-cursor__pointer { opacity: 1; transform: scale(1); }

/* ── ACCESSIBILITÀ ────────────────────────────────────────────────────────
   Chi ha chiesto meno movimento riceve la pagina, non l'animazione.        */
@media (prefers-reduced-motion: reduce) {
  .g-root *, .g-root *::before, .g-root *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .g-page-transition { display: none; }
  .g-clip::before { clip-path: none; }
}
