/* ===== SHARED PAGE STYLES ===== */
/* Used by manifesto.html, authors.html, contribute.html */

:root {
  --serif: 'Outfit', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
  --sans: 'DM Sans', -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #06050a;
  --text: #e8e6e1;
  --muted: #908e8b;
  --dim: #757270;
  --accent: #e8654a;
  --accent-btn: #be4028;
  --accent-glow: rgba(232, 101, 74, 0.15);
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --grad-a: rgba(226, 92, 62, 0.12);
  --grad-b: rgba(120, 60, 180, 0.10);
  --grad-c: rgba(40, 100, 180, 0.08);
  --ascii-base: rgba(107, 106, 103, 0.08);
  --ascii-mid: rgba(232, 101, 74, 0.12);
  --ascii-bright: rgba(232, 101, 74, 0.28);
  --ascii-fade: rgba(6, 5, 10, 0.07);
  --nav-bg: rgba(6, 5, 10, 0.7);
  --code-bg: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
  --bg: #f6f4f0;
  --text: #1a1917;
  --muted: #656260;
  --dim: #6d6a65;
  --accent: #b53921;
  --accent-btn: #b53921;
  --accent-glow: rgba(181, 57, 33, 0.08);
  --surface: rgba(0, 0, 0, 0.03);
  --surface-hover: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --grad-a: rgba(226, 92, 62, 0.06);
  --grad-b: rgba(160, 100, 200, 0.05);
  --grad-c: rgba(60, 130, 200, 0.05);
  --ascii-base: rgba(0, 0, 0, 0.03);
  --ascii-mid: rgba(181, 57, 33, 0.05);
  --ascii-bright: rgba(181, 57, 33, 0.12);
  --ascii-fade: rgba(246, 244, 240, 0.12);
  --nav-bg: rgba(246, 244, 240, 0.8);
  --code-bg: rgba(0, 0, 0, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.4s ease;
}

/* ===== GRADIENT MESH ===== */
.gradient-mesh {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.gradient-mesh .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  will-change: transform, opacity;
}

.gradient-mesh .orb-1 { width: 600px; height: 600px; background: var(--grad-a); top: -10%; left: -5%; animation: swim1 18s ease-in-out infinite; }
.gradient-mesh .orb-2 { width: 500px; height: 500px; background: var(--grad-b); top: 30%; right: -10%; animation: swim2 22s ease-in-out infinite; }
.gradient-mesh .orb-3 { width: 450px; height: 450px; background: var(--grad-c); bottom: -5%; left: 20%; animation: swim3 20s ease-in-out infinite; }

@keyframes swim1 { 0%, 100% { transform: translate(0,0) scale(1); } 33% { transform: translate(80px,60px) scale(1.1); } 66% { transform: translate(-40px,30px) scale(0.95); } }
@keyframes swim2 { 0%, 100% { transform: translate(0,0) scale(1); } 33% { transform: translate(-60px,40px) scale(1.05); } 66% { transform: translate(30px,-50px) scale(1.1); } }
@keyframes swim3 { 0%, 100% { transform: translate(0,0) scale(1); } 33% { transform: translate(50px,-40px) scale(1.08); } 66% { transform: translate(-70px,20px) scale(0.97); } }

/* ===== SHADER BACKGROUND ===== */
#shader-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== ASCII CANVAS ===== */
#ascii-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ===== TOP NAV ===== */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.5s ease;
}

.nav-left a {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover { background: var(--surface-hover); color: var(--text); }
.nav-btn svg { width: 18px; height: 18px; transition: transform 0.3s ease; }
.nav-btn:hover svg { transform: scale(1.1); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link svg { width: 14px; height: 14px; }
.nav-link.active { color: var(--text); }

.nav-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ===== CONTENT LAYER ===== */
.page {
  position: relative;
  z-index: 2;
  padding-top: 56px;
}

/* ===== MARKDOWN ARTICLE CONTENT ===== */
.article-container {
  max-width: 740px;
  margin: 0 auto;
  padding: 64px 28px 80px;
}

.article-container h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 8px;
}

/* ===== H2: Major section headings ===== */
.article-container h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: 72px;
  margin-bottom: 8px;
  padding-top: 40px;
  padding-bottom: 16px;
  border-top: 1px solid var(--border);
  position: relative;
}

