/* ============================================================
   HORIZON MUNDI — come-funziona.css
   Stili specifici della pagina Come Funziona.
   Estende global.css + components.css + layout.css.
   ============================================================ */

/* ─── Token locali ───────────────────────────────────────── */
:root {
    --hm-gradient-cf:        linear-gradient(135deg, #1A3A3A 0%, #7D2E3E 100%);
    --hm-cf-abyss-lighter:   #243F3F;
    --hm-cf-bordeaux:        #7D2E3E;
    --hm-cf-bordeaux-dark:   #5C2230;
}

/* ─── Ghost button ───────────────────────────────────────── */
.hm-btn--ghost {
    background: transparent;
    border: 1px solid var(--hm-abyss);
    color: var(--hm-abyss);
    padding: var(--hm-space-4) var(--hm-space-8);
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-sm);
    font-weight: var(--hm-weight-medium);
    letter-spacing: var(--hm-tracking-wider);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition:
        background-color var(--hm-dur-fast),
        color            var(--hm-dur-fast);
}

.hm-btn--ghost:hover {
    background-color: var(--hm-abyss);
    color: var(--hm-white);
}

/* ─── Grid 2 colonne ─────────────────────────────────────── */
.hm-grid--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--hm-space-8);
}

/* ══════════════════════════════════════════════════════════
   § 1  HERO — gradiente scuro, testi bianchi
══════════════════════════════════════════════════════════ */
.hm-cf-hero {
    background: var(--hm-gradient-cf);
    display: flex;
    flex-direction: column;
}

.hm-cf-hero__content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding-top: calc(var(--hm-nav-height) + var(--hm-space-16));
    padding-bottom: var(--hm-space-16);
    text-align: center;
}

.hm-cf-hero__title {
    font-family: var(--hm-font-heading);
    font-size: clamp(var(--hm-size-2xl), 3.5vw, var(--hm-size-4xl));
    font-weight: var(--hm-weight-light);
    color: var(--hm-white);
    line-height: var(--hm-leading-snug);
    letter-spacing: var(--hm-tracking-tight);
    margin-top: var(--hm-space-4);
    margin-bottom: var(--hm-space-6);
    max-width: 720px;
    margin-inline: auto;
}

.hm-cf-hero__subtitle {
    font-family: var(--hm-font-body);
    font-size: var(--hm-size-md);
    font-weight: var(--hm-weight-light);
    color: rgba(255, 255, 255, 0.8);
    line-height: var(--hm-leading-normal);
    max-width: 600px;
    margin-inline: auto;
    margin-bottom: var(--hm-space-8);
}

.hm-cf-hero__actions {
    display: flex;
    gap: var(--hm-space-4);
    flex-wrap: wrap;
    justify-content: center;
}

/* Strip statistiche — sfondo scuro semitrasparente */
.hm-cf-hero__stats-strip {
    background-color: rgba(0, 0, 0, 0.2);
    padding-block: var(--hm-space-10);
}

.hm-cf-hero__stats {
    display: flex;
    gap: 0;
}

.hm-cf-hero__stat {
    flex: 1;
    padding-inline: var(--hm-space-8);
    text-align: center;
}

.hm-cf-hero__stat + .hm-cf-hero__stat {
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.hm-cf-hero__stat-value {
    display: block;
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-3xl);
    font-weight: var(--hm-weight-light);
    color: var(--hm-white);
    line-height: 1;
    letter-spacing: var(--hm-tracking-tight);
    margin-bottom: var(--hm-space-2);
}

.hm-cf-hero__stat-label {
    display: block;
    font-size: var(--hm-size-xs);
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: var(--hm-tracking-wide);
    line-height: var(--hm-leading-snug);
    max-width: 180px;
    margin-inline: auto;
}

/* ══════════════════════════════════════════════════════════
   § 2  IL PRINCIPIO — sfondo bianco
══════════════════════════════════════════════════════════ */
.hm-cf-principio {
    background-color: var(--hm-white);
}

.hm-cf-principio__body {
    margin-bottom: var(--hm-space-10);
}

