:root {
  --ink: #15211d;
  --muted: #5d6863;
  --paper: #f5f1e8;
  --panel: #fffdf8;
  --line: #d8d2c5;
  --accent: #176b52;
  --accent-dark: #0f4939;
  --max: 72rem;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.65;
}

a { color: var(--accent-dark); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell { width: min(calc(100% - 2rem), var(--max)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--line); }
.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  gap: 2rem;
}

.brand {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-frame {
  display: grid;
  white-space: nowrap;
}

.brand-primary,
.brand-expanded {
  grid-area: 1 / 1;
}

.brand-primary {
  animation: brand-primary 2.4s ease-in-out both;
}

.brand-expanded {
  animation: brand-expanded 2.4s ease-in-out both;
}

@keyframes brand-primary {
  0%, 20%, 100% { opacity: 1; }
  38%, 68% { opacity: 0; }
}

@keyframes brand-expanded {
  0%, 24%, 82%, 100% { opacity: 0; }
  42%, 66% { opacity: 1; }
}

nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
nav a { color: var(--muted); font-size: 0.92rem; text-decoration: none; }
nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

main { min-height: calc(100vh - 11rem); }

.hero { padding: clamp(5rem, 13vw, 10rem) 0 clamp(4rem, 10vw, 8rem); }
.hero-grid {
  display: grid;
  gap: clamp(3rem, 7vw, 7rem);
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  align-items: center;
}
.hero-copy { min-width: 0; }
.nyc-map { margin: 0; }
.nyc-map img {
  display: block;
  height: auto;
  max-height: 35rem;
  width: 100%;
}
.nyc-map figcaption {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 0.85rem;
  text-align: right;
}
.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 1.25rem;
  text-transform: uppercase;
}

h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; line-height: 1.06; }
h1 { font-size: clamp(3rem, 8vw, 7rem); letter-spacing: -0.055em; margin: 0; max-width: 11ch; }
h2 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.035em; margin: 0 0 1.5rem; }

.lede { color: var(--muted); font-size: clamp(1.18rem, 2.5vw, 1.55rem); max-width: 45rem; margin: 2rem 0 0; }
.notice { border-left: 3px solid var(--accent); margin-top: 3rem; max-width: 43rem; padding: 0.15rem 0 0.15rem 1.25rem; }
.notice p { margin: 0; }

.page { padding: clamp(4rem, 10vw, 8rem) 0; }
.page h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); }
.copy { max-width: 46rem; }
.copy p { color: var(--muted); font-size: 1.18rem; }
.copy p:first-of-type { color: var(--ink); font-size: 1.35rem; }

.resource-page, .data-paper { padding: clamp(3.5rem, 8vw, 7rem) 0; }
.resource-page section, .data-paper section { border-top: 1px solid var(--line); margin-top: clamp(3rem, 7vw, 5rem); padding-top: clamp(3rem, 7vw, 5rem); }
.resource-page article > section:first-child, .data-paper article > section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.resource-page article > section:first-child > p:first-of-type { color: var(--accent-dark); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; margin-bottom: 0.75rem; text-transform: uppercase; }
.resource-page article > section:first-child > p:nth-of-type(2) { font-size: clamp(1.2rem, 2.5vw, 1.55rem); margin: 2rem 0; }
/* Any figure, at any nesting depth, on a resource page or a data paper.
   The scoped rules below stay for the first-section hero figure; this is the
   floor so a nested figure can never render at its natural pixel width. */
