/* =====================================================================
   Dr. Abdullah Albaqly — formal, bilingual.
   Every pair of lines is mirrored around the page's centre: Arabic on the right, English on the left.
   Colours come from the palette (set inline by __applyLook); fonts, corners and scale from [data-design].
   ===================================================================== */
:root {
  --ground: #F6F4EF; --surface: #ECE8DF; --ink: #14213D; --deep: #14213D; --accent: #B08D57; --on-deep: #F6F4EF;
  --muted: color-mix(in srgb, var(--ink) 64%, var(--ground));
  --rule: color-mix(in srgb, var(--ink) 14%, var(--ground));
  --m: clamp(16px, 4vw, 72px);
  --gap: clamp(24px, 4vw, 80px);
  --ease: cubic-bezier(.22, 1, .36, 1);

  /* design defaults = classic */
  --f-ar: "Noto Naskh Arabic", "Traditional Arabic", serif;
  --f-ar-h: "Noto Naskh Arabic", serif;
  --f-en: "Cormorant Garamond", Georgia, serif;
  --f-en-h: "Cormorant Garamond", Georgia, serif;
  --en-scale: 1.12;           /* Cormorant runs small; scale English to match the Arabic */
  --w-h: 700;
  --r: 14px;                  /* one corner radius for the whole site */
  --h1: clamp(36px, 4.4vw, 68px);
  --h2: clamp(28px, 3vw, 46px);
  --pill: 14px;
}
[data-design="modern"] {
  --f-ar: "IBM Plex Sans Arabic", "Segoe UI", sans-serif; --f-ar-h: var(--f-ar);
  --f-en: "IBM Plex Sans", "Segoe UI", sans-serif; --f-en-h: var(--f-en);
  --en-scale: .94; --w-h: 600; --r: 14px; --pill: 999px;
}
[data-design="soft"] {
  --f-ar: "Tajawal", "Segoe UI", sans-serif; --f-ar-h: var(--f-ar);
  --f-en: "Manrope", "Segoe UI", sans-serif; --f-en-h: var(--f-en);
  --en-scale: .92; --w-h: 700; --r: 30px; --pill: 999px;
}
[data-design="editorial"] {
  --f-ar: "IBM Plex Sans Arabic", sans-serif; --f-ar-h: "Noto Naskh Arabic", serif;
  --f-en: "IBM Plex Sans", sans-serif; --f-en-h: "Playfair Display", Georgia, serif;
  --en-scale: .9; --w-h: 700; --r: 0px; --pill: 0px;
  --h1: clamp(44px, 6.4vw, 104px); --h2: clamp(34px, 4.6vw, 72px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-ar); font-size: 18px; line-height: 1.85; font-weight: 400;
  overflow-x: clip; -webkit-font-smoothing: antialiased;
  transition: background-color .4s, color .4s;
}
[lang="en"] { font-family: var(--f-en); }
.en { font-size: calc(1em * var(--en-scale)); }
img { display: block; max-width: 100%; height: auto; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--ground); }
.skip { position: absolute; inset-inline-start: var(--m); top: -60px; z-index: 60; background: var(--ink); color: var(--ground); padding: 10px 16px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ============ The bilingual pair ============ */
.bi { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--gap); align-items: baseline; }
.bi .ar { text-align: right; }
.bi .en { text-align: left; direction: ltr; }
/* short lines mirror toward the centre axis */
.bi--name .ar, .bi--role .ar, .bi--title .ar, .bi--sub .ar, .bi--place .ar, .bi--mini .ar { text-align: left; }
.bi--name .en, .bi--role .en, .bi--title .en, .bi--sub .en, .bi--place .en, .bi--mini .en { text-align: right; }
.bi--name, .bi--title { position: relative; }
.bi--name::after, .bi--title::after {           /* the centre axis */
  content: ""; position: absolute; left: 50%; top: 12%; bottom: 12%; width: 2px; margin-left: -1px; background: var(--accent);
}
h1, h2, h3 { font-weight: var(--w-h); line-height: 1.25; text-wrap: balance; }
h1.ar, h2.ar, h3.ar, .ar h1, .ar h2 { font-family: var(--f-ar-h); }
h1.en, h2.en, h3.en, p.en.h { font-family: var(--f-en-h); }

/* ============ Bar ============ */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  padding: 14px var(--m); background: color-mix(in srgb, var(--ground) 94%, transparent);
  transition: background-color .4s;
}
.bar__ar { justify-self: start; font-family: var(--f-ar-h); font-weight: var(--w-h); font-size: 19px; text-decoration: none; }
.bar__en { justify-self: end; font-family: var(--f-en-h); font-weight: 600; font-size: calc(19px * var(--en-scale)); text-decoration: none; }
.bar__links { display: flex; gap: clamp(14px, 2.4vw, 36px); font-size: 16px; }
.bar__links a { text-decoration: none; display: grid; justify-items: center; line-height: 1.3; color: var(--muted); transition: color .25s; }
.bar__links a span { font-size: 13px; letter-spacing: .02em; }
.bar__links a:hover { color: var(--ink); }

