/* List View — full-bleed ledger: the table runs edge to edge under the
   full-width header; capping it floats an island on wide monitors. */
.list-view {
  width: 100%;
}

.movie-table {
  width: 100%;
}

.table-row {
  display: grid;
  grid-template-columns: 3fr 0.6fr 1.3fr 0.8fr 1fr 32px;
  padding: var(--spacing-lg) var(--page-gutter); /* rows breathe — 24 vertical */
  border-top: 1px solid transparent;
  border-bottom: 1px solid rgba(255, 255, 255, var(--opacity-faint));
  align-items: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
  min-height: 56px;
  gap: var(--spacing-sm);
  position: relative;
}

/* Poster thumbnail lives inside the title cell, so the column grid stays intact */
.table-row:not(.header) .table-cell.title {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-width: 0;
}

.list-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clean single-row cue: a faint background on the hovered row, nothing else.
   No sibling dimming, no border shifts. */
.table-row:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.85); /* left accent — prominent hover cue */
}

.table-row:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.85);
}

.table-row.header {
  font-size: var(--font-size-sm);
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, var(--opacity-quiet));
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
  cursor: default;
  border-top: none;
  border-bottom: 1px solid rgba(255, 255, 255, var(--opacity-faint));
  background: var(--bg-color);
  position: sticky;
  min-height: 32px;
  top: var(--header-height);
  z-index: 10;
  padding: var(--spacing-xs) var(--page-gutter);
}

.table-row.header:hover {
  background: var(--bg-color);
  box-shadow: none; /* header row is not interactive — no hover accent */
  border-top-color: transparent;
  border-bottom-color: rgba(255, 255, 255, var(--opacity-border));
}

.main-content.search-open .table-row.header {
  top: calc(var(--header-height) + var(--search-height));
}

.table-row.header .table-cell {
  cursor: pointer;
  transition: color 0.2s ease;
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, var(--opacity-quiet));
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-label);
}

.table-row.header .table-cell:hover {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.table-row.highlighted {
  animation: highlight 3s ease forwards;
}

@keyframes highlight {
  0%,
  40% {
    background: rgba(255, 255, 255, var(--opacity-border));
  }
  100% {
    background: transparent;
  }
}

.table-cell {
  font-size: var(--font-size-base);
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  letter-spacing: var(--letter-spacing);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.table-row .table-cell.expand {
  text-align: right;
}

.table-cell.title {
  font-size: var(--font-size-md);
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, var(--opacity-bright));
  position: relative;
  letter-spacing: var(--letter-spacing);
  transition: color var(--transition);
}

.table-row:hover .table-cell.title {
  color: rgba(255, 255, 255, var(--opacity-primary));
}

.table-cell.year {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  font-variant-numeric: tabular-nums;
}

.table-cell.country {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.table-cell.director {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.table-cell.genre {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  letter-spacing: var(--letter-spacing);
}

.table-cell.tags {
  padding: 0;
}

.tag {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  background: rgba(255, 255, 255, var(--opacity-ghost));
  border: 1px solid rgba(255, 255, 255, var(--opacity-border));
  padding: 4px 12px;
  margin-right: 0;
  white-space: nowrap;
  letter-spacing: var(--letter-spacing-body);
  border-radius: 0;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
  cursor: default;
}

.tag.clickable {
  cursor: pointer;
}

.tag:hover {
  border-color: rgba(255, 255, 255, var(--opacity-muted));
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.tag.clickable:hover {
  border-color: rgba(255, 255, 255, var(--opacity-muted));
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  /* kept separate from .tag:hover: non-clickable tags keep cursor:default */
}

.tag.more {
  color: var(--text-quaternary);
  background: transparent;
  border-color: var(--border-light);
}

/* +N expander inside the modal tag list: pill-shaped button, not a row link */
.tag-toggle {
  font: inherit;
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing-body);
  cursor: pointer;
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.tag-toggle:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, var(--opacity-muted));
}

.expand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: var(--font-size-lg);
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  border: none;
  transition: color var(--transition);
  font-weight: var(--font-light);
}

.table-row:hover .expand-icon {
  color: rgba(255, 255, 255, var(--opacity-secondary));
}

/* Expanded Content */
.expanded-content {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, var(--opacity-faint));
  border-bottom: 1px solid rgba(255, 255, 255, var(--opacity-faint));
  overflow: hidden;
}

