/* ════════════════════════════════════════════════════════════════════
   NCCHR ARventure Configurator — Styles
   ════════════════════════════════════════════════════════════════════ */

:root {
  --primary:       #C84B20;
  --primary-dark:  #A33A18;
  --primary-light: #E06030;
  --bg:            #f4f4f4;
  --card:          #ffffff;
  --text:          #1a1a1a;
  --muted:         #666666;
  --border:        #e8e8e8;
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-md:     0 6px 28px rgba(0,0,0,0.14);
  --shadow-lg:     0 16px 56px rgba(0,0,0,0.22);
  --radius:        18px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* Guard against Pannellum's global svg rules bleeding into our UI */
.lang-card svg:not(.pannellum-container svg),
.exhibits-header svg,
.exhibit-card svg,
.how-it-works svg,
.btn-primary svg,
.start-btn svg { max-width: unset; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ════════════════════════════════════════════════════════════════════
   SCREEN FRAMEWORK
   ════════════════════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}
.screen.fade-out {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.screen.fade-in {
  animation: screenIn 0.45s ease forwards;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════════════════
   SCREEN 1 — LANGUAGE SELECTION
   ════════════════════════════════════════════════════════════════════ */
#screen-language {
  background: linear-gradient(145deg, #0d0d1a 0%, #1a1030 40%, #0d1f3c 100%);
  align-items: center;
  justify-content: center;
}

/* ── Flowing "hello" words ── */
#hello-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hw {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  font-weight: 700;
  user-select: none;
  pointer-events: none;
  animation: wordFlow linear infinite;
  opacity: 0;
}

@keyframes wordFlow {
  0%   { transform: translateX(-350px) translateY(var(--dy)); opacity: 0; }
  6%   { opacity: var(--op); }
  94%  { opacity: var(--op); }
  100% { transform: translateX(calc(100vw + 350px)) translateY(var(--dy)); opacity: 0; }
}

/* ── Language card ── */
.lang-card {
  position: relative;
  z-index: 10;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 26px;
  padding: 40px 32px 32px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

/* ── NCCHR Logo ── */
.ncchr-logo {
  display: flex;
  align-items: center;
  gap: 13px;
}
.ncchr-logo.small { gap: 10px; }

.logo-mark-svg { width: 48px; height: 48px; flex-shrink: 0; }
.logo-mark-svg.small { width: 36px; height: 36px; }

.logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.3;
}
.logo-line-top {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-transform: uppercase;
}
.logo-line-bot {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--primary);
  text-transform: uppercase;
}

.lang-rule {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.lang-card h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.lang-card p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 300px;
}

/* ── Language dropdown ── */
.select-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}
.select-icon {
  position: absolute;
  left: 14px;
  width: 18px !important;
  height: 18px !important;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}
.select-chevron {
  position: absolute;
  right: 13px;
  width: 16px !important;
  height: 16px !important;
  color: var(--muted);
  pointer-events: none;
}
#language-select {
  width: 100%;
  padding: 14px 40px 14px 44px;
  font-size: 16px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
#language-select:focus { border-color: var(--primary); }

/* ── Primary button ── */
.btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, transform 0.12s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(200,75,32,0.35);
}
.btn-primary:hover  { background: var(--primary-light); box-shadow: 0 6px 24px rgba(200,75,32,0.45); }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.97); box-shadow: none; }

.powered-by {
  font-size: 12px;
  color: #bbb;
  margin-top: -4px;
}

/* ════════════════════════════════════════════════════════════════════
   SCREEN 2 — EXHIBITS
   ════════════════════════════════════════════════════════════════════ */
#screen-exhibits {
  background: var(--bg);
  overflow: hidden;
}

/* ── Sticky header ── */
.exhibits-header {
  background: white;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  z-index: 10;
}
.exhibits-header .ncchr-logo { margin-bottom: 10px; }

#choose-heading {
  font-size: 19px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
}

/* ── Scrollable list ── */
.exhibits-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.exhibits-scroll::-webkit-scrollbar { display: none; }

#exhibits-list {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── How-it-works banner ── */
.how-it-works {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff8f5;
  border: 1.5px solid rgba(200,75,32,0.2);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text);
}
.how-it-works svg {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 1px;
}
.how-it-works strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 5px;
}
.how-it-works p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  margin: 0;
}
.how-it-works-body {
  flex: 1;
  min-width: 0;
}
.watch-tutorial-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--primary);
  background: #fff;
  border: 1.5px solid rgba(200,75,32,0.35);
  border-radius: 8px;
  cursor: pointer;
}
.watch-tutorial-btn:active {
  background: #fff8f5;
}