/* ============ Cover ============ */
.hero { padding: clamp(48px, 8vh, 96px) var(--m) 0; display: grid; justify-items: stretch; }
.mark { justify-self: center; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--deep); margin-bottom: clamp(28px, 4vh, 44px); }
[data-design="classic"] .mark, [data-design="editorial"] .mark { border-radius: 0; transform: rotate(45deg); width: 64px; height: 64px; }
[data-design="classic"] .mark svg, [data-design="editorial"] .mark svg { transform: rotate(-45deg); }
.mark svg { width: 30px; fill: var(--accent); }
.bi--name h1, .bi--name p { font-size: var(--h1); font-weight: var(--w-h); line-height: 1.15; }
.bi--name .en { font-family: var(--f-en-h); font-size: calc(var(--h1) * var(--en-scale) * .8); }
.bi--role { margin-top: 18px; color: var(--accent); font-size: clamp(18px, 1.5vw, 22px); font-weight: 500; }
.bi--role .en { font-size: calc(clamp(18px, 1.5vw, 22px) * var(--en-scale)); }
.bi--intro { margin-top: 26px; color: var(--muted); }
.bi--intro .ar { text-align: justify; text-align-last: left; } .bi--intro .en { text-align: justify; text-align-last: right; }   /* two short paragraphs facing each other */
.bi--intro p { max-width: 44ch; }
.bi--intro .ar { justify-self: end; } .bi--intro .en { justify-self: start; }
/* contact items: an icon in a filled badge, then the value */
.ci { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; }
.ci__icon {
  flex-shrink: 0; width: 1.9em; height: 1.9em; display: grid; place-items: center;
  border-radius: var(--pill); background: var(--deep); transition: background-color .3s, transform .2s var(--ease);
}
.ci__icon svg { width: 52%; height: 52%; fill: var(--accent); }
[data-design="classic"] .ci__icon, [data-design="editorial"] .ci__icon { border-radius: 50%; }
.ci__text { border-bottom: 1px solid transparent; transition: border-color .3s; overflow-wrap: anywhere; }
.ci:hover .ci__text { border-color: var(--accent); }
.ci:hover .ci__icon { background: var(--accent); }
.ci:hover .ci__icon svg { fill: var(--ground); }
.ci:active .ci__icon { transform: scale(.94); }
.hero__contact { margin-top: 34px; justify-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px clamp(28px, 4vw, 64px); }
.hero__contact .ci { font-size: calc(clamp(22px, 2vw, 30px) * var(--en-scale)); font-weight: 500; }
.hero__photo { margin-top: clamp(40px, 6vh, 64px); }
.hero__photo img { width: 100%; height: clamp(260px, 46vh, 520px); object-fit: cover; border-radius: var(--r); }

.stats { margin-top: -1px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--deep); color: var(--on-deep); border-radius: 0 0 var(--r) var(--r); transition: background-color .4s; }
.stats li { padding: clamp(20px, 3vw, 34px) 12px; display: grid; justify-items: center; text-align: center; gap: 2px; }
.stats b { font-family: var(--f-en-h); font-size: clamp(36px, 4vw, 60px); font-weight: 600; line-height: 1; color: var(--accent); font-variant-numeric: lining-nums tabular-nums; }
.stats .ar { font-size: 16px; }
.stats .en { font-size: calc(14px * var(--en-scale)); opacity: .75; }

/* ============ Blocks ============ */
.block { padding: clamp(100px, 14vh, 170px) var(--m) 0; }
.block--field { margin-top: clamp(100px, 14vh, 170px); padding-bottom: clamp(90px, 12vh, 150px); background: var(--deep); color: var(--on-deep); transition: background-color .4s, color .4s; }
.bi--title h2 { font-size: var(--h2); }
.bi--title .en { font-size: calc(var(--h2) * var(--en-scale)); }
.bi--sub { margin-top: 10px; color: var(--muted); }
.block--field .bi--sub { color: inherit; opacity: .75; }

/* ============ Portrait + gallery ============ */
/* the cut-out portrait stands in an arch of the surface colour; his shoulders sit on the arch's base */
/* the cut-out portrait stands straight on the page: no frame, no backdrop; a short fade settles the coat into the page */
.portrait { justify-self: center; width: clamp(220px, 20vw, 290px); margin: 0 0 clamp(20px, 3vh, 32px); position: relative; }
/* the photo is whole (nothing cut); its pure-white backdrop melts into the page colour */
.portrait img { width: 100%; height: auto; display: block; mix-blend-mode: multiply; }
[data-palette="night"] .portrait img { mix-blend-mode: normal; border-radius: var(--r); }
.stats { margin-top: clamp(44px, 7vh, 72px); border-radius: var(--r); }
.gallery { margin-top: clamp(40px, 6vh, 64px); display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.gallery img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r); filter: saturate(.92); transition: filter .4s, transform .5s var(--ease); }
.gallery li:hover img { filter: none; transform: scale(1.02); }

/* ============ Cases ============ */
.specs { margin-top: 26px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.specs a { display: grid; justify-items: center; line-height: 1.35; padding: 10px 22px; border-radius: var(--pill); background: var(--surface); text-decoration: none; font-size: 17px; transition: background-color .25s, color .25s; }
.specs a span { font-size: 13px; color: var(--muted); }
.specs a:hover { background: var(--deep); color: var(--on-deep); }
.specs a:hover span { color: inherit; opacity: .75; }
.group { margin-top: clamp(64px, 9vh, 110px); }
.bi--group h3 { font-size: clamp(24px, 2.4vw, 36px); }
.bi--group .en { font-size: calc(clamp(24px, 2.4vw, 36px) * var(--en-scale)); }
/* each case section is its own full-width band with its own background */
.group.band { margin: 0 calc(-1 * var(--m)); padding: clamp(64px, 10vh, 120px) var(--m); transition: background-color .4s, color .4s; }
.group.band:first-child { margin-top: clamp(36px, 6vh, 60px); }
.band--0 { background: var(--surface); }
.band--1 { background: color-mix(in srgb, var(--accent) 16%, var(--ground)); }
.band--2 { background: var(--deep); color: var(--on-deep); }
.band--3 { background: color-mix(in srgb, var(--ink) 5%, var(--ground)); }
.band--4 { background: color-mix(in srgb, var(--deep) 14%, var(--ground)); }
.band .case { background: var(--ground); }
.band--2 .case { background: color-mix(in srgb, var(--on-deep) 8%, var(--deep)); color: var(--on-deep); }
.band--2 .bi--title .en, .band--2 .bi--title .ar { color: var(--on-deep); }
.band--2 .pair__view, .band--2 .pair__view span { color: var(--on-deep); opacity: .8; }
.gallery-row { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 18px); max-width: calc(var(--n, 2) * 380px); margin-inline: auto; width: 100%; }
.gallery-row .shot__frame { aspect-ratio: var(--ar); }
.bi--note { margin-top: 4px; font-size: 16px; color: var(--muted); }
.bi--note .ar { text-align: right; } .bi--note .en { text-align: left; }
.band--2 .bi--note { color: var(--on-deep); opacity: .8; }

