/*
 * RecoveryCompass — Center Gallery
 * Premium editorial architecture.
 * Luxury through restraint. Geometry through rhythm.
 *
 * Namespace : .rc-gallery  /  .rcg-*  /  .rcgv-* (viewer)
 * Tokens    : --forest, --gold, --cream, --ink, --border, --serif, --sans
 */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SECTION SHELL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rc-gallery {
  position: relative;
  padding: 0 0 108px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EDITORIAL INTRO — eyebrow + title + rule
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rc-gallery-intro {
  max-width: 680px;
  margin: 0 auto 72px;
  padding: 28px 32px 0;
  text-align: center;
  border-top: 1px solid var(--border, #E4DECE);
}

.rc-gallery-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--gold, #B8924A);
  margin-bottom: 18px;
}

.rc-gallery-heading {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 48px);
  font-weight: 400;
  font-style: italic;
  color: var(--ink, #1C1A16);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 26px;
}

.rc-gallery-heading-rule {
  display: block;
  width: 36px;
  height: 1px;
  background: rgba(28, 26, 22, 0.18);
  margin: 0 auto;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SECTION DIVIDERS  — 01 ARRIVAL & EXTERIOR ———
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-section {
  margin-bottom: 80px;
}

.rcg-section:last-child {
  margin-bottom: 0;
}

.rcg-section-head {
  max-width: 1160px;
  margin: 0 auto 28px;
  padding: 0 32px 10px;
  border-bottom: 1px solid var(--border, #E4DECE);
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.rcg-section-num {
  font-family: var(--sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold, #B8924A);
  line-height: 1;
  flex-shrink: 0;
}

.rcg-section-label {
  font-family: var(--sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(28, 26, 22, 0.38);
  line-height: 1;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ROWS  — within a section
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-row {
  margin-bottom: 16px;
}

.rcg-row:last-child {
  margin-bottom: 0;
}

/* Full-bleed (hero, wide) — break out of content column */
.rcg-row--hero,
.rcg-row--wide {
  position: relative;
  left: 50%;
  margin-left: -50vw !important;
  width: 100vw;
}

.rcg-row--hero .rcg-item {
  height: min(660px, 66vh);
  min-height: 360px;
  border-radius: 0;
}

.rcg-row--wide .rcg-item {
  height: min(360px, 36vh);
  min-height: 200px;
  border-radius: 0;
}

/* Caption below full-bleed strip */
.rcg-row-caption {
  max-width: 1160px;
  margin: 12px auto 0;
  padding: 0 32px;
}

/* Contained rows */
.rcg-row--pair,
.rcg-row--trio,
.rcg-row--detail {
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 32px;
  display: grid;
  gap: 20px;
}

.rcg-row--pair   { grid-template-columns: 1fr 1fr; }
.rcg-row--trio   { grid-template-columns: 1fr 1fr 1fr; }
.rcg-row--detail { grid-template-columns: repeat(4, 1fr); }

.rcg-row--portrait {
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 32px;
  display: flex;
  justify-content: center;
}

.rcg-row--portrait .rcg-photo-wrap {
  width: min(380px, 46%);
}

.rcg-row--standalone {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 32px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   PHOTO WRAP — image + caption unit
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-photo-wrap {
  display: flex;
  flex-direction: column;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   IMAGE ITEM — clickable cell
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--stone, #EAE4D6);
  cursor: pointer;
  border: none;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border-radius: 0;
}

/* Aspect ratios by layout type */
.rcg-row--pair       .rcg-item { aspect-ratio: 4 / 3; }
.rcg-row--trio       .rcg-item { aspect-ratio: 4 / 3; }
.rcg-row--detail     .rcg-item { aspect-ratio: 1 / 1; }
.rcg-row--portrait   .rcg-item { aspect-ratio: 2 / 3; }
.rcg-row--standalone .rcg-item { aspect-ratio: 16 / 7; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   IMAGE — slow, physical, luxurious
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.90s cubic-bezier(0.25, 0.10, 0.25, 1.00);
  will-change: transform;
}

.rcg-item:hover img,
.rcg-item:focus-visible img {
  transform: scale(1.024);
}

.rcg-item:focus-visible {
  outline: 1px solid var(--gold, #B8924A);
  outline-offset: 3px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CAPTIONS — permanent, below image, exhibition-quiet
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.rcg-photo-caption {
  margin-top: 10px;
}

.rcg-pc-cat {
  display: block;
  font-family: var(--sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold, #B8924A);
  margin-bottom: 3px;
  line-height: 1;
}

.rcg-pc-text {
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 300;
  font-style: italic;
  color: rgba(28, 26, 22, 0.52);
  line-height: 1.5;
  margin: 0;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FULLSCREEN VIEWER
   "Opening an image should feel like entering a museum."
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

dialog.rc-gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  z-index: 99999;
  overflow: hidden;
}

dialog.rc-gallery-viewer::backdrop {
  background: #0D1410;
}

.rcgv-layout {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0D1410;
}

/* ── Top bar: counter (left) + close (right) ── */
.rcgv-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px;
  z-index: 10;
}

.rcgv-counter {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: rgba(250, 248, 244, 0.28);
  user-select: none;
}

.rcgv-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(250, 248, 244, 0.10);
  color: rgba(250, 248, 244, 0.40);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.20s, color 0.20s;
  flex-shrink: 0;
}

.rcgv-close:hover {
  border-color: rgba(250, 248, 244, 0.28);
  color: rgba(250, 248, 244, 0.88);
}

.rcgv-close:focus-visible {
  outline: 1px solid var(--gold, #B8924A);
  outline-offset: 2px;
}

/* ── Stage ── */
.rcgv-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 88px 20px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.rcgv-figure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(1340px, calc(100vw - 176px));
  max-height: calc(100vh - 210px);
}

.rcgv-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 230px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.24s ease;
  border-radius: 0;
}

.rcgv-img.is-loading {
  opacity: 0;
}

/* ── Viewer caption ── */
.rcgv-figcaption {
  margin-top: 14px;
  text-align: left;
  min-height: 26px;
}

.rcgv-cap-category {
  display: block;
  font-family: var(--sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold, #B8924A);
  margin-bottom: 4px;
  line-height: 1;
}

.rcgv-cap-text {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 300;
  font-style: italic;
  color: rgba(250, 248, 244, 0.40);
  line-height: 1.55;
  margin: 0;
}

/* ── Navigation arrows ── */
.rcgv-prev,
.rcgv-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 76px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid rgba(250, 248, 244, 0.06);
  color: rgba(250, 248, 244, 0.32);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.20s, color 0.20s;
  z-index: 5;
}

.rcgv-prev:hover, .rcgv-next:hover {
  border-color: rgba(250, 248, 244, 0.18);
  color: rgba(250, 248, 244, 0.75);
}

.rcgv-prev:disabled, .rcgv-next:disabled {
  opacity: 0.08;
  pointer-events: none;
}

.rcgv-prev:focus-visible, .rcgv-next:focus-visible {
  outline: 1px solid var(--gold, #B8924A);
  outline-offset: 2px;
}

.rcgv-prev { left: 16px; }
.rcgv-next { right: 16px; }

/* ── Thumbnail strip ── */
.rcgv-thumbs {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 28px 24px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.rcgv-thumbs::-webkit-scrollbar {
  display: none;
}

.rcgv-thumb {
  flex-shrink: 0;
  width: 42px;
  height: 28px;
  border-radius: 1px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.20;
  border: 1px solid transparent;
  transition: opacity 0.18s, border-color 0.18s;
  background: none;
  padding: 0;
}

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

.rcgv-thumb.is-active {
  opacity: 1;
  border-color: rgba(184, 146, 74, 0.60);
}

.rcgv-thumb:hover { opacity: 0.52; }

.rcgv-thumb:focus-visible {
  outline: 1px solid var(--gold, #B8924A);
  outline-offset: 2px;
}

/* ── Open — pure fade ── */
dialog.rc-gallery-viewer[open] .rcgv-layout {
  animation: rcgv-fade 0.34s ease both;
}

@keyframes rcgv-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   RESPONSIVE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 960px) {
  .rc-gallery { padding-bottom: 80px; }
  .rc-gallery-intro { margin-bottom: 52px; }

  .rcg-section { margin-bottom: 60px; }
  .rcg-section-head { padding: 0 24px 10px; margin-bottom: 22px; }

  .rcg-row--pair,
  .rcg-row--trio,
  .rcg-row--detail,
  .rcg-row--standalone { padding: 0 24px; gap: 14px; }
  .rcg-row--portrait   { padding: 0 24px; }
  .rcg-row--portrait .rcg-photo-wrap { width: min(360px, 58%); }

  .rcg-row--trio   { grid-template-columns: 1fr 1fr; }
  .rcg-row--detail { grid-template-columns: repeat(3, 1fr); }

  .rcg-row--trio .rcg-photo-wrap:nth-child(3):last-child {
    grid-column: 1 / -1;
  }
  .rcg-row--trio .rcg-photo-wrap:nth-child(3):last-child .rcg-item {
    aspect-ratio: 16 / 6;
  }

  .rcg-row-caption { padding: 0 24px; }
  .rcg-row--hero .rcg-item { height: min(520px, 56vh); }
  .rcg-row--wide .rcg-item { height: min(300px, 32vh); }

  .rcgv-stage { padding: 68px 64px 16px; }
}

@media (max-width: 640px) {
  .rc-gallery { padding-bottom: 60px; }
  .rc-gallery-intro { padding-left: 20px; padding-right: 20px; margin-bottom: 40px; }

  .rcg-section { margin-bottom: 48px; }
  .rcg-section-head { padding: 0 20px 10px; margin-bottom: 18px; }

  .rcg-row { margin-bottom: 12px; }

  .rcg-row--pair,
  .rcg-row--trio,
  .rcg-row--detail,
  .rcg-row--portrait,
  .rcg-row--standalone { padding: 0 20px; }

  .rcg-row--trio   { grid-template-columns: 1fr; }
  .rcg-row--detail { grid-template-columns: 1fr 1fr; gap: 10px; }
  .rcg-row--portrait .rcg-photo-wrap { width: 100%; }

  .rcg-row--trio .rcg-photo-wrap:nth-child(3):last-child {
    grid-column: auto;
  }
  .rcg-row--trio .rcg-photo-wrap:nth-child(3):last-child .rcg-item {
    aspect-ratio: 4 / 3;
  }

  .rcg-row-caption { padding: 0 20px; }
  .rcg-row--hero .rcg-item { height: min(360px, 52vh); min-height: 240px; }
  .rcg-row--wide .rcg-item { height: min(220px, 28vh); min-height: 160px; }

  .rcgv-stage  { padding: 64px 16px 12px; }
  .rcgv-figure { max-width: 100vw; max-height: calc(100vh - 190px); }
  .rcgv-figure { align-items: center; }
  .rcgv-figcaption { text-align: center; }
  .rcgv-img    { max-height: calc(100vh - 190px); }
  .rcgv-prev, .rcgv-next { display: none; }
  .rcgv-thumbs { padding: 10px 16px 18px; gap: 3px; }
  .rcgv-thumb  { width: 36px; height: 24px; }
  .rcgv-topbar { padding: 18px 20px; }
}

@media (max-width: 420px) {
  .rcg-row--pair { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .rcg-item img { transition: none; }
  .rcgv-img     { transition: none; }
  dialog.rc-gallery-viewer[open] .rcgv-layout { animation: none; }
}
