/*
 * The front door ("Where do you work?"), the findings it opens with, the
 * Explore card that reads a reach result by neighborhood, and the clock the
 * first reveal shows. Controls keep the paper-relief material: recessed
 * wells, raised paper keys, ink for the committed action.
 */

/* ---------- The work search ---------- */
.front-door-form {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.front-door-form > label {
  color: var(--ink);
  font: 760 var(--panel-label)/1.1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.front-door-input-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--relief-edge-strong, rgba(55, 45, 31, 0.22));
  border-radius: 12px;
  background: var(--relief-paper, #fbfaf4);
  box-shadow:
    inset 0 2px 4px rgba(55, 45, 31, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color var(--motion-duration-fast) var(--ease-crisp), box-shadow var(--motion-duration-fast) var(--ease-crisp);
}

.front-door-input-row:focus-within {
  border-color: var(--ink);
  box-shadow:
    inset 0 2px 4px rgba(55, 45, 31, 0.12),
    0 0 0 3px rgba(201, 53, 43, 0.16);
}

.front-door-input-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 13px;
  fill: none;
  stroke: rgba(17, 16, 14, 0.62);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.front-door-input-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 var(--panel-body)/1.2 var(--font-main);
  outline: none;
}

.front-door-input-row input::placeholder {
  color: rgba(17, 16, 14, 0.5);
}

.front-door-results:empty {
  display: none;
}

.front-door-results {
  display: grid;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--relief-edge, rgba(55, 45, 31, 0.14));
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(36, 30, 20, 0.12);
}

/* Hubs use the house "slip" chips (as Find a Home's common destinations). */
.front-door-hubs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.front-door-hubs button {
  min-width: 0;
  min-height: 36px;
  padding-block: 6px;
  padding-inline: 10px;
  font: 680 var(--panel-label)/1.1 var(--font-main);
  text-wrap: balance;
  cursor: pointer;
  transition: transform var(--motion-duration-fast) var(--ease-crisp);
}

.front-door-hubs button:is(:hover, :focus-visible) {
  transform: translateY(-1px);
}

.front-door-hubs button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.front-door-hubs button:active {
  transform: scale(var(--motion-press-scale, 0.985));
}

