/* CSS variables now defined in style.css :root for centralized management */

/* ===== Search bar ===== */
.searchbar {
  max-width: var(--maxw);
  margin: 1rem auto 1.25rem;
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.searchbar input[type="search"] {
  flex: 1 1 320px;
  min-width: 220px;
  padding: 0.55rem 0.75rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--offwhite);
  font: inherit;
  box-shadow: 0 6px 0 var(--ink);
}

.searchbar input[type="search"]::placeholder {
  opacity: 0.7;
}

#search-clear {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--offwhite);
  font-weight: 700;
  cursor: var(--cursor-pointer);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

#search-clear:hover {
  color: var(--ink);
  background-color: var(--bg-analogous);
  box-shadow: 0 6px 0 var(--ink);
  transform: translateY(-2px);
}

#search-clear:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

#search:focus {
  outline: none;
}

/* ===== Filters & Pager ===== */
.filters {
  max-width: var(--maxw);
  margin: 0.5rem auto 1rem;
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Force a line break before the year chips */
#filters .spacer {
  flex: 0 0 100%;
  height: 0; /* it's just a break */
  margin: 0;
  padding: 0;
}

/* Make the divider a full-width horizontal rule on that new line */
#filters .vdiv {
  flex: 0 0 100%;
  height: 2.5px;
  background: var(--ink);
  opacity: 0.8;
  margin: 0.25rem 0 0.35rem;
  border-radius: var(--radius-pill);
}

.chip {
  cursor: var(--cursor-pointer);
  user-select: none;
  padding: 0.5rem 0.8rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--offwhite);
  font-weight: 700;
  box-shadow: 0 6px 0 var(--ink);
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  /* Firefox optimization: hint browser to optimize color/shadow changes on active */
  will-change: background-color, color, box-shadow;
}

.chip:hover {
  background-color: var(--bg-analogous);
  box-shadow: 0 8px 0 var(--ink), 0 8px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.chip:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--ink);
}

.chip.is-active {
  background: var(--accent);
  color: var(--offwhite);
}

.chip:hover[data-name="ziggy"],
.chip:hover[data-name="elliot"] {
  background: var(--elliot-light);
}

/* Unique active colors for specific character chips */
.chip.is-active[data-name="ziggy"],
.chip.is-active[data-name="elliot"] {
  background: var(--elliot); /* hot pink-red for Ziggy */
  color: var(--offwhite);
}

.chip:hover[data-name="nsfw"] {
  background: var(--bg-analogous);
  color: var(--accent);
}

/* Unique active colors for specific character chips */
.chip.is-active[data-name="nsfw"]{
  background: var(--ink); /* hot pink-red for Ziggy */
  color: var(--accent);
}

/* Optional: style year chips a touch smaller (inherits .chip) */
.chip.year {
  background: var(--offwhite);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
}

.chip.year:hover {
  background-color: var(--year-light);
}

.chip.year.is-active {
  background: var(--year-color);
  color: var(--ink);
}

/* ==============================
   Pager (page numbers + arrows)
   ============================== */

.pager {
  max-width: var(--maxw);
  margin: 0.5rem auto 2.5rem;
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.page-btn {
  /* Button base */
  cursor: var(--cursor-pointer);

  appearance: none;
  -webkit-appearance: none;
  border: 3px solid var(--ink);
  background: var(--offwhite);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.85rem;
  min-width: 2.25rem;
  text-align: center;
  font-weight: 800;
  font-family: inherit;
  line-height: 1;
  cursor: var(--cursor-pointer);
  user-select: none;

  /* Chunky shadow + animation */
  box-shadow: 0 6px 0 var(--ink), 0 8px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(0);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.page-btn[disabled] {
  opacity: 0.45;
  cursor: var(--cursor-unavailable);
  box-shadow: none;
  transform: none;
}

/* Disabled state */
.page-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: var(--cursor-unavailable);
  transform: none;
  box-shadow: none;
}

.page-btn.is-active {
  background: var(--accent);
  color: var(--offwhite);
  border-color: var(--ink);
}

/* Active + hover: slight highlight while staying "pressed" */
.page-btn.is-active:hover {
  background-color: var(--accent);
}

/* Pager links: no underline, inherit color */
.pager .page-btn {
  text-decoration: none;
  color: inherit;
}

/* Also normalize visited/active/focus states */
.pager .page-btn:link,
.pager .page-btn:visited,
.pager .page-btn:active,
.pager .page-btn:focus {
  text-decoration: none;
  color: inherit;
}

/* Hover: lift a bit and tint */
.page-btn:hover:not([disabled]):not(.is-active) {
  box-shadow: 0 8px 0 var(--ink), 0 12px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  background-color: var(--bg-analogous);
}

/* Active (pressed): push down */
.page-btn:active:not([disabled]) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink), 0 6px 14px rgba(0, 0, 0, 0.08);
}

