/* ============================================================
   St. Mark Coptic Academy — Coming Soon
   Reuses the site's design tokens (Figma "Final Design"):
   cream #FEF6F0 · brown #562823 · Thmanyah type system.
   ============================================================ */

/* ——— Fonts (local, same files as the main site) ——— */
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyahserifdisplay-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyahserifdisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyahserifdisplay-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyahserifdisplay-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Display";
  src: url("fonts/thmanyahserifdisplay-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyahseriftext-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyahseriftext-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyahseriftext-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Serif Text";
  src: url("fonts/thmanyahseriftext-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyahsans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyahsans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("fonts/thmanyahsans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Calligraphic Thulth — the Arabic "قريبا", exactly like the hero title */
@font-face {
  font-family: "Moshref Thulth";
  src: url("fonts/AMoshrefThulth.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ——— Design tokens ——— */
:root {
  --cream-50: #fffcfa;
  --cream-100: #fef6f0;
  --cream-200: #fef1e8;
  --brown-300: #8e6f6c;
  --brown-500: #562823;
  --line: #cbbcbb;

  --font-display: "Thmanyah Serif Display", Georgia, serif;
  --font-serif: "Thmanyah Serif Text", Georgia, serif;
  --font-sans: "Thmanyah Sans", ui-sans-serif, system-ui, sans-serif;
  --font-thulth: "Moshref Thulth", "Thmanyah Serif Display", serif;

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* 4 slides × 6s */
  --slide-loop: 24s;
}

/* ——— Reset ——— */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  background: var(--cream-100);
  color: var(--brown-500);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--brown-500);
  color: var(--cream-100);
}

/* ============================================================
   Layout — split screen: emblem (left) · academy (right)
   ============================================================ */
.stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100svh;
}

/* ——— Left: the emblem panel (cream) ——— */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4vh, 48px);
  padding: clamp(32px, 6vw, 88px);
  text-align: center;
  background: var(--cream-100);
  z-index: 2;
}

/* The emblem — loading.svg rendered in brown via mask (same trick as the
   preloader, which masks it in cream). Aspect ratio matches the source
   viewBox 860×640. */
.emblem {
  width: min(400px, 62vw);
  aspect-ratio: 860 / 640;
  background-color: var(--brown-500);
  -webkit-mask: url("assets/loading.svg") no-repeat center / contain;
  mask: url("assets/loading.svg") no-repeat center / contain;
}

.titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.title-en {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--brown-500);
}

.title-ar {
  font-family: var(--font-thulth);
  font-size: clamp(40px, 5.2vw, 72px);
  line-height: 1;
  color: var(--brown-500);
  direction: rtl;
}

.subtitle {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 46ch;
  font-family: var(--font-serif);
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.7;
  color: var(--brown-300);
  text-wrap: pretty;
}
.subtitle-ar {
  font-size: 1.05em;
  line-height: 1.9;
}

/* Thin rule under the title, echoing the site's hairlines */
.rule {
  width: 64px;
  height: 1px;
  background: var(--line);
}

/* ——— Right: the academy images, blended into cream like the hero ——— */
.showcase {
  position: relative;
  overflow: hidden;
}
.showcase .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  will-change: opacity, transform;
  animation: slide-cycle var(--slide-loop) ease-in-out infinite;
}

/* Four slides · 6s each, ~1s of overlap on either side of the handover */
.showcase .slide:nth-child(1) { animation-delay: 0s; }
.showcase .slide:nth-child(2) { animation-delay: 6s; }
.showcase .slide:nth-child(3) { animation-delay: 12s; }
.showcase .slide:nth-child(4) { animation-delay: 18s; }

/* Fade up, hold, fade out — with a slow settle so the loop never feels static.
   The scale resets between 33% and 0% while the slide is fully transparent. */
