html {
    scrollbar-gutter: auto;
    overflow: hidden;
}

/* Dark mode */
html.dark body.project-page {
    background: #1A1716;
}

html.dark .close-link,
html.dark .prev-next a {
    color: #8d8d8d;
}

html.dark .close-link:hover,
html.dark .prev-next a:hover {
    color: #ddd;
}

html.dark .info-box {
    background: #1A1716;
}

html.dark .info-box h2 {
    color: #fff;
}

html.dark .info-box .meta {
    color: #8d8d8d;
}

html.dark .info-box .description {
    color: #cccccc;
}

html.dark .arrow svg path {
    fill: #444;
}

html.dark .arrow:hover svg path {
    fill: #ddd;
}

html.dark .dot {
    background: rgba(255, 255, 255, 0.1);
}

html.dark .dot.active {
    background: rgba(255, 255, 255, 0.7);
}

body.project-page {
  margin: 0;
  padding: 0;
  font-family: "Iowan Old Style", Georgia, serif;
  background: #fff;
  overflow: hidden;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0s ease;
}
.top-nav {
  position: fixed;
  top: 5vh;
  left: 5.5vw;
  right: 5.5vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}
.close-link {
  color: #aaa;
  text-decoration: none;
  font-size: 0.825rem;
  letter-spacing: 0.02em;
}

.close-link:hover {
  color: #000;
  text-decoration: underline;
}

.prev-next a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.825rem;
  letter-spacing: 0.02em;
}

.prev-next a:hover {
  color: #000;
  text-decoration: underline;
}

/* Slideshow */
.slideshow {
  width: 100%;
  height: 100vh;
  position: relative;
}

.slide {
  display: flex;
  position: absolute;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0s ease;
}

.slide.active {
  opacity: 1;
  pointer-events: all;
}

/* Landscape 3:2 */
.slide[data-layout="landscape"] .slide-inner {
  position: relative;
  height: 80vh;
  width: calc(80vh * 3 / 2);
  overflow: hidden;
}

.slide[data-layout="landscape"] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fullscreen landscape */
.slide[data-layout="fullscreen"] .slide-inner {
  width: 100vw;
  height: 100%;
}

.slide[data-layout="fullscreen"] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Portrait 3:4 */
.slide[data-layout="portrait"] .slide-inner {
  position: relative;
  height: 80vh;
  max-height: 80vh;
}

.slide[data-layout="portrait"] img {
  height: 100%;
  width: auto;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* Info box */
.info-box {
  position: fixed;
  bottom: 10vh;
  right: 5vw;
  width: 27vw;
  max-width: 600px;
  background: white;
  padding: 20px 40px 20px 40px;
  transition: opacity 0s ease, background-color 0s ease;
}

.info-box h2 {
  font-size: 1rem;
  font-weight: normal;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
  cursor: pointer;
}


.info-box .meta {
  font-size: 0.825rem;
  color: #aaa;
  margin-bottom: 10px;
}

.info-box .description {
  font-size: 0.825rem;
  color: #555;
  line-height: 1.5;
}

/* Arrows */
.arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-2vh);
  width: 1.8vh;
  height: 1.8vh;
  background: transparent;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: background 0.1s ease;
}

.arrow:hover {
  background: rgba(170, 170, 170, 0.5);
}

