/* ===========================================
   THE HEROIC IDEAL — Worldview Analysis
   A Narrative Commons Worldview Synthesis
   =========================================== */

:root {
  --noir-deepest: #0a0a0f;
  --noir-deep: #111118;
  --noir-base: #1a1a24;
  --noir-surface: #22222e;
  --noir-elevated: #2a2a38;
  --noir-border: #333345;

  /* Heroic Ideal — Classical bronze/copper accent */
  --hi-accent: #b87333;
  --hi-accent-bright: #d4944a;
  --hi-accent-faint: rgba(184, 115, 51, 0.08);
  --hi-accent-glow: rgba(184, 115, 51, 0.3);
  --hi-gold: #c9a84c;
  --hi-gold-dim: rgba(201, 168, 76, 0.15);

  /* Confidence colors */
  --color-trust: #10b981;
  --color-caution: #f59e0b;
  --color-alert: #ef4444;
  --color-neutral: #6b7280;

  /* Text */
  --text-bright: #e8e6e3;
  --text-primary: #c0bdb6;
  --text-secondary: #8a8880;
  --text-muted: #5a5850;

  /* Typography */
  --font-serif: 'EB Garamond', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --t-dramatic: 1000ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===========================================
   RESET & BASE
   =========================================== */

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

html {
  font-size: 19px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-serif);
  background: var(--noir-deepest);
  color: var(--text-primary);
  line-height: 1.75;
  overflow-x: hidden;
}

::selection {
  background: var(--hi-accent);
  color: var(--noir-deepest);
}

a {
  color: var(--hi-accent-bright);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

strong {
  color: var(--text-bright);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--hi-accent);
}


/* ===========================================
   NAVIGATION (slim brand bar)
   =========================================== */

.hi-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--noir-border);
  z-index: 100;
  padding: 0.75rem 0;
}

.hi-nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hi-nav-logo {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.hi-nav-logo:hover { color: var(--hi-accent); }

.hi-nav-sections {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.hi-nav-link {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.hi-nav-link:hover { color: var(--text-bright); }

/* ===========================================
   ARTICLE TOC (sidebar)
   =========================================== */

.hi-toc {
  position: fixed;
  top: 65px;
  left: 0;
  z-index: 90;
  width: 190px;
  max-height: calc(100vh - 80px);
  padding: 1.5rem 0 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.hi-toc-toggle { display: none; }

.hi-toc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  padding-right: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--noir-border) transparent;
}

.hi-toc-link {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-left: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hi-toc-link:hover {
  color: var(--text-secondary);
  border-left-color: var(--noir-border);
}

.hi-toc-link.active {
  color: var(--text-bright);
  border-left-color: var(--hi-accent);
}

.hi-toc-divider {
  display: block;
  height: 1px;
  background: var(--noir-border);
  margin: 0.4rem 0.5rem;
}

@media (min-width: 769px) {
  .hi-toc {
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
  }
}

@media (max-width: 768px) {
  .hi-toc {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: none;
    padding: 0;
    flex-direction: column-reverse;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--noir-border);
  }

  .hi-toc-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.75rem 2rem;
    cursor: pointer;
    width: 100%;
    justify-content: center;
  }

  .hi-toc-toggle:hover { color: var(--text-bright); }

  .hi-toc-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
    padding: 0 2rem;
  }

  .hi-toc.open .hi-toc-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem 2rem 1rem;
  }

  .hi-toc-link {
    font-size: 0.7rem;
    padding: 0.5rem 0.5rem;
  }
}

/* ===========================================
   MAIN LAYOUT
   =========================================== */

.hi-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===========================================
   HEADER
   =========================================== */

.hi-header {
  padding: 10rem 0 5rem;
  text-align: center;
}

.hi-header-content {
  max-width: 600px;
  margin: 0 auto;
}

.hi-header-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--hi-accent);
  margin-bottom: 1.5rem;
}

.hi-header-title {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 400;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1.5rem;
}

.hi-header-subtitle {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.hi-header-meta {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ===========================================
   SECTIONS — flowing prose
   =========================================== */

.hi-section {
  padding: 3rem 0;
}

.hi-section-content {
  max-width: 680px;
  margin: 0 auto;
}

/* Section separator — subtle ornament between parts */
.hi-section + .hi-section::before {
  content: '◆';
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.6rem;
  letter-spacing: 1em;
  padding-bottom: 3rem;
  opacity: 0.5;
}

.hi-section h2 {
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-bright);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.hi-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.hi-section h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.hi-section p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

/* ===========================================
   BLOCKQUOTES — elegant pull-quotes
   =========================================== */

blockquote,
.hi-quote {
  border: none;
  border-left: 2px solid var(--hi-accent);
  background: none;
  padding: 0 0 0 1.5rem;
  margin: 2rem 0;
}

blockquote p,
.hi-quote p {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-bright);
  line-height: 1.75;
  margin: 0 0 0.5rem 0;
}

blockquote footer,
.hi-quote footer {
  font-style: normal;
  font-size: 0;
  color: var(--text-muted);
}

.hi-quote-ref {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color var(--transition-fast);
}

.hi-quote-ref:hover { color: var(--hi-accent); }

/* ===========================================
   SCROLL PROGRESS BAR
   =========================================== */

.hi-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--hi-accent), var(--hi-accent-bright));
  z-index: 200;
  transition: width 50ms linear;
}

/* ===========================================
   NAV — scrolled state
   =========================================== */

.hi-nav.scrolled {
  background: rgba(10, 10, 15, 0.95);
  border-bottom-color: var(--hi-accent);
}

/* ===========================================
   SECTION NUMBER LABELS
   =========================================== */