/* ---------- Desktop welcome ---------- */
@media (min-width: 761px) and (min-height: 600px) {
  body.has-network-overview:not(.is-network-story-open) .side-panel > .desktop-atlas-welcome {
    align-content: start;
    gap: 13px;
    padding-top: clamp(22px, 3.2vh, 40px);
  }

  .desktop-atlas-welcome h2 {
    max-width: 16ch;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-stories {
    padding-top: 12px;
  }

  .desktop-atlas-welcome-starters-title {
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid rgba(17, 16, 14, 0.16);
    color: rgba(17, 16, 14, 0.58);
    font: 760 var(--panel-label)/1.15 var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* The station photos step back to a secondary path. */
  .desktop-atlas-welcome .desktop-atlas-welcome-starters button {
    grid-template-rows: minmax(40px, auto) auto;
    min-height: 84px;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-story-grid.front-door-findings {
    grid-template-columns: minmax(0, 1fr);
  }

  .desktop-atlas-welcome .front-door-findings button {
    min-height: 0;
    gap: 6px;
    padding: 10px 11px 9px;
  }
}

/* ---------- Findings: two places, minutes as bars ---------- */
.front-door-findings button strong span[translate="no"] {
  color: var(--ink);
}

.front-door-findings button > small {
  color: rgba(17, 16, 14, 0.58);
  font: 600 var(--type-label)/1.2 var(--font-main);
}

/* A fixed name column keeps both bars on one baseline. */
.front-door-finding-row {
  display: grid;
  grid-template-columns: minmax(4em, 9.5em) minmax(28px, 1fr) auto 3.4em;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font: 600 var(--type-label)/1.2 var(--font-main);
}

.front-door-finding-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.front-door-finding-row > i {
  display: block;
  width: calc(min(var(--minutes, 0), 60) / 60 * 100%);
  height: 7px;
  border-radius: 4px;
  background: #6290dc;
  transform-origin: left center;
  animation: front-door-bar 900ms var(--motion-ease-enter) both;
}

.front-door-finding-row.is-near > i {
  background: #eab92c;
}

.front-door-finding-row > b {
  font: 760 var(--type-label)/1 var(--font-mono);
  text-align: right;
  white-space: nowrap;
}

.front-door-finding-row > small {
  color: rgba(17, 16, 14, 0.58);
  font: 600 var(--type-label)/1 var(--font-mono);
  text-align: right;
  white-space: nowrap;
}

@keyframes front-door-bar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------- Phone launch card ---------- */
@media (max-width: 980px) {
  .mobile-launch-card.is-front-door {
    gap: 10px;
  }

  .mobile-launch-card.is-front-door .front-door-form > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .mobile-launch-card.is-front-door .front-door-hubs {
    display: flex;
    flex-wrap: nowrap;
    margin-inline: -2px;
    padding: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-launch-card.is-front-door .front-door-hubs button {
    flex: none;
    min-height: 38px;
  }

  .mobile-launch-starters-title {
    color: rgba(17, 16, 14, 0.58);
    font: 760 var(--type-label)/1.15 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mobile-launch-card.is-front-door .mobile-launch-actions {
    display: grid;
    gap: 6px;
  }
}

/* ---------- Explore: the reach by neighborhood ---------- */
.reach-neighborhoods[hidden] {
  display: none !important;
}

.reach-neighborhoods {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.side-panel > .reach-neighborhoods.details-card {
  padding: 18px 18px 16px;
  border: 1px solid rgba(17, 16, 14, 0.14);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: 0 8px 22px rgba(36, 30, 20, 0.06);
  animation: reach-neighborhoods-in 520ms var(--motion-ease-enter) both;
}

.reach-neighborhoods-head {
  display: grid;
  gap: 4px;
}

.reach-neighborhoods-kicker {
  color: var(--accent);
  font: 780 var(--panel-label)/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.reach-neighborhoods-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 2px 0 0;
  color: var(--ink);
  font: 650 var(--panel-lead)/1.15 var(--font-display);
}

.reach-neighborhoods-count b {
  font: 760 var(--panel-metric)/0.95 var(--font-display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.reach-neighborhoods-count b.is-pending {
  color: rgba(17, 16, 14, 0.36);
}

.reach-neighborhoods-basis {
  margin: 0;
  color: rgba(17, 16, 14, 0.62);
  font: 560 var(--panel-label)/1.35 var(--font-main);
}

.reach-neighborhoods-basis i {
  font-style: normal;
}

.reach-neighborhoods-rent {
  display: grid;
  gap: 6px;
}

.reach-neighborhoods-rent h4 {
  margin: 0;
  color: rgba(17, 16, 14, 0.66);
  font: 760 var(--panel-label)/1.1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reach-neighborhoods-rent ol {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reach-neighborhoods-rent li + li {
  border-top: 1px solid rgba(17, 16, 14, 0.1);
}

.reach-neighborhoods-rent li > button {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) auto 5.2em;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.reach-neighborhoods-rent li > button:is(:hover, :focus-visible) .reach-neighborhoods-name {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.reach-neighborhoods-rent li > button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* Long names wrap to a second line rather than lose their end. */
.reach-neighborhoods-name {
  display: -webkit-box;
  overflow: hidden;
  font: 650 var(--panel-body)/1.2 var(--font-main);
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* The row's number, as on its badge on the map. */
.reach-neighborhoods-rank {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper, #fffdf7);
  font: 700 0.6875rem/1 var(--font-mono);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.reach-neighborhoods-rent b {
  color: rgba(17, 16, 14, 0.7);
  font: 650 var(--panel-label)/1 var(--font-mono);
  white-space: nowrap;
}

.reach-neighborhoods-rent em {
  font: 760 var(--panel-body)/1 var(--font-mono);
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* A city-wide average is shared by many areas; it says so. */
.reach-neighborhoods-rent em small {
  display: block;
  margin-top: 2px;
  color: rgba(17, 16, 14, 0.56);
  font: 600 0.625rem/1 var(--font-main);
  letter-spacing: 0.02em;
}

.reach-neighborhoods-note {
  margin: 0;
  color: rgba(17, 16, 14, 0.56);
  font: 520 var(--type-label)/1.35 var(--font-main);
}

/* One line says what the list means; the fine print waits behind this. */
.reach-neighborhoods-how {
  display: grid;
  gap: 4px;
}

.reach-neighborhoods-how > summary {
  width: fit-content;
  color: rgba(17, 16, 14, 0.66);
  font: 650 var(--type-label)/1.35 var(--font-main);
  text-decoration: underline;
  text-decoration-color: rgba(17, 16, 14, 0.28);
  text-underline-offset: 3px;
  cursor: pointer;
}

.reach-neighborhoods-how > summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Places that work by day but not at 10 pm. */
.reach-neighborhoods-dropped {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin: 0;
  color: var(--ink);
  font: 560 var(--type-label)/1.35 var(--font-main);
}

.reach-neighborhoods-dropped > span:first-child {
  color: var(--accent);
  font-weight: 760;
}

.reach-neighborhoods-rent .reach-neighborhoods-dropped-place b {
  color: var(--ink);
  font: 700 var(--type-label)/1.35 var(--font-main);
  white-space: normal;
}

.reach-neighborhoods-dropped-place > span {
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* The lens tray (modules/lens-tray.js): a recessed well of six keys with one
   ink carriage, the house's segmented control (the mode switch's carriage),
   here in a 3 × 2 grid. Overview's "Where to live" lenses and Life From
   Here's categories use it. The carriage sits in the chosen cell by
   --lens-col / --lens-row; switching slides it there with the mode switch's
   settle. */
.reach-neighborhoods-rent,
.lens-tray {
  min-width: 0;
}

.lens-tray {
  --lens-pad: 4px;
  --lens-gap: 3px;
  --lens-duration: 285ms;
  --lens-ease: cubic-bezier(0.2, 0.86, 0.24, 1);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--lens-gap);
  margin-bottom: 6px;
  padding: var(--lens-pad);
  border-radius: var(--relief-segment-radius, 12px);
  background: var(--relief-segment-tray-strong, rgba(226, 217, 201, 0.52));
  box-shadow: var(--relief-inset, inset 0 1px 3px rgba(55, 45, 31, 0.095), inset 0 0 0 1px rgba(55, 45, 31, 0.065));
}

.lens-tray-carriage {
  position: absolute;
  z-index: 0;
  top: var(--lens-pad);
  left: var(--lens-pad);
  width: calc((100% - 2 * var(--lens-pad) - 2 * var(--lens-gap)) / 3);
  height: calc((100% - 2 * var(--lens-pad) - var(--lens-gap)) / 2);
  border: 1px solid rgba(0, 0, 0, 0.72);
  border-radius: var(--relief-segment-radius-inner, 8px);
  background: var(--ink);
  box-shadow: 0 3px 8px rgba(17, 16, 14, 0.17), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  pointer-events: none;
  transform: translate(calc(var(--lens-col, 0) * (100% + var(--lens-gap))), calc(var(--lens-row, 0) * (100% + var(--lens-gap))));
}

.lens-tray.is-moving .lens-tray-carriage {
  transition: transform var(--lens-duration) var(--lens-ease);
}

/* The mode switch's rubber settle, where the browser can express it. */
@supports (transition-timing-function: linear(0, 1)) {
  .lens-tray {
    --lens-duration: var(--motion-duration-slow, 420ms);
    --lens-ease: linear(0, 0.4 15%, 0.76 30%, 0.96 48%, 1.012 65%, 1.004 82%, 1);
  }
}

html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control][data-atlas-control] {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 52px;
  padding: 7px 4px 6px;
  border: 0;
  border-radius: var(--relief-segment-radius-inner, 8px);
  background: transparent;
  box-shadow: none;
  color: rgba(17, 16, 14, 0.62);
  font: 650 var(--panel-label)/1.12 var(--font-ui);
  text-align: center;
  overflow-wrap: normal;
  transition: color 180ms ease, background-color 180ms ease, transform 120ms ease;
}

/* The house tab's underline belongs to tabs, not to this carriage. */
html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control]::after {
  content: none;
}

html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control][aria-pressed="true"] {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #fffdf7;
}

@media (hover: hover) {
  html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control][aria-pressed="false"]:hover {
    border: 0;
    background: rgba(255, 253, 247, 0.62);
    color: var(--ink);
  }
}

html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control]:active {
  transform: scale(0.97);
}

html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control]:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 2px rgba(17, 16, 14, 0.34);
}

html:is([data-material-prototype], :not([data-material-prototype])) body .lens-tray > .lens-tray-key[data-atlas-control][aria-pressed="true"]:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 253, 247, 0.72);
}

.lens-tray-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--lens-duration, 285ms) var(--lens-ease, ease);
}

/* The chosen icon lifts a touch as the carriage arrives under it. */
.lens-tray-key[aria-pressed="true"] .lens-tray-icon {
  transform: translateY(-1px) scale(1.06);
}

/* Rows settle in when the list changes: a short rise, one after another. */
.reach-neighborhoods-lens ol.is-entering > li {
  animation: reach-lens-row-in 300ms var(--motion-ease-enter, cubic-bezier(0.22, 1, 0.36, 1)) both;
  animation-delay: calc(var(--row-index, 0) * 40ms);
}

@keyframes reach-lens-row-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lens-tray.is-moving .lens-tray-carriage,
  .lens-tray-icon {
    transition: none;
  }

  .reach-neighborhoods-lens ol.is-entering > li {
    animation: none;
  }
}

.reach-neighborhoods-lens-summary {
  margin: 0;
  color: var(--ink);
  font: 650 var(--panel-body)/1.3 var(--font-main);
}

.reach-neighborhoods-note.is-pending {
  color: rgba(17, 16, 14, 0.42);
}

.reach-neighborhoods-finding {
  display: grid;
  gap: 7px;
  padding: 11px 12px 10px;
  border-radius: 10px;
  background: rgba(98, 144, 220, 0.08);
}

.reach-neighborhoods-finding .reach-neighborhoods-kicker {
  color: #1c2f7e;
}

.reach-neighborhoods-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reach-neighborhoods-actions button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--relief-edge-strong, rgba(55, 45, 31, 0.22));
  border-radius: 8px;
  background: var(--relief-control-paper-bright, #fffdf7);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 1px 2px rgba(55, 45, 31, 0.14);
  font: 700 var(--panel-label)/1.1 var(--font-main);
  cursor: pointer;
  transition: transform var(--motion-duration-fast) var(--ease-crisp), border-color var(--motion-duration-fast) var(--ease-crisp);
}

