:root {
  --bg:           #1C1917;
  --bg-sidebar:   #231F1C;
  --bg-surface:   #2A2522;
  --bg-card:      #302B28;
  --bg-input:     #2A2522;
  --text:         #E8E3DD;
  --text-muted:   #9D9088;
  --text-faint:   #6B6058;
  --brand:        #D97757;
  --brand-dark:   #C4633F;
  --brand-glow:   rgba(217,119,87,0.15);
  --border:       #3A3430;
  --border-light: #2F2B28;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --radius:       0.75rem;
  --sidebar-w:    240px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

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

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-avatar {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 0.25rem;
  border-radius: 0.4rem;
  transition: color 0.15s;
}
.sidebar-toggle:hover { color: var(--text); background: var(--bg-surface); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 0.4rem 0.6rem 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 0.1rem;
}
.nav-item:hover { background: var(--bg-surface); color: var(--text); }
.nav-item.active { background: var(--brand-glow); color: var(--brand); }
.nav-item svg { flex-shrink: 0; opacity: 0.8; }

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.resume-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.resume-btn:hover {
  background: var(--brand-glow);
  color: var(--brand);
  border-color: var(--brand);
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* ── Pages ───────────────────────────────────────────────────────────────── */
.page {
  display: none;
  min-height: 100vh;
}
.page.active { display: block; }

.content-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.page-title {
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.lead-text {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.body-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* ── Home page ───────────────────────────────────────────────────────────── */
#page-home {
  display: none;
}
#page-home.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-wrap {
  width: 100%;
  max-width: 680px;
  padding: 2rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.home-hero { text-align: center; }

.home-avatar {
  width: 72px; height: 72px;
  background: var(--brand);
  border-radius: 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700; color: #fff;
  margin: 0 auto 1.25rem;
}

.home-name {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.home-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.9rem;
}

.home-tagline {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto 1.2rem;
}

.home-links {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.home-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.home-link-btn:hover {
  background: var(--brand-glow);
  color: var(--brand);
  border-color: var(--brand);
}

/* Home chat prompt */
.home-chat-prompt { width: 100%; }

.chat-prompt-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
}

.home-input-bar {
  margin-bottom: 0.75rem;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.suggestion-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.suggestion-chip:hover {
  background: var(--brand-glow);
  color: var(--brand);
  border-color: var(--brand);
}

/* ── Chat input bar (shared) ─────────────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input-bar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
}
.chat-input::placeholder { color: var(--text-faint); }

.send-btn {
  width: 34px; height: 34px;
  border-radius: 0.55rem;
  background: var(--brand);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover { background: var(--brand-dark); transform: scale(1.05); }
.send-btn:disabled { background: var(--bg-surface); color: var(--text-faint); transform: none; cursor: not-allowed; }

/* ── Chat page ───────────────────────────────────────────────────────────── */
#page-chat {
  display: none;
}
#page-chat.active {
  display: flex;
  flex-direction: column;
}

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.5rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.chat-messages {
  scrollbar-width: none;        
}
.chat-messages::-webkit-scrollbar {
  display: none;              
}

.chat-message.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.65;
  max-width: 560px;
  white-space: pre-wrap;
}

.user-bubble {
  background: var(--brand-glow);
  border-color: var(--brand);
  color: var(--text);
  border-radius: 0.8rem 0.8rem 0.15rem 0.8rem;
}

.chat-input-area {
  padding: 1rem 0 1.5rem;
}

.chat-footer-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

/* Typing dots */
.typing-dots span {
  display: inline-block;
  animation: blink 1.2s infinite;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--brand);
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* Spin animation for loading */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── About ───────────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 700px) { .about-grid { grid-template-columns: 1fr; } }

.focus-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--brand);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.card-degree {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.card-school {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-year {
  font-size: 0.82rem;
  color: var(--brand);
  margin-top: 0.25rem;
}

/* ── Timeline (Experience) ───────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.3rem; top: 0.4rem; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-dot {
  position: absolute;
  left: -1.25rem;
  top: 0.35rem;
  width: 0.8rem; height: 0.8rem;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.timeline-header { margin-bottom: 0.6rem; }

.exp-role {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.exp-company {
  display: block;
  font-size: 0.85rem;
  color: var(--brand);
  margin-top: 0.15rem;
}

.exp-points {
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}
.exp-points li { margin-bottom: 0.3rem; }

/* ── Projects ────────────────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 700px) { .projects-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--brand); }

.project-card.featured {
  border-color: var(--brand);
  background: linear-gradient(135deg, var(--bg-card), rgba(217,119,87,0.05));
  grid-column: 1 / -1;
}

.featured-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  background: var(--brand-glow);
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.25rem;
  width: fit-content;
}

.project-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.project-desc {
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 0.4rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0;
  width: fit-content;
  transition: opacity 0.15s;
}
.project-link:hover { opacity: 0.75; }

/* ── Skills ──────────────────────────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .skills-grid { grid-template-columns: 1fr; } }

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.skill-cat {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 0.6rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.skill-tags span {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: 0.45rem;
}

/* ── Contact ─────────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.contact-btn.primary {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}
.contact-btn.primary:hover { background: var(--brand-dark); }
.contact-btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.contact-btn.ghost:hover {
  background: var(--brand-glow);
  color: var(--brand);
  border-color: var(--brand);
}

.contact-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.contact-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  min-width: 60px;
}

.contact-value {
  font-size: 0.88rem;
  color: var(--brand);
  font-weight: 500;
  transition: opacity 0.15s;
}
.contact-value:hover { opacity: 0.75; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 200;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-muted);
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .main {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .home-wrap {
    padding-top: 4rem;
  }
  .content-wrap {
    padding-top: 4rem;
  }
  .chat-wrap {
    padding-top: 4rem;
  }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Achievements ────────────────────────────────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.achievement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.achievement-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.achievement-img-preview {
  display: block;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--bg);
}

.achievement-img-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.3s;
}

.achievement-card:hover .achievement-img-preview img {
  transform: scale(1.03);
}

.achievement-doc-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 200px;
  background: var(--bg);
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.achievement-doc-preview:hover {
  color: var(--accent);
}

.achievement-info {
  padding: 1rem;
}

.achievement-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.achievement-desc {
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.6;
}
