/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --accent:        #e9614c;
  --accent-dark:   #c94a36;
  --accent-light:  #fde8e5;
  --text:          #0f172a;
  --text-muted:    #475569;
  --bg:            #f8f9fa;
  --bg-card:       #ffffff;
  --radius:        14px;
  --shadow:        0 4px 16px rgba(15,23,42,0.08);

  /* backwards-compat aliases used by old reg/ctr/world pages */
  --bg-page:       #f8f9fa;
  --text-main:     #0f172a;
  --accent-blue:   #3b82f6;
  --accent-green:  #10b981;
  --accent-purple: #8b5cf6;
  --accent-indigo: #6366f1;
  --shadow-card:   0 4px 16px rgba(15,23,42,0.08);
  --radius-card:   14px;
  --font-sans: ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans",
               sans-serif;
}

/* ==========================================================================
   Reset / base
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

hr {
  display: none;
}

a {
  color: var(--accent-dark, #c94a36);
}

/* ==========================================================================
   Layout / container
   ========================================================================== */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Breadcrumb
   ========================================================================== */

.breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
  color: var(--text);
}

.breadcrumb span {
  color: #94a3b8;
}

/* ==========================================================================
   City hero (light, modern)
   ========================================================================== */

.city-hero {
  background: var(--bg-card);
  border-bottom: 1px solid #e2e8f0;
  padding: 3rem 0 2.5rem;
}

.city-hero .hero-city-name {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin: 0.5rem 0 0;
  letter-spacing: -0.02em;
}

.city-hero .hero-label-line {
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  font-weight: 400;
  color: var(--text-muted);
  margin: 0.25rem 0 1rem;
}

.city-hero .hero-label-line em {
  color: var(--accent);
  font-style: italic;
  font-weight: 600;
}

.city-hero .hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
}

.city-hero .hero-sndi-value {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.city-hero .hero-sndi-value b {
  color: var(--accent);
  font-weight: 700;
}

/* Label info button — superscript next to label in hero-label-line */
.label-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.28em;  /* relative to .hero-label-line */
  width: 1.8em;
  height: 1.8em;
  font-style: normal;
  font-weight: 700;
  font-family: serif;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  vertical-align: super;
  margin-left: 0.3em;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.label-info-btn:hover,
.label-info-btn:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}

/* Label info modal overlay */
.label-info-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.label-info-modal.is-open {
  display: flex;
}
.label-info-modal__box {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: calc(100% - 2rem);
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.label-info-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.85rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
}
.label-info-modal__close:hover {
  color: var(--text);
}
.label-info-modal__box h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--text);
}
.label-info-modal__box > p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}
.label-info-modal__box table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.label-info-modal__box th {
  text-align: left;
  padding: 0.35rem 0.65rem;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
}
.label-info-modal__box td {
  padding: 0.35rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}
.label-info-modal__box tr:last-child td {
  border-bottom: none;
}

/* Compact header for subpages — breadcrumbs only */
.city-hero--subpage {
  padding: 1.25rem 0;
  border-bottom: 1px solid #e2e8f0;
}

/* ==========================================================================
   Page content area (replaces .tab-panels)
   ========================================================================== */

.page-content {
  padding: 2.5rem 0 4rem;
}

.page-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #334155;
  margin: 0 0 1.25rem;
  text-align: center;
  padding-left: 0;
}

.page-content h2::before {
  display: none;
}

.page-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
}

.page-content p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.7;
}

/* ==========================================================================
   What is sprawl section (landing page)
   ========================================================================== */

.what-is-sprawl {
  margin-bottom: 2rem;
}

.what-is-sprawl p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Why it matters card (landing page)
   ========================================================================== */

.why-it-matters {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  margin-bottom: 2rem;
}

.why-it-matters h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.why-it-matters ul {
  color: var(--text-muted);
  padding-left: 1.5rem;
  margin: 0;
  line-height: 1.7;
}

