@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-secondary: #3b82f6;
  --color-cta: #f97316;
  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-header: #0f172a;
  --color-success: #10b981;
  --color-success-icon: #059669;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  --color-error-border: #fca5a5;
  --color-warning: #f59e0b;
  --color-accent-blue-bg: #eff6ff;
  --color-accent-blue-border: #bfdbfe;
  --color-accent-green-bg: #ecfdf5;
  --color-accent-green-border: #6ee7b7;
  --color-note-bg: #fffbeb;
  --color-note-border: #fcd34d;
  --color-code-bg: #f1f5f9;
  --color-badge-open-bg: #dbeafe;
  --color-badge-open-text: #1e40af;
  --color-badge-progress-bg: #fef3c7;
  --color-badge-progress-text: #92400e;
  --color-badge-waiting-bg: #fce7f3;
  --color-badge-waiting-text: #9d174d;
  --color-badge-resolved-bg: #d1fae5;
  --color-badge-resolved-text: #065f46;
  --color-badge-closed-bg: #f1f5f9;
  --color-badge-closed-text: #475569;
  --color-star-inactive: #cbd5e1;
  --color-star-active: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 1px 3px rgba(37, 99, 235, 0.06);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-secondary: #60a5fa;
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #0f172a;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-header: #020617;
  --color-success: #34d399;
  --color-success-icon: #34d399;
  --color-error: #f87171;
  --color-error-bg: #2d1215;
  --color-error-border: #7f1d1d;
  --color-warning: #fbbf24;
  --color-accent-blue-bg: #172040;
  --color-accent-blue-border: #1e3a5f;
  --color-accent-green-bg: #0a2f1f;
  --color-accent-green-border: #065f46;
  --color-note-bg: #1c1a0f;
  --color-note-border: #78600a;
  --color-code-bg: #0f172a;
  --color-badge-open-bg: #1e3a5f;
  --color-badge-open-text: #93c5fd;
  --color-badge-progress-bg: #3d2e0a;
  --color-badge-progress-text: #fbbf24;
  --color-badge-waiting-bg: #3d1530;
  --color-badge-waiting-text: #f9a8d4;
  --color-badge-resolved-bg: #0a2f1f;
  --color-badge-resolved-text: #6ee7b7;
  --color-badge-closed-bg: #1e293b;
  --color-badge-closed-text: #94a3b8;
  --color-star-inactive: #475569;
  --color-star-active: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
}

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

.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;
}

.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  transform: scaleX(0);
  transform-origin: left;
  z-index: 1000;
  pointer-events: none;
}

body.is-navigating .page-progress {
  animation: progressBar 1.2s ease-in-out infinite;
}

@keyframes progressBar {
  0%   { transform: scaleX(0); opacity: 1; }
  50%  { transform: scaleX(0.6); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  body.is-navigating .page-progress {
    animation: none;
    transform: scaleX(1);
    opacity: 0.4;
  }
}

/* --- Site Header --- */

.site-header {
  background: var(--color-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 56px;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.site-header .brand-mark {
  border-radius: 6px;
  flex-shrink: 0;
}

.site-header .brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.site-header .nav-link {
  text-decoration: none;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 200ms ease, background 200ms ease;
  cursor: pointer;
  white-space: nowrap;
}

.site-header .nav-link:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
}

.site-header .nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.site-header .nav-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 0.5rem;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #94a3b8;
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
  flex-shrink: 0;
}

.btn-theme-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

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

/* --- Hero Section --- */

.hero {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.hero-inner {
  max-width: 640px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

.hero-lg {
  padding: 3rem 1.5rem;
}

.hero-lg h1 {
  font-size: 2rem;
}

/* --- Main Content --- */

main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* --- Card --- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

/* --- Breadcrumb Bar --- */

.breadcrumb-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
}

.breadcrumb-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.breadcrumb-inner a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-inner a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-text-muted);
}

.breadcrumb-current {
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer-brand {
  font-weight: 600;
  color: var(--color-text);
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    min-height: auto;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .site-header nav {
    order: 3;
    width: 100%;
    gap: 0.125rem;
    margin-left: 0;
    overflow-x: auto;
  }

  .site-header .nav-link {
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
  }

  .btn-theme-toggle {
    margin-left: auto;
  }

  .hero {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-lg {
    padding: 2rem 1rem;
  }

  .hero-lg h1 {
    font-size: 1.625rem;
  }

  main {
    padding: 0 1rem;
    margin: 1.5rem auto;
  }

  .card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
  }

  .breadcrumb-bar {
    padding: 0.625rem 1rem;
  }
}
