/*
 * JuanSoulTrek home styles (subset, aligned with juansoultrek.com index.html).
 * Viewport locked — no document or dashboard panel scrolling (overflow clipped).
 */

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-strong: rgba(30, 41, 59, 0.86);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.22), transparent 34rem),
    radial-gradient(circle at top right, rgba(62, 207, 142, 0.2), transparent 30rem),
    linear-gradient(135deg, #020617 0%, var(--bg) 100%);
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body:not(.dark-mode) {
  color: #172033;
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(62, 207, 142, 0.2), transparent 30rem),
    linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%);
}

main {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 18px);
  width: min(1120px, calc(100% - 32px));
  height: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(8px, 1.5vh, 18px) 0;
  overflow: hidden;
}

.demo-nav-row {
  margin: 0 0 -8px;
}

body:not(.dark-mode) .intro,
body:not(.dark-mode) .card p {
  color: #475569;
}

.page-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 12px);
  overflow: hidden;
}

.section-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3.2vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.intro {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 1.65vw, 0.9rem);
  line-height: 1.38;
}

.intro strong {
  color: var(--text);
  font-weight: 750;
}

.intro-follow {
  margin-top: 2px;
}

.req {
  color: #fca5a5;
  font-weight: 750;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Exactly two dashboard cards — avoid empty third column from the home grid */
.grid.nango-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-content: stretch;
}

.card {
  display: flex;
  min-height: 218px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 20px 64px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(18px);
  transition: 180ms ease;
}

.card.nango {
  min-height: 0;
  overflow: hidden;
}

.relay-body,
.trace-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body:not(.dark-mode) .card {
  background: rgba(255, 255, 255, 0.76);
}

.card:hover {
  border-color: rgba(226, 232, 240, 0.42);
  background: var(--panel-strong);
  transform: translateY(-2px);
}

.tag {
  width: fit-content;
  margin-bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nango .tag {
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.18);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.22rem;
  letter-spacing: -0.04em;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.stack li {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 0.72rem;
}

body:not(.dark-mode) .stack li,
body:not(.dark-mode) .button.secondary {
  color: #334155;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(226, 232, 240, 0.2);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 750;
}

.button.primary {
  border-color: transparent;
  background: #f8fafc;
  color: #020617;
}

.button.secondary {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.42);
}

button.button {
  cursor: pointer;
  font-family: inherit;
}

/* ——— Demo-only: fields + emoji + log (not on marketing home) ——— */

.field-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--text);
}

.field-label:first-of-type {
  margin-top: 6px;
}

.field-hint {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

textarea.nango-input {
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: none;
}

body:not(.dark-mode) textarea.nango-input {
  background: rgba(248, 250, 252, 0.95);
  color: #0f172a;
}

textarea.nango-input:focus {
  outline: 2px solid rgba(102, 126, 234, 0.55);
  outline-offset: 2px;
}

.char-count {
  margin: 6px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: right;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

.emoji-choice {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.28);
  font-size: 1.82rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.22);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

body:not(.dark-mode) .emoji-choice {
  background: rgba(248, 250, 252, 0.88);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.emoji-choice:hover {
  transform: translateY(-3px);
  border-color: rgba(226, 232, 240, 0.42);
  background: rgba(30, 41, 59, 0.65);
  box-shadow:
    0 14px 36px rgba(249, 115, 22, 0.18),
    0 12px 32px rgba(62, 207, 142, 0.14),
    0 16px 40px rgba(2, 6, 23, 0.35);
}

body:not(.dark-mode) .emoji-choice:hover {
  background: rgba(255, 255, 255, 0.98);
}

.emoji-choice:focus-visible {
  outline: 2px solid rgba(102, 126, 234, 0.85);
  outline-offset: 2px;
}

.emoji-choice.is-selected {
  border-color: rgba(167, 139, 250, 0.65);
  background: rgba(139, 92, 246, 0.16);
  box-shadow:
    0 12px 32px rgba(139, 92, 246, 0.28),
    0 8px 20px rgba(2, 6, 23, 0.28);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.banner {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: #6ee7b7;
  flex-shrink: 0;
}

.banner.error {
  color: #fca5a5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.subtle {
  color: var(--muted);
}

.request-line {
  margin: 0 0 12px !important;
  font-size: 0.76rem !important;
  word-break: break-all;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-right: 0;
}

.step {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.35);
}

body:not(.dark-mode) .step {
  background: rgba(248, 250, 252, 0.72);
}

.step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.84rem;
}

.step .meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.ai-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background: rgba(15, 23, 42, 0.55);
}

body:not(.dark-mode) .ai-preview {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(124, 58, 237, 0.22);
}

.ai-preview-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.ai-preview-text {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-preview-refined {
  margin: 0 0 6px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-preview-mood {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.log-request-id {
  margin: 0 0 10px;
  font-size: 0.76rem;
  line-height: 1.35;
  word-break: break-all;
  color: var(--muted);
  flex-shrink: 0;
}

.step--openai .ai-preview-text {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.42;
}

[data-status='pending'] {
  border-color: var(--border);
}

[data-status='running'] {
  border-color: rgba(167, 139, 250, 0.45);
}

[data-status='retry'] {
  border-color: #fbbf24;
}

[data-status='success'] {
  border-color: #34d399;
}

[data-status='error'] {
  border-color: #f87171;
}

@media (max-width: 980px) {
  .grid.nango-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .card:hover {
    transform: none;
  }
}
