/* Shorecrest Studio homepage: the climb. A trail runs from "From shore" up to "to crest." with twelve
   photographs set along it, ordered from the coast to the mountains. The one you are nearest grows into a print. */
.climb {
  --edge: clamp(22px, 4.6vw, 84px);
  --print-w: clamp(180px, min(17vw, 30svh), 280px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 100svh;
  min-height: 660px;
  max-height: 1100px;
  background: #16323b;
  color: var(--cloud);
  --accent: var(--sand-2);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- The drawing (it stays put) ---------- */
.climb__land {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.climb__land img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
}
.climb__land::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(9, 22, 26, 0.42), transparent 20%);
}

/* ---------- The two ends ---------- */
.climb__title {
  font-size: clamp(3.4rem, 8.2vw, 9.4rem);
  font-weight: 360;
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.climb__from,
.climb__to {
  position: absolute;
  z-index: 1;
  display: block;
  text-shadow: 0 6px 40px rgba(6, 18, 22, 0.35);
}
.climb__from {
  left: var(--edge);
  bottom: calc(9% + 1.4rem);
}
.climb__to {
  right: var(--edge);
  top: calc(var(--header-h) + 4%);
  text-align: right;
}
.climb__to em {
  color: var(--sand-2);
}
.climb__by {
  position: absolute;
  z-index: 1;
  right: var(--edge);
  top: calc(var(--header-h) + 4% + clamp(3.4rem, 8.2vw, 9.4rem) * 0.98);
  font-size: clamp(1.1rem, 1.45vw, 1.35rem);
  color: #dbe5df;
}
.climb__hint {
  position: absolute;
  z-index: 1;
  right: var(--edge);
  bottom: 9%;
  max-width: 24ch;
  text-align: right;
  font-size: 1.02rem;
  line-height: 1.35;
  color: #b9cbc4;
}
.climb__hint--touch {
  display: none;
}
@media (hover: none) {
  .climb__hint--fine {
    display: none;
  }
  .climb__hint--touch {
    display: inline;
  }
}

/* ---------- The trail ---------- */
.climb__trail {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.climb__trail path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.climb__trail-ahead {
  stroke: rgba(226, 234, 229, 0.5);
  stroke-width: 1.5;
  stroke-dasharray: 2 7;
}
.climb__trail-done {
  stroke: var(--sand-2);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(214, 200, 170, 0.35));
}
.climb__thread {
  stroke: rgba(214, 200, 170, 0.75);
  stroke-width: 1;
}
.climb__spot {
  fill: var(--sand-2);
  stroke: rgba(22, 50, 59, 0.9);
  stroke-width: 2;
}

/* ---------- The photographs on the trail ---------- */
.climb__stops {
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}
.climb__stop {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: var(--print-w);
  pointer-events: auto;
  -webkit-user-drag: none;
}
.climb__stop-in {
  display: block;
  padding: calc(var(--print-w) * 0.034);
  background: #f2f0e9;
  border-radius: 2px;
  box-shadow:
    0 2px 3px rgba(5, 15, 18, 0.3),
    0 24px 50px -12px rgba(4, 14, 17, 0.55),
    0 50px 90px -30px rgba(4, 14, 17, 0.45);
}
.climb__stop img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #2b3a3a;
  -webkit-user-drag: none;
  pointer-events: none;
}
/* small photographs on the trail get a larger target than they show */
.climb__stop.is-thumb::before {
  content: "";
  position: absolute;
  inset: -40%;
}
.climb__stop:focus-visible {
  outline: none;
}
.climb__stop:focus-visible .climb__stop-in {
  outline: 4px solid var(--sand-2);
  outline-offset: 5px;
}

.climb__cap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  max-width: 22ch;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
  text-shadow: 0 2px 16px rgba(5, 16, 19, 0.7);
}
.climb__cap-title {
  font-size: clamp(1.08rem, 1.3vw, 1.3rem);
  color: var(--cloud);
}
.climb__cap-place {
  font-size: clamp(0.92rem, 1vw, 1.04rem);
  color: #c3d2cb;
}
.climb.is-dragging .climb__stop {
  cursor: grabbing;
}

/* ---------- Arrival: the words settle, the trail fades in, the photographs are set down one by one ---------- */
.js .climb__from,
.js .climb__to,
.js .climb__by,
.js .climb__hint {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 1s ease,
    transform 1.2s var(--ease-out);
}
.js .climb__to {
  transition-delay: 0.15s;
}
.js .climb__by {
  transition-delay: 0.35s;
}
.js .climb__hint {
  transition-delay: 0.6s;
}
.js .climb.is-set .climb__from,
.js .climb.is-set .climb__to,
.js .climb.is-set .climb__by,
.js .climb.is-set .climb__hint {
  opacity: 1;
  transform: none;
}
.js .climb__trail,
.js .climb__cap {
  opacity: 0;
  transition: opacity 1.2s ease 0.5s;
}
.js .climb.is-set .climb__trail,
.js .climb.is-set .climb__cap {
  opacity: 1;
}
.js .climb__stop-in {
  opacity: 0;
}
.js .climb.is-set .climb__stop-in {
  animation: stop-in 0.7s var(--ease-out) both;
  animation-delay: calc(0.55s + var(--n, 0) * 70ms);
}
@keyframes stop-in {
  from {
    opacity: 0;
    translate: 0 14px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* without scripts, the photographs sit in a row above the words */
html:not(.js) .climb__stops {
  inset: auto var(--edge) 34% var(--edge);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
html:not(.js) .climb__stop {
  position: relative;
  width: 64px;
}
html:not(.js) .climb__cap,
html:not(.js) .climb__trail {
  display: none;
}

@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  .climb {
    --print-w: min(52vw, 250px, 25svh);
    min-height: 600px;
    max-height: 960px;
  }
  .climb__land img {
    object-position: 64% 50%;
  }
  .climb__title {
    font-size: clamp(3.1rem, 15.5vw, 5.4rem);
  }
  .climb__to {
    top: calc(var(--header-h) + 6px);
  }
  .climb__by {
    top: calc(var(--header-h) + 6px + clamp(3.1rem, 15.5vw, 5.4rem) * 0.98);
    font-size: 1.05rem;
  }
  .climb__from {
    bottom: calc(5% + 2.9rem);
  }
  .climb__hint {
    left: var(--edge);
    bottom: 5%;
    max-width: none;
    text-align: left;
    font-size: 0.98rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .js .climb__from,
  .js .climb__to,
  .js .climb__by,
  .js .climb__hint,
  .js .climb__trail,
  .js .climb__cap,
  .js .climb__stop-in {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }
}
