:root {
  /* Clean Wiki Color Palette with Aviation Accents */
  --bg-primary: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f6f8;
  --bg-hover: #eef1f4;

  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --accent-sky: #0369a1;
  --accent-sky-light: #e0f2fe;
  --accent-sky-hover: #0284c7;
  --accent-horizon: #f97316;
  --accent-horizon-light: #fff7ed;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  --code-bg: #1a1a2e;
  --code-text: #f8f8f2;

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --content-width: 800px;
  --container-width: 1200px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0f1419;
  --bg-secondary: #1a2028;
  --bg-tertiary: #242d38;
  --bg-hover: #2a3441;

  --text-primary: #e8eef4;
  --text-secondary: #a8b5c4;
  --text-muted: #7a8999;

  --accent-sky: #38bdf8;
  --accent-sky-light: #0c4a6e;
  --accent-sky-hover: #7dd3fc;
  --accent-horizon: #fb923c;
  --accent-horizon-light: #431407;

  --border-light: #2d3a47;
  --border-medium: #3d4d5c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

  --code-bg: #0d1117;
  --code-text: #e6edf3;
}

/* System preference detection */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2028;
    --bg-tertiary: #242d38;
    --bg-hover: #2a3441;

    --text-primary: #e8eef4;
    --text-secondary: #a8b5c4;
    --text-muted: #7a8999;

    --accent-sky: #38bdf8;
    --accent-sky-light: #0c4a6e;
    --accent-sky-hover: #7dd3fc;
    --accent-horizon: #fb923c;
    --accent-horizon-light: #431407;

    --border-light: #2d3a47;
    --border-medium: #3d4d5c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

    --code-bg: #0d1117;
    --code-text: #e6edf3;
  }
}

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

html {
  scroll-behavior: smooth;
}

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

/* Header */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity 0.2s ease;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-sky) 0%, var(--accent-sky-hover) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}

h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.site-tagline {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-sky);
  color: var(--accent-sky);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* Show sun icon in dark mode (to switch to light) */
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Show moon icon in light mode (to switch to dark) */
:root:not([data-theme="dark"]) .theme-toggle .icon-sun {
  display: none;
}

:root:not([data-theme="dark"]) .theme-toggle .icon-moon {
  display: block;
}

/* Handle system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon {
    display: block;
  }
}

/* Main Container */
main {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  width: 100%;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--accent-sky);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-link:hover {
  color: var(--accent-sky-hover);
  text-decoration: underline;
}

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

.breadcrumb-current {
  color: var(--text-secondary);
}

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-sky);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent-sky-hover);
}

/* Section Header */
.section-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.section-description {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Folder Header */
.folder-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.folder-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.folder-icon {
  color: var(--accent-sky);
}

.folder-count {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Content Grid */
.posts-grid {
  display: grid;
  gap: 1rem;
}

/* Card Styles */
.post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.post-card:hover {
  border-color: var(--accent-sky);
  box-shadow: var(--shadow-md);
  background: var(--bg-hover);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.card-icon.folder {
  background: var(--accent-sky-light);
  color: var(--accent-sky);
}

.card-icon.document {
  background: var(--accent-horizon-light);
  color: var(--accent-horizon);
}

.post-info {
  flex: 1;
  min-width: 0;
}

.post-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.post-meta {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.post-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--accent-sky);
}

/* Post Content */
.post-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 3rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-sm);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.post-header h2 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.post-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.post-metadata .meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Post Content Typography */
.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.post-content h4 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content a {
  color: var(--accent-sky);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.post-content a:hover {
  color: var(--accent-sky-hover);
}

.post-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.post-content em {
  font-style: italic;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: var(--accent-horizon);
}

.post-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.post-content blockquote {
  border-left: 4px solid var(--accent-sky);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content ul,
.post-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content li::marker {
  color: var(--accent-sky);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 2rem 0;
}

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.post-content img:hover {
  box-shadow: var(--shadow-lg);
}

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 46, 0.95);
  z-index: 9999;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.lightbox-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  height: auto;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  font-size: 1.5rem;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: var(--font-display);
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 404 Page */
.error-container {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 500px;
  margin: 0 auto;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-code {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent-sky);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-message {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.error-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.error-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-sky);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  transition: background 0.2s ease;
}

.error-link:hover {
  background: var(--accent-sky-hover);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-description {
  font-size: 1rem;
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 1.5rem 2rem;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: var(--container-width);
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer-icon {
  opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .header-content {
    padding: 0.875rem 1rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .post-container {
    padding: 1.5rem;
    border-radius: 8px;
  }

  .post-header h2 {
    font-size: 1.75rem;
  }

  .folder-title {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .post-card {
    padding: 1rem;
  }

  .card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .error-code {
    font-size: 4rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.5rem;
  }

  .post-content h3 {
    font-size: 1.25rem;
  }
}

/* Print Styles */
@media print {
  header, footer, .back-link, .breadcrumbs {
    display: none;
  }

  .post-container {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  body {
    background: white;
  }
}

/* Tags */
.tag {
  display: inline-block;
  background: var(--accent-sky-light);
  color: var(--accent-sky);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.post-content th {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--bg-tertiary);
}

.post-content tr:hover td {
  background: var(--bg-hover);
}
