/* ============================================================================
   Winter WanderLand — the Tonight view: a list over the map.

   The map stays mounted under everything. A sheet (.hsheet) rides over it at
   three heights on a phone (full, half, peek) and becomes a fixed left panel
   from 900px. The display card renders inside the same sheet. Everything in
   here is scoped to the Tonight view; the shared .bsheet that the tour, the
   report grid and the sleigh picker use is untouched.

   v2: no outlines, small radii, Inter, one accent. Loads after style.css.
   Tokens only.
   ========================================================================= */

/* ------------------------------------------------------- the view's chrome */

/* The app bar is for the feed and the tour. Tonight floats its own bar. */
body[data-view="map"] .appbar { display: none; }

#view-map {
  top: 0;
  --hs-lift: 0px;           /* how much of the sheet shows above the bottom edge */
}

#mapOverlay { top: calc(var(--safe-top) + 10px); }

/* the brand bar and the + beside it */
.hs-top { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

.hs-pill {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 6px 14px 6px 10px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hs-pill-mark { width: 22px; height: 22px; flex: 0 0 auto; }
.hs-pill-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.hs-pill-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -.01em;
  color: var(--text);
}
.hs-pill-season { font-size: 12px; font-weight: 400; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-pill-season b { font-weight: 600; color: var(--amber); font-variant-numeric: tabular-nums; }

.icon-btn.hs-add { box-shadow: var(--shadow); }

/* the sleighs pill and the picks row sit under the sheet's top edge at full:
   fade them rather than let them peek out */
#mapOverlay > * { transition: opacity .2s ease; }
#view-map.hs-full:not(.hs-wide) #mapOverlay > :not(.hs-top),
#view-map.hs-card:not(.hs-wide) #mapOverlay > :not(.hs-top) { opacity: 0; pointer-events: none; }

/* the report button and Leaflet's bottom corners ride on the sheet's edge */
#mapFab {
  bottom: calc(var(--hs-lift) + 12px);
  transition: bottom .26s cubic-bezier(.2, .8, .3, 1), opacity .18s ease, visibility 0s linear .18s;
}
#mapHost .leaflet-bottom {
  bottom: calc(var(--hs-lift) + 4px);
  transition: bottom .26s cubic-bezier(.2, .8, .3, 1), opacity .18s ease, visibility 0s linear .18s;
}
#view-map.hs-dragging #mapFab,
#view-map.hs-dragging #mapHost .leaflet-bottom { transition: none; }
#view-map.hs-full:not(.hs-wide) #mapFab,
#view-map.hs-card #mapFab,
#view-map.hs-full:not(.hs-wide) #mapHost .leaflet-bottom,
#view-map.hs-card #mapHost .leaflet-bottom {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* a card hides the dock: the sheet is the whole screen now */
.dock { transition: transform .26s cubic-bezier(.2, .8, .3, 1), opacity .18s ease; }
body.hs-card .dock {
  transform: translateY(calc(100% + 8px));
  opacity: 0;
  pointer-events: none;
}

/* the way back down to the map when the list fills the screen */
.hs-mappill {
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%);
  z-index: 1300;
  display: none;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px 0 13px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
}
.hs-mappill svg { width: 18px; height: 18px; color: var(--amber); }
.hs-mappill:active { background: var(--night-4); }
#view-map.hs-full:not(.hs-card):not(.hs-wide) .hs-mappill { display: inline-flex; }

/* the pin the row or the card is on */
.glow-marker.is-sel { z-index: 1000 !important; }
.glow-marker.is-sel::after {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 0 2px var(--text), 0 0 12px 3px var(--glow);
}
.glow-marker.is-on.is-sel::before { border-color: var(--text); }
.glow-marker.is-dim.is-sel::after,
.glow-marker.is-off.is-sel::after { box-shadow: 0 0 0 2px var(--text); }
/* on the day map the ring is dark so it still reads */
body[data-map-style="light"] .glow-marker.is-sel::after { box-shadow: 0 0 0 2px var(--night), 0 0 12px 3px var(--glow); }
body[data-map-style="light"] .glow-marker.is-dim.is-sel::after,
body[data-map-style="light"] .glow-marker.is-off.is-sel::after { box-shadow: 0 0 0 2px var(--night); }
body[data-map-style="light"] .glow-marker.is-on.is-sel::before { border-color: var(--night); }