/* Focus ring for keyboard nav */
.page-btn:focus-visible {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

/* ===== Loading effects (lightbox + full page) ===== */
img.is-loading {
  visibility: hidden;
  background: linear-gradient(
    90deg,
    #f2f2f2 0%,
    #ececec 40%,
    var(--offwhite) 50%,
    #ececec 60%,
    #f2f2f2 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
  border-bottom: 3px solid var(--ink);
}

@keyframes shimmer {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0.4;
  }
}

.lightbox .frame.loading::after,
.detail-hero.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  background: radial-gradient(
    closest-side,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.65),
    transparent
  );
  pointer-events: none;
}

.lightbox .frame.loading::before,
.detail-hero.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 4px solid var(--ink);
  border-top-color: transparent;
  border-radius: var(--radius-circle);
  box-shadow: 0 4px 0 var(--ink);
  animation: spin 0.8s linear infinite;
  z-index: 2;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Gallery Grid ===== */
.gallery {
  max-width: var(--maxw);
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px 18px;
  /* rows x cols */
  /* Firefox optimization: contain layout only (not paint) to allow hover transforms to extend outside */
  contain: layout style;
}

/* Card base + hover highlight */
.card {
  position: relative;
  background: var(--offwhite);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(0);
  transition: transform var(--transition-medium), box-shadow var(--transition-medium),
    background-color var(--transition-medium), border-color var(--transition-medium);
  cursor: var(--cursor-pointer);
  display: flex;
  flex-direction: column;
  /* Firefox optimization: contain layout only, not paint/size to allow hover transform */
  contain: layout style;
  /* Firefox optimization: hint browser to optimize box-shadow changes on hover */
  will-change: box-shadow, transform;
}

.card:hover {
  transform: translateY(-3px);
  background-color: var(--bg-complementary);
  border-color: var(--ink-complementary);
  box-shadow: 0 14px 0 var(--ink-complementary), 0 16px 28px rgba(0, 0, 0, 0.28);
  color: var(--ink-complementary);
}

.card:focus-visible {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
  background-color: var(--bg-analogous);
  box-shadow: 0 14px 0 var(--ink), 0 16px 28px rgba(0, 0, 0, 0.28);
}

/* Keep the square media on top; content flows under it */
.card .thumb-wrap {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  /* Ensure image fills the rounded space perfectly - remove line-height and font-size spacing */
  line-height: 0;
  font-size: 0;
}

.card-body {
  display: grid;
  grid-template-columns: clamp(84px, 24vw, 120px) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 1.1rem;
  align-items: center;
}

.card .meta span:first-child {
  transform-origin: left center;
  /* anchor the scaling on the left side */
  transition: transform var(--transition-fast);
}

.card:hover .meta span:first-child {
  transform: scale(1.05);
  font-weight: bold;
  color: var(--darkblue);
}

.card .meta span:first-child {
  position: relative;
}

.card:hover .thumb {
  filter: brightness(0.97);
}



/* gallery tiles (square) */
.thumb,
.thumb-media {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: opacity 0.3s ease-in;
  /* Prevent image dragging */
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: auto;
}

