/* ==========================================================================
   HORNOI V2 — PARLIAMONE / ANALISI GRATUITA
   Le classi .cform-* e gli id sono quelli attesi da candidatura.js:
   cambiarli romperebbe validazione e invio.
   ========================================================================== */

/* --------------------------------------------------------------------------
   HERO
   -------------------------------------------------------------------------- */
.ct-hero {
    padding-top: clamp(114px, 11vw, 156px);
    overflow: hidden;
}
.ct-hero__glow { top: -26%; right: -12%; width: 58vw; }

.ct-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: center;
    gap: clamp(40px, 5vw, 76px);
}
@media (max-width: 940px) {
    .ct-hero__grid { grid-template-columns: minmax(0, 1fr); gap: 44px; }
    .ct-hero__ph { max-width: 380px; margin-inline: auto; width: 100%; }
}

/* ritratto */
.ct-portrait {
    position: relative;
    margin: 0;
    border-radius: var(--r-xl);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 4 / 5;
    background: var(--surface-2);
}
.ct-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 16%;
    filter: grayscale(1) contrast(1.08);
}
.ct-portrait::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(10, 10, 10, .94) 6%, rgba(10, 10, 10, .2) 48%, transparent 70%),
        linear-gradient(150deg, rgba(255, 90, 31, .24), transparent 58%);
    pointer-events: none;
}
.ct-portrait figcaption {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 1;
    display: grid;
    gap: 8px;
    padding: 20px;
    color: #fff;
}
/* la pill sta sopra la foto: il fondo va tenuto un filo più presente del
   solito, altrimenti sparisce sulle zone chiare dello scatto */
.ct-portrait figcaption .pill {
    justify-self: start;
    background: rgba(63, 207, 107, .15);
    border-color: rgba(63, 207, 107, .34);
    color: var(--green-hi);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.ct-portrait figcaption strong {
    font-family: var(--f-display);
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -.022em;
    line-height: 1;
}
.ct-portrait figcaption > span:last-child {
    font-size: .76rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}

/* rassicurazioni */
.ct-facts { display: grid; gap: 14px; }

.ct-fact {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.ct-fact > svg {
    width: 38px;
    height: 38px;
    padding: 9px;
    border-radius: var(--r-sm);
    background: rgba(255, 90, 31, .1);
    border: 1px solid rgba(255, 90, 31, .22);
    color: var(--orange);
}
.ct-fact strong {
    display: block;
    font-family: var(--f-display);
    font-size: .98rem;
    font-weight: 650;
    letter-spacing: -.02em;
    margin-bottom: 3px;
}
.ct-fact span {
    font-size: .86rem;
    line-height: 1.4;
    color: var(--fg-muted);
}

/* --------------------------------------------------------------------------
   LAYOUT FORM
   -------------------------------------------------------------------------- */
.ct-grid {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    gap: clamp(36px, 5vw, 76px);
    align-items: start;
}
@media (max-width: 940px) {
    .ct-grid { grid-template-columns: minmax(0, 1fr); gap: 44px; }
}

.ct-side { position: sticky; top: 108px; }
@media (max-width: 940px) { .ct-side { position: static; } }

.ct-side .lyr__item { padding-block: clamp(18px, 2.2vw, 24px); }
.ct-side .lyr__n { font-size: 1.3rem; }

/* alternativa via mail */
.ct-alt {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px 20px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.ct-alt > svg { width: 20px; height: 20px; color: var(--orange); justify-self: center; }
.ct-alt strong {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 3px;
}
.ct-alt a {
    font-size: .88rem;
    color: var(--orange);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* --------------------------------------------------------------------------
   IL FORM
   -------------------------------------------------------------------------- */
.ct-form {
    padding: clamp(26px, 3.4vw, 46px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow);
}

.cform-head {
    padding-bottom: clamp(22px, 2.6vw, 30px);
    margin-bottom: clamp(22px, 2.6vw, 30px);
    border-bottom: 1px solid var(--line);
}

.cform-field { margin-bottom: 20px; }

.cform-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 560px) { .cform-row { grid-template-columns: minmax(0, 1fr); gap: 0; } }

.cform-field label {
    display: block;
    margin-bottom: 9px;
    font-size: .86rem;
    font-weight: 550;
    letter-spacing: -.006em;
    color: var(--fg);
}

.cform-field input,
.cform-field select,
.cform-field textarea {
    width: 100%;
    padding: 13px 16px;
    font-size: .95rem;
    font-family: var(--f-body);
    color: var(--fg);
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
    appearance: none;
    -webkit-appearance: none;
}

.cform-field textarea { resize: vertical; min-height: 130px; line-height: 1.55; }

.cform-field input::placeholder,
.cform-field textarea::placeholder { color: var(--fg-faint); }

.cform-field input:focus,
.cform-field select:focus,
.cform-field textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 90, 31, .13);
}

/* freccia della select disegnata a mano */
.cform-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 42px;
    cursor: pointer;
}

