/* ==========================================================================
   Durango: Community Edition — Institutional Editorial Design System
   Unified typography, hairline architecture, and palette for durango-ce.com & /wiki/
   Type: Newsreader (editorial display) · Inter (UI/body) · JetBrains Mono (data)
   ========================================================================== */

:root {
  /* Obsidian & Warm Charcoal Surfaces */
  --bg: #090a09;
  --bg-subtle: #0e100e;
  --bg-elevated: #141714;
  --bg-hover: #1b1e1b;
  --bg-inset: #060706;

  /* Hairlines */
  --line-subtle: rgba(243, 240, 232, 0.08);
  --line-default: rgba(243, 240, 232, 0.14);
  --line-strong: rgba(243, 240, 232, 0.26);
  --line-accent: rgba(223, 164, 74, 0.44);

  /* Ink Hierarchy (WCAG AAA / AA) */
  --ink: #f3f0e8;
  --ink-secondary: #b8b3a7;
  --ink-muted: #8d887d;
  --ink-dim: #635f56;
  --ink-dark: #0e0b05;

  /* Restrained Brand & Semantic Accents */
  --accent: #dfa44a;
  --accent-hi: #f0be6b;
  --accent-soft: rgba(223, 164, 74, 0.11);

  --sage: #65b878;
  --sage-soft: rgba(101, 184, 120, 0.12);

  --slate: #79b4b4;
  --slate-soft: rgba(121, 180, 180, 0.12);

  --coral: #df6b57;
  --coral-soft: rgba(223, 107, 87, 0.13);

  /* Typography */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Geometry */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-pill: 999px;

  --nav-h: 70px;
  --max-w: 1160px;
  --max-w-wide: 1320px;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(223, 164, 74, 0.28);
  color: var(--ink);
}

a {
  color: var(--accent-hi);
  text-decoration: none;
  transition: color 0.16s ease, opacity 0.16s ease;
}

a:hover {
  color: #f8d48e;
}

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 3px;
}

img, svg {
  display: block;
}

button, input, select {
  font-family: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
}

/* Containers */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
}

.wrap-wide {
  width: 100%;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 32px;
}

/* ==========================================================================
   Institutional 3-Zone Studio Navbar
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(9, 10, 9, 0.82);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line-subtle);
}

.site-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  gap: 24px;
}

/* Left Zone: Brand Lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  justify-self: start;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand-logo {
  height: 48px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
  transition: opacity 0.16s ease;
}

.brand:hover .brand-logo {
  opacity: 0.9;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-default);
  background: var(--bg-elevated);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-wordmark {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}

.brand-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Center Zone: Spacious Understated Links (Zero Pill Boxes) */
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  height: 100%;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 2px;
  font-size: 13.5px;
  font-weight: 450;
  letter-spacing: 0.005em;
  color: var(--ink-secondary);
  transition: color 0.16s ease;
  white-space: nowrap;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1.5px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.nav-link.active {
  color: var(--ink);
  font-weight: 500;
}

.nav-link.active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Right Zone: Ghost Language Switcher + Primary Download CTA */
.nav-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}

.lang-select {
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5' viewBox='0 0 9 5' fill='none'%3E%3Cpath d='M1 1l3.5 3L8 1' stroke='%238d887d' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 6px 24px 6px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.lang-select:hover {
  color: var(--ink);
  background-color: rgba(243, 240, 232, 0.04);
  border-color: var(--line-subtle);
}

.lang-select option {
  background: var(--bg-elevated);
  color: var(--ink);
}

.nav-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(88, 101, 242, 0.55);
  background: rgba(88, 101, 242, 0.22);
  color: #ffffff;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.nav-discord:hover {
  color: #ffffff;
  background: #5865F2;
  border-color: #7984f5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.45);
}

.nav-discord svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-cta {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.005em;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line-default);
  color: var(--ink);
  border-radius: var(--r-sm);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.nav-toggle:hover {
  border-color: var(--line-strong);
  background: rgba(243, 240, 232, 0.05);
}

