/* Trip galleries — wider layout; monochrome chrome matching default.css */

body.trip-page,
body.trips-index,
body.trip-photo {
  width: auto;
  max-width: 72rem;
  padding: 0 1rem;
}

body.trip-page article.trip,
body.trips-index article.trips-index,
body.trip-photo article.trip-photo-page {
  padding: 1.25em;
}

.trip-period,
.trip-dates {
  color: #888a85;
  font-weight: normal;
}

.trip-dates {
  margin: 0 0 0.75em;
}

.trip-back {
  margin: 0 0 1em;
}

.trip-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 1.2fr);
  gap: 1.25rem;
  align-items: start;
}

.trip-layout.trip-layout--map-hidden,
.trip-layout.trip-layout--photos-hidden {
  grid-template-columns: 1fr;
}

.trip-layout.trip-layout--map-hidden .trip-map-column,
.trip-layout.trip-layout--photos-hidden .trip-photos-column {
  display: none;
}

.trip-map-column {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.trip-map-wrap,
.trip-photos-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

@media (max-width: 52rem) {
  .trip-layout {
    grid-template-columns: 1fr;
  }

  .trip-map-column {
    position: static;
  }
}

.trip-chevron-bar {
  display: flex;
  align-items: center;
  min-height: 1.25rem;
}

.trip-chevron-bar:has(.trip-chevron--photos:not([hidden])),
.trip-chevron-bar:has(.trip-chevron--show-photos:not([hidden])) {
  justify-content: flex-end;
}

.trip-chevron-bar:has(.trip-chevron--map:not([hidden])),
.trip-chevron-bar:has(.trip-chevron--show-map:not([hidden])) {
  justify-content: flex-start;
}

/* When both sides of a bar could show (shouldn't), keep ends. */
.trip-photos-wrap > .trip-chevron-bar {
  justify-content: space-between;
}

.trip-photos-wrap > .trip-chevron-bar:not(:has(.trip-chevron--show-map:not([hidden]))) {
  justify-content: flex-end;
}

.trip-map-wrap > .trip-chevron-bar {
  justify-content: flex-start;
  gap: 0.35rem;
}

.trip-map-wrap > .trip-chevron-bar .trip-map-thumbs-toggle {
  margin-left: auto;
}

.trip-map-wrap > .trip-chevron-bar:has(.trip-chevron--show-photos:not([hidden])) {
  justify-content: space-between;
}

.trip-map-wrap > .trip-chevron-bar:has(.trip-chevron--show-photos:not([hidden])) .trip-map-thumbs-toggle {
  margin-left: 0;
}

.trip-chevron {
  margin: 0;
  padding: 0 0.15em;
  border: none;
  background: transparent;
  color: #888a85;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.trip-chevron:hover,
.trip-chevron:focus-visible {
  opacity: 1;
  color: #2e3436;
  outline: none;
}

.trip-map-thumbs-toggle {
  margin: 0;
  padding: 0 0.2em;
  border: none;
  background: transparent;
  color: #888a85;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.trip-map-thumbs-toggle:hover,
.trip-map-thumbs-toggle:focus-visible {
  opacity: 1;
  color: #2e3436;
  outline: none;
}

.trip-map-thumbs-toggle[aria-pressed="false"] {
  opacity: 0.4;
}

.trip-map-frame {
  border: 1px solid #888a85;
  background: #d3d7cf;
}

.trip-map {
  width: 100%;
  height: min(70vh, 32rem);
  background: #d3d7cf;
  border: none;
}

.trip-layout.trip-layout--photos-hidden .trip-map {
  height: min(80vh, 40rem);
}

.trip-gpx-list {
  list-style: none;
  padding: 0;
  margin: 0.75em 0 0;
}

.trip-gpx-list li {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0.35em 0;
}

.trip-track-swatch {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 1px solid #2e3436;
  flex-shrink: 0;
}

.trip-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.5rem;
}

@media (max-width: 52rem) {
  .trip-photo-grid {
    grid-template-columns: 1fr;
  }
}

.trip-photos-stage.is-previewing .trip-photo-grid {
  display: none;
}

.trip-photo-grid-item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: #d3d7cf;
}

.trip-photo-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trip-photo-hover-preview {
  display: none;
  line-height: 0;
}

.trip-photos-stage.is-previewing .trip-photo-hover-preview {
  display: block;
}

.trip-photo-hover-preview img {
  width: 100%;
  height: auto;
  max-height: min(85vh, 48rem);
  object-fit: contain;
  object-position: top center;
  display: block;
}

/* Leaflet photo markers */
.trip-map-photo-icon {
  background: transparent;
  border: none;
}

.trip-map-photo-icon a {
  display: block;
  line-height: 0;
  border: 2px solid #2e3436;
  background: #eeeeec;
  box-shadow: 0 0 0 1px #eeeeec;
}

.trip-map-photo-icon img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}