.hm-cf-principio__text {
    font-size: var(--hm-size-md);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-normal);
    max-width: 720px;
    margin-bottom: var(--hm-space-4);
}

.hm-cf-principio__text:last-child {
    margin-bottom: 0;
}

/* Box bordeaux con testo bianco */
.hm-cf-bordeaux-box {
    background-color: var(--hm-cf-bordeaux);
    padding: var(--hm-space-10) var(--hm-space-12);
    max-width: 720px;
}

.hm-cf-bordeaux-box__text {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-lg);
    font-weight: var(--hm-weight-light);
    color: var(--hm-white);
    line-height: var(--hm-leading-normal);
    letter-spacing: var(--hm-tracking-normal);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   § 3  IL PROCESSO IN 5 STEP — sfondo platino
══════════════════════════════════════════════════════════ */
.hm-cf-processo {
    background-color: var(--hm-platinum);
}

.hm-cf-steps {
    list-style: none;
    padding: 0;
    margin: var(--hm-space-10) 0 0;
    display: flex;
    flex-direction: column;
    max-width: 860px;
}

.hm-cf-step {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 0 var(--hm-space-8);
    padding-bottom: var(--hm-space-8);
    position: relative;
}

.hm-cf-step:last-child {
    padding-bottom: 0;
}

/* Linea verticale gold che connette gli step */
.hm-cf-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 30px; /* centro della colonna num (64px / 2 - 1px) */
    top: 44px;  /* sotto il numero */
    bottom: var(--hm-space-2);
    width: 2px;
    background-color: var(--hm-gold);
    opacity: 0.5;
}

.hm-cf-step__num-col {
    display: flex;
    justify-content: center;
    padding-top: var(--hm-space-2);
    position: relative;
    z-index: 1;
}

.hm-cf-step__num {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-2xl);
    font-weight: var(--hm-weight-light);
    color: var(--hm-gold);
    line-height: 1;
    letter-spacing: var(--hm-tracking-tight);
}

.hm-cf-step__body {
    background-color: var(--hm-white);
    border-left: 3px solid var(--hm-gold);
    padding: var(--hm-space-8);
    position: relative;
    z-index: 1;
}

.hm-cf-step__title {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-xl);
    font-weight: var(--hm-weight-semibold);
    color: var(--hm-abyss);
    letter-spacing: var(--hm-tracking-tight);
    margin-bottom: var(--hm-space-3);
}

.hm-cf-step__text {
    font-size: var(--hm-size-base);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-normal);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   § 4  IL MODELLO COMMISSIONALE — sfondo Verde Abisso
══════════════════════════════════════════════════════════ */
.hm-cf-commissioni {
    background-color: var(--hm-abyss);
}

.hm-cf-commissioni__intro {
    margin-bottom: var(--hm-space-10);
}

.hm-cf-commissioni__text {
    font-size: var(--hm-size-md);
    color: rgba(255, 255, 255, 0.75);
    line-height: var(--hm-leading-normal);
    max-width: 720px;
    margin-bottom: var(--hm-space-4);
}

.hm-cf-commissioni__text:last-child {
    margin-bottom: 0;
}

/* Cards commissioni su sfondo leggermente più chiaro */
.hm-cf-comm-card {
    background-color: var(--hm-cf-abyss-lighter);
    border: 1px solid rgba(184, 150, 46, 0.25);
    border-top: 3px solid var(--hm-gold);
    padding: var(--hm-space-10) var(--hm-space-8);
}

.hm-cf-comm-card__title {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-xl);
    font-weight: var(--hm-weight-semibold);
    color: var(--hm-white);
    letter-spacing: var(--hm-tracking-tight);
    margin-bottom: var(--hm-space-4);
}

.hm-cf-comm-card__text {
    font-size: var(--hm-size-base);
    color: rgba(255, 255, 255, 0.75);
    line-height: var(--hm-leading-normal);
    margin: 0;
}