/* Loading skeleton for images */
.thumb.is-loading {
  opacity: 0;
  background: linear-gradient(
    90deg,
    var(--offwhite) 0%,
    rgba(245, 245, 245, 0.8) 50%,
    var(--offwhite) 100%
  );
  /* Optimized for Firefox: use opacity fade instead of background-position */
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
}

/* Meta row: Title (left), Art Tag (right) */
.meta {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 0.7rem 0.8rem;
  gap: 0.6rem;
  align-items: center;
}

.meta .tag {
  font-size: 0.85rem;
  background: var(--offwhite);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.5rem;
}

.meta-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Reserve a fixed title block height (2 lines) so cards align */
.meta > :first-child {
  line-height: 1.25;
  display: -webkit-box; /* clamp for WebKit/Blink */
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden; /* hide overflow after 2 lines */
  min-height: calc(1.25em * 2); /* reserve the space even for 1-line titles */
}

/* Credits row: Artist (left), Date (right — aligned to tag column) */
.card .credits {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 0.8rem 0.8rem;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: auto;
}

.card .credits a {
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid currentColor;
}

.card .credits a:hover {
  display: inline-block; /* needed so transform works properly */
  animation: wiggle 0.6s ease-in-out;
}

.credits .who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.card .credits .date {
  font-size: 0.85rem;
  opacity: 0.75;
  justify-self: end;
}

/* Variant badge - number of versions/alts */
.variant-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--offwhite);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--ink);
  user-select: none;
  /* Prevent text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  /* Prevent dragging in Safari/Chrome */
  cursor: var(--cursor-default);
  /* Show normal cursor, not text cursor */
  background-color: var(--offwhite);
}

.card:hover .variant-pill,
.variant-pill:hover {
  animation: wiggle 1s ease-in-out;
  background-color: var(--bg-complementary-light);
  border: 3px solid var(--ink-complementary);
  box-shadow: 0 4px 0 var(--ink-complementary);
  color: var(--ink-complementary);
}

/* Avatars (cards + lightbox caption + full page) */
.avatar {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
  background: var(--offwhite);
  vertical-align: middle;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  /* Pad the overlay from the top by header height so we never clip it */
  padding: var(--overlay-gap);
  padding-top: calc(
    var(--overlay-gap) + var(--header-h) + env(safe-area-inset-top)
  );
  padding-bottom: calc(var(--overlay-gap) + env(safe-area-inset-bottom));
  pointer-events: none;
}

.lightbox.is-open {
  display: flex;
  pointer-events: auto;
}

.lightbox .frame {
  position: relative;
  background: var(--offwhite);
  border: 4px solid var(--ink);
  border-radius: 16px;
  max-width: min(1080px, 96vw);
  max-height: calc(
    100vh - (var(--header-h) + (var(--overlay-gap) * 2)) -
      env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  overflow: auto; /* keep inner scrollbars off non-media rows */
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.lightbox img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-bottom: 3px solid var(--ink);
}

/* Full Page button at top-right of expanded card */
.lb-toplink {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border-radius: 999px;
}

/* Fixed Navigation Buttons */
.lb-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background: var(--offwhite);
  border: 3px solid var(--ink);
  pointer-events: auto;
  cursor: var(--cursor-pointer);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.lb-nav-prev {
  left: 12px;
}

.lb-nav-next {
  right: 12px;
}

/* Hide nav buttons on very small screens */
@media (max-width: 600px) {
  .lb-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  .lb-nav-prev {
    left: 8px;
  }
  .lb-nav-next {
    right: 8px;
  }
}

/* Caption and controls */
.lightbox .cap {
  padding: 0.45rem 0.8rem;
  /* was ~.6 .1rem */
  display: flex;
  gap: 0.6rem;
  /* keep controls comfy */
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.lightbox .cap a {
  font-weight: 700;
}

/* Wiggle the lightbox caption URL */
.lightbox .cap a:hover {
  display: inline-block;
  animation: wiggle 0.6s ease-in-out;
}

/* No wiggle for description preview links */
.lb-description-preview a:hover {
  animation: none !important;
  transform: none !important;
  display: inline !important;
}

#lb-caption {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

#lb-caption a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: var(--cursor-pointer);
}

#lb-caption a:hover {
  text-decoration: underline;
}

