/* ==========================================================================
   Gold Academy — Base
   Element defaults, typography, accessibility helpers, reveal animation.
   ========================================================================== */

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--c-heading);
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-3);
  text-wrap: balance;
}
h1 { font-size: var(--fs-display); letter-spacing: -.01em; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p  { margin-bottom: var(--sp-4); }

a { text-underline-offset: .2em; transition: color var(--dur-fast) var(--ease); }
img, video, iframe, svg { max-width: 100%; }
img { height: auto; display: block; }

/* Numbers in tables, prices and stats keep the same width */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
/* Latin fragments (codes, phone numbers) inside Arabic text */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- Focus: visible for keyboard users only ---------- */
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { box-shadow: none; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; inset-inline-start: var(--sp-4); top: -100px; z-index: 2000;
  background: var(--c-primary); color: var(--c-surface);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); color: var(--c-surface); }

/* ---------- Icons (inline SVG sprite) ---------- */
.icon {
  width: 1.25em; height: 1.25em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.25em;
}
.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.75em; height: 1.75em; }
.icon-fill { fill: currentColor; stroke: none; }
/* Directional icons: sprite arrows already point "forward" for RTL (left). Kept as a hook for LTR pages. */
[dir="ltr"] .icon-dir { transform: scaleX(-1); }

/* ---------- Layout helpers ---------- */
.container { max-width: var(--container); }
.section { padding-block: var(--section-y); }
.section-head { max-width: 640px; margin-bottom: var(--sp-10); }
.section-head.text-center { margin-inline: auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--c-accent-ink);
  margin-bottom: var(--sp-3);
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--c-accent);
}
.lead-text { font-size: var(--fs-md); color: var(--c-text-muted); }
.text-muted-ga { color: var(--c-text-muted) !important; }

/* ---------- Scroll reveal (driven by core.js) ---------- */
.reveal {
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
/* Stagger siblings without inline styles (keeps a strict CSP possible) */
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal.is-visible { opacity: 1; transform: none; }
/* Hidden only once core.js has set up the observer (html.reveal-ready),
   so content never disappears if a script fails to load */
.reveal-ready .reveal:not(.is-visible) { opacity: 0; transform: translateY(18px); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Theme-aware images (logo) ---------- */
.theme-dark-only { display: none !important; }
[data-bs-theme="dark"] .theme-light-only { display: none !important; }
[data-bs-theme="dark"] .theme-dark-only { display: block !important; }

/* Icon sprite container (no inline style, so a strict CSP can block inline styles) */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Focus ring on navy areas */
.hero, .site-footer, .cta-inner { --c-focus: var(--gold-400); }

::selection { background: var(--gold-300); color: var(--navy-900); }

/* Container: 16px side gutter on phones, Bootstrap's default above that */
.container { --bs-gutter-x: 2rem; }
@media (min-width: 768px) { .container { --bs-gutter-x: 3rem; } }

/* ---------- Smooth cross-page transitions (Chrome/Edge; other browsers navigate normally) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; }
.site-header { view-transition-name: site-header; }
.page-hero h1 { view-transition-name: page-title; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
