/* Intervention area pages (approfondimenti.php). Loaded after css/site.css.
   Content comes from dettagli/*.php as plain data: intro, signs, forms, help, when, source. */

/* ---------- Hero: copy on the left, petal + icon composition with two reassuring notes on the right ---------- */
.ar-hero {
    padding-bottom: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}

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

/* Long titles (e.g. "ossessivo-compulsivo") must never overflow on small phones. */
.ar-hero__title {
    font-size: clamp(2.5rem, 1.5rem + 3.2vw, 4.25rem);
    margin-bottom: var(--space-5);
    overflow-wrap: break-word;
    hyphens: auto;
}

.ar-hero--long .ar-hero__title {
    font-size: clamp(2.125rem, 1.4rem + 2.4vw, 3.375rem);
}

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

/* The small chip next to the eyebrow stands in for the composition on small screens. */
.ar-hero__chip {
    display: none;
}

.ar-visual {
    position: relative;
    justify-self: end;
    width: min(100%, 430px);
    aspect-ratio: 1;
    margin-block: var(--space-4);
}

.ar-visual__art {
    position: absolute;
    inset: 0;
}

/* Leaf petal from the logo, tinted with the brand duo (clay to slate). */
.ar-visual__petal {
    position: absolute;
    inset: 13%;
    border-radius: 0 72% 0 72%;
    background:
        radial-gradient(60% 60% at 35% 30%, rgb(251 252 251 / 0.9), transparent 70%),
        linear-gradient(135deg, var(--c-secondary-soft) 0%, var(--c-tertiary-soft) 100%);
    box-shadow: inset 0 0 0 1px rgb(251 252 251 / 0.8), var(--shadow);
    transform: rotate(32deg);
}

/* A second, smaller sage leaf behind, as in the overlapping petals of the emblem. */
.ar-visual__art::before {
    content: "";
    position: absolute;
    inset: 30% 2% 6% 34%;
    border-radius: 0 72% 0 72%;
    background: linear-gradient(135deg, var(--c-sage-soft) 0%, rgb(134 161 141 / 0.55) 100%);
    transform: rotate(100deg);
}

.ar-visual__ring {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    border: 1px solid rgb(154 83 64 / 0.18);
}

.ar-visual__icon.icon-chip {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44%;
    height: auto;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    background: var(--c-surface);
    box-shadow: 0 2px 6px rgb(11 45 51 / 0.05), 0 22px 44px -18px rgb(154 83 64 / 0.45);
    --icon-duo-opacity: 0.5;
}

.ar-visual__icon.icon-chip .icon {
    width: 52%;
    height: 52%;
}

.ar-visual__dot {
    position: absolute;
    top: 9%;
    left: 20%;
    width: clamp(32px, 3vw, 48px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--c-secondary);
}

ul.ar-visual__notes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ar-note-chip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5) var(--space-3) var(--space-3);
    white-space: nowrap;
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: var(--shadow);
    font-size: var(--fs-sm);
    line-height: 1.35;
    color: var(--c-ink-soft);
}

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

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

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

.ar-note-chip--1 {
    top: 12%;
    right: -6%;
}

.ar-note-chip--2 {
    bottom: 4%;
    left: -10%;
}

/* ---------- Body: alternating rhythm (centred lede, full-width grid, accordion, horizontal path) ---------- */

/* Lede: the key message, set like the opening of an article. */
.ar-lede {
    padding-block: clamp(3rem, 2rem + 4vw, 5.5rem) clamp(2.5rem, 2rem + 2vw, 4rem);
}

.ar-lede__inner {
    max-width: 50rem;
    text-align: center;
}

.ar-lede__mark {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-5);
    border-radius: 0 50% 0 50%;
    background: var(--c-secondary-soft);
    color: var(--c-secondary-strong);
    --icon-duo: var(--c-secondary);
    --icon-duo-opacity: 0.4;
}

.ar-lede__mark .icon {
    width: 26px;
    height: 26px;
}

.ar-lede__text {
    font-family: var(--font-serif);
    font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--c-ink);
    text-wrap: pretty;
}

.ar-lede__text .hl {
    font-weight: 500;
}

/* Quick links to the sections below */
.ar-jump {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-6);
}

