/* ============================================================
   PDEC - Pacific Decarbonized Energy Corridor
   Color palette: #1B5E8C (accent), #2C3E50 (dark), #4A6274 (medium),
   #0F6E56 (teal), #BA7517 (amber), #D85A30 (coral), #E8F0F6 (light)
   ============================================================ */

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

:root {
  --accent: #1B5E8C;
  --accent-dark: #0a2a3f;
  --dark: #2C3E50;
  --medium: #4A6274;
  --teal: #0F6E56;
  --amber: #BA7517;
  --coral: #D85A30;
  --purple: #534AB7;
  --light: #E8F0F6;
  --bg: #f7f9fb;
  --white: #ffffff;
  --border: #dce3e8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1120px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--dark);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--medium);
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-cta {
  background: var(--accent) !important;
  color: var(--white) !important;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 600 !important;
  font-size: 13px !important;
  transition: background var(--transition) !important;
}

.nav-cta:hover {
  background: var(--accent-dark) !important;
  color: var(--white) !important;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--dark);
  margin: 5px 0;
  transition: var(--transition);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--dark);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 8px 0;
}

.btn-ghost:hover { color: var(--accent-dark); }

.btn-ghost::after {
  content: '\2192';
  margin-left: 4px;
  transition: margin var(--transition);
}

.btn-ghost:hover::after { margin-left: 8px; }

/* ============================================================
   SECTIONS
   ============================================================ */

.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--bg);
}

.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
  margin-bottom: 16px;
}

.section-subtitle {
  font-size: 16px;
  color: var(--medium);
  line-height: 1.7;
  max-width: 720px;
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  padding: 56px 0 48px;
  background: var(--bg);
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
}

.hero-eyebrow-canada {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #D42D27;
  margin-bottom: 16px;
}

.canada-flag {
  border-radius: 2px;
  object-fit: cover;
}

.hero-title {
  font-size: 40px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--medium);
  line-height: 1.7;
  margin-bottom: 24px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.metric-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-label {
  font-size: 12px;
  color: var(--medium);
  margin-top: 4px;
  font-weight: 500;
}

.metric-note {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.mc-accent .metric-value { color: var(--accent); }
.mc-teal .metric-value { color: var(--teal); }
.mc-amber .metric-value { color: var(--amber); }
.mc-coral .metric-value { color: var(--coral); }

/* ============================================================
   CARDS
   ============================================================ */

.card-grid {
  display: grid;
  gap: 20px;
}

.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid-6 { grid-template-columns: repeat(6, 1fr); }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}

.card p {
  font-size: 13px;
  color: var(--medium);
  line-height: 1.6;
}

/* ============================================================
   OFFTAKER STRIP
   ============================================================ */

.offtaker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.offtaker-chip {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition);
}

.offtaker-chip:hover { transform: translateY(-2px); }

.offtaker-icon {
  font-size: 24px;
  margin-bottom: 6px;
  opacity: 0.7;
}

.offtaker-count {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.offtaker-label {
  font-size: 12px;
  color: var(--medium);
  margin-top: 2px;
}

/* ============================================================
   ECONOMICS TABLE
   ============================================================ */

.econ-table {
  width: 100%;
  max-width: 640px;
}

/* Stacked bar */
.econ-bar-wrapper {
  max-width: 100%;
}

.econ-stacked-bar {
  display: flex;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  gap: 3px;
}

.econ-bar-segment {
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.econ-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
}

.econ-bar-direct {
  background: var(--accent);
}

.econ-bar-social {
  background: var(--teal);
}

.econ-bar-total-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 10px 16px;
  background: var(--accent-dark);
  border-radius: 6px;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
}

.econ-bar-total-value {
  font-size: 22px;
  font-weight: 800;
}

/* Two-column cards */
.econ-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.econ-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.econ-card-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.econ-card-direct { border-top: 3px solid var(--accent); }
.econ-card-social { border-top: 3px solid var(--teal); }

.econ-card .econ-row {
  padding: 10px 20px;
  border-bottom: 1px solid var(--light);
}

.econ-card .econ-row:last-child { border-bottom: none; }

.econ-card-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 2px solid;
  background: var(--bg);
}

.econ-card-subtotal .econ-name {
  font-weight: 700;
  color: var(--dark);
}

.econ-card-subtotal .econ-value {
  font-size: 15px;
}

.econ-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--light);
}

.econ-row:last-child { border-bottom: none; }

.econ-name {
  font-size: 14px;
  color: var(--medium);
}

.econ-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  margin-left: 12px;
}