#lb-caption .artist-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--offwhite);
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}



/* ===============================
   Safety: generic text overflow
   =============================== */

#lb-caption,
.detail-wrap,
.detail-meta,
.cameo-panel {
  min-width: 0;
}

#lb-caption,
#lb-caption * {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Lightbox expand + prev/next hover states */
#lightbox #lb-open,
#lightbox .lb-nav-btn,
#lightbox #lb-close {
  transition: color var(--transition-medium), background-color var(--transition-medium), transform var(--transition-medium);
  color: var(--ink);
  /* default dark color */
}

/* Hover = turn red */
#lightbox #lb-open:hover,
#lightbox .lb-nav-btn:hover,
#lightbox #lb-close:hover {
  color: var(--offwhite);
  /* your red accent */
  background-color: var(--accent);
  /* subtle red tint background */
  cursor: var(--cursor-pointer);
}

/* Scale up nav buttons on hover for better feedback */
#lightbox .lb-nav-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

/* Press down effect when clicking nav buttons */
#lightbox .lb-nav-btn:active {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Disqus section in lightbox */
.lb-disqus {
  padding: 0.5rem 1rem;
  border-top: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--offwhite);
}

.disqus-reactions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.disqus-reaction-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink);
}

.disqus-reaction-item .emoji {
  font-size: 1.1rem;
}

/* Reactions content container */
.reactions-content {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.react-label {
  font-size: 0.9rem;
  color: var(--gray);
  flex-shrink: 0;
}

/* Preview content container */
.disqus-preview {
  font-size: 0.9rem;
  flex: 1;
  min-width: 200px;
}

.disqus-preview-content {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.comment-count-text {
  color: var(--gray);
  font-size: 0.9rem;
}

.view-comments-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-medium);
  flex-shrink: 0;
  white-space: nowrap;
}

.view-comments-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.disqus-preview a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-medium);
}

.disqus-preview a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.disqus-comment-count {
  color: var(--gray);
  margin-right: 0.5rem;
}

/* Reaction buttons */
.reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--offwhite);
  font-size: 1.2rem;
  text-decoration: none;
  transition: background-color var(--transition-medium), transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium), color var(--transition-medium);
  cursor: var(--cursor-pointer);
  padding: 0;
  margin: 0;
  font-family: inherit;
  line-height: 1;
}

.reaction-btn:hover {
  transform: scale(1.15);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.reaction-btn:active {
  transform: scale(0.95);
  background: var(--accent);
}

/* Reaction animation for when clicked */
@keyframes reaction-pulse {
  0% {
    transform: scale(1);
    background: var(--offwhite);
  }
  50% {
    transform: scale(1.3);
    background: var(--accent);
    box-shadow: 0 0 20px rgba(221, 56, 97, 0.6);
  }
  100% {
    transform: scale(1);
    background: var(--offwhite);
  }
}

.reaction-btn.reacted {
  animation: reaction-pulse 0.5s ease-out;
}

.disqus-preview {
  flex: 1;
  min-width: 200px;
}

.reaction-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Lightbox image loading effects ===== */
/* Lightbox media box: reserves space with aspect-ratio so no jump */
#lightbox .lb-media {
  position: relative;
  width: min(92vw, 1100px);
  max-height: calc(100vh - 8rem);
  margin: 0 auto;
  display: grid;
  place-items: center;
  flex: 1 1 auto; /* grow and shrink */
  min-height: 0; /* critical so it can actually shrink */

  /* default aspect if unknown; JS will set --lb-ar to w/h */
  aspect-ratio: var(--lb-ar, 4 / 3);
}

/* Shimmer placeholder shown while loading */
#lightbox .lb-media::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.18) 20%,
    rgba(255, 255, 255, 0.06) 40%
  );
  background-size: 200% 100%;
  opacity: 0;
  pointer-events: none;
}

/* Turn the shimmer on while loading */
#lightbox.is-loading .lb-media::before {
  opacity: 1;
  animation: shimmer 1.2s linear infinite;
}

