/* ================================================================
   SHARED.CSS — Cormorant Gold Design System
   The Institute for Cognitive Sovereignty
   Single source of truth for design tokens, reset, nav, footer, widget
   ================================================================ */

/* ========== DESIGN TOKENS ========== */
:root {
  /* Backgrounds */
  --void: #06060f;
  --surface: #0d0d1a;
  --surface2: #111120;

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.13);

  /* Gold accent */
  --gold: #c9a84c;
  --gold-dim: rgba(201, 168, 76, 0.18);
  --gold-ghost: rgba(201, 168, 76, 0.04);

  /* Text */
  --text: #cccce0;
  --text-bright: #ededfa;
  --text-dim: rgba(204, 204, 224, 0.45);
  --text-hint: rgba(204, 204, 224, 0.2);

  /* Semantic colors */
  --red: #ef4444;
  --green: #10b981;
  --teal: #0d9488;
  --purple: #8b5cf6;

  /* Legacy aliases — for pages that still reference old variable names */
  --bg: var(--void);
  --accent: var(--gold);
  --accent-dim: var(--gold-dim);
  --text-muted: var(--text-dim);
  --surface-hover: var(--surface2);
}

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

html {
  scroll-behavior: smooth;
}

/* ========== BASE BODY ========== */
body {
  background: var(--void);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle gold grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(201, 168, 76, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.012) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, .hero-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--text-bright);
}

/* ========== NAV ========== */
nav.site-nav {
  position: sticky;
  top: 0;
  background: rgba(6, 6, 15, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.nav-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-bright);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-bright);
}

.nav-links a.active {
  color: var(--gold);
}

/* Hamburger (hidden on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-bright);
}

.nav-hamburger svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ========== FOOTER ========== */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

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

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.5;
}

.footer-copy a {
  color: var(--gold);
  text-decoration: none;
}

.footer-copy a:hover {
  text-decoration: underline;
}

/* ========== HQ ECOSYSTEM WIDGET ========== */
.hq-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, sans-serif;
}

.hq-widget-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.3s;
}

.hq-widget-btn:hover {
  transform: scale(1.05);
  border-color: rgba(16, 185, 129, 0.5);
}

.hq-widget-btn svg {
  width: 28px;
  height: 28px;
}

.hq-dropdown {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 280px;
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.hq-widget.active .hq-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hq-dropdown-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hq-dropdown-header svg {
  width: 20px;
  height: 20px;
}

.hq-dropdown-header span {
  font-weight: 600;
  font-size: 0.9rem;
  color: #e8e8f0;
}

.hq-dropdown-links {
  padding: 0.5rem;
}

.hq-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: #9ca3b8;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.hq-dropdown a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e8e8f0;
}

.hq-dropdown .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.hq-dropdown .icon.cgs { background: rgba(59, 130, 246, 0.15); }
.hq-dropdown .icon.dlp { background: rgba(139, 92, 246, 0.15); }
.hq-dropdown .icon.gdn { background: rgba(16, 185, 129, 0.15); }
.hq-dropdown .icon.research { background: rgba(239, 68, 68, 0.15); }
.hq-dropdown .icon.hq { background: rgba(251, 191, 36, 0.15); }

.hq-dropdown .info {
  display: flex;
  flex-direction: column;
}

.hq-dropdown .name {
  color: #e8e8f0;
  font-weight: 500;
}

.hq-dropdown .desc {
  font-size: 0.75rem;
  color: #6b7280;
}

.hq-dropdown-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.75rem;
  color: var(--gold);
}

/* ========== COMMON UTILITY CLASSES ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.6rem 1.25rem;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  background: transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--gold-dim);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  background: transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-secondary:hover {
  color: var(--text-bright);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-hamburger {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(6, 6, 15, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 2rem 1.5rem;
    gap: 0.75rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 0.95rem;
    padding: 0.5rem 0;
  }

  .footer-links {
    gap: 1rem;
  }

  .hq-dropdown {
    right: -10px;
    width: 260px;
  }
}

@media (max-width: 480px) {
  nav.site-nav {
    padding: 0.75rem 1rem;
  }

  .nav-brand {
    font-size: 0.85rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .hq-dropdown {
    right: -15px;
    width: calc(100vw - 60px);
    max-width: 260px;
  }

  .hq-widget {
    bottom: 15px;
    right: 10px;
  }
}

/* ========== CODE & PREFORMATTED TEXT ========== */
pre, code {
  font-family: 'DM Mono', monospace;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

code {
  color: var(--gold);
  font-size: 0.9em;
}

pre code {
  color: var(--text);
}

/* ========== ACCESSIBILITY ========== */
.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;
}

