/* ==========================================================================
   Quizora AI — shared foundation
   Tokens, reset, app shell (backdrop + sidebar + main), and reusable UI.
   Page-specific styles live in css/<page>.css.
   ========================================================================== */

/* ---------- Tokens (Figma variables, Dark mode) ---------- */
/* The product is dark-only by design, so the page commits to one dark look. */
:root {
  color-scheme: dark;
  --bg-page: #05171e;
  --bg-sidebar: #030f14;
  --bg-panel: rgba(10, 37, 48, 0.66);
  --bg-subtle: rgba(239, 240, 254, 0.04);
  --bg-brand-soft: rgba(99, 102, 241, 0.14);
  --border: rgba(129, 140, 248, 0.6);
  --text: #eff0fe;
  --muted: #94aab4;
  --brand: #6366f1;
  --accent: #67e8f9;

  --grad: linear-gradient(90deg, #8a8cf4 0%, #46adc5 100%);
  --glass: linear-gradient(152deg, rgba(99,102,241,.18) 6.7%, rgba(99,102,241,.02) 43.3%, rgba(8,145,178,.10) 73.3%), var(--bg-panel);
  --glow-card: 0 24px 56px -20px rgba(79, 70, 229, .22);
  --glow-btn: 0 6px 18px rgba(99, 102, 241, .55);

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --sidebar-w: 260px;
  --page-pad: 56px; /* left/right margin of the main column (smaller on narrow screens, see below) */

  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Familjen Grotesk", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --f-label: "Space Grotesk", system-ui, sans-serif; /* stands in for Acid Grotesk (not web-licensed) */

  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: none; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }

/* ---------- Backdrop (Component 34) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(100deg, #04141a 0%, #061721 35%, #0a1636 70%, #0d1840 100%);
}
.blob { position: absolute; border-radius: 50%; will-change: transform; animation: ease-in-out infinite alternate; }
.blob-1 { left: 48.6%; top: -36.7%; width: 72.2%; height: 81.3%; background: rgba(79,70,229,.19);  filter: blur(126px); animation-name: blob1; animation-duration: 18s; }
.blob-2 { left: 37.5%; top: 29.7%;  width: 44.4%; height: 50%;   background: rgba(26,24,78,.45);   filter: blur(144px); animation-name: blob2; animation-duration: 22s; }
.blob-3 { left: 14.6%; top: 73.8%;  width: 52.8%; height: 59.4%; background: rgba(33,153,217,.16); filter: blur(160px); animation-name: blob3; animation-duration: 20s; }
.blob-4 { left: 67.4%; top: 52.3%;  width: 47.9%; height: 55.9%; background: rgba(99,102,241,.18); filter: blur(130px); animation-name: blob4; animation-duration: 16s; }
@keyframes blob1 { to { transform: translate(-140px, 80px) scale(1.15); } }
@keyframes blob2 { to { transform: translate(120px, -60px) scale(1.2); } }
@keyframes blob3 { to { transform: translate(160px, -90px) scale(1.1); } }
@keyframes blob4 { to { transform: translate(-120px, -70px) scale(1.2); } }

.starfield { position: absolute; inset: 0; }
.star {
  position: absolute; border-radius: 50%; background: var(--text);
  animation: drift var(--dur) ease-in-out var(--delay) infinite alternate,
             twinkle var(--tw) ease-in-out var(--delay) infinite alternate;
}
.star.cyan { background: var(--accent); }

/* ---------- Sidebar (Component 28) — fixed ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--sidebar-w);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 32px 16px 40px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(99,102,241,.14) 0%, rgba(99,102,241,0) 50%, rgba(8,145,178,.08) 100%), var(--bg-sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-top { display: flex; flex-direction: column; gap: 24px; }
.sidebar-logo img { width: 138px; height: 34px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 17px; line-height: 1.55; color: var(--muted);
  transition: background .2s, color .2s;
}
.nav-item img { width: 20px; height: 20px; opacity: .85; transition: opacity .2s; }
.nav-item:hover { background: rgba(99,102,241,.08); color: var(--text); }
.nav-item:hover img,
.nav-item.is-active img { opacity: 1; }
.nav-item.is-active { background: var(--bg-brand-soft); color: var(--text); }

.profile-wrap { position: relative; margin-top: 24px; }
.profile {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--bg-panel); border: 1px solid transparent; border-radius: var(--radius-sm);
  text-align: left; cursor: pointer; transition: border-color .2s, background .2s;
}
.profile:hover,
.profile[aria-expanded="true"] { border-color: rgba(129,140,248,.35); background: rgba(10,37,48,.85); }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 18px; overflow: hidden; border: .6px solid var(--accent); }
.avatar img { width: 36px; height: 36px; }
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-size: 17px; line-height: 1.55; white-space: nowrap; }
.profile-sub { font-size: 14px; line-height: 1.45; color: var(--muted); white-space: nowrap; }
.profile-chev { flex: none; transform: rotate(180deg); transition: transform .25s var(--ease-out); }
.profile[aria-expanded="true"] .profile-chev { transform: none; }
.profile-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  display: flex; flex-direction: column; padding: 6px;
  background: rgba(7,26,34,.96); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease-out);
}
.profile-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.profile-menu a { padding: 10px 12px; border-radius: 8px; font-size: 15px; color: var(--muted); }
.profile-menu a:hover { background: var(--bg-brand-soft); color: var(--text); }
.profile-menu a.is-danger:hover { background: rgba(248,113,113,.12); color: #fca5a5; }

/* ---------- Main column ---------- */
.main {
  position: relative; z-index: 1;
  margin-left: var(--sidebar-w);
  padding: var(--page-pad);
  padding-bottom: clamp(32px, 4.5vw, 64px);
}
.content {
  width: 100%; /* no max-width: content always spans the space beside the sidebar, 56px margins */
  display: flex; flex-direction: column; gap: 24px;
  container: content / inline-size;
}

@media (max-width: 1100px) { :root { --page-pad: 32px; } }
@media (max-width: 760px)  { :root { --page-pad: 24px; } }

/* Page header (title + subtitle) */
.page-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.page-header p { max-width: 640px; }

/* ---------- Typography ---------- */
.display { font-family: var(--f-display); font-weight: 700; font-size: clamp(36px, 4.2cqw + 6px, 50px); line-height: 1.05; letter-spacing: -1px; }
.h-section { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 1.05; letter-spacing: -.48px; }
.h-card { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 1.05; letter-spacing: -.48px; }
.h-sub { font-family: var(--f-display); font-weight: 700; font-size: 24px; }
.h-small { font-family: var(--f-display); font-weight: 700; font-size: 20px; }
.body { font-size: 17px; line-height: 1.55; }
.small { font-size: 14px; line-height: 1.45; }
.muted { color: var(--muted); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow {
  font-family: var(--f-label); font-size: 12px; line-height: 1.2; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.eyebrow-mono {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-weight: 500; font-size: 11px; letter-spacing: 1.76px; color: var(--accent);
}
.num { font-variant-numeric: tabular-nums; }
.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;
}

/* ---------- Components ---------- */
.card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--glass);
  box-shadow: var(--glow-card), inset 0 1px 0 rgba(255,255,255,.07);
}

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-md);
  font-family: var(--f-label); font-size: 12px; line-height: 1.2; letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
}
.chip img,
.pulse-dot { animation: dotPulse 2s ease-in-out infinite; }
.pulse-dot { width: 22px; height: 22px; margin: -8px; }

