/* --- Reset & base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-text: #f0f4f8;
    --color-text-muted: rgba(240, 244, 248, 0.72);
    --color-accent: #5eb3ff;
    --header-height: 4.5rem;
    --footer-height: 3.5rem;
    --content-max-width: 72rem;
    --font-body: "Montserrat", system-ui, -apple-system, sans-serif;
    --font-heading: "Good Times", "Montserrat", sans-serif;
    --grid-padding-left: 2rem;
    --pillars-width: 75vw;
    --box-bg: #1a1f2e;
    --box-border: rgba(255, 255, 255, 0.14);
    --box-radius: 0.625rem;
    --pillar-radius: 1.25rem;
    --pillar-border-width: 2px;
    --pillar-purple: #9b5de5;
    --pillar-green: #22c55e;
    --pillar-blue: #3b82f6;
    --pillar-healthcare: #e11d48;
    --grid-gap: 1rem;
    --video-tutorial-bg: #c9a227;
    --video-tutorial-border: #e8c84a;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-heading {
    font-family: var(--font-heading);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

/* --- VANTA background (full viewport, behind everything) --- */
#vanta-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
}

/* --- Page shell above background --- */
.page-shell {
    position: relative;
    z-index: 1;
}

/* --- Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: var(--header-height);
    background: transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 1.5rem;
}

.site-header__logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.site-header__logo {
    display: block;
    height: calc(var(--header-height) - 1.25rem);
    width: auto;
    max-width: min(420px, 85vw);
    object-fit: contain;
    object-position: center;
}

/* --- Main / hero section (full viewport) --- */
.site-main {
    padding: 0;
}

.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.hero-section__pillars {
    position: absolute;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--grid-gap);
    width: calc(var(--pillars-width) - var(--grid-padding-left) - var(--grid-gap));
    padding: var(--grid-gap) var(--grid-gap) var(--grid-gap) var(--grid-padding-left);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.pillar-box {
    flex: 0 0 auto;
    min-height: 8rem;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1.25rem 1.5rem;
    border-radius: var(--pillar-radius);
    border: var(--pillar-border-width) dashed var(--pillar-border);
    background: rgba(26, 31, 46, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pillar-box--ecosystem {
    --pillar-border: var(--pillar-purple);
}

.pillar-box--knowledge {
    --pillar-border: var(--pillar-green);
}

.pillar-box--ecosystem,
.pillar-box--knowledge,
.pillar-box--execution,
.pillar-box--healthcare {
    flex-direction: column;
    align-items: stretch;
    gap: var(--grid-gap);
    padding: var(--grid-gap);
}

.pillar-box--execution {
    --pillar-border: var(--pillar-blue);
}

.pillar-box--healthcare {
    --pillar-border: var(--pillar-healthcare);
}

.pillar-box__content {
    flex: 0 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--grid-gap);
    align-content: start;
}

.pillar-box__content .eco-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
}

.pillar-box__subtitle {
    font-size: clamp(0.875rem, 1.35vw, 1.125rem);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.3;
}

.hero-section__grid {
    position: absolute;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
    align-content: start;
    column-gap: var(--grid-gap);
    row-gap: var(--grid-gap);
    /* Una riga (3 box) = metà schermo */
    width: calc(50vw - var(--grid-padding-left) - var(--grid-gap));
    padding: var(--grid-gap) var(--grid-gap) var(--grid-gap) var(--grid-padding-left);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.eco-box {
    --eco-accent: #8b1538;
    position: relative;
    container-type: size;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--box-radius);
    background: var(--box-bg);
    border: 1px solid var(--box-border);
    overflow: hidden;
    display: flex;
    align-items: stretch;
    min-height: 0;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eco-box:hover {
    border-color: var(--eco-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--eco-accent) 55%, transparent);
}

.eco-box:focus-visible {
    outline: 2px solid var(--eco-accent);
    outline-offset: 2px;
}

.eco-box__online {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 2;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--eco-accent);
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--eco-accent) 25%, transparent),
        0 0 0.45rem color-mix(in srgb, var(--eco-accent) 65%, transparent);
    pointer-events: none;
}

.eco-box--demo-online:hover .eco-box__online,
.eco-box--demo-online:focus-visible .eco-box__online {
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--eco-accent) 35%, transparent),
        0 0 0.65rem color-mix(in srgb, var(--eco-accent) 85%, transparent);
}

