/* ==================================================================
   Cairo FACE World Summit 2027 — scroll-driven WebGL brand film
   Architecture per BUILD_SPEC: fixed canvas (z-0), DOM overlays
   (z-10), header (z-20), rail + CTA pill stack (z-30).
   Identity unchanged: steel blue #5288B0 + white, circular shapes,
   Archivo + Archivo Narrow.
   ================================================================== */

:root {
  --accent: #5288B0;
  --accent-strong: #2F6693;
  --ink: #0A1A28;
  --paper: #FFFFFF;
  --paper-2: #F2F6FA;
  --wash: rgba(82, 136, 176, 0.08);
  --muted-light: rgba(10, 26, 40, 0.6);
  --muted-dark: rgba(255, 255, 255, 0.64);
  --hairline-light: rgba(82, 136, 176, 0.35);
  --hairline-dark: rgba(255, 255, 255, 0.22);
  --panel-dark: rgba(15, 38, 58, 0.45);
  --grad-footer: linear-gradient(180deg, #1B4363 0%, #16405F 55%, #0B2233 100%);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ui: cubic-bezier(0.4, 0, 0.2, 1);
  --pad: 34px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---------------- type ---------------- */
.display-xl { font-size: clamp(44px, 6.6vw, 88px); font-weight: 400; line-height: 0.98; letter-spacing: -0.03em; }
.display-l  { font-size: clamp(34px, 5vw, 64px); font-weight: 400; line-height: 1.06; letter-spacing: -0.02em; }
.display-m  { font-size: clamp(26px, 3.2vw, 42px); font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; }
.heading    { font-size: clamp(21px, 2.3vw, 30px); font-weight: 500; line-height: 1.16; letter-spacing: -0.01em; }
.body-l     { font-size: 19px; font-weight: 500; line-height: 1.4; }
.body       { font-size: 16px; font-weight: 400; line-height: 1.5; }
.label {
  font-family: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  font-size: 13px; font-weight: 500; line-height: 1.4;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.label--dim { opacity: 0.62; }
.line-2 { opacity: 0.55; }

/* ---------------- circular primitives ---------------- */
.circle-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 9999px; flex: none;
  background: var(--accent); color: #fff; font-size: 18px;
  transition: transform 0.32s var(--ease-ui);
}
.circle-arrow--sm { width: 30px; height: 30px; font-size: 15px; }

.pill-sm {
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 4px 0 18px; border-radius: 9999px;
  border: 1px solid var(--hairline-light);
  font-family: "Archivo Narrow", Arial, sans-serif;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  transition: border-color 0.3s var(--ease-ui);
  white-space: nowrap;
}
.pill-sm:hover { border-color: var(--accent); }
.footer .pill-sm { border-color: var(--hairline-dark); color: #fff; }

.tick {
  position: absolute; width: 10px; height: 10px; border-radius: 9999px;
  background: var(--accent); display: block;
}
.tick--corner { top: -5px; left: -5px; z-index: 2; }

/* ---------------- z-0 · canvas ---------------- */
#film {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100svh;
  display: block;
  pointer-events: none;
}
body:not(.film-gl) #film { display: none; }

/* ---------------- z-20 · header ---------------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding-top: 14px; height: 61px;
}
.header__row { display: flex; align-items: center; justify-content: space-between; }
.header__brand { font-size: 20px; font-weight: 300; letter-spacing: -0.01em; }
.header__brand strong { font-weight: 500; }
.header__nav { display: flex; align-items: center; gap: 6px; }
.navpill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 15px;
  border-radius: 9999px;
  background: var(--panel-dark); backdrop-filter: blur(12px);
  font-family: "Archivo Narrow", Arial, sans-serif;
  font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
}
.navpill--arrow { width: 34px; padding: 0; justify-content: center; background: var(--accent); font-family: "Archivo", sans-serif; }
.navpill__flip { display: block; height: 1.4em; overflow: hidden; }
.navpill__flip span { display: block; transition: transform 0.32s var(--ease-ui); }
.navpill:hover .navpill__flip span { transform: translateY(-100%); }

.header { transition: color 0.5s var(--ease-ui); }
.header[data-theme="dark"] { color: #fff; }
.header[data-theme="dark"] .navpill { color: #fff; }
.header[data-theme="light"] { color: var(--ink); }
.header[data-theme="light"] .navpill { background: rgba(82, 136, 176, 0.12); color: var(--ink); }
.header[data-theme="light"] .navpill--arrow { background: var(--accent); color: #fff; }

/* ---------------- z-30 · scene-dot rail ---------------- */
.rail {
  position: fixed; right: 30px; top: 50%; transform: translateY(-50%);
  z-index: 30;
  display: flex; flex-direction: column; gap: 12px;
}
.rail__dot {
  position: relative; width: 26px; height: 26px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
}
.rail__dot::before {
  content: ""; width: 4px; height: 4px; border-radius: 9999px;
  background: var(--rail-dot, rgba(255, 255, 255, 0.55));
  transition: background 0.3s var(--ease-ui);
}
.rail__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 9999px;
  border: 1px solid var(--rail-dot, rgba(255, 255, 255, 0.55));
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.3s var(--ease-ui), transform 0.3s var(--ease-ui);
}
.rail__dot[aria-current="true"]::after { opacity: 1; transform: scale(1); }
body[data-scene-theme="light"] .rail { --rail-dot: rgba(10, 26, 40, 0.5); }

/* ---------------- z-30 · CTA pill stack ---------------- */
.pillstack {
  position: fixed; left: 50%; bottom: 31px; z-index: 30;
  width: 250px; height: 52px;
  transform: translateX(-50%);
}
.pill-cta {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 0 24px;
  border-radius: 9999px;
  background: var(--accent); color: #fff;
  font-family: "Archivo Narrow", Arial, sans-serif;
  font-size: 15px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(10, 26, 40, 0.25);
  transition: opacity 0.45s var(--ease-ui), transform 0.45s var(--ease-ui);
}
.pill-cta__arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-family: "Archivo", sans-serif; font-size: 17px;
  transition: transform 0.3s var(--ease-ui);
}
.pill-cta:hover .pill-cta__arrow { transform: translateX(3px); }
.pill-cta--back { opacity: 0; transform: scale(0.95); pointer-events: none; }
.pill-cta--front { opacity: 1; transform: scale(1); }
.pill-cta--gone { opacity: 0; transform: scale(1.04); pointer-events: none; }