.reach-neighborhoods-actions [data-reach-rank-homes] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 6px rgba(17, 16, 14, 0.22);
}

.reach-neighborhoods-actions button:is(:hover, :focus-visible) {
  transform: translateY(-1px);
}

.reach-neighborhoods-actions button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.reach-neighborhoods-actions button:active {
  transform: scale(var(--motion-press-scale, 0.985));
}

@keyframes reach-neighborhoods-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* The stop count steps back to a supporting figure under it. */
@media (min-width: 761px) {
  body.is-map-active.is-reach-mode.has-origin.has-reach-neighborhoods:not(.is-comparison-surface) #reachValue .reach-station-count b {
    font-size: 30px;
    line-height: 1;
  }
}

/* Phone: the card sits in the sheet under the reach summary. */
@media (max-width: 980px) {
  .reach-neighborhoods.is-mobile {
    gap: 12px;
    margin: 0 10px 12px;
    padding: 14px 14px 12px;
    border: 1px solid rgba(17, 16, 14, 0.14);
    border-radius: 14px;
    background: rgba(255, 253, 247, 0.9);
  }

  .reach-neighborhoods.is-mobile .reach-neighborhoods-count b {
    font-size: 1.75rem;
  }

  .reach-neighborhoods.is-mobile .reach-neighborhoods-actions button {
    flex: 1 1 auto;
    min-height: 42px;
  }

  /* Collapsed, the sheet shows the dock alone. */
  #mobileSheet[data-snap="collapsed"] .reach-neighborhoods.is-mobile {
    display: none;
  }
}

