/* ===== Reset & Base ===== */

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

:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #5a6278;
  --color-text-muted: #4f5870;
  --color-primary: #1a56db;
  --color-primary-hover: #1242b0;
  --color-primary-light: #e8eefb;
  --color-accent: #047857;
  --color-accent-hover: #065f46;
  --color-border: #e5e7eb;
  --color-border-light: #f0f1f3;
  --color-warning: #b45309;
  --color-danger: #b91c1c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.09);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--color-primary-hover); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 300;
  background: var(--color-text);
  color: #fff !important;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}

.skip-link:focus-visible {
  top: 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  white-space: nowrap;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
}

.brand:hover { color: var(--color-text); }

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), #3b82f6);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 18px;
}

.brand-mark { display: none; }

.site-nav { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }

.site-nav a,
.nav-dropdown-toggle {
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.site-nav a:hover,
.nav-dropdown-toggle:hover {
  color: var(--color-text);
  background: var(--color-primary-light);
}

.site-nav a.is-active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
  flex-shrink: 0;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.nav-dropdown.is-active > .nav-dropdown-toggle {
  color: var(--color-primary);
}

.nav-caret {
  font-size: 10px;
  transition: transform 0.15s;
}

.nav-dropdown.is-open > .nav-dropdown-toggle .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 4px;
  z-index: 200;
}

.nav-dropdown.is-open > .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu a {
  white-space: nowrap;
  padding: 8px 12px;
}

/* ===== Main Content ===== */

main { padding: 32px 0 48px; flex: 1; }

/* ===== Hero Section ===== */

.hero-section {
  margin-bottom: 32px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.page-subtitle {
  color: var(--color-text-secondary);
  font-size: 16px;
  margin-top: 6px;
  font-weight: 400;
}

/* ===== Dark Mode ===== */

[data-theme="dark"] {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-text: #e4e6eb;
  --color-text-secondary: #a0a6b4;
  --color-text-muted: #8890a0;
  --color-primary: #5b8def;
  --color-primary-hover: #7da5f7;
  --color-primary-light: #1e2a42;
  --color-accent: #34d399;
  --color-accent-hover: #6ee7b7;
  --color-border: #2a2d3a;
  --color-border-light: #23262f;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] .brand-icon {
  background: linear-gradient(135deg, #5b8def, #60a5fa);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text);
  margin-left: auto;
  transition: background 0.15s;
}

.theme-toggle:hover {
  background: var(--color-primary-light);
}

/* ===== Mobile Nav Toggle ===== */

.nav-toggle { display: none; }

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
  opacity: 0;
}
.nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-toggle-label {
    display: flex;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
  }

  .nav-toggle:checked ~ .site-nav {
    display: flex;
  }

  .site-nav a,
  .nav-dropdown-toggle {
    padding: 10px 12px;
  }

  .nav-dropdown-menu {
    position: static;
    border: none;
    box-shadow: none;
    min-width: 0;
    padding: 0 0 0 12px;
  }

  .nav-dropdown-menu a {
    padding: 8px 12px;
  }

  .nav-dropdown.is-open > .nav-dropdown-menu {
    display: flex;
  }

  .header-inner {
    flex-wrap: wrap;
  }
}

/* ===== Empty State ===== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
  font-size: 17px;
}
