/* ===================================================
   HEADWORKS NAVIGATOR – Premium Dialog Experience
   Design: Dark premium, architectural, mobile-first
   =================================================== */

/* --- Reset & Tokens --- */
/* Scoped reset: only inside navigator elements */
.nav-app *,
.nav-app *::before,
.nav-app *::after,
.nav-overlay *,
.nav-overlay *::before,
.nav-overlay *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Brand colors (aligned with main site) */
  --black: #000000;
  --white: #ffffff;
  --dark: #0e0e0e;
  --dark-2: #141414;
  --dark-3: #1a1a1a;
  --dark-4: #222222;
  --accent: #e50914;
  --accent-dim: rgba(229, 9, 20, 0.12);
  --accent-glow: rgba(229, 9, 20, 0.22);

  /* Neutral scale */
  --gray-100: #f0f0f0;
  --gray-200: #d0d0d0;
  --gray-400: #888888;
  --gray-500: #666666;
  --gray-600: #444444;

  /* Surface / glass */
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);

  /* Sizing */
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 999px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t: 0.4s var(--ease);
  --t-fast: 0.22s var(--ease);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Standalone navigator page only (body styles scoped via .navigator-standalone) */
body.navigator-standalone {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.65;
  background: var(--dark);
  color: var(--white);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* Scoped element resets for navigator only */
.nav-app a,
.nav-overlay a {
  text-decoration: none;
  color: inherit;
}
.nav-app ul,
.nav-overlay ul {
  list-style: none;
}
.nav-app img,
.nav-overlay img {
  max-width: 100%;
  display: block;
}
.nav-app button,
.nav-overlay button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===================================================
   APP SHELL
   =================================================== */

.nav-app {
  display: grid;
  grid-template-rows: auto 2px 1fr auto auto;
  height: 100vh;
  height: 100dvh;
  background: var(--dark);
  position: relative;
  overflow: hidden;
}

/* Ambient background glow */
.nav-app::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 60% 50% at 20% 10%,
      rgba(229, 9, 20, 0.06) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 60% at 90% 90%,
      rgba(229, 9, 20, 0.04) 0%,
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
}

/* ===================================================
   HEADER
   =================================================== */

.nav-app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
  background: rgba(14, 14, 14, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-app__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--white);
  opacity: 0.9;
}

.nav-app__logo img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.nav-app__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: all var(--t-fast);
}

.nav-app__close:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--white);
  transform: scale(1.05);
}

/* ===================================================
   PROGRESS BAR
   =================================================== */

.nav-app__progress {
  position: relative;
  z-index: 10;
  background: var(--dark-3);
  height: 2px;
}

.nav-app__progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    rgba(229, 9, 20, 0.6) 100%
  );
  width: 0%;
  transition: width 0.6s var(--ease);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ===================================================
   MAIN CONVERSATION AREA
   =================================================== */

.nav-app__main {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
}

/* Scrollbar */
.nav-app__main::-webkit-scrollbar {
  width: 4px;
}
.nav-app__main::-webkit-scrollbar-track {
  background: transparent;
}
.nav-app__main::-webkit-scrollbar-thumb {
  background: var(--dark-4);
  border-radius: 4px;
}

/* ===================================================
   MESSAGES
   =================================================== */

.msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(12px);
  animation: msgIn 0.45s var(--ease) forwards;
}

@keyframes msgIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bot message (left) */
.msg--bot {
  flex-direction: row;
}

.msg--user {
  flex-direction: row-reverse;
}

/* Avatar */
.msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--dark-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* Bubble */
.msg__bubble {
  max-width: min(480px, 80%);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
}

.msg--bot .msg__bubble {
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--gray-100);
}

.msg--user .msg__bubble {
  background: var(--accent);
  border-bottom-right-radius: 6px;
  color: var(--white);
  font-weight: 500;
}

/* Typing indicator */
.msg--typing .msg__bubble {
  padding: 14px 20px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Section divider label */
.msg--section {
  justify-content: center;
  margin: 8px 0 20px;
}

.msg__section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-600);
  padding: 4px 14px;
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-full);
}

/* ===================================================
   CHOICES AREA
   =================================================== */

