/* =========================================================
   CCAA Galleries — archive grid, viewer, and lightbox
   ========================================================= */

/* ---------- Archive grid ---------- */
.ccaa-gallery-archive { padding: 48px 0 80px; }
.ccaa-gallery-archive-head { margin-bottom: 32px; }
.ccaa-gallery-archive-head h1 { font-family: var(--font-display); font-size: 40px; margin: 0 0 8px; color: var(--crest-deep); }
.ccaa-gallery-archive-head p { color: var(--ink-dim); margin: 0; }

.ccaa-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.ccaa-gallery-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
  display: block;
  color: inherit;
  text-decoration: none;
}
.ccaa-gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.ccaa-gallery-card-media { position: relative; aspect-ratio: 4/3; background: var(--crest-deep); overflow: hidden; }
.ccaa-gallery-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ccaa-gallery-card-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.6); font-family: var(--font-display); }

.ccaa-gallery-badge {
  position: absolute; top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(20,42,68,.78); color: #fff;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 20px;
}
.ccaa-gallery-badge svg { width: 13px; height: 13px; }

.ccaa-gallery-lock {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(212,167,58,.95); color: var(--crest-deep);
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 20px;
}
.ccaa-gallery-lock svg { width: 12px; height: 12px; }

.ccaa-gallery-card-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20,42,68,0); transition: background .18s ease;
}
.ccaa-gallery-card:hover .ccaa-gallery-card-play { background: rgba(20,42,68,.18); }
.ccaa-gallery-card-play svg { width: 46px; height: 46px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); opacity: 0; transition: opacity .18s ease; }
.ccaa-gallery-card:hover .ccaa-gallery-card-play svg { opacity: 1; }

.ccaa-gallery-card-body { padding: 16px 18px 20px; }
.ccaa-gallery-card-body h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 19px; color: var(--crest-deep); }
.ccaa-gallery-card-meta { font-size: 13px; color: var(--ink-dim); }

.ccaa-gallery-empty { padding: 60px 0; text-align: center; color: var(--ink-dim); }

/* ---------- Access-gated notice (locked gallery) ---------- */
.ccaa-gallery-locked {
  max-width: 640px; margin: 60px auto; padding: 40px 36px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); text-align: center;
}
.ccaa-gallery-locked svg { width: 42px; height: 42px; color: var(--gold); margin-bottom: 14px; }
.ccaa-gallery-locked h1 { font-family: var(--font-display); font-size: 26px; color: var(--crest-deep); margin: 0 0 10px; }
.ccaa-gallery-locked p { color: var(--ink-dim); margin: 0 0 22px; }
.ccaa-gallery-locked .ccaa-btn { display: inline-block; }

.ccaa-btn {
  background: var(--gold); color: var(--crest-deep); font-weight: 700;
  padding: 12px 26px; border-radius: 999px; text-decoration: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 15px;
}
.ccaa-btn:hover { filter: brightness(0.96); }

/* ---------- Single viewer shell ---------- */
.ccaa-gallery-viewer { padding: 40px 0 80px; }
.ccaa-gallery-title-row { margin-bottom: 24px; }
.ccaa-gallery-title-row h1 { font-family: var(--font-display); font-size: 34px; color: var(--crest-deep); margin: 0 0 8px; }
.ccaa-gallery-title-row .ccaa-gallery-count { color: var(--ink-dim); font-size: 14px; }

/* ---------- Image gallery: thumb grid + main preview ---------- */
.ccaa-viewer-layout { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .ccaa-viewer-layout { grid-template-columns: 1fr; } }

.ccaa-thumb-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.ccaa-thumb-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 860px) { .ccaa-thumb-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 480px) { .ccaa-thumb-grid { grid-template-columns: repeat(4, 1fr); } }

.ccaa-thumb-btn { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; aspect-ratio: 1/1; cursor: pointer; background: var(--surface-2); }
.ccaa-thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ccaa-thumb-btn.is-active { border-color: var(--gold); }