/* Box trasparenza — bordo gold, testo bianco */
.hm-cf-trasparenza-box {
    border: 1px solid var(--hm-gold);
    border-left: 4px solid var(--hm-gold);
    padding: var(--hm-space-8) var(--hm-space-10);
    margin-top: var(--hm-space-10);
    max-width: 640px;
    margin-inline: auto;
    text-align: center;
}

.hm-cf-trasparenza-box__text {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-md);
    font-weight: var(--hm-weight-light);
    color: var(--hm-white);
    letter-spacing: var(--hm-tracking-normal);
    line-height: var(--hm-leading-normal);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   § 5  COSA CI DISTINGUE — sfondo bianco
══════════════════════════════════════════════════════════ */
.hm-cf-distingue {
    background-color: var(--hm-white);
}

/* Wrapper 2×2 su platino */
.hm-cf-cards-plat {
    background-color: var(--hm-platinum);
    padding: var(--hm-space-10);
}

/* Feature card — stile condiviso (ridefinito per isolamento CSS) */
.hm-feature-card {
    background-color: var(--hm-white);
    padding: var(--hm-space-8);
    border-top: 2px solid var(--hm-gold);
}

.hm-feature-card__icon {
    color: var(--hm-abyss);
    margin-bottom: var(--hm-space-5);
    display: block;
}

.hm-feature-card__title {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-xl);
    font-weight: var(--hm-weight-semibold);
    color: var(--hm-abyss);
    letter-spacing: var(--hm-tracking-tight);
    margin-bottom: var(--hm-space-3);
}

.hm-feature-card__text {
    font-size: var(--hm-size-base);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-normal);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   § 6  TEMPI REALI — sfondo platino
══════════════════════════════════════════════════════════ */
.hm-cf-tempi {
    background-color: var(--hm-platinum);
}

.hm-cf-tempi__intro {
    font-size: var(--hm-size-md);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-normal);
    max-width: 720px;
    margin-inline: auto;
    text-align: center;
    margin-bottom: var(--hm-space-12);
}

/* Timeline orizzontale 4 fasi */
.hm-cf-timeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: relative;
    margin-bottom: var(--hm-space-12);
}

/* Linea gold orizzontale attraverso i dot */
.hm-cf-timeline::before {
    content: '';
    position: absolute;
    /* centrato sui dot: top padding (48px etichetta) + gap (12px) + meta dot (7px) = ~67px */
    top: 67px;
    left: 12.5%;  /* centro del primo phase */
    right: 12.5%; /* centro dell'ultimo phase */
    height: 2px;
    background-color: var(--hm-gold);
}

.hm-cf-timeline__phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 var(--hm-space-3);
    position: relative;
}

.hm-cf-timeline__time {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-sm);
    font-weight: var(--hm-weight-semibold);
    color: var(--hm-gold);
    letter-spacing: var(--hm-tracking-wide);
    text-transform: uppercase;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: var(--hm-leading-snug);
}

/* Dot quadrato gold — nessun border-radius per design system */
.hm-cf-timeline__dot {
    display: block;
    width: 14px;
    height: 14px;
    background-color: var(--hm-gold);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    margin-block: var(--hm-space-3);
}

.hm-cf-timeline__label {
    font-size: var(--hm-size-sm);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-snug);
    max-width: 160px;
    text-align: center;
}

/* Box Verde Abisso con testo bianco */
.hm-cf-abyss-box {
    background-color: var(--hm-abyss);
    padding: var(--hm-space-10) var(--hm-space-12);
    max-width: 720px;
    margin-inline: auto;
    text-align: center;
}

.hm-cf-abyss-box__text {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-md);
    font-weight: var(--hm-weight-light);
    color: rgba(255, 255, 255, 0.9);
    line-height: var(--hm-leading-normal);
    letter-spacing: var(--hm-tracking-normal);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   § 7  FAQ — sfondo bianco
══════════════════════════════════════════════════════════ */
.hm-cf-faq {
    background-color: var(--hm-white);
}

/* Accordion */
.hm-accordion {
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.hm-accordion__item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.hm-accordion__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--hm-space-6) 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    gap: var(--hm-space-4);
    transition: color var(--hm-dur-fast);
}

