/* OpenSeat W&M — dashboard page styles. Tokens come from style.css; no literal colours here. */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { overflow-x: hidden; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 2000;
  background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.section { padding-block: 40px 8px; scroll-margin-top: 64px; }
#spots, #map { scroll-margin-top: 64px; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.section-head .eyebrow { margin-bottom: 4px; }
.section-note { font-size: var(--fs-sm); max-width: 36ch; }

/* ---------- skeletons ---------- */
.skel {
  display: inline-block; vertical-align: middle; border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite;
}
.skel-line { width: min(260px, 70%); height: 0.9em; }
.skel-pill { width: 128px; height: 22px; }
.skel-short { width: 120px; height: 0.8em; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- hero ---------- */
.hero { padding-block: 28px 8px; }
.hero-inner { display: grid; gap: 24px; align-items: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--brand); }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--occ-low);
  --c: var(--occ-low); animation: occ-pulse 2.4s ease-out infinite;
}
.hero h1 { font-size: clamp(1.85rem, 7vw, 3rem); max-width: 18ch; }
.hero-live { margin-top: 14px; font-size: var(--fs-md); min-height: 1.6em; color: var(--fg); }
.hero-live-num {
  display: inline-block; min-width: 2ch; padding: 1px 8px; margin-right: 2px; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--brand-ink); font-weight: 700; text-align: center;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: var(--fs-md); }
.btn-ghost { background: transparent; }
.hero-actions .btn-primary { flex: 1 1 220px; }
.hero-actions .btn-ghost { flex: 0 1 auto; min-height: 52px; }
@media (max-width: 479px) { .hero-actions .btn-ghost { display: none; } }
body[data-status="error"] .board.is-empty { display: none; }

/* the "departure board" */
.board {
  padding: 16px 16px 8px; border-top: 4px solid var(--accent);
  background: var(--surface);
}
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.board-title { font-size: var(--fs-sm); font-family: var(--font-body); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
.board-clock { font-size: var(--fs-xs); color: var(--fg-muted); }
.board-rows { list-style: none; margin: 0; padding: 0; }
.board-row { border-top: 1px dashed var(--line); }
.board-row:first-child { border-top: none; }
.board-row.is-skel { padding: 13px 0; }
.board-link {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-areas: "dot name pct" ". age age";
  align-items: center; column-gap: 10px; row-gap: 0; padding: 10px 0; color: var(--fg); text-decoration: none;
}
.board-link:hover .board-name { text-decoration: underline; text-underline-offset: 3px; }
.board-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 2px; background: var(--occ-none); }
.board-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-pct { grid-area: pct; font-size: var(--fs-lg); font-weight: 700; color: var(--occ-none); text-align: right; }
.board-age { grid-area: age; font-size: var(--fs-xs); }
.board-dot[data-level="low"] { background: var(--occ-low); }
.board-dot[data-level="medium"] { background: var(--occ-medium); }
.board-dot[data-level="high"] { background: var(--occ-high); }
.board-dot[data-level="full"] { background: var(--occ-full); }
.board-pct[data-level="low"] { color: var(--occ-low); }
.board-pct[data-level="medium"] { color: var(--occ-medium); }
.board-pct[data-level="high"] { color: var(--occ-high); }
.board-pct[data-level="full"] { color: var(--occ-full); }
.board-row:nth-child(n+4) { display: none; }

