:root {
  color-scheme: light;
  --night: #062440;
  --night-2: #082c4d;
  --night-3: #0c3a63;
  --paper: #f3f6f9;
  --paper-2: #e7eef5;
  --surface: #ffffff;
  --surface-dark: rgba(13, 53, 79, .78);
  --ink: #0e2438;
  --ink-soft: #5b6d7e;
  --ink-on-dark: #eaf2f8;
  --muted-on-dark: #a3b7c8;
  --line: #d6e1ea;
  --line-dark: rgba(176, 215, 181, .16);
  --teal: #4eb657;
  --teal-bright: #6fcf78;
  --teal-dark: #00548c;
  --teal-pale: #e3f3e5;
  --gold: #c6a15f;
  --gold-pale: #f0e4ca;
  --danger: #a94646;
  --shadow-sm: 0 10px 30px rgba(15, 62, 92, .08);
  --shadow-md: 0 20px 48px rgba(13, 53, 79, .13);
  --shadow-lg: 0 32px 100px rgba(6, 30, 46, .28);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --shell: min(1240px, calc(100% - 48px));
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 116px;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body:has(dialog[open]),
body.modal-open { overflow: hidden; }

button,
input { font: inherit; }

button { color: inherit; }

button,
[role="button"] { -webkit-tap-highlight-color: transparent; }

button:active { transform: translateY(1px) scale(.99); }

img {
  display: block;
  max-width: 100%;
}

[hidden] { display: none !important; }

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 500;
  inset-block-start: 10px;
  inset-inline-start: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--teal-bright);
  color: var(--night);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .18s ease;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid rgba(82, 205, 99, .48);
  outline-offset: 3px;
}

/* Header */
.site-header {
  position: sticky;
  z-index: 90;
  inset-block-start: 0;
  border-bottom: 1px solid var(--line-dark);
  background: rgba(8, 33, 50, .88);
  color: var(--ink-on-dark);
  backdrop-filter: blur(20px) saturate(1.2);
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: start;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 205, 99, .3);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(82, 205, 99, .22), rgba(45, 156, 60, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 30px rgba(0, 0, 0, .18);
}

.brand-mark svg { width: 27px; fill: var(--teal-bright); }
.brand-copy strong,
.brand-copy small { display: block; }

.brand-copy strong {
  font-family: "Noto Kufi Arabic", Tahoma, sans-serif;
  font-size: .94rem;
  line-height: 1.6;
}

.brand-copy small { color: var(--muted-on-dark); font-size: .74rem; }

.main-nav { display: flex; align-items: center; gap: 5px; }

.main-nav button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 7px 13px;
  background: transparent;
  color: #c4d6c6;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.main-nav button:hover {
  border-color: var(--line-dark);
  background: rgba(255, 255, 255, .055);
  color: var(--teal-bright);
}

.source-banner {
  position: relative;
  z-index: 30;
  border-bottom: 1px solid #cbe0ce;
  background: #e0f1e2;
  color: #155884;
  font-size: .82rem;
}

.source-banner__inner {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
}

.source-banner__icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-dark);
  color: #ffffff;
  font-size: .64rem;
  font-weight: 700;
}

.source-banner__stats {
  padding-inline-start: 10px;
  border-inline-start: 1px solid #a7bdcb;
  font-weight: 700;
}

/* Hero */
.hero {
  position: relative;
  min-height: min(750px, calc(100svh - 118px));
  overflow: visible;
  padding: clamp(76px, 10vh, 118px) 0 94px;
  background:
    radial-gradient(circle at 13% 8%, rgba(82, 205, 99, .17), transparent 30%),
    radial-gradient(circle at 82% 15%, rgba(198, 161, 95, .14), transparent 25%),
    linear-gradient(145deg, #082132 0%, #0c324c 55%, #0a273b 100%);
  color: var(--ink-on-dark);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .32;
  background-image:
    linear-gradient(rgba(170, 220, 177, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(170, 220, 177, .055) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000000 5%, transparent 92%);
}

.hero::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -1px;
  height: 80px;
  z-index: -1;
  background: linear-gradient(to bottom, transparent, rgba(242, 244, 246, .05));
  clip-path: polygon(0 68%, 100% 0, 100% 100%, 0 100%);
}

.hero-noise {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background: radial-gradient(circle at 50% 120%, rgba(82, 205, 99, .18), transparent 40%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(350px, .75fr);
  gap: clamp(48px, 7vw, 100px);
  align-items: center;
}

.hero-copy { position: relative; z-index: 5; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--teal-dark);
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.eyebrow i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 12%, transparent);
}

.eyebrow--light { color: var(--teal-bright); }

.hero h1,
.section-heading h2,
.explorer-head h2,
.integrity-card h2,
.case-detail h2,
.detail-section h3 {
  margin: 0;
  font-family: "Noto Kufi Arabic", Tahoma, sans-serif;
  line-height: 1.5;
}

.hero h1 {
  max-width: 850px;
  margin-block: 17px 18px;
  font-size: clamp(2.65rem, 5.5vw, 5rem);
  line-height: 1.35;
  letter-spacing: -.035em;
}

.hero h1 em {
  color: var(--teal-bright);
  font-style: normal;
  text-shadow: 0 0 35px rgba(82, 205, 99, .16);
}

.hero-lead {
  max-width: 710px;
  margin: 0;
  color: #b6c1c8;
  font-size: clamp(1rem, 1.7vw, 1.16rem);
}

