/* ==========================================================================
   SG Sustainability Hub - design layer on top of vendored Bootstrap 5.3
   Tokens are defined once on :root and remapped for dark mode, so every
   component follows the theme without per-component overrides.
   ========================================================================== */

:root {
  /* Brand: a deep teal-green reads as environmental without the clip-art green. */
  --hub-primary: #0f6b5c;
  --hub-primary-strong: #0a5246;
  --hub-primary-soft: #e6f2ef;
  --hub-accent: #b8860b;
  --hub-ink: #16201f;
  --hub-body: #48534f;
  --hub-muted: #6f7b77;
  --hub-line: #dfe5e2;
  --hub-surface: #ffffff;
  --hub-surface-2: #f6f8f7;
  --hub-canvas: #f2f5f3;

  --scope-1: #b5502b;
  --scope-2: #2f6f9f;
  --scope-3: #6b5b95;
  --scope-other: #6f7b77;

  --hub-radius: 12px;
  --hub-shadow: 0 1px 2px rgba(16, 32, 28, .06), 0 8px 24px -12px rgba(16, 32, 28, .18);
  --hub-shadow-lift: 0 2px 4px rgba(16, 32, 28, .07), 0 16px 36px -14px rgba(16, 32, 28, .24);
}

[data-bs-theme="dark"] {
  --hub-primary: #4cc3a9;
  --hub-primary-strong: #6fd6bf;
  --hub-primary-soft: #14312c;
  --hub-accent: #e0b44a;
  --hub-ink: #eef4f2;
  --hub-body: #b7c4c0;
  --hub-muted: #8b9994;
  --hub-line: #2a3634;
  --hub-surface: #151d1c;
  --hub-surface-2: #1b2524;
  --hub-canvas: #0e1514;

  --scope-1: #e08a68;
  --scope-2: #79b2dd;
  --scope-3: #a99bd4;
  --scope-other: #8b9994;

  --hub-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --hub-shadow-lift: 0 2px 6px rgba(0, 0, 0, .45), 0 18px 40px -14px rgba(0, 0, 0, .7);
}

body {
  background: var(--hub-canvas);
  color: var(--hub-body);
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { color: var(--hub-ink); font-weight: 600; letter-spacing: -.011em; }
a { color: var(--hub-primary); text-underline-offset: 2px; }
a:hover { color: var(--hub-primary-strong); }

.skip-link {
  position: absolute; top: .5rem; left: .5rem; z-index: 2000;
  background: var(--hub-primary); color: #fff; padding: .5rem .9rem; border-radius: 8px;
}

/* --------------------------------------------------------- navigation --- */

.hub-nav {
  background: var(--hub-surface);
  border-bottom: 1px solid var(--hub-line);
  padding-block: .55rem;
  padding-top: calc(.55rem + env(safe-area-inset-top, 0px));
  backdrop-filter: saturate(160%) blur(8px);
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--hub-primary), var(--hub-primary-strong));
  color: #fff; font-size: 1.05rem; flex: 0 0 auto;
}
/* The leaf is drawn on its own gradient, so it must not pick up the tile's
   text colour the way the previous icon font did. */
.brand-mark img { display: block; width: 24px; height: 24px; }
.navbar-brand:hover .brand-mark { filter: brightness(1.06); }
.brand-name { font-weight: 700; color: var(--hub-ink); font-size: 1.02rem; letter-spacing: -.02em; }
.brand-sub { font-size: .68rem; color: var(--hub-muted); letter-spacing: .04em; text-transform: uppercase; margin-top: 3px; }
.navbar-brand:hover .brand-name { color: var(--hub-primary); }

.hub-nav .nav-link {
  color: var(--hub-body); font-size: .88rem; font-weight: 500;
  padding: .4rem .7rem; border-radius: 8px; white-space: nowrap;
}
.hub-nav .nav-link:hover { color: var(--hub-primary); background: var(--hub-primary-soft); }
.hub-nav .nav-link.active { color: var(--hub-primary); background: var(--hub-primary-soft); font-weight: 600; }
.navbar-toggler { border-color: var(--hub-line); color: var(--hub-body); }
.navbar-toggler:focus { box-shadow: 0 0 0 3px var(--hub-primary-soft); }

.btn-theme {
  border: 1px solid var(--hub-line); color: var(--hub-body);
  background: var(--hub-surface-2); border-radius: 8px; line-height: 1;
}
.btn-theme:hover { color: var(--hub-primary); border-color: var(--hub-primary); }