.ar-jump a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-5);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius-pill);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--c-ink);
    text-decoration: none;
    transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}

.ar-jump a:hover {
    border-color: var(--c-teal);
    background: var(--c-surface);
}

/* Shared section head: title and one supporting line, stacked. */
.ar-head {
    max-width: 44rem;
    margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.ar-head .h2 {
    margin-bottom: var(--space-3);
}

.ar-head p {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--c-ink-soft);
    text-wrap: pretty;
}

.ar-head--wide {
    max-width: 52rem;
}

.ar-head--wide p {
    font-size: 1.125rem;
}

/* Signs: three-column grid of tiles. */
ul.ar-signs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ar-signs li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-5);
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--c-ink);
}

.ar-signs__mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--c-sage-soft);
    color: var(--c-teal-strong);
}

.ar-signs__mark .icon {
    width: 16px;
    height: 16px;
}

/* Forms: title column on the left, accordion on the right. */
.ar-forms-block__grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: var(--space-6) clamp(2rem, 1rem + 5vw, 6rem);
    align-items: start;
}

.ar-forms-block__head .h2 {
    margin-bottom: var(--space-3);
}

.ar-forms-block__head p {
    margin-bottom: var(--space-4);
    color: var(--c-ink-soft);
}

@media (min-width: 1024px) {
    .ar-forms-block__head {
        position: sticky;
        top: calc(var(--header-h-compact) + 2rem);
    }
}

.ar-accordion {
    display: grid;
    min-width: 0;
    gap: var(--space-3);
}

.ar-acc {
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--dur) var(--ease-out);
}

.ar-acc[open] {
    box-shadow: var(--shadow);
}

.ar-acc summary {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 64px;
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius);
}

.ar-acc summary::-webkit-details-marker {
    display: none;
}

.ar-acc summary:focus-visible {
    outline-offset: -2px;
}

.ar-acc__dot {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 0 50% 0 50%;
    background: var(--tone);
}

.ar-acc--sage { --tone: var(--c-sage); }
.ar-acc--clay { --tone: var(--c-secondary); }
.ar-acc--slate { --tone: var(--c-tertiary); }

.ar-acc__name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere; /* long compound names such as "depersonalizzazione/derealizzazione" */
    hyphens: auto;
    font-family: var(--font-serif);
    font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
    font-weight: 500;
    line-height: 1.3;
    color: var(--c-ink);
}

.ar-acc__toggle {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--c-mist-soft);
    color: var(--c-teal-strong);
    transition: transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}

.ar-acc__toggle .icon {
    width: 16px;
    height: 16px;
}

.ar-acc summary:hover .ar-acc__toggle {
    background: var(--c-sage-soft);
}

.ar-acc[open] .ar-acc__toggle {
    transform: rotate(180deg);
}

.ar-acc p {
    padding: 0 var(--space-5) var(--space-5) calc(var(--space-5) + 12px + var(--space-4));
    max-width: 60ch;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--c-ink-soft);
}

/* How therapy helps: three steps as a horizontal path joined by a line. */
.ar-help .ar-head p .hl {
    color: var(--c-ink);
}

ol.ar-path {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

ol.ar-path::before {
    content: "";
    position: absolute;
    top: 52px;
    left: 12%;
    right: 12%;
    height: 2px;
    background-image: linear-gradient(90deg, var(--c-line-strong) 50%, transparent 50%);
    background-size: 12px 2px;
}

.ar-path__step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.ar-path__step .icon-chip {
    width: 56px;
    height: 56px;
    box-shadow: 0 0 0 6px var(--c-surface);
}

.ar-path__step .icon-chip .icon {
    width: 30px;
    height: 30px;
}

.ar-path__step p {
    max-width: 24ch;
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--c-ink);
}

/* ---------- When to ask for help: ink call-to-action card ---------- */
.ar-when-wrap {
    padding-block: clamp(3rem, 2rem + 3vw, 5rem);
}

.ar-when {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: var(--space-6) clamp(2rem, 1rem + 4vw, 5rem);
    align-items: center;
    padding: clamp(2rem, 1.25rem + 3vw, 4rem);
    border-radius: var(--radius-lg);
    background: var(--c-ink);
    color: var(--c-on-dark);
    overflow: hidden;
    isolation: isolate;
}

