
/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  font-feature-settings: "kern";
  font-kerning: normal;
  text-rendering: geometricPrecision;
  background: #fff;
  color: #000;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; padding: 0; font: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }

/* ─── Preloader ──────────────────────────────────────────────────────────── */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #fff;
  pointer-events: none;
}
#preloader-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 0%;
  background: #000;
  transition: width 0.25s ease;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding: 22px 30px;
}
.header-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.header-nav a {
  font-size: 13px;
  letter-spacing: 0.02em;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
.header-nav a:hover { opacity: 1; }

/* ─── Grid ───────────────────────────────────────────────────────────────── */
#grid {
  padding: 180px 7.01vw 80px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  column-gap: 7.01vw;
  row-gap: 0;
  align-items: start;
}

/*
  Each tile is split into two implicit sub-rows via CSS subgrid:
  row 0 = fixed 255px image area (images bottom-align within it)
  row 1 = auto title

  We fake this without subgrid by giving every tile a fixed-height image
  wrapper. Since all wrappers are the same height, titles always align.
*/

.tile {
  cursor: pointer;
  margin-bottom: 224px; /* vertical rhythm between rows */
  opacity: 0;
}

.tile-image-wrap {
  height: 192px;
  display: flex;
  align-items: flex-end;   /* images sit at the bottom of the 204px box */
  justify-content: flex-start;
  overflow: hidden;
}

.tile-image-wrap img,
.tile-image-wrap video {
  max-height: 192px;
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile-image-wrap img.loaded,
.tile-image-wrap video.loaded {
  opacity: 1;
}

.tile:hover .tile-image-wrap img.loaded,
.tile:hover .tile-image-wrap video.loaded {
  opacity: 0.72;
}

.tile-title {
  display: none;
}

/* ─── About ──────────────────────────────────────────────────────────────── */
#about {
  padding: 80px 7.01vw 100px;
  opacity: 0;
}
.about-layout {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 7.01vw;
}
.about-inner {
  max-width: 50vw;
}
.about-portrait img {
  display: block;
  width: auto;
  height: auto;
  max-height: 500px;
}
.about-inner p {
  font-size: 20px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  margin-bottom: 1.2em;
}
.about-inner p:last-child { margin-bottom: 0; }

/* ─── Overlay ────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.overlay.is-open {
  pointer-events: all;
}

.overlay-close {
  position: absolute;
  top: 22px;
  right: 30px;
  font-size: 18px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  z-index: 10;
  padding: 8px;
}
.overlay-close:hover { opacity: 1; }

.overlay-mute {
  display: none;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.4;
  margin-right: 29px;
  transition: opacity 0.2s ease;
}
.overlay-mute.is-video { display: block; }
.overlay-mute.is-video:hover { opacity: 1; }

.overlay-description {
  display: none;
  position: absolute;
  bottom: 50px;
  left: 30px;
  width: 33.33%;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.5;
  z-index: 10;
  pointer-events: none;
  transition: color 0.3s ease;
}

.overlay-description.is-visible {
  display: block;
}

.overlay-project-title {
  position: absolute;
  bottom: 26px;
  left: 30px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.4;
  z-index: 10;
}

.overlay-nav {
  position: absolute;
  bottom: 22px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
}
.overlay-prev,
.overlay-next {
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.overlay-prev:hover,
.overlay-next:hover { opacity: 1; }

.overlay-counter {
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.35;
}

/* Media area — fullscreen */
.overlay-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.overlay-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.overlay-media img {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
}

.overlay-media img.is-portrait {
  height: 100vh;
  width: auto;
  max-width: 100vw;
}

.overlay-media img.is-landscape {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
}

.overlay-media img.is-doc {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
}

.overlay-media video {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  display: block;
}


/* Hide chrome on copy slides */
.overlay.is-copy .overlay-project-title,
.overlay.is-copy .overlay-nav { display: none; }

/* Copy slide */
.overlay-copy-slide {
  max-width: 700px;
  padding: 0 30px;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  text-align: left;
}

.overlay-copy-slide p {
  margin-bottom: 1.2em;
}

.overlay-copy-slide p:last-child {
  margin-bottom: 0;
}

/* Inline copy — overlaid at bottom */
.overlay-copy {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  padding: 0 80px;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  opacity: 0.6;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}

/* ─── Large screens (matching Solve's 16px body / 13px caption breakpoint) ── */
@media (min-width: 1640px) {
  body { font-size: 16px; }
}

/* ─── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #header { padding: 18px 20px; }

  #grid {
    padding: 70px 15px 0;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 12px;
    row-gap: 0;
  }

  .tile { margin-bottom: 128px; }
  .tile-image-wrap { height: 136px; }
  .tile-image-wrap img,
  .tile-image-wrap video { max-height: 136px; }

  #about { padding: 60px 20px 80px; }
  .about-layout { flex-direction: column; align-items: flex-start; gap: 40px; }
  .about-inner { max-width: 100%; }
  .about-portrait img { max-height: 360px; }

  .overlay-copy { padding: 0 20px; bottom: 18px; }
  .overlay-close { top: 18px; right: 20px; font-size: 22px; padding: 8px; }
  .overlay-description { left: 20px; bottom: 42px; width: 50%; font-size: 10px; }
  .overlay-project-title { left: 20px; bottom: 22px; font-size: 10px; }
  .overlay-nav { right: 20px; bottom: 8px; gap: 20px; }
  .overlay-prev,
  .overlay-next { font-size: 22px; padding: 8px; opacity: 0.5; }
  .overlay-counter { font-size: 11px; }

  /* Landscape images — fill width on mobile */
  .overlay-media img.is-landscape {
    width: 100vw;
    height: auto;
  }

  /* Portrait images — fill width on mobile */
  .overlay-media img.is-portrait {
    width: 100vw;
    height: auto;
    max-height: 100vh;
  }

  /* Doc slides — fill width, let height be natural */
  .overlay-media img.is-doc {
    width: 100vw;
    height: auto;
    max-height: none;
  }

  /* Copy slides — scrollable on mobile, vertically centered */
  .overlay-copy-slide {
    font-size: 16px;
    padding: 24px;
    max-width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}
