:root {
  --pine: #143528;
  --pine-deep: #0c2419;
  --mist: #d9e4dc;
  --fog: #eef3ef;
  --paper: #f7f5f0;
  --ink: #1a1f1c;
  --ink-soft: #4a554e;
  --copper: #c46b2a;
  --copper-deep: #9a5018;
  --allowed: #2f6b4f;
  --restricted: #b07a1a;
  --heavy: #a33b2a;
  --banned: #6b1f1a;
  --unclear: #5c6670;
  --moderate: #3d6e8c;
  --light: #3f7a5c;
  --line: rgba(20, 53, 40, 0.12);
  --shadow: 0 18px 50px rgba(12, 36, 25, 0.12);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Sora", "Helvetica Neue", sans-serif;
  --radius: 4px;
  --max: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 107, 42, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 110, 140, 0.1), transparent 50%),
    linear-gradient(180deg, var(--fog) 0%, var(--paper) 40%, #ebe6dc 100%);
  min-height: 100vh;
  line-height: 1.55;
}

img {
  max-width: 100%;
  display: block;
}

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

code {
  font-size: 0.9em;
  background: rgba(20, 53, 40, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--pine);
  color: white;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: min(92vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--paper);
  isolation: isolate;
}

.hero__atmosphere {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      105deg,
      rgba(12, 36, 25, 0.88) 0%,
      rgba(20, 53, 40, 0.72) 42%,
      rgba(20, 53, 40, 0.35) 68%,
      rgba(12, 36, 25, 0.55) 100%
    ),
    url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?auto=format&fit=crop&w=2000&q=80")
      center / cover no-repeat;
  transform: scale(1.04);
  animation: atmosphere-drift 18s ease-in-out infinite alternate;
}

@keyframes atmosphere-drift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(-1.5%, 1%, 0);
  }
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav__links {
  display: flex;
  gap: 1.5rem;
}

.nav__links a {
  color: rgba(247, 245, 240, 0.85);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav__links a:hover {
  color: white;
}

.hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 8vw, 5.5rem);
  max-width: 820px;
  margin-right: auto;
  animation: rise-in 0.9s ease-out both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__brand {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  color: #f3ebe0;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 3.2vw, 2.15rem);
  line-height: 1.25;
  margin: 0 0 1rem;
  max-width: 18ch;
  color: rgba(247, 245, 240, 0.95);
}

.hero__lede {
  margin: 0 0 1.75rem;
  max-width: 38ch;
  font-size: 1.05rem;
  color: rgba(247, 245, 240, 0.82);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--copper);
  color: #fff8f0;
}

.btn--primary:hover {
  background: var(--copper-deep);
}

.btn--ghost {
  background: transparent;
  color: var(--paper);
  border-color: rgba(247, 245, 240, 0.45);
}

.btn--ghost:hover {
  border-color: var(--paper);
  background: rgba(247, 245, 240, 0.08);
}

/* —— Pulse stats (below hero) —— */
.pulse {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  max-width: var(--max);
  margin: -2.5rem auto 0;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
  position: relative;
  z-index: 2;
}

.pulse__item {
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  padding: 1.15rem 1.25rem;
  animation: rise-in 0.7s ease-out both;
}

.pulse__item:nth-child(2) {
  animation-delay: 0.08s;
}
.pulse__item:nth-child(3) {
  animation-delay: 0.16s;
}
.pulse__item:nth-child(4) {
  animation-delay: 0.24s;
}

.pulse__value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--pine);
  line-height: 1.1;
}

.pulse__label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-transform: lowercase;
}

.pulse__item--note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}

/* —— Explorer —— */
.explorer {
  max-width: 1280px;
  margin: 3.5rem auto 4rem;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
}

.explorer__toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
}

.select--state {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 11rem;
}

.select__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--line);
  flex: 1;
  min-width: 14rem;
}

