/* =====================================================================
   Sharjah Sports Council — Talent Registration
   Shared design system: brand tokens, base, navbar, buttons, footer
   Brand: Navy #183254 + Gold #CFA762 · Fonts: Fraunces + Lexend
   ===================================================================== */

/* ---- Design tokens ------------------------------------------------- */
:root {
  /* Brand core (from the official identity guide) */
  --navy-900: #0d1f36;
  --navy-800: #183254;   /* brand primary */
  --navy-700: #21436b;
  --navy-600: #2c5688;
  --navy-100: #e9eef4;

  --gold-700: #a9833f;
  --gold-600: #bd9550;
  --gold-500: #cfa762;   /* brand accent */
  --gold-300: #e2c48b;

  --ink:       #13243a;
  --slate-700: #3a4a60;
  --slate-500: #65758c;
  --slate-400: #94a1b3;

  --paper:    #f6f8fb;
  --paper-2:  #eef2f7;
  --white:    #ffffff;
  --grey:     #cccccc;
  --border:   #dde4ec;
  --border-2: #cdd6e1;

  --danger:    #b3261e;
  --danger-bg: #fbeceb;
  --success:   #2c5688;

  /* Typography */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Lexend", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(13, 31, 54, .06), 0 1px 3px rgba(13, 31, 54, .05);
  --shadow:    0 10px 30px -12px rgba(13, 31, 54, .20);
  --shadow-lg: 0 30px 60px -24px rgba(13, 31, 54, .34);

  --max:  1180px;
  --nav-max: 1340px;   /* floating navbar runs wider than the content column */
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---- Reset / base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--navy-800);
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 3px;
  border-radius: 4px;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; inset-inline-start: 16px; top: -64px; z-index: 200;
  background: var(--navy-800); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Brand logo (white over hero, black on solid navbar) ---------- */
.nav__brand { position: relative; display: block; line-height: 0; }
.nav__logo { height: 58px; width: auto; display: block; transition: opacity .3s var(--ease); }
/* Stack both logos; only one is shown at a time. */
.nav__logo--light { position: absolute; inset: 0; }
.nav__logo--light { opacity: 0; }   /* solid navbar (default/scrolled) → black logo */
.nav__logo--dark  { opacity: 1; }
/* Light hero: the navbar keeps its dark logo — no white-logo swap. */
.footer__logo { height: 220px; width: auto; align-self: flex-start; }
@media (max-width: 520px) { .nav__logo { height: 46px; } }

/* ---- Buttons ------------------------------------------------------- */
.btn {
  --btn-bg: var(--navy-800); --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1;
  padding: 15px 26px; min-height: 48px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; text-align: center;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease),
              background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn[hidden] { display: none; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn--primary { --btn-bg: var(--navy-800); }
.btn--primary:hover { --btn-bg: var(--navy-700); }

.btn--gold { --btn-bg: var(--gold-500); --btn-fg: var(--navy-900); box-shadow: 0 8px 22px -10px rgba(207, 167, 98, .75); }
.btn--gold:hover { --btn-bg: var(--gold-300); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--navy-800); border-color: var(--border-2); }
.btn--ghost:hover { --btn-bg: var(--paper-2); box-shadow: none; }

.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---- "Federation plate" CTAs (hero + CTA band) --------------------- */
/* Squared institutional plates with a gold spine on the leading edge and
   tracked uppercase labels — the register of an official mandate. The spine
   floods the plate on hover. Scoped to these two variants so the site-wide
   pill .btn (nav, forms) is untouched. The spine is drawn as a background
   layer (not a pseudo-element) so the label always sits cleanly on top, and
   it anchors to the inline-start edge so it mirrors correctly in RTL. */
