/* Online therapy page (terapia_online.php). Builds on css/site.css tokens and components. */

/* Hero: copy on the left, photo with three floating notes on the right. */
.to-hero {
    padding-bottom: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}

.to-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: var(--space-7) clamp(2.5rem, 1rem + 5vw, 6rem);
    align-items: center;
}

.to-hero__title {
    font-size: clamp(2.5rem, 1.5rem + 3.4vw, 4.375rem);
    margin-bottom: var(--space-5);
}

.to-hero__title em {
    display: block;
}

.to-hero .lead {
    max-width: 34rem;
}

/* Keep each short highlighted phrase on one line. */
.to-hero .hl {
    white-space: nowrap;
}

.to-hero__visual {
    position: relative;
    width: min(100%, 520px);
    justify-self: end;
    margin-block: var(--space-5) var(--space-6);
}

/* Tilted brand-tinted card behind the photo and a clay dot, as in the home hero. */
.to-hero__photo {
    position: relative;
}

.to-hero__photo::before {
    content: "";
    position: absolute;
    inset: 6% -5% -6% 8%;
    border-radius: var(--radius-lg);
    background: linear-gradient(150deg, var(--c-secondary-soft), var(--c-tertiary-soft));
    box-shadow: inset 0 0 0 1px rgb(251 252 251 / 0.7);
    transform: rotate(4deg);
    z-index: -1;
}

.to-hero__photo::after {
    content: "";
    position: absolute;
    top: -5%;
    right: 9%;
    width: clamp(40px, 4vw, 64px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--c-secondary);
}

.to-hero__photo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: 58% 50%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--c-mist-soft);
}

ul.to-hero__notes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.to-note {
    position: absolute;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 270px;
    padding: var(--space-3) var(--space-5) var(--space-3) var(--space-3);
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: var(--shadow);
}

.to-note .icon-chip {
    width: 46px;
    height: 46px;
}

.to-note .icon-chip .icon {
    width: 26px;
    height: 26px;
}

.to-note__text {
    font-size: var(--fs-sm);
    line-height: 1.35;
    color: var(--c-ink-soft);
}

.to-note__text strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-ink);
}

.to-note--1 {
    top: 9%;
    left: -12%;
}

.to-note--2 {
    top: 46%;
    right: -7%;
}

.to-note--3 {
    bottom: -8%;
    left: 4%;
}

/* Intro: ethics code statement on the left, effectiveness card on the right. */
.to-intro__grid {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: var(--space-7) clamp(2rem, 1rem + 4vw, 5rem);
    align-items: center;
}

.to-intro__copy .h2 {
    margin-bottom: var(--space-5);
}

.to-intro__text {
    max-width: 36rem;
    font-size: var(--fs-lead);
    line-height: 1.6;
    color: var(--c-ink-soft);
    text-wrap: pretty;
}

.to-evidence {
    position: relative;
    padding: clamp(1.75rem, 1.4rem + 1.2vw, 2.75rem);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    box-shadow: var(--shadow);
}

.to-evidence__compare {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.to-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--c-mist-soft);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.2;
    color: var(--c-ink);
}

.to-pill .icon {
    width: 18px;
    height: 18px;
    color: var(--c-teal);
}

.to-pill:last-child {
    background: var(--c-secondary-soft);
}

.to-pill:last-child .icon {
    color: var(--c-secondary-strong);
}

.to-evidence__equal {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    line-height: 1;
    color: var(--c-ink-soft);
}

.to-evidence__text {
    font-family: var(--font-serif);
    font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.875rem);
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--c-ink);
    text-wrap: pretty;
}

.to-evidence__text strong {
    font-style: italic;
    font-weight: 400;
    color: var(--c-secondary-strong);
}

/* Advantages: 4-column bento (wide card, two cards / two cards, wide invite). */
.to-bento {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
    margin: 0;
}

ul.to-bento {
    padding: 0;
}

.to-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 200px;
    padding: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-ink);
}

.to-card:first-child,
.to-card--cta {
    grid-column: span 2;
}

.to-card .icon-chip {
    margin-bottom: auto;
    background: rgb(251 252 251 / 0.75);
}

.panel--ink .to-card .h3 {
    margin-top: var(--space-5);
    font-size: clamp(1.25rem, 1.15rem + 0.35vw, 1.4375rem);
    color: var(--c-ink);
}

.to-card p {
    font-size: var(--fs-sm);
    line-height: 1.6;
    color: var(--c-ink-soft);
    text-wrap: pretty;
}

.to-card:first-child p {
    max-width: 40ch;
    font-size: 1rem;
}

/* Light cards on the ink panel: standard highlight, not the on-dark variant. */
.panel--ink .to-card .hl {
    color: var(--c-ink);
    font-weight: 600;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M4 9.5C34 4.6 71 7.8 108 5.6c31-1.8 60-2.4 88 1.2 2.3 6.5 2.6 15.9 1.2 24.4-33 4.6-70 1.4-106 3.8-29 1.9-57 2.6-86 .2C2.6 27.6 2 17.2 4 9.5Z' fill='%23C97B63' fill-opacity='.26'/%3E%3C/svg%3E");
}

.to-card--light { background: var(--c-bg); }
.to-card--light .icon-chip { background: var(--c-secondary-soft); }
.to-card--sage { background: var(--c-sage-soft); }
.to-card--clay { background: var(--c-secondary-soft); }
.to-card--slate { background: var(--c-tertiary-soft); }

/* Invite: teal cell that closes the grid */
.to-card--cta {
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
    background:
        radial-gradient(70% 90% at 100% 0%, rgb(232 182 165 / 0.22), transparent 70%),
        var(--c-teal);
    color: var(--c-on-dark);
}

