/* ============================================================
   NASA Space Apps Challenge 2026 — Madinah
   Light editorial · Arabic-first · IBM Plex Sans Arabic
   ============================================================ */

:root {
  --paper: #F7F5F0;
  --card: #FFFFFF;
  --card-tint: #EDEAE2;
  --line: #E3DFD5;
  --ink: #0B1730;
  --ink-dim: rgba(11, 23, 48, 0.72);
  --body-c: #4B5468;
  --gold: #FFCB52;
  --gold-deep: #B97E0A;   /* gold darkened for text on paper */
  --red: #F5442A;
  --shadow: 0 1px 2px rgba(11, 23, 48, 0.06);
  --r-card: 24px;
  --r-el: 16px;
  --maxw: 1120px;
  --header-h: 76px;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
em { font-style: normal; }

/* ---------- Language switching ---------- */
html[lang="en"] .ar { display: none !important; }
html[lang="ar"] .en { display: none !important; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 780px; }
.section { padding: clamp(28px, 4.5vw, 56px) 0; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 10px 16px;
  border-radius: 10px; font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ============================================================
   HEADER — solid, opaque, never floats over content
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  min-height: var(--header-h);
  display: flex; align-items: center;
  transition: box-shadow .25s;
}
.site-header.scrolled { box-shadow: 0 2px 12px rgba(11, 23, 48, 0.07); }
.header-inner { display: flex; align-items: center; gap: 18px; }

.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { height: 46px; width: auto; transition: height .25s ease; }
.site-header.scrolled .brand img { height: 40px; }

.main-nav { display: flex; gap: 2px; margin-inline-start: auto; }
.main-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 15px; border-radius: 999px; font-size: 0.97rem;
  color: var(--ink-dim); font-weight: 500; transition: color .2s, background .2s;
}
.main-nav a:hover { color: var(--ink); background: var(--paper); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: 0.92rem; font-weight: 600; transition: border-color .2s, background .2s;
}
.lang-toggle:hover { border-color: var(--ink); background: var(--paper); }
.lang-toggle svg { flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  min-height: 48px; padding: 0 28px; border-radius: 999px; border: none;
  transition: background .2s, transform .15s ease;
  white-space: nowrap; text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-sm { min-height: 44px; padding: 0 20px; font-size: 0.94rem; }
.btn-lg { min-height: 54px; padding: 0 36px; font-size: 1.05rem; }

.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: #f4bd39; }

.text-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px;
  font-weight: 600; color: var(--ink); text-decoration: underline;
  text-underline-offset: 5px; text-decoration-thickness: 1.5px;
  text-decoration-color: var(--gold);
  transition: text-decoration-color .2s;
}
.text-link:hover { text-decoration-color: var(--ink); }

/* ---------- Mobile nav toggle ---------- */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px; width: 46px; height: 46px;
  align-items: center; justify-content: center; background: transparent;
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer; flex-shrink: 0;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: clamp(20px, 3.5vw, 44px) 0 0; }
.hero-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: clamp(40px, 7vw, 88px) clamp(22px, 5vw, 72px);
  text-align: center;
}
.hero-card { padding-bottom: clamp(115px, 26vw, 250px); }
.hero-copy { position: relative; z-index: 1; }
.hero-art {
  position: absolute; inset-inline: 0; bottom: 0;
  /* height tracks width (scene is 4:1) so the whole composition stays visible */
  height: clamp(84px, 22vw, 215px);
  overflow: hidden; pointer-events: none;
  /* dissolve the artwork at the card edges instead of chopping it */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}
.hero-scene { width: 100%; height: 100%; display: block; }
/* satellite tracks the bounded arc, fades in/out at each end, repeats */
.horizon-sat {
  transform-box: view-box; transform-origin: 600px 900px;
  animation: pass 16s linear infinite;
}
@keyframes pass {
  0%        { transform: rotate(-25deg); opacity: 0; }
  10%, 90%  { opacity: 1; }
  100%      { transform: rotate(25deg); opacity: 0; }
}

