/* ═══════════════════════════════════════════════════════════════
   INTEC4WATER FLUSSI — v2.0
   ═══════════════════════════════════════════════════════════════ */

.i4w-experience {
    --i4w-primary: #006f99;
    --i4w-secondary: #00a65a;
    --i4w-red: #ed1c24;
    --i4w-blue-dark: #294f96;
    --i4w-blue-light: #5b9bd5;
    --i4w-text: #17212b;
    --i4w-muted: #5d6872;
    --i4w-surface: #ffffff;
    --i4w-border: #d9e3e8;
    --i4w-radius: 18px;
    color: var(--i4w-text);
    font-family: inherit;
}
.i4w-experience *, .i4w-experience *::before, .i4w-experience *::after { box-sizing: border-box; }

/* ── Sezioni ── */
.i4w-flow {
    padding: clamp(48px, 7vw, 10px) 0;
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 700ms ease, transform 700ms ease;
}
.i4w-flow.is-visible { opacity: 1; transform: none; }
.i4w-flow--primary   { background: linear-gradient(180deg, #fff 0%, #f1f7fa 100%); }
.i4w-flow--prototype { background: linear-gradient(180deg, #eef7f3 0%, #fff 100%); }

.i4w-container {
    width: min(1400px, calc(100% - 32px));
    margin-inline: auto;
}

/* ── Header ── */
.i4w-section-header { max-width: 900px; margin: 0 auto 40px; text-align: center; }
.i4w-eyebrow {
    margin: 0 0 10px;
    color: var(--i4w-primary);
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.i4w-section-header h2 {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 3rem);
    line-height: 1.1;
    text-wrap: balance;
}
.i4w-title-hera {
    text-align: center;
    font-variant: small-caps;
}
.i4w-title-hera__logo {
    display: inline;
    height: clamp(2.2rem, 5vw, 4rem);
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    margin-left: 10px;
}
.i4w-introduction {
    max-width: 700px;
    margin: 16px auto 0;
    color: var(--i4w-muted);
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.65;
}

/* ── Audio ── */
.i4w-audio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 480px);
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding: 20px 24px;
    border: 1px solid var(--i4w-border);
    border-radius: var(--i4w-radius);
    background: var(--i4w-surface);
    box-shadow: 0 12px 40px rgb(24 61 77 / 8%);
}
.i4w-audio p   { margin: 4px 0 0; color: var(--i4w-muted); font-size: 0.9rem; }
.i4w-audio audio { width: 100%; }

/* ══════════════════════════════════════════
   PROCESS MAP — layout per il flusso
   ══════════════════════════════════════════ */
.i4w-process-map,
.i4w-proto-map {
    position: relative;
    width: 100%;
    isolation: isolate;
}

/* Etichette linea */
.i4w-line-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.i4w-line-label--acque  { background: #dbeef8; color: #1a5276; }
.i4w-line-label--fanghi { background: #fce4d6; color: #8b4513; margin-top: 40px; }

/* ── Riga di nodi ── */
.i4w-process--water,
.i4w-process--sludge {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns:
        minmax(140px, 1fr)   /* nodo 1 */
        40px                 /* freccia */
        minmax(180px, 1.4fr) /* nodo 2 */
        40px
        minmax(140px, 1fr)   /* nodo 3 */
        40px
        minmax(140px, 1fr)   /* nodo 4 */
        40px
        minmax(140px, 1fr);  /* nodo 5 */
    align-items: stretch;
    gap: 8px;
}

/* ── Nodo ── */
.i4w-node {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--i4w-border);
    border-radius: 14px;
    background: var(--i4w-surface);
    box-shadow: 0 10px 30px rgb(21 62 82 / 8%);
    transition: transform 200ms ease, box-shadow 200ms ease;
}
.i4w-node:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgb(21 62 82 / 14%);
}
.i4w-node__title {
    margin: 0 0 4px;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    line-height: 1.25;
    text-align: center;
    text-transform: uppercase;
    color: var(--i4w-text);
    min-height: 2.2em;
}
.i4w-node__subtitle {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    color: var(--i4w-muted);
}
.i4w-node__img {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    padding: 6px;
}
.i4w-node__img img {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: contain;
}

/* ── Frecce ── */
.i4w-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}
.i4w-arrow__svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: opacity 250ms ease, transform 650ms cubic-bezier(.22,1,.36,1);
}
.i4w-flow.is-visible .i4w-arrow__svg { opacity: 1; transform: scaleX(1); }

/* ══════════════════════════════════════════
   SVG CONNESSIONI VERTICALI (pipe)
   ══════════════════════════════════════════ */
