/* ─────────────────────────────────────────────────────────────
   Accordion
   Icon and name collapsed, description on click. Written against
   .jm-accordion rather than a page-specific class so the home page
   can use exactly the same component.
   ───────────────────────────────────────────────────────────── */

.jm-about-services {
    padding: clamp(46px, 6vw, 88px) 0 clamp(56px, 8vw, 110px);
    background: var(--bg-white);
}

.jm-about-services__label {
    margin: 0 0 clamp(22px, 3vw, 38px);
    color: var(--text-light);
}

.jm-accordion {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border-light);
}

.jm-accordion__item {
    border-bottom: 1px solid var(--border-light);
}

/* ─── The row ──────────────────────────────────────────────── */

.jm-accordion__summary {
    /* Both are needed: Safari draws the marker through a pseudo-element,
       everything else through list-style. */
    list-style: none;
    cursor: pointer;
    /* The theme strips focus outlines from interactive elements; a summary
       is focusable, so it needs its ring put back below. */
    outline: none;
}

.jm-accordion__summary::-webkit-details-marker { display: none; }
.jm-accordion__summary::marker { content: ""; }

.jm-accordion__heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(14px, 2.2vw, 24px);
    margin: 0;
    padding: clamp(20px, 2.4vw, 30px) 0;
    color: var(--text-primary);
    letter-spacing: normal;
    transition: color 0.3s var(--ease);
}

.jm-accordion__icon {
    display: block;
    color: var(--primary);
    transition: color 0.3s var(--ease);
}

.jm-accordion__icon svg {
    display: block;
    width: clamp(26px, 2.8vw, 32px);
    height: auto;
}

.jm-accordion__title {
    font-size: clamp(1.0625rem, 0.96rem + 0.55vw, 1.375rem);
    font-weight: 400;
    line-height: 1.34;
    letter-spacing: 0.01em;
    text-wrap: pretty;
}

/* ─── The open/close sign ──────────────────────────────────────
   A plus that folds into a minus. Drawn from two rules rather than
   set as a glyph so it stays a hairline at any size and matches the
   rest of the page's line work. */
.jm-accordion__sign {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
}

.jm-accordion__sign::before,
.jm-accordion__sign::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--text-secondary);
    transition: transform 0.4s var(--ease), background-color 0.3s var(--ease);
}

.jm-accordion__sign::after { transform: rotate(90deg); }

/* Open. While the script is animating a panel shut it keeps `open` on the
   element, so the second rule flips the sign back the moment the close
   starts rather than when it finishes. */
.jm-accordion__details[open] .jm-accordion__sign::after { transform: rotate(0deg); }

.jm-accordion.is-animated .jm-accordion__details:not(.is-open) .jm-accordion__sign::after {
    transform: rotate(90deg);
}

.jm-accordion__details[open] .jm-accordion__heading { color: var(--primary-dark); }
.jm-accordion__details[open] .jm-accordion__sign::before,
.jm-accordion__details[open] .jm-accordion__sign::after { background: var(--primary); }

@media (hover: hover) and (pointer: fine) {
    .jm-accordion__summary:hover .jm-accordion__heading { color: var(--primary); }
    .jm-accordion__summary:hover .jm-accordion__icon { color: var(--accent); }
}

.jm-accordion__summary:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 3px !important;
}

/* ─── The panel ────────────────────────────────────────────────
   Default is plain block flow, which is what <details> does on its own
   and what a visitor without JavaScript gets. The script adds
   .is-animated to the list, and only then does the panel become a grid
   that eases between 0fr and 1fr — animating to the content's real
   height, with no max-height guess to clip long copy or to ease against
   a height the text never reaches. */
.jm-accordion.is-animated .jm-accordion__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.45s var(--ease);
}

.jm-accordion.is-animated .jm-accordion__details.is-open .jm-accordion__panel {
    grid-template-rows: 1fr;
}

.jm-accordion.is-animated .jm-accordion__panel-inner {
    overflow: hidden;
}

.jm-accordion__text {
    margin: 0;
    padding: 0 0 clamp(22px, 2.6vw, 32px);
    max-width: 68ch;
    color: var(--text-secondary);
    line-height: 1.8;
}

.jm-accordion.is-animated .jm-accordion__text {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.jm-accordion.is-animated .jm-accordion__details.is-open .jm-accordion__text {
    opacity: 1;
    transform: none;
    transition-delay: 0.12s;
}

/* Indent the copy to the title's margin so it reads as belonging to the
   row above rather than starting a new column. */
@media (min-width: 700px) {
    .jm-accordion__text {
        padding-left: calc(clamp(26px, 2.8vw, 32px) + clamp(14px, 2.2vw, 24px));
    }
}
