/* ═══════════════════════════════════════════════════════════════
   Troy Card — Mobile-First Visual System
   Adapted from TMG bioluminescent palette
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --black: #0a0a0a;
  --black-soft: #111111;
  --black-card: #161616;
  --black-elevated: #1a1a1a;

  --cyan: #00B4D8;
  --cyan-bright: #00d4ff;
  --cyan-glow: rgba(0, 180, 216, 0.4);
  --magenta: #E91E8C;
  --magenta-bright: #ff2da5;
  --magenta-glow: rgba(233, 30, 140, 0.4);
  --ember: #c9a227;
  --ember-glow: rgba(201, 162, 39, 0.4);
  --white-hot: #ffffff;
  --white-warm: #f5f5f5;

  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 0.2s;
  --duration-med: 0.4s;
  --duration-slow: 0.8s;

  --glow-cyan: 0 0 30px var(--cyan-glow), 0 0 60px rgba(0, 180, 216, 0.2);
  --glow-magenta: 0 0 30px var(--magenta-glow), 0 0 60px rgba(233, 30, 140, 0.2);
  --glow-ember: 0 0 30px var(--ember-glow), 0 0 60px rgba(201, 162, 39, 0.2);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient Canvas ────────────────────────────────────────── */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Main Layout ───────────────────────────────────────────── */
#card-root {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100dvh;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-xl) 0;
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.1;
  color: var(--white-hot);
  letter-spacing: -0.02em;
}

.hero__tagline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: var(--space-xs);
}

.hero__bridge {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  max-width: 380px;
  line-height: 1.6;
}

/* ── Route Cards ───────────────────────────────────────────── */
.routes {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
}

.route-card {
  display: block;
  background: var(--black-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all var(--duration-med) var(--ease-out);
  cursor: pointer;
}

.route-card:hover,
.route-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.route-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.route-card--cyan:hover,
.route-card--cyan:focus-visible {
  border-color: rgba(0, 180, 216, 0.4);
  box-shadow: var(--glow-cyan);
}

.route-card--ember:hover,
.route-card--ember:focus-visible {
  border-color: rgba(201, 162, 39, 0.4);
  box-shadow: var(--glow-ember);
}

.route-card--magenta:hover,
.route-card--magenta:focus-visible {
  border-color: rgba(233, 30, 140, 0.4);
  box-shadow: var(--glow-magenta);
}

.route-card__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.route-card--cyan .route-card__label { color: var(--cyan); }
.route-card--ember .route-card__label { color: var(--ember); }
.route-card--magenta .route-card__label { color: var(--magenta); }

.route-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.route-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.route-card__cta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.route-card--cyan .route-card__cta { color: var(--cyan); }
.route-card--ember .route-card__cta { color: var(--ember); }
.route-card--magenta .route-card__cta { color: var(--magenta); }

.route-card__cta-arrow {
  transition: transform var(--duration-fast) var(--ease-out);
}

.route-card:hover .route-card__cta-arrow {
  transform: translateX(4px);
}

/* ── Proof Strip ───────────────────────────────────────────── */
.proof {
  padding: var(--space-lg) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.proof::-webkit-scrollbar { display: none; }

.proof__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.proof__item {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
  white-space: normal;
}

.proof__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
}

/* ── Social Icons ──────────────────────────────────────────── */
.socials {
  display: flex;
  gap: 12px;
  padding: var(--space-lg) 0;
  justify-content: center;
}

.social-link {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--duration-med) var(--ease-out);
}

.social-link:hover,
.social-link:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.social-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ── Contact ───────────────────────────────────────────────── */
.contact {
  padding: var(--space-lg) 0;
  text-align: center;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.contact__link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--duration-fast) var(--ease-out);
}

.contact__link:hover {
  color: var(--cyan);
  border-color: rgba(0, 180, 216, 0.3);
}

.contact__vcard {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--black);
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  border: none;
  padding: 14px 28px;
  cursor: pointer;
  min-height: 48px;
  transition: all var(--duration-fast) var(--ease-out);
}

.contact__vcard:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  padding: var(--space-lg) 0 var(--space-xl);
  text-align: center;
}

.footer__copy {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ── Reveal Animations ─────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Lead Capture Modal ────────────────────────────────────── */
.lead-overlay {
  position: fixed;
  inset: 0;
  z-index: 1002;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-med) var(--ease-out);
}

.lead-overlay--open {
  opacity: 1;
  pointer-events: auto;
}

.lead-modal {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px 16px 0 0;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  transform: translateY(100%);
  transition: transform var(--duration-med) var(--ease-out);
}

.lead-overlay--open .lead-modal {
  transform: translateY(0);
}

.lead-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.lead-modal__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.lead-modal__subtitle {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.lead-modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration-fast);
}

.lead-modal__close:hover { color: var(--text-primary); }

.lead-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.lead-form__input,
.lead-form__select,
.lead-form__textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 14px;
  outline: none;
  transition: border-color var(--duration-fast);
  min-height: 48px;
  width: 100%;
}

.lead-form__input::placeholder,
.lead-form__textarea::placeholder { color: var(--text-muted); }

.lead-form__input:focus,
.lead-form__select:focus,
.lead-form__textarea:focus { border-color: rgba(233, 30, 140, 0.4); }

.lead-form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.lead-form__select option {
  background: var(--black-card);
  color: var(--text-primary);
}

.lead-form__textarea {
  resize: none;
  min-height: 60px;
}

.lead-form__submit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--black);
  background: linear-gradient(135deg, var(--magenta), var(--cyan));
  border: none;
  padding: 16px;
  cursor: pointer;
  min-height: 48px;
  transition: all var(--duration-fast) var(--ease-out);
}

.lead-form__submit:hover { opacity: 0.9; }
.lead-form__submit:disabled { opacity: 0.6; cursor: wait; }

