/* MCQ Forge — tokens, reset, typography, atmosphere.
   Palette idea: midnight ink, molten gold (the forge), tempered-steel blue (the cool secondary).
   Correct = verdigris green, wrong = ember red. */

:root {
  color-scheme: dark;
  --font-display: 'Gloock', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-body: 'Hanken Grotesk', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial,
    'Noto Nastaliq Urdu', 'Noto Naskh Arabic', sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Noto Naskh Arabic', serif;

  /* dark (default) */
  --bg: #0c1121;
  --bg-2: #111832;
  --surface: rgba(23, 31, 58, 0.62);
  --surface-solid: #161d37;
  --surface-2: rgba(36, 46, 82, 0.55);
  --surface-hover: rgba(48, 60, 104, 0.55);
  --line: rgba(226, 222, 210, 0.09);
  --line-strong: rgba(226, 222, 210, 0.18);
  --text: #ece8dc;
  --text-2: #a9aec2;
  --text-3: #767d97;
  --gold: #f2b544;
  --gold-hi: #ffd57e;
  --ember: #e8743a;
  --on-gold: #1d1404;
  --gold-text: #f5c45f;
  --gold-soft: rgba(242, 181, 68, 0.14);
  --steel: #8fb0ff;
  --steel-soft: rgba(143, 176, 255, 0.14);
  --ok: #46d19a;
  --ok-soft: rgba(70, 209, 154, 0.14);
  --bad: #f4645c;
  --bad-soft: rgba(244, 100, 92, 0.14);
  --warn: #f2b544;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px -12px rgba(2, 4, 14, 0.7);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 30px 60px -20px rgba(2, 4, 14, 0.85);
  --glow-gold: 0 0 0 1px rgba(242, 181, 68, 0.35), 0 10px 40px -8px rgba(242, 181, 68, 0.45);
  --aurora-a: rgba(242, 160, 50, 0.20);
  --aurora-b: rgba(96, 130, 255, 0.18);
  --aurora-c: rgba(232, 116, 58, 0.10);
  --grain-opacity: 0.07;
  --chart-grid: rgba(226, 222, 210, 0.07);
  --ring-track: rgba(226, 222, 210, 0.08);
  --scrim: rgba(5, 8, 20, 0.66);

  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* type scale (≈1.25, anchored at 16px) */
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: clamp(2.2rem, 4.2vw, 3rem);
  --fs-hero: clamp(3.5rem, 9vw, 6rem);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #eceef5;
  --bg-2: #e3e6f0;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: rgba(234, 237, 247, 0.9);
  --surface-hover: rgba(222, 227, 243, 0.95);
  --line: rgba(20, 28, 56, 0.09);
  --line-strong: rgba(20, 28, 56, 0.18);
  --text: #141a30;
  --text-2: #475071;
  --text-3: #6d7593;
  --gold: #eaa22a;
  --gold-hi: #f5bd52;
  --ember: #d9601f;
  --on-gold: #1d1404;
  --gold-text: #925c00;
  --gold-soft: rgba(234, 162, 42, 0.16);
  --steel: #3f63d6;
  --steel-soft: rgba(63, 99, 214, 0.1);
  --ok: #138a5c;
  --ok-soft: rgba(19, 138, 92, 0.1);
  --bad: #cf3a33;
  --bad-soft: rgba(207, 58, 51, 0.09);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 8px 24px -14px rgba(26, 34, 70, 0.28);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 24px 50px -22px rgba(26, 34, 70, 0.35);
  --glow-gold: 0 0 0 1px rgba(214, 140, 20, 0.45), 0 10px 30px -10px rgba(234, 162, 42, 0.55);
  --aurora-a: rgba(245, 178, 70, 0.28);
  --aurora-b: rgba(110, 140, 255, 0.20);
  --aurora-c: rgba(232, 116, 58, 0.08);
  --grain-opacity: 0.045;
  --chart-grid: rgba(20, 28, 56, 0.08);
  --ring-track: rgba(20, 28, 56, 0.09);
  --scrim: rgba(20, 26, 48, 0.42);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.15; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--gold); color: var(--on-gold); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
h1.display { font-size: var(--fs-3xl); }
h2.display { font-size: var(--fs-xl); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }
.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;
}
/* Urdu / RTL text gets a Nastaliq face and more line height */
[dir='rtl'], .urdu { font-family: var(--font-urdu); line-height: 2.1; }

/* ---------- atmosphere: aurora glow + grain ---------- */
.atmos {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60vw 50vh at 12% -8%, var(--aurora-a), transparent 70%),
    radial-gradient(55vw 55vh at 105% 18%, var(--aurora-b), transparent 70%),
    radial-gradient(70vw 50vh at 50% 120%, var(--aurora-c), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.atmos::after {
  content: '';
  position: absolute; inset: -50%;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme='light'] .atmos::after { filter: invert(1); }

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