/* ──────────────────────────────────────────────
   Retreat Showcase — Enhanced Gallery
   ────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;1,8..60,300;1,8..60,400&family=Noto+Serif+TC:wght@300;400;500&display=swap');

/* ═══════════════════════════════════════════════
   Theme A: 暗調藝廊 (Enhanced)
   ═══════════════════════════════════════════════ */
[data-theme="dark-gallery"] {
  --bg: #050403;
  --bg-gradient: radial-gradient(ellipse at 50% 48%, #0e0b08 0%, #070504 40%, #020201 100%);
  --text-main: #FFFFFF; 
  --text: #C4A35A;      
  --text-dim: rgba(196, 163, 90, 0.45); 
  --accent: #C4A35A;
  --accent-dim: rgba(196, 163, 90, 0.3);
  --slot-border: rgba(196, 163, 90, 0.03);
  --slot-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
  
  /* Fixed to FangSong elegant stack */
  --font-display: 'STFangsong', 'FangSong', 'BiauKai', 'Noto Serif TC', serif;
  --font-body: 'Libre Baskerville', Georgia, serif;
  
  --grain-opacity: 0.04;
  --vignette-opacity: 1;
  --panel-bg: rgba(255, 255, 255, 0.04);
  --panel-text: rgba(255, 255, 255, 0.4);
  --panel-active-text: #C4A35A;
  --panel-active-bg: rgba(196, 163, 90, 0.1);
  --panel-border: rgba(255, 255, 255, 0.05);
  --text-glow:
    0 0 60px rgba(0, 0, 0, 0.95),
    0 0 120px rgba(0, 0, 0, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ═══════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-gradient, var(--bg));
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.8s ease, color 0.8s ease;
}

/* ═══════════════════════════════════════════════
   Atmosphere Layers
   ═══════════════════════════════════════════════ */

.vignette {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  opacity: var(--vignette-opacity);
  background: radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(0, 0, 0, 0.28) 100%);
  transition: opacity 0.8s ease;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 150px;
  transition: opacity 0.8s ease;
}

/* ═══════════════════════════════════════════════
   Enter Screen
   ═══════════════════════════════════════════════ */

.enter-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #030302;
  opacity: 1;
  transition: opacity 1.4s ease-out;
}

.enter-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.enter-screen__title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 4.2vw, 3.6rem);
  font-weight: 300;
  letter-spacing: 0.18em;
  color: #F5F0EB;
  margin-bottom: 0.3em;
  text-align: center;
  line-height: 1.45;
  white-space: nowrap;
}

.enter-screen__line {
  width: 36px;
  height: 1px;
  background: #C4A35A;
  margin: 1.4em auto;
  opacity: 0.5;
}

.enter-screen__subtitle {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.18em;
  color: rgba(245, 240, 235, 0.4);
  margin-bottom: 3.5em;
}

.enter-screen__btn {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(0.72rem, 1.1vw, 0.9rem);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: #C4A35A;
  background: transparent;
  border: 1px solid rgba(196, 163, 90, 0.35);
  padding: 0.85em 2.6em;
  cursor: pointer;
  transition: all 0.5s ease;
}

.enter-screen__btn:hover {
  background: #C4A35A;
  color: #030302;
  border-color: #C4A35A;
}

/* ═══════════════════════════════════════════════
   Resume overlay (paused state)
   ═══════════════════════════════════════════════ */

.resume-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.resume-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.resume-overlay:not(.hidden) {
  pointer-events: auto;
}

.resume-overlay .enter-screen__btn {
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════
   Media Slots
   ═══════════════════════════════════════════════ */

.media-slot {
  position: absolute;
  opacity: 0;
  overflow: hidden;
  border: 1px solid var(--slot-border);
  border-radius: 6px;
  box-shadow: var(--slot-shadow);
  /* The opacity transition duration is driven by JS via CSS custom property */
  transition: opacity var(--fade-duration, 1.5s) ease-in-out, border-color 0.8s ease, box-shadow 0.8s ease, border-radius 0.5s ease;
  will-change: opacity;
  z-index: 1;
}

.media-slot.visible { opacity: 1; }
.media-slot.hidden  { opacity: 0; }

.media-slot img,
.media-slot video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ═══════════════════════════════════════════════
   Center Text
   ═══════════════════════════════════════════════ */

.center-text-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto; 
  height: auto; 
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  transition: opacity 1.5s ease-in-out; 
}

.center-text {
  position: relative;
  display: inline-block;
  text-align: center;
  padding: 0 3em; 
}

.center-text .ct-line1,
.center-text .ct-line2 {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.5vw, 1.25rem);
  font-weight: 300;
  letter-spacing: 0.15em;
  line-height: 1.5;
  color: var(--text-main); 
  text-shadow: var(--text-glow);
  transition: color 0.8s ease;
  white-space: nowrap; 
}

.center-text .hl {
  color: var(--text);
  text-shadow: 0 0 10px var(--accent-dim);
  transition: color 0.8s ease;
}

/* ═══════════════════════════════════════════════
   Text Decoration (Side Slash)
   ═══════════════════════════════════════════════ */

.center-text::before,
.center-text::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  width: 1px;
  background: var(--accent);
  opacity: 0.4;
  transform: skewX(-15deg);
  transition: all 0.8s ease;
}

.center-text::before {
  left: -20px;
}

.center-text::after {
  right: -20px;
}

/* ═══════════════════════════════════════════════
   Audio Control
   ═══════════════════════════════════════════════ */

.audio-control {
  position: fixed;
  bottom: 2rem;
  right: 2.5rem;
  z-index: 500;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--panel-text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.audio-control:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════
   Mobile (≤640px) — 五欄緊湊佈局 + 橫欄文字
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
  .enter-screen__title {
    font-size: clamp(1.05rem, 4.6vw, 1.85rem);
    letter-spacing: 0.1em;
  }

  .enter-screen__btn {
    letter-spacing: 0.18em;
    padding: 0.85em 2em;
  }

  .center-text-wrapper {
    width: 92%;
    max-width: none;
  }

  .center-text .ct-line1,
  .center-text .ct-line2 {
    white-space: normal;
    font-size: clamp(0.8rem, 3.5vw, 1rem);
    letter-spacing: 0.1em;
    line-height: 1.6;
  }

  .center-text {
    padding: 0 0.8em;
  }

  .center-text::before,
  .center-text::after {
    display: none;
  }

  .audio-control {
    bottom: 1rem;
    right: 1rem;
  }
}

