:root {
    color-scheme: dark;
    --bg: #080f21;
    --surface: #0d1730;
    --surface-2: #111c38;
    --panel: rgba(255, 255, 255, 0.05);
    --text: #f5f7fb;
    --muted: #9aa4c0;
    --faint: #6c7794;
    --accent: #2dd9c8;
    --accent-strong: #5ee7d9;
    --violet: #8f7cff;
    --amber: #ffb648;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --danger: #f87171;
    --ok: #2dd9c8;
    --grad: linear-gradient(135deg, var(--accent), var(--violet));
    --mono: "SF Mono", Consolas, "Liberation Mono", monospace;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-2: #eef2f9;
    --panel: #ffffff;
    --text: #0b1220;
    --muted: #4a5568;
    --faint: #6b7280;
    --accent: #0b8f80;
    --accent-strong: #076b60;
    --violet: #5b46d6;
    --amber: #a35c00;
    --border: #dde3ee;
    --border-strong: #c3ccdd;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(1200px 700px at 80% -10%, rgba(45, 217, 200, 0.16), transparent 60%),
        radial-gradient(900px 600px at 5% 8%, rgba(143, 124, 255, 0.14), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
}

:root[data-theme="light"] body {
    background:
        radial-gradient(1200px 700px at 80% -10%, rgba(11, 143, 128, 0.08), transparent 60%),
        radial-gradient(900px 600px at 5% 8%, rgba(91, 70, 214, 0.07), transparent 55%),
        var(--bg);
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-strong);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    z-index: 10;
    transform: translateY(-150%);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.skip-link:focus {
    transform: translateY(0);
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 8;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px);
}

.nav-shell {
    width: min(1180px, calc(100% - 32px));
    min-height: 74px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--sans);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    display: block;
    border-radius: 6px;
    flex-shrink: 0;
}

.footer-brand .brand-mark {
    width: 18px;
    height: 18px;
}

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

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a,
.theme-toggle {
    color: var(--muted);
    text-decoration: none;
    transition: color 150ms ease;
}

.nav-links a[aria-current="page"],
.nav-links a:hover,
.theme-toggle:hover {
    color: var(--accent);
}

.theme-toggle {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    cursor: pointer;
}

/* ---------- Layout ---------- */

.hero,
.section,
.page-head,
.footer-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 3.5rem;
    padding: 6rem 0 4.5rem;
}

.hero-inner > * + * {
    margin-top: 1.35rem;
}

.hero-visual {
    aspect-ratio: 4 / 3.2;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(45, 217, 200, 0.14), rgba(143, 124, 255, 0.10));
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.hero-visual::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    top: -60px;
    right: -60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(45, 217, 200, 0.45), transparent 70%);
}

.hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- Tipografia ---------- */

.eyebrow,
.label,
.meta,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
}

.eyebrow {
    color: var(--amber);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.42rem 0.95rem;
    border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--amber) 8%, transparent);
}

.eyebrow .prompt {
    color: var(--amber);
}

.label,
.meta {
    color: var(--muted);
    font-size: 0.88rem;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--sans);
    line-height: 1.1;
    letter-spacing: -0.025em;
}

h1 {
    max-width: 820px;
    font-size: clamp(2.3rem, 4.4vw, 3.6rem);
    font-weight: 800;
}

h2 {
    max-width: 820px;
    font-size: clamp(1.7rem, 2.8vw, 2.35rem);
    font-weight: 800;
}

