/* ============================================================
   AI BOX — styles.css
   Reusable UI components + section layouts + footer + responsive.
   Design tokens/reset/typography live in base.css;
   @keyframes and the scroll-reveal engine live in animations.css.
   ============================================================ */

/* ============================================================
   COMPONENTS — reusable UI
   ============================================================ */

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease),
              backdrop-filter var(--t-base);
}

.nav.scrolled {
  background: var(--nav-scrim);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-heading);
}

.brand .mark { width: 26px; height: 26px; flex: none; }
.brand .mark svg { width: 100%; height: 100%; display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  padding: 8px 14px;
  font-size: var(--text-small);
  color: var(--fg-muted);
  border-radius: 8px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.nav-links a:hover {
  color: var(--fg);
  background: var(--hover-wash);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--whatsapp);
  color: var(--whatsapp-ink);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

.nav-cta:hover { transform: translateY(-1px); opacity: 0.9; }
.nav-cta svg { flex: none; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  position: relative;
  transition: transform var(--t-fast) var(--ease);
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--fg);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}

.nav-toggle span::before { top: -7px; }
.nav-toggle span::after  { top: 7px; }

body.menu-open .nav-toggle span { background: transparent; }
body.menu-open .nav-toggle span::before { transform: translateY(7px) rotate(45deg); }
body.menu-open .nav-toggle span::after  { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 680px) {
  .nav-links  { display: none; }
  .nav-cta    { display: none; }
  .nav-toggle { display: flex; }

  /* Mobile menu overlay */
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: fixed;
    inset: var(--nav-h) var(--gutter) auto var(--gutter);
    z-index: 99;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
  }

  .nav-links.open a {
    width: 100%;
    font-size: 1.1rem;
    padding: 14px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: var(--weight-medium);
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-whatsapp { background: var(--whatsapp); color: var(--whatsapp-ink); }

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -12px rgba(37, 211, 102, 0.55);
}

.btn-whatsapp svg { flex: none; }

.btn-ghost { border: 1px solid var(--border-strong); color: var(--fg); }

.btn-ghost:hover {
  background: var(--fg);
  color: var(--bg);
  transform: translateY(-2px);
}

/* Compact variant for box-card footers */
.btn--small { padding: 10px 18px; font-size: var(--text-small); }

.btn .arrow { transition: transform var(--t-fast) var(--ease); }
.btn:hover .arrow { transform: translate(3px, -3px); }

/* ---------- CTA band ---------- */
.band {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: clamp(48px, 8vw, 110px) var(--gutter);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  text-align: center;
}

.band .band-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(60% 120% at 50% 0%, rgba(110, 231, 249, 0.14), transparent 60%);
}

.band > * { position: relative; z-index: 1; }

.band .eyebrow { justify-content: center; }

.band .h2 {
  margin-top: var(--sp-3);
  max-width: 22ch;
  margin-inline: auto;
}

.band .lead {
  max-width: 52ch;
  margin: 20px auto 0;
}

.band .band-note {
  margin: 16px auto 36px;
  font-size: var(--text-small);
  color: var(--fg-faint);
}

/* ============================================================
   SECTIONS — page layouts
   ============================================================ */

/* ---------- Hero (full-screen video) ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(48px, 8vw, 120px);
  padding-top: 140px;
  overflow: hidden;
}

/* The <video> and its poster share this layer. Poster shows first;
   JS adds .is-playing once autoplay succeeds (fades the video in).
   When autoplay is blocked (iOS Low Power) or reduced-motion is on,
   the poster simply remains — the video is progressive enhancement. */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-elev-2);
}

.hero__video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.hero__video.is-playing { animation: videoIn var(--t-slow) var(--ease) forwards; }

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(10, 10, 11, 0.92) 0%, rgba(10, 10, 11, 0.25) 45%, rgba(10, 10, 11, 0.55) 100%),
    radial-gradient(70% 60% at 80% 10%, rgba(110, 231, 249, 0.10), transparent 60%),
    radial-gradient(70% 60% at 10% 90%, rgba(167, 139, 250, 0.10), transparent 62%);
}