/* cases: static pairs and stage rows — every photo visible at once */
.cases { margin-top: 28px; display: grid; gap: clamp(36px, 5vh, 56px); max-width: 1180px; margin-inline: auto; }
.group--endo .cases { grid-template-columns: 1fr 1fr; column-gap: clamp(20px, 3vw, 44px); }
.group--endo .case--stages { grid-column: 1 / -1; }
.case { padding: clamp(18px, 2.4vw, 30px); background: var(--surface); border-radius: var(--r); display: grid; gap: 16px; transition: background-color .4s; }
.case .bi--mini h4 { font-size: clamp(19px, 1.6vw, 25px); font-weight: var(--w-h); }
.case .bi--mini h4.ar { font-family: var(--f-ar-h); }
.case .bi--mini .en { font-family: var(--f-en-h); font-size: calc(clamp(19px, 1.6vw, 25px) * var(--en-scale)); }
.pair { display: grid; gap: 8px; }
.pair + .pair { margin-top: 10px; }
.pair__view { justify-self: center; font-size: 15px; color: var(--muted); }
.pair__view span { font-size: 13px; margin-inline-start: 4px; }
.pair__row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1vw, 14px); }   /* RTL: before (first) sits on the right */
.shot { display: grid; gap: 8px; margin: 0; }
.shot__frame { aspect-ratio: var(--ar, 4 / 3); background: #111; border-radius: calc(var(--r) * .7); overflow: hidden; display: grid; place-items: center; }
.shot__frame { position: relative; }
.shot__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }   /* the photo always fits inside its frame: shown whole, never cropped */
.shot__tag { justify-self: center; padding: 2px 14px; border-radius: var(--pill); font-size: 15px; line-height: 1.7; background: var(--ground); }
.shot__tag span { font-size: 13px; color: var(--muted); margin-inline-start: 4px; }
.shot--after .shot__tag { background: var(--deep); color: var(--on-deep); }
.shot--after .shot__tag span { color: inherit; opacity: .75; }
/* stages: up to 3 per row, read right to left in order; the last one is the final result */
.stages { display: grid; grid-template-columns: repeat(min(var(--n, 3), 3), 1fr); align-items: start; gap: clamp(10px, 1.4vw, 18px); }
.stages .step-arrow { display: none; }
.stage .shot__frame { aspect-ratio: var(--sar, 4 / 5); }
.stage:last-child .shot__frame { box-shadow: 0 0 0 3px var(--accent); }
.pair + .pair, .stages + .pair { margin-top: 10px; }
.stage:last-child .shot__tag { background: var(--deep); color: var(--on-deep); }
.stage:last-child .shot__tag span { color: inherit; opacity: .75; }
.step-arrow { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--ground); margin-bottom: 34px; }
.step-arrow svg { width: 18px; height: 18px; }

.ba { --pos: 50%; position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r); background: #111; direction: ltr; touch-action: pan-y; }
.group--endo .ba { aspect-ratio: 4 / 5; }
.group--prosth .ba { aspect-ratio: 16 / 8; }
.ba__layer { position: absolute; inset: 0; }
.ba__layer img { width: 100%; height: 100%; object-fit: contain; }   /* his clinical photos are shown whole, never cropped */
.ba__after { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }   /* after on the left, before on the right */
.ba__ph { height: 100%; display: grid; place-content: center; text-align: center; gap: 4px; padding: 20px 52% 20px 24px; background: color-mix(in srgb, var(--accent) 18%, var(--ground)); color: var(--ink); font-size: 15px; line-height: 1.5; }
.ba__ph b { font-size: 18px; }
.ba__tag { position: absolute; top: 14px; z-index: 2; padding: 3px 14px; border-radius: var(--pill); font-size: 14px; line-height: 1.6; background: var(--ground); color: var(--ink); }
.ba__tag--before { right: 14px; }
.ba__tag--after { left: 14px; background: var(--deep); color: var(--on-deep); }
.ba__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--ground); pointer-events: none; }
.ba__knob {
  position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; background: var(--ground); color: var(--ink); display: grid; place-items: center;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); transition: transform .2s var(--ease);
}
[data-design="classic"] .ba__knob, [data-design="editorial"] .ba__knob { border-radius: 0; transform: rotate(45deg); }
[data-design="classic"] .ba__knob svg, [data-design="editorial"] .ba__knob svg { transform: rotate(-45deg); }
.ba__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.ba__range:focus-visible ~ .ba__line .ba__knob { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ============ About ============ */
.about { margin-top: clamp(36px, 6vh, 60px); display: grid; grid-template-columns: 1fr minmax(220px, .7fr) 1fr; gap: var(--gap); align-items: center; }
.about .ar { text-align: right; }
.about .en { text-align: left; }
.about__photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r); }
.about { direction: rtl; }