.ccaa-thumb-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--ink-dim); }
.ccaa-thumb-pager button { background: var(--surface-2); border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ccaa-thumb-pager button:disabled { opacity: .35; cursor: default; }
.ccaa-thumb-pager button svg { width: 14px; height: 14px; }

.ccaa-main-panel { background: var(--crest-deep); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); position: relative; }
.ccaa-main-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 10px 12px; background: rgba(0,0,0,.15); }
.ccaa-icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255,255,255,.12);
  color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s ease;
}
.ccaa-icon-btn:hover { background: rgba(255,255,255,.22); }
.ccaa-icon-btn svg { width: 18px; height: 18px; }
.ccaa-icon-btn[disabled],
.ccaa-icon-btn.is-disabled {
  opacity: .35; cursor: not-allowed; pointer-events: none; background: rgba(255,255,255,.08);
}

.ccaa-main-stage { position: relative; aspect-ratio: 4/3; background: #000; display: flex; align-items: center; justify-content: center; }
.ccaa-main-stage img, .ccaa-main-stage video { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ccaa-main-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.4); border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ccaa-main-nav:hover { background: rgba(0,0,0,.6); }
.ccaa-main-nav svg { width: 18px; height: 18px; }
.ccaa-main-nav.prev { left: 12px; }
.ccaa-main-nav.next { right: 12px; }

.ccaa-main-footer { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px; color: #fff; background: rgba(0,0,0,.15); font-size: 13px; letter-spacing: .02em; }

/* ---------- Video gallery grid (no side thumb rail) ---------- */
.ccaa-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.ccaa-video-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; }
.ccaa-video-card-media { position: relative; aspect-ratio: 16/9; background: var(--crest-deep); }
.ccaa-video-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ccaa-video-card-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ccaa-video-card-play svg { width: 52px; height: 52px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.45)); }
.ccaa-video-card-title { padding: 12px 14px; font-weight: 600; color: var(--crest-deep); }

/* ---------- Full-screen slideshow lightbox ---------- */
.ccaa-lightbox-overlay {
  position: fixed; inset: 0; background: rgba(10,14,22,.96); z-index: 99999;
  display: none; align-items: stretch; justify-content: stretch;
}
.ccaa-lightbox-overlay.is-open { display: flex; }

.ccaa-lightbox-sidebar {
  width: 64px; flex: 0 0 64px; display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 18px 0; background: rgba(0,0,0,.25);
}
.ccaa-lightbox-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 40px; }
.ccaa-lightbox-stage img, .ccaa-lightbox-stage video {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

/* The media wrapper needs an explicit, centered size — without it, an
   <iframe> (YouTube/Vimeo embeds) collapses to the browser's tiny
   default size instead of filling the stage. */
.ccaa-lightbox-media {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.ccaa-lightbox-media iframe {
  width: min(70vw, 1400px);
  height: min(70vh, 900px);
  border: 0; background: #000; display: block;
}
@media (max-width: 640px) {
  .ccaa-lightbox-media iframe { width: 100%; height: 100%; }
}

.ccaa-lightbox-close {
  position: absolute; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: none; color: #fff; display: flex; align-items: center;
  justify-content: center; cursor: pointer; z-index: 2;
}
.ccaa-lightbox-close:hover { background: rgba(255,255,255,.2); }
.ccaa-lightbox-close svg { width: 20px; height: 20px; }

.ccaa-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: none; color: #fff; display: flex; align-items: center;
  justify-content: center; cursor: pointer; z-index: 2;
}
.ccaa-lightbox-nav:hover { background: rgba(255,255,255,.18); }
.ccaa-lightbox-nav svg { width: 22px; height: 22px; }
.ccaa-lightbox-nav.prev { left: 18px; }
.ccaa-lightbox-nav.next { right: 18px; }

.ccaa-lightbox-progress { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; letter-spacing: .03em; opacity: .85; }

@media (max-width: 640px) {
  .ccaa-lightbox-sidebar { flex-direction: row; width: auto; flex-basis: auto; position: absolute; bottom: 0; left: 0; right: 0; justify-content: center; padding: 10px; }
  .ccaa-lightbox-stage { padding: 16px; }
  .ccaa-lightbox-nav { width: 42px; height: 42px; }
}

/* Downloads are intentionally disabled site-wide for gallery media.
   The disabled state below is purely visual reinforcement — the real
   enforcement (no download attribute, blocked context menu / drag,
   no href to the source file) happens in ccaa-galleries.js. */
.ccaa-icon-btn.ccaa-download[disabled] svg { opacity: .6; }