@media (min-width: 981px) {
  .reach-neighborhoods.is-mobile {
    display: none !important;
  }
}

/* ---------- The first reveal's clock ---------- */
.reach-story-clock[hidden] {
  display: none;
}

.reach-story-clock {
  position: absolute;
  z-index: 6;
  top: 76px;
  left: 50%;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: baseline;
  column-gap: 6px;
  min-width: 132px;
  padding: 9px 16px 8px;
  border: 1px solid rgba(17, 16, 14, 0.18);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 10px 26px rgba(36, 30, 20, 0.16);
  color: var(--ink);
  pointer-events: none;
  transform: translateX(-50%);
  animation: reach-story-clock-in 360ms var(--motion-ease-enter) both;
}

.reach-story-clock b {
  font: 760 2rem/0.95 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 2ch;
}

.reach-story-clock span {
  font: 700 var(--panel-label)/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reach-story-clock small {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: rgba(17, 16, 14, 0.62);
  font: 600 var(--type-label)/1.1 var(--font-main);
  text-align: center;
  white-space: nowrap;
}

.reach-story-clock.is-leaving {
  animation: reach-story-clock-out 900ms ease-in 300ms both;
}

@keyframes reach-story-clock-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes reach-story-clock-out {
  to { opacity: 0; transform: translate(-50%, -4px); }
}

@media (max-width: 980px) {
  .reach-story-clock {
    top: calc(env(safe-area-inset-top, 0px) + 128px);
    min-width: 116px;
    padding: 7px 13px 6px;
  }

  .reach-story-clock b {
    font-size: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .front-door-finding-row > i,
  .reach-neighborhoods,
  .reach-story-clock {
    animation: none !important;
  }
}

/* ---------- Phone: the time key stops covering the map's middle ---------- */
/* It keeps its readable type but loses the footnote line (the dock and sheet
   already state the schedule), and sits right, just above the sheet. */
@media (max-width: 760px), (max-width: 980px) and (orientation: portrait), (max-width: 980px) and (max-height: 599px) {
  html body.is-map-active.is-reach-mode.has-origin:not(.is-time-rings-view):not(.is-mobile-sheet-expanded) .map-frame #legend.legend.is-isochrone-toggle {
    left: auto;
    right: 12px;
    width: min(232px, calc(100vw - 148px));
    padding: 6px 9px;
    bottom: calc(var(--mobile-map-bottom-clearance, 182px) + 10px);
  }

  html body.is-map-active.is-reach-mode.has-origin:not(.is-time-rings-view) #legend.legend.is-isochrone-toggle .legend-foot {
    display: none;
  }
}