@media (min-width: 900px) {
  .hero { padding-block: 48px 16px; }
  .hero-inner { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 48px; }
  .hero-actions .btn-primary { flex: 0 0 auto; }
  .board { padding: 20px 22px 10px; }
  .board-link { grid-template-columns: 10px minmax(0, 1fr) auto auto; grid-template-areas: "dot name age pct"; column-gap: 14px; }
  .board-age { text-align: right; }
  .board-row:nth-child(n+4) { display: block; }
  body[data-status="error"] .hero-inner:has(.board.is-empty) { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- toolbar: chips + sort ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; width: 100%; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%;
  margin-inline: -16px; padding-inline: 16px; padding-block: 2px 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chips .chip { flex: 0 0 auto; min-height: 40px; font-weight: 500; }
.chip-count { font-size: var(--fs-xs); color: var(--fg-muted); }
.sort-field { flex: 1 1 100%; }
.sort-field select { min-height: 44px; font-size: var(--fs-sm); padding-right: 32px; }
@media (min-width: 720px) {
  .toolbar { width: auto; flex-wrap: nowrap; }
  .chips { flex: 0 1 auto; margin-inline: 0; padding-inline: 2px; }
  .sort-field { flex: 0 0 180px; }
}

/* ---------- notice ---------- */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 20px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--fg); font-size: var(--fs-sm);
}
.notice[hidden] { display: none; }
.notice-btn {
  min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--fg-muted);
  background: transparent; color: var(--fg); font: 600 var(--fs-sm)/1 var(--font-body); cursor: pointer;
}

/* ---------- groups + tiles ---------- */
.spot-groups { display: grid; gap: 32px; }
.spot-group { display: grid; gap: 14px; }
.group-title { font-size: var(--fs-lg); display: flex; align-items: baseline; gap: 8px; }
.group-count { font-size: var(--fs-sm); font-weight: 500; }
.group-note { font-size: var(--fs-sm); }

.tile-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-grid--featured { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}

.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 16px 14px; color: var(--fg); text-decoration: none; min-width: 0;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--radius); }
.tile:active { transform: translateY(0); }

.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-type {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted);
}
.tile[data-type="library"] .tile-type { color: var(--brand); }
.open-badge {
  font: 700 0.68rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 4px; border: 1px solid currentColor;
}
.open-badge[data-open="true"] { color: var(--success); }
.open-badge[data-open="false"] { color: var(--fg-muted); }

.tile-name { font-size: 1.3rem; padding-right: 24px; }
.tile-desc {
  font-size: var(--fs-sm); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-desc { display: none; }
@media (min-width: 640px) { .tile-desc { display: -webkit-box; } }
.tile-offcampus {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: var(--fs-xs); font-weight: 600; color: var(--fg); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 999px;
}
.tile-offcampus svg { color: var(--accent); }
.tile-status { display: flex; align-items: center; gap: 8px; min-height: 24px; margin-top: 2px; }
.tile-pill .occ-pill { font-size: var(--fs-sm); padding: 4px 12px 4px 10px; }
.tile-updated { font-size: var(--fs-xs); min-height: 1.4em; margin-top: -2px; }
.tile-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--fs-xs);
}
.tile-hours { color: var(--fg-muted); }
.rating { display: inline-flex; align-items: center; gap: 5px; }
.rating-num { font-weight: 700; }
.tile-arrow {
  position: absolute; top: 40px; right: 16px; font-size: 1.1rem; color: var(--fg-muted);
  transition: transform .15s, color .15s;
}
.tile:hover .tile-arrow { color: var(--brand); transform: translateX(3px); }

@media (min-width: 1024px) {
  .tile--featured { padding: 20px 20px 16px; gap: 12px; }
  .tile--featured .tile-name { font-size: 1.6rem; }
  .tile--featured .tile-arrow { top: 46px; right: 20px; }
}

/* occupancy bar with threshold ticks (30 / 60 / 85 %) */
.occ-bar {
  --c: var(--occ-none);
  position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.occ-bar[data-level="low"] { --c: var(--occ-low); }
.occ-bar[data-level="medium"] { --c: var(--occ-medium); }
.occ-bar[data-level="high"] { --c: var(--occ-high); }
.occ-bar[data-level="full"] { --c: var(--occ-full); }
.occ-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: inherit; transition: width .6s ease; }
.occ-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--surface); opacity: .9; }
.occ-bar[data-level="none"]:not(.is-loading) {
  background: repeating-linear-gradient(90deg, var(--surface-2) 0 6px, transparent 6px 10px);
  outline: 1px solid var(--line); outline-offset: -1px;
}
.occ-bar.is-loading { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; }

.empty { padding: 24px; display: grid; gap: 10px; justify-items: start; }