/* ── Explainer tutorial modal (launcher) ── */
.explainer-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.88);
  font-family: var(--font);
}
.explainer-modal.open {
  display: flex;
}
.explainer-modal-panel {
  width: min(100%, 720px);
  max-height: 92vh;
  overflow-y: auto;
  background: #1a1a1a;
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}
.explainer-modal-panel h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}
.explainer-loading {
  font-size: 14px;
  opacity: 0.85;
  margin: 0 0 10px;
}
.explainer-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.explainer-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.explainer-video-wrap video::cue {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 1em;
}
.explainer-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  cursor: pointer;
  padding: 0;
}
.explainer-play-overlay.hidden {
  display: none;
}
.explainer-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(200, 75, 32, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.explainer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.explainer-btn {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.explainer-btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.explainer-btn-primary {
  background: var(--primary);
  color: #fff;
}
.explainer-btn-primary:active {
  background: var(--primary-dark);
}

/* ════════════════════════════════════════════════════════════════════
   EXHIBIT CARD
   ════════════════════════════════════════════════════════════════════ */
.exhibit-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.exhibit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Exhibit thumbnail ── */
.thumb-wrap {
  position: relative;
  width: 100%;
  height: 210px;
  overflow: hidden;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.thumb-wrap img,
.thumb-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111;
}

/* ── Video play overlay (autoplay blocked) ── */
.video-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.38);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.video-play-overlay.hidden {
  display: none;
}
.video-play-overlay:focus-visible {
  outline: 2px solid var(--orange, #C84B20);
  outline-offset: -4px;
}

/* ── Video play indicator ── */
.video-play-indicator {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}
.video-play-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.6);
  animation: ring-pulse 1.8s ease-out infinite;
}
.video-play-ring:nth-child(2) { animation-delay: 0.6s; }
.video-play-ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes ring-pulse {
  0%   { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}
.video-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(200,75,32,0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.video-play-btn svg { margin-left: 3px; }

/* Placeholder when no thumbnail URL */
.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.thumb-placeholder-icon {
  opacity: 0.25;
}

/* ── Card body ── */
.card-body {
  padding: 20px 20px 22px;
}
.card-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
}

/* ── Start Experience button ── */
.start-btn {
  width: 100%;
  padding: 15px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 4px 16px rgba(200,75,32,0.32);
}
.start-btn:hover  { background: var(--primary-light); box-shadow: 0 6px 22px rgba(200,75,32,0.42); }
.start-btn:active { background: var(--primary-dark); transform: scale(0.97); box-shadow: none; }

.exhibits-footer {
  text-align: center;
  padding: 24px 20px 28px;
  font-size: 13px;
  color: #bbb;
}

/* ════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ════════════════════════════════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.25s;
}
.loading-screen.hidden { display: none; }

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #ececec;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading-label {
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════
   RTL SUPPORT (Arabic, Hebrew, etc.)
   ════════════════════════════════════════════════════════════════════ */
[dir="rtl"] .logo-text { align-items: flex-end; text-align: right; }
[dir="rtl"] .btn-primary svg,
[dir="rtl"] .start-btn svg { transform: scaleX(-1); }
[dir="rtl"] .select-icon  { left: auto; right: 14px; }
[dir="rtl"] .select-chevron { right: auto; left: 13px; }
[dir="rtl"] #language-select { padding: 14px 44px 14px 40px; }

/* ════════════════════════════════════════════════════════════════════
   CHANGE LANGUAGE (exhibits screen + AR experience parity)
   ════════════════════════════════════════════════════════════════════ */
#experience-language-btn {
  display: none;
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 500;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
#experience-language-btn:active {
  background: var(--primary);
}
#language-change-popover {
  display: none;
  position: fixed;
  top: 64px;
  right: 14px;
  z-index: 500;
  width: min(88vw, 272px);
  max-height: calc(100dvh - 72px);
  padding: 12px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.94);
  color: #fff;
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#language-change-popover.open {
  display: flex;
}
#language-change-popover h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
#language-change-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 6px;
  font-size: 13px;
  line-height: 1.25;
  border-radius: 8px;
  border: none;
  background: #fff;
  color: #111;
  /* Scrollable list inside popover (avoids a 32-row native dropdown taller than the viewport) */
  max-height: min(28vh, 10.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#language-change-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
}
#language-change-apply {
  padding: 8px 12px;
  font-size: 13px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
#language-change-cancel {
  padding: 8px 10px;
  font-size: 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  cursor: pointer;
}
