/* ──────────────────────────────────────────────────────────────
   platform.css · shared widgets across The Threshold Collective
   universe. Loaded by index.html, momentum.html, tech.html,
   quant.html, privacy.html, terms.html, 404.html.

   Provides:
     1. Floating actions group (bottom-right): Submit + Chat
     2. Submission modal (full-screen overlay)
     3. Chat widget (bottom-right panel)
     4. Cookie consent banner (bottom)
     5. Mobile hamburger menu helpers

   Each widget honours prefers-reduced-motion. All colours pull
   from the universe palette but are inlined here so the file
   stands alone if a page forgets to include the global tokens.
   ────────────────────────────────────────────────────────────── */

:root {
  --tp-bg: #0a0a0f;
  --tp-surface: #0d0d12;
  --tp-surface-lift: #111118;
  --tp-text: #f5f2ea;
  --tp-muted: #9a958a;
  --tp-muted-2: #7c7c78;
  --tp-border: rgba(255, 255, 255, 0.08);
  --tp-border-bright: rgba(255, 255, 255, 0.18);
  --tp-cream: #e4d9b8;
  --tp-blue: #6cb4ee;
  --tp-violet: #8b5cf6;
  --tp-mint: #4ade80;
  --tp-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  --tp-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --tp-serif: "Playfair Display", Georgia, serif;
}

/* ── Floating actions ─────────────────────────────────────── */
.tp-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

@media (max-width: 600px) {
  .tp-actions { right: 16px; bottom: 16px; }
  /* When the cookie banner is showing on mobile, lift the floating Chat/Submit
     pills above it so they do not collide with the "Got it" CTA. */
  body.tp-cookies-visible .tp-actions { bottom: 130px; }
}
@media (min-width: 601px) {
  /* On desktop the banner is wider but lower; just nudge buttons up slightly */
  body.tp-cookies-visible .tp-actions { bottom: 110px; }
}

.tp-pill {
  background: rgba(10, 10, 15, 0.92);
  border: 1px solid var(--tp-border-bright);
  border-radius: 24px;
  padding: 10px 18px;
  color: var(--tp-cream);
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}

.tp-pill:hover { border-color: var(--tp-cream); transform: translateY(-1px); color: #fff; }
.tp-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--tp-cream);
  box-shadow: 0 0 8px var(--tp-cream);
}

.tp-pill.chat::before { background: var(--tp-blue); box-shadow: 0 0 8px var(--tp-blue); animation: tp-tick 2.4s ease-in-out infinite; }
.tp-pill.chat { color: var(--tp-blue); }
.tp-pill.chat:hover { border-color: var(--tp-blue); }

@keyframes tp-tick {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

/* ── Submission modal ─────────────────────────────────────── */
.tp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tp-modal-backdrop.open { display: flex; }

.tp-modal {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border-bright);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: auto;
  padding: 36px;
  position: relative;
  font-family: var(--tp-sans);
}

.tp-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  color: var(--tp-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.08);
}
.tp-modal-close:hover { background: rgba(255,255,255,0.06); color: var(--tp-text); }

.tp-modal-kicker {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 2.8px;
  text-transform: uppercase;
  color: var(--tp-cream);
  margin-bottom: 14px;
  display: block;
}

.tp-modal h3 {
  font-family: var(--tp-serif);
  font-weight: 700;
  font-size: 28px;
  line-height: 32px;
  margin-bottom: 8px;
  color: var(--tp-text);
  letter-spacing: -0.01em;
}

.tp-modal p.tp-modal-lede {
  color: var(--tp-muted);
  font-size: 14px;
  line-height: 22px;
  margin-bottom: 24px;
}

.tp-form { display: flex; flex-direction: column; gap: 16px; }

.tp-field { display: flex; flex-direction: column; gap: 6px; }

.tp-label {
  font-family: var(--tp-mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--tp-muted-2);
}

.tp-input,
.tp-select,
.tp-textarea {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--tp-border);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--tp-text);
  font-family: var(--tp-sans);
  font-size: 14px;
  line-height: 22px;
  transition: border-color 0.2s ease, background 0.2s ease;
  width: 100%;
}
.tp-input:focus,
.tp-select:focus,
.tp-textarea:focus {
  outline: 0;
  border-color: var(--tp-cream);
  background: rgba(0, 0, 0, 0.55);
}
.tp-textarea { min-height: 110px; resize: vertical; font-family: var(--tp-sans); }

.tp-form-actions { display: flex; gap: 12px; margin-top: 8px; align-items: center; flex-wrap: wrap; }

.tp-btn-primary {
  background: var(--tp-cream);
  color: #1a1500;
  border: 0;
  border-radius: 6px;
  padding: 13px 26px;
  font-family: var(--tp-sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(228,217,184,0.18);
}
.tp-btn-primary:hover { background: #d4c8a3; transform: translateY(-1px); }

.tp-btn-link {
  background: transparent;
  border: 0;
  color: var(--tp-muted);
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 6px;
  transition: color 0.2s ease;
}
.tp-btn-link:hover { color: var(--tp-text); }

.tp-form-status {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--tp-mint);
  margin-top: 8px;
  min-height: 16px;
}
.tp-form-status.error { color: #f59e9e; }

/* ── Chat widget ──────────────────────────────────────────── */
.tp-chat {
  position: fixed;
  right: 24px;
  bottom: 80px;
  z-index: 250;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--tp-surface);
  border: 1px solid var(--tp-border-bright);
  border-radius: 12px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}
.tp-chat.open { display: flex; }

@media (max-width: 600px) {
  .tp-chat { right: 8px; bottom: 76px; width: calc(100vw - 16px); height: calc(100vh - 100px); }
}

.tp-chat-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--tp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tp-surface-lift);
}