/* ---------- map ---------- */
.map-frame { overflow: hidden; padding: 0; position: relative; }
.campus-map { height: min(60vh, 420px); min-height: 300px; width: 100%; background: var(--surface-2); z-index: 0; }
@media (min-width: 900px) { .campus-map { height: 440px; } }
.map-fallback { height: 100%; display: grid; place-content: center; text-align: center; gap: 6px; padding: 24px; }

.leaflet-container { font-family: var(--font-body); }
.leaflet-container a { color: var(--brand); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.78) saturate(.8) contrast(1.05); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.78) saturate(.8) contrast(1.05); }

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border-radius: var(--radius); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 14px 16px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--fg-muted); width: 32px; height: 32px; font-size: 20px; line-height: 30px; }
.map-pop { display: grid; gap: 6px; }
.leaflet-popup-content .map-pop p { margin: 0; }
.map-pop-type { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); padding-right: 18px; }
.map-pop-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.15; }
.map-pop-hours { font-size: var(--fs-xs); color: var(--fg-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-pop-link { font-weight: 600; font-size: var(--fs-sm); margin-top: 2px; }

.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--fg); border-color: var(--line); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--fg-muted); }
.map-ctl-btn {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font: 600 var(--fs-xs)/1.2 var(--font-body); cursor: pointer; box-shadow: var(--shadow);
}
.map-ctl-btn:hover { border-color: var(--brand); }

/* markers: occupancy colour; libraries are squares, other spots circles */
.pin-wrap { background: none; border: none; }
.pin {
  --c: var(--occ-none);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); color: var(--surface); border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgb(0 0 0 / .35); font: 700 11px/1 var(--font-mono); letter-spacing: -0.02em;
  transition: transform .15s;
}
.pin--library { border-radius: 7px; }
.pin[data-level="low"] { --c: var(--occ-low); }
.pin[data-level="medium"] { --c: var(--occ-medium); }
.pin[data-level="high"] { --c: var(--occ-high); }
.pin[data-level="full"] { --c: var(--occ-full); }
.pin-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface); opacity: .85; }
.pin--library .pin-dot { border-radius: 2px; }
.leaflet-marker-icon:hover .pin, .leaflet-marker-icon:focus-visible .pin { transform: scale(1.12); }
.leaflet-marker-icon:focus-visible { outline: none; }
.leaflet-marker-icon:focus-visible .pin { outline: 3px solid var(--focus); outline-offset: 2px; }

/* legend */
.map-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; margin-top: 12px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--fs-xs); }
.legend-list li { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { --c: var(--occ-none); width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.legend-swatch[data-level="low"] { --c: var(--occ-low); }
.legend-swatch[data-level="medium"] { --c: var(--occ-medium); }
.legend-swatch[data-level="high"] { --c: var(--occ-high); }
.legend-swatch[data-level="full"] { --c: var(--occ-full); }
.legend-shape { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--fg-muted); }
.legend-shape.is-library { border-radius: 3px; }

/* ---------- check-in picker (bottom sheet) ---------- */
.picker-sheet {
  border: none; padding: 0; margin: auto auto 0; width: min(560px, 100%); max-width: 100%; max-height: 85vh; overflow: auto; overscroll-behavior: contain;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
}
.picker-sheet[open] { animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) { .picker-sheet { margin: auto; border-radius: var(--radius-lg); } }
.picker-sheet::backdrop { background: rgb(0 0 0 / 0.45); }
.picker-inner { padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; }
.picker-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.picker-head h2 { font-size: var(--fs-lg); margin-top: 2px; }
.picker-close {
  display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer;
}
.picker-sub { font-size: var(--fs-sm); }
.picker-list { margin-top: 4px; }
.picker-group { margin: 14px 0 6px; }
.picker-items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.picker-items li + li { border-top: 1px solid var(--line); }
.picker-item {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px;
  color: var(--fg); text-decoration: none; font-weight: 500;
}
.picker-item:hover { background: var(--surface-2); }
.picker-item:focus-visible { outline-offset: -3px; }
.picker-name { flex: 1; min-width: 0; }
.picker-chev { color: var(--fg-muted); }