.econ-total {
  background: var(--light);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.econ-total .econ-name {
  font-weight: 700;
  color: var(--dark);
}

.econ-total .econ-value {
  font-size: 20px;
}

/* ============================================================
   PARTNER GRID
   ============================================================ */

.partner-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.partner-logo {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--medium);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.partner-logo:hover {
  background: var(--light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   TIMELINE
   ============================================================ */

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.phase {
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}

.phase h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.phase-dates {
  font-size: 13px;
  margin-bottom: 10px;
}

.phase p {
  font-size: 13px;
  line-height: 1.5;
}

.phase-0 { background: var(--light); }
.phase-0 h3 { color: var(--accent); }
.phase-0 .phase-dates { color: var(--medium); }

.phase-1 { background: #D5E8D0; }
.phase-1 h3 { color: var(--teal); }
.phase-1 .phase-dates { color: var(--dark); }

.phase-2 { background: #FCE8D5; }
.phase-2 h3 { color: var(--amber); }
.phase-2 .phase-dates { color: var(--dark); }

.phase-3 { background: #EEEDFE; }
.phase-3 h3 { color: var(--purple); }
.phase-3 .phase-dates { color: var(--dark); }

/* ============================================================
   CTA SECTION
   ============================================================ */

.cta-section {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  padding: 64px 0;
  text-align: center;
  color: var(--white);
}

.cta-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-section p {
  font-size: 16px;
  opacity: 0.85;
  margin-bottom: 24px;
}

.cta-section .btn {
  background: var(--white);
  color: var(--accent);
  font-size: 15px;
  padding: 14px 32px;
}

.cta-section .btn:hover {
  background: var(--light);
  color: var(--accent-dark);
}

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

.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--medium);
}

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

/* ============================================================
   PAGE HEADER (for inner pages)
   ============================================================ */

.page-header {
  background: var(--bg);
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
}

.page-header .section-eyebrow { margin-bottom: 8px; }
.page-header .section-title { margin-bottom: 12px; }

/* ============================================================
   CONTENT SECTIONS (inner pages)
   ============================================================ */

.content-section {
  padding: 48px 0;
  border-bottom: 1px solid var(--light);
}

.content-section:last-child { border-bottom: none; }

.content-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 16px;
}

.content-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  margin-top: 24px;
}

.content-section h3:first-child { margin-top: 0; }

.content-section p {
  font-size: 15px;
  color: var(--medium);
  line-height: 1.7;
  margin-bottom: 12px;
  max-width: 800px;
}

.content-section ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.content-section li {
  font-size: 14px;
  color: var(--medium);
  line-height: 1.7;
  padding: 6px 0 6px 20px;
  position: relative;
}

.content-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ============================================================
   DATA TABLE
   ============================================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 16px 0;
}

.data-table thead th {
  background: var(--accent);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}

.data-table thead th:last-child,
.data-table thead th.right { text-align: right; }

.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--light);
  color: var(--dark);
}

.data-table tbody td:last-child,
.data-table tbody td.right {
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

.data-table tbody tr:nth-child(even) { background: var(--bg); }

.data-table tbody tr:hover { background: var(--light); }

.data-table tfoot td {
  padding: 12px 14px;
  background: var(--light);
  font-weight: 700;
  border-top: 2px solid var(--accent);
}

.data-table tfoot td:last-child {
  text-align: right;
  color: var(--accent);
  font-size: 16px;
}

/* ============================================================
   SYSTEM DIAGRAM (SVG/CSS)
   ============================================================ */

.system-diagram {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  margin: 24px 0;
  overflow: hidden;
}

.diagram-node {
  background: var(--white);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 0;
  text-align: center;
  flex: 1 1 0;
}

.diagram-node h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.diagram-node p {
  font-size: 12px;
  color: var(--medium);
  margin: 0;
}

.diagram-sub {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--dark);
  margin-top: 8px;
}

.diagram-arrow {
  font-size: 28px;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 300;
}

.diagram-arrow-label {
  font-size: 11px;
  color: var(--medium);
  text-align: center;
}

/* ============================================================
   STAT CARDS (Benefits page, etc)
   ============================================================ */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.stat-card {
  text-align: center;
  padding: 24px 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--medium);
  margin-top: 6px;
}

/* ============================================================
   SENSITIVITY CHART PLACEHOLDER
   ============================================================ */

.chart-container {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  min-height: 300px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 350px;
}

/* ============================================================
   CHECKLIST
   ============================================================ */

.checklist { list-style: none; padding: 0; }

.checklist li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 14px;
  color: var(--medium);
}

.checklist li::before {
  position: absolute;
  left: 0;
  top: 9px;
  font-size: 14px;
}

.checklist li.done { color: var(--dark); }
.checklist li.done::before { content: '\2713'; color: var(--teal); font-weight: 700; }
.checklist li.pending::before { content: '\25CB'; color: var(--medium); }

/* ============================================================
   RISK BADGES
   ============================================================ */

.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.risk-critical {
  background: #fce4e4;
  color: #b63a2a;
}