/* Search and live results */
.search-box {
  position: relative;
  z-index: 30;
  margin-block-start: 35px;
  padding: 7px;
  border: 1px solid rgba(174, 220, 180, .23);
  border-radius: 19px;
  background: rgba(255, 255, 255, .98);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28), inset 0 1px 0 #ffffff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.search-box:focus-within {
  border-color: rgba(82, 205, 99, .72);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .34), 0 0 0 4px rgba(82, 205, 99, .1);
}

.search-box > label {
  display: block;
  padding: 5px 13px 1px;
  color: #616e76;
  font-size: .72rem;
  font-weight: 700;
}

.search-box__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
}

.search-box__icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  color: var(--teal-dark);
}

.search-box__icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-height: 55px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.search-box input::placeholder { color: #8c969d; }
.search-box input::-webkit-search-cancel-button { appearance: none; }

.search-box__clear {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--paper-2);
  color: #586873;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.search-box__submit,
.secondary-button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  padding: 10px 21px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(10, 90, 143, .23);
  transition: transform .2s var(--ease), box-shadow .2s ease, filter .2s ease;
}

.search-box__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
}

.search-box__submit b { font-size: 1.2rem; transition: transform .2s var(--ease); }
.search-box__submit:hover b { transform: translateX(-4px); }
.search-box__submit:hover,
.secondary-button:hover { filter: brightness(1.06); box-shadow: 0 14px 28px rgba(10, 90, 143, .3); }

.live-search {
  position: absolute;
  z-index: 60;
  inset-inline: 0;
  inset-block-start: calc(100% + 10px);
  overflow: hidden;
  border: 1px solid #cfe1d1;
  border-radius: 18px;
  background: rgba(255, 255, 255, .985);
  box-shadow: 0 28px 70px rgba(8, 33, 51, .32);
  animation: live-in .18s var(--ease) both;
}

@keyframes live-in {
  from { opacity: 0; transform: translateY(-7px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.live-search__head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #e3e8eb;
  background: #f7faf9;
}

.live-search__head > span { color: var(--teal-dark); font-size: .75rem; font-weight: 700; }
.live-search__head p { margin: 0; color: var(--ink-soft); font-size: .73rem; }
.live-search__list { max-height: min(48vh, 390px); overflow-y: auto; padding: 7px; }

.live-search__list > button,
.live-search-item,
.live-result {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 12px;
  padding: 8px;
  background: transparent;
  cursor: pointer;
  text-align: start;
  transition: background .16s ease, color .16s ease;
}

.live-search__list > button:hover,
.live-search__list > button[aria-selected="true"],
.live-search-item:hover,
.live-search-item.is-active,
.live-result:hover { background: var(--teal-pale); color: var(--teal-dark); }

.live-result__media {
  width: 52px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--paper-2);
}

.live-result__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-result__placeholder { color: var(--teal-dark); font-size: 1.15rem; }
.live-result__copy { min-width: 0; display: grid; gap: 2px; }
.live-result__title,
.live-result__subtitle {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}
.live-result__title { color: var(--ink); font-size: .78rem; font-weight: 700; line-height: 1.65; -webkit-line-clamp: 2; }
.live-result__subtitle { color: var(--ink-soft); font-size: .7rem; line-height: 1.55; -webkit-line-clamp: 1; }
.live-result__action { margin-block-start: 2px; color: var(--teal-dark); font-size: .66rem; font-weight: 700; }

.live-search__all {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid #dce3e8;
  background: #f4f6f8;
  color: var(--teal-dark);
  cursor: pointer;
  font-weight: 700;
}

.search-assurance {
  margin-block-start: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #93a1aa;
  font-size: .83rem;
}

.search-assurance > span { color: var(--gold); }
.search-assurance p { margin: 0; }

/* Hero graphic */
.hero-visual { position: relative; z-index: 1; display: grid; justify-items: center; }

.hero-orbit {
  position: relative;
  width: min(380px, 34vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(139, 207, 148, .18);
  border-radius: 50%;
}

.orbit--one { inset: 4%; animation: orbit-spin 28s linear infinite; }
.orbit--two { inset: 18%; border-color: rgba(198, 161, 95, .22); animation: orbit-spin 21s linear reverse infinite; }
.orbit--three { inset: 31%; border-style: dashed; border-color: rgba(82, 205, 99, .28); animation: orbit-spin 16s linear infinite; }

.orbit--one::before,
.orbit--two::before,
.orbit--three::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  inset-block-start: -4px;
  inset-inline-start: 50%;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 18px var(--teal-bright);
}

.orbit--two::before { background: var(--gold); box-shadow: 0 0 18px var(--gold); }

@keyframes orbit-spin { to { transform: rotate(1turn); } }

.orbit-core {
  position: relative;
  z-index: 2;
  width: 112px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 205, 99, .38);
  border-radius: 36px;
  background: radial-gradient(circle at 35% 25%, rgba(82, 205, 99, .25), rgba(11, 44, 67, .92));
  box-shadow: 0 0 80px rgba(82, 205, 99, .18), inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: rotate(5deg);
}

.orbit-core svg { width: 61px; fill: var(--teal-bright); filter: drop-shadow(0 0 13px rgba(82, 205, 99, .4)); transform: rotate(-5deg); }

.orbit-dot {
  position: absolute;
  z-index: 3;
  width: 10px;
  height: 10px;
  border: 2px solid var(--night);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(198, 161, 95, .7);
}

.orbit-dot--one { inset-block-start: 18%; inset-inline-end: 13%; }
.orbit-dot--two { inset-block-end: 20%; inset-inline-start: 18%; background: var(--teal-bright); }

