/* Shared rich-content styles: used by the editor AND the public article/case pages.
   Anything the editor produces must look the same in both places. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500&display=swap");

.at-body{--at-ink:var(--ink,#0A1033);--at-muted:var(--ink2,#6b6f84);--at-line:var(--line,#E1DDD2);--at-gold:var(--gold,#AB8B4E);
  font-family:"IBM Plex Sans Arabic","IBM Plex Sans",Tahoma,sans-serif;font-weight:300;font-size:18px;line-height:2;color:var(--at-ink)}
.at-body[lang="en"]{font-family:"IBM Plex Sans","IBM Plex Sans Arabic",Arial,sans-serif;line-height:1.75}
.at-body > *:first-child{margin-top:0}
.at-body p{margin:0 0 1.1em}
.at-body h2,.at-body h3,.at-body h4{font-weight:400;line-height:1.45;margin:1.8em 0 .6em;letter-spacing:0}
.at-body h2{font-size:1.65em}
.at-body h3{font-size:1.3em}
.at-body h4{font-size:1.08em;font-weight:500}
.at-body strong,.at-body b{font-weight:500}
.at-body em{font-style:italic}
.at-body a{color:inherit;text-decoration:underline;text-decoration-color:var(--at-gold);text-underline-offset:4px;text-decoration-thickness:1px}
.at-body blockquote{margin:1.6em 0;padding-inline-start:22px;border-inline-start:2px solid var(--at-gold);font-size:1.25em;line-height:1.7}
.at-body blockquote p:last-child{margin-bottom:0}
.at-body ul,.at-body ol{margin:0 0 1.2em;padding-inline-start:1.4em}
.at-body li{margin:.25em 0}
.at-body li p{margin:0}
.at-body hr{border:0;border-top:1px solid var(--at-line);margin:2.2em 0}

/* Direction: blocks inherit the article direction (Arabic = RTL). Only blocks the author marks LTR/RTL change.
   Latin words, numbers and formulas inside Arabic are isolated (.ltr-run) so they keep their typed order. */
.at-body{text-align:start}
.at-body [dir="rtl"]{direction:rtl;text-align:right}
.at-body [dir="ltr"]{direction:ltr;text-align:left}
/* Justified paragraphs: plain line breaking (the "pretty" algorithm is not applied with justify in every browser) */
.at-body p[style*="justify"]{text-wrap:wrap;text-justify:inter-word}
.ltr-run,.at-body .ltr-run{direction:ltr;unicode-bidi:embed;unicode-bidi:-webkit-isolate;unicode-bidi:isolate}
/* Older Safari (macOS 12) ignores the unprefixed "isolate" value: the lines above fall back to -webkit-isolate,
   then to embed. The public pages also add invisible LTR embedding marks around each run (content.js). */

/* ---------- single image ---------- */
.at-figure{margin:2em 0}
.at-figure img{display:block;width:100%;height:auto;border-radius:14px}
.at-figure[data-size="full"]{width:min(100vw - 32px, 1200px);position:relative;inset-inline-start:50%;transform:translateX(50%)}
[dir="ltr"] .at-figure[data-size="full"],.at-body[lang="en"] .at-figure[data-size="full"]{transform:translateX(-50%)}
.at-figure[data-size="half"]{width:min(50%,420px);float:inline-start;margin-inline-end:26px;margin-top:.4em}
.at-figure figcaption,.at-gallery figcaption{margin-top:8px;font-size:13px;line-height:1.7;color:var(--at-muted);text-align:center}
.at-figure a{display:block}

/* ---------- galleries ---------- */
.at-gallery{margin:2.2em 0;--cols:3;--gap:10px}
/* albums follow the article direction explicitly (Safari): first image on the right in Arabic */
.at-body:not([lang="en"]) .at-gallery,[dir="rtl"] .at-gallery{direction:rtl}
.at-body[lang="en"] .at-gallery{direction:ltr}
.at-gallery figure{margin:0;min-width:0}
.at-gallery img{display:block;width:100%;height:auto;border-radius:12px}
.at-gallery.at-grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:var(--gap);align-items:start}
.at-gallery.at-masonry{column-count:var(--cols);column-gap:var(--gap)}
.at-gallery.at-masonry figure{break-inside:avoid;margin-bottom:var(--gap);display:block}
/* JS masonry (content.js / editor): real columns, so images can never overlap in any browser */
.at-gallery.at-masonry.is-ready{column-count:auto;display:flex;gap:var(--gap);align-items:flex-start}
.at-gallery.at-masonry.is-ready .at-col{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:var(--gap)}
.at-gallery.at-masonry.is-ready figure{margin:0}
.at-gallery.at-feature{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:var(--gap);align-items:start}
.at-gallery.at-feature figure:first-child{grid-column:1/-1}
/* Grid and the small Feature tiles share one crop so rows line up; Masonry keeps each image's own ratio */
.at-body .at-gallery.at-grid img,.at-gallery.at-grid .ed-item img,
.at-body .at-gallery.at-feature figure:not(:first-child) img,.at-gallery.at-feature .ed-item:not(:first-child) img{width:100%;height:auto;aspect-ratio:4/3;object-fit:cover}

/* Slider: full-bleed, height = the shortest image at full width; each image keeps its own vertical crop */
.at-gallery.at-slider{position:relative;overflow:hidden;border-radius:14px;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.at-gallery.at-slider .at-track{display:flex;transition:transform .55s cubic-bezier(.22,.61,.36,1);height:var(--h,56vw);max-height:78vh}
.at-gallery.at-slider figure{flex:0 0 100%;height:100%;position:relative}
.at-gallery.at-slider img{width:100%;height:100%;object-fit:cover;border-radius:0}
.at-gallery.at-slider figcaption{position:absolute;inset-inline:0;bottom:0;margin:0;padding:28px 18px 12px;color:#fff;text-align:start;background:linear-gradient(to top,rgba(5,8,28,.55),transparent)}
.at-slider .at-nav{position:absolute;top:50%;transform:translateY(-50%);width:46px;height:46px;border-radius:50%;border:0;background:rgba(246,244,238,.9);color:#0A1033;cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .25s;z-index:2}
.at-slider:hover .at-nav,.at-slider:focus-within .at-nav{opacity:1}
.at-slider .at-nav svg{width:18px;height:18px}
.at-slider .at-prev{inset-inline-start:14px}
.at-slider .at-next{inset-inline-end:14px}
.at-slider .at-dots{position:absolute;bottom:12px;inset-inline-end:16px;display:flex;gap:6px;z-index:2}
.at-slider .at-dots button{width:7px;height:7px;border-radius:50%;border:0;padding:0;background:rgba(255,255,255,.5);cursor:pointer}
.at-slider .at-dots button[aria-current="true"]{background:#fff;width:20px;border-radius:4px}
/* Before JS enhancement (or without JS) the slider degrades to a horizontal scroll strip */
.at-gallery.at-slider:not(.is-ready) .at-track{overflow-x:auto;scroll-snap-type:x mandatory}
.at-gallery.at-slider:not(.is-ready) figure{scroll-snap-align:start}

@media (max-width:700px){
  .at-body{font-size:17px;line-height:1.95}
  .at-gallery.at-grid,.at-gallery.at-feature{--cols:2 !important}
  .at-gallery.at-masonry{column-count:2}
  .at-figure[data-size="half"]{float:none;width:100%;margin-inline:0}
  .at-slider .at-nav{opacity:.85;width:38px;height:38px}
}
@media (prefers-reduced-motion:reduce){.at-gallery.at-slider .at-track{transition:none}}
