/* PM2.5 Sources · Professional UI layer
 * Keeps the scientific content intact while aligning typography, navigation,
 * cards and page width with the shared public design system.
 */

body.pm25-page {
  --pm25-edge: 20px;
  --pm25-shell: min(calc(100vw - (var(--pm25-edge) * 2)), 1400px);
  --fH: var(--aqm-font, 'IBM Plex Sans Thai', system-ui, sans-serif);
  --fU: var(--fH);
  --fE: var(--fH);
  --fM: var(--fH);
  font-family: var(--fU);
  font-size: 14px;
  font-weight: 350;
  background:
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--gold) 6%, transparent), transparent 32rem),
    radial-gradient(circle at 92% 36%, color-mix(in srgb, var(--cyan) 4%, transparent), transparent 28rem),
    var(--sand);
}

body.pm25-page :is(button, input, select, textarea) {
  font-family: var(--fU);
}

body.pm25-page :is(.hv, .kpi .v, .bar-value, .mono, .sc-stat, .src-chip, .ref-year) {
  font-variant-numeric: tabular-nums;
}

/* One alignment rail for global nav, hero, module nav, content and footer. */
body.pm25-page .hero-inner,
body.pm25-page .pm25-module-nav-inner,
body.pm25-page .main,
body.pm25-page .aqm-footer-inner {
  width: var(--pm25-shell);
  max-width: none !important;
  margin-right: auto;
  margin-left: auto;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

body.pm25-page .hero {
  min-height: 520px;
  padding: clamp(54px, 6vw, 82px) 0 clamp(48px, 5vw, 70px) !important;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(147, 197, 253, .14);
  background:
    radial-gradient(circle at 11% 16%, rgba(59, 130, 246, .16), transparent 30rem),
    radial-gradient(circle at 88% 38%, rgba(34, 211, 238, .08), transparent 28rem),
    linear-gradient(135deg, #08111F 0%, #0C1930 54%, #102B48 100%);
}

body.pm25-page .hero::before {
  background:
    radial-gradient(circle at 82% 42%, transparent 0 19%, rgba(147, 197, 253, .07) 19.2% 19.5%, transparent 19.7% 27%, rgba(147, 197, 253, .05) 27.2% 27.45%, transparent 27.7%),
    linear-gradient(115deg, rgba(59, 130, 246, .07), transparent 48%);
}

body.pm25-page .hero-inner {
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  gap: clamp(34px, 5vw, 68px);
}

body.pm25-page .hero-copy {
  max-width: 760px;
}

body.pm25-page .hero h1 {
  font-size: clamp(36px, 4.2vw, 58px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -.035em;
}

body.pm25-page .hero .sub {
  max-width: 720px;
  font-size: 14px;
  line-height: 1.9;
}

body.pm25-page .hero-facts {
  padding: clamp(20px, 2.5vw, 28px);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(13, 27, 50, .84), rgba(20, 49, 82, .6)),
    radial-gradient(circle at top right, rgba(96, 165, 250, .22), transparent 52%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .035);
}

body.pm25-page .hero-stat {
  min-height: 105px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 13px;
}

body.pm25-page .hero-stat .hv {
  font-size: 30px;
  font-weight: 500;
}

body.pm25-page .hero .tag {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
}

.pm25-module-nav {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--ww) 91%, transparent);
  box-shadow: 0 9px 28px color-mix(in srgb, var(--ink) 5%, transparent);
  backdrop-filter: blur(18px) saturate(130%);
}

.pm25-module-nav-inner {
  min-height: 64px;
  padding: 8px 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  align-items: stretch;
  gap: 5px;
}

.pm25-module-nav a {
  min-width: 0;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--t4);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.pm25-module-nav a > span {
  color: color-mix(in srgb, var(--gold) 74%, var(--t4));
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .06em;
}

.pm25-module-nav a:hover,
.pm25-module-nav a:focus-visible,
.pm25-module-nav a.is-active {
  border-color: color-mix(in srgb, var(--gold) 28%, var(--border));
  background: color-mix(in srgb, var(--gold-bg) 62%, var(--ww));
  color: var(--ink2);
  transform: translateY(-1px);
  outline: none;
}

.pm25-module-nav a.is-active {
  box-shadow: inset 0 -2px 0 var(--gold);
}

body.pm25-page .main {
  position: relative;
  z-index: 1;
}

body.pm25-page :is(.pm25-brief, .sect[id]) {
  scroll-margin-top: 160px;
}

body.pm25-page .pm25-brief {
  margin: 30px 0 26px;
  border-radius: 18px;
  box-shadow: 0 14px 36px color-mix(in srgb, var(--ink) 5%, transparent);
}

body.pm25-page .pm25-brief-head {
  padding: 25px 27px;
}

