:root {
  --blue: #2563EB;
  --blue-light: #3B82F6;
  --blue-dark: #1D4ED8;
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;
  --green-50: #F0FDF4;
  --green-600: #16A34A;
  --amber-50: #FFFBEB;
  --amber-600: #D97706;
  --bg: #FFFFFF;
  --text: var(--slate-800);
  --text-secondary: var(--slate-500);
  --border: var(--slate-200);
  --surface: var(--slate-50);
  --code-bg: var(--slate-100);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A;
    --text: #E2E8F0;
    --text-secondary: #94A3B8;
    --border: #334155;
    --surface: #1E293B;
    --code-bg: #1E293B;
    --blue-50: #1E293B;
    --blue-100: #1E3A5F;
    --slate-50: #1E293B;
    --slate-100: #334155;
    --green-50: #0D2818;
    --amber-50: #2D1F04;
  }
}
:root[data-theme="dark"] {
  --bg: #0F172A;
  --text: #E2E8F0;
  --text-secondary: #94A3B8;
  --border: #334155;
  --surface: #1E293B;
  --code-bg: #1E293B;
  --blue-50: #1E293B;
  --blue-100: #1E3A5F;
  --slate-50: #1E293B;
  --slate-100: #334155;
  --green-50: #0D2818;
  --amber-50: #2D1F04;
}
:root[data-theme="light"] {
  --bg: #FFFFFF;
  --text: var(--slate-800);
  --text-secondary: var(--slate-500);
  --border: var(--slate-200);
  --surface: var(--slate-50);
  --code-bg: var(--slate-100);
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --green-50: #F0FDF4;
  --amber-50: #FFFBEB;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* --- HEADER --- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.logo-link:hover { text-decoration: none; }
.logo-link svg { width: 28px; height: 28px; flex-shrink: 0; }
.header-sep { color: var(--slate-300); font-weight: 300; font-size: 1.25rem; }
.header-label { color: var(--text-secondary); font-weight: 500; font-size: 0.9rem; }
.header-nav { margin-left: auto; display: flex; gap: 1.25rem; font-size: 0.875rem; }
.header-nav a { color: var(--text-secondary); }
.header-nav a:hover { color: var(--blue); text-decoration: none; }

/* --- LAYOUT --- */
.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* --- HOME --- */
.hero { text-align: center; padding: 2.5rem 0 2rem; }
.hero h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.hero p { color: var(--text-secondary); font-size: 1.05rem; max-width: 480px; margin: 0 auto; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.category-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: border-color 0.15s;
}
.category-card:hover { border-color: var(--blue-light); }
.category-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-card .icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.category-card ul { list-style: none; }
.category-card li { padding: 0.3rem 0; }
.category-card li a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.category-card li a::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--slate-300);
  flex-shrink: 0;
}
.category-card li a:hover { color: var(--blue); text-decoration: none; }

/* --- ARTICLE --- */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--blue); }

.article { max-width: 680px; }
.article h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.article .subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }
.article h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.article h2:first-of-type { border-top: none; padding-top: 0; }
.article h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.article p { margin-bottom: 0.875rem; }
.article ul, .article ol { margin: 0.5rem 0 1rem 1.25rem; }
.article li { margin-bottom: 0.375rem; }
.article strong { font-weight: 600; }

.callout {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.callout-info { background: var(--blue-50); border-left: 3px solid var(--blue); }
.callout-tip { background: var(--green-50); border-left: 3px solid var(--green-600); }
.callout-warn { background: var(--amber-50); border-left: 3px solid var(--amber-600); }
.callout strong { display: block; margin-bottom: 0.25rem; }

.steps {
  counter-reset: step;
  list-style: none;
  margin-left: 0;
  padding-left: 2rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: -2rem;
  top: 0.1rem;
  width: 1.5rem; height: 1.5rem;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; background: var(--surface); }

.updated {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* --- FOOTER --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--blue); }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.35rem; }
  .category-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