.btn--plate, .btn--plate-ghost {
  min-height: 52px; border-radius: 4px;
  padding: 17px 26px; padding-inline-start: 30px;
  font-size: .82rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  background-repeat: no-repeat; background-position: left;
  transition: transform .2s var(--ease), box-shadow .3s var(--ease),
              background-size .3s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn--plate .arrow, .btn--plate-ghost .arrow { width: 16px; height: 16px; }

.btn--plate {
  --btn-fg: var(--navy-900); color: var(--navy-900);
  background-color: var(--gold-500);
  background-image: linear-gradient(var(--gold-700), var(--gold-700)),   /* spine  */
                    linear-gradient(var(--gold-600), var(--gold-600));   /* flood  */
  background-size: 5px 100%, 0% 100%;
  box-shadow: 0 14px 28px -14px rgba(207, 167, 98, .8);
}
.btn--plate:hover {
  color: var(--navy-900); transform: translateY(-2px);
  background-size: 5px 100%, 100% 100%;
  box-shadow: 0 20px 36px -14px rgba(207, 167, 98, .9);
}

.btn--plate-ghost {
  --btn-fg: #fff; color: #fff; background-color: transparent;
  border-color: rgba(255, 255, 255, .34); backdrop-filter: blur(6px);
  background-image: linear-gradient(var(--gold-300), var(--gold-300)),               /* spine */
                    linear-gradient(rgba(207, 167, 98, .16), rgba(207, 167, 98, .16)); /* flood */
  background-size: 4px 100%, 0% 100%;
}
.btn--plate-ghost:hover {
  color: #fff; transform: translateY(-2px);
  border-color: rgba(226, 196, 139, .6);
  background-size: 4px 100%, 100% 100%;
}

/* ---- Two-row navbar: utility strip + primary rail ------------------ */
/* Row 1 (utility strip) carries the language toggle + quick contact and folds
   away on scroll; row 2 (rail) holds the logo, centred wayfinding and the CTAs.
   The whole header is transparent over the hero, solid glass once scrolled, and
   slides up on scroll-down (toggled in main.js). A gold hairline tracks page
   scroll along the rail's bottom edge. */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  transition: transform .4s var(--ease);
}
.nav--hidden { transform: translateY(-100%); }

