/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Theme variables ──────────────────────────────────────── */
:root {
  --ui-color: #fff;
}

.theme-bright {
  --ui-color: #000;
}

/* ── Base ─────────────────────────────────────────────────── */
html, body {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow: hidden;
}

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 32px;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-name,
.nav-link {
  pointer-events: auto;
  color: var(--ui-color);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.4s ease, opacity 0.2s;
  line-height: 1;
}

.nav-name:hover,
.nav-link:hover {
  opacity: 0.5;
}

/* ── Artwork info — bottom left ───────────────────────────── */
.artwork-info {
  position: fixed;
  bottom: 28px;
  left: 32px;
  z-index: 100;
  text-align: left;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.artwork-title-link {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.artwork-title-link:hover {
  opacity: 0.55;
}

.link-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
  margin-bottom: 1px;
  opacity: 0.75;
  flex-shrink: 0;
}

.artwork-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ui-color);
  transition: color 0.4s ease;
}

.artwork-subtitle,
.artwork-year,
.artwork-materials,
.artwork-dimensions {
  display: block;
  font-size: 11px;
  font-weight: 300;
  opacity: 0.65;
  margin-top: 4px;
  letter-spacing: 0.04em;
  color: var(--ui-color);
  transition: color 0.4s ease;
}

.artwork-subtitle {
  white-space: pre-line;
}

.artwork-subtitle:empty,
.artwork-materials:empty,
.artwork-dimensions:empty {
  display: none;
}

/* ── Bottom-right controls ────────────────────────────────── */
.bottom-right {
  position: fixed;
  bottom: 28px;
  right: 32px;
  z-index: 100;
  transition: opacity 0.25s ease;
}

.btn-fullscreen {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ui-color);
  transition: color 0.4s ease, opacity 0.2s;
  line-height: 1;
}

.btn-fullscreen:hover {
  opacity: 0.5;
}

.btn-fullscreen-text {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* ── Side arrows ──────────────────────────────────────────── */
.arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  background: none;
  border: none;
  cursor: pointer;
  padding: 24px 28px;
  color: var(--ui-color);
  opacity: 0;
  pointer-events: none;
  transition: color 0.4s ease, opacity 0.25s ease;
  line-height: 0;
}

.arrow.visible {
  opacity: 0.45;
  pointer-events: auto;
}

.arrow.visible:hover {
  opacity: 1;
}

.arrow-left  { left: 0; }
.arrow-right { right: 0; }

/* ── Artworks scroll container ────────────────────────────── */
.artworks {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior: none;
}

.artworks::-webkit-scrollbar {
  display: none;
}

/* ── Single artwork section ───────────────────────────────── */
.artwork {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
}

/* ── Media track (horizontal scroll-snap) ────────────────── */
.media-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.media-track::-webkit-scrollbar {
  display: none;
}

/* ── Media items ──────────────────────────────────────────── */
.media-item {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  position: relative;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Image caption ────────────────────────────────────────── */
.media-caption {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 600px) {
  .media-caption {
    bottom: 36px;
  }
}

/* ── Fullscreen image overlay ─────────────────────────────── */
.overlay-image {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.overlay-image.active {
  display: flex;
}

.overlay-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* ── Vimeo full video overlay ─────────────────────────────── */
.overlay-vimeo {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
}

.overlay-vimeo.active {
  display: flex;
}

.overlay-vimeo iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Video player overlay ─────────────────────────────────── */
.overlay-video {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
}

.overlay-video.active {
  display: flex;
}

.overlay-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Close button (video overlay) */
.btn-close {
  position: absolute;
  top: 28px;
  right: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ui-color);
  opacity: 0.6;
  transition: color 0.4s ease, opacity 0.2s;
  line-height: 0;
  z-index: 1;
}

.btn-close:hover {
  opacity: 1;
}

/* ── Hidden state (used in fullscreen modes) ──────────────── */
.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav {
    padding: 22px 24px;
  }

  .nav-name,
  .nav-link {
    font-size: 11px;
  }

  .artwork-info {
    bottom: 24px;
    left: 24px;
  }

  .bottom-right {
    bottom: 24px;
    right: 24px;
  }

  .arrow {
    padding: 20px 20px;
  }
}

/* Safe area insets (notched phones) */
@supports (padding: env(safe-area-inset-bottom)) {
  .nav {
    padding-top: max(28px, env(safe-area-inset-top));
    padding-left: max(32px, env(safe-area-inset-left));
    padding-right: max(32px, env(safe-area-inset-right));
  }

  .artwork-info {
    bottom: max(28px, env(safe-area-inset-bottom));
    left: max(32px, env(safe-area-inset-left));
  }

  .bottom-right {
    bottom: max(28px, env(safe-area-inset-bottom));
    right: max(32px, env(safe-area-inset-right));
  }

  @media (max-width: 600px) {
    .nav {
      padding-top: max(22px, env(safe-area-inset-top));
      padding-left: max(24px, env(safe-area-inset-left));
      padding-right: max(24px, env(safe-area-inset-right));
    }

    .artwork-info {
      bottom: max(24px, env(safe-area-inset-bottom));
      left: max(24px, env(safe-area-inset-left));
    }

    .bottom-right {
      bottom: max(24px, env(safe-area-inset-bottom));
      right: max(24px, env(safe-area-inset-right));
    }
  }
}