@keyframes slide-cycle {
  0% {
    opacity: 0;
    transform: scale(1.05);
  }
  4% {
    opacity: 1;
  }
  25% {
    opacity: 1;
  }
  29% {
    opacity: 0;
  }
  33% {
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}
/* Cream gradient — same intent as the hero's overlay, rotated so the photo
   melts into the cream emblem panel on its left edge (and top). */
.showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Many stops tracing an ease-out curve: a 2-stop ramp reads as a visible
     band, this one dissolves. Alpha never jumps more than ~0.12 per stop. */
  background:
    linear-gradient(
      to right,
      rgb(254, 246, 240) 0%,
      rgba(254, 246, 240, 0.995) 4%,
      rgba(254, 246, 240, 0.97) 9%,
      rgba(254, 246, 240, 0.92) 14%,
      rgba(254, 246, 240, 0.84) 19%,
      rgba(254, 246, 240, 0.73) 25%,
      rgba(254, 246, 240, 0.6) 31%,
      rgba(254, 246, 240, 0.46) 37%,
      rgba(254, 246, 240, 0.33) 44%,
      rgba(254, 246, 240, 0.21) 51%,
      rgba(254, 246, 240, 0.12) 59%,
      rgba(254, 246, 240, 0.05) 68%,
      rgba(254, 246, 240, 0.01) 78%,
      rgba(254, 246, 240, 0) 88%
    ),
    linear-gradient(
      to bottom,
      rgba(254, 246, 240, 0.35) 0%,
      rgba(254, 246, 240, 0.24) 8%,
      rgba(254, 246, 240, 0.14) 16%,
      rgba(254, 246, 240, 0.06) 24%,
      rgba(254, 246, 240, 0.02) 31%,
      rgba(254, 246, 240, 0) 38%
    );
}

/* ============================================================
   Entrance motion — CSS only, respects reduced motion
   ============================================================ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel > * {
  opacity: 0;
  animation: rise 0.9s var(--ease-out-quart) forwards;
}
.panel > .emblem { animation-delay: 0.15s; }
.panel > .titles { animation-delay: 0.35s; }
.panel > .rule { animation-delay: 0.5s; }
.panel > .subtitle { animation-delay: 0.6s; }

.showcase {
  opacity: 0;
  animation: fade 1.4s var(--ease-out-quart) 0.2s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .panel > *,
  .showcase {
    opacity: 1;
    animation: none;
  }
  /* Hold a single still instead of cycling */
  .showcase .slide {
    animation: none;
    opacity: 0;
    transform: none;
  }
  .showcase .slide:nth-child(1) {
    opacity: 1;
  }
}

/* ============================================================
   Responsive — stack like the hero: content over the academy
   ============================================================ */
@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .panel {
    padding: clamp(40px, 9vw, 64px) 24px 28px;
    gap: clamp(22px, 3.5vh, 36px);
  }

  .emblem {
    width: min(320px, 68vw);
  }

  /* Academy image sits below the emblem and fades up into the cream,
     the same relationship as the hero's campus film under the headline. */
  .showcase {
    height: 46vh;
    min-height: 300px;
  }
  .showcase::after {
    background: linear-gradient(
      to top,
      rgba(254, 246, 240, 0) 30%,
      rgba(254, 246, 240, 0.03) 40%,
      rgba(254, 246, 240, 0.09) 50%,
      rgba(254, 246, 240, 0.18) 60%,
      rgba(254, 246, 240, 0.3) 69%,
      rgba(254, 246, 240, 0.45) 77%,
      rgba(254, 246, 240, 0.62) 85%,
      rgba(254, 246, 240, 0.8) 92%,
      rgba(254, 246, 240, 0.94) 97%,
      rgb(254, 246, 240) 100%
    );
  }
}

@media (max-width: 480px) {
  .title-en {
    font-size: clamp(30px, 9vw, 44px);
  }
  .title-ar {
    font-size: clamp(38px, 13vw, 56px);
  }
}