/* ============ CV tables: Arabic right · date centre · English left ============ */
.cv + .cv { margin-top: clamp(70px, 10vh, 120px); }
.cv .bi--title h2 { font-size: clamp(24px, 2.4vw, 36px); }
.cv .bi--title .en { font-size: calc(clamp(24px, 2.4vw, 36px) * var(--en-scale)); }
.rows { margin-top: 22px; }
.row { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(14px, 2.4vw, 40px); align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); transition: background-color .25s; }
.row:first-child { border-top: 2px solid var(--accent); }
.row:hover { background: var(--surface); }
.row .ar { text-align: right; padding-inline-start: 8px; }
.row .en { text-align: left; direction: ltr; padding-inline-end: 8px; }
.row .d { justify-self: center; min-width: 9.5em; text-align: center; padding: 2px 12px; border-radius: var(--pill); background: var(--surface); color: var(--accent); font-family: var(--f-en); font-size: calc(15px * var(--en-scale)); font-weight: 600; direction: ltr; white-space: nowrap; }
.row:hover .d { background: var(--ground); }
.row .dot { justify-self: center; width: 9px; height: 9px; background: var(--accent); transform: rotate(45deg); }
[data-design="soft"] .row .dot, [data-design="modern"] .row .dot { border-radius: 50%; transform: none; }
.row--main .ar, .row--main .en { font-weight: 600; }
.row__sub { grid-column: 1 / -1; display: grid; gap: 4px; margin-top: 6px; }
.row__sub li { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(9.5em + 2 * clamp(14px, 2.4vw, 40px)); font-size: 15.5px; color: var(--muted); line-height: 1.7; }
.row__sub .ar { position: relative; padding-inline-start: 22px; }
.row__sub .en { padding-inline-end: 0; padding-inline-start: 22px; position: relative; }
.row__sub .ar::before, .row__sub .en::before { content: ""; position: absolute; top: .75em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.row__sub .ar::before { right: 8px; } .row__sub .en::before { left: 8px; }
.cv .bi--sub { margin-top: 8px; }
[data-design="soft"] .row, [data-design="modern"] .row { border: 0; border-radius: var(--r); padding: 16px 12px; }
[data-design="soft"] .row + .row, [data-design="modern"] .row + .row { margin-top: 6px; }
[data-design="soft"] .row, [data-design="modern"] .row { background: var(--surface); }
[data-design="soft"] .row .d, [data-design="modern"] .row .d { background: var(--ground); }

/* ============ Contact ============ */
.contact { margin-top: clamp(110px, 14vh, 170px); background: var(--deep); color: var(--on-deep); padding: clamp(80px, 12vh, 140px) var(--m) 36px; display: grid; justify-items: center; text-align: center; transition: background-color .4s, color .4s; }
.contact .bi { width: 100%; }
.contact__phone { margin-top: 30px; font-family: var(--f-en-h); font-size: clamp(42px, 6.4vw, 100px); font-weight: 600; line-height: 1; text-decoration: none; color: var(--accent); }
.contact__phone .ci__icon { width: 1.1em; height: 1.1em; background: var(--accent); }
.contact__phone .ci__icon svg { fill: var(--deep); }
.contact__mail { margin-top: 20px; font-size: clamp(22px, 2.6vw, 36px); }
.contact .ci__icon { background: var(--accent); }
.contact .ci__icon svg { fill: var(--deep); }
.contact .ci:hover .ci__icon { background: var(--on-deep); }
.contact .ci:hover .ci__icon svg { fill: var(--deep); }   /* keep the icon visible on hover */
.contact__row { margin-top: clamp(28px, 4vh, 44px); display: flex; flex-wrap: wrap; justify-content: center; gap: 18px clamp(32px, 5vw, 80px); }
.contact__row .ci { font-size: clamp(20px, 1.8vw, 26px); font-weight: 500; color: var(--on-deep); }
.contact__row .ci__icon { width: 2em; height: 2em; }
.bi--place { margin-top: 18px; opacity: .8; }
.credits { margin-top: clamp(60px, 9vh, 100px); font-size: 13px; line-height: 1.7; opacity: .6; max-width: 100ch; font-family: var(--f-en); }

/* ============ Side panel ============ */
.tab {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 45;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 10px; border: 0; cursor: pointer; border-radius: 0 14px 14px 0;
  background: var(--ink); color: var(--ground); writing-mode: vertical-rl; font-size: 15px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
  transition: padding .25s var(--ease);
}
.tab:hover { padding-inline: 14px; }
.tab__dots { display: flex; flex-direction: column; gap: 4px; writing-mode: horizontal-tb; }
.tab__dots i { width: 12px; height: 12px; border-radius: 50%; outline: 1px solid var(--ground); }
.tab__dots i:nth-child(1) { background: var(--ground); }
.tab__dots i:nth-child(2) { background: var(--deep); }
.tab__dots i:nth-child(3) { background: var(--accent); }
.panel {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: min(380px, 92vw);
  background: var(--ground); color: var(--ink); padding: 20px 20px 28px; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 0 60px rgb(0 0 0 / .3);
  font-family: "IBM Plex Sans Arabic", sans-serif;
}
.panel[hidden] { display: none; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel__head h2 { font-family: inherit; font-size: 19px; font-weight: 600; }
.panel__head span, .panel__group span { display: block; font-family: "IBM Plex Sans", sans-serif; font-size: 13px; font-weight: 400; color: var(--muted); }
.panel__close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface); font-size: 24px; cursor: pointer; }
.panel__group { margin: 22px 4px 10px; font-size: 16px; font-weight: 600; font-family: inherit; }
.panel__list { display: grid; gap: 8px; }
.opt { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--surface); cursor: pointer; text-align: right; font-family: inherit; transition: transform .2s var(--ease), box-shadow .2s; }
.opt:hover { box-shadow: inset 0 0 0 1px var(--muted); }
.opt:active { transform: scale(.98); }
.opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.opt__sw { display: flex; }
.opt__sw i { width: 24px; height: 40px; }
.opt__sw i:first-child { border-radius: 0 8px 8px 0; }
.opt__sw i:last-child { border-radius: 8px 0 0 8px; }
.opt__name { font-size: 16px; line-height: 1.35; }
.opt__name small { display: block; font-size: 13px; color: var(--muted); font-family: "IBM Plex Sans", sans-serif; }
.opt__check { opacity: 0; font-size: 18px; }
.opt[aria-pressed="true"] .opt__check { opacity: 1; }
.opt__aa { width: 70px; height: 44px; display: flex; gap: 6px; justify-content: center; align-items: center; white-space: nowrap; border-radius: 8px; background: var(--ground); font-size: 19px; font-weight: 600; }
[data-design-preview="classic"] { font-family: "Noto Naskh Arabic", serif; } [data-design-preview="classic"] [lang] { font-family: "Cormorant Garamond", serif; }
[data-design-preview="modern"] { font-family: "IBM Plex Sans Arabic", sans-serif; } [data-design-preview="modern"] [lang] { font-family: "IBM Plex Sans", sans-serif; }
[data-design-preview="soft"] { font-family: "Tajawal", sans-serif; border-radius: 22px; } [data-design-preview="soft"] [lang] { font-family: "Manrope", sans-serif; }
[data-design-preview="editorial"] { font-family: "Noto Naskh Arabic", serif; font-size: 22px; } [data-design-preview="editorial"] [lang] { font-family: "Playfair Display", serif; }
.panel__note { margin-top: 20px; font-size: 14px; color: var(--muted); }

