:root {
  /* Color Palette - Dark Celestial Observatory */
  --color-space-black: #0a0a0f;
  --color-midnight-blue: #1a2332;
  --color-deep-navy: #0f1620;
  --color-cream: #f4f1e8;
  --color-cream-dimmed: #c4c1b8;
  --color-copper: #c77d4b;
  --color-copper-bright: #e09664;
  --color-sage: #2d4a3e;
  --color-sage-light: #3d5a4e;

  /* Typography */
  --font-display: 'Crimson Pro', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-symbols: 'STIX Two Math', math;
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--color-space-black);
  color: var(--color-cream);
  position: relative;
}

/* Subtle constellation background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, var(--color-midnight-blue) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, var(--color-deep-navy) 0%, transparent 50%);
  opacity: 0.6;
  z-index: 0;
  pointer-events: none;
}

/* Subtle paper texture */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}

.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

nav {
  background: linear-gradient(180deg, rgba(26, 35, 50, 0.8) 0%, rgba(10, 10, 15, 0.9) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(199, 125, 75, 0.2);
  padding: 0.75rem 1.5rem;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-copper) transparent;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

nav::-webkit-scrollbar {
  height: 6px;
}

nav::-webkit-scrollbar-track {
  background: transparent;
}

nav::-webkit-scrollbar-thumb {
  background: var(--color-copper);
  border-radius: 3px;
}

nav a {
  color: var(--color-cream-dimmed);
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 2px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 0 0 auto;
  position: relative;
  border: 1px solid transparent;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 1px;
  background: var(--color-copper);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

nav a:hover {
  color: var(--color-cream);
  background: rgba(199, 125, 75, 0.08);
}

nav a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

nav a.active {
  color: var(--color-copper-bright);
  background: rgba(199, 125, 75, 0.15);
  border-color: rgba(199, 125, 75, 0.3);
  font-weight: 600;
}

nav .disabled {
  color: rgba(244, 241, 232, 0.25);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: not-allowed;
  flex: 0 0 auto;
  font-style: italic;
}

main {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: var(--color-copper) transparent;
}

main::-webkit-scrollbar {
  width: 8px;
}

main::-webkit-scrollbar-track {
  background: transparent;
}

main::-webkit-scrollbar-thumb {
  background: var(--color-copper);
  border-radius: 4px;
}

h1 {
  color: var(--color-copper-bright);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(199, 125, 75, 0.3);
}

/* Wide screen layout: sidebar navigation */
@media (min-width: 768px) {
  .layout {
    flex-direction: row;
  }

  nav {
    flex-direction: column;
    width: 220px;
    padding: 2.5rem 1.25rem;
    gap: 0.35rem;
    overflow: visible;
    border-bottom: none;
    border-right: 1px solid rgba(199, 125, 75, 0.2);
    background: linear-gradient(90deg, rgba(26, 35, 50, 0.8) 0%, rgba(10, 10, 15, 0.9) 100%);
  }

  nav a {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
  }

  nav a::after {
    left: 0;
    transform: translateX(0) scaleX(0);
    transform-origin: left;
    width: 3px;
    height: 70%;
    top: 15%;
    bottom: auto;
  }

  nav a:hover::after {
    transform: translateX(0) scaleX(1);
  }

  nav .disabled {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
  }

  main {
    padding: 1.5rem;
  }
}