/* Image transition (no size change here) */
#lightbox .lb-media img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  filter: blur(6px);
  transition: opacity var(--transition-slow), transform 0.35s ease, filter 0.35s ease;
  /* Firefox optimization: hint browser to optimize filter changes */
  will-change: filter, opacity, transform;
}

#lightbox .lb-media img,
#lightbox .lb-media video {
  max-height: 100%; /* capped by whatever space is left */
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Reveal once loaded */
#lightbox.is-loaded .lb-media img {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

/* NON-MEDIA ROWS: fixed height, never allowed to shrink */
.lightbox .cap,
#lightbox .variant-strip,
.lightbox .cameo-panel {
  flex: 0 0 auto; /* fixed block size */
}

/* Variant strip */
.variant-strip {
  display: flex;
  gap: var(--vgap);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.6rem 0.8rem 0.5rem;
  /* was ~1.2rem 1rem */
  border-top: 3px solid var(--ink);
  background: var(--offwhite);
  margin-top: 0.5rem;
  /* was 1.5rem */
  flex-wrap: nowrap;
  scroll-snap-type: x proximity; /* optional: nice snap */
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.variant-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  height: auto; /* let labels dictate height */
  width: auto; /* remove fixed 60px */
  flex: 0 0 auto;
  cursor: var(--cursor-pointer);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  scroll-snap-align: start;
}

/* Avoid hover lift causing vertical collision */
/* .variant-item:hover { transform: none; } */

.variant-item:hover {
  transform: translateY(-3px);
}

.variant-item .variant-thumb {
  transition: opacity var(--transition-fast);
}

.variant-item:hover .variant-thumb {
  opacity: 0.85;
}

.variant-item:hover .thumb-label {
  color: var(--accent);
  /* fallback to red if --accent not defined */
  font-weight: bold;
}

.variant-item .thumb-label {
  overflow-wrap: anywhere;
  white-space: normal;
}

.variant-thumb {
  border: 3px solid var(--ink);
  border-radius: var(--radius-md);
  object-fit: cover;
  cursor: var(--cursor-pointer);
  background: var(--offwhite);
  aspect-ratio: 1/1;
}

.thumb-label {
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
  max-width: calc(var(--vthumb) + 24px);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variant-thumb.is-active {
  outline: 3px solid var(--accent);
}

/* video fallback thumb (no poster available) */
.variant-thumb.video {
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #000;
  color: var(--offwhite);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
}

/* Black-square fallback for video tiles in the gallery */
.thumb.video-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--ink);
  color: var(--offwhite);
  font-weight: 900;
  border-bottom: 0;
  /* matches .thumb styling */
}

/* ===== Cameo panels ===== */
.cameo-panel {
  display: flex;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  flex-wrap: nowrap; /* chips move to new rows when needed */
  gap: 0.5rem 0.6rem;
  padding: 0.5rem 0.75rem;
  overflow-x: auto; /* horizontal scroll */
  overflow-y: hidden; /* no vertical growth */
  border-top: 3px dashed var(--ink);
  background: var(--offwhite);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  /* Optional: fade edges hinting at scroll */
  mask-image: linear-gradient(
    to right,
    transparent 0,
    black 16px,
    black calc(100% - 16px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    black 16px,
    black calc(100% - 16px),
    transparent 100%
  );
}

.cameo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--bg-analogous);
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700;
  width: max-content;
  text-decoration: none;
  /* <-- remove underline if <a> */
  color: inherit;
  /* <-- inherit parent text color */
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

/* ===============================
   Cameo chips: wrap without squish
   =============================== */

.cameo-panel .cameo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  flex: 0 0 auto; /* fixed in the row */
  scroll-snap-align: start;
  max-width: 220px; /* prevent super-wide chips */
}

/* Avatar stays fixed; text can wrap to next line inside the pill */
.cameo-panel .cameo-chip .avatar {
  width: 32px;
  height: 32px; /* your requested size */
  flex: 0 0 auto;
}

