/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:    #e8d1c2;
  --cream-lt: #f5ede5;
  --brown:    #3a2f25;
  --brown-md: #5b4636;
  --brown-lt: #81735c;
  --tan:      rgba(245,235,220,0.95);
  --blue-title: #3d4c70;
  --font-mono: "Courier Prime", "Courier New", monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-mono);
  color: var(--brown);
  background: var(--cream-lt);
}

a { color: inherit; text-decoration: none; }

/* ── Site header (shared by gallery + detail) ───────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background: var(--cream-lt);
  border-bottom: 1px solid rgba(58,47,37,0.12);
}

.site-header--dark {
  background: #1a1510;
  border-bottom-color: rgba(255,255,255,0.08);
  color: #e0d4c8;
}

.site-wordmark {
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--blue-title);
}

.site-header--dark .site-wordmark { color: #b8c4d8; }

.back-link {
  position: absolute;
  left: 2rem;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.back-link:hover { opacity: 1; }

/* ── HOME: hero ─────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  /* fallback color; image is set inline from DB or defaults to GCS via admin */
  background-color: #c8b8a8;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.hero-title {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--blue-title);
  font-size: 2rem;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(255,255,255,0.4);
  white-space: nowrap;
  z-index: 2;
}

.hero-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 45vh;
  background: linear-gradient(to bottom, transparent, var(--cream) 80%, var(--cream));
  z-index: 1;
}

/* ── HOME: statement ────────────────────────────────────────── */
.statement-section {
  background: var(--cream);
  padding: 5rem 2rem 6rem;
  text-align: center;
}

.statement-body {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.statement-body h3,
.statement-body h4 {
  text-align: center;
  color: var(--brown-md);
  margin: 2rem 0 1rem;
}

.statement-body p {
  line-height: 1.8;
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  text-align: justify;
  text-align-last: center;
}

.cta-wrapper { margin-top: 3rem; text-align: center; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background: var(--brown-lt);
  border: 1px solid #221e19;
  border-radius: 6px;
  color: #e1d7cf;
  font-family: var(--font-mono);
  font-weight: bold;
  letter-spacing: 0.04em;
  transition: background 0.18s, transform 0.18s;
}
.btn:hover { background: #393531; transform: scale(1.03); }

/* ── GALLERY ────────────────────────────────────────────────── */
.gallery-page {
  min-height: 100vh;
  background-color: #d4c4b4;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
  padding: 2.5rem 2rem 4rem;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-card {
  display: block;
  width: 250px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  transition: transform 0.2s, box-shadow 0.2s;
  background: transparent;
}
.gallery-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}

.gallery-card-media { position: relative; line-height: 0; }

.card-thumb {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.media-badge {
  position: absolute;
  bottom: 0.5rem; right: 0.5rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.audio-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #3a2f25, #5b4636);
}
.audio-icon { font-size: 3rem; color: rgba(255,255,255,0.6); }

.gallery-card-footer {
  background: var(--tan);
  padding: 0.75rem 1rem;
  border-top: 1px solid #d9cbb7;
  text-align: center;
}
.card-title {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: #4e3d2e;
  word-wrap: break-word;
}
.card-category {
  display: block;
  font-size: 0.8rem;
  color: #6a594b;
  margin-top: 0.2rem;
}

.empty-gallery {
  padding: 4rem;
  text-align: center;
  opacity: 0.6;
}

/* ── ART DETAIL ─────────────────────────────────────────────── */
.detail-page {
  min-height: 100vh;
  /* blur_url is set inline on <body>; fallback to dark */
  background-color: #1a1108;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--fg);
}

/* Semi-transparent overlay to deepen/soften the blur */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  pointer-events: none;
  z-index: 0;
}

/* ── Detail header ───────────────────────────────────────────── */
.detail-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(128,100,80,0.18);
}

.detail-back {
  font-size: 0.82rem;
  color: var(--fg-muted);
  transition: color 0.15s;
  letter-spacing: 0.03em;
}
.detail-back:hover { color: var(--fg); }

.detail-wordmark {
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--fg);
  opacity: 0.8;
}

/* ── Two-column layout ───────────────────────────────────────── */
.detail-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 56px);
}

@media (max-width: 860px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* ── Left: media ─────────────────────────────────────────────── */
.detail-media {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  overflow: hidden;
}

@media (max-width: 860px) {
  .detail-media {
    position: static;
    height: auto;
    min-height: 50vw;
    padding: 1.5rem;
  }
}

.detail-img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  /* Subtle shadow to lift the image off the blurred bg */
  box-shadow: 0 8px 48px rgba(0,0,0,0.55);
}

.detail-video {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

/* 16:9 responsive YouTube embed */
.detail-youtube {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.detail-youtube iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.detail-audio-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}
.audio-icon-lg {
  font-size: 5rem;
  opacity: 0.45;
  color: var(--fg);
}
.detail-audio {
  width: 100%;
  max-width: 380px;
}

/* ── Right: text panel ───────────────────────────────────────── */
.detail-content {
  display: flex;
  align-items: flex-start;
  padding: 3rem 2.5rem;
  overflow-y: auto;
}

/* No box — text floats directly on the blurred background */
.detail-panel {
  padding: 1rem 0;
  width: 100%;
}

.detail-title {
  font-size: 1.85rem;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
  line-height: 1.25;
  text-shadow: 0 1px 12px rgba(0,0,0,0.4);
}

.detail-category {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
  margin-bottom: 2rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

/* ── Prose (detail body) ─────────────────────────────────────── */
.prose {
  font-size: 1rem;
  line-height: 1.82;
  color: var(--fg);
  text-shadow: 0 1px 8px rgba(0,0,0,0.25);
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--fg);
  margin: 2rem 0 0.6rem;
  font-weight: 500;
}
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.1rem; }
.prose p  { margin-bottom: 1.1rem; }
.prose a  { color: var(--fg); text-decoration: underline; opacity: 0.8; }
.prose a:hover { opacity: 1; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.1rem; }
.prose li { margin-bottom: 0.3rem; }
.prose blockquote {
  border-left: 2px solid var(--fg-dim);
  padding-left: 1rem;
  color: var(--fg-muted);
  margin: 1.5rem 0;
  font-style: italic;
}
.prose code {
  background: rgba(128,100,80,0.15);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}
.prose pre {
  background: rgba(0,0,0,0.2);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.1rem;
}
.prose img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1rem 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.prose hr {
  border: none;
  border-top: 1px solid rgba(128,100,80,0.25);
  margin: 2rem 0;
}
.prose strong { color: var(--fg); }

/* ── Lightbox ────────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#lightbox.open { display: flex; }

#lb-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.25s;
  display: block;
}

.lb-close {
  position: fixed;
  top: 1.25rem; right: 1.75rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.lb-close:hover { opacity: 1; }