/* Selected film inverts to a light ledger card — same move phone already makes,
   now on desktop too. Header row + its content panel go white with dark text. */
/* Expanded row: quiet dark highlight, not a bright white panel. The open
   film reads as lifted (brighter title, faint tint) without inverting. */
.table-row.expanded {
  background: rgba(255, 255, 255, var(--opacity-border)); /* selected row reads at a glance */
}
.table-row.expanded .table-cell.title {
  color: rgba(255, 255, 255, var(--opacity-primary));
}
.table-row.expanded .expanded-content {
  background: rgba(255, 255, 255, var(--opacity-faint));
  border-bottom-color: rgba(255, 255, 255, var(--opacity-faint));
}

.table-row.expanded + .table-row .expanded-content {
  animation: expandRow 0.2s ease-out;
}

@keyframes expandRow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.expanded-inner {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--spacing-3xl);
  padding: var(--spacing-xl) var(--page-gutter) var(--spacing-2xl);
}

.expanded-details {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.expanded-poster {
  width: 280px;
  aspect-ratio: 2/3;
  background: rgba(255, 255, 255, var(--opacity-ghost));
  border: none;
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
}

/* Facts block lives inside .expanded-poster; phone-only (2-col header) */
.expanded-facts {
  display: none;
}

.expanded-facts-meta {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, var(--opacity-quiet));
  line-height: var(--line-height-base);
}

.expanded-facts-genre {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.expanded-facts-vibe {
  font-size: var(--font-size-base); /* vibe tier: one size everywhere — matches body */
  font-style: italic;
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.expanded-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.expanded-warnings,
.expanded-synopsis,
.expanded-recommendations,
.expanded-trivia,
.expanded-tags {
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: rgba(255, 255, 255, var(--opacity-secondary));
  letter-spacing: var(--letter-spacing-body);
}

.expanded-warnings:last-child,
.expanded-synopsis:last-child,
.expanded-recommendations:last-child,
.expanded-tags:last-child {
  margin-bottom: 0;
}

.expanded-warnings strong,
.expanded-synopsis strong,
.expanded-recommendations strong,
.expanded-trivia strong,
.expanded-tags strong {
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, var(--opacity-tertiary)); /* eyebrow tier matches the modal */
  display: block;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  font-size: var(--font-size-sm); /* eyebrow tier: 12px everywhere */
  letter-spacing: var(--letter-spacing-label);
}

/* Spoiler Reveal Button */
.spoiler-hidden {
  display: inline;
}

.spoiler-reveal-btn {
  display: inline-flex;
  align-items: baseline;
  background: none;
  border: none;
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  font-family: var(--font-family);
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
  /* same ▸ disclosure grammar as TAGS / CONTENT WARNING — no underline link */
}

.spoiler-reveal-btn:hover {
  color: rgba(255, 255, 255, var(--opacity-bright));
}

.trivia-content {
  margin: 0;
  line-height: 1.6;
}

.trivia-content.spoiler-revealed {
  animation: fadeInSpoiler 0.4s ease;
}

@keyframes fadeInSpoiler {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spoiler-hide-btn {
  display: inline;
  margin-left: 8px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, var(--opacity-quiet));
  font-family: var(--font-family);
  font-size: inherit;
  letter-spacing: inherit;
  transition: color 0.2s ease;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.spoiler-hide-btn:hover {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.expanded-synopsis p,
.expanded-recommendations p,
.expanded-trivia p {
  margin: 0;
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-body);
  color: rgba(255, 255, 255, var(--opacity-secondary));
  font-size: var(--font-size-base);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Content Warnings - styles are inherited from .expanded-warnings above */

/* Researched content warnings — ▸ disclosure (renderWarnings) */
.cw-toggle {
  display: inline-flex;
  align-items: baseline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-family);
  color: rgba(255, 255, 255, var(--opacity-tertiary)); /* actionable label — info floor */
  letter-spacing: var(--letter-spacing-body);
  transition: color 0.2s ease;
}

.cw-toggle:hover {
  color: rgba(255, 255, 255, var(--opacity-primary));
}

.cw-arrow {
  display: inline-block;
  margin-right: 6px;
  font-size: var(--font-size-xs);
  line-height: 1;
  transform: translateY(-1px);
  transition: transform 0.2s ease;
  color: rgba(255, 255, 255, var(--opacity-subtle));
}

.cw-toggle.open .cw-arrow {
  transform: translateY(-1px) rotate(90deg);
}

.cw-toggle-label {
  text-transform: uppercase;
  font-size: var(--font-size-sm); /* eyebrow tier — matches modal section labels */
  letter-spacing: var(--letter-spacing-label);
}

.cw-count {
  margin-left: 8px;
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, var(--opacity-quiet));
  font-variant-numeric: tabular-nums;
}

.cw-list {
  list-style: none;
  margin: var(--spacing-sm) 0 0;
  padding: 0;
  animation: fadeInSpoiler 0.3s ease;
}

.cw-item {
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, var(--opacity-faint));
}

