:root {
  --cream: #f8f6f2;
  --ink: #1a1916;
  --mid: #888580;
  --faint: #e4e1db;
  --paper: #efede8;
  --nav-bg: rgba(248, 246, 242, 0.85);
  --border-radius-md: 4px;
  --border-radius-lg: 8px;
}

[data-theme="dark"] {
  --cream: #0c0b0a;
  --ink: #f5f3ef;
  --mid: #9c9994;
  --faint: #22201e;
  --paper: #161513;
  --nav-bg: rgba(12, 11, 10, 0.85);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fadeIn .8s ease forwards;
  transition: background-color .4s ease, color .4s ease;
}

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

/* Fixed Navigation Header with Backdrop Blur */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 3rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--nav-bg);
  border-bottom: 0.5px solid var(--faint);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: .15em;
  color: var(--ink);
  text-decoration: none;
  text-transform: lowercase;
  flex-shrink: 0;
  transition: color 0.4s ease;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: .62rem;
  letter-spacing: .2em;
  color: var(--mid);
  text-decoration: none;
  text-transform: uppercase;
  transition: color .25s;
  font-weight: 300;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active, .nav-links a:focus-visible {
  color: var(--ink);
}

.theme-toggle {
  background: none;
  border: none;
  font-family: inherit;
  font-size: .62rem;
  letter-spacing: .2em;
  color: var(--mid);
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: color .25s;
  font-weight: 300;
}

.theme-toggle:hover, .theme-toggle:focus-visible {
  color: var(--ink);
}

/* Layout Adjustments for Fixed Navigation */
main {
  padding-top: 5.5rem;
  transition: background-color 0.4s ease;
}

/* Footer Section */
footer {
  padding: 1.5rem 3rem;
  border-top: .5px solid var(--faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.4s ease, background-color 0.4s ease;
}

footer span {
  font-size: .6rem;
  letter-spacing: .15em;
  color: var(--mid);
  text-transform: uppercase;
}

@media(max-width: 820px) {
  nav {
    align-items: flex-start;
    padding: 1.4rem 1.5rem;
    gap: 1.5rem;
  }
  .nav-links {
    gap: 1.15rem;
    overflow-x: auto;
    padding-bottom: .3rem;
  }
  .nav-links a, .theme-toggle {
    font-size: .56rem;
    letter-spacing: .15em;
  }
}

@media(max-width: 600px) {
  nav {
    position: fixed;
    flex-direction: column;
    align-items: center;
  }
  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    overflow: visible;
    gap: .9rem 1.2rem;
  }
  main {
    padding-top: 10.5rem;
  }
  footer {
    padding: 1.5rem;
    flex-direction: column;
    gap: .5rem;
    text-align: center;
  }
}

@media(prefers-reduced-motion: reduce) {
  body {
    animation: none;
    opacity: 1;
  }
}