/* ==========================================================================
   Buttons & Semantic Pills
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid var(--line-default);
  background: rgba(243, 240, 232, 0.04);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(243, 240, 232, 0.09);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-dark);
  font-weight: 550;
}

.btn-primary:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--ink-dark);
  box-shadow: 0 4px 18px rgba(243, 240, 232, 0.12);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-dark);
  font-weight: 550;
}

.btn-accent:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: var(--ink-dark);
  box-shadow: 0 6px 22px rgba(223, 164, 74, 0.22);
}

.btn-sm {
  padding: 7px 15px;
  font-size: 12.5px;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
  padding: 6px 10px;
}

.btn-ghost:hover {
  background: rgba(243, 240, 232, 0.06);
  border-color: transparent;
  color: var(--ink);
}

/* Refined Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--line-default);
  background: rgba(243, 240, 232, 0.03);
  color: var(--ink-secondary);
}

.pill-sage {
  background: var(--sage-soft);
  border-color: rgba(101, 184, 120, 0.3);
  color: #8ad39b;
}

.pill-accent {
  background: var(--accent-soft);
  border-color: rgba(223, 164, 74, 0.35);
  color: var(--accent-hi);
}

.pill-slate {
  background: var(--slate-soft);
  border-color: rgba(121, 180, 180, 0.3);
  color: #9ed0d0;
}

.pill-coral {
  background: var(--coral-soft);
  border-color: rgba(223, 107, 87, 0.32);
  color: #ee8c7b;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 0 rgba(101, 184, 120, 0.55);
  animation: live-pulse 2.6s ease-out infinite;
  display: inline-block;
  flex-shrink: 0;
}

.live-dot.amber {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(223, 164, 74, 0.45);
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(101, 184, 120, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(101, 184, 120, 0); }
  100% { box-shadow: 0 0 0 0 rgba(101, 184, 120, 0); }
}

/* Inline Code & Pre */
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(243, 240, 232, 0.06);
  padding: 1.5px 6px;
  border-radius: var(--r-xs);
  color: #e6e0d2;
}

pre {
  margin: 0;
  padding: 20px 22px;
  background: var(--bg-inset);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.68;
  color: #d8d3c8;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* ==========================================================================
   Editorial Section Rhythm
   ========================================================================== */
.section {
  padding: 108px 0;
  border-top: 1px solid var(--line-subtle);
  scroll-margin-top: var(--nav-h);
}

.section-header {
  max-width: 660px;
  margin-bottom: 52px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.section-title em {
  font-style: italic;
  color: var(--accent-hi);
}

.section-lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-secondary);
}

/* Subtle Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ==========================================================================
   Minimalist Editorial Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line-subtle);
  padding: 48px 0 60px;
  color: var(--ink-muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
}

.footer-links a {
  color: var(--ink-secondary);
}

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

/* ==========================================================================
   Responsive & Reduced Motion
   ========================================================================== */
@media (max-width: 920px) {
  .wrap, .wrap-wide {
    padding: 0 20px;
  }
  .site-nav {
    display: flex;
    justify-content: space-between;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    background: rgba(12, 14, 12, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line-default);
    padding: 14px 20px 20px;
    gap: 4px;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-link {
    height: auto;
    padding: 10px 4px;
    font-size: 15px;
    border-bottom: 1px solid var(--line-subtle);
  }
  .nav-link:last-child {
    border-bottom: none;
  }
  .nav-link::after {
    display: none;
  }
  .nav-link.active {
    color: var(--accent-hi);
  }
  .section {
    padding: 72px 0;
  }
}

@media (max-width: 520px) {
  .brand-sub {
    display: none;
  }
  .nav-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(88, 101, 242, 0.55);
  background: rgba(88, 101, 242, 0.22);
  color: #ffffff;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.nav-discord:hover {
  color: #ffffff;
  background: #5865F2;
  border-color: #7984f5;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.45);
}

.nav-discord svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-cta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

.nav-links .nav-link-wiki {
  height: auto;
  align-self: center;
  padding: 6px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-default);
  background: rgba(243, 240, 232, 0.06);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
}
.nav-links .nav-link-wiki:hover {
  color: var(--accent-hi);
  border-color: var(--line-accent);
  background: rgba(223, 164, 74, 0.1);
}
.nav-links .nav-link-wiki.active {
  color: var(--accent-hi);
  border-color: var(--accent-hi);
  background: rgba(223, 164, 74, 0.14);
}
.nav-links .nav-link-wiki.active::after { display: none; }

.footer-links a.footer-link-accent {
  color: var(--accent-hi);
}
.footer-links a.footer-link-accent:hover {
  color: #fff3d6;
  text-decoration: underline;
}