.orbit-topic {
  position: absolute;
  z-index: 6;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(151, 215, 160, .25);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(9, 38, 57, .88);
  color: #d9e2e8;
  cursor: pointer;
  font-size: .69rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
  backdrop-filter: blur(10px);
  transition: transform .2s var(--ease), border-color .2s ease, background .2s ease, color .2s ease;
}

.orbit-topic:hover,
.orbit-topic:focus-visible {
  border-color: var(--teal-bright);
  background: rgba(15, 62, 92, .96);
  color: #ffffff;
  transform: translateY(-2px);
}

.orbit-topic__mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(82, 205, 99, .14);
  color: var(--teal-bright);
  font-family: "Noto Kufi Arabic", Tahoma, sans-serif;
  font-size: .64rem;
}

.orbit-topic--pain { inset-block-start: 2%; inset-inline-end: 9%; }
.orbit-topic--treatment { inset-block-start: 2%; inset-inline-start: 7%; }
.orbit-topic--gums { inset-block-start: 36%; inset-inline-end: -4%; }
.orbit-topic--missing { inset-block-start: 36%; inset-inline-start: -4%; }
.orbit-topic--appearance { inset-block-end: 4%; inset-inline-end: 8%; }
.orbit-topic--alignment { inset-block-end: 4%; inset-inline-start: 8%; }

.hero-stats {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line-dark);
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(12px);
}

.hero-stats > div { padding: 17px 19px; }
.hero-stats > div + div { border-inline-start: 1px solid var(--line-dark); }
.hero-stats strong { display: block; color: var(--teal-bright); font-family: "Noto Kufi Arabic", sans-serif; font-size: 1.25rem; line-height: 1.35; }
.hero-stats span { color: #93a1aa; font-size: .73rem; }

.hero-visual__note {
  margin: 13px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #82909a;
  font-size: .72rem;
}

.hero-visual__note span { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-bright); box-shadow: 0 0 10px var(--teal-bright); }

.hero-scroll {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: 27px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #697984;
  font-size: .68rem;
  transform: translateX(50%);
}