/* Logo emblem as a faint watermark, as in the contact panel. */
.ar-when::before {
    content: "";
    position: absolute;
    right: -4%;
    bottom: -18%;
    width: clamp(220px, 26vw, 380px);
    aspect-ratio: 240 / 164;
    background: url("../../images/logo/emblema-480.webp") no-repeat center / contain;
    opacity: 0.08;
    z-index: -1;
}

.ar-when .h2 {
    margin-bottom: var(--space-4);
    font-size: clamp(2rem, 1.5rem + 1.8vw, 3rem);
    color: var(--c-on-dark);
}

.ar-when .h2 em {
    color: #e8b6a5;
}

.ar-when__copy p {
    max-width: 36em;
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--c-on-dark-soft);
    text-wrap: pretty;
}

.ar-when .hl {
    color: var(--c-on-dark);
    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='%23E8B6A5' fill-opacity='.4'/%3E%3C/svg%3E");
}

.ar-when__actions {
    display: grid;
    gap: var(--space-3);
}

.ar-when :focus-visible {
    outline-color: var(--c-on-dark);
}

.ar-when__hours {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    font-size: 0.875rem;
    color: var(--c-on-dark-soft);
}

.ar-when__hours .icon {
    width: 1rem;
    height: 1rem;
}

/* Disclaimer and source close the page quietly. */
.ar-fineprint {
    display: grid;
    gap: var(--space-3);
    max-width: 52rem;
    margin-top: var(--space-6);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--c-ink-soft);
}

