/* ============================================================
   Study Guide Design System — base.css
   A comprehensive design token and utility layer for a
   static study guide site. Organized as:

     1. Custom Properties (Design Tokens)
     2. Reset & Base Styles
     3. Typography
     4. Animation Keyframes
     5. Utility Classes
     6. Responsive Adjustments
   ============================================================ */


/* ------------------------------------------------------------
   1. CUSTOM PROPERTIES
   ------------------------------------------------------------ */

:root {
  /* --- Colors: Brand --- */
  --color-primary:   #2563eb;
  --color-secondary: #0d9488;
  --color-accent:    #f59e0b;
  --color-success:   #10b981;
  --color-rose:      #f43f5e;
  --color-indigo:    #6366f1;
  --color-purple:    #8b5cf6;

  /* --- Colors: Neutral Gray Scale --- */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* --- Spacing (4 px increments) --- */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   12px;
  --space-lg:   16px;
  --space-xl:   24px;
  --space-2xl:  32px;
  --space-3xl:  48px;

  /* --- Border Radius --- */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* --- Shadows --- */
  --shadow-sm:  0 1px  2px rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px  6px rgba(0, 0, 0, 0.07),
                0 2px  4px rgba(0, 0, 0, 0.05);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.08),
                0 4px   6px rgba(0, 0, 0, 0.04);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.10),
                0 8px  10px rgba(0, 0, 0, 0.04);

  /* --- Transitions --- */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow:   0.35s ease;

  /* --- Typography: Font Families --- */
  --font-heading: Georgia, 'PT Serif', serif;
  --font-body:    system-ui, -apple-system, 'Segoe UI', Roboto,
                  Helvetica, Arial, sans-serif;
  --font-code:    'SF Mono', SFMono-Regular, ui-monospace,
                  'Cascadia Code', 'Fira Code', Menlo, monospace;

  /* --- Typography: Size Scale --- */
  --text-xs:   0.75rem;   /* 12 px */
  --text-sm:   0.875rem;  /* 14 px */
  --text-base: 1rem;      /* 16 px */
  --text-lg:   1.125rem;  /* 18 px */
  --text-xl:   1.25rem;   /* 20 px */
  --text-2xl:  1.5rem;    /* 24 px */
  --text-3xl:  2rem;      /* 32 px */
  --text-4xl:  2.5rem;    /* 40 px */
}


/* ------------------------------------------------------------
   2. RESET & BASE STYLES
   ------------------------------------------------------------ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--gray-900);
  background-color: var(--gray-50);
  -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 {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-indigo);
  text-decoration: underline;
}


/* ------------------------------------------------------------
   3. TYPOGRAPHY
   ------------------------------------------------------------ */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--gray-900);
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-xl);
}

h2 {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-lg);
}

code,
pre {
  font-family: var(--font-code);
  font-size: 0.9em;
}

code {
  background-color: var(--gray-100);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-indigo);
}

pre {
  background-color: var(--gray-800);
  color: var(--gray-100);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  border-radius: 0;
}


/* ------------------------------------------------------------
   4. ANIMATION KEYFRAMES
   ------------------------------------------------------------ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% { transform: scale(1); }
  50%  { transform: scale(1.05); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}


/* ------------------------------------------------------------
   5. UTILITY CLASSES
   ------------------------------------------------------------ */

/* --- Layout --- */

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: #fff;
}

.btn-secondary:hover {
  background-color: #0f766e;
}

/* --- Card --- */

.card {
  background-color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* --- Badge --- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125em 0.625em;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  border-radius: 9999px;
  background-color: var(--gray-100);
  color: var(--gray-700);
  white-space: nowrap;
}

.badge-primary {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-secondary {
  background-color: #ccfbf1;
  color: #115e59;
}

.badge-accent {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-rose {
  background-color: #ffe4e6;
  color: #9f1239;
}


/* ------------------------------------------------------------
   6. RESPONSIVE ADJUSTMENTS
   ------------------------------------------------------------ */

/* --- Tablet: 768 px and up --- */

@media (min-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }

  .container {
    padding-inline: var(--space-xl);
  }
}

/* --- Desktop: 1024 px and up --- */

@media (min-width: 1024px) {
  h1 {
    font-size: calc(var(--text-4xl) * 1.15);
  }

  h2 {
    font-size: calc(var(--text-3xl) * 1.1);
  }

  .container {
    padding-inline: var(--space-2xl);
  }
}
