/* =========================================================
   DGA Vision – one page
   ========================================================= */

:root {
    --viola: #9e18fd;
    --viola-scuro: #8618e5;
    --lilla: #f6effc;
    --nero: #0d0d0d;
    --testo: #2b2b2b;
    --grigio: #6b6b6b;
    --bianco: #ffffff;
    --bordo: #e4d8f0;
    --errore: #d4183d;
    --ok: #138a52;

    --font-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-title: "Plus Jakarta Sans", "Montserrat", system-ui, sans-serif;

    --radius: 18px;
    --header-h: 76px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--testo);
    background: var(--bianco);
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: var(--viola);
}

h1, h2, h3, h4 {
    font-family: var(--font-title);
    color: var(--nero);
    line-height: 1.15;
    margin: 0 0 .5em;
}

h2 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 40px);
}

.eyebrow {
    margin: 0 0 .6em;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--viola);
}

.accent {
    color: var(--viola);
}

.section-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 48px;
}

.section-head__hint {
    color: var(--grigio);
    margin: 0;
}

/* ---------- Bottoni ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 30px;
    border-radius: 999px;
    border: 2px solid var(--viola);
    font: 700 .85rem/1 var(--font-body);
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}

.btn--primary {
    background: var(--viola);
    color: var(--bianco);
}

.btn--primary:hover {
    background: var(--viola-scuro);
    border-color: var(--viola-scuro);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(158, 24, 253, .3);
}

.btn--ghost {
    background: transparent;
    color: var(--viola);
}

.btn--ghost:hover {
    background: var(--viola);
    color: var(--bianco);
}

.btn:focus-visible,
.flip:focus-visible,
.nav a:focus-visible {
    outline: 3px solid var(--viola);
    outline-offset: 3px;
}

/* ---------- Header ---------- */

.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    transition: box-shadow .3s;
}

.header.is-scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, .06);
}

.header__inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo img {
    width: 180px;
}

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

.nav a {
    color: var(--nero);
    text-decoration: none;
    font-weight: 600;
    font-size: .82rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    transition: color .2s;
}

.nav a:hover {
    color: var(--viola);
}

.nav .nav__cta {
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--viola);
    color: var(--bianco);
}

.nav .nav__cta:hover {
    background: var(--viola-scuro);
    color: var(--bianco);
}

.header__toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    background: none;
    cursor: pointer;
}

.header__toggle span {
    display: block;
    height: 2px;
    margin: 5px 0;
    background: var(--nero);
    transition: transform .3s, opacity .3s;
}

.header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
    padding-block: clamp(48px, 8vw, 110px);
    overflow: hidden;
}

.hero__inner {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 40px;
}

.hero__title {
    font-size: clamp(2.4rem, 6vw, 4.4rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: .4em;
}

.hero__title em {
    position: relative;
    display: inline-block;
    font-style: normal;
    color: var(--viola);
}

.squiggle {
    position: absolute;
    left: 0;
    bottom: -.18em;
    width: 100%;
    height: .3em;
    overflow: visible;
}

.squiggle path {
    fill: none;
    stroke: var(--viola);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 1.3s .4s ease-out forwards;
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

.hero__kicker {
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: .9rem;
    color: var(--nero);
    margin-top: 0;
}

.hero__text > p:not(.hero__kicker) {
    max-width: 560px;
    color: var(--testo);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

.hero__visual {
    max-width: 400px;
    width: 100%;
    justify-self: center;
}

.hero__mascot {
    width: 100%;
}

/* ---------- Servizi (flip card) ---------- */

.services {
    padding-block: clamp(64px, 9vw, 120px);
    background: var(--lilla);
}

.services .container {
    max-width: 1440px;
}

.services__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.flip {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
    perspective: 1200px;
}

.flip__inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}

/* Classi gestite da main.js: is-hovered solo col mouse, is-flipped al tap */
.flip.is-hovered .flip__inner,
.flip.is-flipped .flip__inner {
    transform: rotateY(180deg);
}

.flip__front,
.flip__back {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flip__front {
    background: var(--viola);
    box-shadow: 0 10px 30px rgba(134, 24, 229, .18);
}

.flip__front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flip__back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    padding: 24px 26px;
    background: var(--nero);
    color: var(--bianco);
    font-size: .92rem;
    line-height: 1.55;
    overflow-y: auto;
}

.flip__back strong {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--viola);
    margin-bottom: 8px;
}

/* ---------- Marquee ---------- */

.marquee {
    overflow: hidden;
    background: var(--viola);
    color: var(--bianco);
    padding-block: 22px;
}

.marquee__track {
    display: flex;
    width: max-content;
    animation: marquee 28s linear infinite;
}

.marquee__track span {
    white-space: nowrap;
    font-family: var(--font-title);
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 3rem);
    text-transform: uppercase;
    letter-spacing: .02em;
    padding-right: .3em;
}

@keyframes marquee {
    to { transform: translateX(-50%); }
}

