/* ---------- Capa ---------- */

.album-page { padding-inline: 0; }

.cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  max-width: none;
  min-height: min(72vh, 640px);
  overflow: hidden;
  background: #111 var(--cover-thumb) center / cover;
  color: #fff;
}

.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  animation: cover-in 1.2s ease-out both;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0.35) 100%);
}

.cover-text {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px 40px;
}

.cover .back {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 20px;
  z-index: 1;
  color: #fff;
  opacity: 0.9;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.cover .back:hover { opacity: 1; }
.cover .kicker { color: #fdba74; margin-bottom: 8px; }

.cover h1 {
  margin: 0 0 8px;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

.cover .summary {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  opacity: 0.85;
}

@keyframes cover-in {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: none; }
}

/* ---------- Grade justificada ---------- */

.album-page main {
  max-width: 1200px;
  padding: 24px 12px 48px;
}

.jgrid {
  --row: 240px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.jgrid::after {
  content: "";
  flex-grow: 1e9;
}

.tile {
  position: relative;
  flex-grow: var(--r);
  flex-basis: calc(var(--r) * var(--row));
  overflow: hidden;
  background: var(--line);
  outline-offset: 2px;
}

.tile::before {
  content: "";
  display: block;
  padding-bottom: calc(100% / var(--r));
}

.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.tile:hover img { transform: scale(1.03); filter: brightness(1.06); }

.tile.video::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 7v10l8-5z'/%3E%3C/svg%3E") center / 20px no-repeat;
  backdrop-filter: blur(4px);
}

@media (max-width: 700px) {
  .jgrid { --row: 140px; gap: 3px; }
  .album-page main { padding-inline: 3px; }
}

.album-footer {
  max-width: 1200px;
  padding: 0 20px 64px;
  border: 0;
  text-align: center;
}

.album-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------- Visualizador ---------- */

.viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #050505;
  color: #fff;
  font-family: var(--sans);
}

.viewer[open] { animation: v-fade 0.25s ease-out; }
.viewer::backdrop { background: #000; }

.v-backdrop {
  position: absolute;
  inset: -60px;
  background: center / cover no-repeat;
  filter: blur(48px) saturate(1.3) brightness(0.35);
}

.v-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.v-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.v-track.animate { transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.24, 1); }

.v-slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  height: 100%;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px));
}

.v-media {
  position: relative;
  transform-origin: 0 0;
}

.v-media img,
.v-media video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-drag: none;
}

.v-media img.loading { filter: blur(8px); }
.v-media img { transition: filter 0.3s; }
.v-zoomable { transition: transform 0.3s ease; }

.v-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 20px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.v-count {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.v-actions { display: flex; gap: 4px; }

.viewer button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.3s;
}

.viewer button:hover { background: rgba(255, 255, 255, 0.14); }
.viewer button:focus-visible { outline: 2px solid #fdba74; }

.viewer svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 52px !important;
  height: 52px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(8px);
}

.v-nav:hover { background: rgba(255, 255, 255, 0.2) !important; }
.v-nav svg { width: 26px; height: 26px; }
.v-prev { left: 16px; }
.v-next { right: 16px; }

.v-strip {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  gap: 6px;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

.v-strip::-webkit-scrollbar { display: none; }
.v-strip::before, .v-strip::after { content: ""; flex: 1 0 0; }

.viewer .v-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #222 center / cover;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}

.viewer .v-thumb:hover { opacity: 0.8; background-color: #222; }
.viewer .v-thumb.active { opacity: 1; border-color: #fff; transform: scale(1.08); }
.viewer:focus { outline: none; }

.viewer.idle .v-top,
.viewer.idle .v-nav,
.viewer.idle .v-strip { opacity: 0; pointer-events: none; }

.v-top, .v-nav, .v-strip { transition: opacity 0.35s; }

@media (max-width: 700px), (hover: none) {
  .v-nav { display: none !important; }
  .v-slide { padding-inline: 0; }
  .v-media img, .v-media video { border-radius: 0; }
  .viewer .v-thumb { width: 44px; height: 44px; }
}

@keyframes v-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cover-img, .viewer[open] { animation: none; }
  .v-track.animate, .v-zoomable { transition: none; }
}
