/* Deep-dive view — sidebar expands to ~60vw, map stays in canvas (just narrower).
   Map needs no special CSS: when sidebar grows its flex-basis, canvas shrinks
   automatically and #map fills the smaller canvas via its absolute insets. */

/* Sidebar grows just enough to fit deep-dive content. Map stays dominant.
   Heatmap content maxes at ~560px; 640px host gives comfortable padding. */
.app-body.mode-deep-dive .sidebar {
  flex-basis: 640px;
  width: 640px;
  max-width: min(640px, 70vw);
}

/* Hide the tile list / filter pills while deep-dive is active */
.sidebar.is-deep-dive .sidebar-inner {
  opacity: 0;
  pointer-events: none;
}

.sidebar-inner {
  transition: opacity var(--duration) var(--easing);
}

/* ===== Deep-dive panel ===== */

.deep-dive {
  position: absolute;
  inset: 0;
  background: var(--chrome);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--duration-slow) var(--easing),
              transform var(--duration-slow) var(--easing);
}

.sidebar.is-deep-dive .deep-dive {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Hide rail/collapse affordances while in deep-dive */
.sidebar.is-deep-dive .sidebar-toggle,
.sidebar.is-deep-dive .sidebar-rail {
  display: none;
}

/* Scrollbar — quiet */
.deep-dive::-webkit-scrollbar { width: 10px; }
.deep-dive::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
.deep-dive::-webkit-scrollbar-track { background: transparent; }

/* Back button — explicitly in the document flow; scrolls with the rest of
   the panel content. position: static is declared explicitly to override any
   stale `sticky` rule that may still be cached in older browsers. */
.deep-dive-back {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px 10px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--chrome);
  border-radius: var(--radius-sm);
  margin: 16px 0 0 16px;
  transition: color var(--duration-fast) var(--easing),
              background var(--duration-fast) var(--easing);
}
.deep-dive-back span:first-child { font-size: 18px; line-height: 1; }
.deep-dive-back:hover { color: var(--text-primary); background: var(--chrome-strong); }

/* Inner content */
.deep-dive-content {
  padding: 8px 32px 64px 32px;
  max-width: 820px;
}

/* ===== Section: header ===== */

.dd-section { margin-bottom: 40px; }
.dd-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}

.dd-header {
  margin-top: 4px;
  margin-bottom: 36px;
  /* leave room for top-right thumbnail */
  padding-right: 32px;
  max-width: 480px;
}

.dd-header-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  line-height: 1.2;
}

.dd-header-hero {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.dd-header-hero-num {
  font-family: var(--font-mono);
  font-size: 60px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.dd-header-hero-num--free   { color: var(--status-free); }
.dd-header-hero-num--medium { color: var(--status-medium); }
.dd-header-hero-num--full   { color: var(--status-full); }
.dd-header-hero-num--suspect{ color: var(--status-amber-text); }
.dd-header-hero-num--no-data{ color: var(--text-muted); }

.dd-header-hero-label {
  font-size: 14px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.dd-header-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
}

.dd-header-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 14px;
  background: var(--chrome-strong);
  color: var(--text-secondary);
}

.dd-header-status--suspect,
.dd-header-status--stale { color: var(--status-amber-text); }

/* ===== Section: today chart ===== */

.dd-today-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

/* ===== Section: history heatmap + spark ===== */

.dd-heatmap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 560px;
}

.dd-heatmap-row {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  align-items: center;
}

.dd-heatmap-row--header .dd-heatmap-h {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
}

.dd-heatmap-d {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: left;
  padding-right: 6px;
}

.dd-heatmap-c {
  height: 18px;
  border-radius: 3px;
  cursor: default;
}

.dd-spark-wrap {
  margin-top: 24px;
  max-width: 560px;
}
.dd-spark-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.dd-spark-canvas-wrap {
  position: relative;
  width: 100%;
  height: 90px;
}

/* ===== Section: amenities ===== */

