@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --travel-background: url('/img/travel/bg.png');
  --journal-paper: #fceede;
  --journal-gold: #dec5a6;
  --journal-frame-radius: 1.5rem;
}

* {
  box-sizing: border-box;
  user-select: none;
}

html {
  color-scheme: dark;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--journal-paper);
  background: #071425 var(--travel-background) center bottom / cover no-repeat;
  font-family: 'Inter', sans-serif;
}

button {
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--journal-gold);
  outline-offset: 4px;
}

#nav {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 4vw;
  font-family: 'Cormorant Garamond', serif;
}

#nav a {
  position: relative;
  padding-bottom: 0.3rem;
  color: inherit;
  font-size: 1.2rem;
  text-decoration: none;
  white-space: nowrap;
}

#nav > a:first-child {
  margin-right: auto;
  font-size: 1.65rem;
}

#nav a::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 250ms ease;
}

#nav a:hover::after,
#nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Keep a photo and its caption inside the available screen. */
.travel-carousel {
  --caption-space: 12rem;
  --frame-height: max(0px, min(28rem, calc((100vw - 9rem) * 3 / 4), calc(100cqh - var(--caption-space) - 3rem)));
  --frame-width: calc(var(--frame-height) * 4 / 3);
  --peek: calc((100% - var(--frame-width)) / 2);
  container-type: size;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  min-height: 0;
  padding-block: 1rem;
}

.carousel-atmosphere,
.album-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.album-atmosphere { overflow: hidden; }

.carousel-aura,
.album-aura {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  filter: blur(4rem) saturate(1.2) brightness(1.15);
  mask-image: radial-gradient(ellipse, #000 15%, transparent 78%);
  opacity: 0;
  transition: opacity 900ms ease;
}

.carousel-aura {
  top: var(--aura-center-y, 40%);
  width: min(94vw, calc(var(--frame-width) * 1.9));
  height: calc(var(--frame-height) * 1.85);
}

.album-aura {
  top: var(--album-glow-top, 50%);
  width: var(--album-glow-width, 90vw);
  height: var(--album-glow-height, 90svh);
}

.carousel-aura.is-active,
.album-aura.is-active {
  opacity: 0.4;
}

.journal-heading,
.album-eyebrow,
.card-location,
.album-location {
  color: var(--journal-gold);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.journal-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 0;
  text-align: center;
}

.journal-heading::before,
.journal-heading::after {
  content: '';
  width: 2rem;
  height: 1px;
  background: rgba(222, 197, 166, 0.35);
}

#main-container {
  position: relative;
  display: flex;
  gap: 2rem;
  flex: 0 0 auto;
  padding: 1rem var(--peek) var(--caption-space);
  overflow-x: auto;
  overflow-anchor: none;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

#main-container::-webkit-scrollbar,
.album-thumbnails::-webkit-scrollbar {
  display: none;
}

.card {
  --photo-width: min(var(--frame-width), calc(var(--frame-height) * var(--photo-aspect, 1.333333)));
  position: relative;
  flex: 0 0 var(--frame-width);
  height: var(--frame-height);
}

.photo-window,
.album-photo-frame {
  overflow: hidden;
  border: 1px solid rgba(252, 238, 222, 0.18);
  border-radius: var(--journal-frame-radius);
  box-shadow: 0 1.3rem 3.5rem rgba(2, 8, 20, 0.3), 0 0 2rem rgba(234, 201, 155, 0.06);
}

.photo-window {
  position: absolute;
  left: 50%;
  width: 0;
  height: 100%;
  transform: translateX(-50%);
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transition: width 280ms cubic-bezier(0.22, 0.68, 0, 1), opacity 180ms ease, visibility 0s 280ms;
}

.card.is-active .photo-window {
  width: var(--photo-width);
  opacity: 1;
  visibility: visible;
  transition: width 480ms cubic-bezier(0.22, 0.68, 0, 1), opacity 180ms ease, visibility 0s;
}

.card-image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--photo-width);
  height: var(--frame-height);
  transform: translate(-50%, -50%);
  object-fit: contain;
  -webkit-user-drag: none;
}

.card-content {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  width: 90vw;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
}

.card.is-active .card-content {
  opacity: 1;
  transition: opacity 260ms ease 220ms;
}

.card h2,
.album-header h2 {
  margin: 0 0 0.4rem;
  font: 500 4rem / 1.05 'Cormorant Garamond', serif;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.card-location {
  margin: 0 0 0.5rem;
}

.card-description {
  max-width: 38rem;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
}

#main-container.is-dragging,
#main-container.is-dragging .photo-window {
  cursor: grabbing;
}

