/* The dashboard header stays in the document flow so this compact bar is the
   only persistent page-level navigation. */
:root {
  --section-navigation-height: 3.15rem;
}

.dashboard-theme:has(.section-navigation) .site-header {
  position: relative;
}

.section-navigation {
  --section-navigation-min-height: 3.75rem;
  position: sticky;
  z-index: 18;
  top: 0;
  min-height: var(--section-navigation-min-height);
  border-block: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 4px 16px rgb(20 55 37 / 8%);
  backdrop-filter: blur(.8rem);
}

.section-navigation-inner {
  display: flex;
  align-items: center;
  width: min(100% - 2rem, 60rem);
  min-height: var(--section-navigation-min-height);
  margin-inline: auto;
}

.section-navigation-primary {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
  min-width: 0;
}

.section-navigation-link {
  position: relative;
  display: inline-flex;
  min-width: 0;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem .75rem .65rem;
  border: 0;
  border-radius: .6rem;
  color: var(--muted);
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

.section-navigation-primary .section-navigation-link {
  flex: 0 1 auto;
}

.section-navigation-link::after {
  position: absolute;
  right: .7rem;
  bottom: .25rem;
  left: .7rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  content: '';
  opacity: 0;
  transform: scaleX(.45);
  transition: opacity .15s ease, transform .15s ease;
}

.section-navigation-link:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--text);
}

.section-navigation-link[aria-current="location"] {
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent-strong);
}

.section-navigation-link[aria-current="location"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.section-navigation-link:focus-visible {
  z-index: 1;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.section-navigation-link > svg,
.section-navigation-icon {
  display: inline-grid;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 1.05rem;
  place-items: center;
  color: currentColor;
}

.section-navigation-link > svg,
.section-navigation-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.section-navigation-label-short {
  display: none;
}

/* Keep native deep links clear of the persistent bar. */
#overview,
#weather-chart,
#radar,
#forecast,
#air-quality-section {
  scroll-margin-top: calc(var(--section-navigation-height, 3.15rem) + .75rem);
}

@media (max-width: 42rem) {
  .section-navigation { --section-navigation-min-height: 4rem; }
  .section-navigation-inner { width:calc(100% - .5rem); padding-block:.25rem; }
  .section-navigation-primary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.125rem; align-items:stretch; }
  .section-navigation-primary .section-navigation-link {
    min-width:0; min-height:3.5rem; flex-direction:column; gap:.25rem;
    padding:.35rem .1rem .5rem; border-radius:.5rem;
    font-size:.875rem; font-weight:600; letter-spacing:-.025em;
    line-height:1.1; white-space:nowrap;
  }
  .section-navigation-link > svg { display:block; width:1.125rem; height:1.125rem; flex:0 0 1.125rem; }
  .section-navigation-link::after { left:25%; right:25%; bottom:.15rem; }
  .section-navigation-label-full { display:none; }
  .section-navigation-label-short { display:inline; }
}

@media (prefers-reduced-motion: reduce) {
  .section-navigation-link,
  .section-navigation-link::after {
    transition: none;
  }
}

:root[data-theme="dark"] .section-navigation {
  box-shadow: 0 5px 18px rgb(0 0 0 / 24%);
}

/* History disclosure follows the existing card treatment. */
.air-quality-disclosure { min-width:0; border:1px solid var(--border); border-radius:4px; background:var(--surface); }
.briefing-grid > .air-quality-disclosure { grid-column:1/-1; }
.air-quality-disclosure > summary { display:flex; align-items:center; gap:.75rem; min-height:3.25rem; padding:.7rem 1rem; color:var(--ink); cursor:pointer; list-style:none; }
.air-quality-disclosure > summary::-webkit-details-marker { display:none; }
.air-quality-disclosure > summary:hover { background:var(--soft); }
.air-quality-disclosure-title { display:inline-flex; align-items:center; gap:.5rem; font-weight:650; }
.air-quality-disclosure-title svg { width:1.1rem; height:1.1rem; flex:none; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; }
.air-quality-disclosure-chevron { width:.5rem; height:.5rem; flex:none; margin-left:auto; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); transition:transform .15s ease; }
.air-quality-disclosure[open] .air-quality-disclosure-chevron { transform:rotate(225deg); }
.air-quality-disclosure[open] > summary { border-bottom:1px solid var(--border); }
.air-quality-disclosure-content { min-width:0; padding:.8rem 1rem; }
.air-quality-disclosure-content .air-history { margin:0; padding:0; border:0; box-shadow:none; }
.air-quality-disclosure-status { color:var(--muted); font-size:.875rem; }
@media(max-width:759px) {
  .dashboard-theme .briefing-grid { grid-template-areas:"left" "right" "air" "data"; }
  .briefing-grid > .air-quality-disclosure { grid-area:air; }
}
@media(max-width:36rem) {
  .air-quality-disclosure > summary { flex-wrap:nowrap; gap:.5rem; padding:.8rem; }
  .air-quality-disclosure-content { padding:.75rem; }
}
@media(prefers-reduced-motion:reduce) { .air-quality-disclosure-chevron { transition:none; } }

/* A consistent section boundary replaces repeated introductory labels. */
.dashboard-theme #weather-chart,
.dashboard-theme #radar,
.dashboard-theme #forecast {
  position:relative;
  padding-top:2rem;
  border-top:0;
}
.dashboard-theme #weather-chart::before,
.dashboard-theme #radar::before,
.dashboard-theme #forecast::before {
  position:absolute; top:0; left:0;
  width:100%; height:1px;
  background:linear-gradient(90deg,
    color-mix(in srgb,var(--accent) 48%,var(--border)),
    color-mix(in srgb,var(--accent) 12%,var(--border)) 35%,
    color-mix(in srgb,var(--border) 65%,transparent) 78%,
    transparent);
  content:""; pointer-events:none;
}
.dashboard-theme #weather-chart { margin-top:2.5rem; }
.dashboard-theme .page-shell > .forecast-section { margin-top:2.5rem; gap:2.5rem; }
.air-quality-disclosure > summary { background:var(--soft); }
@media(max-width:42rem) {
  .dashboard-theme #weather-chart,
  .dashboard-theme #radar,
  .dashboard-theme #forecast { padding-top:1.5rem; }
  .dashboard-theme #weather-chart { margin-top:1.75rem; }
  .dashboard-theme .page-shell > .forecast-section { margin-top:1.75rem; gap:1.75rem; }
}

/* Light section titles with room above and below, without altering card labels. */
.dashboard-theme #chart-heading,
.dashboard-theme #radar-heading,
.dashboard-theme #forecast-heading {
  font-size:clamp(1.25rem,2.2vw,1.8rem);
  font-weight:400;
  letter-spacing:-.02em;
  line-height:1.3;
  white-space:normal;
  max-width:none;
}
.dashboard-theme #weather-chart > .weather-chart-heading,
.dashboard-theme #radar > .radar-heading,
.dashboard-theme #forecast > .forecast-heading { margin-bottom:1.5rem; }
@media(max-width:42rem) {
  .dashboard-theme #weather-chart > .weather-chart-heading,
  .dashboard-theme #radar > .radar-heading,
  .dashboard-theme #forecast > .forecast-heading { margin-bottom:1.125rem; }
}