.dd-amenities-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dd-amenities-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.dd-amenities-list li:last-child { border-bottom: none; }

.dd-amenities-label { color: var(--text-secondary); }
.dd-amenities-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

/* ===== Section: practical ===== */

.dd-practical-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: baseline;
}
.dd-practical-row:last-child { border-bottom: none; }

.dd-practical-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dd-practical-value {
  color: var(--text-primary);
}

.dd-practical-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.dd-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--chrome-strong);
  color: var(--text-primary);
  transition: background var(--duration-fast) var(--easing);
}
.dd-link-btn:hover { background: var(--border-strong); text-decoration: none; }

.dd-link-btn--primary {
  background: var(--accent);
  color: var(--accent-text);
}
.dd-link-btn--primary:hover { filter: brightness(1.08); }

/* ======================================================================== */
/* Item 4 — tabs (Live | History) + History tab content (weekday + heatmap)  */
/* ======================================================================== */

.dd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 24px 0;
}
.dd-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--duration-fast) var(--easing),
              border-color var(--duration-fast) var(--easing);
}
.dd-tab:hover { color: var(--text-primary); }
.dd-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.dd-tab-panel { /* used as a data-attr selector marker too; no special layout */ }
.dd-tab-panel[hidden] { display: none; }

.dd-history {
  margin-bottom: 40px;
}
.dd-history-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dd-history-loading,
.dd-history-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Weekday picker (dropdown). */
.weekday-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.weekday-picker label {
  font-size: 13px;
  color: var(--text-secondary);
}
.weekday-picker select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.dd-weekday-wrap {
  position: relative;
  height: 200px;
  width: 100%;
}
.dd-weekday-caption {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: -4px;
}

/* Heatmap — 7 day-of-week rows × 24 hour columns. */
.heatmap-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.heatmap-row {
  display: grid;
  /* Day label column + 24 equal hour cells. */
  grid-template-columns: 96px repeat(24, minmax(0, 1fr));
  gap: 2px;
}
.heatmap-row--selected .heatmap-day-label {
  color: var(--accent);
  font-weight: 600;
}
.heatmap-row--selected .heatmap-data {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.heatmap-cell {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.heatmap-corner,
.heatmap-hour-label {
  color: var(--text-muted);
  font-size: 10px;
}
.heatmap-day-label {
  color: var(--text-secondary);
  font-family: var(--font-sans, inherit);
  font-size: 11px;
  justify-content: flex-end;
  padding-right: 8px;
  cursor: pointer;
  user-select: none;
}
.heatmap-data {
  cursor: pointer;
  border-radius: 2px;
  transition: filter var(--duration-fast) var(--easing);
}
.heatmap-data:hover { filter: brightness(1.15); }
.heatmap-data--free   { background: var(--status-free); }
.heatmap-data--medium { background: var(--status-medium); }
.heatmap-data--full   { background: var(--status-full); }
.heatmap-data--no-data {
  background: var(--chrome-strong);
  cursor: default;
}
.heatmap-data--no-data:hover { filter: none; }

/* Mobile (drawer) — tighten layout. */
@media (max-width: 1023.98px) {
  .heatmap-row { grid-template-columns: 64px repeat(24, minmax(0, 1fr)); }
  .heatmap-cell { height: 18px; }
  .heatmap-day-label { font-size: 10px; padding-right: 4px; }
  .dd-weekday-wrap { height: 180px; }
}

/* =================================================================
   Not-found banner + cold-load skeleton (Pass D)
================================================================= */

.dd-not-found {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 32px 24px;
  max-width: 480px;
}
.dd-not-found-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.dd-not-found-body {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.dd-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  animation: skel-pulse 1.2s ease-in-out infinite;
}
.dd-skel-row {
  height: 14px;
  background: var(--border-strong);
  border-radius: 4px;
}
.dd-skel-row--lg { width: 80%; height: 28px; }
.dd-skel-row--md { width: 55%; }
.dd-skel-row--sm { width: 35%; height: 10px; }
