/* ieasybooks — base styles, palette, typography tokens */

:root {
  /* Palette */
  --c-bg: #0d1f38;
  --c-bg-elev: #15355A;
  --c-accent-navy: #2662A6;
  --c-accent-magenta: #882E8E;
  --c-accent-burgundy: #6C1B54;
  --c-text: #E2D1DD;
  --c-text-dim: rgba(226, 209, 221, 0.82);
  --c-text-faint: rgba(226, 209, 221, 0.62);
  --c-border: rgba(226, 209, 221, 0.14);
  --c-border-strong: rgba(226, 209, 221, 0.24);

  /* Gradients per card theme */
  --gradient-navy: linear-gradient(145deg, rgba(38, 98, 166, 0.15) 0%, rgba(21, 53, 90, 0.40) 100%);
  --gradient-burgundy: linear-gradient(145deg, rgba(136, 46, 142, 0.15) 0%, rgba(108, 27, 84, 0.30) 100%);

  /* Typography */
  --font-ar: "Noor", "Noor Regular", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-en: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: var(--font-en);

  /* Spacing scale (px) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.25);

  /* Motion */
  --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
  --t-reveal: 700ms;
  --t-reveal-slow: 1000ms;
}

/* Self-hosted fonts (files added in Task 3) */
@font-face {
  font-family: "Noor";
  src: url("/assets/fonts/Noor-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noor";
  src: url("/assets/fonts/Noor-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Arabic page uses Noor primary */
html[lang="ar"] body {
  font-family: var(--font-ar);
}
html[lang="ar"] body * {
  font-family: inherit;
}
/* Latin characters inside Arabic page fall back to Inter */
html[lang="ar"] .latin {
  font-family: var(--font-en);
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--c-text);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--c-accent-magenta);
  color: #fff;
}
/* ieasybooks — layout: hero, timeline, card, footer */

/* ─── Hero ─────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-7) var(--s-5) var(--s-9);
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(136, 46, 142, 0.18) 0%, transparent 60%),
    var(--c-bg);
}

.hero__logo {
  width: 88px;
  height: 88px;
  border-radius: var(--r-md);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}
.hero__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.hero__name {
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 44px);
  margin-top: var(--s-5);
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: #fff;
}

.hero__subtitle {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: var(--s-2);
  color: var(--c-text-dim);
}

.hero__tagline {
  font-size: clamp(14px, 2.5vw, 16px);
  margin-top: var(--s-5);
  max-width: 480px;
  line-height: 1.6;
  color: var(--c-text-dim);
}

.hero__locales {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.hero__locale {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-dim);
  transition: all 200ms ease;
}
.hero__locale[aria-current="true"] {
  background: rgba(226, 209, 221, 0.10);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.hero__locale:hover { color: var(--c-text); border-color: var(--c-border-strong); }

.hero__scroll-hint {
  position: absolute;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--c-text-faint);
  letter-spacing: 1px;
}

/* ─── Timeline ────────────────────────────────────────────── */
.timeline {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}

.year-group {
  position: relative;
  padding: var(--s-9) 0 var(--s-6);
}
.year-group:last-child { padding-bottom: var(--s-9); }

.year-glyph {
  position: absolute;
  top: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-en);
  font-weight: 800;
  font-size: clamp(80px, 24vw, 320px);
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: rgba(226, 209, 221, 0.06);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}

/* ─── Project Card ────────────────────────────────────────── */
.project-card {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto var(--s-5);
  padding: var(--s-5) var(--s-5);
  background: var(--gradient-navy);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(10px);
  display: flex;
  gap: var(--s-4);
  box-shadow: var(--shadow-card);
}
.project-card[data-gradient="burgundy"] { background: var(--gradient-burgundy); }

.project-card__logo {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: rgba(226, 209, 221, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}
.project-card__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: calc(var(--r-md) - 4px);
}
/* Typographic glyph fallback when no logo (e.g., Tafrigh) */
.project-card__logo--glyph {
  background: linear-gradient(135deg, var(--c-accent-burgundy), var(--c-accent-magenta));
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
}

.project-card__body { flex: 1; min-width: 0; }

.project-card__meta {
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-text-faint);
  margin-bottom: var(--s-1);
}

.project-card__name-primary {
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 24px;
  color: #fff;
  line-height: 1.2;
}

.project-card__name-secondary {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--c-text-dim);
  margin-top: 2px;
}

.project-card__tagline {
  font-size: 13px;
  line-height: 1.55;
  color: var(--c-text-dim);
  margin-top: var(--s-3);
}

.project-card__section-label {
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-text-faint);
  margin-top: var(--s-4);
  margin-bottom: var(--s-2);
}

