/* ===========================================
   THE OBSERVATORY — Public Site Stylesheet
   Clean, professional, academic tone
   =========================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #eef1f5;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7a7a9a;
  --accent: #2d3561;
  --accent-light: #3d4f8f;
  --accent-hover: #1e2445;
  --accent-bg: rgba(45, 53, 97, 0.06);
  --accent-border: rgba(45, 53, 97, 0.15);
  --border: #dde1e8;
  --border-light: #eaecf0;
  --green: #2e7d32;
  --green-bg: rgba(46, 125, 50, 0.08);
  --orange: #c17a1a;
  --orange-bg: rgba(193, 122, 26, 0.08);
  --red: #b33a3a;
  --red-bg: rgba(179, 58, 58, 0.08);
  --purple: #5e4b8b;
  --purple-bg: rgba(94, 75, 139, 0.08);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width: 800px;
  --max-width-wide: 960px;
}

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

/* Base */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

em {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--accent-bg);
  color: var(--text-secondary);
  border-radius: 0 4px 4px 0;
}

blockquote p {
  margin-bottom: 0.5rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

ul, ol {
  margin: 0.5rem 0 1.25rem 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.35rem;
}

li::marker {
  color: var(--text-muted);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
}

/* ===========================================
   Navigation
   =========================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  max-width: var(--max-width-wide);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
  min-height: 56px;
}

.site-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-bg);
  font-weight: 500;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

/* ===========================================
   Page Header
   =========================================== */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.5;
  max-width: 600px;
}

/* ===========================================
   Content
   =========================================== */
.content {
  padding: 2rem 0 4rem;
}

.content > *:first-child {
  margin-top: 0;
}

/* ===========================================
   Tables
   =========================================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td {
  color: var(--text-secondary);
}

tr:hover td {
  background: var(--bg-secondary);
}

/* ===========================================
   Cards
   =========================================== */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}

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

.card h3 {
  margin-top: 0;
  font-size: 1rem;
}

.card p {
  font-size: 0.9rem;
}

/* ===========================================
   Key Numbers
   =========================================== */
.key-numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.key-number {
  text-align: center;
  padding: 1.25rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.key-number .number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.key-number .label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===========================================
   Version Tag
   =========================================== */
.version-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  margin-left: 0.25rem;
}

.inflection-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===========================================
   Topology Cards
   =========================================== */
.topology-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.topology-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  border-top: 3px solid var(--accent);
}

.topology-card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.topology-card .example {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ===========================================
   Lexicon Entries
   =========================================== */
.lexicon-section {
  margin-top: 2rem;
}

.lexicon-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.lexicon-entry {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.lexicon-entry:last-child {
  border-bottom: none;
}

.lexicon-term {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.lexicon-plain {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 0.5rem;
}

.lexicon-def {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.6;
}

/* ===========================================
   Iteration Timeline (findings page)
   =========================================== */
.iteration-entry {
  padding: 1rem 0 1rem 1.5rem;
  border-left: 2px solid var(--border);
  position: relative;
  margin-bottom: 0;
}

.iteration-entry::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 1.25rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.iteration-entry.inflection {
  border-left-color: var(--green);
}

.iteration-entry.inflection::before {
  background: var(--green);
  width: 10px;
  height: 10px;
  left: -6px;
}

.iteration-version {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.iteration-name {
  font-weight: 600;
  margin-left: 0.5rem;
  font-size: 0.95rem;
}

.iteration-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-family: var(--font-mono);
}

.iteration-finding {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.iteration-generation {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ===========================================
   SVG Chart
   =========================================== */
.chart-container {
  margin: 2rem 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 1.5rem;
  overflow-x: auto;
}

.chart-container h3 {
  margin-top: 0;
  font-size: 0.95rem;
}

.chart-container p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.chart-svg {
  width: 100%;
  height: auto;
}

/* ===========================================
   Architecture Diagram
   =========================================== */
.diagram {
  margin: 2rem 0;
  text-align: center;
}

.diagram svg {
  max-width: 100%;
  height: auto;
}

/* ===========================================
   Page Links Grid (homepage)
   =========================================== */
.page-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.page-link {
  display: block;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.page-link:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  text-decoration: none;
}

.page-link h3 {
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 0.25rem;
  color: var(--accent);
}

.page-link p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ===========================================
   Methodology Cycle Diagram (CSS)
   =========================================== */
.cycle-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.cycle-step {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  text-align: center;
  min-width: 120px;
}

.cycle-step .step-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

.cycle-step .step-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.cycle-arrow {
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* ===========================================
   Footer
   =========================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.8;
}

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

.footer-sep {
  margin: 0 0.5rem;
  color: var(--border);
}

/* ===========================================
   Proposal-specific
   =========================================== */
.proposal-meta {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.proposal-meta p {
  margin-bottom: 0.25rem;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
  h1 {
    font-size: 1.4rem;
  }

  .key-numbers {
    grid-template-columns: repeat(2, 1fr);
  }

  .topology-grid {
    grid-template-columns: 1fr;
  }

  .page-links {
    grid-template-columns: 1fr;
  }

  .site-header .container {
    flex-wrap: wrap;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    padding: 0.5rem 0;
    gap: 0;
  }

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

  .site-nav a {
    padding: 0.6rem 0;
    border-radius: 0;
  }

  .nav-toggle {
    display: block;
  }

  .cycle-diagram {
    flex-direction: column;
  }

  .cycle-arrow {
    transform: rotate(90deg);
  }

  table {
    font-size: 0.82rem;
  }

  th, td {
    padding: 0.5rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .key-numbers {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .key-number .number {
    font-size: 1.5rem;
  }

  .container {
    padding: 0 1rem;
  }
}
