/* Chopper Noise (choppernoise.publicworks.nyc)
   ------------------------------------------------------------------
   One stylesheet, no build step, no webfonts. Tokens, base, masthead and
   footer follow the shared publicworks.nyc chrome; the reference is
   paygap.publicworks.nyc. The map page is a working surface: on a wide
   screen it fills the window and does not scroll. */

/* ---- Tokens ---------------------------------------------------- */

:root {
  --paper:        #fbfaf7;
  --paper-raised: #ffffff;
  --paper-sunken: #f2f0eb;
  --ink:          #16181d;
  --ink-soft:     #4a4f5a;
  --ink-faint:    #6b7280;
  --rule:         #e0ddd6;
  --rule-strong:  #c9c5bb;

  --accent:       #4338ca;   /* indigo; 7.6:1 on the paper */
  --on-accent:    #ffffff;
  --accent-soft:  #ecebfa;
  --accent-ink:   #3730a3;
  --warn:         #b4520a;
  --warn-soft:    #fdf0e4;

  /* Loudness, one orange ramp: 60, 70 and 80 dBA. 50 is a neutral slate,
     because it marks presence rather than harm. */
  --band-50: #8b95a7;
  --band-60: #de6f25;
  --band-70: #b7470f;
  --band-80: #7a2a08;


  /* The two groups of flights. */
  --non-essential:  #c4387a;
  --public-service: #2a78d6;

  --shadow: 0 1px 2px rgba(20,22,28,.05), 0 8px 24px -12px rgba(20,22,28,.18);
  --shadow-tight: 0 1px 2px rgba(20,22,28,.06);

  --glass:      rgba(251, 250, 247, .82);
  --glass-blur: saturate(140%) blur(14px);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .9);

  --measure: 34rem;
  --wide:    72rem;
  --masthead-h: 3.3rem;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

/* ---- Base ------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.12; letter-spacing: -.022em; font-weight: 700; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-top: 2.5em; }
h3 { font-size: 1.1rem; letter-spacing: -.01em; margin-top: 2em; }

p { margin: 0 0 1em; max-width: var(--measure); }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: .07em; }
a:hover { color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

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

.wrap { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }
main { padding-bottom: 5rem; }

.eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .35rem;
}

/* ---- Masthead --------------------------------------------------- */
/* The shared portfolio header. Only --accent may differ between sites.
   Do not retune the sizes below on one site alone. */

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }

@media (min-width: 60rem) and (hover: hover) {
  .masthead {
    position: sticky; top: 0; z-index: 30;
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-edge);
  }
  :root { scroll-padding-top: calc(var(--masthead-h) + 1rem); }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .masthead { background: var(--paper-raised); }
  }
  @media (prefers-reduced-transparency: reduce) {
    .masthead {
      background: var(--paper-raised);
      -webkit-backdrop-filter: none; backdrop-filter: none;
    }
  }
  @media (max-height: 34rem) {
    .masthead { position: static; }
    :root { scroll-padding-top: 0; }
  }
}