.arrow svg path { fill: #AAA; }
.arrow:hover svg path {  fill: #000; }

.arrow-prev { left: 5.75vw; }
.arrow-next { right: 5.75vw; }

.arrow-prev svg {  transform: rotate(180deg); }

/* Dots */
.dots {
  position: fixed;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3vw;
  z-index: 100;
}

.dot {
  width: 5px;
  height: 5px;
  background: #e6e6e6;
  cursor: pointer;
}

.dot.active {
  background: #555;
}

/* Desktop: white dots on fullscreen, hide info card on landscape/fullscreen */
@media (min-width: 768px) {
  .top-nav {
    left: max(5.5vw, calc(50vw - 60vh));
    right: max(5.5vw, calc(50vw - 60vh));
  }

  html.dark .slideshow:has(.slide[data-layout="fullscreen"].active) .dot {
    background: rgba(255, 255, 255, 0.3);
  }

  html.dark .slideshow:has(.slide[data-layout="fullscreen"].active) .dot.active {
    background: rgba(255, 255, 255, 1);
  }

  .slideshow:has(.slide:not(:first-child)[data-layout="landscape"].active) ~ .info-box,
  .slideshow:has(.slide:not(:first-child)[data-layout="fullscreen"].active) ~ .info-box {
    opacity: 0;
    pointer-events: none;
  }

  /* Dark mode: light text + arrows on fullscreen */
  html.dark body:has(.slide[data-layout="fullscreen"].active) .close-link,
  html.dark body:has(.slide[data-layout="fullscreen"].active) .prev-next a {
    color: rgba(255, 255, 255, 0.45);
  }

  html.dark body:has(.slide[data-layout="fullscreen"].active) .close-link:hover,
  html.dark body:has(.slide[data-layout="fullscreen"].active) .prev-next a:hover {
    color: rgba(255, 255, 255, 1);
  }

  html.dark body:has(.slide[data-layout="fullscreen"].active) .arrow svg path {
    fill: rgba(255, 255, 255, 0.45);
  }

  html.dark body:has(.slide[data-layout="fullscreen"].active) .arrow:hover svg path {
    fill: rgba(255, 255, 255, 1);
  }
}

/* Title row (shared, hidden on desktop) */
.info-title-row {
  display: block;
}

.mobile-prev-next {
  display: none;
}

html.dark .mobile-prev-next a {
  color: #555;
}

html.dark .mobile-prev-next a:hover {
  color: #ddd;
}

/* Mobile */
@media (max-width: 768px) {
  body.project-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    align-items: stretch;
    justify-content: center;
  }

  .top-nav {
    position: static;
    padding: 20px 24px 20px 40px;
    justify-content: flex-start;
  }

  .top-nav .prev-next {
    display: none;
  }

  .slideshow {
    flex: none;
    width: 100%;
    height: min(calc(100vw * 4 / 3), calc(100dvh - 220px));
    position: relative;
    overflow: visible;
  }

  .slide {
    position: absolute;
    inset: 0;
    flex-direction: row;
  }

  .slide[data-layout="landscape"] .slide-inner,
  .slide[data-layout="portrait"] .slide-inner,
  .slide[data-layout="fullscreen"] .slide-inner {
    width: 100%;
    height: 100%;
    max-height: none;
    flex-direction: row;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .slide[data-layout="landscape"] img,
  .slide[data-layout="fullscreen"] img,
  .slide[data-layout="portrait"] img {
    width: 100%;
    height: auto;
    object-fit: unset;
    aspect-ratio: auto;
  }

  /* Center img-dark to match flexbox-centered img-light */
  .slide[data-layout="landscape"] .img-dark,
  .slide[data-layout="fullscreen"] .img-dark {
    top: 50%;
    transform: translateY(-50%);
  }

  .slide[data-layout="portrait"] .slide-inner {
    overflow: hidden;
  }

  .slide[data-layout="portrait"] img {
    height: auto;
    object-fit: unset;
    max-height: none;
  }

  .info-box {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 20px 40px 28px;
    flex-shrink: 0;
  }

  .info-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
  }

  .info-title-row h2 {
    margin-bottom: 0;
  }

  .mobile-prev-next {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
  }

  .mobile-prev-next a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.825rem;
    letter-spacing: 0.02em;
  }

  .dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 101;
  }

  .slideshow:has(.slide[data-layout="portrait"].active) .dot {
    background: rgba(255, 255, 255, 0.2);
  }

  .slideshow:has(.slide[data-layout="portrait"].active) .dot.active {
    background: rgba(255, 255, 255, 1);
  }

  .arrow {
    display: flex;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }

  .arrow-prev { left: 20px; }
  .arrow-next { right: 20px; }
}