/* ═══════════════════════════════════════════════════════
   CFA.PREP v2 — Design System
   Premium, clean, modern educational platform
   ═══════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* ── DESIGN TOKENS ── */
:root {
  /* Color — Refined Navy + Blue accent */
  --c-bg:        #F8FAFB;
  --c-surface:   #FFFFFF;
  --c-surface-2: #F1F5F9;
  --c-surface-3: #F8FAFC;
  --c-border:    #E2E8F0;
  --c-border-2:  #CBD5E1;

  --c-text:      #0F172A;
  --c-text-2:    #334155;
  --c-text-3:    #64748B;
  --c-text-4:    #94A3B8;

  --c-primary:   #2563EB;
  --c-primary-h: #1D4ED8;
  --c-primary-l: #DBEAFE;
  --c-primary-xl:#EFF6FF;

  --c-accent:    #D97706;
  --c-accent-h:  #B45309;
  --c-accent-l:  #FEF3C7;

  --c-success:   #059669;
  --c-success-l: #ECFDF5;
  --c-error:     #DC2626;
  --c-error-l:   #FEF2F2;

  /* Typography */
  --f-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  --f-serif: 'DM Serif Display', 'Noto Serif KR', Georgia, serif;
  --f-mono:  'IBM Plex Mono', 'SF Mono', Consolas, monospace;

  /* Font Sizes — fluid scale */
  --fs-xs:   0.75rem;    /* 12px */
  --fs-sm:   0.8125rem;  /* 13px */
  --fs-base: 0.9375rem;  /* 15px */
  --fs-md:   1.0625rem;  /* 17px */
  --fs-lg:   1.25rem;    /* 20px */
  --fs-xl:   1.5rem;     /* 24px */
  --fs-2xl:  2rem;       /* 32px */
  --fs-3xl:  2.5rem;     /* 40px */

  /* Spacing */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-2xl: 32px;
  --r-full: 9999px;

  /* Shadow — layered for depth */
  --sh-xs:  0 1px 2px rgba(0,0,0,.04);
  --sh-sm:  0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --sh-md:  0 4px 16px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --sh-lg:  0 8px 32px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  --sh-xl:  0 20px 60px rgba(0,0,0,.10), 0 4px 16px rgba(0,0,0,.05);
  --sh-primary: 0 4px 14px rgba(37,99,235,.25);
  --sh-primary-lg: 0 8px 30px rgba(37,99,235,.30);

  /* Transition — cubic-bezier for premium feel */
  --tr:     all .25s cubic-bezier(.4,0,.2,1);
  --tr-s:   all .15s cubic-bezier(.4,0,.2,1);
  --tr-bounce: all .35s cubic-bezier(.34,1.56,.64,1);

  /* Layout — 92% viewport for immersive feel */
  --max-w:  92vw;
  --max-w-content: 1440px;
  --nav-h:  64px;
  --mob-nav: 56px;
}

/* ── BASE TYPOGRAPHY ── */
body {
  font-family: var(--f-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--c-text);
}
h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; }
h3 { font-size: var(--fs-xl);  font-weight: 700; letter-spacing: -0.01em; }
h4 { font-size: var(--fs-lg);  font-weight: 700; }
h5 { font-size: var(--fs-md);  font-weight: 600; }
h6 { font-size: var(--fs-base); font-weight: 600; }

p { margin-bottom: var(--sp-4); color: var(--c-text-2); }
small { font-size: var(--fs-xs); color: var(--c-text-3); }

/* ── LAYOUT UTILITIES ── */
.container {
  width: var(--max-w);
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.page-content {
  padding-top: calc(var(--nav-h) + var(--sp-8));
  padding-bottom: var(--sp-16);
  min-height: 100vh;
}

/* ── CARD ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  transition: var(--tr);
}
.card:hover {
  border-color: var(--c-border-2);
  box-shadow: var(--sh-md);
  transform: translateY(-1px);
}
.card-flat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: var(--tr);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-primary) 0%, #1D4ED8 100%);
  color: #fff;
  box-shadow: var(--sh-primary);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1D4ED8 0%, #1e40af 100%);
  box-shadow: var(--sh-primary-lg);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-accent {
  background: linear-gradient(135deg, var(--c-accent) 0%, #B45309 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(217,119,6,.25);
}
.btn-accent:hover {
  box-shadow: 0 8px 24px rgba(217,119,6,.30);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--c-text-2);
  border: 1.5px solid var(--c-border);
}
.btn-outline:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-xl);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-3);
}
.btn-ghost:hover { color: var(--c-primary); background: var(--c-primary-xl); }

.btn-lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-base);
  border-radius: var(--r-lg);
  font-weight: 700;
}
.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-primary { background: var(--c-primary-l); color: var(--c-primary); }
.badge-accent  { background: var(--c-accent-l);  color: var(--c-accent); }
.badge-success { background: var(--c-success-l); color: var(--c-success); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root {
    --fs-3xl: 1.75rem;
    --fs-2xl: 1.5rem;
    --fs-xl:  1.25rem;
    --nav-h:  56px;
  }
  .container { padding: 0 var(--sp-4); }
  .page-content {
    padding-top: calc(var(--nav-h) + var(--sp-4));
    padding-bottom: var(--sp-12);
  }
}

@media (max-width: 480px) {
  :root {
    --fs-3xl: 1.5rem;
    --fs-2xl: 1.3rem;
  }
}

/* ── ACCESSIBILITY ── */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}
.animate-fade-up { animation: fadeInUp .5s cubic-bezier(.4,0,.2,1) forwards; }
.animate-fade-in { animation: fadeIn .4s ease forwards; }
.animate-scale-in { animation: scaleIn .3s cubic-bezier(.4,0,.2,1) forwards; }

/* ── SCROLLBAR (Webkit) ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border-2);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text-4); }

/* ── SELECTION ── */
::selection {
  background: var(--c-primary-l);
  color: var(--c-primary-h);
}