.hero-scroll span { width: 24px; height: 1px; background: #586975; }

/* Shared section styles */
.quick-section,
.explorer-section,
.results-section,
.browse-section,
.integrity-section { padding: 86px 0; }

.quick-section { background: var(--paper); }
.explorer-section { padding-block-start: 8px; background: var(--paper); }
.results-section { background: var(--paper-2); }
.browse-section { background: #ffffff; }
.integrity-section { padding-block: 32px 92px; background: #ffffff; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  margin-block-end: 31px;
}

.section-heading h2,
.integrity-card h2,
.explorer-head h2 {
  margin-block-start: 6px;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
}

.section-heading > p,
.library-heading__actions > p {
  max-width: 490px;
  margin: 0;
  color: var(--ink-soft);
}

.section-heading--results { align-items: center; }
.results-status { margin: 7px 0 0; color: var(--ink-soft); }

.ghost-button,
.browse-toggle,
.text-button {
  min-height: 43px;
  border: 1px solid #bcd0bf;
  border-radius: 11px;
  padding: 8px 15px;
  background: transparent;
  color: var(--teal-dark);
  cursor: pointer;
  font-weight: 700;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.ghost-button:hover,
.browse-toggle:hover { border-color: var(--teal); background: var(--teal-pale); }

/* Quick routes */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.quick-topic {
  position: relative;
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 17px;
  background: rgba(255, 255, 255, .76);
  cursor: pointer;
  text-align: start;
  box-shadow: 0 5px 20px rgba(18, 73, 109, .035);
  transition: transform .22s var(--ease), border-color .22s ease, box-shadow .22s ease, background .22s ease;
}

.quick-topic::after {
  content: "←";
  position: absolute;
  inset-inline-end: 16px;
  inset-block-end: 13px;
  color: #a3aeb5;
  font-size: .9rem;
  transition: color .2s ease, transform .2s var(--ease);
}

.quick-topic:hover {
  transform: translateY(-4px);
  border-color: #9cb8cb;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.quick-topic:hover::after { color: var(--teal-dark); transform: translateX(-4px); }

.quick-topic__mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid #c7e3cb;
  border-radius: 15px;
  background: var(--teal-pale);
  color: var(--teal-dark);
  font-family: "Noto Kufi Arabic", sans-serif;
  font-size: .82rem;
  font-weight: 700;
}

.quick-topic__label { padding-inline-end: 12px; font-weight: 700; }

/* Guided explorer */
.explorer-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(166, 194, 212, .18);
  border-radius: var(--radius-lg);
  padding: 36px;
  background:
    radial-gradient(circle at 88% 0%, rgba(82, 205, 99, .12), transparent 27%),
    linear-gradient(145deg, var(--night-2), #092639);
  color: var(--ink-on-dark);
  box-shadow: var(--shadow-lg);
}

.explorer-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgba(160, 189, 209, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 189, 209, .07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, transparent, #000000 50%, transparent);
}

.explorer-head,
.explorer-grid { position: relative; z-index: 1; }

.explorer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 26px;
  margin-block-end: 29px;
}

.explorer-head h2 { max-width: 760px; color: #ffffff; }
.explorer-head__mark { color: rgba(82, 205, 99, .23); font-family: "Noto Kufi Arabic", sans-serif; font-size: 4.5rem; line-height: 1; }

.explorer-grid {
  display: grid;
  grid-template-columns: .88fr 1fr 1.15fr;
  gap: 12px;
}

.explorer-step {
  min-width: 0;
  min-height: 290px;
  border: 1px solid var(--line-dark);
  border-radius: 19px;
  padding: 18px;
  background: rgba(255, 255, 255, .035);
  backdrop-filter: blur(8px);
}

.explorer-step__label {
  min-height: 41px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block-end: 13px;
  color: #d9e1e6;
  font-size: .84rem;
  font-weight: 700;
}

.explorer-step__label b {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(82, 205, 99, .13);
  color: var(--teal-bright);
  font-size: .72rem;
}

.explorer-groups,
.explorer-options { display: grid; gap: 8px; }

.explorer-groups > button,
.explorer-options > button,
.explorer-group,
.explorer-option {
  width: 100%;
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, .055);
  color: #bbcebe;
  cursor: pointer;
  text-align: start;
  font-size: .84rem;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.explorer-groups > button:hover,
.explorer-options > button:hover,
.explorer-group:hover,
.explorer-option:hover,
.explorer-groups > button.is-active,
.explorer-options > button.is-active,
.explorer-group.is-active,
.explorer-option.is-active,
.explorer-groups > button[aria-pressed="true"],
.explorer-options > button[aria-pressed="true"] {
  border-color: rgba(82, 205, 99, .38);
  background: rgba(82, 205, 99, .13);
  color: #ffffff;
}

.explorer-results-status { margin: 0 0 12px; color: #8f9da6; font-size: .78rem; }
.explorer-results { display: grid; gap: 8px; }

.explorer-results > button,
.explorer-result {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  padding: 7px;
  background: rgba(255, 255, 255, .04);
  color: #d8e0e5;
  cursor: pointer;
  text-align: start;
  font-size: .79rem;
}

.explorer-results img {
  width: 46px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #0b2b41;
  object-fit: contain;
}

.explorer-results-wrap .text-button { margin-block-start: 12px; border-color: var(--line-dark); color: var(--teal-bright); }

/* Library and cards */
.section-heading--library { align-items: start; }
.library-heading__actions { max-width: 510px; display: grid; justify-items: end; gap: 13px; }
.browse-toggle { display: inline-flex; align-items: center; gap: 9px; }
.browse-toggle b { transition: transform .2s ease; }
.browse-toggle[aria-expanded="false"] b { transform: rotate(180deg); }
.browse-body { animation: content-in .22s var(--ease) both; }

@keyframes content-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 20px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.category-chip {
  min-height: 43px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  background: #ffffff;
  color: #4d5d67;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 600;
  transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.category-chip:hover { border-color: #93b3c9; color: var(--teal-dark); }
.category-chip.is-active,
.category-chip[aria-pressed="true"] {
  border-color: var(--night-2);
  background: var(--night-2);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(10, 39, 59, .18);
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.case-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(17, 71, 107, .05);
  transition: transform .24s var(--ease), border-color .24s ease, box-shadow .24s ease;
  animation: card-in .35s var(--ease) both;
}

.case-card:nth-child(2n) { animation-delay: .035s; }
.case-card:nth-child(3n) { animation-delay: .07s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.case-card::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset-inline: 0;
  inset-block-start: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--teal-bright), var(--gold));
  opacity: 0;
  transition: opacity .2s ease;
}

.case-card:hover {
  transform: translateY(-5px);
  border-color: #a1bbcc;
  box-shadow: 0 20px 44px rgba(17, 71, 107, .12);
}

.case-card:hover::before { opacity: 1; }

.case-card__media,
.detail-image__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(19, 76, 114, .035) 25%, transparent 25%, transparent 75%, rgba(19, 76, 114, .035) 75%),
    linear-gradient(45deg, rgba(19, 76, 114, .035) 25%, transparent 25%, transparent 75%, rgba(19, 76, 114, .035) 75%),
    #edf0f2;
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.case-card__media { border-bottom: 1px solid #e4e8eb; }

.case-card__media img,
.detail-image__media img,
.case-hero__media img,
.case-thumbnails img,
.image-dialog__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.case-card__placeholder {
  max-width: 190px;
  padding: 15px;
  color: #717e86;
  text-align: center;
  font-size: .82rem;
}

.case-card__count {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 999px;
  background: rgba(9, 36, 54, .82);
  color: #ffffff;
  font-size: .7rem;
  backdrop-filter: blur(8px);
}

.case-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.case-card__source {
  align-self: flex-start;
  margin-block-end: 9px;
  color: var(--teal-dark);
  font-size: .7rem;
  font-weight: 700;
}

.case-card h3,
.case-card__title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-family: "Noto Kufi Arabic", Tahoma, sans-serif;
  font-size: .98rem;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.case-card__excerpt-label {
  margin-block-start: 12px;
  color: var(--teal-dark);
  font-size: .68rem;
  font-weight: 700;
}

.case-card__subtitle,
.case-card__preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.case-card__subtitle {
  margin: 6px 0 0;
  color: #155884;
  font-size: .8rem;
  font-weight: 600;
  -webkit-line-clamp: 2;
}

.case-card__preview {
  margin: 11px 0 0;
  color: var(--ink-soft);
  font-size: .83rem;
  line-height: 1.8;
  -webkit-line-clamp: 3;
}

.case-card__footer {
  margin-block-start: auto;
  padding-block-start: 15px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--teal-dark);
  font-size: .78rem;
  font-weight: 700;
}

.case-card__footer span:last-child { transition: transform .2s var(--ease); }
.case-card:hover .case-card__footer span:last-child { transform: translateX(-4px); }

.explorer-results .case-card {
  min-height: 74px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 6px;
  border-color: var(--line-dark);
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
  color: #d8e0e5;
  box-shadow: none;
}

.explorer-results .case-card:hover {
  transform: translateY(-2px);
  border-color: rgba(82, 205, 99, .55);
  background: rgba(82, 205, 99, .1);
  box-shadow: none;
}

.explorer-results .case-card__media {
  width: 72px;
  border: 0;
  border-radius: 9px;
}

.explorer-results .case-card__body { min-height: 0; padding: 3px 8px; }
.explorer-results .case-card__title { color: #f3f6f8; font-size: .74rem; line-height: 1.65; -webkit-line-clamp: 2; }
.explorer-results .case-card__subtitle { display: none; }
.explorer-results .case-card__footer { padding-block-start: 4px; color: var(--teal-bright); font-size: .62rem; }
.explorer-results .case-card__footer span:first-child { display: none; }
.explorer-results .case-card__count { inset-block-start: 4px; inset-inline-start: 4px; padding: 3px 5px; font-size: .55rem; }
.browse-more-wrap { display: flex; justify-content: center; margin-block-start: 32px; }

/* Integrity and footer */
.integrity-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  border: 1px solid #b8d9bc;
  border-radius: var(--radius-lg);
  padding: 34px;
  background: linear-gradient(135deg, #e5f4e7, #f9fbf9);
}

.integrity-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--teal-dark);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(10, 90, 143, .22);
}

.integrity-card p { max-width: 820px; margin: 8px 0 0; color: #455864; }

.integrity-seal {
  width: 112px;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  border: 1px solid #acc3d2;
  border-radius: 50%;
  color: var(--teal-dark);
  text-align: center;
}

.integrity-seal strong,
.integrity-seal span { display: block; }
.integrity-seal strong { font-family: "Noto Kufi Arabic", sans-serif; font-size: 1.05rem; }
.integrity-seal span { font-size: .66rem; }

.site-footer {
  border-top: 1px solid rgba(174, 213, 179, .13);
  background: var(--night);
  color: var(--ink-on-dark);
}

.footer-inner {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.footer-brand { display: flex; align-items: center; gap: 13px; }
.footer-brand strong { font-family: "Noto Kufi Arabic", sans-serif; }
.footer-inner p { margin: 3px 0 0; color: #8f9da6; }
.footer-note { max-width: 530px; text-align: end; }

/* Case viewer */
dialog { padding: 0; border: 0; }

dialog::backdrop {
  background: rgba(4, 25, 38, .78);
  backdrop-filter: blur(12px);
}

.case-dialog {
  width: min(1440px, calc(100% - 24px));
  height: min(96dvh, 1080px);
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid rgba(150, 178, 197, .22);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 40px 140px rgba(0, 0, 0, .52);
}

.case-dialog[open] { animation: dialog-in .26s var(--ease) both; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.dialog-shell { height: 100%; overflow-y: auto; overscroll-behavior: contain; }

.dialog-bar {
  position: sticky;
  z-index: 20;
  inset-block-start: 0;
  min-height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line-dark);
  padding: 10px 18px;
  background: rgba(8, 33, 50, .96);
  color: var(--ink-on-dark);
  backdrop-filter: blur(18px);
}

.dialog-close,
.jump-match {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-dark);
  border-radius: 11px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, .055);
  color: #e2e9ed;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  transition: border-color .18s ease, background .18s ease;
}

.dialog-close { justify-self: start; }
.jump-match { justify-self: end; color: var(--teal-bright); }
.dialog-close:hover,
.jump-match:hover { border-color: rgba(82, 205, 99, .42); background: rgba(82, 205, 99, .1); }

.dialog-title-lockup { min-width: 0; text-align: center; }
.dialog-title-lockup strong,
.dialog-title-lockup span { display: block; }
.dialog-title-lockup strong { max-width: 48ch; overflow: hidden; color: #ffffff; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.dialog-category { color: #8f9ea8; font-size: .68rem; }

.case-nav {
  position: sticky;
  z-index: 15;
  inset-block-start: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 246, .94);
  backdrop-filter: blur(15px);
  scrollbar-width: none;
}

.case-nav::-webkit-scrollbar { display: none; }

.case-nav button {
  min-height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 9px;
  padding: 7px 13px;
  background: transparent;
  color: #5a6872;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
}

.case-nav button span { color: #9ba6ae; font-size: .64rem; }
.case-nav button:hover,
.case-nav button.is-active,
.case-nav button[aria-current="true"] { background: var(--teal-pale); color: var(--teal-dark); }

.case-detail { max-width: 1260px; margin-inline: auto; padding: 0 42px 56px; }

.case-detail__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 55px;
  align-items: end;
  padding: 58px 0 46px;
  border-bottom: 1px solid var(--line);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #c5e2c9;
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--teal-pale);
  color: var(--teal-dark);
  font-size: .75rem;
  font-weight: 700;
}

.source-badge span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-dark);
  color: #ffffff;
  font-size: .62rem;
}