.skip-to-content {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--gold);
  color: var(--void);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* Focus-visible for interactive canvases */
canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ========== HERO SECTION UTILITIES ========== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  position: relative;
}

.hero-badge {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
}

.hero-sub {
  font-size: 1.25rem;
  color: var(--text-dim);
  max-width: 700px;
  margin: 0 auto 3rem;
  line-height: 1.8;
}

.hero-sub strong {
  color: var(--text);
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ========== BUTTON UTILITIES ========== */
.btn {
  padding: 1rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-accent {
  background: var(--gold);
  color: var(--void);
}

.btn-accent:hover {
  background: #a8893d;
  transform: translateY(-2px);
}

.btn-surface {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-surface:hover {
  background: var(--surface2);
  border-color: var(--gold);
}

/* ========== SECTION UTILITIES ========== */
section {
  padding: 6rem 1.5rem;
}

.section {
  padding: 3rem 0;
}

.section-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-bright);
}

.section-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 1.125rem;
  max-width: 700px;
  margin: 0 auto 4rem;
}

.section-sub {
  color: var(--text-dim);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* ========== CARD GRID UTILITIES ========== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.2s ease;
}

.card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card-desc {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Semantic card variants */
.threat-card {
  border-color: rgba(239, 68, 68, 0.2);
}

.threat-card:hover {
  border-color: var(--red);
}

.threat-card .card-title {
  color: var(--red);
}

.solution-card {
  border-color: rgba(16, 185, 129, 0.2);
}

.solution-card:hover {
  border-color: var(--green);
}

.solution-card .card-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.solution-card .card-link:hover {
  text-decoration: underline;
}

/* ========== CTA SECTION UTILITIES ========== */
.cta-section {
  text-align: center;
  padding: 6rem 2rem;
  background: linear-gradient(180deg, transparent, var(--gold-dim));
}

.cta-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.cta-sub {
  color: var(--text-dim);
  font-size: 1.125rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== MANIFESTO & FEATURED BOXES ========== */
.manifesto {
  max-width: 900px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
}

.manifesto blockquote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.manifesto cite {
  color: var(--text-dim);
  font-size: 1rem;
  font-style: normal;
}

.featured-box {
  max-width: 900px;
  margin: 0 auto 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
}

/* ========== SCROLL INDICATOR ========== */
.scroll-indicator {
  margin-top: 4rem;
  color: var(--text-dim);
  font-size: 1.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 768px) {
  .hero {
    padding: 3rem 1rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  section {
    padding: 4rem 1.5rem;
  }

  .cta-section {
    padding: 4rem 1.5rem;
  }

  .cta-title {
    font-size: 1.8rem;
  }
}

/* ========== PADDING & SPACING UTILITIES ========== */
.section-padding-compact {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.section-padding-top-reset {
  padding-top: 0;
}

.section-padding-bottom-compact {
  padding-bottom: 3rem;
}

.section-padding-top-reset-bottom-compact {
  padding-top: 0;
  padding-bottom: 3rem;
}

.spacing-lg {
  margin: 3rem 0;
  padding: 2rem 0;
}

.text-center-small {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* ========== CANVAS & VISUALIZATION UTILITIES ========== */
.canvas-block {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 1rem;
}

.panel-detail {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 80px;
  margin-top: 1rem;
}

.label-mono-sm {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #c9a84c;
  margin-bottom: 0.75rem;
}

.text-detail {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ========== INLINE CONTENT UTILITIES ========== */
.margin-bottom-1 {
  margin-bottom: 1rem;
}

.margin-bottom-half {
  margin-bottom: 0.5rem;
}

.color-gold-strong {
  color: #c9a84c;
  font-weight: 600;
}

.italic-muted {
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
}

.border-top-thin {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(201, 168, 76, 0.2);
}

.label-small {
  font-size: 0.85rem;
  color: #c9a84c;
  font-weight: 500;
}

.text-bright-muted {
  color: rgba(255, 255, 255, 0.8);
}

.link-accent {
  color: var(--gold);
  text-decoration: none;
}

.link-accent:hover {
  text-decoration: underline;
}

.text-center {
  text-align: center;
}