.masthead-inner {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .55rem 0; flex-wrap: wrap;
}
.wordmark {
  font-weight: 700; letter-spacing: -.03em; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.nav { display: flex; gap: .15rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a {
  color: var(--ink-soft); text-decoration: none;
  padding: .35rem .6rem; border-radius: 6px;
  font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--paper-sunken); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---- Notes ------------------------------------------------------ */

.note-box {
  border-left: 3px solid var(--rule-strong);
  background: var(--paper-sunken);
  padding: .85rem 1rem;
  border-radius: 0 8px 8px 0;
  font-size: .89rem;
  color: var(--ink-soft);
  margin: 1.5rem 0;
  max-width: 46rem;
}
.note-box strong { color: var(--ink); }
.note-box.caution { border-left-color: var(--warn); background: var(--warn-soft); }
.note-box p { max-width: none; }
.note-box p:last-child { margin-bottom: 0; }

/* ---- Footer ----------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem; padding: 2rem 0 3rem;
  font-size: .87rem; color: var(--ink-faint);
}
.footer p { max-width: 40rem; }
.footer a { color: var(--ink-soft); }
.footer a:hover { color: var(--accent); }
.footer-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.footer h4 {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-faint); margin: 0 0 .5rem;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: .25rem; }

.colophon { margin-top: 1.5rem; font-size: .82rem; }
.portfolio {
  margin: 1.75rem 0 0; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: .8rem; letter-spacing: .02em; color: var(--ink-faint);
}
.portfolio a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.portfolio a:hover { color: var(--accent); text-decoration: underline; }

.footer-compact { margin: 1.5rem 0 0; padding: 1.25rem 0 2rem; font-size: .8rem; }
.footer-compact p { margin: 0; }
.footer-compact .colophon { margin-top: 0; font-size: .78rem; }
.footer-compact .portfolio { margin-top: 1rem; padding-top: .9rem; }


/* ---- About and Data --------------------------------------------- */
/* Reading pages. Text holds to the measure; tables and download panels
   take a wider column. Downloads, Columns and Process follow the shared
   publicworks.nyc Data page parts. */

.document { padding-top: clamp(2rem, 5vw, 3.5rem); }
.document h1 { margin-bottom: .3em; }
.document h2 { margin-top: 2.2em; }
.document ul, .document ol { max-width: var(--measure); padding-left: 1.2rem; margin: 0 0 1em; }
.document li { margin-bottom: .45rem; }
.document .lead { font-size: 1.2rem; line-height: 1.45; color: var(--ink-soft); max-width: 36rem; }

.downloads {
  display: grid; gap: 1rem; margin: 1rem 0; max-width: 48rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.download {
  display: block; background: var(--paper-raised);
  border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.2rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-tight);
  transition: border-color .15s ease;
}
.download:hover { border-color: var(--accent); color: inherit; }
.download h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.download p { margin: 0; font-size: .89rem; color: var(--ink-soft); max-width: none; }

details { max-width: 48rem; margin: 1rem 0; }
details > summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
details[open] > summary { margin-bottom: .75rem; }
.data-note { font-size: .85rem; color: var(--ink-faint); margin-top: .75rem; }
.fine { font-size: .85rem; color: var(--ink-faint); }

.table-wrap {
  overflow-x: auto; max-width: 48rem; margin: 1rem 0;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-raised);
}
.document table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.document th, .document td { padding: .5rem .8rem; text-align: left; vertical-align: top; }
.document thead th {
  background: var(--paper-sunken); border-bottom: 1px solid var(--rule-strong);
  font-size: .78rem; letter-spacing: .02em; color: var(--ink-soft); font-weight: 700;
}
.document tbody tr + tr td { border-top: 1px solid var(--rule); }
.document td.num, .document th.num { text-align: right; white-space: nowrap; }
.document td.nowrap { white-space: nowrap; }
.document code { font-family: var(--mono); font-size: .88em; }

/* On a phone a stacked table reads each row as one block. */
@media (max-width: 40rem) {
  .stack thead { display: none; }
  .stack tr { display: block; padding: .6rem .8rem; }
  .stack tbody tr + tr { border-top: 1px solid var(--rule); }
  .document .stack td { display: block; padding: 0; border-top: 0; }
  .document .stack td + td { margin-top: .15rem; font-size: .86rem; color: var(--ink-soft); }
}

.process { list-style: none; margin: 1rem 0 0; padding: 0; counter-reset: step; max-width: var(--measure); }
.document .process { padding-left: 0; }
.process > li { position: relative; counter-increment: step; padding: 0 0 1.25rem 2.6rem; margin: 0; }
.process > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--paper);
  font-size: .8rem; font-weight: 700;
}
.process > li:not(:last-child)::after {
  content: ""; position: absolute; left: .8rem; top: 1.9rem; bottom: .25rem;
  border-left: 2px solid var(--rule-strong);
}
.process h3 { margin: 0 0 .2rem; font-size: 1rem; }
.process p { margin: 0; color: var(--ink-soft); }

/* Loudness: the panel's four level rows, with the same faces. */
.levels { max-width: var(--measure); }
.levels td:first-child { width: 2.2rem; padding-right: 0; }
.levels .face { display: block; margin-top: .1rem; }

.formula {
  font-family: var(--mono); font-size: .86rem; line-height: 1.5;
  background: var(--paper-sunken); border-radius: 8px;
  padding: .6rem .8rem; margin: 0 0 .75rem; max-width: 40rem; overflow-x: auto;
  white-space: pre-wrap;
}


/* ---- Map page --------------------------------------------------- */
/* Wide: the window is the page. The side panel scrolls on its own and the
   map fills the rest. Narrow: the map sits on top and the panel follows. */

.atlas { display: flex; flex-direction: column; padding-bottom: 0; }

.rail { background: var(--paper); }
.rail-head { padding: 1.1rem 1.25rem 0; }
.rail-title { font-size: 1.15rem; letter-spacing: -.02em; margin: 0; }

