/* واجهة الرئيسية: المبنى يُنشأ من المخطط، وفي أعلى اليمين هوية النادي ثابتة، ثم مؤشر المراحل، ثم قصة النادي. */
.build-hero {
  --lav: #C9B6F2; --purple: #4B2E83; --purple-deep: #5A3A9A; --ink: #0c1220;
  position: relative; height: 600vh; background: var(--ink);
}
.bh-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--ink); color: var(--cream); }
.bh-poster, .bh-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bh-poster { max-width: none; object-fit: cover; object-position: 30% 50%; }
.build-hero.has-plate .bh-poster { visibility: hidden; }

/* اللوحة: موضعها ومقاسها يحسبهما build.js، فتبقى يمين المبنى وفوق حافة الطاولة */
.bh-panel {
  position: absolute; z-index: 3; inset-inline-start: clamp(24px, 6.5vw, 120px);
  top: var(--panel-top, 76px); block-size: var(--panel-h, 70vh); inline-size: var(--panel-w, min(500px, 38vw));
  display: flex; flex-direction: column; gap: 18px;
}

.bh-panel :is(h1, h2, p) { margin: 0; }

/* هوية النادي */
.bh-id { flex: none; display: grid; gap: 10px; justify-items: start; }
.bh-mark { inline-size: 44px; block-size: auto; filter: drop-shadow(0 4px 14px rgb(0 0 0 / .4)); }
.bh-id-text { display: grid; gap: 8px; }
.bh-name { font-size: clamp(2.2rem, 1rem + 2.2vw, 3.5rem); line-height: 1.22; font-weight: 700; color: var(--cream); text-wrap: balance; }
.bh-name span { display: block; color: var(--lav); }
.bh-uni { font-size: 16px; font-weight: 600; color: rgb(247 245 239 / .8); }
.bh-id > * { opacity: 0; transform: translateY(14px); transition: opacity .9s ease, transform 1.1s var(--ease-film); }
.bh-id > :nth-child(2) { transition-delay: .1s; }
.scene-ready .bh-id > * { opacity: 1; transform: none; }

/* مؤشر المراحل */
.bh-hud {
  flex: none; display: grid; gap: 10px; font-size: 13px; font-weight: 600; color: rgb(247 245 239 / .5);
  opacity: 0; transition: opacity 1s ease .4s;
}
.scene-ready .bh-hud { opacity: 1; }
.bh-steps { list-style: none; display: flex; justify-content: space-between; margin: 0; padding: 0; }
.bh-steps li { transition: color .4s ease; }
.bh-steps li.done { color: rgb(247 245 239 / .8); }
.bh-steps li.on { color: var(--cream); }
.bh-bar { position: relative; block-size: 2px; background: rgb(247 245 239 / .18); }
.bh-bar i { position: absolute; inset: 0; background: var(--lav); transform-origin: 100% 50%; transform: scaleX(0); }

/* نافذة المحتوى: المجموعات تتحرك داخلها وتتلاشى عند حدّيها */
.bh-window {
  position: relative; flex: 1; min-block-size: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22px, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 22px, #000 calc(100% - 26px), transparent);
}
.bh-g { display: grid; justify-items: start; align-content: start; gap: 10px; padding-block: 22px 26px; }
.bh-g { position: absolute; inset-inline: 0; top: 0; will-change: transform; transform: translateY(var(--y, 120%)); }

/* سطور العناوين تصعد من خلف قناع، والأيقونة تُرسم، ثم يظهر الوصف والرابط */
.bh-g .ln { display: block; overflow: hidden; padding-block: .04em .32em; margin-block: -.04em -.32em; }
.bh-g .ln > span { display: inline-block; transform: translateY(140%) rotate(-2deg); transform-origin: 100% 100%; transition: transform 1.1s var(--ease-film); }
.bh-g .ln + .ln > span { transition-delay: .08s; }
.bh-g.in .ln > span { transform: none; }
.bh-lead, .bh-intro .actions, .bh-feat p, .bh-feat .go {
  opacity: 0; transform: translateY(14px); transition: opacity .9s ease .18s, transform 1.1s var(--ease-film) .18s;
}
.bh-intro .actions, .bh-feat .go { transition-delay: .34s; }
.bh-g.in :is(.bh-lead, .actions, p, .go) { opacity: 1; transform: none; }

/* العبارة */
.bh-say { margin: 0; font-size: clamp(2rem, 1rem + 2vw, 3.2rem); line-height: 1.28; font-weight: 700; color: var(--cream); text-shadow: 0 10px 30px rgb(0 0 0 / .45); }

/* التعريف والأزرار */
.bh-lead { margin: 0; font-size: clamp(16px, .8rem + .4vw, 19px); line-height: 1.8; color: rgb(247 245 239 / .9); max-width: 40ch; }
.bh-intro .actions { margin-block-start: 6px; }
.bh-intro .btn-ring { color: var(--cream); border-color: rgb(247 245 239 / .6); }
.bh-intro .btn-ring:hover { background: rgb(255 255 255 / .1); }
.bh-intro .btn-solid:hover { background: var(--purple-deep); }