.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.tab.is-active {
  color: var(--pine);
  border-bottom-color: var(--copper);
}

.filters {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 0.65rem;
}

.search input,
.select select {
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 245, 240, 0.85);
  color: var(--ink);
}

.search input:focus,
.select select:focus {
  outline: 2px solid rgba(196, 107, 42, 0.35);
  outline-offset: 1px;
}

.explorer__body {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.45fr) minmax(260px, 0.95fr);
  gap: 1rem;
  min-height: 620px;
  align-items: stretch;
}

.list-pane,
.map-pane,
.detail-pane {
  background: rgba(247, 245, 240, 0.72);
  border: 1px solid var(--line);
  min-height: 620px;
}

.map-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.map-pane__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.map-pane__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--pine);
}

.map-pane__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.map {
  flex: 1;
  min-height: 480px;
  background: #dfe8e2;
}

.map-legend {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 500;
  background: rgba(247, 245, 240, 0.94);
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  pointer-events: none;
}

.map-legend strong {
  display: block;
  color: var(--pine);
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.map-legend__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.map-legend__swatch {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

.leaflet-container {
  font: inherit;
  background: #dfe8e2;
}

.leaflet-control-attribution {
  font-size: 0.65rem !important;
  background: rgba(247, 245, 240, 0.85) !important;
}

.leaflet-tooltip.str-tip {
  background: var(--pine-deep);
  color: var(--paper);
  border: 0;
  border-radius: 2px;
  padding: 0.35rem 0.55rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  box-shadow: none;
}

.leaflet-tooltip.str-tip::before {
  border-top-color: var(--pine-deep);
}

.muni-marker {
  border-radius: 50%;
  border: 2px solid rgba(247, 245, 240, 0.95);
  box-shadow: 0 1px 4px rgba(12, 36, 25, 0.35);
  transition: transform 0.15s ease;
}

.muni-marker.is-selected {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(196, 107, 42, 0.45);
}

.list-meta {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(70vh + 40px);
  overflow: auto;
}

.rank-item {
  width: 100%;
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.8rem 0.85rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.rank-item:hover,
.rank-item.is-selected {
  background: rgba(20, 53, 40, 0.06);
}

.rank-item.is-selected {
  box-shadow: inset 3px 0 0 var(--copper);
}

.rank-item__num {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--pine);
  font-size: 1.05rem;
}

.rank-item__name {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.92rem;
}

.rank-item__sub {
  display: block;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.rank-item__score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--pine);
}

.badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.4rem;
  border-radius: 2px;
  color: white;
  background: var(--unclear);
}

.badge--allowed,
.badge--likely_unregulated,
.badge--unregulated,
.badge--light {
  background: var(--allowed);
}

.badge--restricted,
.badge--moderate {
  background: var(--restricted);
}

.badge--heavily_restricted {
  background: var(--heavy);
}

.badge--banned,
.badge--restrictive {
  background: var(--banned);
}

.badge--unclear {
  background: var(--unclear);
}

.detail-pane {
  position: sticky;
  top: 1rem;
  padding: 1.35rem;
  box-shadow: var(--shadow);
  animation: panel-in 0.35s ease both;
  max-height: 85vh;
  overflow: auto;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.detail-empty {
  height: 100%;
  min-height: 480px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  text-align: center;
  padding: 2rem;
}

.detail__rank {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}

.detail__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  margin: 0 0 0.35rem;
  line-height: 1.15;
  color: var(--pine-deep);
}

.detail__sub {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
}

.detail__score-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.detail__score {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--pine);
  line-height: 1;
}

.detail__score span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.detail__grid {
  display: grid;
  gap: 0.85rem;
  margin: 1.25rem 0;
}

.detail__field dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 0.2rem;
}

.detail__field dd {
  margin: 0;
  font-size: 0.95rem;
}