.case-detail h2 {
  max-width: 960px;
  margin-block-start: 19px;
  font-size: clamp(1.65rem, 3.2vw, 2.85rem);
  white-space: pre-wrap;
}

.case-detail__subtitle {
  max-width: 900px;
  margin: 13px 0 0;
  color: #155884;
  font-size: .98rem;
  font-weight: 600;
  white-space: pre-wrap;
}

.source-preview {
  max-width: 900px;
  margin-block-start: 23px;
  padding: 16px 18px;
  border-inline-start: 3px solid var(--teal);
  border-radius: 0 12px 12px 0;
  background: #edf2f5;
}

.source-preview > span { color: var(--teal-dark); font-size: .73rem; font-weight: 700; }
.source-preview p { margin: 5px 0 0; color: #52626c; white-space: pre-wrap; }

.case-meta { display: grid; gap: 8px; margin: 0; }
.case-meta > div { border: 1px solid var(--line); border-radius: 13px; padding: 10px 13px; background: #ffffff; }
.case-meta dt { color: var(--ink-soft); font-size: .68rem; }
.case-meta dd { margin: 2px 0 0; font-size: .8rem; font-weight: 700; }

.detail-section { scroll-margin-top: 130px; padding-block: 46px; border-bottom: 1px solid var(--line); }
.detail-section:last-of-type { border-bottom: 0; }

.detail-section__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-block-end: 23px;
}

.detail-section__heading > div { display: flex; align-items: center; gap: 11px; }
.detail-section__heading h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }
.detail-section__heading p { margin: 0; color: var(--ink-soft); font-size: .79rem; }

