/* ============================================================
   남씨 한국사 — Design System (common)
   ============================================================ */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  /* Brand */
  --navy: #0f2744;
  --navy-deep: #0a1a2e;
  --navy-soft: #1a3a5c;
  --blue: #1a5fb4;
  --blue-light: #3584e4;
  --blue-pale: #e8f0fa;
  --blue-muted: #d4e4f5;

  /* Semantic boxes */
  --memory-bg: #fff8dc;
  --memory-border: #e6c200;
  --memory-text: #5c4a00;
  --trap-bg: #fdecea;
  --trap-border: #c01c28;
  --trap-text: #7a1018;
  --tip-bg: #e8f5e9;
  --tip-border: #2e7d32;
  --tip-text: #1b4d1e;

  /* Neutrals */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #444;
  --text-muted: #6b7280;
  --border: #d8dee6;
  --border-light: #e8ecf1;
  --table-header: #e8f0fa;
  --table-stripe: #f4f7fb;
  --gray-pale: #f0f2f5;

  /* Layout */
  --sidebar-w: 260px;
  --aside-w: 240px;
  --content-max: 720px;
  --header-h: 52px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(15, 39, 68, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 39, 68, 0.12);

  /* Type */
  --font-sans: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
  --font-serif: "Noto Serif KR", "Batang", Georgia, serif;
  --fs-base: 16px;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.35rem;
  --fs-2xl: 1.65rem;
  --fs-3xl: 2rem;
  --lh: 1.7;
  --lh-tight: 1.4;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.2s;
}

/* Dark mode */
[data-theme="dark"] {
  --navy: #8bb4e0;
  --navy-deep: #0d1117;
  --navy-soft: #1c2838;
  --blue: #6db3f2;
  --blue-light: #8ec8f8;
  --blue-pale: #1a2838;
  --blue-muted: #243447;
  --memory-bg: #3d3520;
  --memory-border: #c9a800;
  --memory-text: #f5e6a3;
  --trap-bg: #3a1e1e;
  --trap-border: #e05a5a;
  --trap-text: #f5b0b0;
  --tip-bg: #1e3320;
  --tip-border: #5cb85c;
  --tip-text: #b8e0b8;
  --bg: #0d1117;
  --surface: #161b22;
  --text: #e6edf3;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --border: #30363d;
  --border-light: #21262d;
  --table-header: #1a2838;
  --table-stripe: #131920;
  --gray-pale: #1c2128;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: var(--fs-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

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

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.25rem;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight);
  font-weight: 700;
  color: var(--blue);
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); margin: 1.5rem 0 0.6rem; }
h3 { font-size: var(--fs-xl); margin: 1.25rem 0 0.5rem; }
h4 { font-size: var(--fs-lg); margin: 1rem 0 0.4rem; color: var(--navy); }

p {
  margin: 0.5rem 0;
}

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--navy-deep);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 0.5rem;
}

/* Font size scale (JS toggles data-fs on html) */
html[data-fs="sm"] { --fs-base: 14px; }
html[data-fs="md"] { --fs-base: 16px; }
html[data-fs="lg"] { --fs-base: 18px; }
html[data-fs="xl"] { --fs-base: 20px; }