.nav-app__choices {
  position: relative;
  z-index: 5;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Choice grid: 1 col default, adapts */
.choices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.choices-grid--2col {
  grid-template-columns: 1fr 1fr;
}

/* Choice card */
.choice-card {
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: left;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: cardIn 0.35s var(--ease-bounce) forwards;
}

.choice-card:nth-child(1) {
  animation-delay: 0.05s;
}
.choice-card:nth-child(2) {
  animation-delay: 0.1s;
}
.choice-card:nth-child(3) {
  animation-delay: 0.15s;
}
.choice-card:nth-child(4) {
  animation-delay: 0.2s;
}
.choice-card:nth-child(5) {
  animation-delay: 0.25s;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.choice-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.choice-card:hover {
  border-color: rgba(229, 9, 20, 0.4);
  background: var(--dark-4);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.choice-card:hover::before {
  opacity: 1;
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-card--selected {
  border-color: var(--accent);
  background: rgba(229, 9, 20, 0.08);
}

/* Icon container */
.choice-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: all var(--t-fast);
}

.choice-card:hover .choice-card__icon {
  background: var(--accent-dim);
  border-color: rgba(229, 9, 20, 0.3);
}

/* Text */
.choice-card__text {
  flex: 1;
}

.choice-card__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 2px;
}

.choice-card__sub {
  font-size: 0.78rem;
  color: var(--gray-400);
  line-height: 1.4;
}

/* Arrow */
.choice-card__arrow {
  color: var(--gray-600);
  flex-shrink: 0;
  transition: all var(--t-fast);
}

.choice-card:hover .choice-card__arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ===================================================
   RESULT SCREEN
   =================================================== */

.result-screen {
  padding: 8px 4px 0;
  animation: msgIn 0.5s var(--ease) forwards;
}

.result-card {
  background: linear-gradient(135deg, var(--dark-3) 0%, var(--dark-4) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}

.result-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 70%);
}

.result-card__eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-card__eyebrow::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 1px;
  background: var(--accent);
}

.result-card__title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--white);
  margin-bottom: 12px;
}

.result-card__body {
  font-size: 0.9rem;
  color: var(--gray-400);
  line-height: 1.7;
  margin-bottom: 20px;
}

/* Highlights */
.result-highlights {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.result-highlights li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--gray-200);
}

.result-highlights li::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(229, 9, 20, 0.3);
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 5L4 7L8 3' stroke='%23e50914' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* CTAs */
.result-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 15px 24px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  width: 100%;
  text-align: center;
}

.cta-btn--primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.35);
}

.cta-btn--primary:hover {
  background: #cc0812;
  box-shadow: 0 8px 32px rgba(229, 9, 20, 0.45);
  transform: translateY(-2px);
}

.cta-btn--secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--gray-200);
}

.cta-btn--secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--white);
}

.cta-btn__arrow {
  transition: transform var(--t-fast);
}

.cta-btn:hover .cta-btn__arrow {
  transform: translateX(4px);
}

/* ===================================================
   FOOTER
   =================================================== */

.nav-app__footer {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 14px;
  border-top: 1px solid var(--border);
}

.nav-app__restart {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  transition: all var(--t-fast);
  background: none;
  border: none;
}

.nav-app__restart:hover {
  color: var(--gray-200);
  background: var(--surface);
}

.nav-app__footer-hint {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--gray-600);
  text-transform: uppercase;
}

/* ===================================================
   STANDALONE PAGE LAYOUT
   (when opened as /navigator/)
   =================================================== */

/* ===================================================
   EMBED TRIGGER BUTTON (used in main site)
   =================================================== */

.navigator-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: 60px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: all 0.3s ease;
  letter-spacing: 0.01em;
}

.navigator-trigger:hover {
  background: rgba(229, 9, 20, 0.12);
  border-color: rgba(229, 9, 20, 0.4);
  color: #fff;
  transform: translateY(-2px);
}

/* ===================================================
   OVERLAY MODE (when triggered from main site)
   =================================================== */

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px;
}

.nav-overlay.is-open {
  display: flex;
  animation: overlayFadeIn 0.35s var(--ease) forwards;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.nav-overlay__panel {
  width: 100%;
  max-width: 520px;
  height: min(680px, 90vh);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: panelSlideIn 0.45s var(--ease-bounce) forwards;
  background: var(--dark);
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nav-overlay__panel .nav-app {
  height: 100%;
}

/* ===================================================
   RESPONSIVE
   =================================================== */

@media (max-width: 480px) {
  .nav-app__header {
    padding: 14px 18px;
  }
  .nav-app__main {
    padding: 24px 16px 12px;
  }
  .nav-app__choices {
    padding: 10px 14px 16px;
  }
  .nav-app__footer {
    padding: 8px 16px 12px;
  }

  .choices-grid--2col {
    grid-template-columns: 1fr;
  }

  .choice-card {
    padding: 14px 16px;
  }
  .choice-card__icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .result-card {
    padding: 22px 18px;
  }
  .result-card__title {
    font-size: 1.1rem;
  }
}

@media (min-width: 600px) {
  .choices-grid:not(.choices-grid--single) {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .nav-overlay__panel {
    max-width: 560px;
    height: min(720px, 90vh);
  }
}

/* ===================================================
   UTILITY
   =================================================== */

.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;
}

/* Fade-out animation for clearing choices */
.choices-exit {
  animation: choicesOut 0.2s ease forwards;
}

@keyframes choicesOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}
