:root {
  --siding: #ECEBE4;
  --door: #9AA0A4;
  --steel: #5F6B5E;
  --slate: #1E2328;
  --marker: #E2562B;
  --hazard: #E3B21B;
  --ink-soft: #4A5158;
  --plate-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 24px rgba(20,24,28,.28);
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--slate); }
body { font-family: var(--font); font-stretch: 100%; color: var(--slate); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }

#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; width: 100%; height: 100%; }
#labels { position: fixed; inset: 0; pointer-events: none; }
.tag {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: rgba(236,235,228,.92); color: var(--slate);
  padding: 2px 7px; border-radius: 3px; white-space: nowrap;
  border-left: 3px solid var(--hazard);
}
.tag.tag-quiet { border-left-color: var(--door); font-weight: 500; }

/* Loading */
#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; background: var(--slate); color: var(--siding); z-index: 20; transition: opacity .6s ease; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-title { font-stretch: 125%; font-weight: 800; font-size: clamp(26px, 5vw, 44px); margin: 0 0 6px; letter-spacing: .01em; }
.loading-sub { margin: 0; color: var(--door); }

/* The enamel title plate */
.plate {
  position: fixed; left: 20px; top: 20px; max-width: 380px;
  background: var(--siding); border-radius: 8px; padding: 16px 18px 14px;
  box-shadow: var(--plate-shadow); z-index: 5;
}
.plate h1 { font-stretch: 125%; font-weight: 800; font-size: 22px; line-height: 1.1; margin: 0 0 8px; letter-spacing: .005em; }
.lede { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-soft); }
.plate-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 4px 0; font-weight: 600; font-size: 14px; text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: pointer; }

/* Stops */
.stops {
  position: fixed; right: 20px; top: 20px; width: 210px;
  background: rgba(30,35,40,.86); color: var(--siding); border-radius: 8px; padding: 12px 14px; z-index: 5;
  backdrop-filter: blur(6px);
}
.stops-title { margin: 0 0 6px; font-size: 13px; color: var(--door); font-weight: 600; }
.stops ol { list-style: none; margin: 0 0 10px; padding: 0; }
.stops li button {
  width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 5px;
  font-size: 14.5px; cursor: pointer; display: flex; gap: 8px; align-items: baseline;
}
.stops li button .n { color: var(--door); font-variant-numeric: tabular-nums; font-size: 12px; width: 1.2em; }
.stops li button:hover { background: rgba(236,235,228,.08); }
.stops li button[aria-current="true"] { background: rgba(226,86,43,.22); }
.stops li button[aria-current="true"] .n { color: var(--marker); }
.toggle { display: flex; gap: 8px; align-items: center; font-size: 13.5px; padding: 4px 2px; cursor: pointer; }
.toggle input { accent-color: var(--marker); width: 16px; height: 16px; }

/* Era diamonds: the bay marker signs */
.eras {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%);
  display: flex; gap: 26px; z-index: 5; padding: 0 10px;
}
.era {
  position: relative; width: 74px; height: 74px; border: 0; background: none; cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.era::before {
  content: ""; position: absolute; inset: 11px; transform: rotate(45deg);
  background: var(--siding); border: 2px solid var(--slate); border-radius: 3px;
  box-shadow: 0 4px 14px rgba(20,24,28,.35); transition: background .2s ease;
}
.era span { position: relative; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1; }
.era small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--siding); white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.era[aria-checked="true"]::before { background: var(--marker); }
.era[aria-checked="true"] span { color: var(--slate); }
.era:hover::before { background: #F6D2C4; }
.era[aria-checked="true"]:hover::before { background: var(--marker); }
.era-caption {
  position: fixed; left: 50%; bottom: calc(130px + var(--safe-b)); transform: translateX(-50%);
  margin: 0; max-width: min(560px, 90vw); text-align: center; z-index: 4;
  color: var(--siding); font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

/* Drawers */
.drawer {
  position: fixed; left: 20px; top: 20px; bottom: 20px; width: min(420px, calc(100vw - 40px));
  background: var(--siding); border-radius: 8px; padding: 22px 22px 18px; overflow-y: auto; z-index: 10;
  box-shadow: var(--plate-shadow);
}
.drawer[hidden] { display: none; }
.drawer h2 { font-stretch: 125%; font-weight: 800; font-size: 20px; margin: 0 0 14px; padding-right: 60px; }
.drawer-close { position: absolute; top: 14px; right: 14px; background: var(--slate); color: var(--siding); border: 0; border-radius: 5px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.fact-list { list-style: none; margin: 0 0 14px; padding: 0; }
.fact-list li { padding: 10px 0; border-top: 1px solid rgba(30,35,40,.14); font-size: 15px; }
.fact-list li b { display: block; font-stretch: 112%; font-size: 18px; }
.fact-list a { font-size: 13px; color: var(--ink-soft); }
.small { font-size: 13.5px; color: var(--ink-soft); }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-grid button { border: 0; padding: 0; background: none; cursor: pointer; text-align: left; }
.photo-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 5px; display: block; }
.photo-grid span { display: block; font-size: 12.5px; margin-top: 4px; color: var(--ink-soft); line-height: 1.3; }

.compare {
  position: fixed; right: 20px; bottom: calc(20px + var(--safe-b)); width: min(380px, 40vw); margin: 0; z-index: 9;
  background: var(--siding); border-radius: 8px; padding: 8px; box-shadow: var(--plate-shadow);
}
.compare[hidden] { display: none; }
.compare img { width: 100%; display: block; border-radius: 5px; }
.compare figcaption { font-size: 13px; padding: 6px 4px 2px; color: var(--ink-soft); }
.compare .drawer-close { top: 14px; right: 14px; }

.noscript { position: fixed; inset: 0; display: grid; place-content: center; color: var(--siding); }

/* Phones */
@media (max-width: 760px) {
  .plate { left: 10px; right: 10px; top: 10px; max-width: none; padding: 12px 14px 10px; }
  .plate h1 { font-size: 18px; }
  .lede { font-size: 13.5px; margin-bottom: 6px; }
  .stops { right: 10px; left: 10px; top: auto; bottom: calc(118px + var(--safe-b)); width: auto; padding: 8px 10px; }
  .stops-title { display: none; }
  .stops ol { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 4px; scrollbar-width: none; }
  .stops li button { white-space: nowrap; padding: 6px 9px; font-size: 13.5px; }
  .toggle { display: inline-flex; margin-right: 12px; font-size: 12.5px; }
  .eras { gap: 10px; bottom: calc(20px + var(--safe-b)); }
  .era { width: 62px; height: 62px; }
  .era span { font-size: 13px; }
  .era small { font-size: 11px; }
  .era-caption { bottom: auto; top: 150px; font-size: 13.5px; }
  .drawer { left: 10px; right: 10px; top: 10px; bottom: 10px; width: auto; }
  .compare { left: 10px; right: 10px; width: auto; bottom: auto; top: 10px; }
}

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