/* Pagina di presentazione di BeNews. Il fondo è quello del video (blu notte, una brace in basso a destra): le schermate
   sono fotogrammi del video e ci si appoggiano senza bordo. Carattere Inter, come il gestionale. */
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter/inter-latin-variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --night: #0e141c;          /* fondo del video */
    --night-raised: #151d28;
    --night-line: #2a3542;
    --on-night: #eef3f8;
    --on-night-soft: #a9b8c8;  /* 8,6:1 su --night */
    --azure: #8fc5ee;          /* accento del menu del gestionale */
    --blue: #1f61a5;           /* i due colori del logo */
    --violet: #514877;
    --ember: #b4532a;          /* la brace del fondo del video */
    --paper: #f3f6fa;
    --white: #ffffff;
    --ink: #242a30;
    --ink-soft: #5f6b74;
    --line: #c8d1da;
    --action: #2b6cab;
    --action-deep: #194b75;
    --danger: #b3261e;
    --ok: #1d7a4c;
    --gutter: clamp(20px, 5vw, 56px);
    --wrap: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* Scorrimento morbido solo dopo un clic: all'apertura con un'ancora (dopo l'invio del modulo) la pagina è già lì. */
html:focus-within { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--night);
    color: var(--on-night);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
    font-feature-settings: "cv11", "ss03";
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, p, dl, dd, figure { margin: 0; }

a { color: inherit; }

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

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 10; padding: .6rem 1rem; background: var(--white); color: var(--ink); border-radius: 8px; }
.skip:focus { top: .75rem; }

/* Pulsanti: uno pieno chiaro sul fondo scuro, uno blu sul fondo chiaro, uno a filo. */
.button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: .7rem 1.35rem;
    border: 1px solid transparent; border-radius: 999px;
    font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.button-light { background: var(--white); color: var(--ink); }