.cameo-panel .cameo-chip .cameo-name,
.cameo-panel .cameo-chip .text-run {
  min-width: 0;
  overflow-wrap: anywhere; /* wrap long names/usernames */
  white-space: nowrap;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cameo-chip:hover {
  background: var(--offwhite);
  box-shadow: 0 6px 0 var(--ink), 0 8px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
  cursor: var(--cursor-pointer);
}

.cameo-chip:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

/* === Cameo chip links: no text decoration === */
.cameo-chip a,
.cameo-chip a:visited,
.cameo-chip a:hover,
.cameo-chip a:focus {
  text-decoration: none !important;
  border: 0 !important;
  box-shadow: none !important;
  color: inherit;
  /* keep chip color */
}

/* Optional: keep an accessible focus style without underlines */
.cameo-chip a:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

/* Prevent selection/dragging inside cameo chips */
.cameo-chip,
.cameo-chip * {
  user-select: none;
  /* Prevent text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  /* Prevent dragging in Safari/Chrome */
}

/* Lightbox cameo panel: tighter spacing */
.lightbox .cameo-panel {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-top: 3px dashed var(--ink);
  background: var(--offwhite);
  flex: 0 0 auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.lightbox .cameo-chip {
  gap: 0.3rem;
  padding: 0.35rem 0.5rem;
  margin: 0.2rem;
}

.lightbox .cameo-panel .cameo-chip {
  flex: 0 0 auto;
  max-width: 220px;
  scroll-snap-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapse cameo panel completely when hidden */
.cameo-panel[hidden] {
  display: none !important;
  border-top: none !important;
  padding: 0 !important;
}

/* === Media unification (image + video) === */
.thumb-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

.thumb-video {
  background: #000;
}

/* play badge on video tiles */
.play-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: var(--offwhite);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--ink);
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

/* lightbox media area */
.media-wrap {
  position: relative;
}

#lb-media img,
#lb-media video {
  width: 100%;
  height: auto;
  max-height: 55vh;
  display: block;
  object-fit: contain;
  border-bottom: 3px solid var(--ink);
  background: #000;
  /* nice background for videos */
}

/* ===== Full-page detail (art.html) ===== */
.detail-wrap {
  max-width: 1080px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.detail-hero {
  position: relative;
  background: var(--offwhite);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Cap media size so it never overwhelms viewport */
.detail-hero img,
.detail-hero video {
  width: 100%;
  height: auto;
  max-height: 72vh;
  /* <<< keeps it reasonable */
  display: block;
  object-fit: contain;
  /* good backdrop for videos/letterbox */
}

/* Title/credits BELOW the media; normal-weight title */
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.8rem 1rem;
  border-top: 3px solid var(--ink);
  background: var(--offwhite);
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-top: 1.2rem;
  /* spacing under media */
  margin-bottom: 1.3rem;
  /* spacing above nav */
  min-width: 0; /* allow children to shrink */
}

/* Top row: title + author + tags */
.detail-meta .meta-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
  width: 100%;
}

/* Description row (below title/author) */
.detail-meta .meta-description {
  width: 100%;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 2px solid rgba(58, 27, 34, 0.15);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.9;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Description box styling - matches detail-meta design */
.detail-description {
  padding: 1rem 1.2rem;
  border-top: 3px solid var(--ink);
  background: var(--offwhite);
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-top: -0.5rem; /* slight overlap with meta */
  margin-bottom: 1.3rem;
  line-height: 1.5;
}

.detail-description .description-content {
  font-size: 0.95rem;
  color: var(--ink);
  white-space: pre-wrap; /* preserve line breaks */
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* ===============================
   Art detail: meta bar wrapping
   =============================== */

/* Right stack (tags + date) can wrap and drop below on narrow screens */
.detail-meta .right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  margin-left: auto; /* keep it to the right when there’s room */
  justify-self: end;
}

/* Tag group wraps across lines */
.detail-meta .tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

/* Defensive: very long single words in tags/dates won’t overflow */
.detail-meta .tag,
.detail-meta .date {
  overflow-wrap: anywhere;
  white-space: normal;
  min-width: 0;
}

.detail-meta .title {
  font-family: inherit;
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.25;
  display: flex;
  flex-wrap: wrap; /* wrap long titles/author to new lines */
  align-items: center;
  gap: 0.4rem 0.6rem;
  min-width: 0;
}

/* Ensure all inline bits inside can wrap and never overflow */
.detail-meta .title > * {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.detail-meta .title a {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  /* remove underline from the whole link */
  border-bottom: none;
  /* in case older styles used border-bottom on <a> */
  min-width: 0;
}

.detail-meta .title a .artist-name {
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.2;
  border-bottom: 2px solid currentColor;
  /* underline just the name text */
}

/* Wiggle the lightbox caption URL */
.detail-meta .title a .artist-name:hover {
  display: inline-block;
  animation: wiggle 0.6s ease-in-out;
}

/* Ensure the avatar never gets underlined or selected */
.detail-meta .title a .avatar {
  user-select: none !important;
  -webkit-user-drag: none !important;
  pointer-events: none;
  /* optional: lets you select the text without grabbing the img */
}

.detail-meta .title .avatar {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
  background: var(--offwhite);
  vertical-align: middle;
}

.detail-meta .tag {
  font-size: 0.9rem;
  background: var(--bg-analogous);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* Spacing for tags inside the meta title row */
#detail-meta .tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  /* adjust spacing between tag chips */
}

#detail-meta .tags-wrap .tag {
  margin: 0;
  /* remove any inline spacing */
  padding: 0.2rem 0.5rem;
}

/* Prev / Next under the meta */
.detail-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

/* Prev / Next buttons on fullscreen art page */
#detail-nav .btn {
  color: var(--ink);
  /* ensure default text is dark */
  transition: background var(--transition-medium), color var(--transition-medium);
  padding: 1rem 2rem;
  font-size: 1.3rem; /* adjust as needed */
}

/* Hover effect — tint background but keep text color */
#detail-nav .btn:hover {
  background: var(--accent);
  /* or your chosen accent color */
  color: var(--offwhite);
  /* force text to stay dark */
  cursor: var(--cursor-pointer);
}