h3 {
    font-size: 1.16rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.grad {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

p {
    max-width: 720px;
    margin: 0;
}

.lead {
    max-width: 700px;
    color: var(--muted);
    font-size: clamp(1.08rem, 1.6vw, 1.22rem);
}

.muted {
    color: var(--muted);
}

.section {
    padding: 5.5rem 0;
    border-top: 1px solid var(--border);
}

.section > * + * {
    margin-top: 1.5rem;
}

.page-head {
    padding: 5rem 0 3rem;
}

.page-head > * + * {
    margin-top: 1.4rem;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.8rem;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 1.35rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 150ms ease, transform 150ms ease;
}

.button:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}

p + .button,
.muted + .button,
.definition-list + .button,
.notice + .button {
    margin-top: 1.5rem;
}

.section > .button,
.card > .button,
.case > .button,
.problem > .button {
    display: flex;
    width: fit-content;
}

.actions .button {
    display: inline-flex;
    margin-top: 0;
}

.button.primary {
    border-color: transparent;
    background: var(--grad);
    color: #04121c;
    font-weight: 700;
    box-shadow: 0 6px 26px rgba(45, 217, 200, 0.28);
}

.button.primary:hover {
    color: #04121c;
    filter: saturate(1.1);
}

:root[data-theme="light"] .button.primary {
    color: #ffffff;
}

:root[data-theme="light"] .button.primary:hover {
    color: #ffffff;
}

/* ---------- Griglie e card ---------- */

.grid {
    display: grid;
    gap: 1.35rem;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.case,
.problem,
.notice {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
}

.card,
.case,
.problem {
    padding: 1.6rem 1.5rem;
    transition: transform 180ms ease, border-color 180ms ease;
}

.card > * + *,
.case > * + *,
.problem > * + *,
.notice > * + * {
    margin-top: 1rem;
}

.card:hover,
.case:hover,
.problem:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
}

/* Bordo superiore colorato, a rotazione, come nel design approvato */
.grid.three > .card:nth-child(3n + 1),
.grid.two > .card:nth-child(3n + 1),
.grid > .case:nth-child(3n + 1),
.grid.two > .problem:nth-child(3n + 1) {
    border-top: 3px solid var(--accent);
}

.grid.three > .card:nth-child(3n + 2),
.grid.two > .card:nth-child(3n + 2),
.grid > .case:nth-child(3n + 2),
.grid.two > .problem:nth-child(3n + 2) {
    border-top: 3px solid var(--violet);
}

.grid.three > .card:nth-child(3n + 3),
.grid.two > .card:nth-child(3n + 3),
.grid > .case:nth-child(3n + 3),
.grid.two > .problem:nth-child(3n + 3) {
    border-top: 3px solid var(--amber);
}

/* ---------- Statistiche ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.stat {
    padding: 1.9rem 1.4rem;
    border-top: 0;
    background: var(--surface);
    text-align: center;
}

.stat-number {
    display: block;
    color: var(--accent);
    font-family: var(--sans);
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.client-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-family: var(--mono);
    font-size: 1.02rem;
    color: var(--text);
}

.tag {
    display: inline-flex;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.74rem;
}

/* ---------- Foto ---------- */

.photo-placeholder {
    min-height: 320px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    background: var(--panel);
    color: var(--muted);
    font-family: var(--mono);
}

.photo-frame {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    line-height: 0;
}

.photo-frame img {
    width: 100%;
    height: auto;
    display: block;
}

/* ---------- Liste di definizione ---------- */

.definition-list {
    display: grid;
    gap: 0.7rem;
    max-width: 820px;
}

.definition-list div {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}

dt {
    display: inline-flex;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.86rem;
    color: var(--accent);
}

dd {
    margin: 0;
}

/* ---------- Form ---------- */

.form {
    max-width: 760px;
    display: grid;
    gap: 1.1rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

label {
    font-family: var(--mono);
    font-size: 0.84rem;
    color: var(--muted);
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

input:hover,
textarea:hover {
    border-color: var(--border-strong);
}

textarea {
    min-height: 190px;
    resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--muted);
}

.check input {
    width: auto;
    margin-top: 0.35rem;
}

.honeypot {
    position: absolute;
    left: -100vw;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-status {
    min-height: 1.5rem;
    color: var(--muted);
}

.notice {
    padding: 1.15rem 1.35rem;
}

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

.site-footer {
    border-top: 1px solid var(--border);
    padding: 3.2rem 0 6rem;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.4fr auto;
    grid-template-areas:
        "identity social"
        "links links";
    align-items: start;
    gap: 2rem;
    color: var(--muted);
}

.footer-identity {
    grid-area: identity;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--sans);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.footer-legal {
    margin: 0.5rem 0 0;
    font-size: 0.86rem;
    line-height: 1.55;
}

.footer-social {
    grid-area: social;
    display: flex;
    gap: 0.6rem;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--muted);
    transition: color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.footer-social a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.footer-social svg {
    width: 18px;
    height: 18px;
    display: block;
}

.footer-links {
    grid-area: links;
    display: flex;
    flex-wrap: wrap;
    gap: 1.35rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--border);
    font-size: 0.86rem;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
}

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

.mobile-contact {
    display: none;
}

/* ---------- Cookie ---------- */

.cookie-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9;
    width: min(420px, calc(100% - 2rem));
    padding: 1.15rem;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.cookie-panel[hidden] {
    display: none;
}

.cookie-panel p {
    font-size: 0.92rem;
}

.cookie-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

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

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding-top: 4rem;
    }

    .hero-visual {
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 900px) {
    .nav-shell {
        align-items: flex-start;
        flex-direction: column;
        padding: 0.9rem 0;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        gap: 1.1rem;
        padding-bottom: 0.25rem;
    }

    .grid.two,
    .grid.three,
    .stats {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "social"
            "links";
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    .section {
        padding: 3.5rem 0;
    }

    .definition-list div {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .mobile-contact {
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        z-index: 7;
        display: flex;
        min-height: 48px;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        background: var(--grad);
        color: #04121c;
        font-weight: 700;
        text-decoration: none;
    }

    .site-footer {
        padding-bottom: 5.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