.why-it-matters li {
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   Further reading (landing page)
   ========================================================================== */

.further-reading {
  margin-top: 3rem;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.article-card {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}

.article-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.article-journal {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* ==========================================================================
   Back button (subpages)
   ========================================================================== */

.back-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 0.2s, transform 0.2s;
}

.back-btn:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

/* ==========================================================================
   Metrics row
   ========================================================================== */

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metrics-row > div {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.metrics-row h3 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.metrics-row span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* comparison metrics (how-we-measure) */
.metrics-row--compare > div:last-child {
  border-left-color: var(--accent);
  background: var(--accent-light, #fde8e5);
}

.metrics-row--compare h3.accent-value {
  color: var(--accent);
}

/* ==========================================================================
   Callout cards
   ========================================================================== */

.callout {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  position: relative;
}

.callout h4 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.callout p {
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}

/* ==========================================================================
   Callout grid (4 callouts in trends)
   ========================================================================== */

.callout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.callout-grid .callout {
  margin-bottom: 0;
}

.callout-grid .callout:nth-child(1) { border-left-color: var(--accent); }
.callout-grid .callout:nth-child(2) { border-left-color: var(--accent); }
.callout-grid .callout:nth-child(3) { border-left-color: var(--accent); }
.callout-grid .callout:nth-child(4) { border-left-color: var(--accent); }

.callout-grid .callout:nth-child(2) h4 { color: var(--accent); }
.callout-grid .callout:nth-child(3) h4 { color: var(--accent); }
.callout-grid .callout:nth-child(4) h4 { color: var(--accent); }

/* ==========================================================================
   Navigation cards (landing page)
   ========================================================================== */

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.nav-card {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.nav-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}

.nav-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.nav-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Two-column nav cards (landing page explore section) */
.nav-cards--two-col {
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.nav-cards--two-col .nav-card {
  padding: 1.75rem 2rem;
}

/* Regions list section (country pages) */
.regions-list {
  margin-top: 3.5rem;
}

/* Cities list section (region pages) */
.cities-list {
  margin-top: 3rem;
}

/* ==========================================================================
   Ranking tables (comparisons subpage)
   ========================================================================== */

.ranking-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.ranking-table {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.ranking-table h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
}

.ranking-rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
  align-items: baseline;
}

.ranking-rows dt {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.ranking-rows dd {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  margin: 0;
}

p.ranking-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

@media (max-width: 600px) {
  .ranking-tables {
    grid-template-columns: 1fr;
  }

  .context-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Chart images
   ========================================================================== */

.chart-img {
  display: block;
  max-width: 100%;
  margin: 1.5rem auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Iframe container (by-neighborhood)
   ========================================================================== */

.iframe-container {
  width: 100%;
  height: 500px;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 1rem 0 1.5rem;
}

.map-link {
  display: inline-block;
  text-align: right;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  float: right;
  margin-bottom: 0.5rem;
}

.map-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.how-to-list {
  color: var(--text-muted);
  padding-left: 1.5rem;
}

.how-to-list li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* ==========================================================================
   Emphasis box (how-we-measure)
   ========================================================================== */

.emphasis-box {
  background: var(--accent-light, #fde8e5);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: var(--text);
}

.emphasis-box b {
  color: var(--accent);
  font-size: 1.3rem;
}

/* ==========================================================================
   Admin context block
   ========================================================================== */

.admin-context {
  margin-top: 1.5rem;
}

.admin-context ul {
  color: var(--text-muted);
  padding-left: 1.5rem;
}

.admin-context li {
  margin-bottom: 0.4rem;
}

/* Geographic context page — new layout helpers */

.intro-text {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 0 2rem;
}

.metrics-row--two-col {
  grid-template-columns: repeat(2, 1fr) !important;
}

.map-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2rem 0 0.25rem;
}

dl.admin-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0 2rem;
}

dl.admin-dl dt {
  font-weight: 600;
  color: var(--text);
}

dl.admin-dl dd {
  color: var(--text-muted);
  margin: 0;
}

.context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 1.5rem;
}

.context-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.context-box > h3 {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

.data-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.data-source-item {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.data-source-item h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.data-source-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ==========================================================================
   Context / chart description paragraph
   ========================================================================== */

.chart-desc,
.context-desc {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  box-shadow: var(--shadow);
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 1.5rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  max-width: 1100px;
  margin: 4rem auto 3rem;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 0.2s, transform 0.2s;
}

.footer-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

/* ==========================================================================
   Backwards-compatible styles for old reg/ctr/world pages
   ========================================================================== */

/* Old page structure: #page-title, #intro, #content */

#page-title {
  max-width: 1100px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
}

#page-title h1 {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1.25rem;
}

#page-title iframe {
  display: block;
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15,23,42,0.12);
  margin-top: 1.5rem;
  margin-bottom: 3rem;
}

#intro,
.city-overview-section {
  max-width: 1100px;
  margin: 0 auto 3rem;
  padding: 2rem 2.5rem;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

#intro h3,
.city-overview-section h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1rem;
}

#intro h3::before,
.city-overview-section h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  height: 1.2em;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
}

#intro p,
.city-overview-section p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

#intro ul {
  color: var(--text-muted);
  margin: 0.5rem 0 1rem 1.25rem;
}

#intro li {
  margin-bottom: 0.3rem;
}

#content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

#content section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.25rem;
  position: relative;
  padding-left: 1rem;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  height: 1.3em;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
}

section .metrics-row {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 2rem 0;
}

section .metrics-row > div {
  background: var(--bg-card) !important;
  border-radius: var(--radius);
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
}

section .metrics-row h3 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text);
}

section .metrics-row span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Callout cards in old page structure */
#content section .callout {
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

#content section .callout h4 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

#content section .callout p {
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}

/* Color variants for old callouts */
#content section .callout:nth-of-type(2) { border-left-color: var(--accent); }
#content section .callout:nth-of-type(3) { border-left-color: var(--accent); }
#content section .callout:nth-of-type(4) { border-left-color: var(--accent); }
#content section .callout:nth-of-type(2) h4 { color: var(--accent); }
#content section .callout:nth-of-type(3) h4 { color: var(--accent); }
#content section .callout:nth-of-type(4) h4 { color: var(--accent); }

/* Image blocks */
.image-block {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.accordion-image,
img.center {
  display: block;
  max-width: 100%;
  margin: 1.5rem auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Pill link lists */
#content section ul,
ul.list_multicols {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin-top: 1.25rem;
}

#content section ul li a,
ul.list_multicols li a {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15,23,42,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

#content section ul li a:hover,
ul.list_multicols li a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15,23,42,0.15);
}

/* Accordion (legacy, kept for reg pages) */
.accordion-toggle {
  all: unset;
  font-size: 1.3rem;
  font-weight: 500;
  cursor: default;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .callout-grid {
    grid-template-columns: 1fr;
  }

  .metrics-row,
  section .metrics-row {
    grid-template-columns: 1fr;
  }

  .nav-cards {
    grid-template-columns: 1fr 1fr;
  }

  #intro,
  .city-overview-section,
  #content section {
    padding: 1.5rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .nav-cards {
    grid-template-columns: 1fr;
  }
}