/* reveal (content visible without script) */
.js .rv { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .rv { opacity: 1; transform: none; transition: none; } }

/* ============ Tablet & phone ============ */
@media (max-width: 899px) {
  .bar { grid-template-columns: 1fr 1fr; }
  .bar__links { display: none; }
  .cases, .group--endo .cases { grid-template-columns: 1fr; }
  .stages { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .row__sub li { grid-template-columns: 1fr; row-gap: 2px; }
  .about { grid-template-columns: 1fr 1fr; }
  .about__photo { grid-column: 1 / -1; order: -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: 1fr 1fr; }
  .row .d { grid-column: 1 / -1; order: -1; justify-self: center; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .bi { column-gap: 18px; }
  .bi--intro, .about, .case .bi--body { grid-template-columns: 1fr; row-gap: 14px; }
  .bi--intro .ar, .about .ar, .case .bi--body .ar { text-align: right; justify-self: stretch; }
  .bi--intro .en, .about .en, .case .bi--body .en { text-align: left; justify-self: stretch; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row .ar { text-align: right; } .row .en { text-align: left; }
  .bar__ar { font-size: 16px; } .bar__en { font-size: 15px; }
  .hero__contact { flex-direction: column; align-items: center; gap: 12px; }
  .hero__contact .ci { font-size: 20px; }
  .bi--intro .ar, .bi--intro .en { text-align-last: auto; }
  .tab { top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 16px; transform: none; writing-mode: horizontal-tb; padding: 12px; border-radius: 999px; }
  .tab:hover { padding-inline: 12px; }
  .tab__dots { flex-direction: row; }
  .tab > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* =====================================================================
   Cases gallery (cases.js): sticky category bar · one section per specialty ·
   horizontal case cards · View Case window with a before/after slider
   ===================================================================== */
#cases-app { margin-top: clamp(28px, 4vh, 44px); }

/* category bar */
.cg-nav {
  position: sticky; z-index: 24; margin: 0 calc(-1 * var(--m)); padding: 12px var(--m) 0;
  background: color-mix(in srgb, var(--ground) 93%, transparent);
  transition: box-shadow .3s;
}
.cg-nav.is-stuck { box-shadow: 0 10px 24px -18px rgb(0 0 0 / .35); }
.cg-nav__track { display: flex; gap: 10px; justify-content: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 12px; scroll-snap-type: x proximity; }
.cg-nav__track::-webkit-scrollbar { display: none; }
.cg-chip {
  flex: 0 0 auto; scroll-snap-align: center; min-width: 132px;
  display: grid; justify-items: center; gap: 2px; padding: 12px 16px 10px;
  border-radius: var(--r); text-decoration: none; text-align: center;
  background: color-mix(in srgb, var(--accent) 12%, var(--ground)); color: var(--ink);
  box-shadow: 0 1px 0 rgb(0 0 0 / .04);
  transition: background-color .35s var(--ease), color .35s var(--ease), transform .25s var(--ease), box-shadow .35s;
}
.cg-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -12px rgb(0 0 0 / .35); }
.cg-chip .ci-svg { width: 30px; height: 30px; color: var(--deep); transition: color .35s; }
.cg-chip__ar { font-family: var(--f-ar-h); font-weight: 600; font-size: 16px; line-height: 1.4; }
.cg-chip__en { font-family: var(--f-en); font-size: calc(13px * var(--en-scale)); color: var(--muted); line-height: 1.3; }
.cg-chip.is-active { background: var(--deep); color: var(--on-deep); box-shadow: 0 10px 22px -14px rgb(0 0 0 / .5); }
.cg-chip.is-active .ci-svg { color: var(--accent); }
.cg-chip.is-active .cg-chip__en { color: color-mix(in srgb, var(--on-deep) 75%, transparent); }
.cg-chip.is-active::after { content: ""; width: 26px; height: 3px; margin-top: 4px; border-radius: 3px; background: var(--accent); }
.cg-progress { height: 3px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.cg-progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); margin-inline-start: 0; background: var(--accent); transition: width .15s linear; }

/* one section per specialty: its own soft background and floating shapes */
.cg-sec { position: relative; overflow: hidden; margin: 0 calc(-1 * var(--m)); padding: clamp(64px, 10vh, 110px) var(--m); scroll-margin-top: 150px; isolation: isolate; }
.cg-sec--0 { background: color-mix(in srgb, var(--accent) 9%, var(--ground)); }
.cg-sec--1 { background: color-mix(in srgb, var(--ink) 3%, var(--ground)); }
.cg-sec--2 { background: color-mix(in srgb, var(--accent) 16%, var(--ground)); }
.cg-sec--3 { background: color-mix(in srgb, var(--deep) 6%, var(--ground)); }
.cg-sec--4 { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.cg-deco { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.cg-deco--a { width: 520px; height: 520px; inset-inline-end: -140px; top: -180px; background: color-mix(in srgb, var(--accent) 16%, transparent); opacity: .55; }
.cg-deco--b { width: 300px; height: 300px; inset-inline-start: -90px; bottom: -110px; background: color-mix(in srgb, var(--ground) 70%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.cg-sec:nth-of-type(even) .cg-deco--a { inset-inline-end: auto; inset-inline-start: -160px; top: auto; bottom: -220px; }
.cg-sec:nth-of-type(even) .cg-deco--b { inset-inline-start: auto; inset-inline-end: -60px; top: 40px; bottom: auto; }

.cg-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: var(--gap); align-items: center; max-width: 1180px; margin-inline: auto; }
.cg-head__text { display: grid; justify-items: start; gap: 10px; }
.cg-head__icon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--ground); color: var(--deep); box-shadow: 0 6px 18px -12px rgb(0 0 0 / .35); }
.cg-head__icon .ci-svg { width: 32px; height: 32px; }
.cg-title { display: grid; gap: 0; line-height: 1.2; }
.cg-title .ar { font-family: var(--f-ar-h); font-size: var(--h2); font-weight: var(--w-h); }
.cg-title .en { font-family: var(--f-en-h); font-size: calc(var(--h2) * .62 * var(--en-scale)); color: var(--muted); font-weight: 500; }
.cg-desc { display: grid; gap: 2px; max-width: 54ch; color: var(--muted); }
.cg-desc .en { font-family: var(--f-en); font-size: calc(15px * var(--en-scale)); direction: ltr; text-align: right; }
.cg-count { font-size: 15px; color: var(--accent); font-weight: 600; }
.cg-count span { font-family: var(--f-en); font-weight: 500; }
.cg-head__visual { justify-self: center; width: min(100%, 360px); }
.cg-head__visual img { width: 100%; height: auto; max-height: 320px; object-fit: contain; mix-blend-mode: multiply; }
.cg-head__visual--icon { width: 220px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 70%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); color: var(--deep); }
.cg-big-icon { width: 46%; height: 46%; stroke-width: 1.1; }
[data-palette="night"] .cg-head__visual img { mix-blend-mode: normal; border-radius: var(--r); }

/* horizontal gallery of case cards */
.cg-gallery { max-width: 1180px; margin: clamp(28px, 4vh, 44px) auto 0; }
.cg-ctrl { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }
.cg-ctrl.is-hidden { display: none; }
.cg-pos { font-family: var(--f-en); min-width: 4.5ch; text-align: center; direction: ltr; color: var(--muted); }
.cg-arrow { width: 46px; height: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; background: var(--ground); color: var(--deep); box-shadow: 0 6px 16px -10px rgb(0 0 0 / .4); transition: background-color .25s, color .25s, transform .2s var(--ease), opacity .25s; }
.cg-arrow svg { width: 20px; height: 20px; }
.cg-arrow:hover:not(:disabled) { background: var(--deep); color: var(--on-deep); }
.cg-arrow:active:not(:disabled) { transform: scale(.94); }
.cg-arrow:disabled { opacity: .35; cursor: default; }
.cg-track {
  display: flex; gap: 20px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 4px 18px;
  -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); mask-image: linear-gradient(to left, #000 88%, transparent);   /* the next card fades at the edge: there is more */
}
.cg-track::-webkit-scrollbar { display: none; }
.cg-card {
  flex: 0 0 min(440px, 84%); scroll-snap-align: start; display: grid; grid-template-rows: auto 1fr;
  background: var(--ground); border-radius: var(--r); padding: 12px;
  box-shadow: 0 14px 34px -26px rgb(0 0 0 / .45); transition: transform .35s var(--ease), box-shadow .35s;
}
.cg-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -26px rgb(0 0 0 / .5); }
.cg-card__media { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; cursor: zoom-in; }
.cg-card__media.is-single { grid-template-columns: 1fr; }
.cg-shot { margin: 0; display: grid; gap: 6px; }
.cg-frame { position: relative; height: 230px; border-radius: var(--r); overflow: hidden; background: transparent; }
.cg-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }   /* whole photo, never cropped */
.cg-tag { justify-self: center; font-size: 14px; padding: 1px 12px; border-radius: var(--pill); background: color-mix(in srgb, var(--accent) 14%, var(--ground)); }
.cg-tag span { font-family: var(--f-en); font-size: 12px; color: var(--muted); }
.is-after .cg-tag, .is-final .cg-tag { background: var(--deep); color: var(--on-deep); }
.is-after .cg-tag span, .is-final .cg-tag span { color: inherit; opacity: .75; }
.cg-card__body { display: grid; gap: 6px; align-content: start; padding: 14px 6px 4px; }
.cg-kind { font-size: 14px; font-weight: 600; color: var(--accent); }
.cg-kind span { font-family: var(--f-en); font-weight: 500; }
.cg-sub { color: var(--accent); font-weight: inherit; }   /* «— مراحل العلاج» beside the case number */
.cg-card__title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cg-card__title .ar { font-family: var(--f-ar-h); font-size: 21px; font-weight: var(--w-h); }
.cg-card__title .en { font-family: var(--f-en-h); font-size: calc(17px * var(--en-scale)); color: var(--muted); direction: ltr; }
.cg-view {
  justify-self: start; margin-top: 6px; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border: 0; border-radius: var(--pill); cursor: pointer;
  background: var(--deep); color: var(--on-deep); font-size: 15px; font-weight: 500;
  transition: background-color .25s, transform .2s var(--ease);
}