/* المجالات ومبادرة «جسر» */
.bh-feat { color: inherit; text-decoration: none; gap: 8px; }
.bh-feat .ico { inline-size: 36px; block-size: 36px; margin-block-end: 4px; color: #F9F9F9; overflow: visible; }
.bh-feat .ico .d { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.3s var(--ease-film) .1s; }
.bh-feat .ico .f { transform: scale(.85); opacity: 0; transform-box: fill-box; transform-origin: center; transition: transform .9s var(--ease-film) .35s, opacity .5s ease .35s; }
.bh-feat.in .ico .d { stroke-dashoffset: 0; }
.bh-feat.in .ico .f { transform: none; opacity: 1; }
.bh-feat h2 { margin: 0; font-size: clamp(1.6rem, 1rem + 1.2vw, 2.3rem); line-height: 1.2; font-weight: 700; color: #F9F9F9; }
.bh-feat p { margin: 0; font-size: clamp(15px, .8rem + .35vw, 18px); line-height: 1.75; color: rgb(247 245 239 / .88); max-width: 40ch; }
.bh-feat .go { display: inline-flex; gap: 8px; font-size: 15px; font-weight: 600; color: var(--lav); }
.bh-feat .go .arrow { transition: transform .25s var(--ease-film); }
.bh-feat:focus-visible .go .arrow { transform: translateX(-5px); }
@media (hover: hover) and (pointer: fine) {
  .bh-feat:hover .go .arrow { transform: translateX(-5px); }
  .bh-feat:hover h2 { text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 2px; }
}

/* تخطّي المشهد */
.bh-skip {
  position: absolute; z-index: 4; inset-inline-end: clamp(20px, 4vw, 48px); bottom: max(20px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; min-block-size: 40px; padding: 8px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--cream);
  background: rgb(12 18 32 / .62); border: 1px solid rgb(247 245 239 / .22); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .25s ease;
}
@media (hover: hover) and (pointer: fine) { .bh-skip:hover { background: rgb(12 18 32 / .82); }  }
.bh-skip .arrow { transition: transform .25s var(--ease-film); }
.bh-skip:hover .arrow { transform: translateY(3px); }
#after-hero:focus { outline: none; }

.bh-cue {
  position: absolute; z-index: 3; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0;
  font-size: 13px; font-weight: 600; color: rgb(29 20 48 / .78); opacity: clamp(0, calc(1 - var(--build, 0) * 25), 1); pointer-events: none;
}
.bh-cue i { inline-size: 1px; block-size: 40px; background: linear-gradient(rgb(29 20 48 / .7), transparent); transform-origin: top; animation: cue 2.2s var(--ease-film) infinite; }

/* الانتقال: القسم التالي يصعد فوق المبنى بعد لحظة من اكتماله */
.rise.after-build { margin-block-start: -36vh; }

/* حين لا تتسع النافذة لأطول مجموعة (الشاشات العريضة القصيرة) يضيف build.js الصنف compact */
@media (min-aspect-ratio: 21/20) {
  .bh-panel.compact { gap: 14px; }
  .compact .bh-id { grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
  .compact .bh-mark { inline-size: 40px; }
  .compact .bh-id-text { gap: 4px; }
  .compact .bh-name { font-size: clamp(1.8rem, .8rem + 1.6vw, 2.5rem); }
  .compact .bh-name span { display: inline; }
  .compact .bh-uni { font-size: 15px; }
  .compact .bh-g { gap: 8px; padding-block: 18px 22px; }
  .compact .bh-say { font-size: clamp(1.9rem, .9rem + 1.8vw, 2.7rem); }
  .compact .bh-feat .ico { inline-size: 32px; block-size: 32px; margin-block-end: 2px; }
  .compact .bh-feat h2 { font-size: clamp(1.45rem, .9rem + 1vw, 2rem); }
  .compact .bh-feat p, .compact .bh-lead { font-size: 15px; line-height: 1.7; }
}

/* الجوال والعرض الطولي: الهوية والمؤشر والمحتوى أعلى، والمبنى أسفل */
@media (max-aspect-ratio: 21/20) {
  .bh-poster { inset: auto 0 0 0; height: 62%; object-position: 36% 100%; }
  .bh-panel { inset-inline: 20px; inline-size: auto; gap: 10px; }
  .bh-id { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
  .bh-mark { inline-size: 34px; }
  .bh-id-text { gap: 2px; }
  .bh-name { font-size: clamp(1.4rem, 6.8vw, 2rem); line-height: 1.2; }
  .bh-name span { display: inline; }
  .bh-uni { font-size: 13px; }
  .bh-hud { font-size: 12px; gap: 8px; }
  .bh-g { gap: 6px; padding-block: 14px 18px; }
  .bh-say { font-size: clamp(1.7rem, 7.4vw, 2.6rem); }
  .bh-lead, .bh-feat p { font-size: 14px; line-height: 1.65; }
  .bh-feat .ico { inline-size: 28px; block-size: 28px; margin-block-end: 0; }
  .bh-feat h2 { font-size: clamp(1.3rem, 5.6vw, 1.8rem); }
  .bh-feat .go { font-size: 13px; }
  .bh-intro .btn { min-block-size: 44px; font-size: 15px; padding-inline: 1.2em; }
  .bh-cue { display: none; }
  .bh-skip { font-size: 13px; min-block-size: 36px; padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bh-g .ln > span, .bh-feat .ico .d, .bh-feat .ico .f, .bh-id > *,
  .bh-lead, .bh-intro .actions, .bh-feat p, .bh-feat .go { transition: none; }
  .bh-cue i { animation: none; }
}
