/* ==========================================================================
   Marketers Design System — Colors & Type
   v1.1 — April 2026
   Source: designer/references/Brand-Identity.md + Landing-Page.md
   ========================================================================== */

/* --------------------------------------------------------------------------
   Web fonts
   Tiempos Headline (Klim Type Foundry, commercial) is the official heading
   face. We don't have a license, so we substitute Playfair Display 800 from
   Google Fonts, exactly as the brand spec mandates as the fallback.
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,800;0,900;1,400;1,700;1,800;1,900&family=Inter:wght@300;400;500;600;700&family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* ============ COLORS ============ */

  /* Dark — background and structure */
  --dark-base:      #080D1A;          /* primary dark bg */
  --dark-base-alt:  #050d1f;          /* designer alt */
  --dark-mid:       #071228;          /* alternate dark sections */
  --dark-surface:   #0F1629;          /* nav, overlay surfaces */
  --dark-card:      #0c1a35;          /* slightly lighter card on dark */
  --dark-glass:     rgba(8,18,40,0.7);
  --grid-line:      #1A2038;          /* blueprint grid line */

  /* Blue — identity & action */
  --blue:           #1746f5;          /* CTA primary */
  --vivid-blue:     #1B1EFF;          /* maximum impact CTAs */
  --blue-mid:       #1a52ff;          /* hover */
  --electric-blue:  #4B6BFB;          /* secondary accent (labels, ticks) */
  --blue-light:     #6B8AFF;          /* italic accents, headline accent */
  --deep-blue:      #3451D1;
  --blue-medium:    #1A2860;          /* gradient stop, borders */
  --blue-pale:      #eef2ff;          /* brand pill bg */

  /* Light — breathing & legibility */
  --off-white:      #f4f6ff;          /* primary light bg */
  --light:          #eef1ff;          /* alt light bg */
  --ice:            #F0F2F8;          /* PDF/document light bg */
  --white:          #FFFFFF;
  --body-dark:      #444444;          /* body text on light */
  --muted:          rgba(8,16,31,0.46);
  --white-muted:    rgba(255,255,255,0.5);
  --body-light:     rgba(255,255,255,0.6);
  --subtitle-light: rgba(255,255,255,0.7);

  /* Accent — gradient filler ONLY, never type */
  --ember:          #E8793A;

  /* ============ APPROVED GRADIENTS ============ */
  --grad-cta-amber:    linear-gradient(135deg, #080D1A 0%, #1A2860 50%, #E8793A 100%);
  --grad-hero-soft:    linear-gradient(160deg, #1A2860 0%, #2A3F8F 40%, #E8793A 100%);
  --grad-avatar-blue:  linear-gradient(135deg, #1A2860, #4B6BFB);
  --grad-cta-hover:    linear-gradient(135deg, #1B1EFF, #4B6BFB);
  --grad-text-accent:  linear-gradient(135deg, #6B8AFF 0%, #a78bfa 40%, #c4b5fd 60%, #6B8AFF 100%);

  /* ============ FONTS ============ */
  --serif:    'Playfair Display', Georgia, 'Tiempos Headline', serif;
  --sans:     'Inter', 'DM Sans', system-ui, sans-serif;
  --sans-alt: 'DM Sans', 'Inter', system-ui, sans-serif;
  --mono:     'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ============ SPACING (8px base) ============ */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 40px;
  --space-3xl: 48px;
  --space-4xl: 56px;

  /* ============ RADII ============ */
  --radius-pill:    40px;
  --radius-card:    10px;
  --radius-btn:      8px;
  --radius-input:    8px;
  --radius-badge:    4px;
  --radius-image:   12px;
  --radius-section: 12px;

  /* ============ SHADOWS / GLOW ============ */
  --glow-sm:    0 0 10px rgba(23,70,245,0.35);
  --glow-md:    0 0 20px rgba(23,70,245,0.35);
  --glow-lg:    0 0 28px rgba(23,70,245,0.35);
  --glow-hover: 0 0 36px rgba(23,70,245,0.35);
  --glow-cta:   0 0 48px rgba(23,70,245,0.35), 0 8px 32px rgba(23,70,245,0.4);
  --glow-icon:  0 0 40px rgba(23,70,245,0.35);

  /* ============ BORDERS ============ */
  --border-light:   0.5px solid rgba(0,0,0,0.06);
  --border-dark:    0.5px solid rgba(255,255,255,0.07);
  --border-premium: 1.5px solid #4B6BFB;

  /* ============ BACKDROP BLUR ============ */
  --blur-sm: 6px;
  --blur-md: 12px;
  --blur-lg: 20px;
  --blur-xl: 24px;
}

/* ==========================================================================
   Semantic typography
   ========================================================================== */

.h-hero {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(42px, 6vw, 82px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.h1, h1.ds {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.1;
}

.h2, h2.ds {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(26px, 2.5vw, 34px);
  line-height: 1.15;
}

.h3, h3.ds {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

.subtitle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.5;
}

.body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.65;
}

.body-sm {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.6;
}

.section-label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--electric-blue);
}

.eyebrow,
.badge {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.mono-num {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--electric-blue);
}

.caption {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Headline italic accent — signature pattern */
.italic-accent {
  font-style: italic;
  color: var(--blue-light);
}

/* ==========================================================================
   Mobile-ready base (L1) — May 2026
   Conservativo: migliora mobile senza rompere desktop.
   Step successivi (L2): media queries per-section nei singoli JSX.
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  min-width: 0;
  max-width: 100vw;
}

img, video, svg, picture, iframe {
  max-width: 100%;
  height: auto;
}

/* Fluid type override per le classi semantiche già esistenti.
   Sotto 768px tutto si riduce con clamp(min, fluid, max). */
.h3, h3.ds {
  font-size: clamp(15px, 1.2vw + 12px, 18px);
}

.subtitle {
  font-size: clamp(15px, 0.6vw + 13px, 17px);
}

.body {
  font-size: clamp(14px, 0.3vw + 13px, 15px);
}

.body-sm {
  font-size: clamp(12px, 0.2vw + 11px, 13px);
}

.section-label,
.eyebrow,
.badge,
.mono-num {
  font-size: clamp(10px, 0.2vw + 9px, 11px);
}

.caption {
  font-size: clamp(11px, 0.2vw + 10px, 12px);
}

/* Tap-target minimo 44px su touch (Apple HIG) */
@media (hover: none) and (pointer: coarse) {
  button, a[role="button"], .btn {
    min-height: 44px;
  }
}

/* ==========================================================================
   L2 — Mobile drawer (navbar)
   Renderizzato fuori dal <nav> per evitare lo stacking context creato dal
   backdrop-filter del nav. Drawer è davvero position:fixed al viewport.
   z-index: 99 (sotto al nav: 100 → hamburger cliccabile mentre aperto).
   ========================================================================== */

.mw-nav-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  animation: fadein 0.25s ease both;
  cursor: pointer;
}

.mw-nav-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(86vw, 340px);
  background: #050d1f;
  border-left: 1px solid rgba(255,255,255,0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 99;
  overflow-y: auto;
  display: block;
  padding-top: 80px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}
.mw-nav-drawer.open { transform: translateX(0); }
.mw-nav-drawer-inner { padding: 8px 22px 48px; }

@media (min-width: 769px) {
  .mw-nav-drawer { display: none !important; }
  .mw-nav-burger { display: none !important; }
  .mw-nav-backdrop { display: none !important; }
}

/* ==========================================================================
   L2 — Mobile section overrides (≤ 768px)
   Strategia: attribute selectors su style inline per evitare di toccare
   ogni JSX. Tutte le grid multi-col collassano a single col, padding
   ridotti, font scalati. !important necessario per battere inline style.
   ========================================================================== */

@media (max-width: 768px) {
  /* ---- Grid layouts: multi-col → 1 col ---- */
  [style*="repeat(2, 1fr)"],
  [style*="repeat(3, 1fr)"],
  [style*="repeat(4, 1fr)"],
  [style*="repeat(5, 1fr)"],
  [style*="repeat(6, 1fr)"],
  [style*="repeat(7, 1fr)"],
  [style*="repeat(8, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* 2-col ratio layouts → 1 col */
  [style*="1.1fr 1fr"],
  [style*="1.15fr 1fr"],
  [style*="1.2fr 1fr"],
  [style*="1.3fr 1fr"],
  [style*="1.4fr 1fr"],
  [style*="1fr 1.1fr"],
  [style*="1fr 1.2fr"],
  [style*="1fr 1.3fr"],
  [style*="1fr 1.4fr"],
  [style*="0.7fr 1.3fr"],
  [style*="1fr 0.7fr"],
  [style*="34% 1fr"],
  [style*="320px 1fr"],
  [style*="2fr 1fr"],
  [style*="3fr 1fr"],
  [style*="1fr 2fr"],
  [style*="1fr 1fr"]:not([style*="52px"]):not([style*="auto"]):not([style*="14px 24px"]):not([style*="12px 32px"]) {
    grid-template-columns: 1fr !important;
  }

  /* Layout speciali multi-col con auto/colonne fisse */
  [style*="1.4fr auto auto auto auto"],
  [style*="repeat(4, 1fr) auto"],
  [style*="repeat(3, 1fr)"],
  [style*="1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Eccezioni: card piccole (speaker, loghi) → 2-col su mobile invece di 1.
     Pattern: grid 4+ col con gap piccolo = cards quadrate/foto. */
  [style*="repeat(4, 1fr)"][style*="gap: 16px"],
  [style*="repeat(4, 1fr)"][style*="gap: 12px"],
  [style*="repeat(4, 1fr)"][style*="gap: 8px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* Loghi aziende 7-col → 3-col */
  [style*="repeat(7, 1fr)"][style*="gap: 1px"],
  [style*="repeat(8, 1fr)"][style*="gap: 1px"],
  [style*="repeat(7, 1fr)"][style*="gap: 2px"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  /* Storia timeline orizzontale: lasciamola scrollabile invece di collassarla */
  [style*="grid-template-columns: repeat"][style*="position: relative"][style*="gap: 8px"] {
    overflow-x: auto !important;
    grid-template-columns: none !important;
    display: flex !important;
    gap: 16px !important;
    padding-bottom: 8px;
  }

  /* Grid con gap molto grande → ridotto */
  [style*="gap: 64px"],
  [style*="gap: 80px"],
  [style*="gap: 56px"] {
    gap: 28px !important;
  }
  [style*="gap: 48px"],
  [style*="gap: 40px"] {
    gap: 24px !important;
  }
  [style*="gap: 32px"] {
    gap: 18px !important;
  }

  /* ---- Section padding orizzontale ---- */
  /* La maggior parte delle <section> usa 56px orizzontale, troppo su mobile */
  section,
  [style*="padding: '56px 56px"],
  [style*="padding: '100px 56px"],
  [style*="padding: '120px 56px"],
  [style*="padding: '80px 56px"],
  [style*="padding: '14px 56px"],
  [style*="padding: '8px 56px"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Padding verticale grande → ridotto */
  [style*="padding: '120px"],
  [style*="padding: '100px"] {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }
  [style*="padding: '80px"] {
    padding-top: 44px !important;
    padding-bottom: 44px !important;
  }
  [style*="padding: '56px 56px 80px"] {
    padding-top: 36px !important;
    padding-bottom: 48px !important;
  }

  /* Margin-top grande → ridotto */
  [style*="marginTop: 64"],
  [style*="margin-top: 64"] {
    margin-top: 36px !important;
  }
  [style*="marginTop: 80"],
  [style*="margin-top: 80"] {
    margin-top: 44px !important;
  }
  [style*="marginTop: 100"],
  [style*="marginTop: 120"] {
    margin-top: 56px !important;
  }

  /* maxWidth forzati grandi → 100% del viewport */
  [style*="maxWidth: 560"],
  [style*="maxWidth: 600"],
  [style*="maxWidth: 700"],
  [style*="maxWidth: 800"] {
    max-width: 100% !important;
  }

  /* Flex con tanti elementi e gap grandi → wrap */
  [style*="display: flex"][style*="gap: 28"],
  [style*="display: flex"][style*="gap: 32"],
  [style*="display: flex"][style*="gap: 40"] {
    flex-wrap: wrap !important;
  }

  /* ---- TopBar ---- */
  .mw-topbar {
    padding: 6px 14px !important;
    font-size: 9px !important;
    letter-spacing: 0.10em !important;
  }
  .mw-topbar-right { display: none !important; }

  /* ---- Nav ---- */
  .mw-nav {
    grid-template-columns: 1fr auto !important;
    padding: 12px 16px !important;
    gap: 12px !important;
  }
  .mw-nav-links { display: none !important; }
  .mw-nav-cta { display: none !important; }
  .mw-nav-burger { display: inline-flex !important; }

  /* ---- Hero ---- */
  .mw-hero {
    padding: 28px 16px 48px !important;
  }
  .mw-hero-hud { display: none !important; }
  .mw-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* Hero stats — eccezione: 2x2 invece di 1 col, ultima riga full width */
  .mw-hero-stats {
    grid-template-columns: 1fr 1fr !important;
    margin-top: 36px !important;
  }
  .mw-hero-stats > div {
    padding: 18px 14px !important;
    border-right: 1px solid rgba(255,255,255,0.08) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .mw-hero-stats > div:nth-child(2n) {
    border-right: none !important;
  }
  .mw-hero-stats > div:nth-last-child(-n+1):nth-child(odd) {
    grid-column: 1 / -1;
    border-right: none !important;
    border-bottom: none;
  }
  .mw-hero-stats > div:nth-last-child(-n+2):nth-last-child(even),
  .mw-hero-stats > div:nth-last-child(1) {
    border-bottom: none;
  }
  /* Riduci la cifra grande nelle stats */
  .mw-hero-stats > div > div:first-child {
    font-size: 36px !important;
  }
  .mw-hero-stats > div > div:first-child span {
    font-size: 22px !important;
  }

  /* ---- Bottoni hero ---- */
  [style*="display: flex"][style*="gap: 12"] {
    flex-wrap: wrap !important;
  }
  /* PrimaryBtn / GhostBtn — full width su mobile */
  .mw-hero a[role="button"],
  .mw-hero button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ---- Bordi verticali in grid: rimuovi border-right su collasso ---- */
  /* Pattern comune nei JSX: borderRight per dividere col grid. Su mobile,
     col diventa 1, quindi la border-right diventa visivamente verticale
     orfana. La sostituiamo con border-bottom. */
  [style*="borderRight"] {
    border-right: none !important;
  }

  /* ---- Image sizing in card grandi ---- */
  img {
    max-width: 100%;
    height: auto;
  }

  /* ---- Ticker / scroll orizzontali animati: tienili contenuti ---- */
  [style*="overflow: hidden"][style*="white-space: nowrap"] {
    max-width: 100vw !important;
  }

  /* ---- Decorazioni che escono dal container (causano scroll orizz.) ---- */
  .mw-trailer-scribble { display: none !important; }

  /* Pattern generici: position absolute con left/right negativi grandi */
  [style*="left: -68"],
  [style*="left: -50"],
  [style*="right: -50"],
  [style*="right: -100"],
  [style*="top: -100"],
  [style*="top: -64"],
  [style*="left: -100"] {
    display: none !important;
  }

  /* ---- Trailer hero: aspect ratio più friendly su mobile ---- */
  .mw-trailer-wrap [style*="aspect-ratio: 4/5"],
  .mw-trailer-wrap [style*="aspectRatio: '4/5'"] {
    aspect-ratio: 16/10 !important;
  }
  /* Play button trailer: riduci dimensione */
  .mw-trailer-wrap button[style*="width: 96px"],
  .mw-trailer-wrap button[style*="width:96px"] {
    width: 64px !important;
    height: 64px !important;
  }

  /* ==========================================================================
     L3 — Edits specifici richiesti da Dario (16 mag 2026)
     ========================================================================== */

  /* Edit 2 — Nascondi countdown (giorni/ore/min/sec) + frase associata */
  .mw-countdown-bar,
  .mw-countdown-text { display: none !important; }

  /* Edit 3 — PastSpeakers ("Scordati talk noiosi"): 2 colonne invece di 1 */
  .mw-past-speakers-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Edit 4 — Box "vantaggio competitivo": titolo sopra, CTA sotto, CTA full width */
  .mw-quote-cta {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 24px !important;
    padding: 28px 22px !important;
  }
  .mw-quote-cta > p {
    font-size: 20px !important;
    max-width: 100% !important;
  }
  .mw-quote-cta a[role="button"],
  .mw-quote-cta > a {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Edit 5 — Testimonianze (avatar cerchi): 3 per riga
     Doppia classe per aumentare specificità e battere panic-mode + cache */
  .mw-testimonianze-avatars.mw-testimonianze-avatars {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
    max-width: 100% !important;
  }
  .mw-testimonianze-avatars.mw-testimonianze-avatars > button {
    min-width: 0 !important;
  }
  .mw-testimonianze-avatars.mw-testimonianze-avatars > button > div:first-child {
    width: clamp(56px, 18vw, 80px) !important;
    height: clamp(56px, 18vw, 80px) !important;
  }

  /* Edit 6 — Nascondi sezione "Sponsor del MW26" */
  .mw-sponsors-section { display: none !important; }

  /* Edit 7 — Testimonianze: frame 9:16 centrato su mobile, max 280px,
     link verticale "Ascolta tutte le rockstar" nascosto (occupava troppo spazio) */
  .mw-testimonianze-frame-wrap {
    justify-content: center !important;
    margin-top: 32px;
    gap: 0 !important;
  }
  .mw-testimonianze-frame {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 280px !important;
  }
  .mw-testimonianze-frame-wrap > a {
    display: none !important;
  }
}

/* ---- Mobile small (≤ 480px) — ulteriori riduzioni ---- */
@media (max-width: 480px) {
  .mw-topbar {
    font-size: 8px !important;
  }
  .mw-hero {
    padding: 22px 14px 40px !important;
  }
  .mw-hero-stats > div > div:first-child {
    font-size: 30px !important;
  }
  section,
  [style*="padding: '56px 56px"],
  [style*="padding: '100px 56px"],
  [style*="padding: '120px 56px"],
  [style*="padding: '80px 56px"] {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}