.hm-accordion__trigger:hover .hm-accordion__title {
    color: var(--hm-abyss);
}

.hm-accordion__title {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-lg);
    font-weight: var(--hm-weight-medium);
    color: var(--hm-dark);
    line-height: var(--hm-leading-snug);
    letter-spacing: var(--hm-tracking-normal);
    transition: color var(--hm-dur-fast);
}

.hm-accordion__item.is-open .hm-accordion__title {
    color: var(--hm-abyss);
}

.hm-accordion__icon {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-xl);
    font-weight: var(--hm-weight-light);
    color: var(--hm-gold);
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    transition: transform var(--hm-dur-base) var(--hm-ease-out);
}

.hm-accordion__item.is-open .hm-accordion__icon {
    transform: rotate(45deg);
}

.hm-accordion__panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition:
        max-height var(--hm-dur-slow) var(--hm-ease-out),
        opacity    var(--hm-dur-base) var(--hm-ease-out);
}

.hm-accordion__item.is-open .hm-accordion__panel {
    max-height: 600px;
    opacity: 1;
}

.hm-accordion__body {
    padding-bottom: var(--hm-space-6);
}

.hm-accordion__body p {
    font-size: var(--hm-size-base);
    color: var(--hm-color-text-muted);
    line-height: var(--hm-leading-normal);
}

/* ══════════════════════════════════════════════════════════
   § 8  CTA FINALE — gradiente scuro
══════════════════════════════════════════════════════════ */
.hm-cf-finale {
    background: var(--hm-gradient-cf);
    padding-block: var(--hm-space-24);
}

.hm-cf-finale__lead {
    font-size: var(--hm-size-md);
    color: rgba(255, 255, 255, 0.75);
    line-height: var(--hm-leading-normal);
    max-width: 560px;
    margin-inline: auto;
    margin-top: var(--hm-space-4);
}

.hm-cf-finale .hm-section-header--center {
    margin-bottom: var(--hm-space-12);
}

.hm-cf-finale__form-wrap {
    max-width: 640px;
    margin-inline: auto;
    margin-bottom: var(--hm-space-12);
}

/* Form su sfondo scuro */
.hm-form--light {
    display: flex;
    flex-direction: column;
    gap: var(--hm-space-6);
}

.hm-form__row--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--hm-space-6);
}

.hm-field {
    display: flex;
    flex-direction: column;
    gap: var(--hm-space-2);
}

.hm-field__label {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-xs);
    font-weight: var(--hm-weight-medium);
    letter-spacing: var(--hm-tracking-wider);
    text-transform: uppercase;
    color: var(--hm-abyss);
}

.hm-field__label--light {
    color: rgba(255, 255, 255, 0.65);
}

.hm-field__label--light abbr {
    color: var(--hm-gold);
}

.hm-field__input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    padding: var(--hm-space-3) 0;
    font-family: var(--hm-font-body);
    font-size: var(--hm-size-base);
    color: var(--hm-dark);
    outline: none;
    transition: border-color var(--hm-dur-fast);
    width: 100%;
    appearance: none;
}

.hm-field__input--light {
    color: var(--hm-white);
    border-bottom-color: rgba(255, 255, 255, 0.25);
}

.hm-field__input--light::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.hm-field__input--light:focus {
    border-bottom-color: var(--hm-gold);
}

.hm-field__input--light option {
    color: var(--hm-dark);
    background: var(--hm-white);
}

.hm-field__textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select wrapper con chevron */
.hm-field__select-wrap {
    position: relative;
}

.hm-field__select-wrap::after {
    content: '';
    position: absolute;
    right: var(--hm-space-3);
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-right: 1.5px solid;
    border-bottom: 1.5px solid;
    pointer-events: none;
}

.hm-cf-finale .hm-field__select-wrap::after {
    border-color: rgba(255, 255, 255, 0.5);
}

.hm-form__submit {
    padding-top: var(--hm-space-2);
}

/* Link interni gold */
.hm-inner-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--hm-space-4) var(--hm-space-8);
    justify-content: center;
}

