/* ======================================================================
   studio.css — Seamless masonry stacking with exact column counts
   ====================================================================== */

:root {
  --content-max: 1200px;
  --gap: 16px;

  --text-bg: #ffffff;
  --text-fg: #111111;
  --muted: #8b8b8b;
  --border: #dedede;
  --shadow: 0 3px 14px rgba(0,0,0,0.18);
  --accent: #e67e00;
}

/* Global reset + dark page background */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  background: #444;
  color: #fff;
  font-family: var(--font-body, system-ui, sans-serif);
}

/* Limit and center the main content */
.app-main.studio-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px;
  background: transparent;
}

/* Toolbar */
.sc-toolbar-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.sc-artist { font-size: 1.05rem; font-family: var(--font-heading, inherit); color: #f2f2f2; }
.sc-count  { color: var(--muted); font-size: 0.95rem; text-align: right; }

/* =================== Gallery (masonry) =================== */
/* Force exact column counts; keep 4 on desktop */
.gallery {
  column-count: 4;                 /* ✅ exactly four columns on PC */
  column-gap: var(--gap);
  width: 100%;
}

/* Cards flow into columns as blocks (seamless masonry) */
.painting {
  display: inline-block;
  width: 100%;
  margin: 0 0 var(--gap);
  vertical-align: top;

  /* robust break-inside for Chrome/Safari/Firefox */
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;

  background: #fff;
  color: var(--text-fg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  outline: none;
  transition: box-shadow 180ms ease, border-color 180ms ease, transform 150ms ease;
}

.painting:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  border-color: #cfcfcf;
  transform: translateY(-2px);
}

.painting img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: #f3f3f3;
}

.painting h3 {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  padding: 10px 14px 6px;
  color: #111;
  font-family: var(--font-heading, inherit);
  border-top: 1px solid var(--border);
}

.painting p {
  margin: 0;
  padding: 0 14px 12px;
  color: #666;
  font-size: 0.92rem;
  line-height: 1.35;
  background: var(--text-bg);
  border-top: 1px solid var(--border);
}

.gallery-status {
  margin: 12px 0;
  color: #eee;
  font-size: 0.95rem;
  text-align: center;
}

/* =================== Lightbox =================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  grid-template-rows: 64px 1fr 64px;
  grid-template-areas:
    "close close close"
    "left  figure right"
    ".     .      .";
  background: rgba(10,10,12,0.88);
  backdrop-filter: blur(3px);
}
.lightbox.hidden { display: none; }

.lb-close {
  grid-area: close;
  justify-self: end;
  align-self: start;
  margin: 12px 12px 0 0;
  width: 44px; height: 44px;
  border: none; border-radius: 8px;
  color: #fff;
  background: rgba(255,255,255,.12);
  font-size: 28px;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255,255,255,.2); }

.lb-nav {
  align-self: center;
  width: 44px; height: 44px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.10);
  font-size: 30px;
  cursor: pointer;
}
.lb-left  { grid-area: left;  justify-self: center; }
.lb-right { grid-area: right; justify-self: center; }
.lb-nav:hover { background: rgba(255,255,255,.18); }

.lb-figure {
  grid-area: figure;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  align-items: center;
  justify-items: center;
  padding: 12px;
}

#lightbox-img {
  max-width: 92vw;
  max-height: 74vh;
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  transition: transform .2s ease;
  background: #000;
}

.lb-caption {
  max-width: 92vw;
  color: #eee;
  text-align: center;
}
.lb-caption h3 { margin: 0 0 6px; font-size: 1.05rem; }
.lb-caption .lb-desc { margin: 0; color: #d7d7d7; font-size: .95rem; }

/* =================== Responsive =================== */
/* Keep 4 columns down to 900px viewport, then 3, then 2 on phones */
@media (max-width: 1200px) {
  .gallery { column-count: 2; }
}
@media (max-width: 900px) {
  .app-main.studio-page { padding: 14px; }
  .gallery { column-count: 1; column-gap: 14px; }
  #lightbox-img { max-width: 95vw; max-height: 64vh; }
}
