:root {
  color-scheme: dark;
  --bg: #141312;
  --panel: rgba(25, 24, 23, 0.82);
  --panel-strong: rgba(12, 12, 12, 0.9);
  --text: #f4f0e8;
  --muted: #b9b0a2;
  --line: rgba(255, 255, 255, 0.16);
  --accent: #d6b36a;
  --accent-strong: #f1d18a;
  --danger: #c95f50;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.62)),
    url("../Aranxa_18/res/backgroundimages/05_leather.jpg") center / cover fixed,
    var(--bg);
}

button,
a {
  font: inherit;
}

.gallery-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  padding: 18px 0;
}

.topbar,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0;
}

.counter {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 8px 10px;
  text-align: center;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.photo-frame {
  position: relative;
  min-width: 0;
  height: min(72dvh, 740px);
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
}

.photo-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 1;
  transition: opacity 180ms ease, transform 220ms ease;
  user-select: none;
}

.photo-frame.is-loading img {
  opacity: 0;
  transform: scale(0.992);
}

.photo-frame figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82) 28%);
  min-height: 58px;
}

#title {
  font-weight: 700;
}

#meta {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.nav,
.controls button,
.controls a,
.music-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.38);
  cursor: pointer;
}

.nav {
  width: 54px;
  height: 70px;
  display: grid;
  place-items: center;
  font-size: 3rem;
  line-height: 1;
}

.nav:hover,
.controls button:hover,
.controls a:hover,
.music-toggle:hover {
  border-color: rgba(241, 209, 138, 0.62);
  background: rgba(214, 179, 106, 0.18);
}

.controls {
  justify-content: center;
  flex-wrap: wrap;
}

.controls button,
.controls a,
.music-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  text-decoration: none;
}

.music-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.thumb-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  scrollbar-color: var(--accent) rgba(255, 255, 255, 0.12);
}

.thumb {
  width: 92px;
  height: 70px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #111;
  cursor: pointer;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb[aria-current="true"] {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.65);
}

body.is-fullscreen .gallery-shell {
  width: min(1440px, calc(100vw - 18px));
}

body.is-fullscreen .topbar,
body.is-fullscreen .controls,
body.is-fullscreen .thumb-strip {
  background: rgba(0, 0, 0, 0.68);
}

@media (max-width: 760px) {
  .gallery-shell {
    width: min(100vw - 14px, 680px);
    gap: 10px;
    padding: 8px 0;
  }

  .topbar {
    min-height: 54px;
  }

  .counter {
    min-width: 72px;
    font-size: 0.9rem;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  .photo-frame {
    height: min(64dvh, 560px);
  }

  .nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 64px;
    background: rgba(0, 0, 0, 0.5);
  }

  .nav-prev {
    left: 6px;
  }

  .nav-next {
    right: 6px;
  }

  .photo-frame figcaption {
    display: block;
  }

  #meta {
    display: block;
    margin-top: 3px;
    text-align: left;
    font-size: 0.84rem;
  }

  .controls {
    justify-content: stretch;
  }

  .controls button,
  .controls a,
  .music-toggle {
    flex: 1 1 138px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-frame img {
    transition: none;
  }
}
