@font-face {
  font-family: 'RB-Regular';
  src: url('../fonts/rb/RB-Regular.eot');
  src: url('../fonts/rb/RB-Regular.eot?#iefix') format('embedded-opentype'),
    url('../fonts/rb/RB-Regular.woff2') format('woff2'),
    url('../fonts/rb/RB-Regular.woff') format('woff'),
    url('../fonts/rb/RB-Regular.ttf') format('truetype'),
    url('../fonts/rb/RB-Regular.svg#RB-Regular') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RB-Bold';
  src: url('../fonts/rb/RB-Bold.eot');
  src: url('../fonts/rb/RB-Bold.eot?#iefix') format('embedded-opentype'),
    url('../fonts/rb/RB-Bold.woff2') format('woff2'),
    url('../fonts/rb/RB-Bold.woff') format('woff'),
    url('../fonts/rb/RB-Bold.ttf') format('truetype'),
    url('../fonts/rb/RB-Bold.svg#RB-Bold') format('svg');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Primary YGCS Navy palette */
  --ygcs-navy-950: #06182E;
  --ygcs-navy-900: #071B33;
  --ygcs-navy-850: #091f3a;
  --ygcs-navy-800: #0B2748;
  --ygcs-navy-700: #0d315a;
  --ygcs-navy-600: #123a6b;
  --ygcs-navy-500: #184a85;
  --ygcs-navy-400: #2163a8;
  --ygcs-navy-300: #2d7ec9;
  --ygcs-navy-200: #5ca0e0;
  --ygcs-navy-100: #a3caf3;
  --ygcs-navy-50: #e6f2fc;

  /* Accent cyan */
  --ygcs-cyan: #27BFEA;
  --ygcs-cyan-light: #65D8F5;
  --ygcs-cyan-dark: #1a9bc4;
  --ygcs-cyan-50: rgba(39, 191, 234, 0.08);

  /* Gold accents (limited use) */
  --ygcs-gold: #C8A45D;
  --ygcs-gold-light: #E0C58E;
  --ygcs-gold-dark: #9E7F3D;
  --ygcs-gold-50: rgba(200, 164, 93, 0.08);

  /* Neutrals */
  --ygcs-white: #FFFFFF;
  --ygcs-off-white: #F5F8FA;
  --ygcs-bg-light: #F8FAFC;
  --ygcs-text: #122033;
  --ygcs-text-secondary: #3a4a5e;
  --ygcs-muted: #6F7D8C;
  --ygcs-border: #DCE5EC;
  --ygcs-border-light: #EDF2F7;
  --ygcs-overlay: rgba(6, 24, 46, 0.55);
  --ygcs-overlay-dark: rgba(6, 24, 46, 0.82);
  --ygcs-overlay-medium: rgba(6, 24, 46, 0.70);

  /* Theme semantic */
  --color-bg: var(--ygcs-white);
  --color-surface: var(--ygcs-off-white);
  --color-surface-elevated: var(--ygcs-white);
  --color-text: var(--ygcs-text);
  --color-text-secondary: var(--ygcs-text-secondary);
  --color-muted: var(--ygcs-muted);
  --color-border: var(--ygcs-border);
  --color-border-light: var(--ygcs-border-light);
  --color-primary: var(--ygcs-cyan);
  --color-primary-dark: var(--ygcs-cyan-dark);
  --color-accent: var(--ygcs-gold);
  --color-hero-bg: var(--ygcs-navy-950);

  /* Typography */
  --font-ar-display:  "RB-Regular", "Noto Kufi Arabic", "Tajawal", sans-serif;
  --font-ar-body: "RB-Bold", sans-serif;
  --font-en-display: "Manrope", "Plus Jakarta Sans", "Inter", sans-serif;
  --font-en-body: "Inter", "Manrope", sans-serif;

  /* Font sizes */
  --text-xs: clamp(0.7rem, 0.8vw, 0.8rem);
  --text-sm: clamp(0.8rem, 0.9vw, 0.9rem);
  --text-base: clamp(0.9rem, 1vw, 1rem);
  --text-md: clamp(1rem, 1.1vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.25vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 2vw, 2rem);
  --text-3xl: clamp(1.8rem, 2.5vw, 2.5rem);
  --text-4xl: clamp(2.2rem, 4.5vw, 4rem);
  --text-5xl: clamp(2.8rem, 5vw, 5rem);
  --text-6xl: clamp(3.5rem, 6vw, 6rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Layout */
  --header-height: 80px;
  --header-height-scrolled: 68px;
  --ticker-height: 46px;
  --container-max: 1400px;
  --container-narrow: 1200px;
  --container-reading: 820px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-hero: 800ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark mode */
[data-theme="dark"],
html[data-theme="dark"] {
  --color-bg: var(--ygcs-navy-950);
  --color-surface: var(--ygcs-navy-900);
  --color-surface-elevated: var(--ygcs-navy-800);
  --color-text: var(--ygcs-white);
  --color-text-secondary: rgba(255, 255, 255, 0.75);
  --color-muted: rgba(255, 255, 255, 0.55);
  --color-border: rgba(255, 255, 255, 0.12);
  --color-border-light: rgba(255, 255, 255, 0.06);
  --color-hero-bg: var(--ygcs-navy-950);
}

/* Respect OS preference only when not explicitly set */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --color-bg: var(--ygcs-navy-950);
    --color-surface: var(--ygcs-navy-900);
    --color-surface-elevated: var(--ygcs-navy-800);
    --color-text: var(--ygcs-white);
    --color-text-secondary: rgba(255, 255, 255, 0.75);
    --color-muted: rgba(255, 255, 255, 0.55);
    --color-border: rgba(255, 255, 255, 0.12);
    --color-border-light: rgba(255, 255, 255, 0.06);
    --color-hero-bg: var(--ygcs-navy-950);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[dir="rtl"] {
  --arrow-start: 'right';
  --arrow-end: 'left';
}

html[dir="ltr"] {
  --arrow-start: 'left';
  --arrow-end: 'right';
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ar-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  font-size: var(--text-base);
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

html[lang="en"] body {
  font-family: var(--font-en-body);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  margin: 0 0 0.75em;
  font-family: var(--font-ar-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
}

html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3,
html[lang="en"] h4,
html[lang="en"] h5,
html[lang="en"] h6,
html[lang="en"] .h1,
html[lang="en"] .h2,
html[lang="en"] .h3,
html[lang="en"] .h4,
html[lang="en"] .h5,
html[lang="en"] .h6 {
  font-family: var(--font-en-display);
  font-weight: 800;
}

h1, .h1 { font-size: var(--text-5xl); }
h2, .h2 { font-size: var(--text-4xl); }
h3, .h3 { font-size: var(--text-3xl); }
h4, .h4 { font-size: var(--text-2xl); }
h5, .h5 { font-size: var(--text-xl); }
h6, .h6 { font-size: var(--text-lg); }

p {
  margin: 0 0 1em;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
}

/* Focus visible */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: var(--ygcs-navy-950);
  font-weight: 700;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* Container */
.ygcs-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.ygcs-container-narrow {
  max-width: var(--container-narrow);
}

.ygcs-container-reading {
  max-width: var(--container-reading);
}

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

/* Section spacing */
.ygcs-section {
  padding-block: var(--space-4xl);
}

.ygcs-section-sm {
  padding-block: var(--space-2xl);
}

.ygcs-section-lg {
  padding-block: var(--space-5xl);
}

/* Section header */
.ygcs-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.ygcs-section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  margin-bottom: 0.15em;
  color: var(--color-text);
  position: relative;
  display: inline-block;
}

.ygcs-section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--color-primary);
  margin-top: var(--space-sm);
  border-radius: var(--radius-full);
}

html[dir="ltr"] .ygcs-section-title::after {
  margin-left: 0;
}

html[dir="rtl"] .ygcs-section-title::after {
  margin-right: 0;
}

.ygcs-section-subtitle {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.ygcs-section-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-primary);
  white-space: nowrap;
}