.cw-item:first-child {
  border-top: none;
  padding-top: 4px;
}

.cw-tag {
  /* deliberately above chip tier — content warnings must read, not squint */
  font-size: var(--font-size-base);
  color: rgba(255, 255, 255, var(--opacity-bright));
}

.cw-lvl {
  margin-left: 8px;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
}

.cw-lvl-graphic {
  color: rgba(255, 255, 255, var(--opacity-bright));
}
.cw-lvl-depicted {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}
.cw-lvl-referenced {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
} /* severity info — meets the info floor */

.cw-note {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

.cw-info {
  position: relative;
  font-size: var(--font-size-compact);
  color: rgba(
    255,
    255,
    255,
    var(--opacity-tertiary)
  ); /* interactive info affordance — floor 0.55 */
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: color 0.2s ease;
}

.cw-info:hover {
  color: rgba(255, 255, 255, var(--opacity-tertiary));
}

/* Backdrop overlay when tooltip is active */
.cw-info.active::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9998;
}

.cw-tooltip {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 340px;
  max-width: 90vw;
  height: fit-content;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0d0d0d 0%, #080808 100%);
  border: 1px solid rgba(255, 255, 255, var(--opacity-border));
  padding: var(--spacing-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-regular);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  white-space: normal;
  z-index: 9999;
  text-align: left;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.cw-tooltip p {
  margin-bottom: var(--spacing-md);
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  line-height: 1.6;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--font-size-base);
  font-weight: var(--font-regular);
}

.cw-tooltip strong {
  color: rgba(255, 255, 255, var(--opacity-primary));
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  font-weight: var(--font-medium);
}

.cw-info.active .cw-tooltip {
  display: block;
}

.cw-tooltip-close {
  display: block;
  width: 100%;
  margin-top: var(--spacing-md);
  padding: 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, var(--opacity-border));
  color: rgba(255, 255, 255, var(--opacity-tertiary));
  font-size: var(--font-size-sm);
  font-weight: var(--font-regular);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-body);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  font-family: var(--font-family);
}

.cw-tooltip-close:hover {
  background: rgba(255, 255, 255, var(--opacity-faint));
  border-color: rgba(255, 255, 255, var(--opacity-dim));
  color: rgba(255, 255, 255, var(--opacity-primary));
}

/* Dim siblings on hover — gallery, hybrid, and list */
/* Only activates on elements that have finished their scroll-reveal (.gsap-revealed).
   These rules out-specify the base card rules, and `transition` replaces the
   whole list — so they must carry the FULL list (opacity + the card's own
   transform/border/background transitions) or the hover lift/tint snaps. */
/* Gallery keeps the sibling-dim (image grid reads well that way).
   The row views (hybrid ledger) do not — dimming a whole column of text
   on every hover is noise. */
.gallery-view:hover .gallery-item.gsap-revealed {
  opacity: 0.85;
  transition:
    opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.35s ease;
}

.gallery-view:hover .gallery-item.gsap-revealed:hover {
  opacity: 1;
  transition:
    opacity 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.35s ease;
}