.eco-box__avatar {
    flex: 0 0 40%;
    align-self: stretch;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    min-width: 0;
    height: 100%;
    padding-left: 0.25rem;
    overflow: hidden;
}

.eco-box__avatar img {
    display: block;
    width: auto;
    height: 90cqh;
    max-height: 90cqh;
    max-width: none;
    object-fit: contain;
    object-position: bottom left;
    pointer-events: none;
    user-select: none;
}

.eco-box__avatar--pending {
    align-items: center;
    justify-content: center;
    padding-left: 0;
}

.eco-box__avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55%;
    height: 70%;
    max-height: 90cqh;
    border-radius: 0.35rem;
    background: linear-gradient(145deg, color-mix(in srgb, var(--eco-accent) 35%, transparent), rgba(255, 255, 255, 0.04));
    border: 1px dashed color-mix(in srgb, var(--eco-accent) 55%, transparent);
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 4cqw, 2rem);
    color: var(--eco-accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    user-select: none;
}

.eco-box__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: right;
    padding: 0.5rem 0.65rem 0.5rem 0.25rem;
    min-width: 0;
}

.eco-box__app {
    font-size: clamp(0.5rem, 0.75vw, 0.6875rem);
    font-weight: 500;
    color: var(--color-text-muted);
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
}

.eco-box__title {
    font-size: clamp(0.65rem, 1.1vw, 0.95rem);
    color: var(--eco-accent);
    text-transform: uppercase;
}

.eco-box__rule {
    width: 50cqw;
    height: 1px;
    margin: 0.35rem 0;
    background: var(--eco-accent);
}

.eco-box__subtitle {
    font-size: clamp(0.5rem, 0.75vw, 0.6875rem);
    font-weight: 500;
    color: var(--color-text-muted);
    line-height: 1.35;
    min-height: 0;
    margin-bottom: 0;
}

.eco-box__demo {
    font-family: var(--font-body);
    font-size: clamp(0.5rem, 0.7vw, 0.625rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text);
    background: transparent;
    border: 1px solid var(--eco-accent);
    border-radius: 0.25rem;
    padding: 0.3rem 0.65rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease;
}

.eco-box__demo:hover,
.eco-box__demo:focus-visible {
    background: var(--eco-accent);
    outline: none;
}