.ar-disclaimer {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.ar-disclaimer .icon {
    margin-top: 0.15em;
    color: var(--c-tertiary-strong);
}

.ar-source {
    padding-left: calc(1.25em + var(--space-3));
}

.ar-source span {
    font-weight: 600;
    color: var(--c-ink);
}

/* Fallback for a detail file still in the old HTML format. */
.ar-legacy {
    margin-bottom: var(--space-7);
}

.ar-legacy .callout h2 {
    margin: 0 0 var(--space-3);
    font-size: 1.1875rem;
}

.ar-legacy .ar-source {
    padding: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
    .ar-note-chip--1 {
        right: -2%;
    }

    .ar-note-chip--2 {
        left: -4%;
    }
}

/* Small laptops: a wider title column keeps the forms link on one line. */
@media (min-width: 1024px) and (max-width: 1199px) {
    .ar-forms-block__grid {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: var(--space-6) var(--space-7);
    }
}

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

    /* The composition gives way to a compact chip and an inline list of notes. */
    .ar-visual {
        justify-self: start;
        width: 100%;
        aspect-ratio: auto;
        margin: 0;
    }

    .ar-visual__art {
        display: none;
    }

    ul.ar-visual__notes {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .ar-note-chip {
        position: static;
        white-space: normal;
        padding-block: var(--space-2);
        box-shadow: var(--shadow-sm);
    }

    .ar-note-chip strong {
        display: inline;
        font-size: inherit;
    }

    .ar-note-chip .icon-chip {
        width: 38px;
        height: 38px;
    }

    .ar-note-chip .icon-chip .icon {
        width: 22px;
        height: 22px;
    }

    .ar-hero__chip {
        display: grid;
        width: 36px;
        height: 36px;
    }

    .ar-hero__chip .icon {
        width: 22px;
        height: 22px;
    }

    .ar-hero__eyebrow {
        gap: var(--space-3);
    }

    .ar-forms-block__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    ul.ar-signs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ar-when__actions {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
        align-items: center;
    }

    .ar-when__hours {
        justify-content: flex-start;
    }
}

/* Tablet: copy beside the petal composition, the two notes in a row below. */
@media (min-width: 768px) and (max-width: 1023px) {
    .ar-hero__grid {
        grid-template-columns: minmax(0, 1fr) clamp(170px, 24vw, 240px);
        grid-template-areas:
            "copy art"
            "notes notes";
        gap: var(--space-6) var(--space-6);
    }

    .ar-hero__copy {
        grid-area: copy;
    }

    .ar-visual {
        display: contents;
    }

    .ar-visual__art {
        grid-area: art;
        position: relative;
        display: block;
        inset: auto;
        width: 100%;
        aspect-ratio: 1;
    }

    .ar-visual__dot {
        width: 28px;
    }

    ul.ar-visual__notes {
        grid-area: notes;
        flex-wrap: nowrap;
    }

    .ar-note-chip {
        flex: 1 1 0;
        min-width: 0;
    }

    .ar-note-chip strong {
        display: block;
    }

    /* The chip next to the eyebrow repeats the large icon: not needed here. */
    .ar-hero__chip {
        display: none;
    }

    /* Other areas: two columns of compact rows, icon beside the text. */
    .ar-others .area {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-content: start;
        gap: var(--space-1) var(--space-4);
        padding: var(--space-5);
    }

    .ar-others .area .icon-chip {
        grid-row: 1 / span 2;
        width: 48px;
        height: 48px;
        margin: 0;
    }

    .ar-others .area .icon-chip .icon {
        width: 26px;
        height: 26px;
    }

    .ar-others .area__go {
        display: none;
    }
}

@media (max-width: 767px) {
    ul.ar-signs,
    ol.ar-path {
        grid-template-columns: minmax(0, 1fr);
    }

    ol.ar-path::before {
        display: none;
    }

    .ar-path__step {
        flex-direction: row;
        gap: var(--space-4);
        padding: var(--space-4);
        text-align: left;
        border-radius: var(--radius);
    }

    .ar-path__step .icon-chip {
        width: 48px;
        height: 48px;
        box-shadow: none;
    }

    .ar-path__step p {
        max-width: none;
    }

    .ar-lede__inner {
        text-align: left;
    }

    /* Quick links: one swipeable row bleeding to the screen edge (the cut chip hints at more). */
    .ar-jump {
        flex-wrap: nowrap;
        justify-content: flex-start;
        margin-inline: calc(var(--gutter) * -1);
        padding-inline: var(--gutter);
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scroll-padding-inline: var(--gutter);
        scrollbar-width: none;
    }

    .ar-jump::-webkit-scrollbar {
        display: none;
    }

    .ar-jump a {
        flex: none;
        padding-inline: var(--space-4);
        background: var(--c-surface);
        scroll-snap-align: start;
    }

    /* The forms link wraps like text: the arrow is redrawn glued to the last word (nbsp, no space before the icon in the markup). */
    .ar-forms-block__head .link-arrow {
        display: inline-block;
        padding-block: var(--space-2);
    }

    .ar-forms-block__head .link-arrow .icon {
        display: none;
    }

    .ar-forms-block__head .link-arrow::after {
        content: "\00a0";
        margin-left: 0.25em;
        padding-right: 1.25em;
        background: currentColor;
        -webkit-mask: var(--ar-arrow) no-repeat right center / 1.25em 1.25em;
        mask: var(--ar-arrow) no-repeat right center / 1.25em 1.25em;
        --ar-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z'/%3E%3C/svg%3E");
    }

    /* Other areas: a compact list of titles, the arrow says where to tap. */
    .ar-others .area {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        padding: var(--space-3) var(--space-4);
    }

    .ar-others .area:not(.area--invite) p {
        display: none;
    }

    .ar-others .area:not(.area--invite) > * {
        grid-row: 1;
    }

    .ar-others .area .icon-chip {
        width: 44px;
        height: 44px;
    }

    .ar-others .area .icon-chip .icon {
        width: 24px;
        height: 24px;
    }

    .ar-others .area__go {
        display: grid;
        grid-column: 3;
        grid-row: 1 / span 2;
        margin: 0;
        padding: 0;
        font-size: 0; /* text stays for screen readers, only the arrow shows */
        line-height: 0;
    }

    .ar-others .area__go .icon {
        width: 20px;
        height: 20px;
    }

    .ar-signs li {
        padding: var(--space-4);
    }

    .ar-acc summary {
        padding-inline: var(--space-4);
    }

    .ar-acc p {
        padding: 0 var(--space-4) var(--space-4);
    }

    .ar-note-chip {
        flex: 1 1 100%;
    }

    .ar-hero .hero__actions .btn,
    .ar-when__actions .btn {
        flex: 1 1 100%;
    }

    .ar-when {
        padding: var(--space-6) var(--space-5);
        border-radius: var(--radius);
    }

    .ar-when::before {
        bottom: -8%;
        width: 200px;
    }
}
