/* ==========================================================================
   CAAA · Website Under Construction
   0. Fonts       1. Tokens        2. Base          3. Header & language switch
   4. Stage       5. Emblem        6. Hero text
   7. Status      8. Contact       9. Footer
   10. Motion     11. Reduced motion
   ========================================================================== */

/* 0. Fonts: self-hosted variable WOFF2 subsets (SIL OFL 1.1, see assets/fonts/FONTS-LICENSE.txt).
   Unicode ranges copied from Google Fonts so each file loads only when its script appears. */

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/cairo-arabic.woff2") format("woff2");
  unicode-range: U+600-6FF, U+750-77F, U+870-891, U+897-8E1, U+8E3-8FF, U+200C-200E, U+2010-2011,
    U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E,
    U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22,
    U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49,
    U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F,
    U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E,
    U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/cairo-latin.woff2") format("woff2");
  unicode-range: U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  /* Palette supplied by CAAA */
  --navy: #0a2458;
  --red: #d71938;
  --gold: #c6a15b;
  --white: #ffffff;
  --mist: #f5f7fa;

  /* Tones derived from the palette */
  --navy-hover: #12357a;
  --navy-soft: #475b82;                  /* navy at 75% on white, 6.8:1 */
  --text: #3b4a66;                       /* body copy, 8.3:1 on mist */
  --muted: #5b6880;                      /* fine print, 5.2:1 on mist */
  --hairline: rgba(10, 36, 88, 0.12);
  --gold-hairline: rgba(198, 161, 91, 0.62);

  --font-ar: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  --gutter: 16px;
  --plate-vw: 86vw;                      /* 80vw on phones, so the ring shows around the plate */
  --plate-w: clamp(240px, min(var(--plate-vw), 46vh), 460px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: only light;
}

@supports (height: 1svh) {
  :root {
    --plate-w: clamp(240px, min(var(--plate-vw), 46svh), 460px);
  }
}

/* 2. Base ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: rgba(10, 36, 88, 0.28) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background-color: var(--mist);
  background-image:
    radial-gradient(ellipse 60% 52% at 50% 36%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 72%),
    radial-gradient(ellipse 120% 60% at 50% -14%, rgba(10, 36, 88, 0.08), rgba(10, 36, 88, 0) 62%),
    radial-gradient(ellipse 110% 50% at 50% 114%, rgba(10, 36, 88, 0.07), rgba(10, 36, 88, 0) 60%);
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 1.0625rem;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html:lang(en) body {
  font-family: var(--font-en);
  font-size: 1rem;
  line-height: 1.75;
}

/* Letterhead band: navy with a gold edge, after the ribbon in the logo */
body::before {
  content: "";
  height: 5px;
  background: linear-gradient(to bottom, var(--navy) 0 4px, var(--gold) 4px 5px);
}

/* Sections toggled from config.js stay hidden even when a component sets display */
[hidden] {
  display: none !important;
}

/* Only the active language is rendered */
html[lang="ar"] [data-lang="en"],
html[lang="en"] [data-lang="ar"] {
  display: none !important;
}

::selection {
  background: rgba(198, 161, 91, 0.32);
  color: var(--navy);
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

/* 3. Header & language switch --------------------------------------------- */

/* Pinned top-right in both languages, so the switch stays put when the direction flips */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 12px var(--gutter) 0;
  direction: ltr;
}

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 1px 2px rgba(10, 36, 88, 0.05),
    0 8px 20px -14px rgba(10, 36, 88, 0.35);
}

html:not(.js) .lang-switch {
  display: none;
}

.lang-switch__option {
  min-width: 5.25rem;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--navy-soft);
  font: 600 0.875rem/1 var(--font-en);
  cursor: pointer;
}

.lang-switch__option[lang="ar"] {
  font-family: var(--font-ar);
  font-size: 0.9375rem;
  font-weight: 700;
}

@media (hover: hover) {
  .lang-switch__option:hover {
    color: var(--navy);
    background: rgba(10, 36, 88, 0.06);
  }
}

.lang-switch__option[aria-pressed="true"] {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 4px 10px -4px rgba(10, 36, 88, 0.55);
  cursor: default;
}

.lang-switch__option:focus-visible {
  outline-offset: 2px;
}

/* 4. Stage ----------------------------------------------------------------- */

.stage {
  display: grid;
  align-content: center;
  justify-items: center;
  row-gap: clamp(40px, 7vh, 72px);
  padding: clamp(28px, 6vh, 64px) var(--gutter) clamp(36px, 6vh, 64px);
  text-align: center;
  overflow-x: clip;
}

.hero,
.hero__copy {
  display: grid;
  justify-items: center;
  width: 100%;
}

.hero {
  max-width: 48rem;
}

/* Phones: a slightly narrower plate so the ring reads as a band around it,
   and room above the emblem so the ring clears the language switch */
@media (max-width: 599px) {
  :root {
    --plate-vw: 80vw;
  }

  .stage {
    padding-top: clamp(68px, 9vh, 84px);
  }
}

/* 5. Emblem: logo plate on the guilloche ring ------------------------------ */

.emblem {
  position: relative;
  width: var(--plate-w);
  max-width: 100%;
  margin-block-end: clamp(32px, 5.5vh, 52px);
}

.emblem__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(128%, 100vw - var(--gutter));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000 50%, transparent 82%);
}

.emblem__ring-in,
.emblem__ring-in img {
  display: block;
  width: 100%;
  height: 100%;
}

.plate {
  position: relative;
  padding: clamp(10px, calc(var(--plate-w) * 0.04), 18px);
  border-radius: 18px;
  background: var(--white);
  box-shadow:
    0 1px 2px rgba(10, 36, 88, 0.06),
    0 12px 28px -14px rgba(10, 36, 88, 0.24),
    0 34px 64px -34px rgba(10, 36, 88, 0.32);
}

