/* ══════════════════════════════════════════════════════════
   base.css — Design system variables, reset, typography
   uiux.bd — Bangladesh UI/UX Designer Community
   ══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
  color-scheme: light;
  /* Brand — royal blue, light blue, violet on a pale-blue canvas */
  --color-brand: #0B63F6;          /* royal blue — primary fills, links */
  --color-brand-soft: #DCEBFF;
  --color-on-brand: #FFFFFF;
  --color-sky: #A9D4FF;            /* light blue — secondary fills */
  --color-sky-soft: #E3F1FF;
  --color-violet: #A66BFF;         /* accent — use with dark text */
  --color-violet-soft: #EFE4FF;
  --color-on-violet: #0F1222;
  --color-bd-green: #006A4E;       /* Bangladesh flag */
  --color-bd-red: #F42A41;
  --color-brand-glow: rgba(255, 255, 255, 0.7);
  --color-primary: #0B63F6;
  --color-primary-light: #DCEBFF;
  --color-primary-dark: #0848B5;
  --color-primary-shadow: rgba(11, 99, 246, 0.25);
  --color-on-primary: #FFFFFF;
  --color-accent: #7C4DDB;
  --color-accent-light: #EFE4FF;

  /* Ink — outlines, headings, dark buttons (line-art look) */
  --color-ink: #0F1222;
  --color-ink-hover: #262B45;
  --color-on-ink: #FFFFFF;
  --color-line: #0F1222;           /* illustration outlines */
  --line: 1.5px solid var(--color-line);
  --pop: 4px 4px 0 var(--color-line);          /* hard offset shadow */
  --pop-brand: 6px 6px 0 var(--color-brand);   /* flat blue shadow */

  /* Neutrals */
  --color-bg: #F1F8FE;
  --color-surface: #FFFFFF;
  --color-surface-2: #E6F2FD;
  --color-surface-3: #D6E8FA;
  --color-border: #CFE0F2;
  --color-border-strong: #A9C3DE;

  /* Text */
  --color-text-primary: #0F1222;
  --color-text-secondary: #3D4560;
  --color-text-muted: #5F6886;
  --color-text-inverse: #FFFFFF;

  /* Semantic */
  --color-success: #1A9E6A;
  --color-success-light: #E2F7EE;
  --color-warning: #D97706;
  --color-warning-light: #FEF3C7;
  --color-error: #DC2626;
  --color-error-light: #FEE2E2;
  --color-info: #2563EB;
  --color-info-light: #DBEAFE;

  /* XP Tier colors */
  --color-tier-newcomer: #9B97B2;
  --color-tier-builder: #1A9E6A;
  --color-tier-expert: #0A7BBD;
  --color-tier-fellow: #D97706;

  /* Typography */
  --font-sans: 'Mona Sans', 'Hind Siliguri', 'Inter', -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26, 23, 48, 0.06),
    0 1px 2px rgba(26, 23, 48, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 23, 48, 0.08),
    0 2px 4px rgba(26, 23, 48, 0.04);
  --shadow-lg: 0 12px 32px rgba(26, 23, 48, 0.10),
    0 4px 8px rgba(26, 23, 48, 0.06);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 1280px;
  --sidebar-width: 260px;
  --header-height: 76px;
}

/* ── Dark mode overrides ───────────────────────────────── */
/* Dark theme is opt-in via the header toggle (light is the default). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0A0F1E;
  --color-surface: #111831;
  --color-surface-2: #18213D;
  --color-surface-3: #212C4D;
  --color-border: #26335A;
  --color-border-strong: #3A4A78;
  --color-text-primary: #F1F6FF;
  --color-text-secondary: #C3CCE6;
  --color-text-muted: #94A0C2;
  --color-ink: #F1F6FF;
  --color-ink-hover: #D6E0F7;
  --color-on-ink: #0A0F1E;
  --color-line: #C9D7F5;
  --color-brand: #5B8CFF;
  --color-on-brand: #0A0F1E;
  --color-brand-soft: #1A2B57;
  --color-sky: #2A4A80;
  --color-sky-soft: #17264A;
  --color-violet-soft: #2B1F4D;
  --color-primary: #7FA6FF;
  --color-primary-dark: #A9C4FF;
  --color-primary-light: #1A2B57;
  --color-on-primary: #0A0F1E;
  --color-primary-shadow: rgba(91, 140, 255, 0.25);
  --color-accent: #B994FF;
  --color-accent-light: #2B1F4D;
  --color-success-light: #0D2E1F;
  --color-warning-light: #2E1F0A;
  --color-error-light: #2E0D0D;
  --color-info-light: #0D1A2E;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-weight: var(--weight-semibold); }

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

strong, b {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-sm);
}

code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background-color: var(--color-surface-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* ── Lists ─────────────────────────────────────────────── */
ul, ol {
  list-style: none;
}

/* ── Images ────────────────────────────────────────────── */
img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Tables ────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ── Focus states ──────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Selection ─────────────────────────────────────────── */
::selection {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* ── Scrollbar (webkit) ────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-muted);
}

/* ── Utilities ─────────────────────────────────────────── */
.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;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
