/* ── Variables ──────────────────────────────────── */

:root {
  --navy: #003255;
  --navy-light: #08446d;
  --teal: #4DC3CF;
  --teal-hover: #5fd1dc;
  --text-on-navy: #ffffff;
  --text-on-navy-muted: rgba(255, 255, 255, 0.82);
  --text-on-navy-faint: rgba(255, 255, 255, 0.55);

  --logo-w: min(22vw, 12vh, 12dvh, 110px);
  --logo-max-h: min(12vh, 12dvh, 110px);

  --pad-x: clamp(18px, 5vw, 40px);
  --gap: min(1.8vh, 1.8dvh, 14px);
}

/* ── Reset ──────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Montserrat', 'Source Sans 3', 'Source Sans Pro', 'Noto Sans Arabic', 'Noto Sans SC', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #000;
  overflow: hidden;
}

/* ── Screen ──────────────────────────────────── */

.screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--navy);
  color: var(--text-on-navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen::-webkit-scrollbar { display: none; }

.screen.screen-exit {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.screen[dir="rtl"] { direction: rtl; }

/* ── Background Arcs ──────────────────────────── */

.bg-arcs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-arcs::before,
.bg-arcs::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.bg-arcs::before { width: min(620px, 160vw); height: min(620px, 160vw); top: -25%; right: -50%; }
.bg-arcs::after  { width: min(460px, 120vw); height: min(460px, 120vw); bottom: -30%; left: -40%; }

/* ── Stars SVG ──────────────────────────────── */

.stars-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

/* ── Content ─────────────────────────────────
   Flexes between the two logos. Centres children
   when there is headroom, scrolls if there isn't.
   ──────────────────────────────────────────── */

.content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 480px;
  flex: 1 1 auto;
  min-height: 0;
  /* Use the responsive --pad-x (clamp 18-40px) instead of a 48px floor
     so small phones aren't choked. Larger breakpoints below override
     --pad-x for tablets/desktop. */
  padding: var(--gap) var(--pad-x);
  padding-top: max(env(safe-area-inset-top, 0px), var(--gap));
}

/* ── Logo (shared sizing via variables) ──── */

.logo-top,
.logo-bottom {
  width: var(--logo-w);
  flex: 0 0 auto;
  opacity: 0;
}

.logo-top  { margin-bottom: var(--gap); animation: rise .7s ease-out .1s forwards; }
.logo-bottom {
  position: relative;
  z-index: 2;
  margin-top: var(--gap);
  padding: var(--gap) 0;
  padding-bottom: max(env(safe-area-inset-bottom, 4px), var(--gap));
  animation: rise .7s ease-out .55s forwards;
}

.logo-top img,
.logo-bottom img {
  width: 100%;
  height: auto;
  max-height: var(--logo-max-h);
  object-fit: contain;
  display: block;
  animation: none;
}

/* ── Title ──────────────────────────────────── */

.title {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(20px, min(5.5vh, 5.5dvh, 7vw), 42px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-transform: none;
  margin: 0;
  color: #fff;
  text-align: center;
  flex: 0 0 auto;
  opacity: 0;
  animation: rise .7s ease-out .25s forwards;
  transition: opacity .25s ease;
}

.title .year {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(9px, min(1.6vh, 1.6dvh, 3.2vw), 16px);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-align: center;
  text-transform: uppercase;
  margin-top: calc(var(--gap) * .85);
  color: var(--teal);
}

/* ── Divider ──────────────────────────────── */

.divider {
  width: 50px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  margin: calc(var(--gap) * 0.5) 0;
  flex: 0 0 auto;
  opacity: 0;
  animation: fade .6s ease-out .35s forwards;
}

/* ── Description ──────────────────────────── */

.description {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  /* Responsive: shrinks on small phones, comfortable on tablets. The
     tablet / desktop media queries below override with their own clamps. */
  font-size: clamp(12px, min(1.9vh, 1.9dvh, 3.6vw), 16px);
  line-height: 1.55;
  color: white;
  margin: calc(var(--gap) * 0.5) 0;
  width: 100%;
  max-width: 360px;
  text-align: center;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 1;
  animation: rise .7s ease-out .4s forwards;
  transition: opacity .25s ease;
}

.description::-webkit-scrollbar { display: none; }

.description p {
  margin: 0 0 calc(var(--gap) * .7);
}


/* ── Launch Section ──────────────────────── */

.launch-section {
  margin-top: auto;
  padding-top: calc(var(--gap) * 0.5);
  width: 100%;
  max-width: 360px;
  flex: 0 0 auto;
  opacity: 0;
  animation: rise .7s ease-out .5s forwards;
}

/* ── Language Grid ──────────────────────── */

.lang-section {
  margin-bottom: calc(var(--gap) * .8);
}

/* ── Launch Button ──────────────────────── */

.launch-btn {
  width: 100%;
  background: var(--teal);
  color: var(--navy);
  border: none;
  border-radius: clamp(12px, 2vw, 18px);
  padding: clamp(9px, min(1.8vh, 1.8dvh), 17px) 20px;
  /* Responsive label size so the button text shrinks on small phones
     instead of overflowing or wrapping awkwardly. */
  font-size: clamp(11px, min(1.8vh, 1.8dvh, 3.6vw), 14px);
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: transform .15s ease, background .15s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.launch-btn:active { transform: translateY(0); }

.launch-btn--ready { box-shadow: 0 4px 20px rgba(77, 195, 207, 0.3); }

.launch-btn__icon {
  font-size: clamp(13px, min(2.2vh, 2.2dvh), 19px);
  line-height: 1;
  color: var(--navy);
}

/* ── Animations ──────────────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── i18n ────────────────────────────────── */

.is-fading .title,
.is-fading .description,
.is-fading .launch-btn span { opacity: 0; }

/* ═══════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════ */

/* ── Tall screens: centre everything ────── */
@media (min-height: 780px) {
  .screen  { justify-content: center; }
  .content { flex: 0 1 auto; }
  .description { flex: 1 1 auto; }
}

/* ── Very tall screens: breathe ──────── */
@media (min-height: 900px) {
  :root {
    --gap: min(2.4vh, 2.4dvh, 20px);
    --logo-w: min(26vw, 14vh, 14dvh, 140px);
    --logo-max-h: min(14vh, 14dvh, 140px);
  }
}

/* ── Narrow phones (≤ 360px) ──────────── */
@media (max-width: 360px) {
  :root { --pad-x: 14px; }
  .launch-btn { gap: 6px; }
}

/* ── Very narrow phones (≤ 320px, iPhone SE 1st gen, Galaxy Fold closed) */
@media (max-width: 320px) {
  :root {
    --pad-x: 12px;
    --gap: min(1.4vh, 1.4dvh, 10px);
  }
  .title       { font-size: clamp(18px, 6.5vw, 22px); }
  .description { font-size: clamp(11px, 3.2vw, 13px); line-height: 1.5; }
  .launch-btn  { font-size: clamp(10px, 3.2vw, 12px); padding: 9px 14px; }
  .divider     { width: 40px; }
}

/* ── Short portrait phones (≤ 600px tall, e.g. iPhone SE) ─────
   The default sizes assume a typical ~700px+ portrait viewport; on
   shorter screens we compress vertical rhythm so all sections fit
   without forcing the screen to scroll. */
@media (orientation: portrait) and (max-height: 600px) {
  :root {
    --gap: min(1.2vh, 1.2dvh, 9px);
    --logo-w: min(18vw, 9vh, 9dvh, 80px);
    --logo-max-h: min(9vh, 9dvh, 80px);
  }
  .title        { font-size: clamp(18px, 5vh, 26px); }
  .title .year  { font-size: clamp(9px, 1.4vh, 12px); margin-top: 3px; }
  .description  { font-size: clamp(11px, 1.7vh, 13px); line-height: 1.45; }
  .description p { margin-bottom: 4px; }
  .divider      { margin: 4px 0; }
  .launch-btn   { font-size: clamp(10px, 1.7vh, 12px); padding: 8px 16px; }
}

/* ── Landscape mobile ──────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --logo-w: min(18vw, 10vh, 10dvh, 56px);
    --logo-max-h: min(14vh, 14dvh, 56px);
    --gap: min(1.4vh, 1.4dvh, 8px);
  }

  .screen {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    overflow-y: hidden;
  }

  .content {
    width: 54%;
    max-width: none;
    padding: var(--gap) 20px;
    padding-left: max(env(safe-area-inset-left, 12px), 20px);
    justify-content: center;
    overflow-y: auto;
  }

  .launch-section {
    position: fixed;
    right: max(env(safe-area-inset-right, 12px), clamp(12px, 3vw, 32px));
    top: 50%;
    transform: translateY(-50%);
    width: 34%;
    max-width: 260px;
    padding-top: 0;
    margin-top: 0;
    z-index: 3;
  }

  .logo-bottom {
    position: fixed;
    bottom: 0;
    right: max(env(safe-area-inset-right, 12px), clamp(12px, 3vw, 32px));
    z-index: 3;
    padding: 6px 0;
  }

  .bg-arcs::before { width: 400px; height: 400px; top: -100px; right: -200px; }
  .bg-arcs::after  { width: 300px; height: 300px; bottom: -120px; left: -150px; }
}

/* ── Tablet portrait (≥ 768px) ──────── */
@media (min-width: 768px) and (orientation: portrait) {
  :root {
    --logo-w: min(22vw, 14vh, 14dvh, 160px);
    --logo-max-h: min(14vh, 14dvh, 160px);
    --gap: min(2.6vh, 2.6dvh, 22px);
    --pad-x: 40px;
  }

  .content { max-width: 580px; }

  .title { font-size: clamp(32px, min(6vh, 6dvh, 5.5vw), 48px); }
  .title .year { font-size: clamp(13px, min(2vh, 2dvh, 2.2vw), 18px); }

  .divider { width: 48px; }

  .description {
    font-size: clamp(13.5px, min(2vh, 2dvh, 2vw), 16px);
    max-width: 460px;
    line-height: 1.7;
  }

  .launch-section { max-width: 440px; }
  .launch-btn { border-radius: 18px; }

  .bg-arcs::before { width: 900px; height: 900px; top: -200px; right: -400px; }
  .bg-arcs::after  { width: 650px; height: 650px; bottom: -250px; left: -300px; }
}

/* ── Tablet landscape (≥ 768px, landscape) ── */
@media (min-width: 768px) and (orientation: landscape) {
  :root {
    --logo-w: min(16vw, 12vh, 12dvh, 130px);
    --logo-max-h: min(12vh, 12dvh, 130px);
    --gap: min(2.2vh, 2.2dvh, 18px);
    --pad-x: 36px;
  }

  .content { max-width: 560px; }

  .title { font-size: clamp(28px, min(5vh, 5dvh, 3.8vw), 44px); }
  .title .year { font-size: clamp(12px, min(1.8vh, 1.8dvh, 1.6vw), 16px); }

  .divider { width: 48px; }

  .description {
    font-size: clamp(13px, min(1.8vh, 1.8dvh, 1.6vw), 15px);
    max-width: 440px;
    line-height: 1.65;
  }

  .launch-section { max-width: 420px; }
  .launch-btn { border-radius: 18px; }
}

/* ── Desktop (≥ 1200px) ─────────────── */
@media (min-width: 1200px) {
  :root {
    --logo-w: min(14vw, 10vh, 10dvh, 120px);
    --logo-max-h: min(10vh, 10dvh, 120px);
    --gap: min(1.5vh, 1.5dvh, 14px);
    --pad-x: 48px;
  }

  .screen { justify-content: center; overflow: hidden; }
  .content { max-width: 640px; flex: 0 1 auto; }

  .title { font-size: clamp(32px, min(4.5vh, 4.5dvh, 3.2vw), 48px); }
  .title .year { font-size: clamp(12px, min(1.6vh, 1.6dvh, 1.4vw), 18px); }

  .divider { width: 56px; margin: var(--gap) 0; }

  .description {
    font-size: clamp(13px, min(1.6vh, 1.6dvh, 1.2vw), 15px);
    max-width: 520px;
    line-height: 1.6;
    margin: var(--gap) 0;
  }

  .launch-section { max-width: 480px; padding-top: 0; }
  .launch-btn { gap: 12px; border-radius: 20px; }

  .logo-top { margin-bottom: var(--gap); }
  .logo-bottom { margin-top: var(--gap); padding: calc(var(--gap) * 0.5) 0; }

  .bg-arcs::before { width: 1400px; height: 1400px; top: -400px; right: -500px; }
  .bg-arcs::after  { width: 1000px; height: 1000px; bottom: -400px; left: -400px; }
}

/* ── Wide desktop (≥ 1600px) ──────────── */
@media (min-width: 1600px) {
  :root {
    --logo-w: min(12vw, 10vh, 10dvh, 140px);
    --logo-max-h: min(10vh, 10dvh, 140px);
    --gap: min(2vh, 2dvh, 18px);
  }

  .content { max-width: 720px; }

  .title { font-size: clamp(38px, min(5vh, 5dvh, 3vw), 56px); }

  .description { font-size: clamp(14px, 1vw, 16px); max-width: 560px; }
  .launch-section { max-width: 520px; }
}