/* -----------------------------------------
   Re-enable selection/drag for author link text
   (Full-screen slug meta row + Lightbox caption)
------------------------------------------ */

/* Keep the tiny avatar inside the author link non-draggable and not selectable */
.lightbox .cap a .avatar {
  user-select: none !important;
  -webkit-user-drag: none !important;
  pointer-events: none;
  /* optional: lets you select the text without grabbing the img */
}

.back {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.8rem;
  text-decoration: none;
  font-weight: 800;
  border-bottom: 2px solid currentColor;
}

/* Hide tags on cards when in lightbox (they appear in caption) */
.card .meta .tag {
  display: none !important;
}

/* thumbs: always square, always var-sized */
.variant-thumb,
.variant-thumb.video,
img.variant-thumb {
  width: var(--vthumb) !important;
  height: var(--vthumb) !important;
  flex: 0 0 var(--vthumb) !important; /* prevents flex shrink */
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* each tile’s column width follows the thumb */
.variant-item {
  flex: 0 0 calc(var(--vthumb) + 24px) !important;
  min-width: calc(var(--vthumb) + 24px) !important;
}

/* strip height follows the thumb (no vertical scroll) */
.variant-strip {
  height: var(--vstrip-h) !important;
  flex: 0 0 var(--vstrip-h) !important;
  overflow-y: hidden !important;
}

/* Subtle NSFW distinction */
.card.nsfw-card {
  background-color: var(--bg-analogous); /* light pink overlay */
}

.card.nsfw-card:hover {
  transform: translateY(-3px);
  background-color: var(--nsfw-tint);
  border-color: var(--ink);
  box-shadow: 0 14px 0 var(--ink), 0 16px 28px rgba(0, 0, 0, 0.28);
  color: var(--ink);
}


.card.nsfw-card:hover .meta span:first-child {
  transform: scale(1.05);
  font-weight: bold;
  color: var(--ink);
}