/* ---------------- scenes ---------------- */
.scene { position: relative; z-index: 10; }
.scene--dark { color: #fff; }
.scene--white, .scene--pale { color: var(--ink); }

.beat { height: 190vh; position: relative; }
.beat--tall { height: 240vh; }
.beat__inner {
  position: sticky; top: 0;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 22px;
  align-items: center; text-align: center;
}
.beat__inner > * { max-width: 720px; }
.beat__inner--left { align-items: flex-start; text-align: left; }
.beat__inner--left > * { max-width: 680px; }
.beat__inner .body { max-width: 62ch; }

/* per-scene fallback + flat-mode backgrounds (canvas paints these live) */
body:not(.film-gl) [data-scene="hero"]      { background: linear-gradient(180deg, #0B2233 0%, #16405F 100%); }
body:not(.film-gl) [data-scene="manifesto"] { background: linear-gradient(180deg, #16405F 0%, #FFFFFF 26%, #FFFFFF 100%); }
body:not(.film-gl) [data-scene="numbers"]   { background: #EEF4F9; }
body:not(.film-gl) [data-scene="plan"]      { background: linear-gradient(180deg, #2F5B85 0%, #16405F 100%); }
body:not(.film-gl) [data-scene="days"]      { background: #0B2233; }
body:not(.film-gl) [data-scene="voices"]    { background: #E7EFF6; }
body:not(.film-gl) [data-scene="abstract"]  { background: linear-gradient(180deg, #5288B0 0%, #2F5B85 100%); }
body:not(.film-gl) .beat, body:not(.film-gl) .beat--tall { height: auto; }
body:not(.film-gl) .beat__inner { position: static; min-height: 0; padding: 96px 0; }

/* hero extras */
.hero__welcome { color: inherit; opacity: 0.85; }
.hero__meta {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 12px;
}
.beat__inner--left .hero__meta { align-items: flex-start; }
.countdown { display: flex; align-items: flex-start; gap: 14px; margin-top: 6px; }
.countdown__cell { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.countdown__cell b {
  font-size: 34px; font-weight: 300; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.countdown__sep { font-size: 28px; font-weight: 300; opacity: 0.4; line-height: 1.1; }
.hero__scrollhint { margin-top: 28px; }

/* manifesto */
.manifesto { max-width: 24ch; }
.manifesto__vision { color: var(--muted-light); }

/* per-character reveal */
[data-split] .ch, [data-split-progress] .ch { color: var(--ch-dim); transition: color 0.22s linear; }
[data-split] .ch.on, [data-split-progress] .ch.on { color: var(--ch-lit); }
.scene--white [data-split-progress], .scene--pale [data-split-progress],
.tail [data-split] { --ch-dim: rgba(10, 26, 40, 0.2); --ch-lit: var(--ink); }
.scene--dark [data-split-progress] { --ch-dim: rgba(255, 255, 255, 0.28); --ch-lit: #fff; }

/* late body reveal, driven by the beat's --bp progress */
.lateshow { opacity: clamp(0, calc((var(--bp, 1) - 0.38) * 3.2), 1); }
body:not(.film-gl) .lateshow { opacity: 1; }

/* stats */
.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 64px; margin-top: 16px;
}
.stat { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.stat dd {
  font-size: clamp(48px, 6vw, 92px); font-weight: 300; line-height: 1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.beat__inner .stats { max-width: 900px; }

/* day marker */
.opp__day {
  display: flex; flex-direction: column; gap: 2px;
  width: 110px; height: 110px; border-radius: 9999px;
  border: 1px dashed currentColor;
  align-items: center; justify-content: center;
  opacity: 0.9;
}
.opp__day b { font-size: 28px; font-weight: 300; letter-spacing: -0.01em; }

/* ---------------- DOM tail ---------------- */
.tail { position: relative; z-index: 10; background: var(--paper); padding: 128px 0; }
.tail.committee { background: var(--paper-2); }

.speakers__head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  margin-bottom: 48px;
}
.speakers__head h2 { margin-top: 10px; }

/* the card rail — horizontal, scroll-snap, continues past the edge */
.cardrail {
  display: flex; gap: 28px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--pad);
  padding: 6px var(--pad) 24px;
  -webkit-overflow-scrolling: touch;
}
.cardrail::-webkit-scrollbar { height: 6px; }
.cardrail::-webkit-scrollbar-thumb { background: var(--hairline-light); border-radius: 9999px; }
.scard {
  flex: none; width: min(328px, 78vw);
  display: flex; flex-direction: column; gap: 14px;
  scroll-snap-align: start;
}
.scard__media { position: relative; }
.scard__media img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top;
  border-radius: 16px;
}
.scard--more {
  justify-content: center; align-items: flex-start; gap: 18px;
  border: 1px dashed var(--hairline-light); border-radius: 16px;
  padding: 24px;
}
.scard--more .circle-arrow { align-self: flex-end; }
.scard:hover .circle-arrow { transform: translateX(3px); }

.spindex { margin-top: 48px; display: flex; flex-direction: column; gap: 16px; }
.spindex__names {
  columns: 3; column-gap: 28px;
  font-size: 17px; line-height: 1.9; color: var(--muted-light);
}

/* committee */
.committee__grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px;
  margin-top: 48px;
}
.member {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 4px; border-bottom: 1px dashed var(--hairline-light);
}
.member .body-l { font-weight: 400; }

/* endorse */
.endorse__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 32px; }
.endorse__card {
  position: relative; padding: 40px; border-radius: 20px;
  border: 1px dashed var(--hairline-light);
  display: flex; flex-direction: column; gap: 16px; align-items: flex-start;
}
.endorse__card .body { color: var(--muted-light); max-width: 48ch; }

/* footer */
.footer { position: relative; z-index: 10; background: var(--grad-footer); color: #fff; padding: 96px 0 0; overflow: hidden; }
.footer__grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 48px 28px;
  padding-bottom: 72px; border-bottom: 1px dashed var(--hairline-dark);
}
.footer__col { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.footer__col--news { grid-column: 1 / span 4; }
.footer__col:nth-child(2) { grid-column: 6 / span 2; }
.footer__col:nth-child(3) { grid-column: 8 / span 2; }
.footer__col:nth-child(4) { grid-column: 10 / span 2; }
.footer__col--end { grid-column: 12 / span 1; align-items: flex-end; }
.footer__note { margin-top: 8px; }
.footer__links { display: grid; gap: 10px; }
.footer__links a { opacity: 0.85; transition: opacity 0.2s; font-size: 17px; }
.footer__links a:hover { opacity: 1; }
.footer__legal { display: flex; justify-content: space-between; gap: 16px; padding: 20px var(--pad); }
.wordmark {
  font-size: clamp(120px, 21vw, 400px); font-weight: 500; letter-spacing: -0.02em;
  line-height: 0.72; text-align: center; white-space: nowrap;
  margin-top: 24px; margin-bottom: -0.16em;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.06) 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  user-select: none;
}

/* ---------------- responsive ---------------- */
@media (max-width: 1400px) {
  .header__nav .navpill--login { display: none; }
}
@media (max-width: 1200px) {
  .spindex__names { columns: 2; }
  .committee__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .footer__col--news { grid-column: 1 / span 6; }
  .footer__col:nth-child(2) { grid-column: 1 / span 2; }
  .footer__col:nth-child(3) { grid-column: 3 / span 2; }
  .footer__col:nth-child(4) { grid-column: 5 / span 2; }
  .footer__col--end { grid-column: 1 / span 6; align-items: flex-start; }
}
@media (max-width: 768px) {
  :root { --pad: 20px; }
  .header__nav .navpill:not(.navpill--arrow) { display: none; }
  .rail { right: 12px; gap: 8px; }
  .beat { height: 160vh; }
  .beat--tall { height: 200vh; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
  .countdown__cell b { font-size: 28px; }
  .pillstack { width: 220px; height: 48px; bottom: 20px; }
  .speakers__head { flex-direction: column; align-items: flex-start; }
  .spindex__names { columns: 1; }
  .committee__grid { grid-template-columns: 1fr; }
  .endorse__grid { grid-template-columns: 1fr; }
  .tail { padding: 80px 0; }
  .footer__legal { flex-direction: column; gap: 8px; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-split] .ch, [data-split-progress] .ch { color: var(--ch-lit); transition: none; }
  .lateshow { opacity: 1; }
  .navpill:hover .navpill__flip span { transform: none; }
  .pill-cta { transition: none; }
}
