.landing-page {
    background: #14171f;
    color: #edf2f7;
    min-height: 100vh;
}

.landing-hero {
    position: relative;
    min-height: 70vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-hero-map-shell {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #1d222a;
}

.landing-hero-map-shell .leaflet-container {
    background: #1d222a;
}

.landing-hero-tint {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(12, 15, 22, 0.62);
}

.landing-hero-content {
    position: relative;
    z-index: 2;
    width: min(780px, calc(100% - 36px));
    margin-left: clamp(18px, 7%, 96px);
    padding: 72px 0 64px;
}

.landing-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 13px;
    margin-bottom: 18px;
    color: #d6ecff;
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid rgba(52, 152, 219, 0.45);
    border-radius: 6px;
    font-size: var(--font-size-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.landing-hero h1 {
    color: #ffffff !important;
    font-size: var(--font-size-display);
    line-height: 1.02;
    letter-spacing: 0;
    margin: 0 0 18px;
    max-width: 760px;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.38);
}

.landing-hero p {
    color: #e7edf5;
    max-width: 680px;
    font-size: var(--font-size-highlight);
    line-height: 1.6;
    margin: 0 0 24px;
}

.landing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.landing-hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    background: rgba(20, 23, 31, 0.58);
}

.landing-hero-button:hover,
.landing-hero-button:focus {
    color: #ffffff;
    border-color: #ffffff;
    text-decoration: none;
    background: rgba(20, 23, 31, 0.82);
}

.landing-hero-button-primary {
    color: #ffffff;
    border-color: #3498db;
    background: #2477ad;
}

.landing-hero-button-primary:hover,
.landing-hero-button-primary:focus {
    background: #2f8fcc;
    border-color: #5dade2;
}

.landing-section {
    padding: 36px 18px;
}

.landing-container {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.landing-metrics-section {
    padding-top: 18px;
    padding-bottom: 18px;
    background: #20252d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-metrics {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.landing-metric {
    min-height: 190px;
    padding: 20px 22px;
    background: #272b30;
    border: 1px solid #444a52;
    border-radius: 8px;
}

.landing-metric-value {
    font-size: var(--font-size-critical);
    font-weight: 900;
    line-height: 1;
}

.landing-metric-label {
    margin-top: 10px;
    color: #c5ced8;
    font-size: var(--font-size-highlight);
    font-weight: 750;
    line-height: 1.25;
}

.landing-section-heading {
    max-width: 740px;
    margin-bottom: 18px;
}

.landing-section-heading h2 {
    font-size: var(--font-size-title);
    margin: 0 0 8px;
}

.landing-section-heading p {
    color: #c5ced8;
    margin: 0;
    line-height: 1.55;
}

.landing-module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.landing-module-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    color: #edf2f7;
    background: #272b30;
    border: 1px solid #444a52;
    border-radius: 8px;
    padding: 16px;
    text-decoration: none;
}

.landing-module-card:hover,
.landing-module-card:focus {
    color: #ffffff;
    text-decoration: none;
    border-color: #5dade2;
    background: #30363d;
}