.tp-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tp-chat-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--tp-blue);
  box-shadow: 0 0 8px var(--tp-blue);
  animation: tp-tick 2.4s ease-in-out infinite;
}

.tp-chat-title-text {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tp-text);
}

.tp-chat-close {
  background: transparent;
  border: 0;
  color: var(--tp-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.08);
}
.tp-chat-close:hover { color: var(--tp-text); }

.tp-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tp-msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--tp-sans);
  font-size: 14px;
  line-height: 21px;
}

.tp-msg.bot {
  align-self: flex-start;
  background: rgba(108, 180, 238, 0.10);
  border: 1px solid rgba(108, 180, 238, 0.22);
  color: var(--tp-text);
  border-top-left-radius: 4px;
}

.tp-msg.user {
  align-self: flex-end;
  background: rgba(228, 217, 184, 0.10);
  border: 1px solid rgba(228, 217, 184, 0.22);
  color: var(--tp-text);
  border-top-right-radius: 4px;
}

.tp-msg a {
  color: var(--tp-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tp-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tp-suggestion {
  background: transparent;
  border: 1px solid var(--tp-border-bright);
  border-radius: 16px;
  padding: 6px 12px;
  color: var(--tp-muted);
  font-size: 11px;
  font-family: var(--tp-mono);
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.tp-suggestion:hover { border-color: var(--tp-cream); color: var(--tp-text); }

.tp-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(108, 180, 238, 0.10);
  border: 1px solid rgba(108, 180, 238, 0.22);
  border-radius: 12px;
  border-top-left-radius: 4px;
}

.tp-typing span {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--tp-blue);
  animation: tp-bounce 1.4s ease-in-out infinite;
}
.tp-typing span:nth-child(2) { animation-delay: 0.2s; }
.tp-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tp-bounce {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-3px); }
}

.tp-chat-input {
  border-top: 1px solid var(--tp-border);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--tp-surface-lift);
}

.tp-chat-input input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--tp-text);
  font-family: var(--tp-sans);
  font-size: 14px;
  outline: 0;
}
.tp-chat-input input::placeholder { color: var(--tp-muted-2); }

.tp-chat-send {
  background: var(--tp-blue);
  color: #061525;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font-family: var(--tp-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.tp-chat-send:hover { background: #5a9fd6; }

.tp-chat-disclaimer {
  padding: 8px 16px 14px;
  font-family: var(--tp-mono);
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tp-muted-2);
  text-align: center;
  background: var(--tp-surface-lift);
  border-top: 1px solid var(--tp-border);
}

/* ── Cookie banner ─────────────────────────────────────────── */
.tp-cookies {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 180;
  background: rgba(10, 10, 15, 0.96);
  border: 1px solid var(--tp-border-bright);
  border-radius: 10px;
  padding: 18px 22px;
  font-family: var(--tp-sans);
  display: none;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.tp-cookies.show { display: flex; }

@media (max-width: 600px) {
  .tp-cookies { left: 12px; right: 12px; bottom: 12px; padding: 14px 16px; }
}

.tp-cookies-text {
  flex: 1;
  min-width: 240px;
  color: var(--tp-muted);
  font-size: 12px;
  line-height: 18px;
}
.tp-cookies-text a { color: var(--tp-cream); text-decoration: underline; text-underline-offset: 2px; }

.tp-cookies-btn {
  background: var(--tp-cream);
  color: #1a1500;
  border: 0;
  border-radius: 6px;
  padding: 12px 22px;
  font-family: var(--tp-sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.6px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.08);
}

.tp-cookies-btn-secondary {
  background: transparent;
  color: var(--tp-muted);
  border: 1px solid var(--tp-border-bright);
}
.tp-cookies-btn-secondary:hover { color: var(--tp-text); border-color: var(--tp-text); }

/* ── Mobile menu helper ───────────────────────────────────── */
.tp-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--tp-border-bright);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--tp-text);
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .tp-mobile-toggle { display: inline-flex; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tp-actions *, .tp-modal *, .tp-chat *, .tp-cookies * {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Footer sitemap (used by footer-sitemap class on every page) ── */
.tp-sitemap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 36px;
  padding: 56px 0 36px;
  border-top: 1px solid var(--tp-border);
}

.tp-sitemap-col h4 {
  font-family: var(--tp-mono);
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--tp-cream);
  margin-bottom: 14px;
}

.tp-sitemap-col ul { list-style: none; padding: 0; margin: 0; }
.tp-sitemap-col li { padding: 4px 0; }
.tp-sitemap-col a {
  color: var(--tp-muted);
  font-family: var(--tp-sans);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s ease;
}
.tp-sitemap-col a:hover { color: var(--tp-text); }

.tp-sitemap-col p {
  color: var(--tp-muted);
  font-family: var(--tp-sans);
  font-size: 13px;
  line-height: 20px;
  margin: 0;
}