.rail-tools {
  display: grid; gap: .55rem;
  padding: .9rem 1.25rem .85rem; background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.rail-scroll { padding: 0 1.25rem; }

/* Day and the live switch. */
.when { display: flex; gap: .45rem; }
.day-select {
  flex: 1; min-width: 0; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink);
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 8px;
  padding: .38rem .6rem; cursor: pointer;
}
.day-select:hover { border-color: var(--rule-strong); }
/* Live waits for a real-time feed; until then it sits greyed out. */
.live {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--ink-faint);
  background: var(--paper-sunken); border: 1px solid var(--rule); border-radius: 8px;
  padding: .38rem .7rem; opacity: .7;
}
.live-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--rule-strong); }

/* Segmented buttons: one choice from a short set. */
.seg {
  display: flex; padding: 2px; gap: 2px;
  background: var(--paper-sunken); border: 1px solid var(--rule); border-radius: 8px;
}
.seg button {
  flex: 1; min-width: 0; font: inherit; font-size: .84rem; font-weight: 500;
  color: var(--ink-soft); background: none; border: 0; border-radius: 6px;
  padding: .32rem .4rem; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.seg button[aria-pressed="true"] {
  background: var(--paper-raised); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 2px rgba(20,22,28,.12);
}

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .8rem; color: var(--ink-soft); cursor: pointer;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: 999px; padding: .2rem .65rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; flex: none; }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 1.5px #fff; }
.dot.non-essential { background: var(--non-essential); }
.dot.public-service { background: var(--public-service); }

/* ---- Readouts --------------------------------------------------- */

.readout { padding: 1.1rem 0 1rem; border-bottom: 1px solid var(--rule); }
#flights { border-bottom: 0; }

/* Residents below beside the people aboard. */
.pair { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; margin-top: .2rem; }
.hero-num {
  font-size: 2.7rem; font-weight: 700; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: proportional-nums; margin: .15rem 0 .25rem;
}
.hero-num small { font-size: .42em; font-weight: 600; letter-spacing: -.01em; }
.hero-label { font-size: .84rem; color: var(--ink-soft); margin: 0; line-height: 1.35; }
.aboard { padding-left: 1rem; border-left: 1px solid var(--rule); }
.aboard .hero-num { font-size: 2.2rem; }

/* Levels with residents in each, the same in both views: a face for the
   level, how loud it sounds, a bar against the 60+ row, the count. Rows
   share one set of columns, so every bar starts and ends in line. */
.rows {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: 1.25rem max-content minmax(2.5rem, 1fr) 5.4rem; gap: .32rem .5rem;
}
.rows li {
  grid-column: 1 / -1; display: grid; align-items: center; gap: .5rem;
  grid-template-columns: 1.25rem 6.5rem minmax(2.5rem, 1fr) 5.4rem;
  grid-template-columns: subgrid;
  font-size: .84rem; color: var(--ink-soft);
}
.rows .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows b { color: var(--ink); font-weight: 600; }
.rows .bar { height: .5rem; background: var(--paper-sunken); border-radius: 2px; overflow: hidden; }
.rows .bar i { display: block; height: 100%; width: 0; border-radius: 0 3px 3px 0; transition: width .25s ease; }
.rows .v { color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }
.rows .lead b, .rows .lead .v { font-weight: 700; }
.rows .presence { margin-top: .2rem; padding-top: .45rem; border-top: 1px solid var(--rule); }
.rows .presence, .rows .presence b, .rows .presence .v { color: var(--ink-faint); font-weight: 500; }
.rows .presence .bar { background: none; }
.rows .presence .bar i { opacity: .6; }

/* A bar longer than the scale fills the track and trails off in dots. */
.rows .bar i.more { position: relative; border-radius: 0; }
.rows .bar i.more::after {
  content: ''; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  width: 1.1rem; height: 4px; margin-left: 3px;
  background: radial-gradient(circle, var(--band-50) 1.6px, transparent 2px) 0 50% / 6px 4px repeat-x;
}
.mark { justify-self: center; display: flex; }

/* Faces: white features on a disc of the level's color. 50 is an outline,
   the same faint presence as its ring. */