.landing-module-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.landing-module-eyebrow,
.landing-module-meta {
    font-size: var(--font-size-secondary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.landing-module-meta {
    color: #aeb8c5;
}

.landing-module-card h3 {
    font-size: var(--font-size-highlight);
    margin: 0 0 10px;
}

.landing-module-card p {
    color: #c5ced8;
    line-height: 1.5;
    margin: 0 0 18px;
}

.landing-module-link {
    margin-top: auto;
    color: #8fd0ff;
    font-weight: 800;
}

.landing-path-section {
    background: #1b2028;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-step-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.landing-step {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    color: #edf2f7;
    background: #272b30;
    border: 1px solid #444a52;
    border-radius: 8px;
    padding: 12px;
    text-decoration: none;
}

.landing-step:hover,
.landing-step:focus {
    color: #ffffff;
    border-color: #5dade2;
    text-decoration: none;
    background: #30363d;
}

.landing-step-index {
    flex: 0 0 auto;
    width: 42px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-size: var(--font-size-secondary);
    font-weight: 900;
}

.landing-step-title {
    font-weight: 800;
    line-height: 1.2;
}

.landing-tone-blue {
    color: #5dade2;
}

.landing-tone-red {
    color: #ff7c6f;
}

.landing-tone-green {
    color: #58d68d;
}

.landing-tone-yellow {
    color: #f4d03f;
}

/* ── Popup "cosa vedrai" in hover/focus sulle caselle di accesso ─────────────── */
.landing-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.landing-tile > a,
.landing-tile > .landing-metric {
    flex: 1 1 auto;
}

.landing-tile:hover,
.landing-tile:focus-within {
    z-index: 40;
}

.landing-popup {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    z-index: 50;
    width: min(300px, 86vw);
    padding: 14px 16px;
    display: block;
    text-align: left;
    color: #edf2f7;
    background: #1c2128;
    border: 1px solid #5dade2;
    border-radius: 10px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
    pointer-events: none;
    font-weight: 400;
}

.landing-popup::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    width: 10px;
    height: 10px;
    margin-bottom: -6px;
    background: #1c2128;
    border-left: 1px solid #5dade2;
    border-top: 1px solid #5dade2;
    transform: translateX(-50%) rotate(45deg);
}

.landing-tile:hover > .landing-popup,
.landing-tile:focus-within > .landing-popup {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition-delay: 0.12s, 0.12s, 0s;
}

.landing-popup > span {
    display: block;
}

.landing-popup-kicker {
    margin-bottom: 4px;
    color: #8fd0ff;
    font-size: var(--font-size-secondary);
    font-weight: 800;
    text-transform: uppercase;
}

.landing-popup-lead {
    margin-bottom: 8px;
    font-weight: 700;
    line-height: 1.4;
}

.landing-popup ul {
    margin: 0 0 10px;
    padding-left: 18px;
    color: #c5ced8;
    line-height: 1.45;
}

.landing-popup li + li {
    margin-top: 3px;
}

.landing-popup-go {
    color: #58d68d;
    font-size: var(--font-size-secondary);
    font-weight: 800;
}

/* Prima / ultima casella di una riga: il popup resta dentro lo schermo */
.landing-align-start > .landing-popup {
    left: 0;
    transform: translate(0, -6px);
}

.landing-align-start:hover > .landing-popup,
.landing-align-start:focus-within > .landing-popup,
.landing-align-end:hover > .landing-popup,
.landing-align-end:focus-within > .landing-popup {
    transform: translate(0, 0);
}

.landing-align-start > .landing-popup::after {
    left: 28px;
}

.landing-align-end > .landing-popup {
    left: auto;
    right: 0;
    transform: translate(0, -6px);
}

.landing-align-end > .landing-popup::after {
    left: auto;
    right: 28px;
    transform: translateX(0) rotate(45deg);
}

body[data-theme="light"] .landing-popup {
    color: #212529;
    background: #ffffff;
    border-color: #3498db;
    box-shadow: 0 16px 36px rgba(31, 45, 61, 0.2);
}

body[data-theme="light"] .landing-popup::after {
    background: #ffffff;
    border-color: #3498db;
}

body[data-theme="light"] .landing-popup-kicker {
    color: #1f6fa8;
}

body[data-theme="light"] .landing-popup ul {
    color: #4a5560;
}

body[data-theme="light"] .landing-popup-go {
    color: #1e8449;
}

/* Su touch non esiste l'hover: niente popup (la casella apre direttamente la pagina) */
@media (hover: none) {
    .landing-popup {
        display: none;
    }
}

body[data-theme="light"] .landing-page {
    color: #212529;
    background: #f4f6f8;
}

body[data-theme="light"] .landing-metrics-section,
body[data-theme="light"] .landing-path-section {
    background: #e9eef3;
    border-color: #d4dce5;
}

body[data-theme="light"] .landing-metric,
body[data-theme="light"] .landing-module-card,
body[data-theme="light"] .landing-step {
    color: #212529;
    background: #ffffff;
    border-color: #ced7e0;
}

body[data-theme="light"] .landing-metric-label,
body[data-theme="light"] .landing-section-heading p,
body[data-theme="light"] .landing-module-card p,
body[data-theme="light"] .landing-module-meta {
    color: #5b6570;
}

body[data-theme="light"] .landing-module-card:hover,
body[data-theme="light"] .landing-module-card:focus,
body[data-theme="light"] .landing-step:hover,
body[data-theme="light"] .landing-step:focus {
    color: #111820;
    background: #f8fafc;
    border-color: #3498db;
}

@media (max-width: 992px) {
    .landing-hero {
        min-height: 66vh;
    }

    .landing-hero h1 {
        font-size: var(--font-size-display);
    }

    .landing-module-grid,
    .landing-step-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* a 2 colonne: sinistra/destra */
    .landing-module-grid .landing-tile:nth-child(odd) > .landing-popup {
        left: 0;
        right: auto;
        transform: translate(0, -6px);
    }

    .landing-module-grid .landing-tile:nth-child(even) > .landing-popup {
        left: auto;
        right: 0;
        transform: translate(0, -6px);
    }

    .landing-module-grid .landing-tile:nth-child(n):hover > .landing-popup {
        transform: translate(0, 0);
    }

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

@media (max-width: 576px) {
    .landing-hero {
        min-height: auto;
    }

    .landing-hero-content {
        width: calc(100% - 28px);
        margin: 0 auto;
        padding: 54px 0 44px;
    }

    .landing-hero h1 {
        font-size: var(--font-size-display);
    }

    .landing-hero p {
        font-size: var(--font-size-highlight);
    }

    .landing-hero-button {
        width: 100%;
    }

    .landing-metric {
        min-height: 104px;
        padding: 18px 20px;
    }

    .landing-metric-value {
        font-size: var(--font-size-critical);
    }

    .landing-metric-label {
        font-size: var(--font-size-highlight);
    }

    .landing-module-grid,
    .landing-step-row,
    .landing-metrics {
        grid-template-columns: 1fr;
    }
}

a.landing-metric {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

a.landing-metric:hover,
a.landing-metric:focus {
    color: inherit;
    border-color: #5dade2;
    background: #30363d;
}

body[data-theme="light"] a.landing-metric:hover,
body[data-theme="light"] a.landing-metric:focus {
    background: #f8fafc;
    border-color: #3498db;
}

#landing-drilldown {
    scroll-margin-top: 80px;
}

@media (max-width: 992px) {
    .landing-metrics .landing-tile:nth-child(odd) > .landing-popup {
        left: 0;
        right: auto;
        transform: translate(0, -6px);
    }

    .landing-metrics .landing-tile:nth-child(even) > .landing-popup {
        left: auto;
        right: 0;
        transform: translate(0, -6px);
    }

    .landing-metrics .landing-tile:nth-child(n):hover > .landing-popup,
    .landing-metrics .landing-tile:nth-child(n):focus-within > .landing-popup {
        transform: translate(0, 0);
    }
}

/* Anonimi: le pagine sono bloccate, il click apre il login -> il popup lo dice */
.landing-popup-lock {
    display: none !important;
    color: #f5b041;
    font-size: var(--font-size-secondary);
    font-weight: 800;
}

.landing-popup-lock::before {
    content: "\1F512  ";
}

body.auth-guest .landing-popup-lock {
    display: block !important;
}

body.auth-guest .landing-popup-lock ~ .landing-popup-go,
body.auth-guest .landing-popup-go:has(+ .landing-popup-lock) {
    display: none;
}

body[data-theme="light"] .landing-popup-lock {
    color: #b9770e;
}

.landing-metric-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.landing-metric-head .landing-metric-value {
    white-space: nowrap;
}

.landing-metric-head .landing-metric-label {
    margin-top: 0;
}

.landing-metric-desc {
    margin: 0;
    color: #c5ced8;
    font-size: var(--font-size-secondary);
    line-height: 1.45;
}

.landing-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.landing-chip {
    padding: 2px 9px;
    font-size: var(--font-size-secondary);
    font-weight: 700;
    line-height: 1.5;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.04);
}

.landing-chip-blue   { color: #5dade2; }
.landing-chip-red    { color: #ff6b6b; }
.landing-chip-orange { color: #ffa94d; }
.landing-chip-green  { color: #58d68d; }
.landing-chip-yellow { color: #f4d03f; }
.landing-chip-grey   { color: #9aa0a6; }

.landing-metric-cta {
    margin-top: auto;
    color: #8fd0ff;
    font-weight: 800;
    transition: transform 0.15s ease;
}

a.landing-metric:hover .landing-metric-cta,
a.landing-metric:focus .landing-metric-cta {
    transform: translateX(4px);
}

body[data-theme="light"] .landing-metric-desc {
    color: #5b6570;
}

body[data-theme="light"] .landing-metric-cta {
    color: #1f6fa8;
}

body[data-theme="light"] .landing-chip {
    background: rgba(0, 0, 0, 0.03);
}

body[data-theme="light"] .landing-chip-blue   { color: #1f6fa8; }
body[data-theme="light"] .landing-chip-red    { color: #c0392b; }
body[data-theme="light"] .landing-chip-orange { color: #b9770e; }
body[data-theme="light"] .landing-chip-green  { color: #1e8449; }
body[data-theme="light"] .landing-chip-yellow { color: #9a7d0a; }
body[data-theme="light"] .landing-chip-grey   { color: #6b7480; }

/* Dati reali sotto le caselle di accesso e i passi del drill-down */
.landing-module-card .landing-chips {
    margin: -6px 0 14px;
}

.landing-module-card .landing-chip,
.landing-step .landing-chip {
    font-size: var(--font-size-secondary);
    padding: 1px 8px;
}

.landing-step-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.landing-chip strong {
    font-weight: 800;
}

.landing-step .landing-chip {
    white-space: nowrap;
}