.resource-page figure, .data-paper figure { margin: 2rem 0; max-width: 100%; }
.resource-page figure img, .data-paper figure img { display: block; height: auto; max-width: 100%; width: 100%; }
.resource-page figcaption, .data-paper figcaption { color: var(--muted); font-size: 0.78rem; margin-top: 0.75rem; max-width: 52rem; }
.resource-page article > section:first-child > figure { margin: 2rem 0 0; max-width: 36rem; }
.resource-page article > section:first-child > figure img { display: block; height: auto; width: 100%; }
.resource-page article > section:first-child > figure figcaption { color: var(--muted); font-size: 0.78rem; margin-top: 0.75rem; }
.resource-page article > section:first-child > dl { border-block: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); margin: clamp(3rem, 7vw, 5rem) 0 0; }
.resource-page article > section:first-child > dl div { padding: 1.25rem; }
.resource-page article > section:first-child > dl div + div { border-left: 1px solid var(--line); }
.resource-page article > section:first-child > dl dt { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.resource-page article > section:first-child > dl dd { font-size: 0.98rem; margin: 0.35rem 0 0; }
.resource-page section section section, .data-paper section section section { margin-top: 2rem; padding-top: 2rem; }
.resource-page h1, .data-paper h1 { font-size: clamp(3rem, 8vw, 6.5rem); }
.resource-page h2, .data-paper h2 { margin-bottom: 1.25rem; }
.resource-page h3, .data-paper h3 { font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 500; line-height: 1.2; margin: 0 0 0.8rem; }
.resource-page p, .data-paper p { color: var(--muted); max-width: 52rem; }
.resource-header { display: grid; gap: clamp(2.5rem, 6vw, 6rem); grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 0.65fr); align-items: center; }
.resource-lede { font-size: clamp(1.2rem, 2.5vw, 1.55rem); margin: 2rem 0 0; }
.resource-map { margin: 0; }
.resource-map img { display: block; height: auto; width: 100%; }
.resource-map figcaption { color: var(--muted); font-size: 0.78rem; margin-top: 0.75rem; text-align: right; }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.45rem 0.9rem; justify-content: flex-end; margin-bottom: 0.3rem; }
.map-legend > span { align-items: center; display: inline-flex; gap: 0.35rem; }
.legend-swatch { border: 1px solid transparent; display: inline-block; height: 0.72rem; width: 1.25rem; }
.legend-swatch.water-included { background: #d8e7e8; border-color: #3f7785; border-style: dashed; }
.legend-swatch.water-excluded { background: #176b52; border-color: #0f4939; }
.external-link::after { content: " ↗"; font-size: 0.8em; text-decoration: none; }
.resource-facts { border-block: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); margin: clamp(3rem, 7vw, 5rem) 0 0; }
.resource-facts div { padding: 1.25rem; }
.resource-facts div + div { border-left: 1px solid var(--line); }
.resource-facts dt { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.resource-facts dd { font-size: 0.98rem; margin: 0.35rem 0 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: 0.92rem; min-width: 46rem; width: 100%; }
table caption { color: var(--muted); font-size: 0.78rem; font-weight: 700; padding: 0 0 0.75rem; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: 1rem; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
th span { font-size: 0.9em; letter-spacing: 0; text-transform: none; }
.numeric td:not(:first-child), .numeric th:not(:first-child) { text-align: right; }
.status { background: #dfeee7; border-radius: 999px; color: var(--accent-dark); display: inline-block; font-size: 0.72rem; font-weight: 750; margin-right: 0.35rem; padding: 0.12rem 0.5rem; }
.annotation { font-size: 0.88rem; }
.knowledge-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.knowledge-card { background: var(--panel); border: 1px solid var(--line); padding: clamp(1.5rem, 4vw, 2.5rem); }
.knowledge-card p { margin-bottom: 0; }
.downloads { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0; }
.downloads a { background: var(--panel); border: 1px solid var(--line); display: block; padding: 1.1rem 1.25rem; text-decoration: none; }
.downloads strong, .downloads span { display: block; }
.downloads span { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.check-list { padding-left: 1.2rem; }
.check-list li { margin-bottom: 0.65rem; }
.limitation { background: #eee7d8; border: 0 !important; margin-inline: -1.5rem; padding: clamp(1.5rem, 5vw, 3rem) !important; }
.limitation h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.history { padding-left: 1.2rem; }
.history li { margin-bottom: 0.65rem; }

@media (max-width: 56rem) {
  .resource-header { grid-template-columns: 1fr; }
  .resource-map { margin-inline: auto; max-width: 24rem; }
  .resource-facts { grid-template-columns: 1fr 1fr; }
  .resource-facts div + div { border-left: 0; }
  .resource-facts div:nth-child(even) { border-left: 1px solid var(--line); }
  .resource-facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .resource-page article > section:first-child > dl { grid-template-columns: 1fr 1fr; }
  .resource-page article > section:first-child > dl div + div { border-left: 0; }
  .resource-page article > section:first-child > dl div:nth-child(even) { border-left: 1px solid var(--line); }
  .resource-page article > section:first-child > dl div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: clamp(3rem, 7vw, 5rem) 0;
}

.name-meaning h2 { font-size: clamp(2rem, 5vw, 3.5rem); }
.name-meaning p { margin-bottom: 0; }

.kee-term { margin: 0 0 1.75rem; }
.kee-term h3 { line-height: 1.2; margin: 0; }
.kee-term p { margin: 0; }
.back-to-top {
  display: inline-block;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 0.3rem;
  text-decoration: none;
  vertical-align: 0.08em;
}

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; padding: 2rem 0; }
.site-footer p { margin: 0; }

@media (max-width: 42rem) {
  .site-header .shell { align-items: flex-start; flex-direction: column; gap: 0.65rem; padding-block: 1.2rem; }
  nav { gap: 0.8rem 1.1rem; }
  h1 { letter-spacing: -0.04em; }
  .hero-grid { grid-template-columns: 1fr; }
  .nyc-map { margin-inline: auto; max-width: 28rem; width: 100%; }
  .knowledge-grid, .downloads { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .brand-primary { animation: none; }
  .brand-expanded { display: none; animation: none; }
}