/* Hybrid View - Archive ledger: full-bleed rows, hairline rules, no card boxes */
.hybrid-view {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: 0 var(--page-gutter);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Cards again: boxed, bordered, breathing room inside and between.
   Fixed height keeps every row identical regardless of title/meta wrapping. */
.hybrid-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 50%, 720px); /* wide plate: real 16:9 backdrop, no portrait crop */
  gap: 0;
  align-items: stretch;
  /* height follows content — footer hugs the synopsis, no dead void on short
     cards. Image plate uses object-fit:cover so it always fills (crops, never
     letterboxes) whatever height the text column ends up. */
  min-height: 260px;
  background: rgba(255, 255, 255, var(--opacity-ghost));
  border: 1px solid rgba(255, 255, 255, var(--opacity-border));
  /* transform intentionally NOT transitioned — GSAP owns transform on cards
     (reveal y-tween); a CSS transition here double-eases every GSAP frame */
  transition:
    background 0.3s ease,
    border-color 0.3s ease;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  will-change: transform;
}

.hybrid-item:hover {
  background: rgba(255, 255, 255, var(--opacity-faint));
  border-color: rgba(255, 255, 255, var(--opacity-tertiary));
}
/* image lifts on hover — brightness only, NO scale (1-bit dither moirés when scaled) */
.hybrid-item:hover .hybrid-image img {
  filter: brightness(1.12) contrast(1.04);
}
.hybrid-item:hover .hybrid-title {
  color: #fff;
}
.hybrid-image img {
  transition: filter 0.3s ease;
}

.hybrid-item:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, var(--opacity-subtle));
}

.hybrid-item.highlighted {
  border-color: rgba(255, 255, 255, var(--opacity-subtle));
}

.hybrid-image {
  width: 100%;
  height: 100%;
  /* real backdrop proportions: the 16:9 plate sets the row height, card grows
     taller instead of cropping the still into a portrait sliver. If the text
     column is taller the img cover-crops mildly — never portrait again. */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0a0a0a;
}

.hybrid-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Films with no backdrop fall back to a 2:3 poster; anchor the crop to the
     top so the title/faces survive instead of a mid-body slice. ponytail:
     band-aid until backdrop assets land for the ~19 missing films. */
  object-position: center top;
  display: block;
}

/* No zoom on hover: scaling a 1-bit dither causes moiré shimmer */

.hybrid-info {
  padding: var(--spacing-2xl); /* editorial interior — 48 desktop / 32 mobile via token */
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  /* structured column, not floating-centered: title block top, synopsis,
     footer rail pinned to the bottom edge — the card reads composed, not
     abandoned, at any content length */
}

.hybrid-footer {
  /* consistent air above the footer rail instead of margin-top:auto pushing
     it to a fixed bottom — so the rail hugs the text at any card height */
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, var(--opacity-faint));
  font-size: var(--font-size-base); /* vibe tier: one size everywhere — matches body */
  font-style: italic;
  color: rgba(255, 255, 255, var(--opacity-quiet));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62ch;
}

.hybrid-title {
  font-size: var(--font-size-2xl);
  color: rgba(255, 255, 255, var(--opacity-primary));
  font-weight: var(--font-regular);
  letter-spacing: var(--letter-spacing-display-tight);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-sm);
}

.hybrid-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing);
  color: rgba(
    255,
    255,
    255,
    var(--opacity-secondary)
  ); /* lifted from tertiary — meta read too faint */
  /* title + info are the header; the synopsis is its own block below — real air */
  margin-bottom: var(--spacing-2xl);
}

.hybrid-meta span:not(:last-child)::after {
  content: '·';
  margin-left: var(--spacing-sm);
  color: rgba(255, 255, 255, var(--opacity-muted));
}

.hybrid-synopsis {
  font-size: var(--font-size-base); /* unified body size */
  color: rgba(255, 255, 255, 0.82); /* lifted from 0.72 — synopsis read faint */
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-body);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Poster View - art scroll: one poster after another, room to breathe, title on hover */
/* Roadmap scroll: posters wind down the page left/right at varied sizes,
   interlocking vertically; the scroll reveal prints them as you reach them */