/* a meteor crosses the hero sky now and then */
.hero-shoot {
  position: absolute; top: 20%; right: 14%;
  width: 56px; height: 1.4px; border-radius: 2px;
  background: linear-gradient(-90deg, rgba(11,23,48,0.5), rgba(11,23,48,0));
  transform: rotate(150deg); opacity: 0;
  animation: heroShoot 11s ease-in 3s infinite;
}
@keyframes heroShoot {
  0%, 90%   { opacity: 0; translate: 0 0; }
  92%       { opacity: 0.8; }
  98%, 100% { opacity: 0; translate: -140px 80px; }
}

/* planets drift very slowly */
.planet-a { transform-box: view-box; animation: driftA 13s ease-in-out infinite; }
.planet-b { transform-box: view-box; animation: driftB 17s ease-in-out infinite; }
@keyframes driftA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes driftB { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.hero-scene .twk1 { animation: twinkle 4s ease-in-out infinite; }
.hero-scene .twk2 { animation: twinkle 5.2s ease-in-out 1.3s infinite; }
.hero-scene .twk3 { animation: twinkle 6s ease-in-out 2.2s infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.eyebrow {
  font-size: 0.9rem; font-weight: 600; color: var(--red); margin-bottom: 18px;
}
.hero-title {
  font-weight: 700; font-size: clamp(1.5rem, 3.7vw, 2.75rem); line-height: 1.5;
  max-width: 100%; margin: 0 auto 20px; text-wrap: balance;
}
html[lang="en"] .hero-title { line-height: 1.25; }
.hero-title em { color: var(--gold-deep); }
.hero-sub {
  font-size: clamp(1rem, 1.8vw, 1.2rem); color: var(--body-c);
  max-width: 52ch; margin: 0 auto 26px;
}

.hero-facts {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 30px; margin-bottom: 32px;
}
.hero-facts li {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 0.98rem; color: var(--ink);
}
.hero-facts svg { color: var(--ink-dim); flex-shrink: 0; }
.hero-facts .pin { color: var(--red); }

.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 22px; }

/* ---------- Countdown card ---------- */
.countdown-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: clamp(28px, 4.5vw, 44px) clamp(20px, 4vw, 40px);
  margin-top: 18px; text-align: center;
}
.cd-decor { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.countdown-card > :not(.cd-decor) { position: relative; z-index: 1; }
.cd-sat {
  transform-box: view-box; transform-origin: 600px 979px;
  animation: cdPass 18s linear infinite;
}
@keyframes cdPass {
  0%       { transform: rotate(-30deg); opacity: 0; }
  10%, 90% { opacity: 1; }
  100%     { transform: rotate(30deg); opacity: 0; }
}
.cd-title { font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 700; margin-bottom: 22px; }
.cd-title em { color: var(--gold-deep); }
.cd-row { display: flex; justify-content: center; gap: clamp(8px, 2vw, 16px); }
.cd-item {
  flex: 0 1 108px; min-width: 0;
  background: var(--card-tint); border: 1px solid var(--line); border-radius: var(--r-el);
  padding: 14px 6px 12px;
}
.cd-num {
  display: block; font-weight: 700; font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums;
}
.cd-label { display: block; font-size: 0.78rem; color: var(--body-c); margin-top: 2px; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section-title {
  font-weight: 700; font-size: clamp(1.5rem, 3.6vw, 2.4rem); line-height: 1.5;
  margin-bottom: 16px;
}
html[lang="en"] .section-title { line-height: 1.25; }
.section-title em { color: var(--gold-deep); }
.section-title.center { text-align: center; margin-bottom: clamp(22px, 4vw, 36px); }
.prose {
  color: var(--body-c); font-size: clamp(0.98rem, 1.6vw, 1.1rem); max-width: 70ch;
  text-wrap: pretty;
}
/* even edges on both sides — only where the column is wide enough that
   justification doesn't open ugly gaps between words */
@media (min-width: 700px) {
  .prose { text-align: justify; text-align-last: start; }
}

/* About */
.about-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 56px);
}
.fact-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.fact {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px;
  background: var(--card-tint); border-radius: 999px;
  font-weight: 600; font-size: 0.92rem; color: var(--ink);
}

