/* afterdark.nyc — sodium-lamp amber on midnight. System fonts only. */
:root {
  --bg: #f5f2ec; --surface: #fffdf9; --surface2: #efeae1; --ink: #1c1a2e; --muted: #5c5970; --line: #e2dccf;
  --accent: #b5470f; --accent-ink: #fff; --violet: #5a3ccf; --night: #0c0f22; --night2: #171b3a; --glow: #ffb454;
  --good: #1f7a4d; --warn: #9a5b00; --map0: #e7e2d8; --park: #d7e3cf;
  --c1: #fde7c8; --c2: #fbc98a; --c3: #f39b4f; --c4: #d9652a; --c5: #9e3b12;
  --shadow: 0 1px 2px rgba(20,16,40,.06), 0 6px 20px rgba(20,16,40,.07);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c19; --surface: #12152b; --surface2: #191d3a; --ink: #ebe8f6; --muted: #a3a0bb; --line: #262a4b;
    --accent: #ffb454; --accent-ink: #1a1206; --violet: #a993ff; --good: #5fd39a; --warn: #ffc66b;
    --map0: #1b1f3d; --park: #16302a;
    --c1: #3a2a2a; --c2: #6b3d22; --c3: #a95a22; --c4: #e08a2e; --c5: #ffc46b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c19; --surface: #12152b; --surface2: #191d3a; --ink: #ebe8f6; --muted: #a3a0bb; --line: #262a4b;
  --accent: #ffb454; --accent-ink: #1a1206; --violet: #a993ff; --good: #5fd39a; --warn: #ffc66b;
  --map0: #1b1f3d; --park: #16302a;
  --c1: #3a2a2a; --c2: #6b3d22; --c3: #a95a22; --c4: #e08a2e; --c5: #ffc46b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--violet); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: "Avenir Next", "Avenir", "Segoe UI", system-ui, sans-serif; line-height: 1.15; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; margin: .2em 0 .3em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 750; margin: 2.2rem 0 .7rem; }
h3 { font-size: 1.12rem; font-weight: 700; margin: 1.4rem 0 .4rem; }
p { margin: .6rem 0; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 3rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 6px 10px; }

/* header */
.top { background: var(--night); color: #f3efe6; position: sticky; top: 0; z-index: 5; border-bottom: 1px solid rgba(255,180,84,.18); }
.bar { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.brand { flex: none; display: flex; align-items: center; gap: 0; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--glow); font-weight: 600; }
.brand img { margin-right: 9px; }
.brand:hover { color: #fff; }
.top nav { display: flex; gap: 2px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { color: #d9d4ea; text-decoration: none; padding: 7px 10px; border-radius: 8px; font-size: .94rem; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.08); }
.top nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--glow); }

/* hero */
.hero { position: relative; color: #fff; background: var(--night); overflow: hidden; }
.hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,9,24,.88) 0%, rgba(8,9,24,.55) 48%, rgba(8,9,24,.12) 100%), linear-gradient(0deg, rgba(8,9,24,.75) 0%, rgba(8,9,24,0) 45%); }
.hero .wrap { position: relative; z-index: 1; padding-top: clamp(48px, 9vw, 110px); padding-bottom: clamp(28px, 5vw, 56px); }
.hero h1 { max-width: 15em; margin-top: 0; text-shadow: 0 2px 18px rgba(0,0,0,.4); }
.hero p.lede { font-size: clamp(1.02rem, 1.7vw, 1.2rem); max-width: 36em; color: #ece7f7; }
.hero .credit { position: absolute; right: 10px; bottom: 6px; z-index: 2; font-size: .7rem; color: rgba(255,255,255,.7); max-width: 60%; text-align: right; }
.hero .credit a { color: inherit; }
.hero.small .wrap { padding-top: clamp(36px, 6vw, 70px); padding-bottom: 28px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--glow); margin: 0 0 .4rem; }
.crumbs { font-size: .86rem; margin: 0 0 .6rem; color: #cfc9e2; }
.crumbs a { color: #e6e0f6; }
main .crumbs { color: var(--muted); margin-top: 1.2rem; }
main .crumbs a { color: var(--violet); }

/* tonight strip */
.sky { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 22px; max-width: 900px; }
.sky div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; backdrop-filter: blur(4px); }
.sky b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; color: #fff; }
.sky span { font-size: .78rem; color: #d7d1e8; text-transform: uppercase; letter-spacing: .06em; }
.sky .note { grid-column: 1 / -1; background: none; border: 0; padding: 0; font-size: .85rem; color: #d7d1e8; }

/* cards */
.grid4, .grid3, .grid2 { display: grid; gap: 18px; }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flexgrid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.flexgrid > * { flex: 0 1 calc(25% - 14px); min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.card a.cover { display: block; aspect-ratio: 16 / 10; background: var(--night2); overflow: hidden; }
.card a.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover a.cover img { transform: scale(1.04); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { margin: 0; font-size: 1.06rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .meta { font-size: .84rem; color: var(--muted); }
.card .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.pill { font-size: .76rem; background: var(--surface2); border-radius: 999px; padding: 2px 9px; color: var(--ink); white-space: nowrap; }
.pill.hot { background: var(--accent); color: var(--accent-ink); }

/* tiles / stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: .84rem; color: var(--muted); }
.stat em { font-style: normal; font-size: .78rem; color: var(--accent); display: block; margin-top: 2px; }

/* layout */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.split > * { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.notice { border-left: 4px solid var(--accent); background: var(--surface); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 1rem 0; font-size: .95rem; }
.notice.soft { border-left-color: var(--violet); }
.lead { font-size: 1.1rem; max-width: 46em; }
.prose { max-width: 46em; }
.prose p { margin: .8rem 0; }
.cols2 { columns: 2 280px; column-gap: 28px; }
.src { font-size: .82rem; color: var(--muted); }
.src a { color: var(--muted); }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: .8rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
table.wide { min-width: 640px; }
td.nw { white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.today td { background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
tr.sub td { background: var(--surface2); font-weight: 700; }

/* line chips: plain letters in the site palette (no MTA route bullets) */
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 1.75em; height: 1.75em; padding: 0 .35em; border-radius: 6px; border: 1.5px solid var(--ink); font-weight: 800; font-size: .86rem; line-height: 1; color: var(--ink); text-decoration: none; background: var(--surface); }
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.off { opacity: .45; border-style: dashed; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* charts */
svg.bars { width: 100%; max-width: 420px; height: auto; }
svg.bars .b { fill: var(--c3); }
svg.bars .b.hi { fill: var(--violet); }
svg.bars text { font-size: 11px; fill: var(--muted); text-anchor: middle; }
svg.bars text.v { fill: var(--ink); font-weight: 600; }
.heat-wrap { overflow-x: auto; }
svg.heat { min-width: 580px; width: 100%; height: auto; }
svg.heat .hc { fill: var(--accent); }
svg.heat text { font-size: 10px; fill: var(--muted); text-anchor: middle; }
svg.heat text.d { text-anchor: end; }

/* map */
.map-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; overflow: hidden; }
svg.map { width: 100%; height: auto; display: block; touch-action: manipulation; }
svg.map path { stroke: var(--bg); stroke-width: .6; fill: var(--map0); }
svg.map path.park { fill: var(--park); }
svg.map path.k1 { fill: var(--c1); } svg.map path.k2 { fill: var(--c2); } svg.map path.k3 { fill: var(--c3); }
svg.map path.k4 { fill: var(--c4); } svg.map path.k5 { fill: var(--c5); }
svg.map path.sel { stroke: var(--violet); stroke-width: 2.2; }
svg.map path:hover { stroke: var(--ink); stroke-width: 1.4; }
svg.map text { font-size: 15px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; pointer-events: none; }
.legend { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: 6px 4px; }
.legend i { width: 22px; height: 12px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; pointer-events: none; background: var(--night); color: #fff; padding: 7px 10px; border-radius: 8px; font-size: .82rem; max-width: 240px; box-shadow: var(--shadow); z-index: 3; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface2); padding: 4px; border-radius: 10px; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 7px; font: inherit; font-size: .88rem; color: var(--ink); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); font-weight: 700; color: var(--accent); }

/* tools */
.tool { background: var(--night); color: #efeaf8; border-radius: var(--radius); padding: 18px; margin: 1rem 0; }
.tool h2, .tool h3 { color: #fff; margin-top: 0; }
.tool label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #c9c3dd; margin-bottom: 4px; }
.tool input, .tool select, .ctl input, .ctl select { font: inherit; padding: 9px 11px; border-radius: 9px; border: 1px solid #3a3f6b; background: #11142b; color: #fff; width: 100%; }
.ctl input, .ctl select { background: var(--surface); color: var(--ink); border-color: var(--line); }
.tool .row, .ctl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tool .out { margin-top: 14px; }
.tool .out .rt { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.tool .out .rt h4 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; font-size: 1rem; }
.tool .chip { background: transparent; color: #fff; border-color: #fff; }
.tool .times { font-variant-numeric: tabular-nums; font-size: .92rem; color: #e8e2f6; }
.tool .times b { color: var(--glow); }
.tool a { color: var(--glow); }
.tool .hint { font-size: .85rem; color: #bdb7d3; }
.js-only { display: none; }
html.js .js-only { display: block; }
html.js .ctl.js-only { display: grid; }
html.js .seg.js-only { display: inline-flex; }
html.js .no-js { display: none; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: .6rem 0; }
details > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; }
details > div { padding: 0 14px 12px; }
details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }

/* views */
.view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 22px; align-items: center; margin: 1.6rem 0; }
.view:nth-child(even) .ph { order: 2; }
.view .ph img { border-radius: var(--radius); aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.view h2 { margin-top: 0; }
figcaption, .cap { font-size: .74rem; color: var(--muted); margin-top: 4px; }
figure { margin: 0; }
.figure img { border-radius: var(--radius); width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* footer */
.foot { background: var(--night); color: #c8c2dc; font-size: .86rem; padding: 26px 0 34px; margin-top: 2rem; }
.foot a { color: #ffd59a; }
.foot .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.foot h4 { color: #fff; margin: 0 0 6px; font-size: .9rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 3px 0; }

@media (max-width: 1000px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flexgrid > * { flex-basis: calc(50% - 9px); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .grid3, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .view { grid-template-columns: minmax(0, 1fr); }
  .view:nth-child(even) .ph { order: 0; }
  .foot .cols { grid-template-columns: 1fr; }
  .hero .credit { position: relative; right: auto; bottom: auto; display: block; max-width: none; padding: 0 16px 8px; }
}
@media (max-width: 560px) {
  .grid4 { grid-template-columns: minmax(0, 1fr); }
  .flexgrid > * { flex-basis: 100%; }
  .sky { gap: 5px; }
  .sky div { padding: 7px 6px; border-radius: 9px; }
  .sky b { font-size: .82rem; white-space: nowrap; }
  .sky span { font-size: .6rem; letter-spacing: .03em; }
  .bar { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .top nav { margin: 0 -16px; padding: 4px 10px 6px; width: calc(100% + 32px); }
  .top nav a { padding: 7px 7px; font-size: .88rem; }
  th, td { padding: 6px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print { .top, .foot, .tool { display: none; } }
