body { overflow-x: hidden; }

/* Nav — collapses to a hamburger below 760px, where 6 links stop fitting
   on one line. Plain CSS/JS, not Tailwind responsive classes, so it can't
   silently fail or drift out of sync like the showcase grid did. */
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 26px; height: 26px; background: none; border: none; padding: 0; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 1px; }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #060607;
    border-top: 1px solid #25242a;
    border-bottom: 1px solid #25242a;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links a { padding: 14px 20px; border-bottom: 1px solid #17161b; }
}
.outline-type { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.68); }
.hero-shade { background: linear-gradient(90deg,rgba(6,6,7,.98) 0%,rgba(6,6,7,.90) 28%,rgba(6,6,7,.34) 53%,rgba(6,6,7,.04) 75%),linear-gradient(0deg,rgba(6,6,7,.78),transparent 34%); }
.art-card .art-image { transition: transform .6s cubic-bezier(.16,1,.3,1), filter .3s ease; }
.art-card:hover .art-image { transform: scale(1.03); }
.art-card:hover .inspect-overlay { opacity: 1; }
.adult-image { filter: blur(30px) saturate(.65) brightness(.65); transform: scale(1.08); }
.modal-open { overflow: hidden; }

/* Category page grid — rows are built purely by row-math in JS
   (js/gallery-render.js), each row its own equal-column grid via an
   inline grid-template-columns. This CSS only handles ratios per row
   size and the mobile collapse. */
.gallery-row { display: grid; gap: 32px; margin-bottom: 40px; }
.gallery-row .row-ratio-1 { aspect-ratio: 21 / 9; }
.gallery-row .row-ratio-2 { aspect-ratio: 4 / 3; }
.gallery-row .row-ratio-3 { aspect-ratio: 1 / 1; }

@media (max-width: 640px) {
  .gallery-row { grid-template-columns: 1fr !important; gap: 20px; margin-bottom: 24px; }
  .gallery-row .row-ratio-1,
  .gallery-row .row-ratio-2,
  .gallery-row .row-ratio-3 { aspect-ratio: 4 / 3; }
}

img {
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Homepage showcase tiles — portrait works fine at 2/4-column widths, but
   collapses to a single full-width column on small screens, where a
   portrait box at full device width gets enormous. Go wide there instead.
   Column-count and aspect-ratio are both plain px-based CSS on purpose —
   mixing this with Tailwind's rem-based max-sm/max-[900px] breakpoints
   caused the two to drift apart on non-default root font sizes, leaving
   a width range where the layout was still single-column but already
   back to portrait. Now both switch at the exact same breakpoint, always. */
.home-showcase { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.showcase-tile { aspect-ratio: 3 / 4; }

@media (max-width: 900px) {
  .home-showcase { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .home-showcase { grid-template-columns: 1fr; }
  .showcase-tile { aspect-ratio: 16 / 9; }
}

@media (max-width: 900px) {
  .hero-shade { background: linear-gradient(0deg,#060607,rgba(6,6,7,.18) 65%); }
  .hero-title { line-height: .92; letter-spacing: -.03em; }
  .hero-title .outline-type { filter: drop-shadow(0 2px 6px rgba(0,0,0,.85)); }
}

/* Viewer modal layout — plain media query, no Tailwind arbitrary variants,
   so it can't silently fail to apply. */
.viewer-window {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  max-height: 90vh;
}
.viewer-arrows-mobile { display: none; }

@media (max-width: 900px) {
  .viewer-window {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto auto;
    max-height: 94vh;
  }
  .viewer-arrow-desktop { display: none; }
  .viewer-arrows-mobile { display: flex; }
  .viewer-image-wrap { padding: 12px; }
  .viewer-img { max-height: 58vh; }
  .viewer-aside { border-left: none; border-top: 1px solid #25242a; padding: 20px; }
  .viewer-title { font-size: 28px; }
}

/* Image loading state + broken-image fallback. Applied to any wrapper
   marked .media-box (gallery cards, the lightbox, homepage showcase
   tiles). Shows a shimmering placeholder until the <img> inside fires
   load/error (handled inline in gallery-render.js / viewer.js / home.js),
   then either fades the real image in or shows a graceful fallback
   instead of a broken-image icon. */
.media-box { position: relative; }
.media-box img { opacity: 0; transition: opacity .35s ease; }
.media-box.is-loaded img { opacity: 1; }
.media-box.has-error img { display: none; }
.media-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #131217 25%, #1c1b21 37%, #131217 63%);
  background-size: 400% 100%;
  animation: media-shimmer 1.4s ease infinite;
}
.media-box.is-loaded::before { display: none; }
.media-box .media-fallback {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #66646d;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  text-align: center;
  padding: 20px;
}
.media-box.has-error .media-fallback { display: flex; }
@keyframes media-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