.face { width: 1.25rem; height: 1.25rem; flex: none; }
.face .feat circle { fill: #fff; }
.face .feat path { fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.face.b60 .disc { fill: var(--band-60); }
.face.b70 .disc { fill: var(--band-70); }
.face.b80 .disc { fill: var(--band-80); }
.face.b50 .disc { fill: var(--paper-raised); stroke: var(--band-50); stroke-width: 1.2; }
.face.b50 .feat circle { fill: var(--band-50); }
.face.b50 .feat path { stroke: var(--band-50); }

.section-h {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 .45rem;
}

/* Flights by group and category, in the air or all day. */
.groups-sum { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; font-size: .84rem; }
.groups-sum li { display: grid; grid-template-columns: .55rem 1fr auto; gap: .5rem; align-items: baseline; }
.groups-sum .dot { align-self: center; }
.groups-sum b { font-weight: 600; }
.groups-sum small { display: block; color: var(--ink-faint); font-size: .76rem; }
.groups-sum .dim { opacity: .45; }


/* ---- Map stage -------------------------------------------------- */

.stage { position: relative; height: 58vh; height: 58svh; min-height: 20rem; background: #e9eef1; }
.map { position: absolute; inset: 0; }
.map-message {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 8px;
  padding: .5rem .85rem; font-size: .86rem; color: var(--ink-soft); box-shadow: var(--shadow);
  max-width: 22rem; text-align: center; z-index: 4;
}
.map-message:empty { display: none; }
.map-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 6px;
  padding: .3rem .55rem; font-size: .78rem; color: var(--ink); box-shadow: var(--shadow);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.map-attrib {
  position: absolute; right: .5rem; top: .45rem; z-index: 3;
  font-size: .68rem; color: var(--ink-faint);
  background: rgba(255,255,255,.75); padding: .05rem .4rem; border-radius: 4px;
}
.map-attrib a { color: inherit; }
.maplibregl-ctrl-top-right { top: 1.8rem; }

/* Timeline: play, the clock, and the day's traffic to scrub through. */
.timeline {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .8rem;
  padding: .6rem .9rem; background: var(--paper-raised);
  border-top: 1px solid var(--rule);
}
.timeline[hidden] { display: none; }
.play {
  width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
}
.play:hover { background: var(--accent-ink); }
.play svg { width: .95rem; height: .95rem; fill: currentColor; }
.clock-box { display: grid; min-width: 5.6rem; line-height: 1.15; }
.clock { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.pace { font-size: .68rem; color: var(--ink-faint); white-space: nowrap; }

.scrub { position: relative; height: 2.6rem; }
.spark { position: absolute; left: 0; right: 0; top: 0; height: 1.7rem; width: 100%; display: block; }
.spark rect { fill: var(--band-60); opacity: .3; }
.spark rect.on { opacity: .9; }
.scrub input[type="range"] {
  position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 1.8rem; margin: 0;
  background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.scrub input[type="range"]::-webkit-slider-runnable-track { height: 1.8rem; background: transparent; }
.scrub input[type="range"]::-moz-range-track { height: 1.8rem; background: transparent; }
.scrub input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 3px; height: 1.8rem; background: var(--ink); border-radius: 2px; border: 0;
}
.scrub input[type="range"]::-moz-range-thumb { width: 3px; height: 1.8rem; background: var(--ink); border-radius: 2px; border: 0; }
.ticks {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between;
  font-size: .66rem; color: var(--ink-faint); pointer-events: none;
}
.spark-tip {
  position: absolute; bottom: calc(100% + 4px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper-raised); font-size: .72rem;
  padding: .15rem .45rem; border-radius: 4px; white-space: nowrap; pointer-events: none;
}

/* Wide: the page is the window. */
@media (min-width: 60rem) {
  body.app-page {
    height: 100vh; height: 100dvh; overflow: hidden;
    display: flex; flex-direction: column;
  }
  body.app-page .masthead .wrap { width: calc(100% - 2.5rem); }
  .atlas {
    flex: 1; min-height: 0;
    display: grid; grid-template-columns: clamp(21rem, 25vw, 24rem) 1fr;
  }
  .rail {
    order: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    border-right: 1px solid var(--rule);
    display: flex; flex-direction: column;
  }
  /* The notice sits at the foot of the panel, apart from the readout. */
  .rail-scroll { flex: 1 0 auto; display: flex; flex-direction: column; }
  .rail-scroll > .footer-compact { margin-top: auto; }
  .rail-tools { position: sticky; top: 0; z-index: 5; }
  .stage-wrap { order: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  .stage { flex: 1; height: auto; min-height: 0; }
}

/* Narrow: map first, then the panel. */
@media (max-width: 59.99rem) {
  .stage-wrap { order: 0; }
  .rail { order: 1; }
}