/* The client's original file, shown whole: no crop, no stretch, no filter */
.plate__logo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1208 / 880;
  object-fit: contain;
  box-shadow: 0 0 0 1px var(--gold-hairline);
}

/* 6. Hero text ------------------------------------------------------------- */

.hero__title {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.625rem, 1.05rem + 2.1vw, 2.5rem);
  font-weight: 700;
  line-height: 1.45;
  text-wrap: balance;
}

html:lang(en) .hero__title {
  font-size: clamp(1.4rem, 0.95rem + 1.8vw, 2.25rem);
  line-height: 1.22;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: clamp(14px, 2.4vh, 22px);
}

.rule__line {
  width: clamp(40px, 9vw, 72px);
  height: 1px;
}

.rule__line:first-child {
  background: linear-gradient(90deg, rgba(198, 161, 91, 0), var(--gold));
}

.rule__line:last-child {
  background: linear-gradient(90deg, var(--gold), rgba(198, 161, 91, 0));
}

.rule__star {
  display: block;
  flex: none;
}

.hero__lead {
  margin: 0;
  max-width: 36rem;
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1875rem);
  line-height: 1.95;
  text-wrap: pretty;
}

html:lang(en) .hero__lead {
  max-width: 33rem;
  font-size: clamp(0.98rem, 0.94rem + 0.2vw, 1.0625rem);
  line-height: 1.75;
}

/* 7. Status ---------------------------------------------------------------- */

.status {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 21rem);
  margin-block-start: clamp(28px, 4.6vh, 44px);
}

.status__head {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.status__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--white);
  color: var(--navy);
  box-shadow:
    inset 0 0 0 1px var(--gold-hairline),
    0 6px 14px -8px rgba(10, 36, 88, 0.45);
}

.status__label {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

html:lang(en) .status__label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.status__bar {
  position: relative;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(10, 36, 88, 0.1);
}

.status__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 36%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(10, 36, 88, 0), var(--navy) 48%, var(--gold));
}

[dir="rtl"] .status__fill {
  left: auto;
  right: 0;
  background: linear-gradient(270deg, rgba(10, 36, 88, 0), var(--navy) 48%, var(--gold));
}

/* 8. Contact --------------------------------------------------------------- */

.contact {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  max-width: 34rem;
}

.contact__title {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.4;
}

html:lang(en) .contact__title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.contact__text {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin-block-start: 8px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow:
    0 1px 2px rgba(10, 36, 88, 0.2),
    0 10px 22px -12px rgba(10, 36, 88, 0.6);
}

html:lang(en) .button {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.button:focus-visible {
  outline-offset: 4px;
}

[dir="rtl"] .button__arrow {
  transform: scaleX(-1);
}

@media (hover: hover) {
  .button:hover {
    background: var(--navy-hover);
    box-shadow:
      0 1px 2px rgba(10, 36, 88, 0.2),
      0 16px 30px -14px rgba(10, 36, 88, 0.65);
  }

  .button:hover .button__arrow {
    transform: translateX(3px);
  }

  [dir="rtl"] .button:hover .button__arrow {
    transform: scaleX(-1) translateX(3px);
  }
}

/* 9. Footer ---------------------------------------------------------------- */

.footer {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px var(--gutter) 28px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
  text-align: center;
}

html:lang(en) .footer {
  font-size: 0.8125rem;
}

.footer::before {
  content: "";
  width: 40px;
  height: 1px;
  margin-block-end: 14px;
  background: var(--gold);
  opacity: 0.75;
}

.footer p {
  margin: 0;
}

.footer__name {
  color: var(--navy);
  font-family: var(--font-en);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.footer__links ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.footer__links a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--gold-hairline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.footer__links a:hover {
  color: var(--navy);
  text-decoration-color: var(--gold);
}

/* 10. Motion: two beats on load (the emblem settles, then the text comes into focus),
   plus the slow ring and the progress glide */

@media (prefers-reduced-motion: no-preference) {
  .emblem__ring-in {
    animation: seal-in 1.6s var(--ease-out) backwards;
  }

  .emblem__ring-in img {
    animation: ring-spin 240s linear infinite;
  }

  .plate {
    animation: rise 1s var(--ease-out) 0.05s backwards;
  }

  .hero__copy,
  .contact,
  .footer {
    animation: focus-in 1s var(--ease-out) 0.4s backwards;
  }

  [dir="ltr"] .status__fill {
    animation: glide-ltr 3.2s var(--ease-in-out) infinite;
  }

  [dir="rtl"] .status__fill {
    animation: glide-rtl 3.2s var(--ease-in-out) infinite;
  }

  .lang-switch__option {
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  }

  .button {
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
  }

  .button__arrow {
    transition: transform 0.3s var(--ease-out);
  }

  /* Language change: the page cross-fades (View Transitions, where supported) */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.32s;
  }
}

@keyframes seal-in {
  from { opacity: 0; transform: scale(0.96); }
}

@keyframes ring-spin {
  to { transform: rotate(360deg); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes focus-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(8px); }
}

@keyframes glide-ltr {
  from { transform: translateX(-105%); }
  to { transform: translateX(285%); }
}

@keyframes glide-rtl {
  from { transform: translateX(105%); }
  to { transform: translateX(-285%); }
}

/* 11. Reduced motion: everything static; the bar becomes a dashed line, still with no figure */

@media (prefers-reduced-motion: reduce) {
  [dir] .status__fill {
    left: 0;
    right: 0;
    width: 100%;
    opacity: 0.38;
    background: repeating-linear-gradient(90deg, var(--navy) 0 10px, transparent 10px 16px);
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
