/* ===========================================
   PREDICTIVE HISTORY — Narrative Commons
   Prose-first long-form reading design
   =========================================== */

:root {
  --noir-deepest: #0a0a0f;
  --noir-deep: #111118;
  --noir-base: #1a1a24;
  --noir-surface: #22222e;
  --noir-elevated: #2a2a38;
  --noir-border: #333345;
  --accent: #3b82f6;
  --accent-faint: rgba(59, 130, 246, 0.08);
  --color-trust: #10b981;
  --color-caution: #f59e0b;
  --color-alert: #ef4444;
  --color-neutral: #6b7280;
  --nc-gold: #c9a84c;
  --nc-gold-dim: rgba(201, 168, 76, 0.15);
  --text-bright: #e8e6e3;
  --text-primary: #c0bdb6;
  --text-secondary: #8a8880;
  --text-muted: #5a5850;
  --font-serif: 'EB Garamond', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --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(--nc-gold);
  color: var(--noir-deepest);
}

a {
  color: var(--nc-gold);
  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(--nc-gold);
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 0;
  background: var(--accent);
  color: white;
  padding: 1rem;
  text-decoration: none;
  z-index: 200;
  font-family: var(--font-system);
}

.skip-link:focus { top: 0; }

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

.ph-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;
}

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

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

.ph-nav-logo:hover { color: var(--nc-gold); }

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

.ph-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);
}

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

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

.ph-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;
}

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

.ph-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;
}

.ph-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;
}

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

.ph-toc-link.active {
  color: var(--text-bright);
  border-left-color: var(--nc-gold);
}

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

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

@media (max-width: 768px) {
  .ph-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);
  }

  .ph-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;
  }

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

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

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

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

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

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

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

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

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

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

.ph-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;
}

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

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

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

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

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

/* Section separator — subtle ornament between parts */
.ph-section + .ph-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;
}

.ph-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;
}

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

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

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

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

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

blockquote p,
.ph-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,
.ph-quote footer {
  font-style: normal;
  font-size: 0;  /* hide old "Watch" labels */
  color: var(--text-muted);
}

/* Video reference link after quote — subtle mono */
.ph-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);
}

.ph-quote-ref:hover { color: var(--nc-gold); }

.ph-quote-video {
  font-size: 0.65rem;
}

.ph-quote-label {
  font-size: 0.65rem;
}

/* ===========================================
   INLINE CONFIDENCE — subtle annotations
   =========================================== */

/* Override the old badge style to be inline text */
.ph-confidence-badge {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  white-space: nowrap;
}

.ph-confidence-high { color: var(--color-trust); }
.ph-confidence-medium { color: var(--color-caution); }
.ph-confidence-low { color: var(--color-alert); }
.ph-confidence-unclear { color: var(--color-neutral); }

/* When used in tables, slightly more visible */
.ph-table .ph-confidence-badge {
  font-size: 0.7rem;
  font-weight: 500;
}

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

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

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

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

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

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

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

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

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

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

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

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

.ph-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;
}

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

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

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

/* ===========================================
   CLAIM CARDS — now just regular prose
   No special container styling
   =========================================== */

.ph-claim-card {
  background: none;
  border: none;
  border-left: none;
  padding: 0;
  margin: 0 0 1.25rem;
  border-radius: 0;
  transition: none;
}

.ph-claim-card:hover {
  border-color: transparent;
  box-shadow: none;
}

.ph-claim-card p { margin-bottom: 1.25rem; }

/* ===========================================
   QUOTE EXPLORER
   =========================================== */

.ph-quote-search {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.ph-quote-search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--noir-border);
  border-radius: 2px;
  font-family: var(--font-serif);
  font-size: 1rem;
  background: var(--noir-surface);
  color: var(--text-bright);
  transition: border-color var(--transition-fast);
}

.ph-quote-search-input:focus {
  outline: none;
  border-color: var(--nc-gold);
}

.ph-quote-search-input::placeholder { color: var(--text-muted); }

.ph-quote-search-btn {
  padding: 0.75rem 1.5rem;
  background: var(--noir-surface);
  color: var(--text-secondary);
  border: 1px solid var(--noir-border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ph-quote-search-btn:hover {
  background: var(--noir-elevated);
  color: var(--text-bright);
  border-color: var(--nc-gold);
}

.ph-quote-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

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

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

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

.ph-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;
}

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

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

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

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

.ph-footer-section a:hover { color: var(--nc-gold); }

.ph-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);
}

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

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

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

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

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

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

  .ph-quote-search { flex-direction: column; }

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

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

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

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