:root {
  color-scheme: light dark;

  --background: light-dark(#fafafa, #0f1210);
  --foreground: light-dark(#1b1b19, #ecebe5);
  --card: light-dark(#ffffff, #171a17);
  --card-foreground: light-dark(#1b1b19, #ecebe5);

  --primary: light-dark(#9c4123, #e9a184);
  --primary-foreground: light-dark(#fff8f4, #2a120a);
  --secondary: light-dark(#f1f0ea, #1c211e);
  --secondary-foreground: light-dark(#2a2a26, #e5e4dc);
  --muted: light-dark(#f2f1eb, #171b18);
  --muted-foreground: light-dark(#6a6860, #a8a69e);
  --faint: light-dark(#f6f5f0, #141815);
  --accent: light-dark(#f4f3ed, #1b201d);

  --border: light-dark(#e5e3da, #2a302b);
  --input: light-dark(#dcd9cf, #3a423c);
  --ring: light-dark(#9c4123, #e9a184);

  --footer-bg: light-dark(#fafafa, #121613);
  --footer-fg: light-dark(#1b1b19, #ecebe5);
  --footer-muted: light-dark(#6a6860, #a8a69e);
  --footer-border: light-dark(#e0ded5, #2a302b);

  --radius-medium: 0.5rem;
  --radius-large: 1rem;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: var(--background);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 0 0 var(--radius-medium) 0;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

main.wrap {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  min-height: 66vh;
}

a {
  color: var(--primary);
}

a.button {
  color: var(--primary-foreground);
}

[hidden] {
  display: none !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-top: 3px solid var(--primary);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 84%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--foreground);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.brand-text span {
  color: var(--primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.site-nav a {
  position: relative;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  transition: color 0.12s ease;
}

.site-nav a:hover {
  color: var(--primary);
}

.site-nav a[aria-current="page"] {
  color: var(--foreground);
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.12rem;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}

.search-form {
  display: flex;
  flex: 1 1 260px;
  max-width: 420px;
  margin-left: auto;
  gap: 0.5rem;
}

.search-form input {
  flex: 1;
  min-width: 0;
}

/* Hero and page headings */
.hero {
  position: relative;
  margin: 1.5rem 0 2.75rem;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: min(660px, calc(100% - 260px));
}

.tag {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--primary);
  vertical-align: middle;
}

.hero h1 {
  margin: 0.9rem 0 0.8rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 60ch;
  font-size: 1.06rem;
  line-height: 1.58;
  color: var(--muted-foreground);
}

.hero-meta {
  margin-top: 1.1rem;
  color: var(--muted-foreground);
}

.hero-meta strong {
  color: var(--foreground);
}

.hero-mark {
  position: absolute;
  top: -10px;
  right: 0;
  width: 240px;
  height: 240px;
  color: var(--foreground);
  opacity: 0.16;
  pointer-events: none;
}

.muted {
  color: var(--muted-foreground);
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head .tag {
  margin-bottom: 0.7rem;
}

.page-head h1 {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

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

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Section heading */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--border);
}

.section-kicker {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-note {
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

/* District grid */
.district-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.district-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-height: 92px;
  padding: 1.1rem 2.7rem 1.1rem 1.15rem;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.02);
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.district-card::after {
  content: "→";
  position: absolute;
  right: 1.05rem;
  top: 50%;
  transform: translate(-4px, -50%);
  color: var(--primary);
  font-size: 1.15rem;
  opacity: 0.35;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.district-card:hover,
.district-card:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 10px 24px rgb(20 25 22 / 0.07);
  transform: translateY(-2px);
}

.district-card:hover::after,
.district-card:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.district-name {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.district-count {
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

/* District layout */
.district-layout {
  display: block;
}

.district-layout.layout-desktop {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.layout-desktop .ppc-list {
  position: sticky;
  top: 5.6rem;
}

.ppc-detail:empty {
  display: none;
}

.filter-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 600;
}

.ppc-list input {
  width: 100%;
  margin-bottom: 0.75rem;
}

.ppc-list-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ppc-item {
  position: relative;
  display: block;
  padding: 0.75rem 2.4rem 0.75rem 0.85rem;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ppc-item::after {
  content: "▾";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  font-size: 0.85rem;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ppc-item[aria-expanded="true"]::after {
  color: var(--primary);
  transform: translateY(-50%) rotate(180deg);
}

.layout-desktop .ppc-item {
  padding-right: 0.85rem;
}

.layout-desktop .ppc-item::after {
  display: none;
}

.ppc-item:hover {
  background-color: var(--faint);
  border-left-color: var(--muted-foreground);
}

.ppc-item.selected {
  background-color: var(--faint);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  border-left-color: var(--primary);
}

.ppc-item-name {
  display: block;
  font-weight: 650;
  line-height: 1.3;
}

.ppc-item-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

/* Detail panel */
.ppc-detail-card {
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding: 1.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.02);
}

.ppc-row .ppc-detail-card {
  margin-top: 0.5rem;
}

.ppc-figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 0.75rem;
  background: var(--faint);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ppc-figure::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  pointer-events: none;
}

.ppc-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ppc-info h2 {
  margin: 0.2rem 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--faint);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.facts dt {
  color: var(--muted-foreground);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

.description {
  line-height: 1.6;
}

.detail-links {
  margin: 1rem 0 0.5rem;
}

.source-line {
  margin: 0.5rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.78rem;
}

/* Search results */
.result-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.result-item {
  display: block;
  padding: 0.8rem 1rem;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  text-decoration: none;
}

.result-item:hover {
  background: var(--faint);
}

.result-name {
  display: block;
  font-weight: 650;
}

.result-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

.empty-filter,
.empty-state {
  padding: 1rem 0;
  color: var(--muted-foreground);
}

/* FAQ */
.faq {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 860px;
}

.faq details {
  padding: 0.15rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.faq details:hover {
  background-color: var(--faint);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.faq details[open] {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.faq summary {
  padding: 0.9rem 0;
  font-weight: 650;
  cursor: pointer;
}

.faq summary::marker {
  color: var(--primary);
}

.faq details[open] summary {
  color: var(--primary);
}

.faq details p {
  margin: 0 0 1rem;
  color: var(--muted-foreground);
  line-height: 1.65;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  background: var(--footer-bg);
  color: var(--footer-fg);
  border-top: 1px solid var(--footer-border);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 2.2rem;
  padding-bottom: 1.5rem;
}

.footer-brand {
  max-width: 360px;
}

.footer-logo {
  display: inline-block;
  color: var(--footer-fg);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.footer-logo span {
  color: var(--primary);
}

.footer-brand p {
  margin: 0.5rem 0 0;
  color: var(--footer-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.25rem;
}

.footer-nav a {
  color: var(--footer-fg);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 920px) {
  .hero-mark {
    display: none;
  }

  .hero-copy {
    max-width: none;
  }
}

@media (max-width: 820px) {
  .ppc-detail-card {
    grid-template-columns: 1fr;
  }

  .ppc-figure {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .header-inner {
    gap: 0.6rem;
  }

  .site-nav {
    margin-left: auto;
  }

  .search-form {
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }

  .footer-top {
    gap: 1.25rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
