/* ==========================================================================
   Gallery
   ========================================================================== */

.gl-hero {
  position: relative;
  padding-top: calc(var(--nav-h) + 72px);
  overflow: hidden;
  isolation: isolate;
}

.gl-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40% 50% at 80% 30%, rgba(41, 151, 255, 0.12), transparent 70%),
    radial-gradient(35% 40% at 0% 90%, rgba(255, 179, 64, 0.05), transparent 70%);
}

.gl-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}

.gl-hero__title {
  font-size: clamp(44px, 7vw, 104px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.gl-hero__title span {
  display: block;
}

.gl-hero__title .dim {
  color: #55565e;
}

.gl-hero .lead {
  max-width: 560px;
}

.gl-index .chip:hover {
  color: var(--fg);
  border-color: var(--line-3);
  background: rgba(255, 255, 255, 0.08);
}

/* Fanned stack of three photos */
.gl-stack {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 4 / 5;
  justify-self: end;
}

.gl-stack__card {
  position: absolute;
  object-fit: cover;
  border-radius: var(--r-m);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  transition: transform 0.9s var(--ease-out);
}

.gl-stack__card--1 {
  left: 0;
  top: 10%;
  width: 52%;
  aspect-ratio: 3 / 4;
  transform: rotate(-9deg);
}

.gl-stack__card--2 {
  right: 0;
  top: 2%;
  width: 60%;
  aspect-ratio: 4 / 3;
  transform: rotate(7deg);
}

.gl-stack__card--3 {
  left: 24%;
  bottom: 0;
  width: 56%;
  aspect-ratio: 2 / 3;
  object-position: 50% 25%;
  transform: rotate(-1.5deg);
}

.gl-stack:hover .gl-stack__card--1 {
  transform: rotate(-13deg) translate(-14px, 6px);
}

.gl-stack:hover .gl-stack__card--2 {
  transform: rotate(11deg) translate(14px, -6px);
}

.gl-stack:hover .gl-stack__card--3 {
  transform: rotate(0deg) translateY(-8px);
}

.gl-stack__tag {
  position: absolute;
  left: -4%;
  bottom: 14%;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg);
  background: rgba(30, 31, 37, 0.8);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transform: rotate(-4deg);
}

/* ── Timeline ────────────────────────────────────────────────────────────── */

.gl-timeline {
  --rail: 250px;
  --gap: 72px;
  --row-gap: clamp(80px, 10vw, 136px);
  display: grid;
  row-gap: var(--row-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gl-chapter {
  --side: calc(var(--rail) + var(--gap));
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gap);
  container-type: inline-size;
  scroll-margin-top: calc(var(--nav-h) + 32px);
}

/* The rail: each chapter draws its segment down to the next dot. */
.gl-chapter::before {
  content: "";
  position: absolute;
  left: calc(var(--rail) + var(--gap) / 2);
  top: 22px;
  bottom: calc(-1 * var(--row-gap));
  width: 1px;
  background: var(--line-2);
  transition: background-color 0.8s var(--ease-out);
}

.gl-chapter:last-child::before {
  display: none;
}

.gl-chapter:has(.gl-text.is-in)::before {
  background: linear-gradient(var(--accent), var(--line-2) 70%);
}

.gl-dot {
  position: absolute;
  left: calc(var(--rail) + var(--gap) / 2 - 6px);
  top: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-3);
  transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s, transform 0.6s var(--ease-spring);
}

.gl-chapter:has(.gl-text.is-in) .gl-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 14px rgba(41, 151, 255, 0.6);
}

.gl-dot--now::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--accent);
  animation: ping 2.4s var(--ease-out) infinite;
}

.gl-text {
  position: sticky;
  top: calc(var(--nav-h) + 40px);
  align-self: start;
}

.gl-when {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}

.gl-title {
  margin-top: 10px;
  font-size: clamp(24px, 2.3vw, 31px);
  font-weight: 650;
  letter-spacing: -0.032em;
  line-height: 1.12;
}

.gl-where {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--fg-3);
}

.gl-where .i {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.gl-note {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-2);
}

.gl-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  transition: gap 0.35s var(--ease-out), color 0.3s;
}

.gl-link:hover {
  gap: 10px;
  color: var(--accent-2);
}

.gl-link .i {
  width: 15px;
  height: 15px;
}

/* Photos: a 6-column grid whose row height follows the column width, so a
   2×3 tile is roughly portrait and a 4×3 tile roughly landscape. */
.gl-photos {
  --col: calc((100cqi - var(--side) - 50px) / 6);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: calc(var(--col) * 0.88);
  grid-auto-flow: dense;
  gap: 10px;
}

.gl-ph,
.gl-aside {
  grid-column: span var(--c, 2);
  grid-row: span var(--r, 3);
}

.gl-ph {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px solid var(--line);
}

.gl-ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  transition: transform 1.1s var(--ease-out);
}

.gl-ph figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 36px 14px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease-out), transform 0.5s var(--ease-out);
  pointer-events: none;
}

.gl-ph:hover img,
.gl-ph:focus-within img {
  transform: scale(1.035);
}

.gl-ph:hover figcaption,
.gl-ph:focus-within figcaption {
  opacity: 1;
  transform: none;
}

.gl-ph img:focus-visible {
  outline: none;
}

.gl-ph:has(img:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gl-aside {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  border-radius: var(--r-s);
}

.gl-aside__k {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.gl-aside__v {
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--fg);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .gl-timeline {
    --rail: 210px;
    --gap: 56px;
  }
}

@media (max-width: 900px) {
  .gl-hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gl-stack {
    justify-self: center;
    max-width: 360px;
  }

  .gl-stack__tag {
    left: 0;
  }

  .gl-chapter {
    --side: 0px;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    padding-left: 34px;
  }

  .gl-chapter::before {
    left: 6px;
  }

  .gl-dot {
    left: 0;
  }

  .gl-text {
    position: static;
    max-width: 560px;
  }
}

/* Phones: each chapter becomes a swipeable row of photos at their own shape. */
@media (max-width: 640px) {
  .gl-photos {
    display: flex;
    gap: 10px;
    margin-right: calc(-1 * var(--gutter));
    padding-right: var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .gl-photos::-webkit-scrollbar {
    display: none;
  }

  .gl-ph,
  .gl-aside {
    flex: none;
    height: 340px;
    scroll-snap-align: start;
  }

  .gl-ph img {
    width: auto;
    max-width: none;
  }

  .gl-aside {
    width: 210px;
  }

  .gl-ph figcaption {
    opacity: 1;
    transform: none;
    font-size: 12.5px;
  }
}

@media (hover: none) {
  .gl-ph figcaption {
    opacity: 1;
    transform: none;
  }
}
