/* ===== AI-Generated Responsive Design =====
 * Created by: 콩미니 (Kong-mini)
 * Models: GPT-4.1 + Claude 3.5 Sonnet
 * Last Updated: 2026-02-24
 *
 * Policy: P1 (Device Agnosticism), P2 (No Essence Compromise)
 * Task: L4-1 ~ L4-3 (Mobile Breakpoint & Typography)
 */

/* ===== CSS Variables ===== */
:root {
  /* Breakpoints */
  --mobile-max: 767px;
  --tablet-min: 768px;
  --tablet-max: 1199px;
  --desktop-min: 1200px;

  /* Spacing (Mobile-first) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Typography (Mobile-first) */
  --font-size-base: 16px;  /* Minimum readable size */
  --font-size-sm: 14px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-xxl: 32px;

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Touch targets (Apple HIG) */
  --touch-target-min: 44px;
}

/* ===== Typography Scale (Fluid) ===== */
html {
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

/* Mobile: Base sizes */
h1 {
  font-size: var(--font-size-xxl);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-sm);
}

/* Code font sizes */
pre, code {
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

/* ===== Spacing (Mobile-first) ===== */
.container {
  padding: var(--space-md);
  max-width: 100%;
}

section {
  margin-bottom: var(--space-xl);
}

/* ===== Touch Targets (Mobile) ===== */
button, .btn {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
}

/* ===== Single Column Layout (Mobile) ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr;  /* Single column */
  gap: var(--space-md);
}

/* ===== Stack Vertical Layout ===== */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ===== Tablet (768px - 1199px) ===== */
@media (min-width: 768px) {
  :root {
    /* Tablet spacing */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 32px;
    --space-xl: 48px;

    /* Tablet typography */
    --font-size-base: 18px;
    --font-size-sm: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 28px;
    --font-size-xxl: 36px;
  }

  /* 2-column layout for tablet */
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Side-by-side layout */
  .split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }
}

/* ===== Desktop (1200px+) ===== */
@media (min-width: 1200px) {
  :root {
    /* Desktop spacing */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 48px;
    --space-xl: 64px;

    /* Desktop typography */
    --font-size-base: 20px;
    --font-size-sm: 18px;
    --font-size-lg: 22px;
    --font-size-xl: 32px;
    --font-size-xxl: 48px;
  }

  /* 3-column layout for desktop */
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Max-width container */
  .container {
    max-width: 1400px;
    margin: 0 auto;
  }

  /* Full side-by-side layout */
  .split-view {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Print Styles ===== */
@media print {
  /* Save paper */
  body {
    font-size: 12pt;
  }

  /* Hide interactive elements */
  button, .btn, .quiz-controls {
    display: none;
  }
}

/* ===== Dark Mode (Future) ===== */
@media (prefers-color-scheme: dark) {
  /* Will implement later in Rate-Tasks */
}

/* ===== High Contrast Mode (Accessibility) ===== */
@media (prefers-contrast: high) {
  /* Increase contrast for visibility */
  :root {
    --font-size-base: 18px;
  }

  /* Will implement in P1 Rate-Task */
}

/* ===== Reduced Motion (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
  /* Disable animations for users who prefer reduced motion */
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