.risk-high {
  background: #fef3e0;
  color: #8a5a00;
}

.risk-medium {
  background: #e0f0fa;
  color: #1a5276;
}

.risk-low {
  background: #e0f5ef;
  color: #0d5e47;
}

.data-table .mitigation-cell {
  font-size: 13px;
  color: var(--medium);
  font-weight: 400;
  line-height: 1.5;
}

/* ============================================================
   COMPARISON CARDS (Why hydrogen section)
   ============================================================ */

.comparison-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.comparison-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.comparison-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.comparison-card-header .card-icon {
  margin-bottom: 0;
  flex-shrink: 0;
}

.comparison-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

.comparison-card-header .comparison-challenge {
  font-size: 13px;
  color: var(--medium);
  margin: 2px 0 0 0;
  line-height: 1.5;
}

.comparison-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.comparison-col {
  padding: 20px 24px;
}

.comparison-col-battery {
  border-right: 1px solid var(--border);
  background: #fef8f5;
}

.comparison-col-hydrogen {
  background: #f2f9f6;
}

.comparison-col-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.comparison-col-battery .comparison-col-label {
  color: var(--coral);
}

.comparison-col-hydrogen .comparison-col-label {
  color: var(--teal);
}

.comparison-col p {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.6;
  margin-bottom: 8px;
}

.comparison-col p:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .comparison-columns {
    grid-template-columns: 1fr;
  }
  .comparison-col-battery {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

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

@media (max-width: 1024px) {
  .hero .container { grid-template-columns: 1fr; gap: 32px; }
  .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .timeline-grid { grid-template-columns: repeat(2, 1fr); }
  .partner-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
    box-shadow: var(--shadow-lg);
  }
  .nav-hamburger { display: block; }

  .hero-title { font-size: 30px; }
  .hero-metrics { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: 26px; }

  .card-grid-3,
  .card-grid-4,
  .card-grid-6 { grid-template-columns: 1fr; }

  .offtaker-grid { grid-template-columns: repeat(3, 1fr); }
  .partner-grid { grid-template-columns: repeat(3, 1fr); }
  .timeline-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }

  .system-diagram { flex-direction: column; }
  .diagram-arrow { transform: rotate(90deg); }
  .econ-columns { grid-template-columns: 1fr; }
  .econ-bar-labels { flex-direction: column; gap: 2px; }
}

@media (max-width: 480px) {
  .hero-metrics { grid-template-columns: 1fr; }
  .offtaker-grid { grid-template-columns: repeat(2, 1fr); }
  .partner-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; }
}

/* ============================================================
   SOURCE INFO SYSTEM
   ============================================================ */

[data-source] {
  position: relative;
}

.source-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--medium);
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  font-family: 'Georgia', 'Times New Roman', serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

[data-source]:hover .source-btn,
[data-source]:focus-within .source-btn {
  opacity: 1;
}

.source-btn:hover,
.source-btn:focus {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  outline: none;
}

/* Touch devices: always show at reduced opacity */
@media (hover: none) {
  .source-btn { opacity: 0.5; }
  [data-source]:hover .source-btn { opacity: 1; }
}

/* Source Modal Overlay */
.source-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 62, 80, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.source-overlay.active {
  display: flex;
}

/* Source Modal */
.source-modal {
  background: var(--white);
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  position: relative;
  animation: sourceModalIn 0.2s ease;
}

@keyframes sourceModalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.source-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--medium);
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
  padding: 0;
}

.source-close:hover {
  color: var(--dark);
  background: var(--bg);
}

.source-body {
  padding: 28px 32px 32px;
}

.source-body h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 16px;
  padding-right: 36px;
  line-height: 1.3;
}

.source-body h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 8px;
}

.source-body h4:first-of-type {
  margin-top: 0;
}

.source-body p {
  font-size: 14px;
  color: var(--dark);
  line-height: 1.7;
  margin: 0 0 8px;
}

.source-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.source-body li {
  font-size: 13px;
  color: var(--dark);
  line-height: 1.6;
  padding: 3px 0 3px 16px;
  position: relative;
}

.source-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.source-math {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--dark);
  line-height: 1.9;
  margin: 10px 0 14px;
  overflow-x: auto;
}

.source-refs {
  margin-top: 4px;
}

.source-refs li::before {
  background: var(--teal);
  width: 4px;
  height: 4px;
  top: 12px;
}

.source-refs li {
  font-size: 12px;
  color: var(--medium);
  line-height: 1.5;
  padding: 3px 0 3px 14px;
}

.source-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

@media (max-width: 640px) {
  .source-modal {
    max-height: 90vh;
    border-radius: 8px;
  }
  .source-body {
    padding: 24px 20px 28px;
  }
  .source-overlay {
    padding: 12px;
  }
}