.hero .container { position: relative; z-index: 2; }

.hero-headline { max-width: 22ch; }

.hero-sub {
  max-width: 52ch;
  margin-top: clamp(20px, 3vw, 32px);
}

.hero-cta { margin-top: clamp(28px, 4vw, 44px); }

.scroll-cue {
  position: absolute;
  bottom: 28px;
  right: var(--gutter);
  z-index: 2;
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  gap: 10px;
}

.scroll-cue::after {
  content: '';
  width: 1px;
  height: 40px;
  background: linear-gradient(var(--fg-faint), transparent);
  animation: cue 2s var(--ease) infinite;
}

/* Section heading directly under its eyebrow */
.eyebrow + .h2 { margin-top: var(--sp-3); }

/* ---------- Come funziona (4 steps + positioning callout) ---------- */
.steps {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: clamp(32px, 5vw, 56px);
}

.step {
  background: var(--bg);
  padding: clamp(28px, 3.5vw, 44px);
  transition: background var(--t-fast) var(--ease);
}

.step:hover { background: var(--bg-elev); }

.step .num {
  font-size: var(--text-step);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: 1;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.step h3 { margin: 18px 0 10px; }

.step p { color: var(--fg-muted); font-size: 0.98rem; }

/* Positioning line — deliberately louder than the steps above */
.positioning {
  position: relative;
  overflow: hidden;
  margin-top: clamp(24px, 3vw, 40px);
  padding: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 56px);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(80% 140% at 0% 50%, rgba(110, 231, 249, 0.08), transparent 60%),
    var(--bg-elev);
  font-size: var(--text-lead);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
  line-height: 1.4;
  max-width: none;
}

/* ---------- Box grid ---------- */
.boxes-head { margin-bottom: clamp(32px, 5vw, 56px); }

.boxes-head .h2 { margin-top: var(--sp-3); }

.boxes-head .lead { margin-top: var(--sp-3); max-width: 52ch; }

/* Family filter chips */
.box-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: clamp(20px, 3vw, 32px);
}

.box-filter button {
  padding: 9px 18px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: var(--text-small);
  color: var(--fg-muted);
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}

.box-filter button:hover { color: var(--fg); background: var(--hover-wash); }

.box-filter button[aria-pressed='true'] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.box-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Family block: header + grid of cards */
.box-family { margin-top: clamp(48px, 7vw, 80px); }

.box-family__head { max-width: 62ch; }

.box-family__head .muted { margin-top: 10px; }

.box-family__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: clamp(14px, 1.6vw, 22px);
  margin-top: clamp(20px, 3vw, 32px);
}

/* Keep single cards from stretching full width in a 1-card family */
.box-family__grid > .box-card { max-width: 640px; }

/* ---------- Box card ---------- */
.box-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Media area: poster <img> + muted loop <video> layered like the
   hero. Click opens the gallery lightbox (audio only on request). */
.box-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.box-media:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.box-media__poster {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-elev-2);
}

.box-media__video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.box-media__video.is-playing { animation: videoIn var(--t-slow) var(--ease) forwards; }

.box-media::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to top, var(--card-scrim) 0%, transparent 45%);
  pointer-events: none;
}

/* Card labels (durata · formato · voce/musica) over the media */
.box-media__tags {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: clamp(14px, 2vw, 20px);
}

.box-media__tags .tag {
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--nav-scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.box-media .play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 11, 0.45);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}

.box-media .play svg { width: 20px; height: 20px; margin-left: 2px; }

.box-media:hover .play {
  background: var(--accent);
  color: var(--accent-ink);
  transform: translate(-50%, -50%) scale(1.06);
}

/* Card body */
.box-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  padding: clamp(22px, 2.6vw, 32px);
}

.box-card__body h4 {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-heading);
}

.box-card__tagline {
  color: var(--fg-muted);
  font-size: var(--text-lead);
  line-height: 1.35;
}