.section-number {
  color: #909ea7;
  font-size: .72rem;
  font-weight: 700;
  direction: ltr;
}

/* Main case gallery */
.case-gallery-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 13px;
  margin-block-end: 24px;
}

.case-gallery-stage:has(#caseHeroImage:not([src])),
.case-gallery-stage:has(#caseHeroImage[src=""]) { display: none; }

.case-hero { position: relative; min-width: 0; }

.case-hero__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cedbd0;
  border-radius: 18px;
  padding: 0;
  background: #e6ebee;
  cursor: zoom-in;
}

.case-hero__media::after {
  content: "تكبير الصورة";
  position: absolute;
  inset-inline-end: 12px;
  inset-block-end: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(8, 33, 50, .76);
  color: #ffffff;
  font-size: .67rem;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(8px);
}

.case-hero__media:hover::after { opacity: 1; transform: none; }

.case-image-position {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-end: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(8, 33, 50, .78);
  color: #ffffff;
  font-size: .7rem;
  direction: ltr;
  backdrop-filter: blur(8px);
}

.case-image-nav {
  position: absolute;
  z-index: 3;
  inset-block-start: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(8, 33, 50, .78);
  color: #ffffff;
  cursor: pointer;
  font-size: 1.65rem;
  line-height: 1;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
  transition: background .18s ease, border-color .18s ease;
}

.case-image-nav:hover { border-color: var(--teal-bright); background: var(--teal-dark); }
.case-image-nav--prev { inset-inline-start: 12px; }
.case-image-nav--next { inset-inline-end: 12px; }
.case-hero__caption { margin: 10px 4px 0; color: #53616b; font-size: .82rem; white-space: pre-wrap; }

.case-thumbnails {
  max-height: 620px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  padding-inline-end: 2px;
  scrollbar-width: thin;
}

.case-thumbnails > button,
.case-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  background: #e8ecee;
  cursor: pointer;
}

.case-thumbnails > button:hover,
.case-thumbnails > button.is-active,
.case-thumbnail:hover,
.case-thumbnail.is-active,
.case-thumbnails > button[aria-current="true"] { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(45, 156, 60, .14); }

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.detail-image {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0;
  background: #ffffff;
  cursor: zoom-in;
  text-align: start;
  box-shadow: 0 4px 16px rgba(15, 62, 92, .04);
  transition: transform .2s var(--ease), border-color .2s ease, box-shadow .2s ease;
}

.detail-image:hover { transform: translateY(-3px); border-color: #9cb8cb; box-shadow: var(--shadow-sm); }

.detail-image__caption {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  padding: 11px 13px 13px;
  color: #52616b;
  font-size: .76rem;
  line-height: 1.7;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.detail-image__caption:empty { display: none; }
.load-more { display: block; margin: 25px auto 0; }

/* Case text */
.case-text-tools {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-block-end: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 5px 12px;
  background: #ffffff;
  color: var(--teal-dark);
}

.case-text-tools input { min-height: 40px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.case-text-tools p { margin: 0; color: var(--ink-soft); font-size: .72rem; }
.case-text-tools button { min-height: 34px; border: 0; border-radius: 9px; padding: 5px 10px; background: var(--teal-pale); color: var(--teal-dark); cursor: pointer; font-size: .74rem; font-weight: 700; }

.case-sections { display: grid; gap: 10px; }

.case-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.case-section[open] { border-color: #bed9c2; box-shadow: 0 9px 26px rgba(15, 62, 92, .055); }

.case-section summary {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 18px;
  cursor: pointer;
  color: #155884;
  font-weight: 700;
  white-space: pre-wrap;
  list-style: none;
}

.case-section summary::-webkit-details-marker { display: none; }

.case-section summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--paper-2);
  color: var(--teal-dark);
  font-size: 1.12rem;
  transition: background .18s ease, transform .18s ease;
}

.case-section[open] summary { border-bottom: 1px solid var(--line); }
.case-section[open] summary::after { content: "−"; background: var(--teal-pale); transform: rotate(180deg); }
.case-section__content { padding: 20px; }

.source-paragraph {
  margin: 0;
  color: #155884;
  font-size: .96rem;
  line-height: 2.05;
  white-space: pre-wrap;
}

.source-paragraph + .source-paragraph { margin-block-start: 15px; }
.source-paragraph mark,
.case-section mark { border-radius: 4px; padding-inline: 2px; background: #ffe7a8; color: #392b08; }

.related-cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }

.related-case {
  position: relative;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 42px 13px 14px;
  background: #ffffff;
  cursor: pointer;
  text-align: start;
  font-size: .8rem;
  font-weight: 700;
  white-space: pre-wrap;
  transition: color .18s ease, border-color .18s ease, transform .18s var(--ease);
}

.related-case::after { content: "←"; position: absolute; inset-inline-end: 14px; inset-block-start: 50%; color: #91a0aa; transform: translateY(-50%); transition: transform .18s var(--ease); }
.related-case:hover { color: var(--teal-dark); border-color: #98b4c7; transform: translateY(-2px); }
.related-case:hover::after { transform: translate(-4px, -50%); }

.outside-source-note {
  margin: 35px 0 0;
  padding: 18px;
  border: 1px dashed #becfc0;
  border-radius: 12px;
  background: #eef0f2;
  color: #657179;
  font-size: .78rem;
}

/* Full-screen image viewer */
.image-dialog {
  width: min(1320px, calc(100% - 24px));
  height: min(96dvh, 980px);
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid rgba(154, 182, 201, .22);
  border-radius: 20px;
  background: #071e2c;
  color: #ffffff;
  box-shadow: 0 40px 140px rgba(0, 0, 0, .68);
}

.image-dialog[open] { animation: dialog-in .22s var(--ease) both; }

.image-dialog__bar {
  position: absolute;
  z-index: 6;
  inset-block-start: 0;
  inset-inline: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  background: linear-gradient(to bottom, rgba(7, 28, 42, .9), transparent);
}

.image-dialog__bar button {
  min-height: 40px;
  border: 1px solid #4a5862;
  border-radius: 10px;
  padding: 7px 14px;
  background: rgba(7, 30, 44, .62);
  color: #ffffff;
  cursor: pointer;
}

.lightbox-counter {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(7, 30, 44, .65);
  color: #bdd0c0;
  font-size: .74rem;
  direction: ltr;
}

.image-dialog__media {
  width: 100%;
  height: calc(100% - 80px);
  display: grid;
  place-items: center;
  padding: 70px 74px 20px;
}

.image-dialog__media img { max-width: 100%; max-height: 100%; }

.lightbox-nav {
  position: absolute;
  z-index: 7;
  inset-block-start: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #505e68;
  border-radius: 50%;
  background: rgba(8, 33, 49, .78);
  color: #ffffff;
  cursor: pointer;
  font-size: 1.8rem;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}

.lightbox-nav:hover { border-color: var(--teal-bright); background: var(--teal-dark); }
.lightbox-nav--prev { inset-inline-start: 15px; }
.lightbox-nav--next { inset-inline-end: 15px; }

.image-dialog > p {
  min-height: 80px;
  overflow-y: auto;
  margin: 0;
  padding: 15px 25px 22px;
  color: #d4dbe0;
  text-align: center;
  white-space: pre-wrap;
}

.noscript {
  margin: 20px;
  border: 1px solid #ddc799;
  border-radius: 12px;
  padding: 14px;
  background: #fff8e8;
}

/* Tablet */
@media (max-width: 1040px) {
  :root { --shell: min(100% - 34px, 920px); }
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(290px, .75fr); gap: 40px; }
  .hero-orbit { width: min(330px, 35vw); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explorer-grid { grid-template-columns: 1fr 1fr; }
  .explorer-results-wrap { grid-column: 1 / -1; min-height: 200px; }
  .explorer-results { grid-template-columns: 1fr 1fr; }
  .case-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-cases { grid-template-columns: 1fr 1fr; }
  .case-detail__header { grid-template-columns: 1fr; gap: 25px; }
  .case-meta { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 760px) {
  :root { --shell: calc(100% - 24px); }
  html { scroll-padding-top: 118px; }

  .site-header { position: sticky; }
  .header-inner { min-height: 108px; flex-wrap: wrap; align-content: center; gap: 7px; padding-block: 8px; }
  .brand { width: 100%; justify-content: center; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .brand-mark svg { width: 24px; }
  .brand-copy strong { font-size: .79rem; }
  .brand-copy small { font-size: .65rem; }
  .main-nav { width: 100%; justify-content: center; }
  .main-nav button { min-height: 34px; flex: 1; justify-content: center; padding: 4px 7px; font-size: .72rem; }

  .source-banner__inner { min-height: 53px; flex-wrap: wrap; gap: 4px 8px; padding-block: 7px; font-size: .72rem; }
  .source-banner__stats { width: 100%; padding: 0; border: 0; }

  .hero { min-height: auto; padding: 58px 0 75px; }
  .hero-grid { grid-template-columns: 1fr; gap: 45px; }
  .hero h1 { font-size: clamp(2.15rem, 11vw, 3.35rem); line-height: 1.45; }
  .hero-lead { font-size: .96rem; }
  .search-box { margin-block-start: 27px; }
  .search-box__row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .search-box__submit { grid-column: 1 / -1; width: 100%; }
  .live-search { inset-inline: -2px; }
  .live-search__list { max-height: 42vh; }

  .hero-visual { margin-block-start: -10px; }
  .hero-orbit { width: min(280px, 82vw); }
  .hero-stats { width: 100%; }
  .hero-scroll { display: none; }

  .quick-section,
  .results-section,
  .browse-section { padding: 60px 0; }
  .explorer-section { padding-block: 0 60px; }
  .integrity-section { padding-block: 22px 65px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 11px; margin-block-end: 23px; }
  .section-heading--results { flex-direction: row; align-items: center; }
  .section-heading > p,
  .library-heading__actions > p { font-size: .86rem; }
  .library-heading__actions { width: 100%; justify-items: start; }

  .quick-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .quick-topic { min-height: 90px; padding: 12px; gap: 9px; }
  .quick-topic__mark { width: 39px; height: 39px; flex-basis: 39px; border-radius: 11px; font-size: .7rem; }
  .quick-topic__label { padding-inline-end: 5px; font-size: .82rem; }
  .quick-topic::after { display: none; }

  .orbit-topic { min-height: 34px; gap: 5px; padding: 4px 7px; font-size: .6rem; }
  .orbit-topic__mark { width: 22px; height: 22px; font-size: .56rem; }
  .orbit-topic--gums { inset-inline-end: -1%; }
  .orbit-topic--missing { inset-inline-start: -1%; }

  .explorer-shell { border-radius: 22px; padding: 24px 15px; }
  .explorer-head { margin-block-end: 21px; }
  .explorer-head h2 { font-size: 1.35rem; }
  .explorer-head__mark { display: none; }
  .explorer-grid { grid-template-columns: 1fr; }
  .explorer-step { min-height: auto; padding: 14px; }
  .explorer-results-wrap { grid-column: auto; }
  .explorer-groups,
  .explorer-options { display: flex; overflow-x: auto; padding-block-end: 5px; scrollbar-width: none; }
  .explorer-groups > button,
  .explorer-options > button,
  .explorer-group,
  .explorer-option { width: auto; min-width: max-content; flex: 0 0 auto; }
  .explorer-results { grid-template-columns: 1fr; }

  .case-grid { grid-template-columns: 1fr; gap: 13px; }
  .case-card { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: start; }
  .case-card__media { width: 108px; aspect-ratio: 4 / 3; margin: 14px 14px 14px 0; border: 1px solid var(--line); border-radius: 12px; }
  .case-card__body { min-height: 120px; padding: 14px 0 14px 14px; }
  .case-card__source { margin-block-end: 5px; font-size: .63rem; }
  .case-card h3,
  .case-card__title { font-size: .84rem; line-height: 1.7; -webkit-line-clamp: 2; }
  .case-card__subtitle { font-size: .72rem; -webkit-line-clamp: 1; }
  .case-card__preview { display: none; }
  .case-card__footer { padding-block-start: 8px; font-size: .68rem; }
  .case-card__footer span:first-child { display: none; }
  .case-card__count { inset-block-start: 5px; inset-inline-start: 5px; padding: 3px 6px; font-size: .58rem; }

  .integrity-card { grid-template-columns: auto 1fr; padding: 23px; }
  .integrity-icon { width: 48px; height: 48px; border-radius: 14px; }
  .integrity-seal { display: none; }
  .footer-inner { min-height: 190px; flex-direction: column; align-items: flex-start; justify-content: center; }
  .footer-note { text-align: start; }

  .case-dialog { width: 100%; height: 100dvh; border-radius: 0; }
  .dialog-bar { min-height: 62px; grid-template-columns: auto minmax(0, 1fr) auto; padding-inline: max(11px, env(safe-area-inset-left)); }
  .dialog-title-lockup strong { font-size: .7rem; }
  .dialog-category { max-width: 34vw; overflow: hidden; font-size: .6rem; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-close,
  .jump-match { min-height: 39px; padding: 6px 10px; font-size: .7rem; }
  .jump-match span { display: none; }
  .case-nav { inset-block-start: 62px; justify-content: flex-start; min-height: 49px; padding-inline: 8px; }
  .case-nav button { min-height: 35px; }
  .case-detail { padding: 0 15px calc(42px + env(safe-area-inset-bottom)); }
  .case-detail__header { grid-template-columns: 1fr; gap: 22px; padding: 37px 0 32px; }
  .case-detail h2 { font-size: 1.45rem; line-height: 1.75; }
  .case-meta { grid-template-columns: 1fr 1fr; }
  .case-meta > div:last-child { grid-column: 1 / -1; }
  .detail-section { scroll-margin-top: 116px; padding-block: 33px; }
  .detail-section__heading { align-items: flex-start; flex-direction: column; gap: 6px; }

  .case-gallery-stage { grid-template-columns: 1fr; }
  .case-thumbnails { grid-template-columns: repeat(5, minmax(68px, 1fr)); max-height: none; overflow-x: auto; padding-block-end: 4px; }
  .case-thumbnails > button,
  .case-thumbnail { min-width: 68px; }
  .case-image-nav { width: 40px; height: 40px; }
  .detail-gallery { grid-template-columns: 1fr; }
  .related-cases { grid-template-columns: 1fr; }
  .case-text-tools { grid-template-columns: auto minmax(0, 1fr) auto; }
  .case-text-tools p { grid-column: 1 / -1; }
  .source-paragraph { font-size: .92rem; line-height: 2; }

  .image-dialog { width: 100%; height: 100dvh; border-radius: 0; }
  .image-dialog__media { height: calc(100% - 105px); padding: 64px 48px 12px; }
  .lightbox-nav { width: 42px; height: 42px; }
  .lightbox-nav--prev { inset-inline-start: 7px; }
  .lightbox-nav--next { inset-inline-end: 7px; }
  .image-dialog > p { min-height: 105px; padding: 13px 18px calc(18px + env(safe-area-inset-bottom)); font-size: .8rem; }
}

@media (max-width: 430px) {
  .quick-grid { grid-template-columns: 1fr; }
  .quick-topic { min-height: 70px; }
  .section-heading--results { align-items: flex-start; flex-direction: column; }
  .case-card { grid-template-columns: 112px minmax(0, 1fr); }
  .case-card__media { width: 96px; }
  .case-meta { grid-template-columns: 1fr; }
  .case-meta > div:last-child { grid-column: auto; }
  .case-thumbnails { grid-template-columns: repeat(4, minmax(66px, 1fr)); }
  .dialog-close span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