.offline-banner {
  background: #fff4e0; color: #7a4a05; border-bottom: 1px solid #f0d9ae;
  font-size: .85rem; padding: .55rem 0;
}
[data-bs-theme="dark"] .offline-banner { background: #2e2413; color: #e5c17a; border-bottom-color: #453519; }

/* -------------------------------------------------------------- hero --- */

.hero {
  background:
    radial-gradient(1100px 380px at 12% -10%, rgba(15, 107, 92, .13), transparent 62%),
    radial-gradient(760px 300px at 92% 0%, rgba(184, 134, 11, .10), transparent 58%),
    var(--hub-surface);
  border-bottom: 1px solid var(--hub-line);
  padding: 3.25rem 0 2.5rem;
}
[data-bs-theme="dark"] .hero {
  background:
    radial-gradient(1100px 380px at 12% -10%, rgba(76, 195, 169, .14), transparent 62%),
    radial-gradient(760px 300px at 92% 0%, rgba(224, 180, 74, .09), transparent 58%),
    var(--hub-surface);
}
.hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.7rem); font-weight: 700; letter-spacing: -.028em; }
.hero-lead { font-size: clamp(.98rem, 2vw, 1.1rem); color: var(--hub-body); max-width: 62ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--hub-primary); background: var(--hub-primary-soft);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: .9rem;
}

/* ------------------------------------------------------------- cards --- */

.hub-card {
  background: var(--hub-surface);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius);
  box-shadow: var(--hub-shadow);
  height: 100%;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.hub-card-link:hover { transform: translateY(-2px); box-shadow: var(--hub-shadow-lift); border-color: var(--hub-primary); }
.hub-card .card-body { padding: 1.15rem 1.25rem; }
.hub-card-title { font-size: 1rem; font-weight: 650; color: var(--hub-ink); margin-bottom: .35rem; }
.hub-card-text { font-size: .875rem; color: var(--hub-body); margin-bottom: 0; }

.section-head { margin-bottom: 1.15rem; }
.section-head h2 { font-size: 1.28rem; font-weight: 680; margin-bottom: .2rem; letter-spacing: -.018em; }
.section-head p { font-size: .875rem; color: var(--hub-muted); margin-bottom: 0; }

/* -------------------------------------------------------- stat tiles --- */

.stat-tile {
  background: var(--hub-surface); border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius); padding: 1.05rem 1.15rem; height: 100%;
}
.stat-value {
  font-size: 1.85rem; font-weight: 700; color: var(--hub-ink);
  line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: .74rem; color: var(--hub-muted); text-transform: uppercase; letter-spacing: .07em; margin-top: .3rem; }
.stat-note { font-size: .78rem; color: var(--hub-muted); margin-top: .45rem; }

/* ------------------------------------------------------- update list --- */

.update-item {
  background: var(--hub-surface); border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius); padding: 1rem 1.15rem; margin-bottom: .7rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.update-item:hover { border-color: var(--hub-primary); box-shadow: var(--hub-shadow); }
.update-title { font-size: .98rem; font-weight: 620; line-height: 1.38; margin-bottom: .3rem; }
.update-title a { color: var(--hub-ink); text-decoration: none; }
.update-title a:hover { color: var(--hub-primary); text-decoration: underline; }
.update-summary { font-size: .855rem; color: var(--hub-body); margin-bottom: .55rem; line-height: 1.5; }
.update-meta { font-size: .76rem; color: var(--hub-muted); display: flex; flex-wrap: wrap; gap: .3rem .75rem; align-items: center; }
.update-source { font-weight: 600; color: var(--hub-primary); }

/* ------------------------------------------------------------- chips --- */