/* Lead Success State */
.lead-success {
  text-align: center;
  padding: var(--space-md) 0;
}

.lead-success__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(233, 30, 140, 0.15);
  color: var(--magenta);
  margin-bottom: var(--space-sm);
}

.lead-success__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.lead-success__text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.lead-success__chat {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cyan);
  background: rgba(0, 180, 216, 0.1);
  border: 1px solid rgba(0, 180, 216, 0.2);
  padding: 14px 28px;
  cursor: pointer;
  min-height: 48px;
  transition: all var(--duration-fast) var(--ease-out);
}

.lead-success__chat:hover { background: rgba(0, 180, 216, 0.2); }

/* Desktop: center the modal */
@media (min-width: 481px) {
  .lead-overlay {
    align-items: center;
  }

  .lead-modal {
    border-radius: 4px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
  }

  .lead-overlay--open .lead-modal {
    transform: translateY(0) scale(1);
  }
}

/* ── Chat Trigger ──────────────────────────────────────────── */
.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--black-card);
  border: 2px solid transparent;
  background-clip: padding-box;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-med) var(--ease-out);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.chat-trigger::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(var(--ember), var(--magenta), var(--cyan), var(--ember));
  z-index: -1;
  animation: halo-spin 4s linear infinite;
}

.chat-trigger:hover {
  transform: scale(1.08);
}

.chat-trigger__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ember);
  animation: trigger-pulse 2s ease-in-out infinite;
}

.chat-trigger__label {
  position: absolute;
  right: 64px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--black-card);
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateX(8px);
  transition: all var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.chat-trigger:hover .chat-trigger__label {
  opacity: 1;
  transform: translateX(0);
}

/* ── Chat Panel ────────────────────────────────────────────── */
.ghost-chat {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-height: 520px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity var(--duration-med) var(--ease-out),
              transform var(--duration-med) var(--ease-out);
}

.ghost-chat--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.ghost-chat__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.ghost-chat__avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.ghost-chat__avatar-halo {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(var(--ember), var(--magenta), var(--cyan), var(--ember));
  z-index: 0;
  animation: halo-spin 4s linear infinite;
}

.ghost-chat__avatar-icon {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--black-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ghost-chat__avatar-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--text-primary);
}

.ghost-chat__title {
  display: flex;
  flex-direction: column;
}

.ghost-chat__name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.ghost-chat__subtitle {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.ghost-chat__close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color var(--duration-fast);
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ghost-chat__close:hover { color: var(--text-primary); }

/* Chat Messages */
.ghost-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 200px;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.ghost-msg {
  max-width: 85%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ghost-msg--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.ghost-msg--user {
  align-self: flex-end;
  background: rgba(0, 180, 216, 0.12);
  border: 1px solid rgba(0, 180, 216, 0.15);
  color: var(--text-primary);
}

.ghost-msg--error {
  color: var(--ember);
  border-color: rgba(201, 162, 39, 0.2);
}

/* Thinking Dots */
.ghost-thinking {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.ghost-thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: think-pulse 1.4s ease-in-out infinite;
}

.ghost-thinking span:nth-child(1) { background: var(--cyan); animation-delay: 0s; }
.ghost-thinking span:nth-child(2) { background: var(--magenta); animation-delay: 0.2s; }
.ghost-thinking span:nth-child(3) { background: var(--ember); animation-delay: 0.4s; }

/* Chat Input */
.ghost-chat__form {
  display: flex;
  gap: 0;
  padding: var(--space-xs) var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.ghost-chat__input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-right: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px; /* Prevents iOS zoom */
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--duration-fast);
  min-height: 48px;
}

.ghost-chat__input::placeholder { color: var(--text-muted); }
.ghost-chat__input:focus { border-color: rgba(0, 180, 216, 0.3); }

.ghost-chat__send {
  background: rgba(0, 180, 216, 0.15);
  border: 1px solid rgba(0, 180, 216, 0.2);
  color: var(--cyan);
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast);
  min-width: 48px;
  min-height: 48px;
}

.ghost-chat__send:hover { background: rgba(0, 180, 216, 0.25); }

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes halo-spin {
  to { transform: rotate(360deg); }
}

@keyframes trigger-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

@keyframes think-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Desktop (480px+) ──────────────────────────────────────── */
@media (min-width: 481px) {
  #card-root {
    padding: 0 32px;
  }
}

/* ── Tablet/Desktop (768px+) ───────────────────────────────── */
@media (min-width: 769px) {
  #card-root {
    max-width: 580px;
  }

  .routes {
    flex-direction: row;
    gap: var(--space-sm);
  }

  .route-card {
    flex: 1;
  }

  .proof__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .proof__item {
    flex: 1;
    min-width: 200px;
  }
}

/* ── Mobile Chat Bottom Sheet ──────────────────────────────── */
@media (max-width: 768px) {
  .ghost-chat {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .ghost-chat--open {
    transform: translateY(0);
  }

  .ghost-chat__messages {
    max-height: calc(70vh - 140px);
  }

  .chat-trigger__label {
    display: none;
  }
}

/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .chat-trigger::before {
    animation: none;
    opacity: 0.5;
  }

  .chat-trigger__dot {
    animation: none;
  }

  .ghost-chat__avatar-halo {
    animation: none;
    opacity: 0.5;
  }

  .ghost-thinking span {
    animation: none;
    opacity: 0.7;
  }

  .ghost-chat {
    transition: opacity 0.1s;
    transform: none !important;
  }

  .ghost-chat--open {
    transform: none !important;
  }

  .route-card {
    transition: none;
  }

  .route-card__cta-arrow {
    transition: none;
  }

  .lead-modal {
    transition: none;
    transform: none !important;
  }
}