.hm-inner-links__item {
    font-family: var(--hm-font-heading);
    font-size: var(--hm-size-sm);
    font-weight: var(--hm-weight-medium);
    color: var(--hm-gold);
    letter-spacing: var(--hm-tracking-wide);
    transition: color var(--hm-dur-fast);
}

.hm-inner-links__item:hover {
    color: var(--hm-sand);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — max-width: 1024px
══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

    /* Hero */
    .hm-cf-hero__title {
        font-size: var(--hm-size-2xl);
    }

    .hm-cf-hero__stat {
        padding-inline: var(--hm-space-5);
    }

    /* Grid 2 col → 1 col */
    .hm-grid--2 {
        grid-template-columns: 1fr;
    }

    /* Cards plat padding ridotto */
    .hm-cf-cards-plat {
        padding: var(--hm-space-8) var(--hm-space-6);
    }

    /* Step: col num più stretta */
    .hm-cf-step {
        grid-template-columns: 52px 1fr;
        gap: 0 var(--hm-space-5);
    }

    .hm-cf-step:not(:last-child)::before {
        left: 24px;
    }

    /* Timeline → 2 col su tablet */
    .hm-cf-timeline {
        grid-template-columns: repeat(2, 1fr);
        row-gap: var(--hm-space-10);
    }

    .hm-cf-timeline::before {
        display: none;
    }

    /* Box */
    .hm-cf-bordeaux-box,
    .hm-cf-abyss-box {
        padding: var(--hm-space-8) var(--hm-space-8);
    }

    .hm-cf-trasparenza-box {
        padding: var(--hm-space-6) var(--hm-space-8);
    }

    /* Link interni */
    .hm-inner-links {
        flex-direction: column;
        align-items: center;
        gap: var(--hm-space-3);
    }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — max-width: 640px
══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

    /* Hero */
    .hm-cf-hero__content {
        padding-top: calc(var(--hm-nav-height) + var(--hm-space-10));
        padding-bottom: var(--hm-space-10);
    }

    .hm-cf-hero__title {
        font-size: var(--hm-size-xl);
    }

    .hm-cf-hero__subtitle {
        font-size: var(--hm-size-base);
    }

    .hm-cf-hero__actions {
        flex-direction: column;
        align-items: center;
    }

    .hm-cf-hero__actions .hm-btn {
        text-align: center;
        justify-content: center;
        width: 100%;
        max-width: 320px;
    }

    /* Stats strip: verticale su mobile */
    .hm-cf-hero__stats {
        flex-direction: column;
        gap: var(--hm-space-6);
    }

    .hm-cf-hero__stat + .hm-cf-hero__stat {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding-top: var(--hm-space-6);
    }

    .hm-cf-hero__stat-value {
        font-size: var(--hm-size-2xl);
    }

    /* Step su mobile */
    .hm-cf-step {
        grid-template-columns: 44px 1fr;
        gap: 0 var(--hm-space-4);
    }

    .hm-cf-step:not(:last-child)::before {
        left: 20px;
    }

    .hm-cf-step__num {
        font-size: var(--hm-size-xl);
    }

    .hm-cf-step__body {
        padding: var(--hm-space-6);
    }

    /* Timeline → 1 col su mobile */
    .hm-cf-timeline {
        grid-template-columns: 1fr;
        row-gap: var(--hm-space-8);
    }

    /* Box */
    .hm-cf-bordeaux-box,
    .hm-cf-abyss-box {
        padding: var(--hm-space-6) var(--hm-space-5);
    }

    .hm-cf-trasparenza-box {
        padding: var(--hm-space-6) var(--hm-space-5);
    }

    /* Accordion */
    .hm-accordion__title {
        font-size: var(--hm-size-base);
    }

    /* CTA finale */
    .hm-cf-finale {
        padding-block: var(--hm-space-12);
    }

    .hm-cf-finale__form-wrap {
        padding-inline: 0;
    }

    .hm-form__row--2 {
        grid-template-columns: 1fr;
    }
}