/* ----------------------------------------------------------- the sheet --- */

.hsheet {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 100dvh;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: var(--night-2);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-up);
  --hs-y: calc(var(--safe-top) + 76px);
  transform: translate3d(0, var(--hs-y), 0);
  transition: transform .26s cubic-bezier(.2, .8, .3, 1);
  will-change: transform;
  overscroll-behavior: contain;
}
.hsheet.is-dragging { transition: none; }

/* the grabber: a real button, 28px tall with a 44px hit area */
.hsheet-grab {
  position: relative;
  flex: 0 0 28px;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.hsheet-grab::before {
  content: "";
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--grab);
}
.hsheet-grab::after { content: ""; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px; }
.hsheet-grab:focus-visible { outline: 2px solid var(--amber); outline-offset: -5px; border-radius: 12px; }
.hsheet.is-dragging .hsheet-grab { cursor: grabbing; }

.hsheet-list { display: flex; flex-direction: column; min-height: 0; }
.hsheet.is-card .hsheet-list { display: none; }

/* the header row: the count on the left, the map count or the List button on the right */
.hsheet-head {
  flex: 0 0 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.hsheet-title {
  margin: 0;
  min-width: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.hsheet-count { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.hsheet-listbtn { display: none; gap: 6px; }
.hsheet-listbtn svg { width: 16px; height: 16px; }
.hsheet.is-peek .hsheet-count { display: none; }
.hsheet.is-peek .hsheet-listbtn { display: inline-flex; }

.hsheet-chips { flex: 0 0 auto; margin: 0; padding: 4px 16px 12px; }
.hsheet-chips .chip .dot { width: 7px; height: 7px; }
.hsheet.is-peek .hsheet-chips { display: none; }

/* the vertical list, sized by the module once the sheet settles */
.hsheet-scroll {
  flex: 0 0 auto;
  height: var(--hs-scroll-h, 50vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 4px 16px calc(var(--dock-h) + var(--safe-bottom) + 84px);
}
.hsheet.is-peek .hsheet-scroll { display: none; }
/* the list is a column flexbox with a fixed height: nothing in it may shrink */
.hsheet-scroll > * { flex: 0 0 auto; }
.hsheet-scroll .empty { margin: 8px 0; }

/* a display in the list: a photo and two lines, no box */
.hcard {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--pin-radius);
  transition: transform .1s ease;
}
.hcard:active { transform: scale(.99); }
.hcard:focus-visible { outline: none; }
.hcard:focus-visible .hcard-media { outline: 2px solid var(--amber); outline-offset: 3px; }

.hcard-media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--pin-radius);
  background: var(--night-3);
  overflow: hidden;
}
.hcard-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
@media (hover: hover) { .hcard:hover .hcard-media img { transform: scale(1.02); transition: transform .4s ease; } }
.hcard.is-on .hcard-media { box-shadow: 0 0 0 1.5px var(--amber), 0 0 16px var(--glow); }
/* A display nobody has photographed yet: one quiet picture of a dark house
   with a single bulb lit. The small copy for thumbnails, the full one for
   the list's wide card. */
.hcard-ph {
  position: absolute;
  inset: 0;
  background: var(--night-3) url(../assets/art/no-photo_t.jpg) center / cover no-repeat;
}
.hcard .hcard-media .hcard-ph { background-image: url(../assets/art/no-photo.jpg); }

/* the glass status pill (top-left, only when there is something to say) and
   the FM pill (top-right) */
.hcard-pill {
  position: absolute;
  top: 10px; left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-family: var(--display);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.hcard-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  flex: 0 0 auto;
}
.hcard-pill.is-on { color: var(--amber); }
.hcard-pill.is-on::before { background: var(--amber); box-shadow: 0 0 6px var(--glow); }
.hcard-pill.is-off::before { background: transparent; border: 1.5px solid var(--text-3); box-sizing: border-box; }
.hcard-pill.is-dim { display: none; }
.hcard-pill.fm { left: auto; right: 10px; color: var(--text); }
.hcard-pill.fm::before { display: none; }
.hcard-pill.fm svg { width: 13px; height: 13px; color: var(--amber); }

.hcard-body { padding: 10px 2px 0; }
.hcard-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hcard-title {
  margin: 0;
  min-width: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hcard-dist {
  flex: 0 0 auto;
  font-family: var(--display);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hcard-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--text-3); }
.hcard-sub .is-on { color: var(--amber); font-weight: 500; }
/* the most-seen list: a rank before the title, a line saying what it ranks */
.hcard-rank { margin-right: 8px; color: var(--amber); font-variant-numeric: tabular-nums; }
/* the tonight line: sunset and the evening's weather, first in the list */
.hsheet-tonight {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 2px 0 -8px; font-size: 13.5px; line-height: 1.45; color: var(--text-2);
}
.hsheet-tonight[hidden] { display: none; }
.hsheet-tonight svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; color: var(--amber); }
.hsheet-note { margin: 0 0 14px; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.hsheet-foot { margin: 8px 0 4px; padding: 14px 0 6px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); text-align: center; }
.hsheet-foot a { display: inline-block; padding: 10px 2px; color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
/* Light, Match phone, Dark: under the list, where a set-once choice belongs */
.hsheet-look { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -6px 0 8px; }
.hsheet-look-k { font-size: 13px; color: var(--text-3); }
.hsheet-look .seg { flex: 0 1 auto; }
.hsheet-look .seg-btn { flex: 0 0 auto; min-height: 36px; padding: 6px 14px; font-size: 13px; }
.hsheet-chips .chip svg { width: 15px; height: 15px; }
.hsheet-chips .chip[aria-pressed="true"] .ll-icon-bookmark,
.hsheet-chips .chip[aria-pressed="true"] .ll-icon-star { fill: currentColor; }

/* loading */
.hcard.sk-card { pointer-events: none; }
.hcard-sk {
  background: linear-gradient(90deg, var(--night-2) 0%, var(--night-3) 50%, var(--night-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.hcard-sk.media { aspect-ratio: 16 / 10; border-radius: var(--pin-radius); }
.hcard-sk.line { height: 14px; border-radius: 5px; margin: 12px 2px 0; width: 58%; }
.hcard-sk.line.short { width: 36%; height: 11px; margin-top: 8px; }

/* ----------------------------------------------------------- peek row ---- */

.hsheet-row {
  display: none;
  flex: 0 0 136px;
  height: 136px;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  --hs-card-w: min(300px, 82vw);
  --hs-row-pad: calc((100vw - var(--hs-card-w)) / 2);
  padding: 8px var(--hs-row-pad);
  scroll-padding-inline: var(--hs-row-pad);
}
.hsheet-row::-webkit-scrollbar { display: none; }
.hsheet.is-peek .hsheet-row { display: flex; }

.hrow-card {
  flex: 0 0 var(--hs-card-w);
  width: var(--hs-card-w);
  height: 120px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  gap: 12px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
  background: var(--night-3);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s ease;
}
/* the plus on a card: pins the house into your tour without leaving the list */
.hcard-add {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); color: var(--text); cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .08s ease;
}
.hcard-add svg { width: 18px; height: 18px; }
.hcard-add:active { transform: scale(.94); }
.hcard-add.is-on { background: var(--amber); color: var(--amber-ink); border-color: transparent; }
.hcard-add:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hrow-thumb .hcard-add { top: 4px; right: 4px; width: 28px; height: 28px; }
.hrow-thumb .hcard-add svg { width: 15px; height: 15px; }

.hrow-card.is-sel { box-shadow: inset 0 0 0 1px var(--line-2); }
.hrow-card.is-sel .hrow-thumb { box-shadow: 0 0 0 2px var(--amber); }
.hrow-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hrow-thumb {
  position: relative;
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--night-4);
  transition: box-shadow .15s ease;
}
.hrow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hrow-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.hrow-body .hcard-pill { position: static; align-self: flex-start; min-height: 22px; padding: 1px 8px 1px 7px; font-size: 11.5px; background: var(--night-4); border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.hrow-title {
  margin: 1px 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hrow-body .hcard-sub { margin: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow-body .hcard-sub:empty { display: none; }

/* ------------------------------------------------------- the card slot --- */

.hsheet-card {
  display: none;
  flex: 0 0 auto;
  height: var(--hs-scroll-h, 50vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 0 calc(var(--safe-bottom) + 40px);
}
.hsheet.is-card .hsheet-card { display: block; }

.hcard-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 8px;
  background: var(--night-2);
}
.hcard-back { gap: 0; }

.hsheet-card .display-card,
.hsheet-card .display-card.is-on {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.hsheet-card .hcard-top { padding: 0 16px 12px; }
.hsheet-card .status-line { margin: 0 0 6px; }
.hsheet-card .card-title { font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.hsheet-card .card-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.hsheet-card .card-body { padding: 0 16px 10px; }
.hsheet-card .card-actions { padding: 2px 16px 14px; }
.hsheet-card .hcard-actions .btn svg { width: 18px; height: 18px; }
.hsheet-card .hcard-actions .navpick { flex: 0 0 auto; min-width: 44px; padding: 0 12px; }
.hsheet-card .hcard-quiet .btn { flex: 1 1 0; }
.hsheet-card .card-media { margin: 0 16px 12px; border-radius: var(--pin-radius); }
/* the card of a display with no photo: the placeholder, with what to do
   written over its dark foot */
.card-media-empty { position: relative; overflow: hidden; background: var(--night-3); }
.card-noimg { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.card-media-note {
  position: absolute; left: 16px; right: 16px; bottom: 14px; margin: 0;
  font-size: 13px; line-height: 1.4; color: var(--text-2);
}
.card-media-note b { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.hsheet-card .card-foot { padding-top: 4px; }

/* the head's right side: Save, then Share */
.hcard-head-end { display: flex; align-items: center; gap: 8px; }
.hcard-save.is-on { color: var(--amber); }
.hcard-save.is-on svg { fill: currentColor; }

/* "More on N Governor St" */
.hcard-more { padding: 2px 16px 14px; }
.hcard-more h4 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.hcard-minis {
  display: flex;
  gap: 10px;
  margin: 0 -16px;
  padding: 2px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.hcard-minis::-webkit-scrollbar { display: none; }
.hcard-mini {
  flex: 0 0 140px;
  scroll-snap-align: start;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--night-3);
}
.hcard-mini.is-on .hcard-mini-media { box-shadow: inset 0 0 0 1.5px var(--amber); }
.hcard-mini:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.hcard-mini-media { position: relative; aspect-ratio: 16 / 10; background: var(--night-4); }
.hcard-mini-media img { width: 100%; height: 100%; object-fit: cover; }
.hcard-mini span {
  display: block;
  padding: 7px 9px 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------- wide screens -- */
/* From 900px the sheet is a panel on the left, full height, no heights to
   snap to. The list and the card share it; the card row is never used. */

@media (min-width: 900px) {
  .hsheet {
    left: 0; right: auto; top: 0; bottom: 0;
    height: auto;
    width: 420px;
    transform: none;
    transition: none;
    border-radius: 0;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding-top: var(--safe-top);
  }
  .hsheet-grab, .hs-mappill { display: none; }
  .hsheet-list { flex: 1 1 auto; }
  .hsheet-head { flex-basis: auto; height: auto; min-height: 56px; padding-top: 14px; touch-action: auto; }
  .hsheet-scroll, .hsheet-card { flex: 1 1 auto; height: auto; min-height: 0; }
  .hsheet-scroll { padding-bottom: 28px; }
  .hsheet.is-peek .hsheet-scroll { display: flex; }
  .hsheet.is-peek .hsheet-chips { display: block; }
  .hsheet.is-peek .hsheet-count { display: inline; }
  .hsheet.is-peek .hsheet-listbtn, .hsheet-row { display: none; }

  #mapOverlay { left: calc(420px + 12px); }
  #mapHost .leaflet-bottom.leaflet-left { left: 420px; }
  #mapFab, #mapHost .leaflet-bottom { bottom: calc(var(--dock-h) + var(--safe-bottom) + 20px); }
}

/* ------------------------------------------------------ reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .hsheet, #mapFab, #mapHost .leaflet-bottom, .dock, .hcard { transition: none; }
  .hsheet-row, .hcard-minis { scroll-behavior: auto; }
  .hcard-sk { animation: none; background: var(--night-3); }
}