.btn-primary {
  display: inline-flex; align-items: center; padding: 12px 22px; border-radius: 40px; background: var(--grad);
  font-family: var(--f-label); font-weight: 500; font-size: 15px; line-height: 1; letter-spacing: .1em; text-transform: uppercase; color: #fff;
  filter: drop-shadow(0 10px 18px rgba(8,145,178,.45));
  transition: transform .2s var(--ease-out), filter .2s;
}
.btn-primary:hover { transform: translateY(-2px); filter: drop-shadow(0 14px 24px rgba(8,145,178,.6)); }

.round-btn {
  position: relative; z-index: 1; flex: none;
  width: 48px; height: 48px; border-radius: 24px; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--grad); box-shadow: var(--glow-btn); cursor: pointer;
  transition: transform .25s var(--ease-out), box-shadow .25s;
}
.round-btn:hover { transform: scale(1.08); box-shadow: 0 8px 24px rgba(99,102,241,.7); }

.ico-box { flex: none; width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--bg-brand-soft); display: grid; place-items: center; }
.ico-box img { width: 22px; height: 22px; }
.ico-box.is-grad { background: var(--grad); }
.ico-box.is-grad img { width: 24px; height: 24px; }

.link-brand {
  display: inline-flex; align-items: center; gap: 8px; color: var(--brand);
  font-family: var(--f-label); font-weight: 500; font-size: 15px; line-height: 1; letter-spacing: .1em; text-transform: uppercase;
}
.link-brand img { width: 18px; height: 18px; transition: transform .25s var(--ease-out); }

/* ---------- Shared keyframes ---------- */
@keyframes drift    { to { transform: translate(var(--dx), var(--dy)); } }
@keyframes twinkle  { from { opacity: var(--o, 1); } to { opacity: calc(var(--o, 1) * .15); } }
@keyframes float    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(var(--amp, -6px)); } }
@keyframes breathe  { 50% { opacity: .5; } }
@keyframes pulse    { 50% { transform: scale(1.08); } }
@keyframes spot     { from { opacity: 1; } to { opacity: .5; } }
@keyframes dotPulse { 50% { opacity: .35; transform: scale(.8); } }

.twinkle { --o: 1; animation: twinkle 1.6s ease-in-out infinite alternate; }

/* ---------- Entrance ---------- */
.reveal { opacity: 0; transform: translateY(16px); }
.is-ready .reveal { animation: reveal .6s var(--ease-out) forwards; animation-delay: calc(var(--d, 0) * 70ms + 60ms); }
@keyframes reveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
