/* ══════════════════════════════════════════════════════
   Shared Project Page Styles
   ──────────────────────────────────────────────────────
   Override --accent, --accent-hover, --accent-bg,
   --accent-bg-active, and --thesis-gradient-end
   per page via a small inline <style> block.
   ══════════════════════════════════════════════════════ */

:root {
  /* Accent — override per page */
  --accent: #4fb1ba;
  --accent-hover: #7dd4dc;
  --accent-bg: rgba(79, 177, 186, 0.1);
  --accent-bg-active: rgba(79, 177, 186, 0.15);
  --thesis-gradient-end: #16a085;

  /* Dark theme palette — shared across all project pages */
  --bg-body: hsl(200.87, 5.99%, 17.5%);
  --bg-sidebar: #202020;
  --bg-nav: rgb(25, 55, 71);
  --bg-card: hsl(200.87, 5.99%, 22.5%);
  --bg-table: hsl(200.87, 5.99%, 20%);
  --bg-code: hsl(200.87, 5.99%, 12%);
  --bg-resources: hsl(200.87, 5.99%, 22%);
  --border-color: hsl(200.87, 5.99%, 22.5%);
  --border-light: hsl(200.87, 5.99%, 25%);
  --border-card: hsl(200.87, 5.99%, 28%);
  --text-primary: #ccc;
  --text-heading: #eee;
  --text-heading-2: #ddd;
  --text-heading-3: #bbb;
  --text-muted: rgba(255,255,255,.5);
  --text-sidebar: rgba(255,255,255,.75);
  --text-sidebar-heading: rgba(255,255,255,.4);
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Top Nav ── */
.topnav {
  background: var(--bg-nav);
  color: #fff;
  padding: 14px 24px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border-color);
}
.topnav .brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.topnav .nav-title {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,.3);
}
.menu-toggle {
  display: none;
  background: none; border: none; color: #fff;
  font-size: 1.5rem; cursor: pointer;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 52px; left: 0; bottom: 0;
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 90;
  transition: transform 0.3s;
}
.sidebar h3 {
  padding: 8px 20px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sidebar-heading);
  margin-top: 12px;
}
.sidebar h3:first-child { margin-top: 0; }
.sidebar a {
  display: block;
  padding: 7px 20px 7px 28px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover {
  background: var(--accent-bg);
  color: var(--accent);
}
.sidebar a.active {
  background: var(--accent-bg-active);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar .back-link {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--accent);
}
.sidebar .sidebar-divider {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 2px solid hsl(200.87, 5.99%, 32%);
  color: rgba(255,255,255,.45);
  font-size: 0.7rem;
  margin-bottom: 4px;
}
.sidebar .report-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 36px;
}
.sidebar .report-link:hover { color: var(--accent); }
.sidebar a.ext-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}
.sidebar a.ext-link:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

/* ── Main Content ── */
.main {
  margin-left: 260px;
  margin-top: 52px;
  padding: 40px 48px 80px;
  max-width: 920px;
}

h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--text-heading);
}
h2 {
  font-size: 1.5rem;
  margin-top: 48px;
  margin-bottom: 16px;
  color: var(--text-heading-2);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}
h3 {
  font-size: 1.15rem;
  margin-top: 32px;
  margin-bottom: 10px;
  color: var(--text-heading-3);
}
p { margin-bottom: 14px; }
strong { color: var(--text-heading); }

/* ── Part dividers ── */
.part-section {
  padding-top: 24px;
  margin-top: 56px;
  border-top: 3px solid var(--accent);
}
.part-section:first-of-type { margin-top: 0; border-top: none; }
.part-label {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.part-date {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ── Callout / Thesis boxes ── */
.central-thesis {
  background: linear-gradient(135deg, var(--bg-nav), var(--thesis-gradient-end));
  color: #fff;
  padding: 28px 32px;
  border-radius: 8px;
  margin: 20px 0 28px;
}
.thesis-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.8;
  margin-bottom: 8px;
}
.thesis-text {
  font-size: 1.1rem;
  line-height: 1.6;
  font-style: italic;
}

.callout {
  background: rgba(249, 168, 37, 0.15);
  border-left: 4px solid #f9a825;
  padding: 16px 20px;
  border-radius: 0 6px 6px 0;
  margin: 20px 0;
}
.callout-label {
  font-weight: 700;
  color: #f9a825;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.finding {
  background: rgba(21, 101, 192, 0.15);
  border-left: 4px solid #64b5f6;
  padding: 16px 20px;
  border-radius: 0 6px 6px 0;
  margin: 20px 0;
}
.finding-label {
  font-weight: 700;
  color: #64b5f6;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.conclusion {
  background: rgba(67, 160, 71, 0.15);
  border-left: 4px solid #66bb6a;
  padding: 20px 24px;
  border-radius: 0 6px 6px 0;
  margin: 28px 0;
}
.conclusion h2 {
  border-bottom: none;
  margin-top: 0;
  color: #81c784;
}

/* ── Pillars ── */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.pillar {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 18px;
}
.pillar-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.92rem;
  background: var(--bg-table);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
th {
  background: var(--bg-nav);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: hsl(200.87, 5.99%, 26%); }
.winner { color: #81c784; font-weight: 700; }
.loser { color: #ef5350; }

/* ── Code blocks ── */
pre {
  background: var(--bg-code);
  color: #cdd6f4;
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.88rem;
  margin: 16px 0;
  line-height: 1.5;
}
code {
  font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
}
p code, li code, td code {
  background: rgba(255,255,255,.12);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
}

/* ── Images ── */
.fig {
  margin: 24px 0;
  text-align: center;
}
.fig img {
  max-width: 100%;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* ── Foldable Supplementary Figures ── */
details.supplementary {
  margin: 20px 0;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--bg-card);
  overflow: hidden;
}
details.supplementary summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
details.supplementary summary::-webkit-details-marker { display: none; }
details.supplementary summary::before {
  content: "\25B6";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  color: var(--accent);
}
details.supplementary[open] summary::before {
  transform: rotate(90deg);
}
details.supplementary summary:hover {
  background: var(--accent-bg);
}
details.supplementary .supple-content {
  padding: 4px 16px 16px;
}
details.supplementary .supple-content .fig {
  margin: 12px 0;
}

/* ── Lists ── */
ul, ol { margin: 10px 0 16px 24px; }
li { margin-bottom: 6px; }

/* ── Horizontal rule ── */
hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 32px 0;
}

/* ── Resources ── */
.resources {
  background: var(--bg-resources);
  padding: 20px 24px;
  border-radius: 8px;
  margin: 24px 0;
}
.resources a { color: var(--accent); text-decoration: none; }
.resources a:hover { text-decoration: underline; }

/* ── Links ── */
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* ── Diagram container ── */
.diagram-container {
  margin: 28px 0;
  overflow-x: auto;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 24px 20px 60px; }
  .menu-toggle { display: block; }
}
