/* ============================================
   Final polish — RTL fixes, responsive tweaks
   ============================================ */

/* RTL arrows: SVG arrows in btns should flip when needed */
[dir="rtl"] .btn svg.flip-rtl,
[dir="rtl"] .read-more svg { transform: scaleX(-1); }

/* Mobile-specific fixes */
@media (max-width: 640px) {
  .hero { padding-top: 110px; }
  .hero-stats { grid-template-columns: 1fr; gap: var(--sp-3); }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }

  .nav-actions .btn:not(.btn-icon) { display: none; }

  .filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--sp-3); }
  .filter-chip { white-space: nowrap; flex-shrink: 0; }
  .filters input[type="search"] { display: none; }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

  .timeline { padding-inline-start: var(--sp-8); }
  .timeline::before { inset-inline-start: 16px; }
  .timeline-item::before { inset-inline-start: -32px; }

  .course-side-card { position: static; }

  .booking-grid { grid-template-columns: 1fr; }

  .hero-visual { min-height: 320px; }
  .pyramid-wrap { width: min(360px, 80vw); }

  .container, .container-narrow, .container-wide { padding-inline: var(--sp-4); }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .hero-title { font-size: 2.5rem !important; }
  .stat-value { font-size: var(--fs-xl) !important; }
  .grid-4 { grid-template-columns: 1fr !important; }
}

/* Hero arrow icon - rotate properly in RTL */
[dir="rtl"] .hero-cta .btn-primary svg {
  transform: rotate(180deg);
}

/* Better scroll snap for marquee tracks */
.marquee-track > span {
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.5;
  transition: opacity 0.3s var(--ease-out);
}
.marquee-track > span:hover { opacity: 1; }

/* Print styles */
@media print {
  .site-header, .site-footer, .nav-toggle, .mobile-menu, .btn, .filters {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; }
}

/* Improved focus visible */
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Smooth font swap fallback */
.font-loading body { opacity: 0; }
.font-loaded body { opacity: 1; transition: opacity 0.3s; }

/* Card hover scale fix on mobile (no hover) */
@media (hover: none) {
  .card:hover, .course-card:hover, .path-card:hover, .mentor-card:hover, .blog-card:hover {
    transform: none;
  }
}

/* Improve table-style filters wrap */
.filters {
  align-items: center;
}

/* Better visual hierarchy for sections */
.section + .section {
  padding-top: 0;
}

/* Make course cover SVGs scale well */
.course-cover svg, .course-side-cover svg {
  width: 60%;
  height: auto;
  max-width: 100px;
}

/* Hero pyramid visibility on mobile */
@media (max-width: 1023px) {
  .hero-orbit { display: none; }
}

/* Container has reasonable inner gutters on tablet */
@media (min-width: 641px) and (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Style the embedded toast for theme parity */
[data-theme="light"] .toast {
  background: #ffffff;
  color: var(--text-primary);
}

/* Avoid horizontal scroll due to aurora */
body { overflow-x: hidden; }

/* "Aurora" softer on smaller screens */
@media (max-width: 768px) {
  .aurora::before, .aurora::after { filter: blur(80px); opacity: 0.4; }
}

/* Active link emphasis */
.nav-menu a.active { color: var(--accent); font-weight: 600; }

/* Keep avatar text centered */
.avatar { font-family: var(--font-ar-secondary); }

/* Sticky footer-ish: keep consistent height */
html, body { min-height: 100vh; }

/* Light mode: better hero green-on-white contrast */
[data-theme="light"] .hero-title .accent {
  background: linear-gradient(135deg, var(--accent) 0%, #003319 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .hero-title .stroke {
  -webkit-text-stroke: 1.5px var(--accent);
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .stat-value {
  background: linear-gradient(135deg, var(--accent), #000);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Dashboard polish */
.dashboard-side a svg { flex-shrink: 0; }
.dashboard-side a.active { font-weight: 700; }

/* Path card num align */
.path-card .path-num {
  position: absolute;
  inset-inline-end: var(--sp-4);
  top: var(--sp-4);
}

/* Course card animation */
.course-card .course-cover svg { transition: transform var(--dur-base) var(--ease-out); }
.course-card:hover .course-cover svg { transform: scale(1.1) rotate(2deg); }

/* Decorative line under page-header h1 */
.page-header h1 {
  position: relative;
  display: inline-block;
}
.page-header h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--r-pill);
}
[dir="rtl"] .page-header h1::after { transform: translateX(-50%); }
