/*
 * Own footage and recordings (player and Area pages built by hyd-world.js). Styles the real local video
 * element, the screen overlays that fade while playing, the recording-location map window (#journey-map and
 * .route-window, including the phone slot #mobile-route-slot), the chapter buttons, the recordings lists on the
 * Area page and the thumbnails in search results. The player window grid itself lives in hyd-player-layout.css.
 */

/* Real local footage; preserve the existing desktop design. */
#journey-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090d10;
  filter: none;
  animation: none;
  transform: none;
}

#big-screen {
  background: #090d10;
}

.screen-shade {
  pointer-events: none;
  background: linear-gradient(transparent 64%, #070d1555);
}

/*
 * While the video plays, the title, date, disclaimer and play button fade out; the play button returns on hover
 * or keyboard focus.
 */
.screen.playing .screen-title,
.screen.playing .screen-disclaimer,
.screen.playing .screen-date,
.screen.playing #play-preview {
  opacity: 0;
  pointer-events: none;
}

.screen-title,
.screen-disclaimer,
.screen-date,
#play-preview {
  transition: opacity 0.2s;
}

.screen-title {
  pointer-events: none;
}

.screen-corner {
  pointer-events: none;
}

.screen.playing:hover #play-preview,
.screen.playing:focus-within #play-preview {
  opacity: 0.8;
  pointer-events: auto;
}

/* --- Location map window and chapter buttons --- */
.screen .route-window {
  max-width: 220px;
}

.route-caption {
  gap: 12px;
}

.route-caption b {
  font-size: calc(11 * var(--px));
}

.chapter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chapters {
  flex-wrap: wrap;
}

.chapter-buttons button[aria-pressed='true'] {
  box-shadow: inset 0 0 0 2px #a6d7ed;
}

#player-error {
  padding: 14px;
  color: #f6e8df;
  background: #50232a;
  border: 1px solid #e2a8b0;
}

/* --- Recording lists (Area page and search results) --- */
.own-recordings {
  grid-template-columns: 1fr 1fr;
}

.own-recordings button span {
  display: block;
}

.own-recordings small {
  display: block;
  font:
    calc(10 * var(--px))/1.5 'IBM Plex Mono',
    monospace;
  margin-top: 4px;
  color: inherit;
}

.own-recordings button img {
  height: 115px;
}

.recording-frame {
  opacity: 0.9;
}

.area-empty {
  margin: 12px 35px 30px;
  padding: 24px;
  border: 1px solid #65747d;
  background: #101d25;
}

.area-empty b,
.area-empty span {
  display: block;
}

.area-empty span {
  margin-top: 10px;
  color: #cad2d7;
  font-size: 13px;
}

#area .hero-journey[hidden],
#area .area-postcard[hidden],
.area-empty[hidden] {
  /* !important: the hidden attribute has to win over the display value these blocks get from other rules. */
  display: none !important;
}

@media (max-width: 620px) {
  .own-recordings button img {
    height: 105px;
  }

  .screen .route-window {
    max-width: 150px;
  }

  .screen .route-window .route-caption {
    display: block;
  }

  .screen .route-window .route-caption span {
    display: none;
  }

  .route-title {
    font-size: calc(9 * var(--px));
  }

  .route-window small {
    font-size: calc(8 * var(--px));
  }

  .chapter-buttons button {
    font-size: calc(11 * var(--px));
  }

  .area-empty {
    margin-inline: 18px;
  }

  .screen-title h1 {
    font-size: calc(24 * var(--px));
  }
}

/* --- Location map (#journey-map) sizes --- */
#big-screen .route-window {
  width: 235px;
  max-width: 235px;
}

#journey-map {
  /*
   * !important: other sheets also size this map (hyd-retro.css and hyd-player.css do so with !important), so
   * the height has to be forced here as well.
   */
  height: 140px !important;
  background: #e5e8df;
}

#route-content > small {
  display: block;
  line-height: 1.45;
  font-size: calc(9 * var(--px));
}

