/* Gallery pages: shared by /themes/ and /styles/. */

.gallery-hero {
  position: relative;
  padding-top: 72px;
  padding-bottom: 22px;
}
.gallery-hero::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -160px;
  height: 520px;
  background: radial-gradient(55% 55% at 45% 0%, var(--glow), transparent 72%);
  pointer-events: none;
}
.gallery-hero > * { position: relative; }
.gallery-hero h1 {
  margin: 16px 0 18px;
  font-size: clamp(40px, 5.6vw, 68px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}
.gallery-hero h1 .accent { color: var(--accent); }
.gallery-lede {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.6;
}
.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}
.gallery-section { padding-top: 30px; padding-bottom: 64px; }
.gallery-note {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.gallery-empty {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font: 12.5px/1.5 var(--mono);
}

/* Theme gallery */
.theme-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.theme-tile {
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.theme-preview {
  appearance: none;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.theme-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: opacity 150ms ease;
}
.theme-preview:hover img { opacity: 0.88; }
.theme-tile figcaption {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
}
.theme-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.theme-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.theme-title code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font: 10.5px/1.4 var(--mono);
}
.theme-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 19px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: 600 9px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-default { color: var(--accent); border-color: var(--accent); }
.badge-favorite { color: var(--text); border-color: var(--border-strong); }
.badge-current { color: var(--text); }
.theme-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.theme-actions .btn { height: 28px; padding: 0 9px; font-size: 11px; border-radius: 6px; }
.theme-actions .link-button { font-size: 10.5px; }

/* Lightbox */
.lightbox {
  width: min(1120px, 94vw);
  max-width: 94vw;
  max-height: 92vh;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}
.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.lightbox-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.lightbox img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92vh - 48px);
  object-fit: contain;
}
.lightbox-caption {
  margin: 0;
  color: var(--muted);
  font: 12px/1.4 var(--mono);
}
.lightbox-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { border-color: var(--accent); }

/* Styles gallery */
.style-gallery {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.style-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 26px;
  padding: 26px 0 30px;
  border-top: 1px solid var(--border);
}
.style-card:first-child { border-top: 0; padding-top: 0; }
.style-media {
  display: grid;
  gap: 12px;
  align-content: start;
}
.style-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.style-body { min-width: 0; }
.style-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.style-head h2 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.style-head code { color: var(--muted); font: 11px/1.4 var(--mono); }
.style-meta {
  margin: 6px 0 0;
  color: var(--accent);
  font: 11px/1.5 var(--mono);
}
.style-description {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.style-code {
  max-height: 290px;
  margin: 14px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  font: 12px/1.55 var(--mono);
  tab-size: 2;
}
.style-code code { white-space: pre; }
.style-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}
.style-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.style-card-full {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.style-card-full .style-body { order: 1; }
.style-card-full .style-media {
  order: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .theme-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-card { grid-template-columns: 1fr; gap: 18px; }
  .gallery-hero { padding-top: 56px; }
}
@media (max-width: 620px) {
  .theme-gallery { grid-template-columns: 1fr; }
  .style-card-full .style-media { grid-template-columns: 1fr; }
  .gallery-hero h1 { font-size: clamp(36px, 12vw, 54px); }
  .theme-actions { align-items: flex-start; flex-direction: column; gap: 6px; }
  .theme-actions .btn { width: 100%; }
  .lightbox { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: 0; }
  .lightbox img { max-height: calc(100vh - 48px); }
}