/* Row 1 — utility strip (navy when solid, translucent over the hero). */
.nav__utility {
  background: var(--navy-900);
  overflow: hidden; max-height: 40px;
  transition: max-height .35s var(--ease), opacity .3s var(--ease), background-color .35s var(--ease);
}
.nav--on-hero .nav__utility { background: transparent; }
.nav--condensed .nav__utility { max-height: 0; opacity: 0; }
.nav__utility-inner {
  width: 100%; max-width: var(--nav-max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 40px; padding: 0 32px;
}

/* Compact globe language toggle (light treatment inside the navy strip). */
.lang-globe {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border: 1px solid var(--border-2); border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--navy-800); line-height: 1;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.lang-globe__icon { width: 16px; height: 16px; flex: none; }
.lang-globe:hover { background: rgba(13, 31, 54, .05); }
.nav__utility .lang-globe { color: #fff; border-color: rgba(255, 255, 255, .30); }
.nav__utility .lang-globe:hover { background: rgba(255, 255, 255, .12); }

/* Quick-contact link sits at the trailing edge of the strip. Positioned by the
   container's space-between (which follows page direction) rather than an
   auto-margin — the link forces dir="ltr" for the number, which would otherwise
   flip margin-inline-start to the wrong side in Arabic. */
.nav__contact {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .82rem; color: rgba(255, 255, 255, .78);
  transition: color .2s var(--ease);
}
.nav__contact:hover { color: #fff; }
.nav__contact-icon { width: 15px; height: 15px; flex: none; opacity: .85; }
/* Light hero: utility-strip controls go dark (they are white on the solid navy strip). */
.nav--on-hero .nav__utility .lang-globe { color: var(--navy-800); border-color: var(--border-2); }
.nav--on-hero .nav__utility .lang-globe:hover { background: rgba(13, 31, 54, .05); }
.nav--on-hero .nav__contact { color: var(--slate-700); }
.nav--on-hero .nav__contact:hover { color: var(--navy-900); }

/* Row 2 — primary rail. */
.nav__rail {
  position: relative;
  background: rgba(246, 248, 251, .86);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 30px -16px rgba(13, 31, 54, .40);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  transition: background-color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.nav--on-hero .nav__rail {
  background: transparent; border-bottom-color: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
/* Scrolled a little but still over the hero: a faint light scrim with a blur so
   the rail reads against passing content, without committing to the full solid
   state (which only arrives once the hero leaves view). */
.nav--on-hero.nav--condensed .nav__rail {
  background: rgba(255, 255, 255, .82);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
          backdrop-filter: blur(10px) saturate(140%);
}
.nav__inner {
  width: 100%; max-width: var(--nav-max); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  height: 72px; padding: 0 32px;
}

/* Three-column balance: brand and actions take equal side columns so the links
   sit dead-centre. Logical flex follows document direction, so the whole rail
   mirrors automatically in Arabic (logo right, CTAs left). The collapse wrapper
   is display:contents on desktop so its children join the rail's flow. */
.nav__brand { flex: 1 1 0; margin: 0; }
.nav__collapse { display: contents; }
.nav__links { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 2px; }
.nav__links a:not(.btn) {
  font-size: .93rem; padding: 8px 14px; border-radius: 8px; color: var(--slate-700); white-space: nowrap;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav__links a:not(.btn):hover { background: rgba(13, 31, 54, .05); }
/* Light hero: links keep the default dark treatment (see .nav__links above). */

.nav__actions { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.nav__actions .btn { padding: 9px 18px; min-height: 40px; font-size: .9rem; }
.nav__actions .btn--gold, .nav__actions .btn--gold:hover { box-shadow: none; }
/* Light hero: the ghost CTA keeps its default navy-on-transparent look. */

.nav__sheet-lang { display: none; }

/* Gold scroll-progress hairline riding the rail's bottom edge (hidden over hero). */
.nav__progress {
  position: absolute; inset-inline-start: 0; bottom: -1px; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-300));
  transition: width .1s linear;
}
.nav--on-hero .nav__progress { opacity: 0; }

/* Hamburger — hidden on desktop, animates to an X when the sheet is open. */
.nav__toggle {
  display: none; flex: none; width: 44px; height: 44px; padding: 0;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border-2); border-radius: 12px;
  cursor: pointer; color: var(--navy-800);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.nav__toggle:hover { background: rgba(13,31,54,.05); }
.nav__burger { position: relative; display: block; width: 20px; height: 14px; }
.nav__burger span {
  position: absolute; inset-inline: 0; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .3s var(--ease), opacity .2s var(--ease), top .3s var(--ease);
}
.nav__burger span:nth-child(1) { top: 0; }
.nav__burger span:nth-child(2) { top: 6px; }
.nav__burger span:nth-child(3) { top: 12px; }
.nav--open .nav__burger span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav--open .nav__burger span:nth-child(2) { opacity: 0; }
.nav--open .nav__burger span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---- Mobile / tablet: links + CTAs collapse into a full-width sheet */
@media (max-width: 1024px) {
  /* Collapsed rail height — the mobile sheet + scrim (≤720px) anchor to this. */
  :root { --nav-rail-h: 66px; }
  .nav__utility { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav__inner { gap: 14px; height: var(--nav-rail-h); }

  /* Burger at the start, logo pinned to the trailing edge. */
  .nav__brand { flex: 0 0 auto; margin-inline-start: auto; }

  /* The collapse becomes the dropdown sheet, anchored to the rail. */
  .nav__collapse {
    display: block;
    position: absolute; top: 100%; inset-inline: 0;
    padding: 14px 20px 20px;
    background: rgba(255, 255, 255, .98);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .25s var(--ease), transform .3s var(--ease), visibility .25s;
  }
  .nav--open .nav__collapse { opacity: 1; visibility: visible; transform: translateY(0); }

  /* The sheet is always light — even when the rail above sits on the hero. */
  .nav__links { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav__links a:not(.btn),
  .nav--on-hero .nav__links a:not(.btn) { padding: 12px 14px; font-size: 1rem; border-radius: 10px; color: var(--slate-700); }
  .nav--on-hero .nav__links a:not(.btn):hover { background: rgba(13, 31, 54, .05); }

  .nav__actions {
    flex-direction: column; align-items: stretch; gap: 8px; justify-content: stretch;
    margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border);
  }
  .nav__actions .btn { width: 100%; min-height: 46px; }
  /* Ghost CTA inside the light sheet uses its light-on-paper look, not the hero one. */
  .nav--on-hero .nav__actions .btn--ghost { --btn-bg: transparent; --btn-fg: var(--navy-800); border-color: var(--border-2); backdrop-filter: none; }
  .nav--on-hero .nav__actions .btn--ghost:hover { --btn-bg: var(--paper-2); box-shadow: none; }

  /* Language toggle inside the sheet (utility strip is hidden on mobile). */
  .nav__sheet-lang { display: flex; justify-content: center; margin-top: 14px; }
}

/* ---- Footer -------------------------------------------------------- */
.footer { position: relative; background: var(--navy-900); color: rgba(255,255,255,.82); padding: 58px 0 30px; overflow: hidden; }
.footer::before {
  content: ""; position: absolute; inset: 0; opacity: .10; pointer-events: none;
  background-image: url("../img/arch-pattern.svg"); background-size: 64px 64px;
}
.footer > .container { position: relative; }
.footer__top {
  display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start;
  padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,.14);
}
.footer__brand { display: flex; flex-direction: column; gap: 18px; }
.footer__cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer__cols h4 { color: #fff; font-family: var(--font-body); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; opacity: .65; margin-bottom: 12px; }
.footer__cols a, .footer__cols li { display: block; font-size: .92rem; opacity: .82; padding: 1px 0; color: rgba(255,255,255,.82); }
.footer__cols a:hover { opacity: 1; color: var(--gold-300); }
.footer__cols ul { list-style: none; margin: 0; padding: 0; }
.footer__social { display: flex; gap: 10px; margin-top: 6px; }
.footer__social a {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); padding: 0;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.footer__social a:hover { background: var(--gold-500); border-color: var(--gold-500); }
.footer__social svg { width: 18px; height: 18px; color: #fff; }
.footer__social a:hover svg { color: var(--navy-900); }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding-top: 22px; font-size: .82rem; opacity: .6; }

/* ---- Motion preferences ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ===== Language switch (both LTR & RTL) ===== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Always read "English / Arabic" regardless of page locale. */
  direction: ltr;
  /* Shows both labels on every page: Latin "English" uses Lexend, the Arabic
     "العربية" falls through to Cairo (loaded in Arabic) — not a serif fallback. */
  font-family: 'Lexend', 'Cairo', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
}
/* Only used in the footer (.lang-switch--footer), inside .footer__bottom
   (opacity: .6) inside .footer (color: rgba(255,255,255,.82)) — those two
   ancestor dimming layers already compound to an effective ~49% white on
   --navy-900 (4.94:1, passing). This rule's own opacity: .7 used to stack a
   THIRD multiplier on top (.82 * .6 * .7 = ~34% effective alpha, 3.10:1 —
   under AA 4.5:1) for the non-current language link. Dropping the extra
   dimming brings it to the same ~49%/4.94:1 as its .footer__bottom
   siblings; is-active/:hover already read as current via weight+underline. */
.lang-switch__opt {
  color: inherit;
  opacity: 1;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.2s ease;
}
.lang-switch__opt:hover { opacity: 1; }
.lang-switch__opt.is-active { opacity: 1; font-weight: 600; text-decoration: underline; }
/* Decorative "|" divider between the two language links, aria-hidden and
   redundant with the visible gap — left at its low-contrast opacity. */
.lang-switch__sep { opacity: 0.4; }
.lang-switch--footer { margin: 0 auto; }

/* ---- Phone (≤720px): nav menu becomes a full-height app sheet ---------
   Overrides the ≤1024px dropdown. The sheet + scrim anchor below the rail via
   --nav-rail-h (defined in the ≤1024px block, where the rail collapses). */
@media (max-width: 720px) {
  .nav__collapse {
    position: fixed;
    top: var(--nav-rail-h); inset-inline: 0;
    /* Explicit viewport-based height — do NOT use `bottom: 0`. This sheet
       lives inside .nav__rail, which has a backdrop-filter off-hero; that
       makes the rail the containing block for this fixed element, so
       `bottom: 0` would resolve against the ~rail-height box and collapse the
       sheet to a sliver. svh keeps it clear of mobile browser chrome. */
    height: calc(100vh - var(--nav-rail-h));
    height: calc(100svh - var(--nav-rail-h));
    overflow-y: auto;
    padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(-12px);
  }
  .nav--open .nav__collapse { transform: translateY(0); }

  /* App-style tap rows: full-width, ≥56px, hairline-separated. */
  .nav__links a:not(.btn),
  .nav--on-hero .nav__links a:not(.btn) {
    min-height: 56px; display: flex; align-items: center;
    padding: 0 14px; font-size: 1.05rem; border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav__actions { margin-top: 18px; }
  .nav__actions .btn { min-height: 52px; }

  /* Dim the page behind the open sheet (sits below the rail, above content). */
  .nav--open::before {
    content: ""; position: fixed; inset: var(--nav-rail-h) 0 0 0; z-index: -1;
    background: rgba(13, 31, 54, .38);
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .nav__collapse { transform: none; }
}

/* ---- Error pages (404 / 403 / 500 / 503) ---- */
body.errorpage { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; margin: 0;
  background: var(--navy-800, #183254); color: #fff; padding: 24px; }
.errorpage__box { max-width: 34rem; text-align: center; }
.errorpage__code { font-size: 3.5rem; font-weight: 700; margin: 0 0 4px;
  color: var(--gold-500, #cfa762); line-height: 1; }
.errorpage__title { font-size: 1.5rem; margin: 0 0 12px; color: inherit; }
.errorpage__body { opacity: .85; margin: 0 0 24px; line-height: 1.7; }
.errorpage__links { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: center; margin: 0; }
.errorpage__links a { color: var(--gold-500, #cfa762); text-decoration: none;
  border: 1px solid currentColor; border-radius: 999px; padding: 10px 18px; min-height: 44px;
  display: inline-flex; align-items: center; }
.errorpage__links a:hover, .errorpage__links a:focus-visible { background: rgba(255,255,255,.08); }
