:root {
  --page-bg: #07110b;
  --surface: #0c1d13;
  --surface-muted: #08150d;
  --surface-soft: #13271a;
  --heading: #f6f1e7;
  --body-text: #e8e6e3;
  --muted-text: #c9c4bd;
  --tag-text: #d8d4cf;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-soft: rgba(255, 255, 255, 0.08);
  --label: #e6c34f;
  --link-accent: #f0d87a;
  --button-border: rgba(255, 255, 255, 0.35);
  --button-hover: rgba(255, 255, 255, 0.08);
  --link-border: rgba(219, 184, 64, 0.4);
  --num: rgba(246, 241, 231, 0.22);
  color-scheme: dark;
}

html.light {
  --page-bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #fafaf9;
  --surface-soft: #f5f5f4;
  --heading: #122318;
  --body-text: #1c1917;
  --muted-text: #57534e;
  --tag-text: #44403c;
  --border-color: #e7e5e4;
  --border-soft: #f5f5f4;
  --label: #7a5e12;
  --link-accent: #2d6338;
  --button-border: #122318;
  --button-hover: #122318;
  --link-border: rgba(18, 35, 24, 0.25);
  --num: rgba(18, 35, 24, 0.3);
  color-scheme: light;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--page-bg);
  color: var(--body-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background-color: #c9a227;
  color: #0a1a10;
}

:focus-visible {
  outline: 2px solid #dbb840;
  outline-offset: 3px;
}

html .bg-white {
  background-color: var(--surface);
  transition: background-color 0.3s ease;
}

html .bg-stone-50 {
  background-color: var(--surface-muted);
  transition: background-color 0.3s ease;
}

html .bg-stone-100 {
  background-color: var(--surface-soft);
  transition: background-color 0.3s ease;
}

html .text-forest-900 {
  color: var(--heading);
}

html .text-stone-900 {
  color: var(--body-text);
}

html .text-stone-700 {
  color: var(--tag-text);
}

html .text-stone-600 {
  color: var(--muted-text);
}

html .text-gold-500,
html .text-gold-600 {
  color: var(--label);
}

html .text-forest-600,
html .text-forest-700 {
  color: var(--link-accent);
}

html .text-forest-900\/30 {
  color: var(--num);
}

html .border-stone-200,
html .border-stone-300 {
  border-color: var(--border-color);
}

html .border-stone-100 {
  border-color: var(--border-soft);
}

html .border-forest-900 {
  border-color: var(--button-border);
}

html .border-forest-900\/25 {
  border-color: var(--link-border);
}

html .decoration-stone-300 {
  text-decoration-color: var(--border-color);
}

html .hover\:text-forest-900:hover {
  color: var(--link-accent);
}

html .hover\:bg-forest-900:hover {
  background-color: var(--button-hover);
}

html .filter-btn {
  border-color: var(--border-color);
  color: var(--tag-text);
}

html .filter-btn:hover:not(.active) {
  border-color: var(--label);
  color: var(--heading);
  background-color: transparent;
}

html .filter-btn.active,
html .filter-btn.active:hover,
html .filter-btn.active:focus {
  background-color: #c9a227 !important;
  color: #0a1a10 !important;
  border-color: #c9a227 !important;
}

html.light .filter-btn.active,
html.light .filter-btn.active:hover,
html.light .filter-btn.active:focus {
  background-color: #122318 !important;
  color: #ffffff !important;
  border-color: #122318 !important;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  background-color: transparent;
  flex-shrink: 0;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  color: #ffffff;
  border-color: #dbb840;
  background-color: rgba(255, 255, 255, 0.06);
}

.theme-icon-moon {
  display: none;
}

html.light .theme-icon-sun {
  display: none;
}

html.light .theme-icon-moon {
  display: block;
}

/* ── Page & Tab Entrance Animations ────────────────────────── */
@keyframes pageFadeIn {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-transition {
  opacity: 0;
  animation: pageFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

.page-transition.page-exit {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 1, 1), transform 0.2s cubic-bezier(0.4, 0, 1, 1) !important;
  pointer-events: none;
}

.fade-up {
  opacity: 0;
  animation: fadeUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease !important;
  will-change: opacity, transform;
}

.reveal.in {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .page-transition,
  .page-transition.page-exit,
  .fade-up,
  .reveal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background-color: rgba(3, 9, 5, 0.65);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 18rem;
  max-width: 88vw;
  background-color: #0a1a10;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.38s;
}

.mobile-drawer.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-link {
  display: block;
  padding: 0.8rem 1rem;
  border-radius: 0.6rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(18px);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.mobile-drawer.open .mobile-link {
  animation: drawerLinkIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mobile-drawer.open .mobile-link:nth-child(1) {
  animation-delay: 0.08s;
}

.mobile-drawer.open .mobile-link:nth-child(2) {
  animation-delay: 0.16s;
}

.mobile-drawer.open .mobile-link:nth-child(3) {
  animation-delay: 0.24s;
}

.mobile-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.06);
}

.mobile-link.active {
  color: #f0d87a;
  background-color: rgba(219, 184, 64, 0.1);
}

body.menu-open {
  overflow: hidden;
}

@keyframes drawerLinkIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.logo-mark {
  filter: brightness(0) invert(1);
}

@media (min-width: 768px) {
  .mobile-drawer,
  .mobile-overlay {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer,
  .mobile-overlay,
  .mobile-link {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }

  .mobile-drawer .mobile-link {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 359px) {
  .brand-wordmark {
    display: none;
  }
}