.button-light:hover { background: #dbe7f3; }
.button-line { border-color: #55657a; color: var(--on-night); }
.button-line:hover { border-color: var(--on-night); }
.button-quiet { min-height: 40px; padding: .45rem 1rem; border-color: #55657a; color: var(--on-night); font-size: .9375rem; }
.button-quiet:hover { border-color: var(--on-night); }
.button-action { background: var(--action); color: var(--white); }
.button-action:hover { background: var(--action-deep); }

/* Testata */
.top { position: relative; z-index: 2; padding-block: 18px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: block; flex: none; }
.brand img { width: 180px; height: auto; }

/* Il piano di fondo: tre luci ferme sullo schermo, che scorrono più piano della pagina (landing.js dà --sy). I colori
   sono quelli del fondo del video: il blu e il viola del logo, la brace in basso a destra. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.glow { position: absolute; border-radius: 50%; will-change: transform; }
.glow-blue {
    width: 95vmax; height: 95vmax; left: -34vmax; top: -46vmax;
    background: radial-gradient(closest-side, rgba(31, 97, 165, .5), transparent);
    transform: translate3d(0, calc(var(--sy, 0) * -.1px), 0);
}
.glow-ember {
    width: 70vmax; height: 70vmax; right: -34vmax; top: 34vh;
    background: radial-gradient(closest-side, rgba(180, 83, 42, .3), transparent);
    transform: translate3d(0, calc(var(--sy, 0) * -.2px), 0);
}
.glow-violet {
    width: 85vmax; height: 85vmax; left: -20vmax; top: 150vh;
    background: radial-gradient(closest-side, rgba(81, 72, 119, .5), transparent);
    transform: translate3d(0, calc(var(--sy, 0) * -.32px), 0);
}

/* Apertura: il titolo è l'immagine. Scorrendo resta indietro e si spegne, mentre la finestra gli passa davanti. */
.hero { position: relative; z-index: 0; padding-block: clamp(32px, 5.5vw, 72px) clamp(32px, 4.5vw, 56px); }
.has-motion .hero-text {
    transform: translate3d(0, calc(var(--sy, 0) * .24px), 0);
    opacity: clamp(0, calc(1 - var(--sy, 0) / 520), 1);
    will-change: transform, opacity;
}
.hero h1 {
    max-width: 17ch;
    font-size: clamp(2.5rem, 7.4vw, 5.75rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.042em;
    text-wrap: balance;
}
.lede {
    max-width: 58ch; margin-top: clamp(20px, 3vw, 32px);
    color: var(--on-night-soft); font-size: clamp(1.0625rem, 1.6vw, 1.3125rem); line-height: 1.55;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(24px, 3.4vw, 40px); }

/* Una finestra: l'immagine ferma e, sopra, la clip muta che landing.js aggiunge quando il movimento è gradito. */
.window { position: relative; overflow: hidden; }
.window > img { width: 100%; }
.clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.is-live > .clip { opacity: 1; }

/* La scena di apertura: la finestra è inclinata in prospettiva e si raddrizza salendo (landing.js dà --p, da 0 a 1).
   È l'unico elemento con una luce propria. */
.stage { position: relative; z-index: 1; padding-bottom: clamp(64px, 10vw, 144px); scroll-margin-top: 24px; }
.stage-scene { perspective: 1800px; perspective-origin: 50% 30%; }
.stage-frame { position: relative; border-radius: clamp(12px, 2vw, 22px); }
.has-motion .stage-frame {
    transform: rotateX(calc((1 - var(--p, 1)) * 24deg)) scale(calc(.88 + var(--p, 1) * .12));
    transform-origin: 50% 40%;
    will-change: transform;
}
.stage-frame > .window {
    aspect-ratio: 16 / 9; border: 1px solid var(--night-line); border-radius: inherit; background: #0a0d12;
    box-shadow: 0 0 0 1px rgba(143, 197, 238, .06), 0 40px 120px -30px rgba(31, 97, 165, .7), 0 30px 90px -40px rgba(81, 72, 119, .95);
}
.stage-frame > .window > img { height: 100%; object-fit: cover; }
.stage-cta {
    position: absolute; left: clamp(10px, 2vw, 24px); bottom: clamp(10px, 2vw, 24px);
    display: inline-flex; align-items: center; gap: 12px; padding: 8px 20px 8px 8px;
    border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px;
    background: rgba(14, 20, 28, .84); color: var(--white); text-decoration: none;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
    transition: background-color .15s ease, border-color .15s ease;
}
.stage-cta:hover { background: rgba(14, 20, 28, .96); border-color: rgba(255, 255, 255, .45); }
.play-disc {
    display: grid; place-items: center; flex: none; width: 44px; aspect-ratio: 1; padding-left: 3px;
    border-radius: 50%; background: var(--white); color: var(--ink);
    transition: transform .2s ease;
}
.stage-cta:hover .play-disc, .stage-cta:focus-visible .play-disc { transform: scale(1.08); }
.play-text { display: flex; flex-direction: column; line-height: 1.25; }
.play-text strong { font-size: 1rem; font-weight: 650; }
.play-text span { font-size: .8125rem; color: #c3d0dd; }
/* Il video completo nella finestra: la finestra si raddrizza e i comandi sono quelli del browser. */
.film { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }
.stage-frame.is-watching, .has-motion .stage-frame.is-watching { transform: none; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.is-watching .stage-cta { display: none; }
.film-close {
    position: absolute; top: clamp(8px, 1.4vw, 16px); right: clamp(8px, 1.4vw, 16px);
    display: grid; place-items: center; width: 40px; height: 40px;
    border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%; background: rgba(14, 20, 28, .72); color: var(--white); cursor: pointer;
}
.film-close:hover { background: rgba(14, 20, 28, .95); }
.stage-note { margin-top: 18px; color: var(--on-night-soft); font-size: .875rem; }

/* Funzioni: testo da un lato, finestra dall'altro, a lati alterni. Scorrendo la finestra corre più del testo e si
   raddrizza al centro dello schermo (landing.js dà --v: 1 sotto lo schermo, 0 al centro, -1 sopra). */
.takes { display: grid; gap: clamp(72px, 11vw, 152px); padding-bottom: clamp(80px, 12vw, 168px); }
.take { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(28px, 5vw, 72px); perspective: 1600px; }
.take:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.take:nth-child(even) .take-text { order: 2; }
.take h2, .pocket h2, .contact h2 {
    font-size: clamp(1.75rem, 3.4vw, 2.75rem); font-weight: 750; line-height: 1.08; letter-spacing: -.03em; text-wrap: balance;
}
.take p { margin-top: 16px; color: var(--on-night-soft); max-width: 44ch; }
.take-shot .window {
    border-radius: clamp(8px, 1vw, 13px);
    box-shadow: 0 0 0 1px var(--night-line), 0 30px 80px -30px rgba(0, 0, 0, .9), 0 24px 90px -40px rgba(31, 97, 165, .6);
}
.has-motion .take-shot {
    transform: translate3d(0, calc(var(--v, 0) * 64px), 0) rotateX(calc(var(--v, 0) * 9deg));
    will-change: transform;
}
.has-motion .take-text { transform: translate3d(0, calc(var(--v, 0) * -26px), 0); will-change: transform; }

/* Telefoni: due schermate, la seconda più in basso; escono dal fondo della fascia. */
.pocket { background: var(--night-raised); border-top: 1px solid var(--night-line); overflow: hidden; }
.pocket-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.pocket-text { padding-block: clamp(56px, 9vw, 120px); }
.pocket-text > p { margin-top: 16px; color: var(--on-night-soft); max-width: 44ch; }
.extras { display: grid; gap: 22px; margin-top: clamp(32px, 4vw, 48px); padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--night-line); max-width: 46ch; }
.extras dt { font-weight: 650; }
.extras dd { margin-top: 2px; color: var(--on-night-soft); }
.phones { display: flex; justify-content: center; gap: clamp(14px, 2.4vw, 28px); padding-top: clamp(56px, 9vw, 120px); margin-bottom: -90px; }
.phone {
    flex: 0 1 270px; min-width: 0; align-self: flex-start;
    padding: 7px; border-radius: clamp(26px, 3.4vw, 40px);
    background: #05070a; box-shadow: 0 0 0 1px #3a4656, 0 30px 70px -20px rgba(0, 0, 0, .7);
}
.phone .window { border-radius: clamp(20px, 2.8vw, 33px); }
.phone-second { margin-top: clamp(40px, 6vw, 84px); }
/* I due telefoni salgono a velocità diverse. */
.has-motion .phone { transform: translate3d(0, calc(var(--v, 0) * 46px), 0); will-change: transform; }
.has-motion .phone-second { transform: translate3d(0, calc(var(--v, 0) * -58px), 0); }

/* Contatti: l'unica fascia chiara, dove tocca a chi legge. */
.contact { background: var(--paper); color: var(--ink); padding-block: clamp(56px, 9vw, 120px); scroll-margin-top: 0; }
.contact-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.contact-text p { margin-top: 16px; color: var(--ink-soft); max-width: 40ch; }
.contact :focus-visible { outline-color: var(--action); }

.form { display: grid; gap: 18px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; font-size: .9375rem; font-weight: 600; }
.optional { font-weight: 400; color: var(--ink-soft); }
.field input:not([type="checkbox"]), .field textarea {
    display: block; width: 100%; padding: .7rem .85rem;
    border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink);
    font: inherit; font-size: 1rem; line-height: 1.4;
}
.field textarea { resize: vertical; min-height: 8.5rem; }
.field input:not([type="checkbox"]):focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--action); border-radius: 10px; }
.field input[aria-invalid="true"]:not([type="checkbox"]), .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field-error { margin-top: 6px; color: var(--danger); font-size: .875rem; }
.field-check { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: start; }
.field-check input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--action); }
.field-check label { margin: 0; font-weight: 400; }
.field-check a { color: var(--action-deep); }
.field-check .field-error { grid-column: 1 / -1; }
.form .button { justify-self: start; margin-top: 4px; }
.form-alert { padding: 12px 16px; border-left: 4px solid var(--danger); border-radius: 6px; background: #fbe9e7; color: #7a1a14; font-size: .9375rem; }
.trap { position: absolute; left: -200vw; width: 1px; height: 1px; overflow: hidden; }
.sent { padding: clamp(24px, 4vw, 40px); border-left: 4px solid var(--ok); border-radius: 6px; background: var(--white); }
.sent h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.sent p { margin-top: 8px; color: var(--ink-soft); }

/* Piè di pagina */
.foot { background: var(--night); padding-block: 36px; border-top: 1px solid var(--night-line); color: var(--on-night-soft); font-size: .875rem; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.foot-row img { width: 112px; }
.foot-company { display: flex; flex-wrap: wrap; gap: 4px 20px; flex: 1 1 auto; }
.foot-link { color: var(--on-night); }

/* Pagine di testo: informativa ed errore. */
.prose { padding-block: clamp(32px, 6vw, 72px) clamp(56px, 9vw, 112px); }
.prose h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; line-height: 1.04; letter-spacing: -.035em; }
.prose-body { max-width: 68ch; margin-top: clamp(24px, 4vw, 40px); color: #d3dde8; }
.prose-body h2 { margin-top: 2.2em; color: var(--on-night); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.prose-body p, .prose-body ul { margin-top: .9em; }
.prose-body ul { padding-left: 1.2em; }
.prose-body a { color: var(--azure); }
.prose-updated { margin-top: 2.4em; color: var(--on-night-soft); font-size: .9375rem; }

/* Il video completo: un riquadro sopra la pagina, che landing.js riempie al clic e svuota alla chiusura. */
.theater {
    width: min(94vw, 149vh, 1280px); max-width: none; max-height: none; padding: 56px 0 0; overflow: visible;
    border: 0; background: transparent; color: var(--white);
}
.theater::backdrop { background: rgba(6, 9, 13, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.theater-frame { aspect-ratio: 16 / 9; overflow: hidden; border-radius: clamp(8px, 1.2vw, 16px); background: #000; box-shadow: 0 40px 120px rgba(0, 0, 0, .7); }
.theater-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.theater-close {
    position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 44px; height: 44px;
    border: 1px solid rgba(255, 255, 255, .28); border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--white); cursor: pointer;
}
.theater-close:hover { background: rgba(255, 255, 255, .2); }

@media (prefers-reduced-motion: no-preference) {
    .theater[open] { animation: theater-in .28s cubic-bezier(.2, .7, .2, 1); }
    @keyframes theater-in { from { opacity: 0; transform: scale(.96); } }
}
@media (prefers-reduced-motion: reduce) {
    html:focus-within { scroll-behavior: auto; }
    .button, .play-disc, .stage-cta, .clip, .stage-frame.is-watching { transition: none; }
}

@media (max-width: 899px) {
    .take, .take:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .take:nth-child(even) .take-text { order: 0; }
    /* La schermata esce dal bordo dello schermo: se ne legge una parte a grandezza utile invece di una miniatura. */
    .take-shot { overflow: hidden; padding-block: 4px 40px; margin-bottom: -40px; }
    .take-shot .window { width: 160%; }
    .take-shot-left { margin-right: calc(-1 * var(--gutter)); padding-left: 1px; }
    .take-shot-right { margin-left: calc(-1 * var(--gutter)); padding-right: 1px; }
    .take-shot-right .window { margin-left: calc(-60% - var(--gutter)); }
    /* Su schermi stretti resta lo scorrimento a due velocità, senza inclinazione. */
    .has-motion .take-shot { transform: translate3d(0, calc(var(--v, 0) * 28px), 0); }
    .has-motion .take-text { transform: none; }
    .has-motion .stage-frame { transform: rotateX(calc((1 - var(--p, 1)) * 16deg)) scale(calc(.92 + var(--p, 1) * .08)); }
    .has-motion .phone { transform: translate3d(0, calc(var(--v, 0) * 22px), 0); }
    .has-motion .phone-second { transform: translate3d(0, calc(var(--v, 0) * -30px), 0); }
    .pocket-row, .contact-row { grid-template-columns: minmax(0, 1fr); }
    .pocket-text { padding-bottom: 0; }
    .phones { padding-top: 40px; }
}

@media (max-width: 520px) {
    .field-pair { grid-template-columns: 1fr; }
    .button-quiet { padding-inline: .8rem; font-size: .875rem; }
    /* Sulla pagina iniziale lo stesso pulsante è subito sotto il titolo. */
    .top-home .button-quiet { display: none; }
    .brand img { width: 140px; }
    .actions .button { flex: 1 1 100%; }
    .form .button { justify-self: stretch; }
    .phones { margin-bottom: -60px; }
    /* Sulla finestra piccola resta il solo disco: il testo lo legge chi usa un lettore di schermo, e il pulsante
       «Guarda il video» è subito sopra. */
    .stage-cta { padding: 6px; gap: 0; }
    .stage-cta .play-disc { width: 40px; }
    .play-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .theater { padding-top: 52px; }
}
