/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --bubble-user-bg: #2563eb;
  --bubble-user-text: #ffffff;
  --bubble-bot-bg: #f1f5f9;
  --bubble-bot-text: #1a202c;
  --tag-bg: #dbeafe;
  --tag-text: #1d4ed8;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --radius: 12px;
  --header-h: 64px;
}

html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.logo-dot { color: var(--accent); font-size: 20px; }

nav { display: flex; gap: 4px; flex-wrap: wrap; }

.tab-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover { background: var(--bg); color: var(--text); }

.tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ── Main & tabs ──────────────────────────────────────────────────────────── */
main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-section {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.tab-section.active { display: flex; flex-direction: column; }

/* ── Chat tab ─────────────────────────────────────────────────────────────── */
#tab-chat {
  height: calc(100vh - var(--header-h) - 48px);
  overflow: hidden;
}

.chat-wrapper {
  max-width: 740px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: 16px;
}

.chat-intro {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  scroll-behavior: smooth;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Bubbles */
.bubble-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.bubble-row.user { flex-direction: row-reverse; }

.bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.bubble-row.user .bubble-avatar { background: #64748b; }

.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.55;
  font-size: 14px;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-row.bot .bubble {
  background: var(--bubble-bot-bg);
  color: var(--bubble-bot-text);
  border-bottom-left-radius: 4px;
}

.bubble-row.user .bubble {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
}

.bubble-action-hint {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  cursor: pointer;
  text-decoration: underline;
}

.bubble-action-hint:hover { color: var(--accent-hover); }

/* Typing indicator */
.typing-dots span {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  margin: 0 2px;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Limit banner */
.limit-banner {
  text-align: center;
  padding: 10px 16px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  font-size: 14px;
  color: #92400e;
  margin: 8px 0;
}

/* Chat input */
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: var(--surface);
  transition: border-color 0.15s;
}

#chat-input:focus { border-color: var(--accent); }

#chat-send-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

#chat-send-btn:hover:not(:disabled) { background: var(--accent-hover); }
#chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-footer {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.modal-box h3 { font-size: 18px; margin-bottom: 10px; }

.ask-me-preview {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-box input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}

.modal-actions { display: flex; gap: 10px; }

/* ── Content pages ────────────────────────────────────────────────────────── */
.content-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
}

.content-wrapper h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.project-card:hover { box-shadow: var(--shadow-md); }

.project-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tag-text);
  background: var(--tag-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.project-card h3 { font-size: 17px; margin-bottom: 8px; }
.project-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }

.project-stack { display: flex; flex-wrap: wrap; gap: 6px; }

.project-stack span {
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 10px;
  color: var(--text-muted);
}

/* Bio */
.bio-layout {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.bio-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bio-text { flex: 1; min-width: 260px; }
.bio-text h2 { margin-bottom: 4px; }
.bio-tagline { color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.bio-text p { color: var(--text-muted); margin-bottom: 12px; font-size: 15px; }

.bio-skills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.bio-skills span {
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

/* Contact */
.contact-intro { color: var(--text-muted); margin-bottom: 28px; }

.contact-form { max-width: 520px; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }

.form-status {
  margin-top: 12px;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 8px;
}

.form-status.success { background: #dcfce7; color: #166534; }
.form-status.error { background: #fee2e2; color: #991b1b; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .header-inner { flex-direction: column; height: auto; padding: 10px 16px; gap: 8px; }
  header { height: auto; }
  .logo { font-size: 15px; }
  .tab-btn { padding: 5px 10px; font-size: 13px; }
  #tab-chat { height: calc(100vh - 120px - 48px); }
  .bubble { max-width: 88%; }
  .bio-layout { flex-direction: column; align-items: center; text-align: center; }
}

