:root {
  --ink-charcoal: #4a4a4a;
  --ink-deep: #2e2e2e;
  --ink-gray: #cbcbcb;
  --ink-ivory: #ffffe3;
  --ink-slate: #6d8196;
  --bg: var(--ink-deep);
  --ink: var(--ink-ivory);
  --muted: var(--ink-gray);
  --accent: var(--ink-slate);
  --line: rgba(255, 255, 227, 0.16);
  --font-display: "Story Script", system-ui, sans-serif;
  --font-sans: "Elms Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
}

.art-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 0.75rem;
}

.back-home {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-home:hover {
  color: var(--ink);
}

.art-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.art-page {
  flex: 1 0 auto;
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.5rem 0 2.5rem;
}

.gallery {
  columns: 1;
  column-gap: 0.85rem;
}

@media (min-width: 560px) {
  .gallery {
    columns: 2;
  }
}

@media (min-width: 900px) {
  .gallery {
    columns: 3;
  }
}

@media (min-width: 1200px) {
  .gallery {
    columns: 4;
  }
}

.gallery-card {
  break-inside: avoid;
  margin: 0 0 0.85rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  position: relative;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.gallery-card:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.gallery-card-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #1a1a1a;
}

.gallery-card img,
.gallery-card video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pan-x, 50%) var(--pan-y, 50%);
  transform: scale(1.12);
  will-change: object-position;
}

.gallery-empty {
  color: var(--muted);
  font-size: 1rem;
  padding: 3rem 0;
}

/* Lightbox / artwork detail */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 60;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(46, 46, 46, 0.92);
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--ink-charcoal);
  color: #fff;
  outline: none;
}

.lightbox-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3.5rem 1rem 3rem;
}

.lightbox-inner {
  width: min(920px, 100%);
  margin: 0 auto;
}

.lightbox-header {
  margin-bottom: 1.5rem;
}

.lightbox-header h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.1;
}

.lightbox-description {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 40rem;
}

.lightbox-media {
  display: grid;
  gap: 1.25rem;
}

.lightbox-media figure {
  margin: 0;
}

.lightbox-media img,
.lightbox-media video {
  display: block;
  width: 100%;
  height: auto;
  background: #171717;
  border-radius: 2px;
}

.lightbox-media video {
  max-height: 80vh;
  margin-inline: auto;
}

.site-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 1.25rem 0 calc(1.1rem + env(safe-area-inset-bottom));
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-gray);
}

.site-footer a,
.site-footer a:visited,
.site-footer a:active {
  color: var(--ink-gray);
  text-decoration: underline;
  text-decoration-color: var(--ink-gray);
  text-underline-offset: 0.2em;
}

.site-footer a:hover {
  color: var(--ink-ivory);
  text-decoration-color: var(--ink-ivory);
}

body.lightbox-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card {
    transition: none;
  }
}
