/* ============================================================
   DD&SA — Neural Theme (site-wide)
   Drop into /assets/neural-theme.css and include on any page with:
     <link rel="stylesheet" href="/assets/neural-theme.css" />
   Designed to layer over existing pages: it themes the common
   elements (body, header, nav, cards, sections, footer, video)
   and lifts page content above the canvas injected by
   /assets/neural-bg.js.
   ============================================================ */

:root {
  --ink:        #04070f;
  --navy:       #0a1228;
  --navy-line:  #1b2a4a;
  --gold:       #c49a2a;
  --gold-hot:   #ffd96b;
  --text:       #eef2fc;
  --muted:      #9aa6c4;

  --display: Georgia, "Times New Roman", serif;
  --bodyfont: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  --radius: 14px;
  --max: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* anchor targets land clear of the sticky header */
[id] { scroll-margin-top: 96px; }

body {
  font-family: var(--bodyfont);
  background: var(--ink);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  margin: 0;
}

/* everything except the injected canvas (z 0) and veil (z 1)
   sits above the living background */
body > * { position: relative; z-index: 2; }

a { color: var(--gold-hot); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold-hot);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; }

/* ---------- header / nav ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50 !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(rgba(4,7,15,0.82), rgba(4,7,15,0.66));
  border-bottom: 1px solid rgba(196,154,42,0.18);
}

nav {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px clamp(20px, 5vw, 48px);
  flex-wrap: wrap;
  gap: 10px;
}

.nav-links { display: flex; gap: clamp(14px, 3vw, 30px); font-size: 16px; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted);
  letter-spacing: 0.02em;
  transition: color 0.25s ease;
  position: relative;
  padding-bottom: 3px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--gold);
  transition: width 0.3s ease;
}
.nav-links a:hover { color: var(--gold-hot); text-decoration: none; }
.nav-links a:hover::after { width: 100%; }

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: 110px clamp(20px, 6vw, 60px) 70px;
  max-width: 960px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}

.hero p {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--muted);
  max-width: 700px;
  margin: 0 auto 40px;
}

/* gilt accent for any element you wrap in <span class="gilt"> */
.gilt {
  background: linear-gradient(105deg, var(--gold) 0%, var(--gold-hot) 45%, var(--gold) 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ddsa-shimmer 7s linear infinite;
}

@keyframes ddsa-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 14px 34px;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.05em;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a8821e);
  color: #0a0d18;
  font-weight: 600;
  box-shadow: 0 6px 26px rgba(196,154,42,0.35);
}
.btn-gold:hover { box-shadow: 0 10px 36px rgba(196,154,42,0.55); }

.btn-ghost {
  border: 1px solid rgba(196,154,42,0.45);
  color: var(--gold-hot);
}
.btn-ghost:hover { background: rgba(196,154,42,0.08); }

/* ---------- sections ---------- */
/* frosted panel so long-form text stays readable while the
   network breathes at the edges */
.section {
  max-width: var(--max);
  margin: 40px auto 70px;
  padding: 60px clamp(20px, 6vw, 60px) 70px;
  background: linear-gradient(165deg, rgba(9,14,32,0.68), rgba(5,9,22,0.68));
  border: 1px solid rgba(27,42,74,0.5);
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.section h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }

