/* ==================================================================
   Custel — landing page
   1. Token del Design System (dark default, light override)
   2. Base e tipografia
   3. Componenti (header, hero, sezioni, feature, showcase, footer)
   Regola: nessun colore hardcoded fuori dai token — solo var(--…).
   ================================================================== */

/* ---------- 1. Token ---------- */
:root {                                   /* DARK (default) */
    --background: #0E0E0F;
    --surface: #161618;
    --surface-container: #1A1A1C;
    --surface-container-high: #202022;
    --on-surface: #ECECEE;
    --on-surface-variant: #9A9A9F;
    --outline: #2E2E31;
    --primary: #E6E6E9;
    --on-primary: #161618;
    --error: #E5484D;
    --radius-card: 14px;

    /* Brand Custel (logo: parentesi + segnalibro) */
    --brand: #2E82E0;
    --brand-soft: #B9CFEF;
    --on-brand: #FFFFFF;

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

[data-theme="light"] {                    /* LIGHT */
    --background: #FFFFFF;
    --surface: #FFFFFF;
    --surface-container: #F2F2F3;
    --surface-container-high: #ECECEE;
    --on-surface: #18181B;
    --on-surface-variant: #6B6B70;
    --outline: #D6D6DA;
    --primary: #18181B;
    --on-primary: #FFFFFF;
    --error: #D92D20;
    --brand: #2E82E0;
    --brand-soft: #8FB6E8;
    --on-brand: #FFFFFF;
    color-scheme: light;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

/* Compat Lenis: quando lo smooth scroll è gestito via JS (motion.js),
   il nativo va disattivato per evitare il doppio easing sulle ancore */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
    margin: 0;
    background: var(--background);
    color: var(--on-surface);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); margin: 0 0 1rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.4rem; }

p { margin: 0 0 1rem; }

a {
    color: var(--on-surface);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--on-surface-variant);
}
a:hover { text-decoration-color: var(--on-surface); }

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

.muted { color: var(--on-surface-variant); }

.wrap {
    max-width: 68rem;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.section { padding: clamp(3.5rem, 9vh, 6.5rem) 0; }

.section-head { max-width: 34rem; margin-bottom: 2.5rem; }

/* Skip link */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0.75rem;
    background: var(--surface-container-high);
    color: var(--on-surface);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    z-index: 10;
}
.skip-link:focus-visible { left: 0.75rem; }

/* ---------- 3. Header ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
}

.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--on-surface); }
.brand .brand-mark { height: 28px; width: auto; }
.brand .brand-wordmark { height: 20px; width: auto; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--outline);
    border-radius: 50%;
    background: transparent;
    color: var(--on-surface);
    cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-container); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero {
    display: grid;
    gap: 3rem;
    align-items: center;
    padding: clamp(2.5rem, 7vh, 5rem) 0 clamp(3.5rem, 9vh, 6.5rem);
}

.hero .lead {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--on-surface-variant);
    max-width: 32rem;
    margin-bottom: 2rem;
}

.cta {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    padding: 0.85rem 1.8rem;
    border-radius: 999px;
    border: 1px solid var(--outline);
    background: var(--surface-container);
    color: var(--on-surface);
}

/* Stato "Presto disponibile": visivamente in attesa, non interattivo */
.cta[aria-disabled="true"] {
    opacity: 0.6;
    cursor: default;
}

.cta-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--on-surface-variant);
}

.hero-visual { margin: 0 auto; width: min(480px, 90vw); }
.hero-visual svg { display: block; width: 100%; height: auto; }

/* ---------- Mockup SVG (inline, ereditano i token) ---------- */
.mock svg { display: block; width: 100%; height: auto; }
.mock .frame { fill: var(--background); stroke: var(--outline); stroke-width: 6; }
.mock .card  { fill: var(--surface-container); }
.mock .hi    { fill: var(--surface-container-high); }
.mock .txt   { fill: var(--on-surface); }
.mock .txt2  { fill: var(--on-surface-variant); }
.mock .line  { fill: var(--outline); }
.mock .fab   { fill: var(--brand); }
.mock .onfab { stroke: var(--on-brand); stroke-width: 3.5; stroke-linecap: round; }

@media (prefers-reduced-motion: no-preference) {
    .mock .shimmer { animation: pulse 1.6s ease-in-out infinite; }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
}

/* ---------- Come funziona ---------- */
.steps {
    list-style: none;
    counter-reset: step;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.5rem;
}

.steps li {
    counter-increment: step;
    background: var(--surface-container);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: 1.5rem;
}

.steps li::before {
    content: counter(step, decimal-leading-zero);
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--brand);
    margin-bottom: 0.75rem;
}

.steps p { margin: 0; color: var(--on-surface-variant); }

/* ---------- Feature grid ---------- */
.features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

.feature {
    background: var(--surface-container);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: 1.5rem;
}
.feature:hover { background: var(--surface-container-high); }

.feature-icon {
    display: inline-flex;
    color: var(--brand);
    margin-bottom: 1rem;
}
.feature-icon svg { width: 26px; height: 26px; }

.feature p { margin: 0; color: var(--on-surface-variant); }

/* ---------- Privacy ---------- */
.privacy-card {
    background: var(--surface-container);
    border: 1px solid var(--outline);
    border-radius: var(--radius-card);
    padding: clamp(1.75rem, 5vw, 3rem);
    max-width: 44rem;
}

.privacy-card .feature-icon { margin-bottom: 1.25rem; }
.privacy-card p { margin: 0; color: var(--on-surface-variant); }

/* ---------- Showcase ---------- */
.showcase {
    display: grid;
    gap: 2.5rem;
    justify-items: center;
}

.showcase figure { margin: 0; width: min(250px, 70vw); }

.showcase figcaption {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--on-surface-variant);
    text-align: center;
}

/* ---------- CTA finale ---------- */
.finale { text-align: center; }
.finale p { color: var(--on-surface-variant); max-width: 30rem; margin: 0 auto 2rem; }

/* ---------- Prosa (pagina privacy) ---------- */
.prose { max-width: 44rem; padding-bottom: clamp(3.5rem, 9vh, 6.5rem); }
.prose h1 { margin: 2rem 0 0.5rem; }
.prose h2 { margin-top: 2.5rem; }
.prose p { color: var(--on-surface-variant); }
.prose .updated { font-size: 0.9rem; }
.back-link { display: inline-block; margin-top: 2.5rem; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--outline);
    padding: 2rem 0 2.5rem;
    margin-top: 2rem;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: center;
    justify-content: space-between;
}

.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; }

.footer-nav a, .site-footer p {
    font-size: 0.9rem;
    color: var(--on-surface-variant);
    margin: 0;
}
.footer-nav a:hover { color: var(--on-surface); }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
    .steps { grid-template-columns: repeat(3, 1fr); }
    .features { grid-template-columns: repeat(2, 1fr); }
    .showcase { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
    .hero { grid-template-columns: 1.1fr 0.9fr; }
    .hero-phone { margin: 0 0 0 auto; }
    .features { grid-template-columns: repeat(4, 1fr); }
}
