:root {
  --bg-deep: #0f1a14;
  --bg-mid: #1a2b22;
  --bg-panel: rgba(18, 32, 26, 0.92);
  --fg: #f2efe6;
  --fg-muted: #b7c4b8;
  --accent: #c4a35a;
  --accent-soft: #8f9e6f;
  --line: rgba(196, 163, 90, 0.28);
  --danger: #c9785a;
  --font-display: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --font-body: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--fg);
  font-family: var(--font-body);
  background: var(--bg-deep);
}

body {
  background:
    radial-gradient(ellipse 90% 60% at 10% 0%, rgba(143, 158, 111, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 20%, rgba(196, 163, 90, 0.12), transparent 50%),
    linear-gradient(160deg, #132018 0%, #0f1a14 45%, #1a1510 100%);
  background-attachment: fixed;
}

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

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 26, 20, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.brand span {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nav a {
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: 0.9rem;
  transition: 0.2s ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--fg);
  border-color: var(--line);
  background: rgba(196, 163, 90, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a1510;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: #d4b56a;
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
}

.btn-ghost:hover {
  background: rgba(196, 163, 90, 0.12);
}

/* Landing */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  align-items: end;
  padding: 2rem 1.4rem 3.5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 26, 20, 0.25) 0%, rgba(15, 26, 20, 0.82) 70%, #0f1a14 100%),
    url("../media/thumbs/tt-atk.jpg") center / cover no-repeat;
  transform: scale(1.04);
  animation: heroDrift 18s ease-in-out infinite alternate;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  margin-bottom: 0.8rem;
}

.hero h1 {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 0 1.6rem;
  color: var(--fg-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 54ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-note {
  padding: 1.2rem 1.4rem 2rem;
  color: var(--fg-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

.footer-note a {
  color: var(--accent-soft);
  text-decoration: underline;
}

@keyframes heroDrift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.1) translate3d(-1.5%, -1%, 0);
  }
}

/* Tour layout */
.tour-app {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-panel);
  min-height: 0;
}

.sidebar-head {
  padding: 1rem 1rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.sidebar-head p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.scene-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  overflow: auto;
  flex: 1;
}

.scene-list button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.35rem;
  transition: 0.15s ease;
}

.scene-list button:hover,
.scene-list button.active {
  background: rgba(196, 163, 90, 0.1);
  border-color: var(--line);
}

.scene-list img {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}

.scene-meta strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.scene-meta span {
  color: var(--fg-muted);
  font-size: 0.75rem;
}

.viewer-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #000;
  height: 100%;
}

#viewer {
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.tour-overlay {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  pointer-events: none;
}

.tour-overlay > * {
  pointer-events: auto;
}

.view-toggle {
  display: inline-flex;
  align-self: flex-start;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(15, 26, 20, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.view-toggle button {
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.view-toggle button.active {
  background: var(--accent);
  color: #1a1510;
  font-weight: 600;
}

.view-toggle[hidden] {
  display: none;
}

.info-panel {
  max-width: 560px;
  padding: 0.95rem 1.05rem;
  border-radius: 16px;
  background: rgba(15, 26, 20, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.info-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.info-panel .commune {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.info-panel p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  max-height: 7.5em;
  overflow: auto;
}

.mobile-bar {
  display: none;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}

.mobile-bar select {
  flex: 1;
  background: #122019;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.loading-banner,
.error-banner {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: rgba(15, 26, 20, 0.88);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}

.error-banner {
  border-color: var(--danger);
  color: #ffd7cb;
}

/* Artifacts */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 3rem;
}

.page header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.page header p {
  margin: 0 0 1.4rem;
  color: var(--fg-muted);
  max-width: 60ch;
  line-height: 1.55;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
}

.gallery button {
  border: 1px solid var(--line);
  background: rgba(18, 32, 26, 0.7);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--fg);
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.gallery button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #101816;
}

.gallery figcaption {
  padding: 0.65rem 0.75rem 0.8rem;
  font-size: 0.86rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(5, 10, 8, 0.88);
}

.lightbox.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.lightbox-inner {
  max-width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #132019;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.8rem;
}

.lightbox img {
  max-height: 70vh;
  margin: 0 auto;
  object-fit: contain;
}

.lightbox h2 {
  margin: 0.8rem 0 0.3rem;
  font-size: 1.1rem;
}

.lightbox p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 1px solid var(--line);
  background: rgba(15, 26, 20, 0.9);
  color: var(--fg);
  border-radius: 999px;
  width: 2.4rem;
  height: 2.4rem;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Hotspot markers inside panorama */
.psv-marker .hs-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  animation: hsPulse 2.4s ease-in-out infinite;
}

.psv-marker .hs-marker__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0d78a, #c4a35a 55%, #8a6d2e);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 6px rgba(196, 163, 90, 0.28), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.psv-marker .hs-marker__label {
  max-width: 150px;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 26, 20, 0.88);
  border: 1px solid rgba(196, 163, 90, 0.45);
  color: #f2efe6;
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
}

.psv-marker .hs-marker--view .hs-marker__dot {
  background: radial-gradient(circle at 35% 30%, #c5d6a8, #8f9e6f 55%, #5f6d43);
  box-shadow: 0 0 0 6px rgba(143, 158, 111, 0.3), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.psv-marker .hs-marker:hover .hs-marker__label {
  border-color: #c4a35a;
  color: #fff;
}

@keyframes hsPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .tour-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 64px);
  }

  .sidebar {
    display: none;
  }

  .mobile-bar {
    display: flex;
  }

  .info-panel p {
    max-height: 5.5em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero::before,
  .gallery button,
  .btn {
    animation: none;
    transition: none;
  }
}