body.pm25-page .pm25-brief h2 {
  max-width: 900px;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  letter-spacing: -.02em;
}

body.pm25-page .pm25-brief-nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding-inline: 12px;
  border-radius: 9px;
}

body.pm25-page .pm25-brief-grid,
body.pm25-page :is(.g2, .g3, .src-grid) {
  align-items: stretch;
}

body.pm25-page .pm25-brief-card {
  height: 100%;
  min-height: 172px;
  display: flex;
  flex-direction: column;
  border-radius: 13px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 3.5%, transparent);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

body.pm25-page .pm25-brief-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--gold) 26%, var(--border));
  box-shadow: var(--sh-md);
}

body.pm25-page .pm25-brief-card .d {
  margin-top: auto;
  padding-top: 9px;
}

body.pm25-page :is(.g2, .g3) > .card {
  height: 100%;
  margin-bottom: 0;
}

body.pm25-page .src-grid > .src-card {
  height: 100%;
}

body.pm25-page .sect {
  max-width: none !important;
  padding: 48px 0 40px;
}

body.pm25-page .sect:last-child {
  padding-bottom: 0;
}

body.pm25-page .sect-hdr {
  min-height: 86px;
  margin-bottom: 22px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(110deg, color-mix(in srgb, var(--gold-bg) 46%, transparent), transparent 48%),
    var(--ww);
  box-shadow: var(--sh-sm);
}

body.pm25-page .sect-hdr .badge {
  min-width: 70px;
  min-height: 30px;
  margin: 0;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

body.pm25-page .sect-hdr h2 {
  flex: 1 1 540px;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 500;
  letter-spacing: -.012em;
}

body.pm25-page .sect-hdr p {
  width: 100%;
  max-width: none;
  margin: 0 0 0 84px;
  line-height: 1.55;
}

body.pm25-page .card,
body.pm25-page .src-card,
body.pm25-page .sensor-card,
body.pm25-page .kpi,
body.pm25-page .proc-node {
  border-radius: 14px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 4%, transparent);
}

body.pm25-page .card-top {
  min-height: 72px;
  padding: 16px 19px;
}

body.pm25-page .card-body {
  padding: 20px;
}

body.pm25-page .evidence-panel {
  border-radius: 13px;
}

body.pm25-page .aqm-public-footer {
  margin-top: 24px;
}

/* Backward compatible with a cached legacy footer template. */
body.pm25-page .aqm-footer-inner > .aqm-footer-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  margin-top: 28px;
  padding: 20px 0;
  border-top: 1px solid var(--aqm-footer-line, rgba(140, 180, 230, .14));
  border-bottom: 1px solid var(--aqm-footer-line, rgba(140, 180, 230, .14));
}

body.pm25-page .aqm-footer-inner > .aqm-footer-links > a {
  min-height: 42px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(140, 180, 230, .12);
  border-radius: 9px;
  background: rgba(10, 24, 48, .46);
  color: var(--aqm-footer-muted, #8fa6c4);
  text-decoration: none;
}

body.pm25-page .aqm-footer-inner > .aqm-footer-links > a::after {
  content: '\2197';
  color: rgba(143, 166, 196, .5);
}

body.pm25-page .aqm-footer-inner > .aqm-footer-links > a[href$="pm25_sources.php"] {
  border-color: rgba(122, 183, 255, .24);
  background: rgba(122, 183, 255, .09);
  color: #dceeff;
}

@media (max-width: 1100px) {
  body.pm25-page .hero-inner {
    grid-template-columns: 1fr;
  }

  .pm25-module-nav-inner {
    grid-template-columns: repeat(9, minmax(118px, 1fr));
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pm25-module-nav-inner::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 760px) {
  body.pm25-page {
    --pm25-edge: 14px;
  }

  body.pm25-page .hero {
    min-height: 0;
    padding: 42px 0 38px !important;
  }

  body.pm25-page .hero h1 {
    font-size: clamp(30px, 9vw, 42px);
  }

  body.pm25-page .hero-facts {
    padding: 16px;
  }

  body.pm25-page .pm25-brief-head {
    padding: 18px;
  }

  body.pm25-page .sect {
    padding-top: 36px;
  }

  body.pm25-page .sect-hdr {
    align-items: flex-start;
    padding: 14px;
  }

  body.pm25-page .sect-hdr h2 {
    flex-basis: calc(100% - 86px);
  }

  body.pm25-page .sect-hdr p {
    margin-left: 0;
  }

  body.pm25-page .aqm-public-footer {
    margin-top: 18px;
  }

  body.pm25-page .aqm-footer-inner > .aqm-footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
    padding: 16px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.pm25-page *,
  body.pm25-page *::before,
  body.pm25-page *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

@media print {
  .pm25-module-nav {
    display: none !important;
  }
}