.detail__rules {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.detail__rules h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.detail__rules p,
.detail__notes {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.detail__notes {
  margin-top: 1rem;
}

.detail__sources {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail__sources a {
  font-size: 0.8rem;
  color: var(--copper-deep);
}

/* —— State law —— */
.state-law {
  background:
    linear-gradient(160deg, var(--pine-deep), #1a4030 55%, #24503c);
  color: var(--paper);
  padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 4vw, 2rem);
}

.state-law__inner {
  max-width: 720px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  margin: 0 0 0.75rem;
  color: rgba(247, 245, 240, 0.65);
}

.state-law h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.state-law__cite {
  margin: 0 0 1.5rem;
  color: rgba(247, 245, 240, 0.72);
  font-size: 0.95rem;
}

.state-law__list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.75rem;
}

.state-law__list li {
  color: rgba(247, 245, 240, 0.9);
}

.state-law__sources {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.state-law__sources a {
  color: #f0c49a;
}

.footer {
  padding: 2rem clamp(1.25rem, 4vw, 2rem) 3rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.footer__run {
  margin-top: 0.5rem;
}

@media (max-width: 1100px) {
  .explorer__body {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "map map"
      "list detail";
  }

  .map-pane {
    grid-area: map;
    min-height: 420px;
  }

  .list-pane {
    grid-area: list;
    min-height: 420px;
  }

  .detail-pane {
    grid-area: detail;
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .pulse {
    grid-template-columns: 1fr 1fr;
    margin-top: -1.5rem;
  }

  .pulse__item--note {
    grid-column: 1 / -1;
  }

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

  .explorer__body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "detail"
      "list";
  }

  .map-pane,
  .list-pane,
  .detail-pane {
    min-height: auto;
  }

  .map {
    min-height: 360px;
  }

  .rank-list {
    max-height: 45vh;
  }
}

/* —— Landing —— */
.hero--landing {
  min-height: min(92vh, 820px);
}

.landing-states {
  padding: 4rem clamp(1.25rem, 4vw, 2rem) 5rem;
}

.landing-states__inner {
  max-width: var(--max);
  margin: 0 auto;
}

.landing-states h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0.35rem 0 0.5rem;
  color: var(--pine-deep);
}

.landing-states__lede {
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0 0 1.75rem;
}

.state-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.state-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.35rem 1.4rem;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(160deg, rgba(20, 53, 40, 0.06), transparent 55%),
    rgba(247, 245, 240, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.state-card:hover {
  transform: translateY(-2px);
  border-color: rgba(196, 107, 42, 0.45);
}

.state-card__code {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--pine);
}

.state-card__name {
  font-weight: 600;
}

.state-card__meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* —— Explorer chrome —— */
.page-explore {
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(196, 107, 42, 0.07), transparent 55%),
    linear-gradient(180deg, var(--fog) 0%, var(--paper) 35%, #ebe6dc 100%);
}

.explore-top {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem clamp(1.25rem, 4vw, 2rem) 0;
}

.nav--explore {
  padding-left: 0;
  padding-right: 0;
  max-width: none;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav__brand--ink {
  color: var(--pine-deep);
}

.nav__links--ink a {
  color: var(--ink-soft);
}

.nav__links--ink a:hover {
  color: var(--pine);
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  flex: 1;
  min-width: 12rem;
}

.crumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.55rem;
  opacity: 0.45;
}

.crumb a {
  color: var(--pine);
  text-decoration: none;
  font-weight: 500;
}

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

.explore-top__intro {
  padding: 0.5rem 0 0.25rem;
}

.explore-top__intro h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  margin: 0 0 0.35rem;
  color: var(--pine-deep);
}

.explore-top__intro p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 40rem;
}

.pulse--explore {
  margin-top: 1.25rem;
}

.page-explore .explorer {
  margin-top: 1.75rem;
}

@media (max-width: 560px) {
  .hero {
    min-height: 88vh;
  }

  .nav__links {
    gap: 1rem;
  }

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

  .nav--explore {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