.to-card--cta .to-card__claim {
    max-width: 30ch;
    font-family: var(--font-serif);
    font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
    line-height: 1.35;
    color: var(--c-on-dark);
}

/* Doubts and direct experience: title on top, doubts left, answer right. */
.to-talk {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "title answer"
        "doubts answer";
    gap: var(--space-6) clamp(2rem, 1rem + 4vw, 5rem);
    align-items: start;
}

.to-talk__title {
    grid-area: title;
}

.to-talk__doubts {
    grid-area: doubts;
    padding-top: var(--space-2);
}

ul.to-talk__doubts .bubble {
    padding: var(--space-4) var(--space-5);
    font-size: 1.0625rem;
    line-height: 1.5;
}

.to-talk__answer {
    grid-area: answer;
}

.to-talk__text {
    max-width: 60ch;
    color: var(--c-ink-soft);
    text-wrap: pretty;
}

/* Direct experiences: one large answer bubble at a time (home reviews carousel). */
.to-talk .to-voices {
    position: relative;
    max-width: 100%;
    margin: var(--space-5) 0 0;
    padding: clamp(1.5rem, 1rem + 1.6vw, 2.5rem);
    padding-top: clamp(3.75rem, 3rem + 1.5vw, 4.5rem);
}

.to-voices__mark {
    position: absolute;
    top: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
    left: clamp(1.5rem, 1rem + 1.6vw, 2.5rem);
    width: 40px;
    height: 40px;
    color: var(--c-secondary);
    --icon-duo: var(--c-secondary);
    --icon-duo-opacity: 0.45;
}

.to-voices__track {
    grid-auto-columns: 100%;
    gap: var(--space-6);
    padding: 0;
}

.to-voice {
    scroll-snap-align: start;
}

.to-voice figure {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.to-voice blockquote {
    font-family: var(--font-serif);
    font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
    line-height: 1.55;
    text-wrap: pretty;
}

.to-voice figcaption {
    margin-top: auto;
    padding-top: var(--space-4);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--c-on-dark-soft);
}

.to-voices__controls {
    justify-content: flex-end;
    margin-top: var(--space-4);
}

/* Link to the full stories on the left of the carousel buttons. */
.to-voices__more {
    margin-right: auto;
}

/* Responsive */
@media (max-width: 1199px) {
    /* The tallest story sets the bubble height: shorter ones sit in the middle, the name right below. */
    .to-voice figure {
        justify-content: center;
    }

    .to-voice figcaption {
        margin-top: 0;
    }

    .to-note--2 {
        right: -4%;
    }
}

@media (max-width: 1023px) {
    .to-hero__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .to-hero__visual {
        justify-self: center;
        width: min(100%, 560px);
    }

    .to-hero__photo img {
        aspect-ratio: 4 / 3;
    }

    .to-intro__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .to-evidence {
        max-width: 40rem;
    }

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

    .to-talk {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "title"
            "doubts"
            "answer";
    }

    .to-talk__doubts {
        max-width: 40rem;
    }

    /* Advantages: compact cards, icon beside title and text. */
    .to-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-content: start;
        gap: var(--space-1) var(--space-4);
        min-height: 0;
    }

    .to-card .icon-chip {
        grid-row: 1 / span 2;
        margin: 0;
    }

    .panel--ink .to-card .h3 {
        margin-top: var(--space-1);
    }

    .to-card:first-child p {
        max-width: none;
    }

    /* Invite: claim and button on one row. */
    .to-card--cta {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    /* Notes become one compact card overlapping the photo bottom (like the home facts). */
    .to-hero__visual {
        width: 100%;
        margin-block: var(--space-2) 0;
    }

    .to-hero__photo img {
        aspect-ratio: 16 / 11;
    }

    .to-hero__photo::after {
        right: 6%;
    }

    ul.to-hero__notes {
        position: relative;
        margin: -2.5rem var(--space-3) 0;
        padding: var(--space-2) var(--space-4);
        border-radius: var(--radius);
        background: var(--c-surface);
        box-shadow: var(--shadow);
    }

    .to-note {
        position: static;
        max-width: none;
        padding: var(--space-3) 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .to-note + .to-note {
        border-top: 1px solid var(--c-line);
    }

    /* The card is already visible at the fold: no per-row reveal. */
    .js .to-note[data-reveal] {
        opacity: 1;
        transform: none;
    }

    .to-bento {
        grid-template-columns: minmax(0, 1fr);
    }

    .to-card:first-child,
    .to-card--cta {
        grid-column: auto;
    }

    .to-card {
        min-height: 0;
    }

    .panel--ink .to-card .h3 {
        margin-top: var(--space-3);
    }

    .to-card .icon-chip {
        margin-bottom: 0;
    }

    .to-card--cta .btn {
        width: 100%;
    }

    .to-evidence__text {
        font-size: 1.3125rem;
    }

    .to-card {
        padding: var(--space-5);
    }

    .to-card--cta {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Stories: the longest ones are cut after 12 lines (full texts on testimonianze.php),
       so a short one never sits in a huge empty bubble. */
    .to-voice blockquote {
        font-size: 1.0625rem;
    }

    .to-voice blockquote p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 12;
        line-clamp: 12;
        overflow: hidden;
    }

    /* Controls: full-size buttons; the link takes its own row when they do not fit. */
    .to-voices__controls {
        flex-wrap: wrap;
        row-gap: var(--space-1);
    }

    .to-voices__controls .carousel__btn {
        flex: none;
        width: 48px;
        height: 48px;
    }

    .to-voices__more {
        white-space: nowrap;
    }
}

/* Narrow phones: buttons stay together on the right, the link moves to its own row below. */
@media (max-width: 399px) {
    .to-voices__more {
        order: 1;
        flex-basis: 100%;
    }
}