.ygcs-section-link:hover {
  color: var(--color-primary-dark);
}

.ygcs-section-link svg,
.ygcs-section-link i {
  transition: transform var(--transition-fast);
}

html[dir="rtl"] .ygcs-section-link:hover svg,
html[dir="rtl"] .ygcs-section-link:hover i {
  transform: translateX(-4px);
}

html[dir="ltr"] .ygcs-section-link:hover svg,
html[dir="ltr"] .ygcs-section-link:hover i {
  transform: translateX(4px);
}

/* Buttons */
.ygcs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.4;
  white-space: nowrap;
}

.ygcs-btn-primary {
  background: var(--color-primary);
  color: var(--ygcs-navy-950);
  border-color: var(--color-primary);
}

.ygcs-btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--ygcs-white);
}

.ygcs-btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.ygcs-btn-outline:hover {
  background: var(--color-primary);
  color: var(--ygcs-navy-950);
}

.ygcs-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ygcs-white);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
}

.ygcs-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--ygcs-white);
}

.ygcs-btn-dark {
  background: var(--ygcs-navy-950);
  color: var(--ygcs-white);
  border-color: var(--ygcs-navy-950);
}

.ygcs-btn-dark:hover {
  background: var(--ygcs-navy-800);
  border-color: var(--ygcs-navy-800);
  color: var(--ygcs-white);
}

.ygcs-btn-gold {
  background: var(--color-accent);
  color: var(--ygcs-navy-950);
  border-color: var(--color-accent);
}

.ygcs-btn-gold:hover {
  background: var(--ygcs-gold-dark);
  border-color: var(--ygcs-gold-dark);
  color: var(--ygcs-white);
}

.ygcs-btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-xs);
}

.ygcs-btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
}

.ygcs-btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-full);
}

.ygcs-btn-icon-sm {
  width: 2rem;
  height: 2rem;
}

/* Badge / Category label */
.ygcs-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}

.ygcs-badge-cyan {
  background: var(--ygcs-cyan-50);
  color: var(--ygcs-cyan-dark);
}

.ygcs-badge-gold {
  background: var(--ygcs-gold-50);
  color: var(--ygcs-gold-dark);
}

.ygcs-badge-dark {
  background: var(--ygcs-navy-800);
  color: var(--ygcs-cyan-light);
}

.ygcs-badge-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}

/* Glass card */
.ygcs-glass {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .ygcs-glass,
html[data-theme="light"] .ygcs-glass {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Divider */
.ygcs-divider {
  height: 1px;
  background: var(--color-border);
  border: 0;
  margin: var(--space-xl) 0;
}

.ygcs-divider-gold {
  background: var(--color-accent);
  width: 60px;
  height: 3px;
  border-radius: var(--radius-full);
}

/* Empty state */
.ygcs-empty {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  color: var(--color-muted);
}

.ygcs-empty-icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-md);
  color: var(--color-border);
}

/* Loading placeholder */
.ygcs-skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-border-light) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: ygcs-skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes ygcs-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Force RB-Regular font on article reading content and all its children */
.ygcs-article-reading,
.ygcs-article-reading *,
.ygcs-article-reading *::before,
.ygcs-article-reading *::after {
    font-family: "RB-Regular", sans-serif !important;
}

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