.article-container h2::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}

.article-container h2:first-child,
.article-container h1 + h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 8px;
}

.article-container h2:first-child::before,
.article-container h1 + h2::before {
  display: none;
}

/* ===== H3: Sub-section headings (including the 16 rights) ===== */
.article-container h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 10px;
  color: var(--text);
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}

.article-container p {
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 20px;
  color: var(--text);
}

/* Strong text gets a subtle accent treatment */
.article-container strong {
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.005em;
}

.article-container em {
  font-style: italic;
}

.article-container a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-glow);
  transition: text-decoration-color 0.2s, color 0.2s;
}

.article-container a:hover {
  text-decoration-color: var(--accent);
}

/* ===== Lists ===== */
.article-container ul,
.article-container ol {
  margin-bottom: 24px;
  padding-left: 0;
  list-style: none;
}

.article-container li {
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 10px;
  padding-left: 24px;
  position: relative;
}

.article-container ul > li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0.85em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.article-container ol {
  counter-reset: ol-counter;
}

.article-container ol > li {
  counter-increment: ol-counter;
}

.article-container ol > li::before {
  content: counter(ol-counter) '.';
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  opacity: 0.7;
  top: 0.2em;
}

/* ===== Blockquotes ===== */
.article-container blockquote {
  border-left: 2px solid var(--accent);
  padding: 16px 28px;
  margin: 32px 0;
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  position: relative;
}

.article-container blockquote::before {
  content: '\201C';
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.2;
  font-family: var(--serif);
  line-height: 1;
}

/* ===== Code ===== */
.article-container code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-container pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 28px 0;
  overflow-x: auto;
  position: relative;
}

.article-container pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0.3;
  border-radius: 8px 0 0 8px;
}

.article-container pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* ===== Horizontal rules ===== */
.article-container hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), var(--accent-glow), var(--border), transparent);
  margin: 56px auto;
  max-width: 240px;
}

/* ===== Tables ===== */
.article-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.article-container th,
.article-container td {
  padding: 14px 18px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-container th {
  background: var(--surface);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.article-container td {
  color: var(--text);
}

/* ===== AUTHOR CARD ===== */
.author-card {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 24px 0;
}

.author-card .author-info h3 {
  margin-top: 0;
  margin-bottom: 4px;
}

.author-card .author-info p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.author-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.author-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.author-links a:hover { color: var(--accent); }
.author-links a svg { width: 14px; height: 14px; }

/* ===== FOOTER (page) ===== */
footer {
  padding: 48px 28px;
  text-align: center;
  border-top: 1px solid var(--border);
}

footer .links {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

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

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

footer .license {
  font-size: 0.75rem;
  color: var(--dim);
}

footer .license a {
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== HYPOTHESIS TOOLBAR OVERRIDES ===== */
/* The toolbar buttons sit outside the iframe on our page */
hypothesis-sidebar,
.annotator-frame {
  z-index: 50 !important;
}

/* ===== MOBILE NAV ===== */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  padding: 0;
}

.nav-hamburger:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-hamburger svg {
  width: 18px;
  height: 18px;
}

.mobile-nav-panel {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  flex-direction: column;
  gap: 2px;
  animation: mobileNavSlide 0.2s ease;
}

.mobile-nav-panel.open {
  display: flex;
}

@keyframes mobileNavSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mobile-nav-panel .nav-link {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.mobile-nav-panel .nav-link:hover,
.mobile-nav-panel .nav-link.active {
  background: var(--surface-hover);
  color: var(--text);
}

.mobile-nav-panel .nav-link svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 600px) {
  .nav-hamburger {
    display: flex;
  }

  .nav-right .nav-link,
  .nav-right .nav-sep {
    display: none;
  }
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
