/* ==========================================================================
   CVC Diagram System — native infographic panels replacing PDF screenshots
   Uses brand tokens from style.css (loaded after it).
   ========================================================================== */

.dg {
  background: #fff;
  padding: clamp(22px, 3vw, 36px);
  font-family: var(--font-body, 'Inter', sans-serif);
  color: var(--text, #0E1A12);
}
.dg--cream { background: var(--cream, #F6F4EC); }
.dg--dark { background: linear-gradient(160deg, #1F3D2C 0%, #16301F 100%); color: #F6F4EC; }

/* --- small heading + kicker inside a diagram --- */
.dg-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent, #5A9168); margin-bottom: 14px;
}
.dg-kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent, #5A9168); }
.dg--dark .dg-kicker { color: var(--accent-bright, #7FB988); }
.dg--dark .dg-kicker::before { background: var(--accent-bright, #7FB988); }

.dg-heading {
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: clamp(18px, 2vw, 24px); font-weight: 600; line-height: 1.25;
  letter-spacing: -0.01em; margin: 0 0 8px;
}
.dg-sub { font-size: 14px; line-height: 1.6; color: var(--text-muted, #5C6660); max-width: 720px; margin: 0 0 22px; }
.dg--dark .dg-sub { color: rgba(246, 244, 236, 0.72); }

/* --- stat row --- */
.dg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.dg-stat {
  background: var(--cream, #F6F4EC); border: 1px solid var(--border, #E5E3DB);
  border-radius: 14px; padding: 18px 16px;
}
.dg--cream .dg-stat, .dg-stat--onwhite { background: #fff; }
.dg-stat__num {
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: clamp(26px, 3vw, 38px); font-weight: 700; letter-spacing: -0.02em;
  color: var(--primary, #1F3D2C); line-height: 1;
}
.dg-stat__num small { font-size: 0.45em; font-weight: 600; color: var(--accent, #5A9168); margin-left: 3px; letter-spacing: 0; }
.dg-stat__label { font-family: var(--font-display, 'Instrument Sans', sans-serif); font-size: 13px; font-weight: 600; margin-top: 8px; line-height: 1.4; }
.dg-stat__note { font-size: 11.5px; color: var(--text-soft, #8A9189); margin-top: 4px; line-height: 1.45; }
.dg--dark .dg-stat { background: rgba(246, 244, 236, 0.06); border-color: rgba(246, 244, 236, 0.14); }
.dg--dark .dg-stat__num { color: #F6F4EC; }
.dg--dark .dg-stat__num small { color: var(--accent-bright, #7FB988); }
.dg--dark .dg-stat__note { color: rgba(246, 244, 236, 0.55); }

/* --- generic node (flow diagrams) --- */
.dg-node {
  border-radius: 12px; padding: 12px 14px;
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  border: 1px solid var(--border, #E5E3DB); background: #fff; color: var(--text, #0E1A12);
}
.dg-node small { display: block; font-family: var(--font-body, 'Inter', sans-serif); font-weight: 400; font-size: 11.5px; color: var(--text-muted, #5C6660); margin-top: 4px; line-height: 1.45; }
.dg-node--green { background: var(--primary, #1F3D2C); border-color: var(--primary, #1F3D2C); color: #fff; }
.dg-node--green small { color: rgba(255, 255, 255, 0.75); }
.dg-node--accent { background: var(--accent, #5A9168); border-color: var(--accent, #5A9168); color: #fff; }
.dg-node--accent small { color: rgba(255, 255, 255, 0.8); }
.dg-node--soft { background: #EAF2EB; border-color: #D3E2D5; color: var(--primary, #1F3D2C); }
.dg-node--gold { background: #F7EFDF; border-color: #E8D9BC; color: #6B5426; }
.dg-node--sky { background: #E8F1F4; border-color: #CBDFE6; color: #2C5967; }
.dg-node--fossil { background: #EFEEEA; border-color: #DDDBD3; color: #5C6660; }

/* --- chain / flow rows --- */
.dg-chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.dg-chain .dg-node { flex: 1 1 120px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.dg-chain__arrow {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  color: var(--accent, #5A9168); font-weight: 700;
}
.dg-chain__arrow svg { width: 18px; height: 18px; }
.dg-chain--fossil .dg-chain__arrow { color: #9AA19B; }

.dg-lane { margin-bottom: 18px; }
.dg-lane:last-child { margin-bottom: 0; }
.dg-lane__title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 10px; color: var(--primary, #1F3D2C);
}
.dg-lane__title::after { content: ""; flex: 1; height: 1px; background: var(--border, #E5E3DB); }
.dg-lane__title--fossil { color: #7C837D; }
.dg-lane__title .dg-lane__badge {
  font-size: 10px; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.08em;
  background: var(--accent, #5A9168); color: #fff;
}
.dg-lane__title--fossil .dg-lane__badge { background: #8A9189; }

/* --- icon tile grid (missions, segments, org cards) --- */
.dg-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.dg-tiles--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.dg-tile {
  background: var(--cream, #F6F4EC); border: 1px solid var(--border, #E5E3DB);
  border-radius: 14px; padding: 16px 16px 18px; position: relative;
}
.dg--cream .dg-tile { background: #fff; }
.dg-tile__icon {
  width: 40px; height: 40px; border-radius: 11px; background: var(--primary, #1F3D2C);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.dg-tile__icon svg { width: 20px; height: 20px; stroke: #fff; }
.dg-tile__icon--accent { background: var(--accent, #5A9168); }
.dg-tile__icon--gold { background: var(--gold, #C5A572); }
.dg-tile__icon--sky { background: var(--sky, #4A90A4); }
.dg-tile h4 { font-family: var(--font-display, 'Instrument Sans', sans-serif); font-size: 14.5px; font-weight: 600; margin: 0 0 6px; line-height: 1.35; }
.dg-tile p { font-size: 12.5px; line-height: 1.55; color: var(--text-muted, #5C6660); margin: 0; }
.dg-tile__tag {
  display: inline-block; font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent, #5A9168); margin-bottom: 8px;
}

/* --- checklist --- */
.dg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dg-list li { position: relative; padding-left: 28px; font-size: 13.5px; line-height: 1.6; color: var(--text, #0E1A12); }
.dg-list li strong { font-weight: 600; }
.dg-list li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--accent, #5A9168);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dg--dark .dg-list li { color: rgba(246, 244, 236, 0.88); }
.dg--dark .dg-list li::before { background: var(--accent-bright, #7FB988); }

/* --- data table --- */
.dg-table-wrap { overflow-x: auto; border: 1px solid var(--border, #E5E3DB); border-radius: 14px; background: #fff; }
.dg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
.dg-table th {
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  text-align: left; color: #fff; background: var(--primary, #1F3D2C); padding: 12px 14px; white-space: nowrap;
}
.dg-table td { padding: 11px 14px; border-top: 1px solid var(--border, #E5E3DB); color: var(--text, #0E1A12); line-height: 1.45; vertical-align: top; }
.dg-table tbody tr:nth-child(even) td { background: #FAF9F4; }
.dg-table td.num { font-family: var(--font-display, 'Instrument Sans', sans-serif); font-weight: 600; white-space: nowrap; }
.dg-table .ref { color: var(--text-muted, #5C6660); font-size: 11.5px; }
.dg-table__foot { padding: 13px 16px; font-size: 12.5px; line-height: 1.55; color: var(--text-muted, #5C6660); background: var(--cream, #F6F4EC); border-top: 1px solid var(--border, #E5E3DB); }
.dg-table__foot strong { color: var(--primary, #1F3D2C); }

/* --- comparison table (CryoSafe) --- */
.dg-table--compare td:nth-child(2) { background: #EAF2EB; font-weight: 600; }
.dg-table--compare tbody tr:nth-child(even) td:nth-child(2) { background: #E2EDE4; }
.dg-table--compare th:nth-child(2) { background: var(--accent, #5A9168); }

/* --- quote / callout band --- */
.dg-band {
  border-left: 3px solid var(--accent, #5A9168); background: var(--cream, #F6F4EC);
  border-radius: 0 12px 12px 0; padding: 14px 18px; font-size: 13px; line-height: 1.6;
  color: var(--text, #0E1A12); margin-top: 18px;
}
.dg--cream .dg-band { background: #fff; }
.dg-band strong { color: var(--primary, #1F3D2C); }

/* --- vertical process (org charts) --- */
.dg-org { display: grid; gap: 0; justify-items: center; }
.dg-org__row { display: grid; gap: 12px; width: 100%; }
.dg-org__row--2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dg-org__row--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.dg-org__connector { width: 2px; height: 22px; background: var(--border-dark, #B9C4BB); opacity: 0.55; margin: 0 auto; }
.dg-org__root {
  background: var(--primary, #1F3D2C); color: #fff; border-radius: 14px; padding: 16px 26px;
  font-family: var(--font-display, 'Instrument Sans', sans-serif); font-weight: 600; font-size: 15px;
  text-align: center; letter-spacing: 0.01em;
}
.dg-org__root small { display: block; font-family: var(--font-body, 'Inter', sans-serif); font-weight: 400; font-size: 11.5px; color: rgba(255,255,255,0.7); margin-top: 3px; }
.dg-org-card { background: #fff; border: 1px solid var(--border, #E5E3DB); border-radius: 14px; overflow: hidden; }
.dg--cream .dg-org-card { background: #fff; }
.dg-org-card__head {
  background: #EAF2EB; color: var(--primary, #1F3D2C); padding: 10px 14px;
  font-family: var(--font-display, 'Instrument Sans', sans-serif); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.dg-org-card__head--gold { background: #F7EFDF; color: #6B5426; }
.dg-org-card__head--sky { background: #E8F1F4; color: #2C5967; }
.dg-org-card__body { padding: 13px 14px; font-size: 12.5px; line-height: 1.55; color: var(--text-muted, #5C6660); }
.dg-org-card__body strong { color: var(--text, #0E1A12); font-weight: 600; }
.dg-org-card__body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.dg-org-card__body li { position: relative; padding-left: 15px; }
.dg-org-card__body li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent, #5A9168); }

/* --- SVG charts --- */
.dg-chart { width: 100%; }
.dg-chart svg { width: 100%; height: auto; display: block; }
.dg-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; }
.dg-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted, #5C6660); }
.dg-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* --- pill strip (feedstocks etc.) --- */
.dg-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-pill {
  font-family: var(--font-display, 'Instrument Sans', sans-serif);
  font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  background: #EAF2EB; color: var(--primary, #1F3D2C); border: 1px solid #D3E2D5;
}
.dg-pill--gold { background: #F7EFDF; color: #6B5426; border-color: #E8D9BC; }
.dg-pill--sky { background: #E8F1F4; color: #2C5967; border-color: #CBDFE6; }

/* --- two/three column split inside a panel --- */
.dg-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.dg-split > div { min-width: 0; }
.dg-panel-box { background: var(--cream, #F6F4EC); border: 1px solid var(--border, #E5E3DB); border-radius: 14px; padding: 18px; }
.dg--cream .dg-panel-box { background: #fff; }
.dg-panel-box h5 {
  font-family: var(--font-display, 'Instrument Sans', sans-serif); font-size: 13px; font-weight: 700;
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px; color: var(--primary, #1F3D2C);
}
.dg-panel-box h5 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #5A9168); flex: 0 0 auto; }
.dg-panel-box h5 .dot--gold { background: var(--gold, #C5A572); }
.dg-panel-box h5 .dot--sky { background: var(--sky, #4A90A4); }
.dg-panel-box h5 .dot--fossil { background: #9AA19B; }

/* --- big center product/output emphasis --- */
.dg-outputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.dg-output {
  text-align: center; border-radius: 12px; padding: 14px 10px;
  background: #EAF2EB; border: 1px solid #D3E2D5;
}
.dg-output--gold { background: #F7EFDF; border-color: #E8D9BC; }
.dg-output strong { display: block; font-family: var(--font-display, 'Instrument Sans', sans-serif); font-size: 13.5px; font-weight: 700; color: var(--primary, #1F3D2C); }
.dg-output--gold strong { color: #6B5426; }
.dg-output small { font-size: 11px; color: var(--text-muted, #5C6660); line-height: 1.4; display: block; margin-top: 3px; }

@media (max-width: 640px) {
  .dg { padding: 18px; }
  .dg-chain { flex-direction: column; }
  .dg-chain__arrow { transform: rotate(90deg); padding: 2px 0; }
  .dg-table { min-width: 480px; }
}

/* --- prevent equal-height stretching: cards size to their own content --- */
.slide-grid { align-items: start; }
/* stacked card header: label on line 1, subtitle on line 2 */
.img-card__header--stack strong {
  display: block;
  white-space: nowrap;
  margin: 0 0 3px;
}
.img-card__header--stack .img-card__header-sub {
  display: block;
  color: #F6F4EC;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* --- 3-across segment/tech card rows: equal columns, aligned captions --- */
.img-grid--3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 1120px) { .img-grid--3 { grid-template-columns: 1fr; } }
.img-grid--3 .img-card { display: flex; flex-direction: column; }
.img-grid--3 .img-card .dg { flex: 1 1 auto; min-height: 0 !important; }
.img-grid--3 .img-card figcaption { margin-top: auto; }

/* --- 2-across CCUS card row: same alignment rules as 3-across --- */
.img-grid--2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: stretch;
}
@media (max-width: 1120px) { .img-grid--2 { grid-template-columns: 1fr; } }
.img-grid--2 .img-card { display: flex; flex-direction: column; }
.img-grid--2 .img-card .dg { flex: 1 1 auto; min-height: 0 !important; }
.img-grid--2 .img-card figcaption { margin-top: auto; }

/* --- photo-based segment cards --- */
.img-grid--3 .img-card .img-card__wrap { flex: 1 1 auto; aspect-ratio: auto; align-items: flex-start; cursor: zoom-in; }
.img-grid--3 .img-card .img-card__wrap img { width: 100%; height: auto; }

/* --- single wide card row --- */
.img-grid--1 { display: grid; grid-template-columns: 1fr; }
.img-grid--1 .img-card { display: flex; flex-direction: column; }
.img-grid--1 .img-card .img-card__wrap { flex: 1 1 auto; aspect-ratio: auto; align-items: flex-start; cursor: zoom-in; }
.img-grid--1 .img-card .img-card__wrap img { width: 100%; height: auto; }

/* --- 2-across cards with photos: same wrap behavior as 3-across --- */
.img-grid--2 .img-card .img-card__wrap { flex: 1 1 auto; aspect-ratio: auto; align-items: flex-start; cursor: zoom-in; }
.img-grid--2 .img-card .img-card__wrap img { width: 100%; height: auto; }

/* --- tighter vertical rhythm: sections were up to 120px padded top+bottom --- */
:root { --section-pad: clamp(48px, 5.5vw, 80px); }
.section-head { margin-bottom: clamp(28px, 4vw, 44px); }
.dg-stats--onwhite .dg-stat, .dg-stats--onwhite .dg-stat { background: #fff; }
#opportunity .dg-tile { background: #fff; }

/* --- larger, more legible tile typography --- */
.dg-tile h4 { font-size: 17.5px; }
.dg-tile p { font-size: 14px; }
.dg-tile__tag { font-size: 12px; }
.dg-pill { font-size: 13.5px; }
.dg-stat__label { font-size: 14.5px; }
.dg-stat__note { font-size: 12.5px; }
.dg-list li { font-size: 14.5px; }

/* ==========================================================================
   MOBILE FIXES — inline grid-template-columns (minmax 220-480px) force
   columns wider than the viewport on phones, causing horizontal overflow.
   Force single column and let content wrap.
   ========================================================================== */
@media (max-width: 720px) {
  .dg-tiles,
  .dg-stats,
  .dg-split,
  .img-grid--2,
  .img-grid--3,
  .dg-org__row,
  .dg-outputs {
    grid-template-columns: 1fr !important;
  }
  /* Green Economy section: diagram first (full width), then the 3 points */
  #green-economy .dg-split > div:first-child,
  #green-economy-about .dg-split > div:first-child {
    max-width: 320px !important;
    margin: 0 auto 8px !important;
  }
  /* never let a card or its contents exceed the screen */
  .dg-tile, .dg-stat, .dg-panel-box, .img-card, .dg-node, .dg-output { min-width: 0; max-width: 100%; }
  .dg-tile h4, .dg-tile p, .dg-panel-box p, .dg-node small { overflow-wrap: anywhere; }
  .dg-pill { max-width: 100%; overflow-wrap: anywhere; }
  .dg { padding: 16px; }
  /* tables stay scrollable rather than stretching the page */
  .dg-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* stacked card headers wrap instead of forcing width */
  .img-card__header--stack strong { white-space: normal; }
}
@media (max-width: 480px) {
  .dg-tiles, .dg-stats, .dg-split { gap: 12px !important; }
  .dg-tile h4 { font-size: 16px; }
}
