/**
 * Academy - Main Stylesheet (Developer-Platform AI Laboratory Aesthetic)
 * Single source of truth for design tokens is centralized in styles/tokens.css.
 * Built with CSS Logical Properties (margin-inline, padding-inline, inset-inline).
 */

@import './tokens.css';

/* ==========================================================================
   1. Typography & Self-Hosted Fonts (Vazirmatn - OFL License)
   ========================================================================== */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/vazirmatn/vazirmatn-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/vazirmatn/vazirmatn-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/vazirmatn/vazirmatn-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   2. Design System Tokens
   Tokens are centralized in styles/tokens.css (single source of truth).
   ========================================================================== */

/* ==========================================================================
   3. Reset & Architectural Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  line-height: var(--line-height-normal);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

/* Persian typography override */
html[lang="fa"] {
  font-family: var(--font-persian);
  line-height: 1.85;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-base);
  background-image: var(--gradient-hero-glow, none);
  background-size: 100% 100%;
  background-position: 0 0;
  background-attachment: fixed;
  color: var(--color-text-primary);
  overflow-x: hidden;
  width: 100%;
}

/* Code, telemetry & monospace blocks */
code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  direction: ltr !important;
  unicode-bidi: isolate;
}

/* Links */
a {
  color: var(--color-accent-ai);
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease;
}

a:hover {
  text-decoration: none;
  color: var(--color-accent-ai-hover);
}

/* Visible Accessible Focus Ring Everywhere */
:focus-visible {
  outline: 2px solid var(--color-focus-ring) !important;
  outline-offset: 2px !important;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -120px;
  inset-inline-start: var(--space-4);
  background: var(--gradient-brand);
  color: #ffffff;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-lg);
  transition: top 250ms ease;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Accessibility utility */
.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;
}

/* Directional Icon Flipping for RTL */
html[dir="rtl"] .icon-directional {
  transform: scaleX(-1);
}

html[dir="rtl"] .icon-directional-reverse {
  transform: scaleX(-1);
}

/* ==========================================================================
   4. Prefers-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;
  }
}