.gallery-view {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  padding: 0 var(--page-gutter);
  max-width: 1080px;
  margin: 0 auto;
}

.gallery-view .gallery-item {
  width: 46%;
}

.gallery-view .gallery-item:nth-child(2n) {
  align-self: flex-end;
}

.gallery-view .gallery-item:nth-child(3n + 1) {
  width: 54%;
}

.gallery-view .gallery-item:nth-child(3n + 2) {
  width: 40%;
}

/* interlock: each even item rises into the gap beside its neighbour */
.gallery-view .gallery-item:nth-child(2n) {
  margin-top: calc(var(--spacing-3xl) * -3);
}

.gallery-view .gallery-item:first-child,
.gallery-view .gallery-item:nth-child(2) {
  margin-top: 0;
}

/* Hybrid view mobile */

/* Criterion-clean: no border, no fill — the poster is the card */
.gallery-item {
  background: transparent;
  border: none;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.gallery-item:focus-visible {
  outline: 1px solid rgba(255, 255, 255, var(--opacity-subtle));
  outline-offset: 2px;
}

.gallery-item.highlighted {
  outline: 1px solid rgba(255, 255, 255, var(--opacity-subtle));
  outline-offset: 2px;
}

.gallery-image {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3; /* Proper poster proportions */
  overflow: hidden;
  background: #0a0a0a;
}

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

/* Overlay reveal — clean poster at rest; hover dims the whole plate evenly
   (no gradient) and the caption appears. No zoom: scaling a 1-bit dither
   causes moiré shimmer */

.gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--spacing-lg);
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover .gallery-overlay,
.gallery-item:focus-visible .gallery-overlay {
  opacity: 1;
}

.gallery-title {
  font-size: var(--font-size-lg);
  color: rgba(255, 255, 255, var(--opacity-primary));
  font-weight: var(--font-regular);
  letter-spacing: var(--letter-spacing-display-tight); /* one title tracking across views */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, var(--opacity-tertiary)); /* one meta tier across all views */
  line-height: var(--line-height-base);
  margin-top: 2px;
}

.gallery-meta span:not(:last-child)::after {
  content: '·';
  margin-left: var(--spacing-sm);
  color: rgba(255, 255, 255, var(--opacity-quiet));
}

/* Dust motes — 1px squares, the starfield's grammar, drifting inside each
   poster after the develop (variant C from test-dither-premium.html).
   Decorative only, peak opacity 0.30 (below the 0.35 floor). */
.gallery-item .dust {
  position: absolute;
  top: 96%;
  width: 2px;
  height: 2px;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.gallery-item .dust.d1 {
  left: 22%;
  animation: gallery-mote 13s linear infinite;
  animation-delay: var(--dd, 0s);
}

.gallery-item .dust.d2 {
  left: 58%;
  width: 1px;
  height: 1px;
  animation: gallery-mote 17s linear infinite;
  animation-delay: var(--dd, 2s);
}

.gallery-item .dust.d3 {
  left: 81%;
  animation: gallery-mote 21s linear infinite;
  animation-delay: var(--dd, 5s);
}

@keyframes gallery-mote {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  8% {
    opacity: 0.3;
  }
  50% {
    transform: translate(6px, -46%);
  }
  92% {
    opacity: 0.3;
  }
  100% {
    transform: translate(-4px, -92%);
    opacity: 0;
  }
}

/* View Controls - Bottom Left */
.view-controls-bottom {
  position: fixed;
  bottom: calc(var(--page-gutter) + env(safe-area-inset-bottom, 0px));
  left: calc(var(--page-gutter) + env(safe-area-inset-left, 0px));
  display: flex;
  gap: 0;
  background: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, var(--opacity-muted));
  border-radius: 0;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.view-button {
  font-size: var(--font-size-xs);
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, var(--opacity-secondary));
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, var(--opacity-border));
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  transition:
    color 0.25s ease,
    background 0.25s ease;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-nav);
  font-family: var(--font-family);
}

.view-button:last-child {
  border-right: none;
}

.view-button:hover {
  color: #fff;
}

.view-button.active {
  color: #fff;
  background: rgba(255, 255, 255, var(--opacity-muted));
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