.cg-view span { font-family: var(--f-en); font-size: 13px; opacity: .8; }
.cg-view svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.cg-view:hover { background: color-mix(in srgb, var(--deep) 82%, var(--accent)); }
.cg-view:hover svg { transform: translateX(-3px); }

/* View Case window */
.cg-lock { overflow: hidden; }
.cg-modal {
  width: min(1120px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 0; border: 0;
  border-radius: var(--r); background: var(--ground); color: var(--ink);
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / .6); overflow: hidden;
}
.cg-modal[open] { display: grid; grid-template-rows: auto 1fr; animation: cg-in .35s var(--ease); }
.cg-modal::backdrop { background: rgb(10 14 22 / .62); }
@keyframes cg-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .cg-modal[open] { animation: none; } }
.cg-modal__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px; background: color-mix(in srgb, var(--accent) 10%, var(--ground)); }
.cg-modal__title { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; margin-top: 2px; }
.cg-modal__title .ar { font-family: var(--f-ar-h); font-size: 24px; font-weight: var(--w-h); }
.cg-modal__title .en { font-family: var(--f-en-h); font-size: calc(18px * var(--en-scale)); color: var(--muted); }
.cg-modal__btns { display: flex; gap: 8px; align-items: center; }
.cg-close { width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--deep); color: var(--on-deep); font-size: 26px; line-height: 1; cursor: pointer; }
.cg-modal__body { overflow-y: auto; padding: 22px; display: grid; gap: 22px; }
.cg-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cg-stages .cg-frame { height: 300px; }
.cg-stages .is-final .cg-frame { box-shadow: 0 0 0 3px var(--accent); }
.cg-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.cg-photos .cg-frame { height: min(70svh, 640px); }
.cg-view-block { display: grid; gap: 8px; }
.cg-view-name { justify-self: center; color: var(--muted); }
.cg-view-name span { font-family: var(--f-en); font-size: 13px; margin-inline-start: 4px; }
.cg-hint { justify-self: center; font-size: 14px; color: var(--muted); }
.cg-hint span { font-family: var(--f-en); }
.cg-ba { --pos: 50%; position: relative; direction: ltr; width: min(100%, calc(min(66svh, 620px) * var(--ar))); aspect-ratio: var(--ar); margin-inline: auto; border-radius: var(--r); overflow: hidden; background: transparent; touch-action: pan-y; }
.cg-ba__layer { position: absolute; inset: 0; }
.cg-ba__layer img { width: 100%; height: 100%; object-fit: contain; }
.cg-ba__after { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }   /* after on the left, before on the right */
.cg-ba__tag { position: absolute; top: 14px; z-index: 2; padding: 3px 14px; border-radius: var(--r); font-size: 14px; direction: rtl; background: var(--ground); color: var(--ink); }
.cg-ba__tag span { font-family: var(--f-en); font-size: 12px; opacity: .7; }
.cg-ba__tag--before { right: 14px; }
.cg-ba__tag--after { left: 14px; background: var(--deep); color: var(--on-deep); }
.cg-ba__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.cg-ba__knob { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; color: #14213D; box-shadow: 0 6px 18px rgb(0 0 0 / .3); }
.cg-ba__knob svg { width: 16px; height: 16px; }
.cg-ba__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.cg-ba__range:focus-visible ~ .cg-ba__line .cg-ba__knob { outline: 3px solid var(--accent); outline-offset: 3px; }
.cg-note { display: grid; gap: 4px; padding: 14px 18px; border-radius: var(--r); background: color-mix(in srgb, var(--accent) 10%, var(--ground)); color: var(--muted); }
.cg-note .en { font-family: var(--f-en); direction: ltr; text-align: right; }

@media (max-width: 899px) {
  .cg-nav__track { justify-content: safe center; }
  .cg-chip { min-width: 116px; padding: 10px 12px 8px; }
  .cg-head { grid-template-columns: 1fr; }
  .cg-head__visual { order: -1; width: min(55%, 220px); }
  .cg-head__visual--icon { width: 150px; }
  .cg-sec { scroll-margin-top: 140px; }
  .cg-frame { height: 190px; }
}
@media (max-width: 560px) {
  .cg-chip { min-width: 104px; }
  .cg-chip__ar { font-size: 14px; }
  .cg-card { flex-basis: 86%; }
  .cg-frame { height: 160px; }
  .cg-modal__bar { flex-wrap: wrap; padding: 12px 14px; }
  .cg-modal__body { padding: 14px; }
  .cg-stages { grid-template-columns: 1fr 1fr; }
  .cg-stages .cg-frame { height: 180px; }
  .cg-card__title { flex-direction: column; gap: 0; }
}
/* section visual: edges fade away so the picture sits in the section, not in a box */
.cg-head__visual img {
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 50% 52%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 70% at 50% 52%, #000 58%, transparent 100%);
}
/* no dark letterbox: the frame hugs wide photos, tall ones stay whole */
.cg-frame { height: auto; aspect-ratio: var(--ar, 4 / 3); max-height: 230px; }
.cg-frame img { border-radius: inherit; }
.cg-stages .cg-frame { height: auto; max-height: 300px; }
.cg-photos .cg-frame { height: auto; max-height: min(70svh, 640px); }
@media (max-width: 900px) { .cg-frame { max-height: 190px; } }
@media (max-width: 560px) { .cg-frame { max-height: 160px; } .cg-stages .cg-frame { height: auto; max-height: 180px; } }
/* cards: every photo box is the same size and every photo is whole (never cropped) */
.cg-card__media { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.cg-card__media.is-single { grid-template-columns: 1fr; }
.cg-card__media .cg-shot { display: grid; gap: 8px; min-width: 0; }
.cg-card__media .cg-frame { width: 100%; aspect-ratio: auto; height: 230px; max-height: none;
  background: color-mix(in srgb, var(--surface) 70%, var(--ground)); }
.cg-card__media .cg-frame img { object-fit: contain; border-radius: 0; }
@media (max-width: 900px) { .cg-card__media .cg-frame { height: 190px; } }
@media (max-width: 560px) { .cg-card__media .cg-frame { height: 160px; } }
/* a section with one case only: the card takes the full width and its photos are larger */
.cg-track:has(> .cg-card:only-child) { -webkit-mask-image: none; mask-image: none; }
.cg-card:only-child { flex: 1 1 100%; max-width: 980px; }
.cg-card:only-child .cg-card__media { gap: 14px; }
.cg-card:only-child .cg-card__media .cg-frame { height: 300px; }
@media (max-width: 900px) { .cg-card:only-child .cg-card__media .cg-frame { height: 220px; } }
@media (max-width: 560px) { .cg-card:only-child { flex-basis: 100%; } .cg-card:only-child .cg-card__media .cg-frame { height: 150px; } }
/* a section with exactly two cases: both cards share the full width, larger photos */
.cg-track:has(> .cg-card:nth-child(2):last-child) { -webkit-mask-image: none; mask-image: none; }
@media (min-width: 561px) { .cg-gallery:has(.cg-card:nth-child(2):last-child) .cg-ctrl { visibility: hidden; } }
.cg-card:first-child:nth-last-child(2), .cg-card:nth-child(2):last-child { flex: 1 1 calc(50% - 10px); }
.cg-card:first-child:nth-last-child(2) .cg-card__media .cg-frame,
.cg-card:nth-child(2):last-child .cg-card__media .cg-frame { height: 320px; }
@media (max-width: 900px) {
  .cg-card:first-child:nth-last-child(2) .cg-card__media .cg-frame,
  .cg-card:nth-child(2):last-child .cg-card__media .cg-frame { height: 240px; } }
@media (max-width: 560px) {
  .cg-track:has(> .cg-card:nth-child(2):last-child) { -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); mask-image: linear-gradient(to left, #000 88%, transparent); }
  .cg-card:first-child:nth-last-child(2), .cg-card:nth-child(2):last-child { flex: 0 0 86%; }
  .cg-card:first-child:nth-last-child(2) .cg-card__media .cg-frame,
  .cg-card:nth-child(2):last-child .cg-card__media .cg-frame { height: 200px; } }
/* View case: before (right) and after (left) side by side, no slider */
.cg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.cg-pair .cg-shot { display: grid; gap: 8px; }
.cg-pair .cg-frame { height: auto; max-height: min(62svh, 560px); }
@media (max-width: 560px) { .cg-pair { gap: 8px; } .cg-pair .cg-frame { max-height: 40svh; } }
.cg-frame.is-match img { object-fit: cover; }   /* pair trimmed at the edges to the same shape */

/* top bar and specialty bar hide while scrolling down, come back on scroll up */
.bar, .cg-nav { transition: transform .35s var(--ease), box-shadow .3s; }
html.bars-off .bar { transform: translateY(-100%); }
html.bars-off .cg-nav.is-stuck { transform: translateY(calc(-100% - var(--bar-h, 0px))); }
.cg-nav:not(.is-stuck) { transition: box-shadow .3s; }   /* in its place under the title: never slides over the text */
@media (prefers-reduced-motion: reduce) { .bar, .cg-nav { transition: none; } }

/* transparent cut-outs: no fade, no blend, no card */
.cg-head__visual img[src$=".png"],
[data-palette="night"] .cg-head__visual img[src$=".png"] {
  -webkit-mask-image: none; mask-image: none; mix-blend-mode: normal; border-radius: 0;
  filter: drop-shadow(0 14px 18px color-mix(in srgb, var(--deep) 18%, transparent));
}