/* errore di campo */
.field-error {
    display: block;
    margin-top: 7px;
    font-size: .8rem;
    color: #E5484D;
    min-height: 0;
}

/* nota di contesto sotto un campo: informa, non segnala un errore */
.field-note {
    display: block;
    margin-top: 7px;
    font-size: .8rem;
    color: var(--fg-muted);
}
.cform-field.has-error input,
.cform-field.has-error select,
.cform-field.has-error textarea {
    border-color: #E5484D;
    box-shadow: 0 0 0 3px rgba(229, 72, 77, .12);
}

/* campo esca: fuori dallo schermo, mai raggiungibile da tastiera */
.cform-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* privacy */
.cform-privacy {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin: 6px 0 4px;
    cursor: pointer;
}
.cform-privacy input {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--orange);
    cursor: pointer;
}
.cform-privacy span {
    font-size: .87rem;
    line-height: 1.5;
    color: var(--fg-muted);
}
.cform-privacy a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 2px;
}

#privacyError { margin-bottom: 12px; }

/* submit */
#formSubmit {
    position: relative;
    width: 100%;
    margin-top: 18px;
}
#formSubmit .cform-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: opacity var(--t-fast);
}
#formSubmit .cform-spin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
}
#formSubmit.is-loading .cform-label { opacity: 0; }
#formSubmit.is-loading .cform-spin { opacity: 1; animation: ct-spin .7s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }

/* durante l'invio il bottone resta bottone: nessun salto di colore, solo
   un po' meno acceso, così si capisce che sta lavorando */
#formSubmit:disabled { cursor: not-allowed; }
#formSubmit.is-loading { opacity: .82; }
#formSubmit.is-loading:hover { background: var(--orange); }

.cform-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    font-size: .8rem;
    color: var(--fg-faint);
    text-align: center;
}
.cform-foot svg { width: 14px; height: 14px; flex: none; }

/* --------------------------------------------------------------------------
   FEEDBACK (iniettato da candidatura.js)
   -------------------------------------------------------------------------- */
.cform-feedback {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 22px;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--surface-2);
}

.cform-feedback .fb-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}
.cform-feedback .fb-msg { font-size: .93rem; line-height: 1.55; }
.cform-feedback .fb-msg strong {
    font-family: var(--f-display);
    font-size: 1.04rem;
    font-weight: 650;
    letter-spacing: -.02em;
}

.feedback-success {
    border-color: rgba(63, 207, 107, .38);
    background: rgba(63, 207, 107, .08);
}
.feedback-success .fb-icon { background: #3FCF6B; }

.feedback-error {
    border-color: rgba(229, 72, 77, .38);
    background: rgba(229, 72, 77, .07);
}
.feedback-error .fb-icon { background: #E5484D; }

/* --------------------------------------------------------------------------
   RIMANDO ALLA MASTERCLASS
   -------------------------------------------------------------------------- */
.ct-mc {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: clamp(22px, 3vw, 40px);
    align-items: center;
    padding: clamp(24px, 3vw, 38px);
    background: var(--surface);
    border: 1px solid rgba(255, 90, 31, .28);
    border-radius: var(--r-xl);
}
@media (max-width: 820px) {
    .ct-mc { grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: start; }
}

.ct-mc__date {
    display: grid;
    justify-items: center;
    width: 92px;
    padding: 16px 10px;
    border-radius: var(--r);
    background: var(--ink);
    color: #fff;
    line-height: 1;
}
.ct-mc__date span {
    font-family: var(--f-display);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -.04em;
    color: var(--orange);
}
.ct-mc__date small {
    margin-top: 7px;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: lowercase;
    color: rgba(255, 255, 255, .62);
}

.ct-mc__b .body { max-width: 56ch; }
