/* ==========================================================================
   ĐIỆN THÁI HOÀ 3D — HOÀNG THÀNH CỐ ĐÔ HUẾ
   Zero-Dependency Production Stylesheet (Desktop & Mobile Optimized)
   ========================================================================== */
:root {
  --bg-deep: #0e0a0c;
  --bg-surface: #181114;
  --bg-card: rgba(27, 18, 21, 0.88);
  --bg-card-solid: #1d1316;
  --gold-bright: #ffe07d;
  --gold-main: #e8b339;
  --gold-deep: #b87c14;
  --crimson: #8f1612;
  --crimson-bright: #b9201a;
  --text-main: #f8f2e6;
  --text-muted: #c4b59f;
  --border-gold: rgba(232, 179, 57, 0.28);
  --border-subtle: rgba(255, 244, 220, 0.12);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.6);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(143, 22, 18, 0.30) 0%, transparent 58%),
    radial-gradient(ellipse at 85% 25%, rgba(232, 179, 57, 0.10) 0%, transparent 45%),
    var(--bg-deep);
  color: var(--text-main);
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.container {
  width: min(95vw, 1780px);
  margin: 0 auto;
  padding: 0 12px;
  transition: width 0.25s ease, max-width 0.25s ease;
}

body.theater-mode .container {
  width: min(98vw, 2160px);
}

/* Top Sticky Royal Navbar */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 10, 12, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-gold);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(232, 179, 57, 0.25);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: color 0.18s ease;
}

.nav-links a:hover {
  color: var(--gold-bright);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Royal Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  background: rgba(255, 248, 230, 0.07);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.16s ease;
  user-select: none;
  -webkit-user-select: none;
}

.btn:hover {
  background: rgba(232, 179, 57, 0.18);
  border-color: rgba(232, 179, 57, 0.55);
  color: #fff;
}

.btn:active {
  transform: scale(0.97);
}

.btn-gold,
.btn[data-active="true"] {
  background: linear-gradient(135deg, #f3c449 0%, #c98818 100%);
  border-color: #ffe58c;
  color: #1c1104;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(232, 179, 57, 0.28);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #ffd463 0%, #da9620 100%);
  color: #140b02;
}

.btn-crimson {
  background: linear-gradient(135deg, #a81c17 0%, #74100c 100%);
  border-color: rgba(255, 212, 120, 0.45);
  color: #fff6e5;
  font-weight: 600;
}

.btn-crimson:hover {
  background: linear-gradient(135deg, #c2231d 0%, #8b1410 100%);
}

/* Hero Intro Header */
.hero-header {
  padding: 14px 0 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(232, 179, 57, 0.13);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.hero-title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.18;
  background: linear-gradient(95deg, #fff6df 0%, #ffd978 55%, #e8a92b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  margin: 5px 0 0;
  max-width: 920px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* 3D Experience Control Deck & Stage */
.explorer-shell {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 11px 12px;
  box-shadow: var(--shadow-lg);
}

.hud-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-row + .hud-row {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.hud-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.loc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(232, 179, 57, 0.14);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-weight: 600;
}

.slider-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.slider-box input[type="range"] {
  width: 92px;
  accent-color: var(--gold-main);
  cursor: pointer;
}

.music-deck {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid var(--border-subtle);
}

.music-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 24px 5px 9px;
  border-radius: 7px;
  border: 1px solid rgba(232, 179, 57, 0.28);
  background-color: rgba(34, 18, 22, 0.92);
  background-image: linear-gradient(45deg, transparent 50%, #ffd978 50%), linear-gradient(135deg, #ffd978 50%, transparent 50%);
  background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  max-width: 175px;
  outline: none;
}

.music-select:hover,
.music-select:focus {
  border-color: rgba(255, 217, 120, 0.65);
}

.music-select option {
  background: #1e1216;
  color: #fff6e5;
}

.time-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--gold-bright);
  font-size: 12px;
  white-space: nowrap;
}

/* 3D Canvas Stage */
.stage-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(232, 179, 57, 0.30);
  background: #090c14;
}

#palace-canvas {
  display: block;
  width: 100%;
  height: clamp(640px, 78vh, 920px);
  min-height: 540px;
  cursor: grab;
  touch-action: none;
  transition: height 0.25s ease;
}

body.theater-mode #palace-canvas {
  height: clamp(720px, 85vh, 1040px);
}

#palace-canvas:active {
  cursor: grabbing;
}

.stage-wrap:fullscreen {
  border-radius: 0;
  border: none;
}

.stage-wrap:fullscreen #palace-canvas {
  height: 100vh !important;
}

/* Floating Overlays inside 3D Stage */
.stage-overlay-card {
  background: rgba(20, 13, 16, 0.88);
  border: 1px solid var(--border-gold);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.rec-live-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 12;
  border-color: rgba(255, 82, 82, 0.65);
  background: rgba(26, 10, 12, 0.90);
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 10px #ff3b30;
  animation: recPulse 1s infinite ease-in-out;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}

.inspect-card {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 320px;
  max-width: calc(100% - 28px);
  padding: 14px 16px;
  z-index: 10;
}

.inspect-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-main);
  font-weight: 700;
}

.inspect-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.inspect-sub {
  font-size: 12px;
  color: var(--gold-bright);
  opacity: 0.88;
}

.inspect-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-main);
  margin: 10px 0 12px;
}

.dpad-box {
  position: absolute;
  bottom: 14px;
  left: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 8;
}

.dpad-caption {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.dpad-row {
  display: flex;
  gap: 4px;
}

.dpad-btn {
  width: 38px;
  height: 34px;
  padding: 0;
  font-size: 13px;
}

.cam-dock {
  position: absolute;
  bottom: 14px;
  right: 14px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  z-index: 8;
}

.stage-hint-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 4px 2px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Cultural & Character Showcase Sections */
.section {
  padding: 56px 0 12px;
}

.section-head {
  margin-bottom: 26px;
}

.section-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-main);
  font-weight: 700;
}

.section-title {
  margin: 6px 0 8px;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 800;
  color: var(--text-main);
}

.section-sub {
  margin: 0;
  color: var(--text-muted);
  max-width: 680px;
  font-size: 14.5px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.heritage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.heritage-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 224, 125, 0.65);
}

.card-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(232, 179, 57, 0.14);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.heritage-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: #fff;
}

.heritage-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Share Banner CTA */
.share-cta-banner {
  margin: 56px 0 36px;
  border-radius: 20px;
  border: 1px solid var(--border-gold);
  background:
    linear-gradient(125deg, rgba(143, 22, 18, 0.55) 0%, rgba(27, 18, 21, 0.94) 60%),
    var(--bg-card-solid);
  padding: 28px 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Share & Postcard Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 4, 6, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-panel {
  width: 100%;
  max-width: 560px;
  background: #1b1215;
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  overflow-y: auto;
}

.share-snap-frame {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-gold);
  background: #0c080a;
  margin: 12px 0;
}

.share-snap-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.share-url-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-url-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold-bright);
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #f3c449, #c98818);
  color: #1c1104;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 150;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  #palace-canvas {
    height: 62vh;
    min-height: 390px;
  }
  .inspect-card {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
  }
  .dpad-btn {
    width: 34px;
    height: 30px;
  }
  .cam-dock .btn {
    padding: 6px 9px;
    font-size: 11.5px;
  }
}
