/* Home page, laid out from the approved design (home-figma-3): hero, online programs' logos, «رسالتي», programs over
   the globe, «النتاج المرئي», books shelf. Type, colours, buttons, chips and arrows are the site's own (core.css,
   pages.css: .display .lead .btn .chip .fchip .rail-ctl .meta, on-night); this file only lays the sections out.
   Every class is prefixed hm-. Motion runs right to left. What needs no script is CSS, so the first screen never
   waits for one; HomeBehaviour adds the rest. Reduced motion shows everything at rest. */

.hm {
  --hm-band: color-mix(in oklab, #5D9DC1 18%, #D8EAF4);   /* fixed: the hero and «رسالتي» look the same on both themes */
  --hm-gutter: clamp(16px, 5vw, 88px); --hm-maxw: 1320px;
  background: var(--night); overflow-x: clip;
}
/* section titles at the design's size, in the site display face (it draws small on its em) */
.hm .display { font-size: clamp(5rem, 11vw, 11.5rem); line-height: .9; margin-block-end: var(--s-4); }
.hm .lead { color: inherit; opacity: .92; max-width: 40em; }

/* ── The site header on the home page takes the hero's night colour, so the first screen reads as one piece ── */

/* ── 1 · Hero ── */
.hm-hero.on-night {
  position: relative; isolation: isolate; overflow: hidden;
  height: max(640px, calc(100svh - var(--header-h) - env(safe-area-inset-top))); max-height: 1000px;   /* under the site header */
  background:
    radial-gradient(60% 55% at 28% 38%, color-mix(in oklab, var(--sky) 26%, transparent), transparent 70%),
    linear-gradient(180deg, var(--night-2) 0%, var(--night-3) 45%, color-mix(in oklab, var(--sky) 30%, var(--night-3)) 62%, color-mix(in oklab, #5D9DC1 45%, #D8EAF4) 80%, var(--hm-band) 100%);
}
.hm-hero-stripes { position: absolute; inset: 0; z-index: -1;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 2px, transparent 2px 9px, rgba(0,0,0,.07) 9px 11px, transparent 11px 18px); }
.hm-hero-stripes::after { content: ""; position: absolute; inset: 58% 0 0 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.16) 0 3px, transparent 3px 12px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 45%, #000 82%, transparent); mask-image: linear-gradient(180deg, transparent, #000 45%, #000 82%, transparent); }
.hm-hero-glow { position: absolute; z-index: -1; width: 56vw; height: 56vw; left: 4vw; top: -6%; border-radius: 50%; background: radial-gradient(circle, color-mix(in oklab, var(--sky) 16%, transparent), transparent 60%); }
.hm-hero-grid { position: absolute; inset: 0; z-index: 2; max-width: 1600px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; padding: 0 var(--hm-gutter); }

/* the photo: top right, the shoulders whole, its lower edge melting into the light band. It comes in after the
   background (the design's order), by CSS alone so it never waits for a script. */
.hm-hero-photo { margin: 0; position: relative; z-index: 1; justify-self: start;
  margin-inline-start: calc(var(--hm-gutter) * -.6); margin-top: clamp(24px, 4vh, 48px);
  height: clamp(400px, min(70vh, 47vw), 740px); aspect-ratio: 2940 / 2070;
  animation: hm-photo-in 1.5s var(--ease-out) .4s both; }
.hm-hero-photo img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 0;
  -webkit-mask-image: linear-gradient(180deg, #000 60%, rgba(0,0,0,.55) 80%, transparent 97%); mask-image: linear-gradient(180deg, #000 60%, rgba(0,0,0,.55) 80%, transparent 97%); }
@keyframes hm-photo-in { from { opacity: 0; transform: translateY(16px); filter: brightness(.8); } }

.hm-hero-text { position: relative; z-index: 2; align-self: start; justify-self: center; width: 100%; max-width: 640px; margin-top: clamp(140px, 24vh, 240px); text-align: center; }
.hm-hero-name { position: relative; margin: 0 auto; width: 100%; aspect-ratio: 958 / 221; filter: drop-shadow(0 6px 24px rgba(0,0,0,.35)); }
.hm-hero-name img, .hm-hero-name video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* the still name is uncovered right to left in one stroke, after the photo; the clip takes its place where it can */
.hm-hero-name img { -webkit-mask-image: linear-gradient(to left, #000 46%, transparent 54%); mask-image: linear-gradient(to left, #000 46%, transparent 54%);
  -webkit-mask-size: 260% 100%; mask-size: 260% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
  animation: hm-write 2.1s cubic-bezier(.55, .1, .35, 1) 1.1s both; }
@keyframes hm-write { from { -webkit-mask-position: 0 0; mask-position: 0 0; } }
.hm-hero-name video { opacity: 0; pointer-events: none; }
.hm-hero-name.is-video video { opacity: 1; }
.hm-hero-name.is-video img, .hm-hero-name.is-video-wait img { visibility: hidden; }
.hm-hero-name.is-still-now img { visibility: visible; animation: none; }
.hm-hero-cv { margin-top: clamp(26px, 3.4vw, 44px); animation: hm-rise 1s var(--ease-out) 3.1s both; }
@keyframes hm-rise { from { opacity: 0; transform: translateY(10px); } }

/* the online programs' logos, inside the first screen (the site marquee, dressed for the hero's light band) */
.hm-logos.marquee { position: absolute; z-index: 3; inset: auto 0 clamp(18px, 3.5vh, 40px) 0; border: 0; padding-block: 8px; gap: clamp(48px, 7vw, 110px); }
.hm-logos .marquee-row { gap: clamp(48px, 7vw, 110px); }
.hm-logos.is-running .marquee-row { animation-duration: 95s; }
.hm-logos .marquee-row img { block-size: clamp(52px, 7.5vh, 84px); max-inline-size: 220px; filter: none; mix-blend-mode: normal; opacity: .82; }
/* coloured program logos drawn in the strip's single dark tone */
.hm-logos .marquee-row img.is-tinted { filter: brightness(0) saturate(0); opacity: .74; }
@media (hover: hover) { .hm-logos .marquee-row a:hover img { filter: none; opacity: 1; } }
/* ── 2 · «رسالتي» ── */
.hm-risala { position: relative; isolation: isolate; overflow: hidden; text-align: center; color: var(--on-night);
  padding: clamp(80px, 11vw, 150px) var(--hm-gutter) clamp(90px, 9vw, 130px);
  background: linear-gradient(180deg, var(--hm-band) 0%, color-mix(in oklab, #5D9DC1 30%, #D8EAF4) 40%, color-mix(in oklab, var(--sky) 45%, var(--night-3)) 64%, var(--night-3) 84%, var(--night-2) 96%, var(--night-2) 100%); }
.hm-risala-ghost { position: absolute; inset: -10% -20% 10%; z-index: -1; opacity: .08; pointer-events: none;
  background: center 40% / 150% auto no-repeat; filter: brightness(3) blur(.5px);   /* the image: inline, same URL as the title */
  transform: translateY(var(--ghost, 0));
  -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent 72%); mask-image: linear-gradient(180deg, #000 35%, transparent 72%); }
.hm-risala-in { position: relative; z-index: 3; max-width: 980px; margin: 0 auto; }
.hm-risala-lead { margin: 0 0 4px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.8rem, 4.4vw, 4rem); line-height: .9; color: #0A2131; }   /* on the light band in both themes */
.hm-risala-title { margin: 0; }
.hm-ihya { position: relative; display: block; width: min(860px, 92%); margin: 0 auto; aspect-ratio: 1600 / 412; filter: drop-shadow(0 8px 30px rgba(20, 40, 55, .35)); }
.hm-ihya video, .hm-ihya img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hm-ihya video { opacity: 0; transition: opacity .3s; }
.hm-ihya.is-video video { opacity: 1; }
.hm-ihya.is-video img { visibility: hidden; }
/* armed by the script: hidden until it comes into view, then the clip or the still reveal */
.hm-ihya.is-armed:not(.is-video):not(.is-reveal) img { opacity: 0; }
.hm-ihya.is-reveal img { -webkit-mask-image: linear-gradient(to left, #000 44%, transparent 56%); mask-image: linear-gradient(to left, #000 44%, transparent 56%);
  -webkit-mask-size: 230% 100%; mask-size: 230% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0; animation: hm-ihya 3.6s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes hm-ihya { from { -webkit-mask-position: 0 0; mask-position: 0 0; } }
.hm-risala-btn { margin-top: clamp(26px, 3vw, 42px); }
/* the hero and «رسالتي» buttons: the design's glass (neither white nor ink) in the site's pill shape. A light edge,
   a sheen that crosses on hover, and a line with a lit point that runs out to its end. */
.hm-glass { position: relative; isolation: isolate; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  min-inline-size: 250px; max-inline-size: 100%; min-block-size: 52px; padding: .7em 1.9em;
  font-family: var(--f-ui); font-weight: 500; font-size: 1.12rem; line-height: 1.4; color: #F0FAFF; white-space: nowrap; border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(240, 250, 255, .12), rgba(240, 250, 255, .04));
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(240, 250, 255, .22), 0 14px 34px -16px rgba(0, 10, 15, .7);
  transition: box-shadow .6s var(--ease-out), transform var(--d-1) var(--ease-out); }
.hm-glass-dark { background: linear-gradient(180deg, rgba(36, 58, 74, .82), rgba(20, 36, 48, .82)); }   /* over the light band */
.hm-glass:active { transform: scale(.97); }
.hm-glass::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(255deg, transparent 32%, rgba(240, 250, 255, .12) 50%, transparent 68%);
  transform: translateX(110%); transition: transform 0s; }
.hm-glass::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(240, 250, 255, .5), rgba(240, 250, 255, .08) 40%, color-mix(in oklab, var(--sky) 60%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.hm-glass-line { --k: .8; container-type: inline-size; position: relative; flex: 0 0 72px; block-size: 9px; }
.hm-glass-line::after { content: ""; position: absolute; inset: 4px 0 auto 0; block-size: 1px; background: linear-gradient(to right, rgba(240, 250, 255, .95), rgba(240, 250, 255, .28));
  transform-origin: right center; transform: scaleX(var(--k)); transition: transform 1s var(--ease-io); }
.hm-glass-line::before { content: ""; position: absolute; left: -3px; top: 1px; inline-size: 7px; block-size: 7px; border-radius: 50%; background: #F0FAFF;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--sky) 30%, transparent), 0 0 12px color-mix(in oklab, var(--sky) 85%, transparent);
  transform: translateX(calc((1 - var(--k)) * 100cqw)); transition: transform 1s var(--ease-io); }
@media (hover: hover) {
  .hm-glass:hover { box-shadow: inset 0 1px 0 rgba(240, 250, 255, .28), 0 18px 38px -16px rgba(0, 10, 15, .75), 0 0 0 3px color-mix(in oklab, var(--sky) 14%, transparent); }
  .hm-glass:hover::before { transform: translateX(-110%); transition: transform 1.6s var(--ease-io); }
  .hm-glass:hover .hm-glass-line { --k: 1; }
}
.hm-glass:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hm-glass::before, .hm-glass-line::before, .hm-glass-line::after { transition: none; } }
@media (max-width: 560px) { .hm-glass { min-inline-size: 220px; font-size: 1.02rem; } }

/* ── 3 · Programs over the globe ── */
.hm-projects.on-night { position: relative; isolation: isolate; overflow: hidden; min-height: 760px; display: grid; align-items: center;
  padding: clamp(60px, 7vw, 100px) var(--hm-gutter) clamp(80px, 8vw, 120px); scroll-margin-top: var(--header-h);
  background: linear-gradient(180deg, var(--night-2) 0, transparent 240px), radial-gradient(60% 70% at 25% 50%, var(--night-3) 0%, var(--night-2) 55%, var(--night) 100%); }
.hm-projects::after { content: ""; position: absolute; inset: auto 0 0; height: 160px; z-index: 1; pointer-events: none; background: linear-gradient(transparent, var(--night)); }
.hm-globe { position: absolute; z-index: 0; height: min(100%, 64vw, 980px); aspect-ratio: 1; left: -12vw; top: 50%; translate: 0 -50%; }   /* never taller than the section, so it is never cut flat */
.hm-globe canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.6s; touch-action: pan-y; }
.hm-globe.gl canvas { opacity: 1; cursor: grab; }
.hm-globe-still { position: absolute; inset: 4%; width: 92%; height: 92%; filter: grayscale(1) contrast(1.05) brightness(.95); transition: opacity 1s; }
.hm-globe.gl .hm-globe-still { opacity: 0; }
.hm-projects-in { position: relative; z-index: 2; width: 100%; max-width: var(--hm-maxw); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; pointer-events: none; }
.hm-projects-in > * { pointer-events: auto; min-width: 0; max-width: 100%; }
.hm-projects-text { max-width: 600px; }
.hm-projects-text .lead { text-align: justify; margin: 0 0 var(--s-5); }
.hm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.hm .on-night .fchip { background: transparent; color: var(--on-night); border-color: var(--line-night); }
.hm .on-night .fchip .icon { color: var(--sky); }
.hm .on-night .fchip[aria-pressed="true"] { background: var(--sky); color: var(--ink); border-color: var(--sky); }
.hm .on-night .fchip[aria-pressed="true"] .icon { color: var(--ink); }
@media (hover: hover) { .hm .on-night .fchip:hover { border-color: var(--sky); } }

/* the programs card: dark glass over the globe */
.hm-pcard { position: relative; overflow: hidden; margin-top: clamp(30px, 4vw, 44px); width: min(680px, 100%);
  background: linear-gradient(160deg, color-mix(in oklab, var(--night-3) 70%, transparent), color-mix(in oklab, var(--night) 76%, transparent));
  border: 1px solid var(--line-night); border-radius: var(--r-3); padding: 24px 24px 18px;
  -webkit-backdrop-filter: blur(16px) saturate(1.15); backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.9); }
.hm-pcard:focus-visible { outline: 2px solid var(--sky); outline-offset: 4px; }
.hm-pcard-viewport { position: relative; overflow: hidden; touch-action: pan-y; cursor: grab; transition: height .8s var(--ease-out); }
.hm-pcard-viewport:active { cursor: grabbing; }
.hm-pcard-track { display: flex; align-items: flex-start; transition: transform 1.05s cubic-bezier(.65, 0, .35, 1); }
.hm-pslide { flex: 0 0 100%; display: flex; flex-direction: column; gap: var(--s-3); user-select: none; padding: 2px; min-width: 0; }
.hm-pslide-top { display: flex; align-items: center; gap: 18px; min-width: 0; }
.hm-pslide-logo { flex: none; width: 96px; aspect-ratio: 1; border-radius: var(--r-3); background: var(--white); display: grid; place-items: center; padding: 11px; overflow: hidden; }
.hm-pslide-logo img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.hm-ph { font-family: var(--f-ui); font-size: .9rem; font-weight: 600; color: var(--ink); text-align: center; line-height: 1.5; }
.hm-pslide-head { min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.hm-pslide-title { margin: 0; }
.hm .on-night .hm-pslide-sub { color: var(--on-night-2); }
.hm .on-night .hm-pslide-sub .icon { color: var(--sky); }
.hm-pslide-desc { margin: 0; line-height: 1.85; color: var(--on-night-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hm-pslide-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.hm-pcard-nav { display: flex; align-items: center; gap: var(--s-4); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-night); }
.hm-pcard-count { display: flex; align-items: baseline; gap: 6px; font-family: var(--f-ui); font-size: .9rem; color: var(--on-night-3); font-variant-numeric: tabular-nums; }
.hm-pcard-count b { font-size: 1.15rem; font-weight: 600; color: var(--on-night); }
.hm-pcard-bar { flex: 1; height: 2px; border-radius: 2px; background: var(--line-night); overflow: hidden; }
.hm-pcard-bar i { display: block; height: 100%; background: var(--sky); transform-origin: right; transform: scaleX(0); }
.hm-pcard-bar i.run { transform: scaleX(1); transition: transform var(--auto, 8s) linear; }

/* ── 4 · «النتاج المرئي» ── */
.hm-visual.on-night { position: relative; isolation: isolate; overflow: hidden; background: var(--night); padding: clamp(120px, 13vw, 190px) var(--hm-gutter) clamp(150px, 15vw, 220px); }
.hm-visual-bg { position: absolute; inset: -60px -10vw; z-index: -2; display: grid; gap: 14px; align-content: center; transform: rotate(-2.5deg) scale(1.06); }
.hm-vrow { display: flex; gap: 14px; width: max-content; animation: hm-drift var(--dur, 120s) linear infinite; }
@keyframes hm-drift { to { transform: translateX(50%); } }
.hm-vcover { width: clamp(220px, 21vw, 330px); aspect-ratio: 16/9; border-radius: var(--r-2); overflow: hidden; flex: none; background: var(--night-3); filter: grayscale(.55) brightness(.55); }
.hm-vcover img { width: 100%; height: 100%; object-fit: cover; }
.hm-visual-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(270deg, rgba(0,10,15,.9) 0%, rgba(0,10,15,.55) 32%, rgba(0,10,15,.62) 56%, rgba(0,10,15,.92) 100%),
    linear-gradient(180deg, var(--night) 0, rgba(0,10,15,.6) 14%, transparent 30%, transparent 76%, rgba(0,10,15,.8)); }
.hm-visual-in > .lead { margin: 0 0 var(--s-6); text-shadow: 0 2px 16px rgba(0,0,0,.7); }
.hm-stats { max-inline-size: 760px; }
/* the site section head, its title at the design's larger size */
.hm .sx-head .h2 { font-size: clamp(3.8rem, 7.5vw, 6.8rem); }

/* ── 5 · Books shelf ── */
.hm-books { position: relative; z-index: 2; margin-top: -48px; background: var(--paper); color: var(--ink); border-radius: 48px 48px 0 0; padding: clamp(64px, 7vw, 100px) 0 clamp(56px, 5vw, 80px); overflow: hidden; }
.hm-books::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 520px; pointer-events: none; background-color: var(--sky); opacity: .07;
  -webkit-mask: url("../brand/khatam.svg") 0 0 / 92px 92px repeat; mask: url("../brand/khatam.svg") 0 0 / 92px 92px repeat; }
.hm-books::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 540px; pointer-events: none; background: linear-gradient(180deg, transparent 0%, var(--paper) 92%); }
.hm-books > .wrap { position: relative; z-index: 1; }
.hm-books-lead { margin: calc(-1 * var(--s-3)) 0 var(--s-5); color: var(--ink-80); }

.hm-shelf { position: relative; z-index: 1; margin-top: clamp(26px, 3vw, 38px); padding: 0 var(--hm-gutter); --bw: clamp(196px, 18vw, 262px); }
.hm-shelf-stage { position: relative; height: calc(var(--bw) * 1.49 + 4px); max-width: 1180px; margin: 0 auto; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
/* the script places, scales and fades each book every frame (transform and opacity only) */
.hm-sbook { position: absolute; left: calc(50% - var(--bw) / 2); bottom: 0; width: var(--bw); aspect-ratio: 1 / 1.48; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 100%; will-change: transform, opacity; -webkit-tap-highlight-color: transparent; }
.hm-sbook-lift { position: relative; display: block; width: 100%; height: 100%; transition: transform .6s var(--ease-out), opacity .3s; }
.hm-sbook img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px 3px 3px 8px; box-shadow: var(--shadow-2), 0 40px 52px -28px rgba(0,10,15,.55); pointer-events: none; }
.hm-sbook-veil { position: absolute; inset: 0; border-radius: 8px 3px 3px 8px; background: var(--paper); opacity: 0; pointer-events: none; }
.hm-sbook::after { content: ""; position: absolute; inset: 0; border-radius: 8px 3px 3px 8px; pointer-events: none; background: linear-gradient(to left, rgba(0,0,0,.2), rgba(255,255,255,.08) 3%, transparent 7%); }
.hm-sbook[aria-hidden="true"] { pointer-events: none; }
@media (hover: hover) { .hm-sbook:hover .hm-sbook-lift { transform: translateY(-6px); } .hm-sbook.is-center:hover .hm-sbook-lift { transform: translateY(-10px); } }
.hm-shelf-stage.is-dragging, .hm-shelf-stage.is-dragging .hm-sbook { cursor: grabbing; }
.hm-shelf-stage.is-dragging .hm-sbook-lift { transform: none; }
.hm-sbook.is-away .hm-sbook-lift { opacity: 0; transition: none; }
.hm-sbook:focus-visible { outline: none; }
.hm-sbook:focus-visible .hm-sbook-lift { outline: 2px solid var(--sky-deep); outline-offset: 6px; border-radius: 6px; }
.hm-shelf-floor { width: min(860px, 84%); height: 22px; margin: 0 auto; background: radial-gradient(50% 100% at 50% 0, rgba(0,10,15,.18), transparent 72%); }
.hm-shelf-ctrl.rail-ctl { display: flex; align-items: center; justify-content: center; gap: clamp(18px, 4vw, 56px); margin-top: 10px; }
.hm-shelf-caption { text-align: center; width: min(440px, 62vw); min-height: 4.4em; }
.hm-shelf-caption > * { display: block; transition: opacity .4s var(--ease-out), transform .55s var(--ease-out); }
.hm-shelf-caption.is-out > * { opacity: 0; transform: translateX(calc(var(--dir, 1) * 14px)); transition-duration: .15s; transition-timing-function: ease-in; }
.hm-shelf-caption.is-pre > * { opacity: 0; transform: translateX(calc(var(--dir, 1) * -14px)); transition: none; }
.hm-shelf-caption h3 { margin: 0 0 var(--s-2); }
.hm-shelf-caption span { font-family: var(--f-ui); font-size: var(--t-sm); color: var(--ink-60); transition-delay: .04s; }

/* the book card over a blurred page */
body.hm-modal-open { overflow: hidden; }
.hm-bmodal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; }
.hm-bmodal::before { content: ""; position: absolute; inset: 0; background: color-mix(in oklab, var(--night) 46%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1); opacity: 0; transition: opacity .5s var(--ease-out); }
.hm-bmodal.on::before { opacity: 1; }
.hm-bmodal-card { position: relative; width: min(900px, 100%); max-height: calc(100svh - 48px); overflow: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; align-items: start; padding: 36px;
  border-radius: var(--r-3); background: var(--paper); color: var(--ink); box-shadow: 0 50px 100px -40px rgba(0,0,0,.75);
  opacity: 0; transform: translateY(18px); transition: opacity .5s var(--ease-out), transform .7s var(--ease-out); }
.hm-bmodal.on .hm-bmodal-card { opacity: 1; transform: none; }
.hm-bmodal-coverbox { position: sticky; top: 0; }
.hm-bmodal-cover { display: block; width: 100%; border-radius: 3px 10px 10px 3px; box-shadow: 0 34px 54px -26px rgba(0,10,15,.6); }
.hm-bmodal.is-flying .hm-bmodal-cover { opacity: 0; }
.hm-bflyer { position: fixed; z-index: 95; margin: 0; object-fit: cover; border-radius: 3px 10px 10px 3px; box-shadow: 0 34px 54px -26px rgba(0,10,15,.6); transform-origin: 0 0; pointer-events: none; will-change: transform; }
.hm-bmodal-body { display: grid; align-content: start; gap: var(--s-3); }
.hm-bmodal-body > * { opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease-out), transform .7s var(--ease-out); }
.hm-bmodal.on .hm-bmodal-body > * { opacity: 1; transform: none; }
.hm-bmodal.on .hm-bmodal-body > :nth-child(1) { transition-delay: .18s; } .hm-bmodal.on .hm-bmodal-body > :nth-child(2) { transition-delay: .24s; }
.hm-bmodal.on .hm-bmodal-body > :nth-child(3) { transition-delay: .3s; } .hm-bmodal.on .hm-bmodal-body > :nth-child(4) { transition-delay: .36s; }
.hm-bmodal.on .hm-bmodal-body > :nth-child(5) { transition-delay: .42s; } .hm-bmodal.on .hm-bmodal-body > :nth-child(6) { transition-delay: .48s; }
.hm-bmodal-cat { justify-self: start; }
.hm-bmodal-cat:empty { display: none; }
.hm-bmodal-title { margin: var(--s-2) 0 0; }
.hm-bmodal-desc { margin: var(--s-2) 0; line-height: 1.95; text-wrap: pretty; }
.hm-bmodal-aud { display: grid; gap: 2px; padding: 14px 18px; border-radius: var(--r-3); background: var(--sky-10); border: 1px solid var(--sky-20); }
.hm-bmodal-aud b { font-family: var(--f-ui); font-size: var(--t-sm); font-weight: 600; color: var(--sky-deep); }
.hm-bmodal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
.hm-bmodal-close { position: absolute; top: 14px; left: 14px; z-index: 2; }

/* ── Tablets and phones ── */
@media (max-width: 1100px) {
  /* hero: the photo on top, the name over its melting edge, then the button, then the logos */
  .hm-hero.on-night { height: auto; max-height: none; padding-bottom: 126px; }
  .hm-hero-grid { position: relative; inset: auto; grid-template-columns: minmax(0, 1fr); padding: 0 20px; }
  .hm-hero-photo { justify-self: center; margin-inline-start: 0; height: auto; width: min(114vw, 660px); margin-top: 8px; }
  .hm-hero-photo img { -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 86%); mask-image: linear-gradient(180deg, #000 45%, transparent 86%); }
  .hm-hero-text { margin-top: max(-21vw, -150px); max-width: 520px; justify-self: center; }
  .hm-hero-name { width: 94%; }
  .hm-hero-cv { margin-top: 18px; }
  .hm-hero-stripes::after { inset: 62% 0 0 0; }
  .hm-logos.marquee { inset: auto 0 22px 0; }
}
@media (max-width: 860px) {
  .hm-logos .marquee-row img { block-size: 50px; }
  .hm-risala { padding-top: 64px; padding-bottom: 64px; }
  .hm-projects.on-night { display: block; min-height: 0; padding: 48px 18px 56px; }
  .hm-globe { height: auto; width: 160vw; left: -30vw; top: auto; bottom: -62vw; translate: 0 0; opacity: .8;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 26%, #000 48%, transparent 60%); mask-image: linear-gradient(180deg, transparent 0, #000 26%, #000 48%, transparent 60%); }
  .hm-chips > .btn { flex-basis: 100%; }
  .hm-projects-in { justify-items: stretch; }
  .hm-projects-text .lead { text-align: start; }
  .hm-pcard { width: 100%; margin-top: 30px; padding: 18px 16px 14px; }
  .hm-pslide-top { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 14px; row-gap: 10px; align-items: center; }
  .hm-pslide-head { display: contents; }
  .hm-pslide-sub { grid-column: 1 / -1; }
  .hm-pslide-logo { width: 64px; padding: 8px; }
  .hm-pslide-desc { -webkit-line-clamp: 4; }
  .hm-pcard-nav { gap: 12px; margin-top: 16px; }
  .hm-visual.on-night { padding: 60px 20px 110px; }
  .hm-visual-shade { background: linear-gradient(180deg, rgba(0,10,15,.92) 0%, rgba(0,10,15,.75) 18%, rgba(0,10,15,.62) 60%, rgba(0,10,15,.92) 100%); }
  .hm-visual-in { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .hm-books { border-radius: 30px 30px 0 0; }
  .hm-shelf { padding: 0 12px; --bw: 172px; }
  .hm-shelf-ctrl.rail-ctl { gap: 10px; }
  .hm-shelf-caption { width: auto; flex: 1; }
  .hm-bmodal { padding: 10px; align-items: end; }
  .hm-bmodal-card { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 26px 20px 22px; max-height: calc(100svh - 20px); }
  .hm-bmodal-coverbox { position: static; width: 136px; margin: 0 auto; }
  .hm-bmodal-actions { grid-template-columns: minmax(0, 1fr); }
}

/* Reduced motion: everything at rest and visible */
@media (prefers-reduced-motion: reduce) {
  .hm *, .hm *::before, .hm *::after, .hm-bmodal, .hm-bmodal * { animation: none !important; transition-duration: .001s !important; }
  .hm-hero-name img { -webkit-mask-image: none; mask-image: none; }
}