/* heroes stay open so the living network shows through */
.hero, section.hero {
  background: none;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- downloads grid ---------- */
.downloads-grid a {
  display: block;
  background: linear-gradient(165deg, rgba(16,22,44,0.92), rgba(8,12,26,0.92));
  border: 1px solid rgba(27,42,74,0.9);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.downloads-grid a:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: rgba(196,154,42,0.55);
  box-shadow: 0 14px 36px rgba(0,0,0,0.5), 0 0 24px rgba(196,154,42,0.10);
  color: var(--gold-hot);
}

/* ---------- cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 26px;
  margin-top: 40px;
}

.card {
  position: relative;
  display: block;
  background: linear-gradient(165deg, rgba(16,22,44,0.92), rgba(8,12,26,0.92));
  border: 1px solid rgba(27,42,74,0.9);
  border-radius: var(--radius);
  padding: 32px 28px 30px;
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(0,0,0,0.5);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  text-decoration: none;
  transform: translateY(-6px);
  border-color: rgba(196,154,42,0.55);
  box-shadow: 0 22px 50px rgba(0,0,0,0.55), 0 0 34px rgba(196,154,42,0.12);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 12%, rgba(196,154,42,0.10), transparent 38%),
    radial-gradient(circle at 8% 95%, rgba(27,42,74,0.55), transparent 45%);
  opacity: 0.7;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

.card h3 { font-size: 1.3rem; margin: 0 0 12px; position: relative; }
.card p  { color: var(--muted); font-size: 0.98rem; position: relative; margin: 0; }

/* ---------- long-form content (essays, blueprint, about pages) ---------- */
.content, article, .prose {
  max-width: 820px;
  margin: 0 auto;
  padding: 60px clamp(20px, 6vw, 60px) 90px;
  background: linear-gradient(165deg, rgba(10,16,36,0.78), rgba(6,10,24,0.78));
  border: 1px solid rgba(27,42,74,0.7);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.content h1, article h1, .prose h1,
.content h2, article h2, .prose h2 { color: var(--text); }

.content h2, article h2, .prose h2 {
  border-bottom: 1px solid rgba(196,154,42,0.25);
  padding-bottom: 10px;
  margin-top: 2.2em;
}

.content p, article p, .prose p { color: #d7ddf0; }

blockquote {
  border-left: 3px solid var(--gold);
  margin: 1.6em 0;
  padding: 0.4em 0 0.4em 1.2em;
  color: var(--muted);
  font-style: italic;
}

/* ---------- media ---------- */
video, iframe.video, .video-frame video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,0.65), 0 0 60px rgba(196,154,42,0.08);
}

.video-frame {
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(140deg,
    rgba(196,154,42,0.55), rgba(27,42,74,0.7) 40%,
    rgba(196,154,42,0.18) 70%, rgba(255,217,107,0.45));
}
.video-frame video { border-radius: calc(var(--radius) - 1px); }

/* ---------- tables (for blueprint / data pages) ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}
th, td {
  border: 1px solid rgba(27,42,74,0.9);
  padding: 10px 14px;
  text-align: left;
}
th {
  background: rgba(196,154,42,0.12);
  color: var(--gold-hot);
  font-family: var(--display);
  letter-spacing: 0.03em;
}
tr:nth-child(even) td { background: rgba(16,22,44,0.45); }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid rgba(196,154,42,0.18);
  background: rgba(3,5,11,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 44px clamp(20px, 6vw, 60px);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- comments drawer (fixed right-hand tab + slide-out panel) ----------
   Only present on pages that include the .ddsa-comments-tab markup
   (essays + FAQ). Inert everywhere else. */
.ddsa-comments-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 14px 16px;
  background: linear-gradient(135deg, var(--gold), #a8821e);
  color: var(--ink);
  border: none;
  border-radius: 12px 0 0 12px;
  font-family: var(--bodyfont);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  z-index: 60;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ddsa-comments-tab:hover,
.ddsa-comments-tab:focus-visible {
  box-shadow: -6px 4px 28px rgba(196,154,42,0.6);
  transform: translateY(-50%) translateX(-3px);
}
.ddsa-comments-tab__icon { font-size: 18px; line-height: 1; }

.ddsa-comments-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4,7,15,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 65;
}
.ddsa-comments-backdrop.is-open { opacity: 1; pointer-events: auto; }

.ddsa-comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(440px, 92vw);
  background: var(--navy);
  border-left: 1px solid rgba(196,154,42,0.35);
  box-shadow: -10px 0 40px rgba(0,0,0,0.55);
  transform: translateX(100%);
  transition: transform 0.32s ease;
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.ddsa-comments-panel.is-open { transform: translateX(0); }
.ddsa-comments-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(196,154,42,0.25);
  font-family: var(--display);
  font-size: 19px;
  color: var(--gold-hot);
  flex: none;
}
.ddsa-comments-panel__close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.ddsa-comments-panel__close:hover,
.ddsa-comments-panel__close:focus-visible {
  color: var(--gold-hot);
}
.ddsa-comments-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 16px 36px;
}
.ddsa-comments-panel__hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
}

@media (max-width: 640px) {
  .ddsa-comments-tab { padding: 12px 14px; font-size: 14px; }
  .ddsa-comments-tab__label { display: none; }
  .ddsa-comments-panel { width: 100vw; border-left: none; }
}

/* ---------- responsive images (prevent mobile overflow) ---------- */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- mobile navigation (hamburger, pure CSS, no JS dependency) ---------- */
.nav-toggle-checkbox { display: none; }

.nav-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 30px;
  height: 24px;
  cursor: pointer;
  z-index: 55;
}
.nav-toggle-label span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--gold-hot);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 880px) {
  .nav-toggle-label { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(6,9,20,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(196,154,42,0.25);
    padding: 6px clamp(20px, 5vw, 48px) 18px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.45);
  }
  .nav-toggle-checkbox:checked ~ .nav-links { display: flex; }

  .nav-links a {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle-checkbox:checked ~ .nav-toggle-label span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}


/* ---------- footer unsubscribe action ---------- */
.ddsa-unsub-link {
  display: inline-block;
  margin-left: 12px;
  padding: 5px 14px;
  font-size: .82rem;
  letter-spacing: .02em;
  color: #cfe2f5;
  background: rgba(9,16,28,0.6);
  border: 1px solid rgba(148,196,236,0.55);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.ddsa-unsub-link:hover,
.ddsa-unsub-link:focus-visible {
  color: #ffffff;
  border-color: rgba(148,196,236,0.95);
  box-shadow: 0 0 16px rgba(104,164,224,0.55);
  text-decoration: none;
  outline: none;
}

/* ---------- accessibility: skip link ---------- */
.ddsa-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--gold);
  color: #0a0d18;
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  text-decoration: none;
}
.ddsa-skip:focus {
  left: 0;
  outline: 2px solid var(--gold-hot);
}
