:root {
  --parchment: #F5EFE0;
  --linen: #E8DCC8;
  --linen-dark: #D9CBAF;
  --walnut: #4A3728;
  --walnut-light: #6B5240;
  --taupe: #8C7B6B;
  --taupe-light: #B5A898;
  --thread-red: #E8412C;
  --thread-red-dark: #C93520;
  --thread-red-pale: #F5D5CF;
  --ink: #2A1F16;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-settle: cubic-bezier(0.16, 1.0, 0.3, 1);
  --ease-snap: cubic-bezier(0.77, 0, 0.18, 1);

  --container: 640px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --parchment: #1E1810;
    --linen: #2A2218;
    --linen-dark: #3A2F22;
    --walnut: #F0E8D5;
    --walnut-light: #F0E8D5;
    --taupe: #B5A898;
    --taupe-light: #B5A898;
    --ink: #F0E8D5;
  }
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--parchment);
  color: var(--walnut);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--nav-h);
}

/* Paper grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: 9999;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--linen); }
::-webkit-scrollbar-thumb { background: var(--taupe); border-radius: 12px; }

a { color: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* NAV */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  z-index: 100;
  background: rgba(245, 239, 224, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--linen-dark);
}

@media (prefers-color-scheme: dark) {
  .nav {
    background: rgba(30, 24, 16, 0.88);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-link {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--taupe);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover { color: var(--walnut); }

/* Thread draw-on animation for nav mascot */
@keyframes nav-thread-draw {
  from { stroke-dashoffset: 34; }
  to { stroke-dashoffset: 0; }
}

.mascot .thread-b {
  stroke-dasharray: 34;
  stroke-dashoffset: 0;
  animation: nav-thread-draw 0.5s ease-out 0.25s backwards;
}

/* Page accent — the one thread-red element per sub-page */
.page-accent {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--thread-red);
  margin-top: -8px;
  margin-bottom: 24px;
}

/* Logo / mascot */
.mascot {
  width: 24px;
  height: 24px;
  transform: rotate(8deg);
  flex: 0 0 auto;
}

/* Overline / label tier */
.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--taupe);
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease-settle), transform 0.5s var(--ease-settle);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-settle), transform 0.6s var(--ease-settle);
}

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.10s; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.20s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.30s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.40s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.50s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.60s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  .reveal-stagger.is-visible > * { transition-delay: 0s !important; }
  .mascot .thread-b, .thread-b { animation: none !important; }
}

/* Footer */
.footer {
  padding: 40px 0 48px;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.footer-links a {
  font-size: 11px;
  color: var(--taupe);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--walnut); }

.footer-links span {
  color: var(--taupe);
  opacity: 0.4;
  font-size: 11px;
}

.copyright {
  font-size: 11px;
  color: var(--taupe);
  opacity: 0.65;
}
