/* Apple-style Matte Black / Matte White Minimalism */

:root {
  --bg: #161618;
  --bg-2: #1c1c1e;
  --bg-3: #2c2c2e;
  --text-main: #F5F5F7;
  --text-muted: #86868b;
  --border: #38383a;
  --accent: #ffffff;
  --nav-height: 60px;
  --radius: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input, select, textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Nav */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
  background: rgba(22, 22, 24, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-logo {
  position: absolute;
  left: 40px;
  display: flex;
  align-items: center;
}
.nav-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}
.nav-links {
  display: flex;
  gap: 8px;
}
.nav-btn {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.nav-btn:hover {
  color: var(--text-main);
}
.nav-btn.active {
  color: var(--bg);
  background: var(--text-main);
}

/* Page wrap */
.page-wrap {
  padding-top: var(--nav-height);
}
.page {
  display: none;
  min-height: calc(100vh - var(--nav-height));
}
.page.active {
  display: block;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s;
}
.btn-primary {
  background: var(--text-main);
  color: var(--bg);
}
.btn-primary:hover {
  transform: scale(1.02);
  opacity: 0.9;
}
.btn-ghost {
  background: var(--bg-2);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-3);
  transform: scale(1.02);
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

/* Hero */
.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 60px;
}
.hero-content {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.hero-h1 {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 24px;
  color: var(--text-main);
}
.hero-sub {
  font-size: clamp(18px, 2.5vw, 22px);
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 40px;
  max-width: 600px;
}
.hero-actions {
  display: flex;
  gap: 16px;
}

/* Videos */
.media-video-container {
  width: 100%;
  max-width: 900px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.split-video-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
}

.video-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  letter-spacing: 0.02em;
}

.split-video-container .inline-video {
  width: 100%;
  height: 100%;
  border-radius: 24px; /* Proportionally larger border-radius */
  background: var(--bg-2);
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
  object-fit: cover;
}

.inline-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-3); /* Matte styled placeholder color */
}

/* Features */
.features {
  padding: 120px 0;
  text-align: center;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 60px;
  text-align: left;
}
.feat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  transition: transform 0.3s var(--ease), background 0.3s;
  cursor: pointer;
}
.feat-card:hover {
  background: var(--bg-3);
  transform: translateY(-4px);
}
.feat-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text-main);
}
.feat-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Media Section */
.media-section {
  padding: 120px 0;
}
.media-container {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
  text-align: center;
}
.media-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Explorer */
.explorer {
  padding: 80px 24px;
  max-width: 1024px;
  margin: 0 auto;
}
.explorer-header {
  margin-bottom: 40px;
}
.explorer-header h2 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.explorer-header p {
  color: var(--text-muted);
  font-size: 16px;
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
  padding: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
.filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.filter-select {
  appearance: none;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.filter-select:focus {
  border-color: var(--text-muted);
}
.add-compare-btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-3);
  color: var(--text-main);
  border: 1px solid var(--border);
  transition: all 0.2s;
  height: 46px;
}
.add-compare-btn:hover:not(:disabled) {
  background: var(--text-muted);
  color: var(--bg);
}
.add-compare-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topics-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.topics-grid {
  display: grid;
  gap: 24px;
}
.topic-group {
  margin-bottom: 16px;
}
.topic-group-header {
  margin-bottom: 12px;
}
.topic-chip-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topic-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.question-summary-btn {
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
  transition: background 0.2s;
}
.question-summary-btn:hover {
  background: var(--bg-3);
}
.question-summary-btn strong {
  font-weight: 600;
  color: var(--text-main);
}