#main-container.is-dragging .card-content,
#main-container.is-settling .card-content {
  opacity: 0;
  transition: opacity 100ms ease;
}

.carousel-controls {
  position: fixed;
  inset: 50svh 3vw auto;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  pointer-events: none;
}

.carousel-controls button,
.album-close,
.album-arrow,
.album-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid rgba(252, 238, 222, 0.55);
  border-radius: 999px;
  background: rgba(7, 20, 37, 0.6);
  font-size: 0.8rem;
  transition: background 180ms ease, border-color 180ms ease;
}

.carousel-controls button {
  pointer-events: auto;
}

.carousel-controls button:hover,
.album-close:hover,
.album-arrow:not(:disabled):hover,
.album-retry:hover {
  background: rgba(252, 238, 222, 0.15);
  border-color: var(--journal-paper);
}

button:disabled {
  opacity: 0.3;
  cursor: default;
}

.album-dialog {
  isolation: isolate;
  width: 100%;
  max-width: none;
  height: 100svh;
  max-height: none;
  margin: 0;
  padding: 2rem;
  border: 0;
  overflow: hidden;
  color: inherit;
  background: linear-gradient(rgba(5, 12, 23, 0.28), rgba(5, 12, 23, 0.42)),
    #071425 var(--travel-background) center bottom / cover no-repeat;
}

.album-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1rem;
  animation: album-enter 220ms ease-out;
}

.album-dialog::backdrop {
  background: rgba(4, 10, 20, 0.25);
}

.album-dialog [hidden] {
  display: none !important;
}

.album-header,
.album-stage,
.album-thumbnails {
  position: relative;
  min-width: 0;
}

.album-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  cursor: default;
}

.album-header > div {
  min-width: 0;
}

.album-header h2 { font-size: 3rem; }
.album-eyebrow { margin: 0 0 0.3rem; }
.album-location { margin: 0.35rem 0 0; }

.album-close {
  flex-shrink: 0;
  padding: 0.65rem 1rem;
}

.album-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}

.album-photo-frame {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
}

.album-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 150ms ease;
  -webkit-user-drag: none;
}

.album-stage.is-loading .album-image { opacity: 0.5; }

.album-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
}

.album-arrow--prev { left: 0; }
.album-arrow--next { right: 0; }

.album-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  max-width: 90%;
  border-radius: 0.75rem;
  background: rgba(5, 12, 23, 0.9);
  text-align: center;
  transform: translate(-50%, -50%);
}

.album-feedback p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.album-retry { margin-top: 0.75rem; }

.album-thumbnails {
  display: flex;
  gap: 0.65rem;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 0.45rem;
  border: 1px solid rgba(252, 238, 222, 0.1);
  border-radius: 0.85rem;
  background: rgba(7, 20, 37, 0.28);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.album-thumbnail {
  flex-shrink: 0;
  width: 5.25rem;
  height: 3.5rem;
  padding: 0.15rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  opacity: 0.55;
  transition: opacity 180ms ease, border-color 180ms ease;
}

.album-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.3rem;
  object-fit: cover;
}

.album-thumbnail.is-selected,
.album-thumbnail:hover {
  border-color: var(--journal-gold);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes album-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 700px) {
  :root { --journal-frame-radius: 1rem; }

  #nav {
    flex-wrap: wrap;
    gap: 0.65rem 1.1rem;
    padding: 1rem 1.25rem;
  }

  #nav > a:first-child {
    flex-basis: 100%;
    padding-bottom: 0;
  }

  #nav a { font-size: 1rem; }
  .travel-carousel { --caption-space: 10rem; }
  .card h2 { font-size: 2.5rem; }
  .card-description { font-size: 0.9rem; }
  .carousel-controls { right: 0.75rem; left: 0.75rem; }
  .album-dialog { padding: 1rem; }
  .album-dialog[open] { gap: 0.75rem; }
  .album-header h2 { font-size: 1.8rem; }
  .album-close { padding: 0; }
  .album-close span { display: none; }
}

@media (max-width: 700px), (max-width: 950px) and (max-height: 500px) {
  .album-arrow { display: none; }
}

@media (max-height: 600px) {
  .travel-carousel { --caption-space: 10rem; padding-block: 0.5rem; }
  .card h2 { font-size: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .album-dialog { animation: none !important; }
}
