/* @author Salama Malek
 * Feature Accordion widget — a left-hand accordion (one item open at a time) paired
 * with a large photo panel on the right that swaps to match the open item. Editable
 * via the SiteOrigin form; the icon box colour is chosen from a fixed palette and
 * the right-side photo is uploaded. Scoped to .nm-facc so it is self-contained.
 */
.nm-facc{
  --fa-ink:var(--gray-950,#121212);   /* --black does not exist; this fell back silently */
  --fa-text:var(--gray-900,#333333);
  --fa-muted:var(--gray-500,#6D6D6D);
  --fa-faint:var(--gray-400,#A8A8A8);
  --fa-line:var(--gray-200,#E6E6E6);
  --fa-surface:var(--gray-100,#F3F3F3);              /* head fill, per design */
  --fa-soft:var(--gray-50,#FAFAFA);
  --fa-disp:var(--font-display,system-ui,sans-serif);
  --fa-body:var(--font-body,system-ui,sans-serif);
  --fa-ease:cubic-bezier(.4,0,.2,1);
  --acc:var(--teal-700,#1D6668);                     /* per-item, set inline from the colour select */
  color:var(--fa-text);font-family:var(--fa-body);
}
.nm-facc *,.nm-facc *::before,.nm-facc *::after{box-sizing:border-box}
.nm-facc__wrap{width:min(1440px,100%);margin-inline:auto}

/* two-column: accordion left, photo right, 100px gap (clamps down when tight) */
/* stretch, not center: the accordion column takes the full height of the photo
   next to it so the two sides start and end level. */
/* The photo track is sized before the 1fr track gets anything, so with a plain
   minmax(0,1fr) the accordion column was whatever happened to be left over: at
   1024px that was ~180px, which clipped the titles into "Sc" / "Tr" and wrapped
   the description one word per line. The 360px minimum means the photo gives way
   first (it shrinks on its own ratio) instead of the text being crushed.
   The gap is capped at 5vw for the same reason: 8vw was taking 80px+ out of the
   very widths that were already too tight. */
.nm-facc__grid{display:grid;grid-template-columns:minmax(360px,1fr) minmax(0,746px);column-gap:clamp(24px,5vw,100px);row-gap:24px;align-items:stretch}

/* ---- accordion list ---- */
/* rows pinned to the top, 24px apart (agreed with design 2026-09-17; this replaced
   space-between, which spread the leftover column height between the rows). */
.nm-facc__list{display:flex;flex-direction:column;gap:24px;min-width:0}
.nm-facc__item{border-radius:20px}
.nm-facc__title-wrap{margin:0;font:inherit;color:inherit}
/* Borderless by design: the fill defines the shape. The 1px transparent border
   that used to sit here is gone - it existed so the body's 21px indent (measured
   from padding 20 + border 1) would not shift, and that indent is now 4px per
   the design. Keeping it would also have made the head 62px tall against a 60px
   spec, because auto height adds both edges. */
.nm-facc__head{width:100%;display:flex;align-items:center;gap:22px;background:var(--fa-surface);border:0;border-radius:22px;padding:16px 20px;cursor:pointer;text-align:left}
.nm-facc__head:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
/* The open item draws no border at all. It is already identified by its
   revealed body and by the photo panel swapping to match. */
.nm-facc__title{flex:1;min-width:0;font:600 20px/28px var(--fa-disp);color:var(--fa-ink);letter-spacing:-.01em}
/* White, not --fa-soft: the head is now #F3F3F3, and the near-white token would
   have all but disappeared into it. --fa-soft is left alone because the photo
   panel also uses it. */
/* 28px, not 32: the spec's head is 60px and its inner row 28px, and this
   control is the tallest thing in that row - the slot stays reserved even
   while hidden, so a 32px one silently made every head 64px. */
.nm-facc__plus{flex:0 0 auto;position:relative;width:28px;height:28px;border-radius:50%;background:var(--base-white,#fff);transition:background .25s var(--fa-ease),transform .4s var(--fa-ease)}
.nm-facc__plus::before,.nm-facc__plus::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:2px;border-radius:2px;background:var(--fa-muted);transform:translate(-50%,-50%);transition:transform .3s var(--fa-ease),background .25s var(--fa-ease)}
.nm-facc__plus::after{transform:translate(-50%,-50%) rotate(90deg)}
/* hover on a collapsed item: fill the plus with the accent + spin (like the original) */
.nm-facc__item:not(.is-active) .nm-facc__head:hover .nm-facc__plus{background:var(--acc);transform:rotate(180deg)}
.nm-facc__item:not(.is-active) .nm-facc__head:hover .nm-facc__plus::before,
.nm-facc__item:not(.is-active) .nm-facc__head:hover .nm-facc__plus::after{background:var(--base-white,#fff)}
/* Open item: the control is not drawn at all. It used to collapse to a "-", which
   reads as "click to close" - but this accordion always keeps exactly one item
   open so the photo panel next to it has something to show, so that click did
   nothing and the promise was false. With nothing there, nothing invites a close.
   visibility, not display: the 32px slot stays reserved so the title does not
   shift sideways as items open and close. */
.nm-facc__item.is-active .nm-facc__plus{visibility:hidden}

/* expanded body: animated open via grid-template-rows (0fr -> 1fr), content rises in.
   Left edge aligns with the icon (21px = head padding 20 + 1px border). */
.nm-facc__body{display:grid;grid-template-rows:0fr;transition:grid-template-rows .38s var(--fa-ease)}
.nm-facc__item.is-active .nm-facc__body{grid-template-rows:1fr}
.nm-facc__body-inner{overflow:hidden;min-height:0;opacity:0;transform:translateY(8px);transition:opacity .3s var(--fa-ease) .04s,transform .34s var(--fa-ease) .04s;display:flex;flex-direction:column;gap:12px;padding:0 4px}
.nm-facc__item.is-active .nm-facc__body-inner{opacity:1;transform:none;padding-top:20px;padding-bottom:8px}
.nm-facc__h{margin:0;font:600 20px/26px var(--fa-disp);color:var(--fa-ink);letter-spacing:-.01em}
/* Hard cap at three lines so the body block keeps a predictable height and the
   layout stops depending on how much an editor types. The photo panel next to
   it is a fixed 520px, so a long description used to be the one thing that
   could push the two columns out of step. Anything longer is ellipsised - see
   the editor note in the widget description. */
.nm-facc__desc{margin:0;font:500 16px/24px var(--fa-body);color:var(--fa-ink);max-width:46ch;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden}
/* Russian needs a fourth line. The same copy runs longer in RU, and the live
   page was clipping two human-written descriptions mid-sentence - a cap meant
   to protect the layout must never eat content. One extra line adds 24px to an
   item, which the column absorbs; silently truncating translated copy does not.
   If the content team shortens those two strings, this can go back to 3. */
.nm-facc:lang(ru) .nm-facc__desc,
html[lang^="ru"] .nm-facc__desc{-webkit-line-clamp:4;line-clamp:4}
.nm-facc__pills{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:8px}
.nm-facc__pill{display:inline-flex;align-items:center;font:600 14px/20px var(--fa-body);color:var(--base-white,#fff);background:var(--acc);border-radius:8px;padding:8px 16px}

/* ---- right-side photo panel: 746x520, 40px radius, 1px border ---- */
/* align-self:start matters now the grid stretches: without it the photo would be
   pulled to the row height and its 746/520 ratio would be overridden whenever an
   open item makes the accordion column the taller of the two. */
.nm-facc__panel{position:relative;width:100%;max-width:746px;aspect-ratio:746/520;border-radius:40px;border:1px solid var(--fa-line);overflow:hidden;background:var(--fa-soft);justify-self:end;align-self:start}
.nm-facc__illu{position:absolute;inset:0;opacity:0;visibility:hidden;transform:scale(1.04);transition:opacity .45s var(--fa-ease),transform .6s var(--fa-ease),visibility 0s .45s}
.nm-facc__illu.is-active{opacity:1;visibility:visible;transform:none;transition:opacity .45s var(--fa-ease),transform .6s var(--fa-ease),visibility 0s}
.nm-facc__illu img{width:100%;height:100%;object-fit:cover;display:block}
.nm-facc__illu-ph{width:100%;height:100%;display:grid;place-items:center;color:var(--fa-faint);font:700 14px/1.3 var(--fa-body);text-align:center;padding:24px}

/* ---- responsive ---- */
/* Stacks at 1200, not 980. Side by side needs the 746px photo plus a readable
   text column plus the gap, which is about 1200px of room; below that the two
   columns were still being rendered and one of them had to lose. Covers the
   1024px tablet landscape case where this broke. */
@media (max-width:1200px){
  .nm-facc__grid{grid-template-columns:1fr;row-gap:18px}
  /* Keeps its 746px design width and centres, rather than stretching: stacked at
     1200px a full-width panel would render about 1200x965 and push the accordion
     off the first screen. Still fills the width on phones, where 100% < 746. */
  .nm-facc__panel{order:-1;justify-self:center;max-width:746px}
}
@media (max-width:520px){
  .nm-facc__head{padding:14px;gap:12px}
  /* No size override on phones any more: the icons are 44x44 artwork, so
     shrinking the tile to 42 would crop 2px off them. Only the corner softens. */
  .nm-facc__title{font-size:17px}
  .nm-facc__body-inner{padding-left:15px;padding-right:2px}
  .nm-facc__panel{border-radius:28px}
}
@media (prefers-reduced-motion:reduce){
  .nm-facc__body,.nm-facc__body-inner,.nm-facc__plus,.nm-facc__plus::before,.nm-facc__plus::after,.nm-facc__illu{transition:none}
}