/* Compare */
.compare-tray {
  margin-top: 60px;
  display: none;
}
.compare-tray.visible {
  display: block;
}
.compare-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.compare-tray-title {
  font-size: 18px;
  font-weight: 600;
}
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.compare-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.compare-panel-head {
  padding: 16px 20px;
  background: var(--bg-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.compare-panel-title {
  font-weight: 600;
  font-size: 15px;
}
.compare-panel-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.compare-panel-remove {
  font-size: 20px;
  color: var(--text-muted);
}
.compare-panel-remove:hover {
  color: var(--text-main);
}
.compare-panel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compare-chip {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}
.compare-chip:hover {
  border-color: var(--text-muted);
}
.compare-q-count {
  color: var(--text-muted);
}

/* Chat */
.chat-page {
  display: flex;
  height: calc(100vh - var(--nav-height));
  background: var(--bg);
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}
.chat-top-bar {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.chat-top-bar h2 {
  font-size: 18px;
  font-weight: 600;
}
.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.loading {
  background: var(--text-main);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.prompts-strip {
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.prompts-strip::-webkit-scrollbar { height: 0; }
.prompt-chip {
  padding: 8px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-muted);
  transition: all 0.2s;
}
.prompt-chip:hover {
  background: var(--bg-3);
  color: var(--text-main);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 40px 24px;
}
.msg-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.6;
  max-width: 85%;
}
.msg-user {
  background: var(--text-main);
  color: var(--bg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg-ai {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-ai p { margin-bottom: 12px; }
.msg-ai p:last-child { margin-bottom: 0; }
.msg-ai ul, .msg-ai ol { margin: 8px 0; padding-left: 20px; }
.msg-ai code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; }

.sources-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-self: flex-start;
}
.source-tag {
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.source-tag strong {
  color: var(--text-main);
}
.citation-btn {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8em;
  vertical-align: super;
  padding: 0 4px;
  cursor: pointer;
}
.citation-btn:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.chat-input-area {
  padding: 24px;
}
.chat-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  transition: border-color 0.2s;
}
.chat-input-wrap:focus-within {
  border-color: var(--text-muted);
}
.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 15px;
  resize: none;
  max-height: 150px;
  padding: 6px 0;
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.chat-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--text-main);
  color: var(--bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.chat-send:hover:not(:disabled) {
  transform: scale(1.05);
}
.chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.empty-chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  text-align: center;
}
.empty-chat h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.open .modal {
  transform: scale(1);
}
.modal-head {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal-meta {
  display: flex;
  gap: 8px;
}
.modal-meta-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-3);
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover {
  background: var(--text-main);
  color: var(--bg);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.q-card {
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 15px;
  line-height: 1.6;
}
.q-card-head {
  margin-bottom: 12px;
}
.q-num-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-main);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 400;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   TYPEWRITER ANIMATION (SCROLL REVEAL)
══════════════════════════════════════════════════════════════ */
.typewriter-reveal {
  opacity: 0;
}
.typewriter-reveal.active {
  opacity: 1;
}
.tw-char {
  opacity: 0;
  display: inline;
  white-space: pre-wrap;
  animation: tw-fade 0.05s forwards;
}
@keyframes tw-fade {
  to {
    opacity: 1;
  }
}

/* Stats Section */
.stats-section {
  padding: 120px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  text-align: center;
}
.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.stat-num {
  font-size: clamp(48px, 6vw, 72px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
}
.stat-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Testimonials Section */
.testimonials-section {
  padding: 120px 0;
  background: var(--bg);
  text-align: center;
}
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 60px;
  text-align: left;
}
.testimonial-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}
.testimonial-quote {
  font-size: 18px;
  color: var(--text-main);
  line-height: 1.6;
  font-style: italic;
}
.testimonial-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

@media(max-width: 768px) {
  .nav { padding: 0 20px; }
  .nav-logo { display: none; }
  .hero-h1 { font-size: 40px; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .chat-page { height: auto; min-height: calc(100vh - var(--nav-height)); }
  .split-video-container { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* AI Thinking UI */
.thinking-container {
  margin-bottom: 12px;
  user-select: none;
}

.thinking-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all 0.2s var(--ease);
}

.thinking-header:hover {
  background: var(--bg-3);
  border-color: var(--text-muted);
}

.thinking-shimmer {
  font-size: 12px;
  font-weight: 500;
  background: linear-gradient(
    90deg,
    #86868b 0%,
    #f5f5f7 50%,
    #86868b 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2.4s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}


.thinking-container.hidden {
  display: none;
}

.thinking-content {
  max-height: 0;
  overflow: hidden;
  transition: all 0.4s var(--ease);
  font-size: 13px;
  line-height: 1.6;
  color: #86868b;
  border-left: 2px solid var(--border);
  margin-left: 14px;
  padding-left: 16px;
  margin-top: 0;
  opacity: 0;
}

.thinking-content.expanded {
  max-height: 800px;
  margin-top: 12px;
  margin-bottom: 16px;
  opacity: 1;
}

/* How It Works Section */
.how-it-works {
  padding: 120px 0;
  background: var(--bg);
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 60px;
}
@media(max-width: 768px) {
  .how-grid {
    grid-template-columns: 1fr;
  }
}
.how-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  transition: transform 0.3s var(--ease), border-color 0.3s;
}
.how-card:hover {
  transform: translateY(-4px);
  border-color: var(--text-muted);
}
.how-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--text-main);
}
.how-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.how-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
}

.split-video-section {
  padding-bottom: 120px;
}
.split-video-section .split-video-container {
  max-width: 1100px;
  margin: 0 auto;
}

/* Footer */
.footer {
  padding: 60px 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
}
.feedback-link {
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.2s var(--ease);
  font-weight: 500;
}
.feedback-link:hover {
  color: var(--text-main);
}