/* Layout for the hours site. Calendar styles come from sunblock.css (copied from sunblock.app). */

.split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(0, 56rem);
  min-height: 100dvh;
}

/* Map pane */
.map-pane {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-inline-end: 1px solid var(--border);
  background: var(--toolbar);
}

.map-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--toolbar);
  position: relative;
  z-index: 500;
}

.map-search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.map-search-box .search-input {
  width: 100%;
  font-size: 0.9375rem;
  min-block-size: 2.25rem;
}

.map-search .locate-btn {
  border-color: var(--border);
  background: var(--surface);
}

#map {
  flex: 1;
  min-height: 0;
  background: var(--toolbar);
}

@media (prefers-color-scheme: dark) {
  #map .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9);
  }
}

.map-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.875rem;
  padding: 0.375rem 0.625rem;
  border-top: 1px solid var(--border);
  background: var(--toolbar);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-status > span {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
}

.map-status-text {
  margin-inline-start: auto;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
}

.dot-osm {
  background: #2d6a4f;
}

.dot-fallback {
  background: #8e8e93;
}

@media (prefers-color-scheme: dark) {
  .dot-osm {
    background: #74c69d;
  }
}

.map-notice {
  margin: auto;
  max-width: 22rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-sec);
}

.map-notice code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Calendar column: reuse sunblock's centered column inside the grid */
.split .centered {
  /* auto margins would shrink-wrap the column inside the grid cell */
  margin: 0;
  width: 100%;
  max-width: none;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.split .libleft {
  position: static;
  margin-top: 2rem;
}

.cal-time-gutter[data-count] {
  /* sunblock's gutter has 7 labels; ours varies, so keep the same spacing rules */
  justify-content: space-between;
}

/* 7-day calendar layout */
.cal-scroll {
  overflow-x: auto;
}

.cal-scroll-inner {
  min-width: 34rem;
}

.cal-day-header {
  gap: 0.25rem;
  padding: 0.45rem 0.125rem;
}

.allday-cell {
  font-size: 0.6875rem;
  padding: 0.25rem 0.125rem;
}

.events-layer {
  inset: 0.875rem 0.125rem;
}

.cal-event {
  padding: 0.1875rem 0.25rem;
}

/* Open-hours blocks */
.cal-event-sunblock[data-kind="open"] {
  border-inline-start-color: #34c759;
  background: var(--ev-green-bg);
  color: var(--ev-green-text);
  justify-content: flex-start;
  gap: 0.125rem;
}

.cal-event-sunblock[data-kind="open"] .event-time {
  white-space: normal;
}

.allday-cell[data-closed] {
  color: var(--apple-red);
}

.station-subline [data-open="true"] {
  color: var(--ev-green-text);
  font-weight: 500;
}

.station-subline [data-open="false"] {
  color: var(--apple-red);
  font-weight: 500;
}

.inspector-desc {
  white-space: pre-line;
}

/* Weekly hours list under the header */
.week-hours {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 0.125rem 1.25rem;
  margin: 0.875rem auto 0;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.week-hours-row {
  display: contents;
}

.week-hours dt {
  color: var(--text-muted);
}

.week-hours dd {
  margin: 0;
  color: var(--text);
}

.week-hours dd[data-closed] {
  color: var(--apple-red);
}

.week-hours-row[data-today] dt,
.week-hours-row[data-today] dd {
  font-weight: 600;
}

@media (max-width: 960px) {
  .map-pane:has(.map-notice:not([hidden])) {
    /* no key: keep the placeholder small so the hours stay in view */
    height: auto;
  }
}

@media (max-width: 960px) {
  .split {
    grid-template-columns: 1fr;
  }

  .map-pane {
    position: relative;
    height: 45dvh;
    border-inline-end: none;
    border-bottom: 1px solid var(--border);
  }
}

[hidden] {
  display: none !important;
}

.map-pane:has(.map-notice:not([hidden])) .map-search {
  display: none;
}

.env-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.125rem 0.4375rem;
  border-radius: 999px;
  border: 1px solid #2d6a4f;
  background: rgba(45, 106, 79, 0.11);
  color: #2d6a4f;
}

@media (prefers-color-scheme: dark) {
  .env-badge {
    border-color: #74c69d;
    background: rgba(116, 198, 157, 0.14);
    color: #74c69d;
  }
}