.hi-section-number {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--hi-accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hi-section-number::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--hi-accent), transparent);
  opacity: 0.3;
}

/* ===========================================
   CONFIDENCE UNDERLINES — inline text marking
   =========================================== */

.hi-conf-high {
  border-bottom: 1px solid var(--color-trust);
  padding-bottom: 1px;
}

.hi-conf-medium {
  border-bottom: 1px dotted var(--color-caution);
  padding-bottom: 1px;
}

.hi-conf-low {
  border-bottom: 1px dotted var(--color-alert);
  padding-bottom: 1px;
}

.hi-conf-speculative {
  border-bottom: 1px dotted var(--color-neutral);
  padding-bottom: 1px;
}

/* In tables, slightly more visible */
.hi-table .hi-conf-high,
.hi-table .hi-conf-medium,
.hi-table .hi-conf-low,
.hi-table .hi-conf-speculative {
  border-bottom-width: 2px;
  padding-bottom: 2px;
}

/* ===========================================
   LISTS — clean, integrated
   =========================================== */

.hi-section ul,
.hi-section ol {
  margin: 1rem 0 1.5rem;
  padding-left: 1.5rem;
}

.hi-section ul { list-style: none; }

.hi-section ul li,
.hi-list li {
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.hi-section ul li::before,
.hi-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.hi-section ol {
  list-style: decimal;
  padding-left: 1.5rem;
}

.hi-section ol li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
  padding-left: 0.25rem;
}

.hi-section ol li::before { content: none; }

/* ===========================================
   TABLES — light, embedded in prose
   =========================================== */

.hi-table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  -webkit-overflow-scrolling: touch;
}

.hi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.6;
}

.hi-table thead { border-bottom: 1px solid var(--noir-border); }

.hi-table th {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.hi-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(51, 51, 69, 0.4);
  color: var(--text-primary);
  vertical-align: top;
}

.hi-table tbody tr:last-child td {
  border-bottom: none;
}

.hi-table a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ===========================================
   SEMANTIC CLUSTER VISUALIZATION
   =========================================== */

.hi-clusters {
  margin: 2rem 0;
}

.hi-cluster {
  background: var(--noir-surface);
  border: 1px solid var(--noir-border);
  border-left: 3px solid var(--hi-accent);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: all var(--transition-normal);
}

.hi-cluster:hover {
  border-color: var(--hi-accent);
  box-shadow: 0 0 20px var(--hi-accent-faint);
}

.hi-cluster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.hi-cluster-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--hi-accent-bright);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hi-cluster-coherence {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.hi-cluster-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.hi-cluster-term {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  background: var(--hi-accent-faint);
  color: var(--text-secondary);
  border: 1px solid rgba(184, 115, 51, 0.15);
}

/* ===========================================
   THESIS BANNER
   =========================================== */

.hi-thesis {
  background: var(--noir-surface);
  border-left: 3px solid var(--hi-accent);
  border-right: 1px solid var(--noir-border);
  border-top: 1px solid var(--noir-border);
  border-bottom: 1px solid var(--noir-border);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  position: relative;
}

.hi-thesis::before {
  content: 'THESIS';
  position: absolute;
  top: -0.6em;
  left: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--hi-accent);
  background: var(--noir-surface);
  padding: 0 0.5rem;
}

.hi-thesis p {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-bright);
  margin: 0;
  line-height: 1.7;
}

/* ===========================================
   FOOTER
   =========================================== */

.hi-footer {
  border-top: 1px solid var(--noir-border);
  padding: 4rem 1.5rem;
  margin-top: 4rem;
}

.hi-footer-content {
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.hi-footer-section h3 {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hi-footer-section p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.hi-footer-section ul { list-style: none; }

.hi-footer-section li { padding: 0.15rem 0; }

.hi-footer-section a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}

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

.hi-footer-section small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===========================================
   SCROLL REVEAL — only for h2 headings
   =========================================== */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 800ms ease, transform 800ms ease;
}

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

/* ===========================================
   STAGGER CHILDREN ANIMATION
   =========================================== */

.stagger-children .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-children .reveal:nth-child(2) { transition-delay: 100ms; }
.stagger-children .reveal:nth-child(3) { transition-delay: 200ms; }
.stagger-children .reveal:nth-child(4) { transition-delay: 300ms; }
.stagger-children .reveal:nth-child(5) { transition-delay: 400ms; }
.stagger-children .reveal:nth-child(6) { transition-delay: 500ms; }
.stagger-children .reveal:nth-child(7) { transition-delay: 600ms; }

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
  html { font-size: 17px; }

  .hi-header { padding: 7rem 0 3rem; }
  .hi-header-title { font-size: 2rem; }

  .hi-nav-sections { display: none; }

  .hi-section h2 { font-size: 1.5rem; }
  .hi-section h3 { font-size: 1.1rem; }

  .hi-footer-content { grid-template-columns: 1fr; gap: 2rem; }

  .hi-footer { padding-bottom: 6rem; }

  .hi-cluster-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

@media (max-width: 480px) {
  .hi-header-title { font-size: 1.7rem; }
}

/* ===========================================
   PRINT
   =========================================== */

@media print {
  body { background: white; color: #1a1a1a; }
  .hi-nav, .hi-toc, .hi-footer { display: none; }
  .reveal { opacity: 1; transform: none; }
  .hi-section + .hi-section::before { color: #999; }
  a { color: #1a1a1a; }
  strong { color: #1a1a1a; }
  blockquote { border-left-color: #999; }
  .hi-table td { border-bottom-color: #ddd; }
  .hi-cluster { border-color: #ccc; box-shadow: none; }
}