.project-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.project-card__links--repositories { margin-top: var(--s-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(226, 209, 221, 0.10);
  border: 1px solid var(--c-border);
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--c-text);
  transition: all 200ms ease;
  white-space: nowrap;
}
.pill:hover {
  background: rgba(226, 209, 221, 0.16);
  border-color: var(--c-border-strong);
  transform: translateY(-1px);
}
.pill__icon {
  display: flex;
  align-items: center;
  transform: translateY(0.5px);
}
.pill svg {
  width: 13px;
  height: 13px;
}

/* RTL: reverse icon/label order in pills so icon reads right */
html[dir="rtl"] .pill { flex-direction: row-reverse; }

/* ─── Stats ───────────────────────────────────────────────── */
.stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: var(--s-8) var(--s-5);
  text-align: center;
}

.stats__item {
  padding: 0 clamp(24px, 5vw, 48px);
}

.stats__divider {
  width: 1px;
  height: 48px;
  background: rgba(226, 209, 221, 0.15);
  flex-shrink: 0;
}

.stats__number {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: clamp(28px, 5vw, 40px);
  color: #fff;
  letter-spacing: -1px;
  line-height: 1;
}

.stats__label {
  font-size: 12px;
  color: var(--c-text-faint);
  margin-top: var(--s-2);
}

@media (max-width: 520px) {
  .stats { flex-direction: column; gap: var(--s-6); }
  .stats__divider { width: 48px; height: 1px; }
}

/* ─── Tutorials ───────────────────────────────────────────── */
.tutorials {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-5);
}

.tutorials__title {
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  text-align: center;
  margin-bottom: var(--s-2);
}

.tutorials__subtitle {
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--c-text-faint);
  text-align: center;
  margin-bottom: var(--s-6);
}

.tutorials__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-border);
}
.tutorials__row:last-child { border-bottom: none; }

.tutorials__project {
  font-size: 12px;
  color: var(--c-text-faint);
  width: 56px;
  flex-shrink: 0;
  text-align: right;
}
html[dir="ltr"] .tutorials__project { text-align: left; }

.tutorials__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  flex: 1;
}

.tutorials__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(226, 209, 221, 0.06);
  border: 1px solid var(--c-border);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--c-text);
  white-space: nowrap;
  transition: all 200ms ease;
}
.tutorials__link:hover {
  background: rgba(226, 209, 221, 0.14);
  border-color: var(--c-border-strong);
  transform: translateY(-1px);
}
.tutorials__play {
  font-size: 9px;
  opacity: 0.7;
}
html[dir="rtl"] .tutorials__play {
  transform: scaleX(-1);
  display: inline-block;
}

@media (max-width: 520px) {
  .tutorials__row { flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .tutorials__project { width: auto; text-align: right; }
  html[dir="ltr"] .tutorials__project { text-align: left; }
  .tutorials__links { justify-content: flex-start; }
}

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid rgba(226, 209, 221, 0.08);
  padding: var(--s-6) var(--s-5);
  text-align: center;
  margin-top: var(--s-7);
}

.site-footer__socials {
  display: flex;
  justify-content: center;
  gap: var(--s-5);
  margin-bottom: var(--s-4);
}
/* CSS-mask approach: each social link sets --mask inline to the icon URL.
   The icon is painted by background-color, so :hover color shifts work
   even though we're loading flat SVG files (not inlining them). */
.site-footer__social {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-color: var(--c-text-dim);
  -webkit-mask: var(--mask) no-repeat center / contain;
          mask: var(--mask) no-repeat center / contain;
  opacity: 0.7;
  transition: background-color 200ms ease, opacity 200ms ease, transform 200ms ease;
}
.site-footer__social:hover {
  background-color: var(--c-accent-magenta);
  opacity: 1;
  transform: translateY(-2px);
}

.site-footer__copy {
  font-size: 12px;
  color: var(--c-text-faint);
}
.site-footer__copy a {
  color: var(--c-text-dim);
  text-decoration: underline;
  text-decoration-color: var(--c-border);
  text-underline-offset: 3px;
}
.site-footer__copy a:hover { color: var(--c-accent-magenta); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
  .year-group { padding-top: var(--s-7); }
  .year-glyph { font-size: 72px; top: var(--s-4); opacity: 0.5; }
  .project-card { padding: var(--s-4); gap: var(--s-3); }
  .project-card__logo { width: 44px; height: 44px; }
  .project-card__name-primary { font-size: 20px; }
  .site-footer__socials { gap: var(--s-4); }
}
/* ieasybooks — reveal animations */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--t-reveal) var(--ease-reveal),
    transform var(--t-reveal) var(--ease-reveal);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Year glyphs take longer to settle */
.year-glyph.reveal {
  transition-duration: var(--t-reveal-slow);
}

/* Reduced motion: no animation, everything visible immediately */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
