/* Gallery — dark rooms of the same building as the resume.
   Shares the main site's type system (Saira condensed headings, Muli body) and
   indigo accents, on a full dark background. Entry point is the highway video
   with "many thousand miles ahead", then the topic selector below. */

:root {
  --bg: #0d1020;
  --panel: #1a1f33;
  --ink: #f4f5f8;
  --body: #c7ccda;
  --muted: #8b93a8;
  --accent: #6fb0e6;
  --accent-dark: #9ccbf0;
  --brand-a: #10366c;
  --brand-b: #321e5d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Muli", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--body);
  background: var(--bg);
}

h1,
h2,
.condensed {
  font-family: "Saira Extra Condensed", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

a {
  color: var(--accent);
}

a:hover,
a:focus {
  color: var(--accent-dark);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== Header ===== */
.gallery-header {
  background: rgba(13, 16, 32, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
}

.gallery-header .brand {
  font-family: "Saira Extra Condensed", sans-serif;
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04rem;
  color: #fff;
}

.gallery-header .home-link {
  color: #d7dbe6;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03rem;
  font-size: 0.85rem;
}

.gallery-header .home-link:hover,
.gallery-header .home-link:focus {
  color: #fff;
}

/* ===== Video hero (entry point) ===== */
.video-hero {
  position: relative;
  height: 100svh;
  min-height: 32rem;
  overflow: hidden;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(13, 16, 32, 0.55),
    rgba(13, 16, 32, 0.35) 40%,
    rgba(13, 16, 32, 0.85)
  );
}

.hero-lines {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.hero-lines p {
  font-family: "Saira Extra Condensed", sans-serif;
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 500;
  line-height: 1.15;
  margin: 0;
  letter-spacing: 0.02rem;
}

.hero-lines p em {
  font-style: italic;
  color: #a9c4ef;
}

.hero-scroll {
  margin-top: 2.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  animation: gallery-bounce 2s infinite;
}

.hero-scroll:hover {
  background: rgba(255, 255, 255, 0.2);
}

@keyframes gallery-bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

.wrap {
  max-width: 75rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* Keep the Rooms heading visible when the hero cue scrolls this section below
   the fixed header. */
#selector {
  scroll-margin-top: 5rem;
}

/* When a single room is open there is no video hero, so keep clear of the
   fixed header. */
#room:not(.hidden) {
  padding-top: 4rem;
}

/* After the visitor leaves the hero, the rooms grid sits directly under the
   fixed header too, so give it the same clearance. */
#hero.hidden ~ .wrap #selector {
  padding-top: 4rem;
}

.intro {
  margin-bottom: 2rem;
}

.intro h1 {
  font-size: 3rem;
  line-height: 1;
  color: var(--ink);
}

.intro p {
  color: var(--muted);
  margin: 0.5rem 0 0;
}

/* ===== Topic selector ===== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.topic-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0;
  display: block;
  width: 100%;
  background: var(--panel);
}

.topic-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.topic-tile:hover img,
.topic-tile:focus-visible img {
  transform: scale(1.05);
}

.tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8, 10, 22, 0.82),
    rgba(8, 10, 22, 0.02) 65%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 1.1rem;
  text-align: left;
}

.tile-label {
  font-family: "Saira Extra Condensed", sans-serif;
  text-transform: uppercase;
  color: #fff;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}

.tile-count {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* ===== Room (thumbnail grid) ===== */
.room-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.5rem;
}

.room-head h1 {
  font-size: 2.8rem;
  line-height: 1;
}

.room-head .count {
  color: var(--muted);
}

.back-link {
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03rem;
  font-size: 0.9rem;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.5rem;
}

.thumb-grid .thumb-btn {
  border: 0;
  padding: 0;
  margin: 0;
  background: var(--panel);
  cursor: pointer;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  display: block;
}

.thumb-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.thumb-grid .thumb-btn:hover img,
.thumb-grid .thumb-btn:focus-visible img {
  transform: scale(1.06);
}

/* ===== Aerial video room: poster tiles that open the clip on Drive ===== */
.video-tile {
  position: relative;
  display: block;
  grid-column: span 2;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: var(--panel);
  text-decoration: none;
}

.video-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.video-tile:hover img,
.video-tile:focus-visible img {
  transform: scale(1.04);
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(13, 16, 32, 0.55);
  border: 2px solid rgba(244, 245, 248, 0.9);
  transition: background 0.2s ease, transform 0.2s ease;
}

.video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #f4f5f8;
}

.video-tile:hover .video-play,
.video-tile:focus-visible .video-play {
  background: rgba(111, 176, 230, 0.85);
  transform: translate(-50%, -50%) scale(1.08);
}

.video-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  color: var(--ink);
  background: linear-gradient(to top, rgba(6, 8, 16, 0.85), transparent);
}

.hidden {
  display: none !important;
}

/* ===== Lightbox (native dialog) ===== */
.lightbox {
  border: 0;
  padding: 0;
  margin: auto;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(6, 8, 16, 0.94);
}

.lb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.lb-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lb-caption {
  color: #e9ecf6;
  font-size: 0.95rem;
  margin: 0;
  min-height: 1.2em;
  text-align: center;
}

.lb-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lb-prev {
  left: 1.25rem;
}

.lb-next {
  right: 1.25rem;
}

.lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lb-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

@media (prefers-reduced-motion: reduce) {
  .topic-tile img,
  .thumb-grid img {
    transition: none;
  }
  .hero-scroll {
    animation: none;
  }
}

@media (max-width: 600px) {
  .lb-btn {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.3rem;
  }
  .lb-prev {
    left: 0.4rem;
  }
  .lb-next {
    right: 0.4rem;
  }
}