/* Trips index — 3 columns when wide; single column when constrained */
.trips-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25em 1.5em;
}

.trips-list li {
  margin: 0;
}

.trips-list-link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
}

.trips-list-thumb {
  display: block;
  box-sizing: border-box;
  width: 75%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #888a85;
  flex-shrink: 0;
}

.trips-list-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0;
}

.trips-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.trips-list-title {
  font-size: 1.25em;
  color: #204a87;
}

.trips-list-period,
.trips-list-counts {
  color: #888a85;
}

@media (max-width: 52rem) {
  .trips-list {
    grid-template-columns: 1fr;
  }

  .trips-list-link {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .trips-list-thumb {
    width: 7.5rem;
    height: 7.5rem;
    aspect-ratio: 1 / 1;
  }
}

/* Single photo */
.trip-photo-page {
  touch-action: pan-y;
}

.trip-photo-figure {
  margin: 0;
  text-align: center;
}

.trip-photo-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid #888a85;
}

.trip-photo-figure figcaption {
  margin-top: 0.75em;
  color: #888a85;
}

.trip-photo-exif {
  font-size: 0.85rem;
  color: #888a85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.trip-photo-meta {
  font-size: 0.85rem;
}

.trip-modal-single-exif,
.trip-modal-feed-exif {
  font-size: 0.85rem;
  color: #eeeeec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.trip-photo-nav {
  display: flex;
  justify-content: space-between;
}

/* Full-screen photo modal dialog */
.trip-photo-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  background: #777777;
  color: #eeeeec;
  z-index: 1000;
  box-sizing: border-box;
  overflow: hidden;
}

.trip-photo-modal::backdrop {
  background: #777777;
}

.trip-photo-modal:not([open]) {
  display: none !important;
}

.trip-photo-modal[open] {
  display: flex;
  flex-direction: column;
}

.trip-modal-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(119, 119, 119, 0.85) 0%, transparent 100%);
  pointer-events: none;
}

.trip-modal-bar > * {
  pointer-events: auto;
}

.trip-modal-close {
  background: transparent;
  border: none;
  color: #eeeeec;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
  opacity: 0.85;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: opacity 0.15s ease;
  margin-left: auto;
}

.trip-modal-close:hover,
.trip-modal-close:focus-visible {
  opacity: 1;
  color: #ffffff;
  outline: none;
}

/* Desktop single-photo full screen */
.trip-modal-single {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 3rem 1rem 1.5rem;
  user-select: none;
}

.trip-modal-single-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  margin: 0;
  overflow: visible;
}

.trip-modal-single-img {
  max-width: calc(100vw - 10rem);
  max-height: calc(100vh - 8.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.trip-modal-single-caption {
  position: relative;
  width: 100%;
  max-width: calc(100vw - 10rem);
  box-sizing: border-box;
  margin-top: 0.75rem;
  padding: 0 7.5rem;
  font-size: 0.9rem;
  color: #eeeeec;
  text-align: center;
}

.trip-modal-single-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-modal-single-caption a {
  color: #ffffff;
  text-decoration: underline;
}

.trip-modal-single-caption a:hover {
  color: #eeeeec;
}

.trip-modal-nav {
  background: transparent;
  border: none;
  color: #eeeeec;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  padding: 1.5rem 1rem;
  opacity: 0.75;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: opacity 0.15s ease, color 0.15s ease;
  z-index: 10;
  user-select: none;
}

.trip-modal-nav:hover,
.trip-modal-nav:focus-visible {
  opacity: 1;
  color: #ffffff;
  outline: none;
}

.trip-modal-nav[hidden] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Mobile vertical feed */
.trip-modal-feed {
  display: none;
}

@media (max-width: 52rem) {
  .trip-modal-single {
    display: none;
  }

  .trip-modal-feed {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 3.5rem 1rem 4.5rem;
  }

  .trip-modal-feed-item {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 180px;
    flex-shrink: 0;
    scroll-margin-top: 3.5rem;
  }

  .trip-modal-feed-img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    background: transparent;
  }

  .trip-modal-feed-caption {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #eeeeec;
    text-align: center;
  }

  .trip-modal-feed-exif {
    max-width: 90vw;
  }

  .trip-modal-feed-caption a {
    color: #ffffff;
    text-decoration: underline;
  }
}