/* Collapsed, the launch card keeps the question and the work search; the
   station starters and survey wait for a raised sheet. */
@media (max-width: 980px) {
  #mobileSheet[data-snap="collapsed"] .mobile-launch-card.is-front-door :is(.mobile-launch-actions, .mobile-launch-copy) {
    display: none;
  }
}

/* ---------- The desktop welcome fits its panel ---------- */
/* Headline, search, hubs and findings come first and fit a 900px window
   without scrolling; the station photos follow, and the network survey
   joins them where there is room. */
@media (min-width: 761px) and (min-height: 600px) {
  body.has-network-overview:not(.is-network-story-open) .side-panel > .desktop-atlas-welcome {
    gap: 11px;
    padding-top: clamp(18px, 2.6vh, 34px);
    padding-bottom: 16px;
  }

  .desktop-atlas-welcome h2 {
    max-width: none;
    font-size: clamp(1.5rem, 2.05vw, 2rem);
    line-height: 1.04;
    text-wrap: balance;
  }

  .desktop-atlas-welcome > p {
    font-size: var(--panel-label);
    line-height: 1.45;
  }

  .desktop-atlas-welcome .front-door-hubs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .desktop-atlas-welcome .front-door-hubs button {
    min-height: 32px;
    padding-block: 5px;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-stories {
    gap: 6px;
    padding-top: 10px;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-story-grid.front-door-findings {
    gap: 4px;
  }

  .desktop-atlas-welcome .front-door-findings button {
    gap: 3px;
    padding: 7px 10px 6px;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-starters-title {
    padding-top: 10px;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-starters button {
    grid-template-rows: minmax(34px, auto) auto;
    min-height: 70px;
  }
}

/* Below 1000px the survey keeps only its title row: still one click away. */
@media (min-width: 761px) and (min-height: 600px) and (max-height: 999px) {
  body.has-network-overview:not(.is-network-story-open) .side-panel > .desktop-atlas-welcome .desktop-atlas-survey-body {
    display: none;
  }
}

@media (min-width: 761px) and (min-height: 600px) {
  .desktop-atlas-welcome > p {
    max-width: 48ch;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-starters .atlas-starter-art {
    height: 40px;
    overflow: hidden;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-starters .atlas-starter-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .desktop-atlas-welcome .desktop-atlas-welcome-starters button {
    grid-template-rows: 40px auto;
    min-height: 0;
  }
}

/* The house slip chip, at the welcome's compact size (it outranks plain
   selectors, so this matches its specificity). */
@media (min-width: 761px) and (min-height: 600px) {
  html[data-material-prototype] body.is-map-active .desktop-atlas-welcome .front-door-hubs [data-atlas-control="slip"][data-atlas-control] {
    min-height: 30px;
    padding: 4px 10px;
    font-size: var(--type-label);
  }
}

/* Phone touch targets are at least 44px, as everywhere in the sheet. */
@media (max-width: 980px) {
  .reach-neighborhoods.is-mobile .reach-neighborhoods-actions button,
  .reach-neighborhoods.is-mobile .reach-neighborhoods-rent li > button,
  .reach-neighborhoods.is-mobile .reach-neighborhoods-how > summary,
  .mobile-launch-card.is-front-door .front-door-hubs button {
    min-height: 44px;
  }

  .reach-neighborhoods.is-mobile .reach-neighborhoods-how > summary {
    padding-block: 12px;
  }

  html[data-material-prototype] body.is-map-active .mobile-launch-card.is-front-door .front-door-hubs [data-atlas-control="slip"][data-atlas-control],
  html:is([data-material-prototype], :not([data-material-prototype])) body :is(.reach-neighborhoods.is-mobile, .mobile-sheet .destination-discovery) .lens-tray > .lens-tray-key[data-atlas-control][data-atlas-control] {
    min-height: 44px;
  }
}

/* ---------- 981–1120px: the welcome floats over the map ---------- */
/* At these widths the map owns the frame until a station is chosen
   (atlas-cartography.css). The front door is the empty state's task, so
   the welcome panel floats over the map's right edge instead of vanishing. */
@media (min-width: 981px) and (max-width: 1120px) and (min-height: 600px) {
  body.is-map-active.has-network-overview:not(.has-origin) .side-panel {
    display: flex;
    position: fixed;
    top: 142px;
    right: 26px;
    bottom: 26px;
    z-index: 30;
    width: min(380px, 42vw);
    border: 1px solid rgba(17, 16, 14, 0.14);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 14px 34px rgba(36, 30, 20, 0.16);
  }
}

/* ---------- Card states and phone starters ---------- */
.front-door-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Between results for the same place, the last reading stays, dimmed. */
.reach-neighborhoods.is-updating > * {
  opacity: 0.55;
  transition: opacity var(--motion-duration-base) var(--ease-crisp);
}

/* Phone station starters wrap rather than clip their names. */
@media (max-width: 980px) {
  html body.is-map-active .mobile-launch-card.is-front-door .mobile-launch-actions nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  html[data-material-prototype] body.is-map-active .mobile-launch-card.is-front-door .mobile-launch-actions nav [data-atlas-control="slip"][data-atlas-control] {
    min-width: 0;
    min-height: 44px;
    padding: 6px 8px;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    line-height: 1.15;
    text-wrap: balance;
  }

  html body.is-map-active .mobile-launch-card.is-front-door .mobile-network-story-button {
    justify-self: start;
    white-space: nowrap;
  }
}

/* Phone station starters: names first, no place ring, full height. */
@media (max-width: 980px) {
  html[data-material-prototype] body.is-map-active .mobile-launch-card.is-front-door .mobile-launch-actions nav [data-atlas-control="slip"]::before {
    display: none;
  }

  html[data-material-prototype] body.is-map-active .mobile-launch-card.is-front-door .mobile-launch-actions nav [data-atlas-control="slip"][data-atlas-control] {
    height: auto;
    max-height: none;
    text-align: center;
  }
}

/* In the sheet's grid order: under its head (title, share), before the
   mode switch and the reach summary. */
@media (max-width: 980px) {
  #mobileSheet > #mobileReachNeighborhoods {
    order: 2;
  }
}

/* ---------- Overview · Life From Here · Details ---------- */
/* Overview (the tab id "station") leads with the neighborhood card; while
   it shows, the stop figures and station profile move to Details. Life From
   Here and Details never repeat the card. */
body.is-map-active.is-reach-mode.has-origin.has-reach-neighborhoods .side-panel[data-atlas-tab="station"] > :is(.score-card, #stationDetailsCard, #stationDataNoteCard, #stationRoleCard) {
  display: none;
}

body.is-map-active.is-reach-mode.has-origin .side-panel:is([data-atlas-tab="life"], [data-atlas-tab="details"]) > #reachNeighborhoodsCard,
body.is-map-active.is-reach-mode.has-origin .side-panel[data-atlas-tab="details"] > #reachDetailsCard {
  display: none !important;
}

/* Details drops the figures nobody could read without a gloss: the share of
   the network and the adjacency rank. Arriving, the workplace's own rent. */
body.has-reach-neighborhoods #reachNetworkTagline,
body.has-reach-neighborhoods .origin-fact.is-stops .origin-fact-series,
body.is-arrival-reach .origin-fact.is-rent {
  display: none !important;
}

@media (max-width: 980px) {
  body.is-map-active.is-reach-mode.has-origin.has-reach-neighborhoods #mobileSheet[data-atlas-tab="station"] > :is(#mobilePrimarySummary, #mobileInspector, #mobileCompassSummary) {
    display: none;
  }

  body.is-map-active #mobileSheet:is([data-atlas-tab="life"], [data-atlas-tab="details"]) > #mobileReachNeighborhoods,
  body.is-map-active.is-reach-mode.has-origin #mobileSheet[data-atlas-tab="details"] > :is(#mobileReachDetails, .mobile-surface-story-toggle) {
    display: none !important;
  }

  /* The three tabs sit straight under the sheet's head, above what they switch. */
  body.is-map-active.is-reach-mode.has-origin.has-reach-neighborhoods #mobileSheet > .atlas-dossier-tabs.is-mobile:not([hidden]) {
    order: 1;
  }
}

.reach-neighborhoods-farthest {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  margin: 0;
  color: rgba(17, 16, 14, 0.62);
  font: 560 var(--panel-label)/1.35 var(--font-main);
}

.reach-neighborhoods-farthest b {
  color: var(--ink);
  font-weight: 700;
}

/* Three tabs when Details is offered. */
.atlas-dossier-tabs:has(> [data-atlas-dossier-tab="details"]:not([hidden])) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reach-neighborhoods-farthest > span:first-child {
  color: rgba(17, 16, 14, 0.56);
  font: 760 var(--type-label)/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reach-neighborhoods-farthest i {
  font-style: normal;
}

/* Leaving from a station, the list above the lenses says how it reads. */
.reach-neighborhoods-lens-frame {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin: 0 0 4px;
  color: rgba(17, 16, 14, 0.66);
  font: 600 var(--panel-label)/1.3 var(--font-main);
}