/* ---------- Metodo ---------- */

.method {
    padding-block: clamp(64px, 9vw, 120px);
}

.method__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

.method__steps li {
    padding: 28px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--bordo);
    transition: border-color .3s, transform .3s, box-shadow .3s;
}

.method__steps li:hover {
    border-color: var(--viola);
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(158, 24, 253, .12);
}

.method__num {
    display: block;
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 2.4rem;
    color: var(--viola);
    line-height: 1;
    margin-bottom: 14px;
}

.method__steps h3 {
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.method__steps p {
    margin: 0;
    font-size: .92rem;
    color: var(--grigio);
}

/* ---------- Chi siamo ---------- */

.about {
    padding-block: clamp(56px, 8vw, 100px);
    background: var(--nero);
    color: #d9d9d9;
}

.about__inner {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: clamp(28px, 6vw, 72px);
    max-width: 960px;
}

.about__logo {
    width: clamp(120px, 18vw, 200px);
}

.about__lead {
    font-family: var(--font-title);
    font-size: clamp(1.4rem, 3vw, 2rem);
    line-height: 1.3;
    color: var(--bianco);
    margin: 0 0 .6em;
}

.about__lead strong {
    color: var(--viola);
}

/* ---------- Contatti / form ---------- */

.contact {
    padding-block: clamp(64px, 9vw, 120px);
    background: var(--lilla);
}

.contact__inner {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: clamp(32px, 6vw, 72px);
    align-items: start;
}

.contact__details {
    margin: 32px 0 0;
}

.contact__details dt {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--viola);
    margin-top: 18px;
}

.contact__details dd {
    margin: 2px 0 0;
    font-weight: 600;
    color: var(--nero);
}

.contact__details a {
    color: inherit;
    text-decoration: none;
}

.contact__details a:hover {
    color: var(--viola);
}

.form {
    background: var(--bianco);
    padding: clamp(24px, 4vw, 44px);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(134, 24, 229, .1);
}

.form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field span {
    font-size: .8rem;
    font-weight: 600;
    color: var(--nero);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--bordo);
    border-radius: 10px;
    font: 400 .95rem/1.4 var(--font-body);
    color: var(--nero);
    background: #fcfaff;
    transition: border-color .2s, box-shadow .2s;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--viola);
    box-shadow: 0 0 0 3px rgba(158, 24, 253, .15);
}

.field.is-invalid input,
.field.is-invalid select {
    border-color: var(--errore);
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 22px;
    font-size: .82rem;
    line-height: 1.5;
    color: var(--grigio);
    cursor: pointer;
}

.check input {
    margin-top: 3px;
    accent-color: var(--viola);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.check.is-invalid span {
    color: var(--errore);
}

.form__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form__submit {
    margin-top: 26px;
    min-width: 180px;
}

.form__submit[disabled] {
    opacity: .6;
    cursor: wait;
}

.form__status {
    margin: 16px 0 0;
    font-weight: 600;
    font-size: .9rem;
    min-height: 1.4em;
}

.form__status.is-error {
    color: var(--errore);
}

.form__status.is-success {
    color: var(--ok);
}

/* ---------- Footer ---------- */

.footer {
    background: var(--nero);
    color: #bdbdbd;
    font-size: .9rem;
    padding-top: 64px;
}

.footer__inner {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 40px;
}

.footer__logo {
    width: 180px;
    margin-bottom: 18px;
}

.footer h4 {
    color: var(--bianco);
    font-size: .8rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer li {
    margin-bottom: 8px;
}

.footer a {
    color: #bdbdbd;
    text-decoration: none;
}

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

.footer__bottom {
    margin-top: 48px;
    padding-block: 22px;
    border-top: 1px solid #2a2a2a;
    font-size: .8rem;
}

.footer__bottom p {
    margin: 0;
}

/* ---------- Reveal on scroll ---------- */

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s ease, transform .7s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1440px) {
    .flip__back {
        padding: 20px 22px;
        font-size: .85rem;
    }
}

@media (max-width: 1300px) {
    .services__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .flip__back {
        padding: 24px 26px;
        font-size: .95rem;
    }
}

@media (max-width: 1000px) {
    .method__steps {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact__inner {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .header__toggle {
        display: block;
    }

    .nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 8px 0 20px;
        background: var(--bianco);
        box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
        display: none;
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        padding: 14px 20px;
    }

    .nav .nav__cta {
        margin-top: 8px;
    }

    .hero__inner {
        grid-template-columns: 1fr;
    }

    .hero__visual {
        order: -1;
        max-width: 320px;
    }

    .footer__inner {
        grid-template-columns: 1fr 1fr;
    }

    .footer__inner > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .services__grid,
    .method__steps,
    .form__grid {
        grid-template-columns: 1fr;
    }

    .about__inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .about__logo {
        margin: 0 auto;
    }

    .footer__inner {
        grid-template-columns: 1fr;
    }

    .form__submit {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