.endpoint-marker {
  background: none;
  border: 0;
}

.endpoint-marker span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: #315b65;
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  font: bold calc(12 * var(--px)) Arial;
  box-shadow: 0 1px 4px #0006;
}

.endpoint-b span {
  background: #985d38;
}

.route-window .leaflet-popup-content {
  font-size: 11px;
  color: #182931;
}

.route-window .leaflet-control-attribution {
  font-size: calc(8 * var(--px));
}

.route-caption b {
  font-size: calc(10 * var(--px));
}

@media (max-width: 620px) {
  #big-screen .route-window {
    width: 160px;
    max-width: 160px;
  }

  #journey-map {
    /* !important: same reason as the map height above. */
    height: 105px !important;
  }

  #route-content > small {
    font-size: calc(8 * var(--px));
  }
}

/* Phone widths: in #mobile-route-slot the route window is a full-width block instead of a floating card. */
@media (max-width: 620px) {
  #mobile-route-slot .route-window {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: none;
    transform: none;
    rotate: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #mobile-route-slot #route-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
  }

  #mobile-route-slot #route-content[hidden] {
    display: none;
  }

  #mobile-route-slot #journey-map {
    grid-row: 1/3;
    /* !important: same reason as the map height above. */
    height: 116px !important;
  }

  #mobile-route-slot .route-caption {
    display: block;
    padding: 4px;
  }

  #mobile-route-slot .route-caption b {
    font-size: 11px;
  }

  #mobile-route-slot #route-content > small {
    font-size: 9px;
    line-height: 1.5;
    padding: 4px;
  }

  #mobile-route-slot .route-title {
    font-size: 11px;
    padding: 7px 10px;
  }

  #mobile-route-slot .route-title button {
    width: 24px;
    height: 22px;
  }
}

@media (max-width: 620px) {
  #mobile-route-slot .route-caption span {
    display: none;
  }

  #mobile-route-slot .route-caption b {
    display: block;
    line-height: 1.4;
  }
}

/* The dot is an illustration of playback progress, not a GPS measurement. */
.journey-position {
  background: none;
  border: 0;
  transition: transform 0.3s linear;
}

.journey-position i {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8dd42;
  border: 3px solid #172c35;
  box-shadow: 0 0 0 3px #fff9;
}

/* --- Area page recordings grid --- */
#area-recordings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0 35px 30px;
}

#area-recordings[hidden] {
  display: none;
}

.area-recording {
  text-align: left;
  padding: 7px;
  background: #172c36;
  color: #f1f3ed;
  border: 1px solid #6d919b;
  box-shadow: 3px 3px #0b1218;
  border-radius: 5px;
  cursor: pointer;
}

.area-recording img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.area-recording strong {
  display: block;
  font-size: 16px;
  padding: 4px 5px 8px;
}

.area-recording small {
  display: block;
  font: 11px monospace;
  color: #c9e1dc;
  padding: 9px 5px 3px;
}

.area-recording:hover,
.area-recording:focus-visible {
  outline: 2px solid #c3dae2;
  transform: translateY(-2px);
}

/* Search results that have a thumbnail. */
.discovery-result img {
  width: 52px;
  height: 39px;
  object-fit: cover;
  grid-row: 1/3;
  border: 1px solid #78939a;
}

.discovery-result:has(img) {
  grid-template-columns: 52px 1fr;
  column-gap: 10px;
}

.discovery-result:has(img) > span,
.discovery-result:has(img) > small {
  grid-column: 2;
}

/* Reduced motion and the motion-off setting: the progress dot jumps instead of gliding. */
@media (prefers-reduced-motion: reduce) {
  .journey-position {
    transition: none;
  }
}

.motion-off .journey-position {
  transition: none;
}

@media (max-width: 620px) {
  #area-recordings {
    padding: 0 18px 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .area-recording strong {
    font-size: 14px;
  }
}
