/* ── Reset & Base ───────────────────────────── */

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

:root {
  --bg:          #111111;
  --bg-raised:   #1c1c1c;
  --text:        #ececec;
  --text-dim:    #999999;
  --text-body:   #cccccc;
  --gold:        #d4a843;
  --gold-soft:   rgba(212, 168, 67, 0.15);
  --border:      rgba(255, 255, 255, 0.08);
  --font:        'Inter', -apple-system, system-ui, sans-serif;
  --font-brand:  'Outfit', sans-serif;
  --font-verse:  'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.75;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-overflow-scrolling: touch;
}

/* ── Navigation ────────────────────────────── */

.nav {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-brand);
  font-size: 17px;
  font-weight: 300;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-new {
  color: var(--gold);
  font-weight: 500;
  margin-left: auto;
}

.nav-new:hover {
  opacity: 0.8;
}

/* ── Hamburger button ──────────────────────── */

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: 12px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-dim);
  transition: background 0.2s;
}

.menu-toggle:hover span {
  background: var(--text);
}

/* ── Side menu ─────────────────────────────── */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  transition: opacity 0.25s;
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-raised);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.side-menu.open {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.menu-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

.menu-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.menu-close:hover {
  color: var(--text);
}

.menu-section {
  padding: 20px;
}

.menu-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.menu-lang-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 28px;
}

.menu-lang-select option {
  background: var(--bg-raised);
  color: var(--text);
}

.menu-links {
  padding: 0 20px;
}

.menu-links a {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  transition: color 0.2s;
}

.menu-links a:hover {
  color: var(--text);
}

.menu-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--border);
}

.menu-footer p {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Chat Container ────────────────────────── */

.chat-container {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 64px 20px 100px;
  min-height: 100dvh;
}

/* ── Empty State ───────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  text-align: center;
}

.title {
  font-family: var(--font-brand);
  font-size: 38px;
  font-weight: 200;
  color: var(--text);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-dim);
  max-width: 320px;
  line-height: 1.6;
  font-weight: 400;
}

/* ── Messages ──────────────────────────────── */

.message {
  margin-bottom: 8px;
}

.message-user {
  padding: 16px 0 8px;
}

.message-user .message-bubble {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.message-response {
  padding: 8px 0 24px;
}

/* ── Response sections ─────────────────────── */

.resp-arrival {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-body);
}

.resp-teaching {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-body);
}

.resp-turn {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-body);
}

.resp-arjuna {
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-style: italic;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

/* ── Krishna Says — the sacred moment ──────── */

.resp-krishnasays {
  text-align: center;
  padding: 32px 16px;
  margin: 24px -16px;
  background: var(--gold-soft);
  border-radius: 8px;
}

.krishnasays-label {
  font-family: var(--font-brand);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 20px;
  font-weight: 400;
  display: block;
  word-spacing: 0.25em;
}

.verse-devanagari {
  font-family: var(--font-verse);
  font-size: 24px;
  line-height: 1.6;
  display: block;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 400;
}

.verse-transliteration {
  font-family: var(--font-verse);
  font-size: 19px;
  font-style: italic;
  display: block;
  margin-bottom: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

.verse-translation {
  font-size: 16px;
  font-style: italic;
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.7;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.verse-ref {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  display: block;
  margin-top: 8px;
}

/* ── Sadhana ───────────────────────────────── */

.resp-sadhana {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.sadhana-divider {
  display: none;
}

.sadhana-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sadhana-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-body);
}

/* ── Special modes ─────────────────────────── */

.resp-special {
  text-align: center;
  padding: 40px 20px;
}

.crisis-message,
.silence-message {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text);
}

.crisis-resource {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.crisis-resource strong {
  color: var(--text);
  font-weight: 500;
}

/* ── Loading dots ──────────────────────────── */

.loading {
  display: flex;
  gap: 6px;
  padding: 16px 0;
}

.loading-dot {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Typing cursor ─────────────────────────── */

.typing-cursor::after {
  content: '|';
  color: var(--gold);
  animation: blink 1s step-end infinite;
  margin-left: 1px;
  font-weight: 300;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Input Area ────────────────────────────── */

.input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px 20px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.input-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

#question-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  overflow: hidden;
}

#question-input::placeholder {
  color: var(--text-dim);
}

#question-input:focus {
  border-color: rgba(255, 255, 255, 0.16);
}

/* ── About Page ────────────────────────────── */

.about-container {
  padding-top: 80px;
  padding-bottom: 60px;
  max-width: 560px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.about-title {
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 32px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.about-section {
  margin-bottom: 28px;
}

.about-section h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.about-section p {
  font-size: 14px;
  color: var(--text-body);
  margin-bottom: 8px;
  line-height: 1.75;
}

.about-section ul {
  list-style: none;
  padding: 0;
}

.about-section li {
  font-size: 14px;
  color: var(--text-body);
  padding: 3px 0;
}

.about-section a {
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.2s;
}

.about-section a:hover {
  opacity: 0.8;
}

.about-section li::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.about-note {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 40px;
}

.about-note p {
  font-style: italic;
  font-size: 13px;
  color: var(--text-dim);
}


/* ── Debug panel ───────────────────────────── */

.debug-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.6;
}

.debug-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.debug-row {
  display: flex;
  gap: 8px;
}

.debug-label {
  color: var(--text-dim);
  min-width: 110px;
  flex-shrink: 0;
}

.debug-value {
  color: var(--text-body);
  word-break: break-all;
}

.debug-gravity-crisis {
  color: #e74c3c;
  font-weight: 600;
}

.debug-gravity-silence {
  color: var(--gold);
  font-weight: 600;
}

.debug-rediagnose {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.debug-rediagnose:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.debug-rediagnose:disabled {
  color: var(--gold);
  border-color: var(--gold);
  cursor: default;
  opacity: 0.7;
}

/* ── Utilities ─────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Responsive ────────────────────────────── */

/* ── Tablet ─────────────────────────────────── */

@media (max-width: 768px) {
  .chat-container { padding: 56px 16px 96px; }
  .resp-krishnasays { margin: 20px -8px; padding: 28px 14px; }
}

/* ── Mobile ─────────────────────────────────── */

@media (max-width: 480px) {
  html { font-size: 16px; }
  .nav { padding: 10px 14px; }
  .nav-logo { font-size: 15px; }
  .chat-container { padding: 50px 14px 88px; }
  .title { font-size: 28px; letter-spacing: 0.06em; }
  .subtitle { font-size: 14px; }
  .message-user .message-bubble { font-size: 17px; }
  .resp-arrival, .resp-teaching, .resp-turn { font-size: 15px; }
  .resp-krishnasays { margin: 16px -6px; padding: 20px 10px; }
  .verse-devanagari { font-size: 20px; }
  .verse-transliteration { font-size: 16px; }
  .verse-translation { font-size: 15px; }
  .krishnasays-label { font-size: 11px; }
  #question-input { padding: 12px 14px; font-size: 16px; }
  .side-menu { width: 260px; }
  .menu-close { font-size: 26px; padding: 4px 8px; }
  .input-area { padding: 8px 12px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ── Small phones ──────────────────────────── */

@media (max-width: 360px) {
  .title { font-size: 24px; }
  .chat-container { padding: 48px 12px 84px; }
  .side-menu { width: 240px; }
}