.i4w-pipe-svg {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.i4w-pipe-rectangle {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 12px;
    height: 120px;
    background-color: #6b7280;
    border-radius: 2px;
    overflow: visible;
    pointer-events: none;
}

.i4w-pipe {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1);
    transition-delay: var(--delay, 0ms);
}
.i4w-flow.is-visible .i4w-pipe { stroke-dashoffset: 0; }

.i4w-pipe--blue-dark  { stroke: var(--i4w-blue-dark); stroke-width: 4; }
.i4w-pipe--blue-light { stroke: var(--i4w-blue-light); stroke-width: 4; }
.i4w-pipe--orange     { stroke: #e87c1e; stroke-width: 4; }
.i4w-pipe--green      { stroke: var(--i4w-secondary); stroke-width: 5; }
.i4w-pipe--thin       { stroke-width: 2.5; }

/* Dot marker per le estremità */
.i4w-pipe-dot {
    r: 4;
    fill: var(--i4w-blue-dark);
    opacity: 0;
    transition: opacity 400ms ease;
    transition-delay: var(--delay, 600ms);
}
.i4w-flow.is-visible .i4w-pipe-dot { opacity: 1; }

/* Arrow marker */
.i4w-pipe-arrow-head {
    fill: var(--i4w-blue-dark);
}

/* ══════════════════════════════════════════
   SEZIONE 2 — PROTOTIPO
   ══════════════════════════════════════════ */

/* Riga compatta fanghi */
.i4w-process--sludge-compact {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns:
        minmax(80px, 1fr) 30px
        minmax(80px, 1fr) 30px
        minmax(80px, 1fr) 30px
        minmax(80px, 1fr) 30px
        minmax(80px, 1fr);
    align-items: stretch;
    gap: 6px;
}
.i4w-node-sm {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--i4w-border);
    border-radius: 12px;
    background: var(--i4w-surface);
    box-shadow: 0 4px 16px rgb(21 62 82 / 6%);
}
.i4w-node-sm__img {
    width: 100%;
    max-width: 100px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.i4w-node-sm__img img {
    max-width: 100%;
    max-height: 70px;
    object-fit: contain;
}
.i4w-node-sm__label {
    display: block;
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    color: var(--i4w-text);
    line-height: 1.2;
}
.i4w-arrow-sm {
    display: flex;
    align-items: center;
    justify-content: center;
}
.i4w-arrow-sm svg {
    width: 100%;
    height: auto;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: opacity 250ms ease, transform 600ms cubic-bezier(.22,1,.36,1);
}
.i4w-flow.is-visible .i4w-arrow-sm svg { opacity: 1; transform: scaleX(1); }

/* Box prototipo */
.i4w-proto-box {
    position: relative;
    z-index: 3;
    margin: 10px auto 0;
    max-width: 820px;
    border: 0px solid var(--i4w-red);
    border-radius: var(--i4w-radius);
    background: transparent;
    overflow: hidden;
}
.i4w-proto-box__header {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ed1c24 0%, #c0392b 100%);
    text-align: center;
}
.i4w-proto-box__badge {
    color: #ffffff00;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.i4w-proto-box__visual {
    padding: 0;
    display: flex;
    justify-content: center;
}
.i4w-proto-box__visual img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

/* Freccia output */
.i4w-proto-output-arrow {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}
.i4w-proto-output-arrow svg {
    width: 32px;
    height: auto;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top center;
    transition: opacity 300ms ease 600ms, transform 500ms cubic-bezier(.22,1,.36,1) 600ms;
}
.i4w-flow.is-visible .i4w-proto-output-arrow svg {
    opacity: 1;
    transform: scaleY(1);
}

/* Output prototipo */
.i4w-proto-outputs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    max-width: 700px;
    margin: 0 auto 32px;
}
.i4w-proto-output {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border-radius: 12px;
    text-align: center;
}
.i4w-proto-output--good {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}
.i4w-proto-output--bad {
    background: #fbe9e7;
    border: 1px solid #ef9a9a;
}
.i4w-proto-output img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}
.i4w-proto-output span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--i4w-text);
}
.i4w-cross {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* ══════════════════════════════════════════
   PARTNER
   ══════════════════════════════════════════ */
.i4w-partners-title {
    text-align: center;
    font-size: 1.3rem;
    margin: 0 0 6px;
}
.i4w-partners-subtitle {
    text-align: center;
    color: var(--i4w-muted);
    font-size: 0.95rem;
    margin: 0 0 20px;
}
.i4w-partners {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    max-width: 900px;
    margin: 0 auto 32px;
}
.i4w-partners--single {
    grid-template-columns: minmax(0, 300px);
    justify-content: center;
    margin-top: 14px;
}
.i4w-partner-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    border: 2px solid var(--i4w-secondary);
    border-radius: 14px;
    background: var(--i4w-surface);
    cursor: pointer;
    font: inherit;
    color: var(--i4w-text);
    transition: all 200ms ease;
}
.i4w-partner-card img {
    height: 48px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.i4w-partner-card span {
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
}
.i4w-partner-card:hover {
    background: var(--i4w-secondary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgb(0 166 90 / 25%);
}
.i4w-partner-card:focus-visible {
    outline: 4px solid #ffbf47;
    outline-offset: 3px;
}

/* Loghi istituzionali */
.i4w-institutional {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--i4w-border);
}
.i4w-institutional img {
    height: 40px;
    width: auto;
    object-fit: contain;
    opacity: 0.7;
}

/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */
.i4w-modal {
    width: min(620px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--i4w-radius);
    color: var(--i4w-text);
    background: var(--i4w-surface);
    box-shadow: 0 30px 120px rgb(0 0 0 / 38%);
}
.i4w-modal::backdrop {
    background: rgb(5 18 25 / 72%);
    backdrop-filter: blur(5px);
}
.i4w-modal__content {
    position: relative;
    padding: clamp(28px, 5vw, 48px);
}
.i4w-modal__logo {
    margin-bottom: 16px;
}
.i4w-modal__logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
}
.i4w-modal__content h2 {
    margin: 0 40px 16px 0;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
}
.i4w-modal__text {
    line-height: 1.7;
    color: var(--i4w-muted);
    font-size: 1rem;
}
.i4w-modal__close {
    position: absolute;
    top: 14px; right: 14px;
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    padding: 0; border: 0; border-radius: 50%;
    font-size: 1.6rem;
    background: #eaf0f3;
    cursor: pointer;
    transition: background 150ms ease;
}
.i4w-modal__close:hover { background: #d5dee3; }
.i4w-modal__close:focus-visible { outline: 4px solid #ffbf47; outline-offset: 3px; }

/* ── Scroll hint ── */
.i4w-scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: 100%;
    margin: 20px auto 0;
    color: var(--i4w-primary);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}
.i4w-scroll-hint span:last-child {
    font-size: 2rem;
    line-height: 1;
    animation: i4w-bounce 1.6s infinite;
}
@keyframes i4w-bounce { 50% { transform: translateY(6px); } }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1100px) {
    .i4w-process--water,
    .i4w-process--sludge {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin-inline: auto;
    }
    .i4w-arrow {
        width: 50px; height: 50px;
        margin-inline: auto;
    }
    .i4w-arrow__svg {
        width: 50px;
        transform: rotate(90deg) scaleX(0);
        transform-origin: center;
    }
    .i4w-flow.is-visible .i4w-arrow__svg { transform: rotate(90deg) scaleX(1); }

    .i4w-pipe-svg { display: none; }
    .i4w-line-label--fanghi { margin-top: 32px; }

    .i4w-process--sludge-compact {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin-inline: auto;
    }
    .i4w-arrow-sm {
        width: 40px; height: 40px;
        margin-inline: auto;
    }
    .i4w-arrow-sm svg { width: 40px; transform: rotate(90deg) scaleX(0); transform-origin: center; }
    .i4w-flow.is-visible .i4w-arrow-sm svg { transform: rotate(90deg) scaleX(1); }
}

@media (max-width: 800px) {
    .i4w-audio { grid-template-columns: 1fr; }
    .i4w-partners { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .i4w-proto-outputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 500px) {
    .i4w-container { width: min(100% - 20px, 1400px); }
    .i4w-partners { grid-template-columns: 1fr; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .i4w-flow { opacity: 1; transform: none; transition: none; }
    .i4w-arrow__svg, .i4w-arrow-sm svg { opacity: 1; transform: none; transition: none; }
    .i4w-pipe { stroke-dasharray: none; stroke-dashoffset: 0; transition: none; }
    .i4w-scroll-hint span:last-child { animation: none; }
    .i4w-proto-output-arrow svg { opacity: 1; transform: none; transition: none; }
    .i4w-pipe-dot { opacity: 1; transition: none; }
}
@media (max-width: 1100px) and (prefers-reduced-motion: reduce) {
    .i4w-arrow__svg { transform: rotate(90deg); }
    .i4w-arrow-sm svg { transform: rotate(90deg); }
}