.hero-section__presenter {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 80vh;
    height: 80dvh;
    width: auto;
    max-width: min(calc(100vw - var(--pillars-width)), 100%);
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

@media (max-width: 1024px) {
    .hero-section__pillars,
    .hero-section__grid {
        width: calc(var(--pillars-width) - var(--grid-padding-left) - var(--grid-gap));
        --grid-padding-left: 1.25rem;
    }
}

@media (max-width: 768px) {
    .hero-section__pillars,
    .hero-section__grid {
        width: calc(100vw - var(--grid-padding-left) - var(--grid-gap));
        --grid-padding-left: 1rem;
    }

    .pillar-box {
        min-height: 6rem;
        padding: 1rem 1.25rem;
    }

    .eco-box__avatar {
        flex: 0 0 42%;
    }

    .hero-section__presenter {
        max-width: 90vw;
        height: 65vh;
        height: 65dvh;
    }
}

/* --- Detail page --- */
.detail-section {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    --eco-accent: #8b1538;
}

.detail-section__content {
    position: absolute;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: min(50vw, 42rem);
    padding: var(--grid-gap) var(--grid-gap) var(--grid-gap) var(--grid-padding-left);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.detail-section__title {
    font-size: clamp(1.5rem, 3.5vw, 2.75rem);
    color: var(--eco-accent);
    text-transform: uppercase;
    line-height: 1.1;
}

.detail-section__title--as-written {
    text-transform: none;
}

.detail-section__avatar {
    font-size: clamp(0.875rem, 1.5vw, 1.125rem);
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.35rem;
}

.detail-section__avatar--tagline {
    text-transform: none;
}

.detail-section__rule {
    width: min(50%, 14rem);
    height: 2px;
    margin: 1rem 0 1.25rem;
    background: var(--eco-accent);
}

.detail-section__text-block {
    flex: 1;
    max-width: 36rem;
}

.detail-section__text {
    font-size: clamp(0.8125rem, 1.1vw, 1rem);
    font-weight: 400;
    color: var(--color-text-muted);
    line-height: 1.65;
}

.detail-section__text + .detail-section__text {
    margin-top: 0.85rem;
}

.detail-section__translation {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.detail-section__actions {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: flex-start;
}

.detail-section__demos,
.detail-section__downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
    align-items: flex-start;
}

.detail-section__download-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.detail-section__qr-link {
    display: block;
    line-height: 0;
    border-radius: 0.35rem;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-section__qr-link img {
    display: block;
    width: 8.5rem;
    height: auto;
}

.detail-section__qr-link:hover,
.detail-section__qr-link:focus-visible {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    outline: none;
}

.detail-section__live-demo {
    font-family: var(--font-body);
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--color-text);
    background: var(--eco-accent);
    border: 1px solid var(--eco-accent);
    border-radius: 0.35rem;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.detail-section__live-demo:hover,
.detail-section__live-demo:focus-visible {
    filter: brightness(1.12);
    outline: none;
}

.detail-section__live-demo--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.detail-section__download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: clamp(0.7rem, 0.95vw, 0.8125rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    text-decoration: none;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 0.35rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.detail-section__download .material-symbols-outlined {
    font-size: 1.15rem;
}

.detail-section__download:hover,
.detail-section__download:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    outline: none;
}

.detail-section__download--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.material-symbols-outlined {
    font-family: "Material Symbols Outlined", sans-serif;
    font-weight: normal;
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.detail-section__video-tutorial {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: none;
    color: #1a1408;
    background: linear-gradient(180deg, var(--video-tutorial-border) 0%, var(--video-tutorial-bg) 100%);
    border: 1px solid var(--video-tutorial-border);
    border-radius: 0.35rem;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.detail-section__video-tutorial .material-symbols-outlined {
    font-size: 1.25rem;
    line-height: 1;
}

.detail-section__video-tutorial:hover,
.detail-section__video-tutorial:focus-visible {
    filter: brightness(1.08);
    outline: none;
}

body.video-modal-open {
    overflow: hidden;
}

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}

.video-modal[hidden] {
    display: none;
}

.video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 18, 0.96);
}

.video-modal__dialog {
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #080c18;
    border: none;
    border-radius: 0;
    padding: 3.5rem 1.5rem 1.5rem;
    box-shadow: none;
}

.video-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.video-modal__close:hover,
.video-modal__close:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    outline: none;
}

.video-modal__close .material-symbols-outlined {
    font-size: 1.5rem;
}

.video-modal__title {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 2.5rem 0.75rem 0.25rem;
}

.video-modal__body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal__player {
    width: 100%;
    height: 100%;
    max-height: calc(100dvh - 5rem);
    border-radius: 0.25rem;
    background: #000;
    object-fit: contain;
}

.video-modal__empty {
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    padding: 3rem 1.5rem;
}

.detail-section--full-body .detail-section__presenter {
    right: auto;
    left: 72%;
    transform: translateX(-50%);
    height: 90vh;
    height: 90dvh;
    max-width: min(42vw, 520px);
    object-position: bottom center;
}

.detail-section__product-logo {
    position: absolute;
    right: var(--grid-gap);
    bottom: calc(var(--footer-height) + var(--grid-gap));
    z-index: 4;
    display: block;
    width: auto;
    max-width: min(14rem, 22vw);
    max-height: 3.5rem;
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.detail-section__presenter {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 80vh;
    height: 80dvh;
    width: auto;
    max-width: min(55vw, 100%);
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

@media (max-width: 1024px) {
    .detail-section__content {
        width: 55vw;
    }
}

@media (max-width: 768px) {
    .detail-section__content {
        width: 100%;
        max-width: none;
        padding-right: 1rem;
    }

    .detail-section__presenter {
        max-width: 90vw;
        height: 65vh;
        height: 65dvh;
        opacity: 0.35;
    }

    .detail-section--full-body .detail-section__presenter {
        left: 50%;
        transform: translateX(-50%);
        height: 75vh;
        height: 75dvh;
        max-width: 85vw;
        opacity: 1;
    }

    .detail-section__product-logo {
        max-width: min(10rem, 40vw);
        max-height: 2.75rem;
        right: 1rem;
        bottom: calc(var(--footer-height) + 0.75rem);
    }
}

/* --- Footer --- */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    min-height: var(--footer-height);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(8, 12, 24, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: var(--content-max-width);
    min-height: var(--footer-height);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-footer__copy {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}
