/* ═══════════════════════════════════════════════════════
   CORTEX FREELANCER — Warm Light Theme v1
   Calm, credible, premium. Built for ad traffic.
   ═══════════════════════════════════════════════════════ */

:root {
  /* ── Surfaces ── */
  --bg: #faf7f2;            /* warm cream */
  --bg-soft: #f5ecdc;       /* peach-cream for hero */
  --bg-card: #ffffff;
  --bg-hover: #f8f3ea;
  --bg-muted: #f2ece0;

  /* ── Borders ── */
  --border: #e8e1d3;
  --border-strong: #d3c9b5;
  --border-soft: #f0ebe0;

  /* ── Text ── */
  --text: #1a1814;          /* warm near-black */
  --text-secondary: #55504a;
  --text-dim: #8a847a;
  --text-muted: #b3ad9f;

  /* ── Accents ── */
  --accent: #ea580c;        /* warm orange, modern */
  --accent-soft: #fff1e6;
  --accent-hover: #c2410c;
  --accent-text: #ffffff;

  /* ── Semantic ── */
  --success: #16a34a;
  --success-soft: #e8f5ec;
  --danger: #dc2626;
  --danger-soft: #fde8e8;
  --info: #2563eb;
  --info-soft: #e8f0fe;

  /* ── Shadow ── */
  --shadow-xs: 0 1px 2px rgba(26, 24, 20, 0.04);
  --shadow-sm: 0 2px 8px -2px rgba(26, 24, 20, 0.06);
  --shadow-md: 0 8px 24px -6px rgba(26, 24, 20, 0.10);
  --shadow-lg: 0 20px 48px -12px rgba(26, 24, 20, 0.14);

  /* ── Radius ── */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* ── Font ── */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ═══════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════ */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250, 247, 242, 0.8);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.main-nav-logo {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1.8px;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.main-nav-logo::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.main-nav-links { display: flex; gap: 1.25rem; align-items: center; }
.main-nav-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.main-nav-links a:hover { color: var(--accent); }
.nav-cta-btn {
  background: var(--text) !important;
  color: var(--bg) !important;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  transition: background 0.15s;
}
.nav-cta-btn:hover { background: var(--accent) !important; color: white !important; }

/* ═══════════════════════════════════════════════════════
   HERO / CHAT SECTION
   ═══════════════════════════════════════════════════════ */
.chat-section {
  padding: 3.5rem 0 3rem;
  position: relative;
  overflow: hidden;
}
.chat-section::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(circle at center,
    rgba(234, 88, 12, 0.08) 0%,
    rgba(234, 88, 12, 0.03) 30%,
    transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.chat-section .container { position: relative; z-index: 1; }

.chat-header {
  text-align: center;
  margin-bottom: 1.75rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
.chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
}
.chat-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

.chat-header h1 {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.08;
  margin-bottom: 0.85rem;
  letter-spacing: -0.02em;
}
.gradient-text {
  background: linear-gradient(120deg, var(--accent) 0%, #f97316 60%, #fb923c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.chat-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 560px;
  margin: 0 auto;
}

/* ── Chat Container ── */
.chat-container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s;
}
.chat-container:focus-within {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  min-height: 180px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 100px;
}

.chat-msg { display: flex; flex-direction: column; }
.chat-msg-user { align-items: flex-end; }
.chat-msg-assistant { align-items: flex-start; }

.chat-bubble {
  max-width: 86%;
  padding: 0.85rem 1.1rem;
  border-radius: 18px;
  font-size: 0.93rem;
  line-height: 1.6;
  word-wrap: break-word;
}
.chat-bubble p { margin-bottom: 0.55rem; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble strong { color: var(--text); font-weight: 600; }
.chat-bubble code {
  background: var(--bg-muted);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  font-size: 0.84rem;
  font-family: 'SF Mono', Menlo, monospace;
}
.chat-bubble ul { margin: 0.5rem 0 0.5rem 1.25rem; }
.chat-bubble li { margin-bottom: 0.3rem; }
.chat-bubble a { color: var(--accent); text-decoration: none; font-weight: 500; }
.chat-bubble a:hover { text-decoration: underline; }

.chat-bubble-user {
  background: var(--text);
  color: var(--bg-card);
  border-bottom-right-radius: 6px;
}
.chat-bubble-user strong { color: var(--bg-card); }
.chat-bubble-assistant {
  background: var(--bg-muted);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.chat-bubble-error {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: var(--danger);
}

/* Tool suggestion cards (within chat) */
.chat-tools { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; max-width: 86%; }
.chat-tool-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.chat-tool-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chat-tool-icon { font-size: 1.4rem; flex-shrink: 0; }
.chat-tool-info { flex: 1; min-width: 0; }
.chat-tool-info strong { display: block; font-size: 0.86rem; color: var(--text); font-weight: 600; }
.chat-tool-info span { font-size: 0.77rem; color: var(--text-dim); }
.chat-tool-arrow { color: var(--accent); font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }

/* ── Suggestion Chips ── */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.5rem 1rem;
  border-top: 1px dashed var(--border-soft);
  padding-top: 0.85rem;
}
.chat-chip {
  padding: 0.45rem 0.95rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chat-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── Input ── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
#chat-input {
  flex: 1;
  padding: 0.7rem 0.85rem;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: calc(1.4em * 4 + 1.4rem);
  transition: all 0.15s;
}
#chat-input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#chat-input::placeholder { color: var(--text-muted); }
#chat-input:disabled { opacity: 0.5; }

.chat-send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-send-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Typing indicator */
.chat-typing { display: flex; gap: 5px; align-items: center; padding: 1rem; }
.chat-typing .dot {
  width: 7px; height: 7px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Trust line under chat */
.trust-line {
  text-align: center;
  margin-top: 1.25rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.trust-line span { display: inline-flex; align-items: center; gap: 0.35rem; }
.trust-line span::before { content: '✓'; color: var(--success); font-weight: 700; }

/* Segment indicator under chat (shown after user picks segment) */
.segment-pill {
  display: none;
  margin: 0.75rem auto 0;
  text-align: center;
}
.segment-pill button {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.3rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.segment-pill button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   TOOLS SECTION
   ═══════════════════════════════════════════════════════ */
.tools-section { padding: 3rem 0 4rem; }
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}
.section-sub {
  color: var(--text-dim);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 2rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s;
}
.tool-card:hover::before { transform: scaleX(1); }
.tool-icon { font-size: 1.75rem; margin-bottom: 0.6rem; }
.tool-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.tool-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.tool-tag {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.22rem 0.65rem;
  border-radius: 100px;
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--success-soft);
  color: var(--success);
}
.tool-tag.popular {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   SEGMENTATION MODAL
   ═══════════════════════════════════════════════════════ */
.seg-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 20, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 0.25s ease;
}
.seg-backdrop.seg-visible { display: flex; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.seg-modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2rem 2rem 1.75rem;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scale-in 0.3s ease;
  position: relative;
}
.seg-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 100px;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.seg-close:hover { background: var(--bg-muted); color: var(--text); }

.seg-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 1.25rem;
}
.seg-progress-step {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  transition: background 0.25s;
}
.seg-progress-step.active { background: var(--accent); }

.seg-step-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}
.seg-step-sub {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.seg-options {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 1.25rem;
}
.seg-options.full-width { grid-template-columns: 1fr; }

.seg-option {
  padding: 0.75rem 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.seg-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.seg-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.seg-option-icon { font-size: 1.05rem; }

.seg-text-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: all 0.15s;
}
.seg-text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.seg-text-input::placeholder { color: var(--text-muted); }

.seg-text-hint {
  margin-top: 0.4rem;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.seg-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  gap: 1rem;
}
.seg-skip {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
}
.seg-skip:hover { color: var(--text); }

.seg-next {
  background: var(--text);
  color: var(--bg-card);
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: 100px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.seg-next:hover {
  background: var(--accent);
}
.seg-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: 2.25rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg-card);
}
.site-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .chat-section { padding: 2rem 0 2rem; }
  .chat-header h1 { font-size: 2rem; }
  .chat-sub { font-size: 0.98rem; }
  .chat-messages { padding: 1.1rem; max-height: 380px; }
  .chat-bubble { max-width: 92%; font-size: 0.9rem; }
  .chat-chips { padding: 0.75rem 1.1rem 0.85rem; gap: 0.4rem; }
  .chat-chip { font-size: 0.78rem; padding: 0.4rem 0.8rem; }
  .main-nav { padding: 0.75rem 1.1rem; }
  .main-nav-links { gap: 0.9rem; }
  .main-nav-links a:not(.nav-cta-btn) { display: none; }
  .tools-grid { grid-template-columns: 1fr; }
  .seg-modal { padding: 1.5rem 1.4rem 1.25rem; }
  .seg-options { grid-template-columns: 1fr; }
  .trust-line { gap: 1rem; font-size: 0.78rem; }
}

/* ═══════════════════════════════════════════════════════
   LEGACY (analyzer tool pages — to be restyled later)
   ═══════════════════════════════════════════════════════ */
.analyzer-section { padding: 3rem 0 4rem; }
.analyzer-panel { max-width: 640px; margin: 0 auto; }
.btn-primary {
  width: 100%; padding: 0.95rem;
  background: var(--accent); color: white;
  font-weight: 600; font-size: 0.95rem; border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  padding: 0.65rem 1.5rem;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  padding: 0.75rem 1.5rem; background: var(--text); color: var(--bg-card);
  border-radius: var(--radius); font-size: 0.85rem; font-weight: 500;
  z-index: 1000; animation: toast-in 0.3s ease; box-shadow: var(--shadow-md);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
