/* ============================================
   LLOS Brand System — Word Discovery
   Extracted from time_travel.php branding
   ============================================ */

:root {
  --cream: #faf9f7;
  --white: #ffffff;
  --dark: #1a1a1a;
  --dark-soft: #4a4a4a;
  --muted: #7a7a7a;
  --border: #e8e6e3;
  --purple: #8b5cf6;
  --purple-soft: #f5f3ff;
  --purple-dark: #6d28d9;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;

  /* Accessible label defaults (dark pill on any bg) */
  --label-bg: rgba(0, 0, 0, 0.55);
  --label-color: #ffffff;
  --label-border: rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Scene Container ---- */
.scene-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ---- Word Layer ---- */
#wordLayer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.discovery-word {
  position: absolute;
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  padding: 5px 12px;
  border-radius: 8px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.discovery-word.visible {
  opacity: 1;
  transform: translateY(0);
  animation: wordFloat 5s ease-in-out infinite;
}

.discovery-word.fading {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.discovery-word:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
  animation: none;
}

/* Focus visible for keyboard accessibility */
.discovery-word:focus-visible,
.scene-exit:focus-visible,
.micro-card-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.3);
}

@keyframes wordFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* ---- Micro Card (bottom sheet) ---- */
.micro-card {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
  padding: 24px 20px 34px;
  z-index: 200;
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 480px;
  margin: 0 auto;
}

.micro-card.visible {
  transform: translateY(0);
}

.micro-card-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.micro-card-close:hover {
  background: var(--cream);
}

.micro-card-word {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.micro-card-definition {
  font-size: 15px;
  color: var(--dark-soft);
  line-height: 1.5;
  margin-bottom: 12px;
}

.micro-card-example {
  font-size: 13px;
  color: var(--dark-soft);
  line-height: 1.5;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.micro-card-reflection {
  font-size: 13px;
  color: var(--purple);
  line-height: 1.5;
  font-style: italic;
}

/* ---- Overlay behind micro-card ---- */
.micro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.micro-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Scene Exit Button (HIGH CONTRAST) ---- */
.scene-exit {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  background: var(--label-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--label-border);
  color: var(--label-color);
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.scene-exit:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* ---- Word counter pill (HIGH CONTRAST) ---- */
.word-counter {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: var(--label-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--label-border);
  color: var(--label-color);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ---- Skip-to-content for screen readers ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Nudge Notification ---- */
.nudge-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 150;
  background: var(--label-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 14px 22px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  max-width: 340px;
  width: max-content;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s ease;
  pointer-events: none;
}

.nudge-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.nudge-toast.hiding {
  transform: translateX(-50%) translateY(120px);
  opacity: 0;
}

.nudge-toast-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 16px;
  animation: nudgeIconBounce 1.5s ease-in-out infinite;
}

@keyframes nudgeIconBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.nudge-toast-dismiss {
  display: inline-block;
  margin-left: 12px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  vertical-align: middle;
}

.nudge-toast-dismiss:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Beckoning pulse on a word to draw attention */
.discovery-word.nudge-pulse {
  animation: nudgeBeckon 1.2s ease-in-out 3 !important;
}

@keyframes nudgeBeckon {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  30% {
    transform: translateY(-4px) scale(1.08);
  }

  60% {
    transform: translateY(1px) scale(1.02);
  }
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
  .discovery-word {
    font-size: 1.1rem;
    padding: 4px 10px;
  }

  .micro-card {
    padding: 20px 16px 28px;
  }

  .micro-card-word {
    font-size: 22px;
  }

  .scene-exit {
    padding: 7px 14px;
    font-size: 12px;
  }

  .word-counter {
    padding: 7px 12px;
    font-size: 11px;
  }

  .nudge-toast {
    max-width: 88vw;
    font-size: 13px;
    padding: 12px 18px;
    bottom: 20px;
    border-radius: 14px;
  }
}