/* Shared theme for the public pages (map, station report, air-quality report).
   The theme is set before first paint by theme.js (saved choice, else the device setting). */
/* Public map, layout 2: dark control-room look with a PM2.5 heat surface.
   The original layout stays in map.css and is served at "/"; this file is only used by "/index2". */
:root {
  color-scheme: dark;
  --bg: #09181f;
  --panel: #0f242d;
  --panel-2: #143039;
  --ink: #e9f4f6;
  --ink-2: #a2bdc4;
  --line: #25434d;
  --line-soft: #1b3640;
  --line-strong: #4a7885;
  --hover: #1b4350;
  --accent: #5fd0e6;
  --focus: #7ee3f5;
  --danger: #ff9a8f;
  --rail: #0f242df2;
  --halo: #07141a;
  --ring-bg: #07141a66;
  --label: #cfe9ee;
  --card: #12303a;
  --field: #09181f;
  --placeholder: #8aa4ac;
  --btn: #1d5568;
  --btn-ink: #ffffff;
  --btn-hover: #27708a;
  --link: #7ee3f5;
  --scroll: #3b5d68;
  --accent-soft: #5fd0e644;
  --shadow: #0008;
  --rank-bg: #e9f4f6;
  --rank-ink: #07141a;
  --map-bg: radial-gradient(circle at 50% 40%, #10303a, #07141a 75%);
  --ff: "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  font-family: var(--ff);
  color: var(--ink);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f4;
  --panel: #ffffff;
  --panel-2: #e7f1f3;
  --ink: #13252b;
  --ink-2: #4a636b;
  --line: #cbdadf;
  --line-soft: #e1eaec;
  --line-strong: #7fa3ad;
  --hover: #d6e8ec;
  --accent: #006f87;
  --focus: #007f99;
  --danger: #b42318;
  --rail: #fffffff2;
  --halo: #ffffff;
  --ring-bg: #ffffffaa;
  --label: #0b3d4c;
  --card: #ffffff;
  --field: #ffffff;
  --placeholder: #5d757c;
  --btn: #073b4c;
  --btn-ink: #ffffff;
  --btn-hover: #0b566d;
  --link: #5b21b6;
  --scroll: #9fb6bc;
  --accent-soft: #23b5d330;
  --shadow: #052b3840;
  --rank-bg: #073b4c;
  --rank-ink: #ffffff;
  --map-bg: #dfe8ea;
}

/* Table headers and the shared top bar */
:root {
  --head-bg: #1b4350;
  --head-ink: #e9f4f6;
}
:root[data-theme="light"] {
  --head-bg: #17324d;
  --head-ink: #ffffff;
}
.site-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
  background: var(--panel);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.site-bar .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}
.site-bar .brand img {
  flex: 0 0 auto;
  object-fit: contain;
}
.site-bar .brand p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-2);
}
.site-bar .site-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}
.site-bar .actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.site-bar .back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.site-bar .back-link:hover,
.site-bar .back-link:focus-visible {
  background: var(--ink);
  color: var(--bg);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--panel-2);
}
.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
@media (max-width: 767px) {
  .site-bar {
    padding-inline: 0.75rem;
    gap: 0.5rem;
  }
  .site-bar .brand img {
    width: 34px;
    height: 34px;
  }
  .site-bar .site-title {
    font-size: 0.88rem;
  }
  .site-bar .back-link {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
}

/* Dialog (health advice) follows the page theme; the band-coloured header is unchanged. */
html .advice-dialog {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 50px #000a;
}
html .advice-status,
html .advice-level-now,
html .advice-footer {
  color: var(--ink-2);
}
html .advice-level {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
html .advice-level[aria-pressed="true"] {
  background: var(--panel-2);
  border-color: var(--ink);
}
html .advice-group {
  background: var(--panel-2);
  border-top-color: var(--line);
  border-right-color: var(--line);
  border-bottom-color: var(--line);
}
html .advice-footer {
  border-top-color: var(--line);
}
html .advice-definitions summary,
html .advice-source a {
  color: var(--ink);
}

/* Switch between the public report pages */
.report-tabs {
  display: flex;
  gap: 0.4rem;
  width: min(1240px, calc(100% - 2rem));
  margin: 0.8rem auto 0;
}
.report-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}
.report-tabs a[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
