/* detail.css -- the station detail overlay (selectedId).
 *
 * Reuses the tier tokens defined once in list.css (--ps-tier-*) via the shared
 * data-tier contract. Full-height-ish bottom sheet over a dim backdrop; the
 * Navigate button is the primary thumb-zone action.
 */

#detail-root,
.ps-dt-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}
#detail-root:empty,
.ps-dt-root:empty { display: none; }
#detail-root.is-open,
.ps-dt-root.is-open { pointer-events: auto; }

.ps-dt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(1.5px);
  animation: ps-dt-fade 0.16s ease;
}

.ps-dt-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  background: var(--surface, var(--color-surface, #ffffff));
  color: var(--text, var(--color-text, #0f172a));
  /* Named outright, not via --radius-lg: base.css defines that token as 18px,
     so inheriting it would quietly reshape this sheet's 20px corner. */
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  animation: ps-dt-rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

.ps-dt-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2, rgba(148, 163, 184, 0.18));
  color: var(--text, #0f172a);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.ps-dt-close:active { transform: scale(0.94); }

.ps-dt-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 18px 8px;
}

/* padding-right clears the close button: it is 44px wide at right:10px, and the
   scroll box already insets 18px, so 36px only just touches it -- 44px keeps a
   real gap between a long station name and the X. */
.ps-dt-head { margin-bottom: 14px; padding-right: 44px; }
.ps-dt-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.ps-dt-sub-line { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.ps-dt-brand { font-size: 0.85rem; color: var(--text-muted, #64748b); font-weight: 500; }
.ps-dt-dist { margin: 6px 0 0; font-size: 0.85rem; color: var(--text-muted, #64748b); }

/* overall block */
.ps-dt-overall {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md, 14px);
  margin-bottom: 16px;
}
.ps-dt-overall[data-tier="great"] { background: var(--ps-tier-great-bg); }
.ps-dt-overall[data-tier="ok"] { background: var(--ps-tier-ok-bg); }
.ps-dt-overall[data-tier="poor"] { background: var(--ps-tier-poor-bg); }
.ps-dt-overall[data-tier="unrated"] {
  background: var(--ps-tier-unrated-bg);
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.ps-dt-overall-score {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}
.ps-dt-overall[data-tier="great"] .ps-dt-overall-score { color: var(--ps-tier-great); }
.ps-dt-overall[data-tier="ok"] .ps-dt-overall-score { color: var(--ps-tier-ok); }
.ps-dt-overall[data-tier="poor"] .ps-dt-overall-score { color: var(--ps-tier-poor); }
.ps-dt-overall-meta { display: flex; flex-direction: column; gap: 1px; }
.ps-dt-overall-tier { font-weight: 700; font-size: 0.95rem; }
.ps-dt-overall-count { font-size: 0.78rem; color: var(--text-muted, #64748b); }
.ps-dt-overall-invite { font-size: 0.82rem; color: var(--text-muted, #475569); }

/* five dimension bars -- co-equal, full width each, none enlarged */
.ps-dt-dims { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ps-dt-dim { display: grid; grid-template-columns: 78px 1fr 30px; align-items: center; gap: 10px; }
.ps-dt-dim-label { font-size: 0.82rem; font-weight: 600; color: var(--text, #334155); }
.ps-dt-dim-track {
  height: 8px;
  border-radius: 999px;
  background: var(--track, rgba(148, 163, 184, 0.28));
  overflow: hidden;
}
.ps-dt-dim-fill { display: block; height: 100%; border-radius: 999px; }
.ps-dt-dim-fill[data-tier="great"] { background: var(--ps-tier-great); }
.ps-dt-dim-fill[data-tier="ok"] { background: var(--ps-tier-ok); }
.ps-dt-dim-fill[data-tier="poor"] { background: var(--ps-tier-poor); }
.ps-dt-dim-fill[data-tier="unrated"] { background: var(--ps-tier-unrated); opacity: 0.5; }
.ps-dt-dim-val { font-size: 0.82rem; font-weight: 700; text-align: right; color: var(--text-muted, #475569); }

/* unrated invite (detail) */
.ps-dt-unrated {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px dashed var(--ps-tier-unrated);
  border-radius: var(--radius-md, 14px);
  background: var(--ps-tier-unrated-bg);
}
.ps-dt-unrated-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ps-tier-unrated); margin-top: 3px; flex: none; }
.ps-dt-unrated-title { margin: 0 0 2px; font-weight: 700; font-size: 0.92rem; }
.ps-dt-unrated-sub { margin: 0; font-size: 0.82rem; color: var(--text-muted, #475569); line-height: 1.35; }

/* sub-sections */
.ps-dt-sub {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}

.ps-dt-amenities { margin-bottom: 16px; }
.ps-dt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-dt-chip {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2, rgba(148, 163, 184, 0.16));
  color: var(--text, #334155);
}

.ps-dt-notes { margin-bottom: 12px; }
.ps-dt-notes-loading { font-size: 0.85rem; color: var(--text-muted, #64748b); display: flex; align-items: center; gap: 8px; }
.ps-dt-notes-empty { margin: 0; font-size: 0.85rem; color: var(--text-muted, #64748b); }
.ps-dt-note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ps-dt-note {
  background: var(--surface-2, var(--color-surface-2, #f8fafc));
  border-radius: var(--radius-sm, 10px);
  padding: 10px 12px;
}
.ps-dt-note-text { margin: 0 0 3px; font-size: 0.88rem; line-height: 1.4; }
.ps-dt-note-when { font-size: 0.78rem; color: var(--text-muted, #94a3b8); }

/* sticky action footer -- Navigate is the primary thumb-zone CTA */
.ps-dt-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.2));
  background: var(--surface, #fff);
  flex: none;
}
.ps-dt-nav,
.ps-dt-rate {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}
.ps-dt-nav {
  flex: 1.4; /* primary action gets a touch more width */
  background: var(--accent, var(--color-accent, #2563eb));
  color: var(--accent-text, #fff);
  border: none;
}
.ps-dt-nav:active { transform: scale(0.98); }
.ps-dt-nav-ico { font-size: 1.05rem; transform: rotate(-0deg); }
.ps-dt-rate {
  background: transparent;
  color: var(--accent, var(--color-accent, #2563eb));
  border: 1.5px solid var(--accent, var(--color-accent, #2563eb));
}
.ps-dt-rate:active { transform: scale(0.98); }

@keyframes ps-dt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ps-dt-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .ps-dt-sheet, .ps-dt-backdrop { animation: none; }
  .ps-dt-nav:active, .ps-dt-rate:active, .ps-dt-close:active { transform: none; }
}