.box-card__line { color: var(--fg-muted); font-size: 0.98rem; }

.box-card__line strong { color: var(--fg); font-weight: var(--weight-medium); }

.box-card__list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--fg-muted);
  font-size: 0.98rem;
}

.box-card__list li {
  padding-left: 18px;
  position: relative;
}

.box-card__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

/* Highlighted one-liner inside a card (e.g. Box Ads) */
.box-card__note {
  padding: 12px 16px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--hover-wash);
  color: var(--fg-muted);
  font-size: var(--text-small);
}

/* Price + CTA footer, pinned to the card bottom */
.box-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.box-card__price {
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-heading);
  color: var(--accent);
}

.box-card__price small {
  font-size: var(--text-small);
  font-weight: var(--weight-regular);
  color: var(--fg-muted);
}

/* "Serve tutto?" full-width closing row */
.box-cta-row {
  position: relative;
  overflow: hidden;
  margin-top: clamp(48px, 7vw, 80px);
  padding: clamp(32px, 5vw, 64px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(70% 140% at 85% 0%, rgba(167, 139, 250, 0.10), transparent 60%),
    var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 48px);
  flex-wrap: wrap;
}

.box-cta-row .lead { max-width: 46ch; margin-top: 10px; }

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: clamp(32px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each question is a card; the open one lifts to an elevated
   surface with an accent bar so the state is obvious at a glance. */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}

.faq-item:hover { background: var(--hover-wash); }

.faq-item[open] {
  background: var(--bg-elev);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: clamp(18px, 2.5vw, 24px) clamp(18px, 2.5vw, 28px);
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-h3);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-heading);
  transition: color var(--t-fast) var(--ease);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary:hover,
.faq-item[open] summary { color: var(--accent); }

.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.faq-item summary .faq-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

.faq-item[open] summary .faq-icon {
  transform: rotate(45deg);
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.faq-item .faq-body {
  padding: 0 clamp(18px, 2.5vw, 28px) clamp(20px, 3vw, 28px);
  max-width: 72ch;
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-body strong { color: var(--fg); font-weight: var(--weight-medium); }

.faq-body ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-body ul li {
  padding-left: 18px;
  position: relative;
}

.faq-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------- Lightbox (gallery, controlled by js/gallery.js) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: var(--gutter);
  background: rgba(6, 6, 8, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox.is-open { display: grid; animation: fadeIn var(--t-fast) var(--ease); }

.lightbox__dialog {
  position: relative;
  width: min(100%, 1100px);
  animation: popIn var(--t-base) var(--ease);
}

.lightbox__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 80dvh;
  margin-inline: auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #000;
}

.lightbox__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.8);
  transition: transform var(--t-fast) var(--ease);
}

.lightbox__close:hover { transform: rotate(90deg); }

.lightbox__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Gallery navigation (shown only when a box has more than one video) */
.lightbox__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
}

.lightbox__arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--fg);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.lightbox__arrow:hover { background: var(--fg); color: var(--bg); }

.lightbox__arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.lightbox__counter {
  font-size: var(--text-small);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 680px) {
  .lightbox__close { top: 8px; right: 8px; }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding-block: clamp(48px, 7vw, 80px) 40px;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 56px);
  flex-wrap: wrap;
}

.footer-brand { font-size: 1.15rem; }

.footer-legal {
  color: var(--fg-muted);
  font-size: var(--text-small);
  margin-top: var(--sp-3);
}

.footer-links {
  list-style: none;
  padding: 0;
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--fg-muted);
  font-size: var(--text-small);
  transition: color var(--t-fast);
}

.footer-links a:hover { color: var(--fg); }

.footer-bottom {
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--fg-faint);
  font-size: 0.85rem;
}

/* ---------- Hero accent word ---------- */
.accent-word {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.1em;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .box-cta-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 680px) {
  .scroll-cue { display: none; }
  .faq-item summary { font-size: var(--text-lead); }
}
