:root {
  --ink: #0c1733;
  --paper: #f5f5f2;
  --blue: #2b3384;
  --red: #e5231b;
  --border: rgba(12, 23, 51, .14);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { color: inherit; font: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }

.app { width: 100%; height: 100%; position: relative; background: var(--paper); }
.toolbar {
  height: 72px; position: absolute; z-index: 20; inset: 0 0 auto;
  padding: 0 22px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 1px solid var(--border); background: rgba(250, 250, 247, .94); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 13px; width: max-content; }
.roundel { width: 37px; height: 37px; border: 7px solid var(--red); border-radius: 50%; display: grid; place-items: center; position: relative; }
.roundel i { position: absolute; width: 45px; height: 8px; background: #1555d4; }
.brand-copy { display: flex; align-items: baseline; gap: 7px; letter-spacing: -.03em; }
.brand-copy strong { font-size: 16px; }
.brand-copy small { color: #748095; font-size: 12px; }
.map-meta { display: flex; align-items: center; gap: 10px; justify-self: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22a36a; box-shadow: 0 0 0 5px rgba(34,163,106,.1); }
.map-meta p { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.map-meta strong { font-size: 11px; }
.map-meta small { font-size: 9px; color: #778298; }
nav { justify-self: end; display: flex; align-items: center; gap: 9px; }
nav > button:not(.fullscreen-button), nav > a { height: 34px; display: grid; place-items: center; padding: 0 10px; border: 0; background: transparent; font-size: 9px; font-weight: 700; }
nav > button:hover, nav > a:hover { background: #eceeeb; }
.fullscreen-button { width: 34px; height: 34px; border: 1px solid var(--border); background: white; display: grid; place-items: center; }
.fullscreen-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.viewer {
  position: absolute; inset: 72px 0 0; overflow: hidden; background: #e7e7e3;
  cursor: zoom-in; touch-action: none; user-select: none;
}
.is-zoomed .viewer { cursor: grab; }
.viewer.dragging { cursor: grabbing; }
.map-stage {
  position: absolute; inset: 0; transform-origin: center center; will-change: transform;
  animation: map-arrival .55s ease both;
}
.map-stage.animate { transition: transform .25s cubic-bezier(.2,.75,.2,1); }
@keyframes map-arrival { from { opacity: 0; } to { opacity: 1; } }
#tubeMap {
  width: 100%; height: 100%; display: block; object-fit: contain; object-position: center;
  pointer-events: none; filter: drop-shadow(0 12px 30px rgba(12,23,51,.08));
}
.zoom-controls {
  position: absolute; z-index: 8; right: 18px; bottom: 20px; width: 40px;
  display: flex; flex-direction: column; background: rgba(255,255,255,.95);
  border: 1px solid var(--border); box-shadow: 0 10px 28px rgba(12,23,51,.13);
}
.zoom-controls button { height: 40px; border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 19px; }
.zoom-controls button:hover { background: #eef0f3; }
.zoom-controls .fit-button { border: 0; font-size: 9px; font-weight: 750; }
.explore-lines {
  position: absolute; z-index: 8; left: 18px; bottom: 20px; height: 34px; padding: 0 13px;
  display: flex; align-items: center; gap: 9px; border: 0; background: var(--ink); color: white;
  font-size: 9px; font-weight: 720; box-shadow: 0 10px 28px rgba(12,23,51,.18);
}
.explore-lines:hover { background: #17264a; }
.explore-lines > span { display: flex; flex-direction: column; gap: 2px; }
.explore-lines > span i { display: block; width: 14px; height: 2px; border-radius: 2px; }
.explore-lines > span i:nth-child(1) { background: #e32017; }
.explore-lines > span i:nth-child(2) { background: #00782a; }
.explore-lines > span i:nth-child(3) { background: #0098d4; }
.map-instruction {
  position: absolute; z-index: 5; left: 166px; bottom: 20px; height: 34px; padding: 0 11px;
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,.88); font-size: 8px; text-transform: uppercase; letter-spacing: .1em;
  color: #657187; backdrop-filter: blur(10px);
}
.mouse-icon { width: 11px; height: 15px; border: 1px solid #657187; border-radius: 6px; position: relative; }
.mouse-icon::after { content: ""; position: absolute; width: 1px; height: 4px; left: 4px; top: 2px; background: #657187; }
.source-credit { position: absolute; z-index: 4; right: 74px; bottom: 29px; font-size: 7px; text-transform: uppercase; letter-spacing: .11em; color: #6e7a8e; }

.facts-panel, .lines-panel {
  position: absolute; z-index: 41; top: 0; right: 0; bottom: 0; width: min(440px, 94vw);
  background: white; padding: 48px; box-shadow: -28px 0 70px rgba(12,23,51,.18);
  transform: translateX(105%); transition: transform .34s cubic-bezier(.2,.75,.2,1);
  overflow-y: auto;
}
.facts-open .facts-panel { transform: none; }
.lines-panel { width: min(480px, 96vw); padding: 0; display: flex; flex-direction: column; }
.lines-open .lines-panel { transform: none; }
.panel-backdrop { position: absolute; z-index: 40; inset: 0; background: rgba(5,12,28,.12); opacity: 0; pointer-events: none; transition: opacity .25s; }
.panel-open .panel-backdrop { opacity: 1; pointer-events: auto; }
.close-panel { position: absolute; top: 22px; right: 22px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #eef0f3; font-size: 21px; }
.panel-label { margin: 36px 0 24px; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .16em; color: #7c8798; }
.facts-panel h1 { margin: 0; font-size: 58px; line-height: .87; letter-spacing: -.075em; }
.panel-intro { margin: 26px 0; max-width: 300px; color: #69758a; font-size: 13px; line-height: 1.55; }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.fact-grid article { min-height: 125px; padding: 18px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; }
.fact-grid strong { font-size: 42px; line-height: 1; letter-spacing: -.06em; }
.fact-grid span { font-size: 9px; color: #748095; }
.fact-source { margin-top: 26px; height: 44px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: white; font-size: 10px; font-weight: 700; }
.license-note { margin: 22px 0 0; color: #8a93a3; font-size: 8px; line-height: 1.5; }
.lines-panel-head { padding: 34px 36px 26px; border-bottom: 1px solid var(--border); position: relative; }
.lines-panel-head .panel-label { margin: 0 0 16px; }
.lines-panel-head h1 { margin: 0; font-size: 41px; line-height: 1; letter-spacing: -.065em; }
.lines-panel-head > div > p:last-child { margin: 13px 46px 0 0; color: #748095; font-size: 11px; line-height: 1.5; }
.line-list { flex: 1; overflow-y: auto; padding: 8px 36px 24px; scrollbar-width: thin; }
.line-family > h2 { margin: 22px 0 8px; font-size: 8px; text-transform: uppercase; letter-spacing: .15em; color: #8a93a3; }
.line-item { border-top: 1px solid var(--border); }
.line-family .line-item:last-child { border-bottom: 1px solid var(--border); }
.line-summary {
  width: 100%; min-height: 54px; display: grid; grid-template-columns: 25px 116px 1fr 18px; gap: 8px; align-items: center;
  border: 0; background: transparent; padding: 8px 0; text-align: left;
}
.line-summary:hover { background: #f7f7f4; }
.line-summary > i { width: 21px; height: 5px; background: var(--line); border-radius: 5px; }
.line-summary > span { font-size: 12px; font-weight: 720; letter-spacing: -.02em; }
.line-summary > small { color: #768196; font-size: 8.5px; line-height: 1.35; }
.line-summary > b { font-size: 15px; font-weight: 400; transition: transform .2s; }
.line-item.open .line-summary > b { transform: rotate(45deg); }
.line-detail { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .3s ease, opacity .25s ease; }
.line-item.open .line-detail { max-height: 150px; opacity: 1; }
.line-detail p { margin: 2px 24px 12px 33px; color: #58667c; font-size: 11px; line-height: 1.55; }
.line-detail > span { margin: 0 24px 18px 33px; display: flex; align-items: center; gap: 6px; color: #8a93a3; font-size: 8px; }
.line-detail > span i { width: 16px; height: 4px; background: var(--line); border-radius: 4px; }
.line-panel-footer { min-height: 54px; padding: 0 36px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; color: #8a93a3; font-size: 8px; }
.line-panel-footer a { color: var(--ink); font-weight: 700; }

@media (max-width: 760px) {
  .toolbar { height: 62px; padding: 0 13px; grid-template-columns: 1fr auto; }
  .viewer { inset-top: 62px; inset: 62px 0 0; }
  .roundel { width: 31px; height: 31px; border-width: 6px; }
  .roundel i { width: 37px; height: 7px; }
  .brand-copy small, .map-meta, nav > a { display: none; }
  .toolbar nav { grid-column: 2; grid-row: 1; }
  nav > button:not(.fullscreen-button) { padding: 0 10px; }
  .map-instruction { bottom: 12px; left: 12px; }
  .map-instruction { display: none; }
  .explore-lines { left: 12px; bottom: 12px; }
  .zoom-controls { right: 12px; bottom: 12px; }
  .source-credit { display: none; }
  .facts-panel { padding: 34px 24px; }
  .facts-panel h1 { font-size: 50px; }
  .lines-panel-head { padding: 30px 22px 22px; }
  .line-list { padding-left: 22px; padding-right: 22px; }
  .line-summary { grid-template-columns: 23px 100px 1fr 16px; }
  .line-panel-footer { padding: 0 22px; }
}

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