.chip {
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .715rem; font-weight: 600; line-height: 1;
  padding: .3rem .55rem; border-radius: 999px;
  background: var(--hub-surface-2); color: var(--hub-body);
  border: 1px solid var(--hub-line); text-decoration: none; white-space: nowrap;
}
a.chip:hover { border-color: var(--hub-primary); color: var(--hub-primary); background: var(--hub-primary-soft); }
.chip-primary { background: var(--hub-primary-soft); color: var(--hub-primary); border-color: transparent; }
.chip-accent { background: rgba(184,134,11,.12); color: #8a6508; border-color: transparent; }
[data-bs-theme="dark"] .chip-accent { color: var(--hub-accent); background: rgba(224,180,74,.14); }
.chip-sg { background: rgba(200, 40, 40, .09); color: #b03030; border-color: transparent; }
[data-bs-theme="dark"] .chip-sg { color: #e88; background: rgba(230, 120, 120, .13); }

.scope-1 { color: #fff; background: var(--scope-1); border-color: transparent; }
.scope-2 { color: #fff; background: var(--scope-2); border-color: transparent; }
.scope-3 { color: #fff; background: var(--scope-3); border-color: transparent; }
.scope-other { color: #fff; background: var(--scope-other); border-color: transparent; }
[data-bs-theme="dark"] .scope-1,
[data-bs-theme="dark"] .scope-2,
[data-bs-theme="dark"] .scope-3,
[data-bs-theme="dark"] .scope-other { color: #0e1514; }

/* Factor provenance.
   Singapore-official sets read as calm and authoritative; the overseas
   fallback is deliberately warmer so a substituted factor is visible when
   skimming a result table rather than only on close reading. */
.chip.factor-dataset {
  font-size: .66rem; font-weight: 600; letter-spacing: .01em;
  background: var(--hub-surface-2); color: var(--hub-muted);
  border-color: var(--hub-line);
}
.chip.factor-dataset.nea,
.chip.factor-dataset.ema,
.chip.factor-dataset.pub,
.chip.factor-dataset.carbon-pricing-act {
  background: rgba(200, 40, 40, .09); color: #b03030; border-color: transparent;
}
[data-bs-theme="dark"] .chip.factor-dataset.nea,
[data-bs-theme="dark"] .chip.factor-dataset.ema,
[data-bs-theme="dark"] .chip.factor-dataset.pub,
[data-bs-theme="dark"] .chip.factor-dataset.carbon-pricing-act {
  color: #e88; background: rgba(230, 120, 120, .13);
}
.chip.factor-dataset.defra-desnz {
  background: rgba(184, 134, 11, .14); color: #8a6508; border-color: transparent;
}
[data-bs-theme="dark"] .chip.factor-dataset.defra-desnz {
  color: var(--hub-accent); background: rgba(224, 180, 74, .16);
}
.chip.factor-dataset.derived,
.chip.factor-dataset.company-reported {
  background: transparent; color: var(--hub-muted);
  border-style: dashed; border-color: var(--hub-line);
}

.factor-substitution {
  font-size: .72rem; line-height: 1.35; color: #8a6508;
}
[data-bs-theme="dark"] .factor-substitution { color: var(--hub-accent); }
.factor-substitution-flag { color: #8a6508; }
[data-bs-theme="dark"] .factor-substitution-flag { color: var(--hub-accent); }

/* ------------------------------------------------------------ tables --- */

.hub-table-wrap {
  background: var(--hub-surface); border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius); overflow: hidden;
}
.hub-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hub-table { margin-bottom: 0; font-size: .855rem; min-width: 780px; }
.hub-table thead th {
  background: var(--hub-surface-2); color: var(--hub-muted);
  font-size: .715rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--hub-line); padding: .7rem .85rem; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.hub-table tbody td { padding: .68rem .85rem; border-bottom: 1px solid var(--hub-line); vertical-align: top; color: var(--hub-body); }
.hub-table tbody tr:last-child td { border-bottom: 0; }
.hub-table tbody tr:hover { background: var(--hub-surface-2); }
.factor-value { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--hub-ink); white-space: nowrap; }
.factor-unit { font-size: .76rem; color: var(--hub-muted); white-space: nowrap; }
.factor-name { color: var(--hub-ink); font-weight: 560; }

/* ------------------------------------------------------------ prose --- */

.prose { color: var(--hub-body); font-size: .93rem; line-height: 1.68; }
.prose h2 { font-size: 1.14rem; margin: 1.7rem 0 .6rem; }
.prose h3 { font-size: 1rem; margin: 1.35rem 0 .45rem; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p { margin-bottom: .85rem; }
.prose ul, .prose ol { margin-bottom: .9rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .32rem; }
.prose code {
  background: var(--hub-surface-2); color: var(--hub-primary-strong);
  padding: .1rem .35rem; border-radius: 4px; font-size: .86em;
}
.prose table { width: 100%; font-size: .87rem; margin-bottom: 1rem; }
.prose table th, .prose table td { border: 1px solid var(--hub-line); padding: .45rem .6rem; }
.prose table th { background: var(--hub-surface-2); }
.prose blockquote {
  border-left: 3px solid var(--hub-primary); padding: .2rem 0 .2rem .9rem;
  color: var(--hub-muted); margin: 0 0 .9rem;
}

/* ----------------------------------------------------------- filters --- */

.filter-bar {
  background: var(--hub-surface); border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius); padding: 1rem 1.1rem; margin-bottom: 1.25rem;
}
.form-control, .form-select {
  border-color: var(--hub-line); background: var(--hub-surface); color: var(--hub-ink); font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--hub-primary); box-shadow: 0 0 0 3px var(--hub-primary-soft);
  background: var(--hub-surface); color: var(--hub-ink);
}
.form-label { font-size: .76rem; font-weight: 650; color: var(--hub-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }

.btn-hub {
  background: var(--hub-primary); border: 1px solid var(--hub-primary); color: #fff;
  font-size: .875rem; font-weight: 600; border-radius: 8px; padding: .44rem 1rem;
}
.btn-hub:hover { background: var(--hub-primary-strong); border-color: var(--hub-primary-strong); color: #fff; }
[data-bs-theme="dark"] .btn-hub, [data-bs-theme="dark"] .btn-hub:hover { color: #0e1514; }
.btn-hub-outline {
  background: transparent; border: 1px solid var(--hub-line); color: var(--hub-body);
  font-size: .875rem; font-weight: 600; border-radius: 8px; padding: .44rem 1rem;
}
.btn-hub-outline:hover { border-color: var(--hub-primary); color: var(--hub-primary); background: var(--hub-primary-soft); }

/* ------------------------------------------------------------ misc ----- */

.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; flex: 0 0 auto; }
.health-healthy { background: #2c9c6a; }
.health-degraded { background: #d69a29; }
.health-failing  { background: #c0453a; }
.health-pending  { background: var(--hub-muted); }
.health-disabled { background: var(--hub-line); }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding-left: 1.5rem; padding-bottom: 1rem; border-left: 2px solid var(--hub-line); margin-left: .35rem; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: .3rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--hub-primary);
}
.timeline-date { font-size: .74rem; font-weight: 700; color: var(--hub-primary); text-transform: uppercase; letter-spacing: .05em; }
.timeline-event { font-size: .875rem; color: var(--hub-body); }

.source-url {
  font-size: .78rem; color: var(--hub-muted); word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.citation { font-size: .78rem; color: var(--hub-muted); }
.citation a { color: var(--hub-primary); }

.empty-state { text-align: center; padding: 3.25rem 1rem; color: var(--hub-muted); }
.empty-state i { font-size: 2.4rem; opacity: .45; display: block; margin-bottom: .85rem; }

.anchor-list { position: sticky; top: 5.2rem; }
.anchor-list a {
  display: block; padding: .38rem .7rem; font-size: .83rem; color: var(--hub-body);
  border-left: 2px solid var(--hub-line); text-decoration: none;
}
.anchor-list a:hover, .anchor-list a.active { color: var(--hub-primary); border-left-color: var(--hub-primary); background: var(--hub-primary-soft); }

/* ---------------------------------------------------------- footer ----- */

.hub-footer {
  background: var(--hub-surface); border-top: 1px solid var(--hub-line);
  padding: 2.5rem 0 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
.footer-title { font-size: 1.02rem; font-weight: 700; margin-bottom: .55rem; }
.footer-heading { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--hub-muted); margin-bottom: .6rem; }
.footer-text { font-size: .85rem; color: var(--hub-muted); line-height: 1.6; }
/* Authorship sits level with the version, a touch firmer than the muted
   boilerplate around it so it reads as a credit rather than fine print. */
.footer-credit { color: var(--hub-body); font-weight: 600; letter-spacing: .01em; }
.footer-list { list-style: none; padding: 0; margin: 0; }
.footer-list li { margin-bottom: .32rem; }
.footer-list a { font-size: .85rem; color: var(--hub-body); text-decoration: none; }
.footer-list a:hover { color: var(--hub-primary); text-decoration: underline; }
.footer-rule { border-color: var(--hub-line); margin: 1.6rem 0 1rem; opacity: 1; }

/* ---------------------------------------------------------- responsive - */

@media (max-width: 991.98px) {
  .hub-nav .nav-link { padding: .55rem .35rem; }
  .anchor-list { position: static; }
}
@media (max-width: 575.98px) {
  .hero { padding: 2.25rem 0 1.75rem; }
  .stat-value { font-size: 1.5rem; }
  .hub-card .card-body { padding: 1rem; }
}

@media print {
  .hub-nav, .hub-footer, .filter-bar, .btn, .offline-banner { display: none !important; }
  body { background: #fff; }
  .hub-card, .update-item, .hub-table-wrap { box-shadow: none; border-color: #ccc; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------- guide nav accent --- */
.nav-guide {
  border: 1px solid var(--hub-primary);
  color: var(--hub-primary) !important;
  font-weight: 600 !important;
}
.nav-guide:hover, .nav-guide.active {
  background: var(--hub-primary) !important;
  color: #fff !important;
}
[data-bs-theme="dark"] .nav-guide:hover,
[data-bs-theme="dark"] .nav-guide.active { color: #0e1514 !important; }

/* Sidebar "on this page" nav inherits the anchor-list styling */
.anchor-list nav a { display: block; }