/* Benefits */
.why-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.why-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 30px 26px;
}
.why-card-featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFFDF2 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 4px 20px rgba(255, 203, 82, 0.15);
  padding: clamp(32px, 5vw, 44px) clamp(24px, 4vw, 36px);
  position: relative; overflow: hidden;
}
.why-icon {
  display: inline-grid; place-items: center; width: 52px; height: 52px;
  background: var(--card-tint); border-radius: 16px; color: var(--ink);
  margin-bottom: 16px; flex-shrink: 0;
}
.why-icon-featured {
  width: 60px; height: 60px; border-radius: 18px;
  background: var(--gold); color: var(--ink);
  margin-bottom: 18px;
}
.why-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.why-card-featured h3 { font-size: clamp(1.35rem, 2.4vw, 1.7rem); margin-bottom: 10px; }
.why-card p { color: var(--body-c); font-size: 0.96rem; }
.why-card-featured p { font-size: clamp(1.02rem, 1.6vw, 1.12rem); color: var(--ink-dim); max-width: 58ch; }

/* Register — the one navy moment: a quiet night sky */
.register-card {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-card);
  padding: clamp(40px, 7vw, 80px) clamp(22px, 5vw, 64px);
  text-align: center;
}
.register-card > :not(.sky):not(.shoot) { position: relative; z-index: 1; }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sky .tw1 { animation: twinkle 3.6s ease-in-out infinite; }
.sky .tw2 { animation: twinkle 4.8s ease-in-out 1.2s infinite; }
.sky .tw3 { animation: twinkle 5.6s ease-in-out 2.4s infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.65; } }
.sky-orbit-anim {
  transform-box: view-box; transform-origin: 470px 80px;
  animation: orbit 40s linear infinite;
}
.shoot {
  position: absolute; top: 14%; right: 6%; /* physical: travel path is drawn for down-left, same in RTL */
  width: 70px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(-90deg, rgba(247,245,240,0.9), rgba(247,245,240,0));
  transform: rotate(148deg); opacity: 0;
  animation: shoot 9s ease-in 4s infinite;
  pointer-events: none;
}
@keyframes shoot {
  0%, 91% { opacity: 0; translate: 0 0; }
  93% { opacity: 0.7; }
  97%, 100% { opacity: 0; translate: -190px 118px; }
}
.register-card h2 { font-weight: 700; font-size: clamp(1.5rem, 3.8vw, 2.5rem); line-height: 1.5; margin-bottom: 12px; }
html[lang="en"] .register-card h2 { line-height: 1.25; }
.register-card p { color: rgba(247, 245, 240, 0.75); font-size: 1.05rem; max-width: 46ch; margin: 0 auto 28px; }
.register-fine { font-size: 0.85rem !important; margin: 16px auto 0 !important; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-el);
  box-shadow: var(--shadow); overflow: hidden;
}
.faq-item summary {
  list-style: none; cursor: pointer; padding: 17px 22px; font-weight: 600;
  font-size: 1.02rem; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  min-height: 44px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--gold-deep);
  transition: transform .25s; line-height: 1; flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-body { padding: 0 22px 20px; color: var(--body-c); }
.faq-body strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: clamp(36px, 6vw, 56px) 0;
  margin-top: clamp(28px, 4.5vw, 56px);
}
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.footer-logo { height: 88px; width: auto; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; }
.footer-links a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 600; font-size: 0.95rem; color: var(--ink);
  text-decoration: underline; text-underline-offset: 5px;
  text-decoration-thickness: 1.5px; text-decoration-color: var(--line);
  transition: text-decoration-color .2s;
}
.footer-links a:hover { text-decoration-color: var(--gold); }
.footer-line { color: var(--body-c); font-size: 0.88rem; }

/* ============================================================
   REVEAL — subtle
   ============================================================ */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   MOTION LAYER
   ============================================================ */

/* Hero entrance — staggered rise (guarded: reduced-motion users see static content) */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { opacity: 0; animation: rise .55s ease forwards; }
  .hero-copy > :nth-child(1) { animation-delay: .05s; }
  .hero-copy > :nth-child(2) { animation-delay: .16s; }
  .hero-copy > :nth-child(3) { animation-delay: .27s; }
  .hero-copy > :nth-child(4) { animation-delay: .38s; }
  .hero-copy > :nth-child(5) { animation-delay: .49s; }
  .hero-art { opacity: 0; animation: rise .7s ease .35s forwards; }
}
@keyframes rise { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* Countdown numerals tick on change */
.cd-num.tick { animation: numTick .3s ease; }
@keyframes numTick { from { opacity: .25; translate: 0 -5px; } }

/* Cards lift on hover */
.why-card.reveal { transition: opacity .5s ease, transform .22s ease, box-shadow .22s ease; }
.why-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(11, 23, 48, 0.08); }
.faq-item { transition: border-color .2s, box-shadow .2s; }
.faq-item:hover { box-shadow: 0 4px 14px rgba(11, 23, 48, 0.07); }

/* Buttons: slight lift */
.btn:hover { transform: translateY(-1.5px); box-shadow: 0 4px 12px rgba(11, 23, 48, 0.12); }

/* FAQ answer eases in */
.faq-item[open] .faq-body { animation: faqIn .28s ease; }
@keyframes faqIn { from { opacity: 0; translate: 0 -4px; } }

/* Night sky: second counter-rotating orbit + second shooting star */
.sky-orbit2-anim {
  transform-box: view-box; transform-origin: 110px 330px;
  animation: orbit 55s linear infinite reverse;
}
.shoot--2 {
  top: 24%; right: auto; left: 8%;
  width: 60px; transform: rotate(32deg);
  animation: shoot2 13s ease-in 7s infinite;
}
@keyframes shoot2 {
  0%, 93% { opacity: 0; translate: 0 0; }
  95% { opacity: 0.6; }
  99%, 100% { opacity: 0; translate: 170px 105px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .why-grid { grid-template-columns: 1fr; }
}

.nav-scrim {
  position: fixed; inset: 0; z-index: 98; border: none; padding: 0;
  background: rgba(11, 23, 48, 0.35); cursor: default;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, visibility .22s;
}

@media (max-width: 800px) {
  body.menu-open .nav-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .main-nav {
    position: fixed; top: var(--header-h); inset-inline: 0; z-index: 99;
    flex-direction: column; gap: 2px; margin: 0;
    background: var(--card); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 32px rgba(11, 23, 48, 0.10);
    padding: 10px 16px 18px;
    transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform .22s ease, opacity .22s ease, visibility .22s;
  }
  .main-nav.open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  .main-nav a { min-height: 50px; font-size: 1.05rem; border-radius: 12px; padding: 0 16px; }
  .nav-toggle { display: flex; }
  .nav-register { display: none; }
  /* nav is out of flow here, so push the controls to the far corner ourselves
     (left in Arabic RTL, right in English LTR) */
  .header-actions { margin-inline-start: auto; }
}

@media (max-width: 520px) {
  .hero-facts { flex-direction: column; align-items: center; gap: 12px; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .cd-row { gap: 7px; }
  .cd-item { flex: 1 1 0; padding: 11px 2px 9px; }
  .fact-row .fact { flex: 1 1 auto; justify-content: center; }
  .register-card .btn { width: 100%; }
  .sponsor-card .btn { width: 100%; }
}

@media (max-width: 380px) {
  .brand img { height: 42px; }
  .lang-toggle { padding: 0 12px; }
  .header-inner { gap: 10px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
