:root {
  --bg: #0F0E13;
  --surface: #17151D;
  --surface-2: #1E1B26;
  --violet: #7C3AED;
  --violet-light: #C4B5FD;
  --text: #F4F4F5;
  --text-muted: #A1A1AA;
  --border: #2A2733;
  --green: #4ADE80;
  --amber: #FBBF24;
  --red: #F87171;
  --max-width: 1140px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}

a { color: inherit; }

/* ---------- Nav ---------- */
.nav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(15,14,19,0.9);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.logo span { color: var(--violet-light); }
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}
.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* ---------- Sections shared ---------- */
section, .footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px;
}
.section-head { margin-bottom: 40px; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--violet-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.section-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
  max-width: 520px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 80px;
}
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
h1 .accent { color: var(--violet-light); }
.sub {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 460px;
  margin-bottom: 28px;
}
.ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.btn-primary {
  background: var(--violet);
  color: white;
  border: none;
  padding: 13px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 13px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  display: inline-block;
}

.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tdot { width: 10px; height: 10px; border-radius: 50%; }
.tdot.red { background: var(--red); }
.tdot.amber { background: var(--amber); }
.tdot.green { background: var(--green); }
.terminal-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}
.terminal-body {
  padding: 20px 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  min-height: 180px;
  white-space: pre-wrap;
}
.terminal-body .key { color: #93C5FD; }
.terminal-body .str { color: #86EFAC; }
.terminal-body .punct { color: var(--text-muted); }
.terminal-body .num { color: var(--amber); }

/* ---------- About ---------- */
.about-text-wrap {
  max-width: 680px;
  position: relative;
  transition: max-height 0.3s ease;
}
.about-text-wrap.collapsed {
  max-height: 130px;
  overflow: hidden;
}
.about-text-wrap.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.about-text { color: var(--text-muted); font-size: 15.5px; margin-bottom: 14px; }
.about-text:last-child { margin-bottom: 0; }
.about-toggle {
  background: none;
  border: none;
  color: var(--violet-light);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-top: 12px;
  text-decoration: underline;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.skill-card .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--violet-light);
  margin-bottom: 12px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 9px;
  border-radius: 6px;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.project-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16.5px;
  font-weight: 500;
}
.status-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.status-pill .pdot { width: 5px; height: 5px; border-radius: 50%; }
.status-live { background: rgba(74,222,128,0.12); color: var(--green); }
.status-live .pdot { background: var(--green); }
.status-build { background: rgba(251,191,36,0.12); color: var(--amber); }
.status-build .pdot { background: var(--amber); }
.project-desc { font-size: 13.5px; color: var(--text-muted); flex-grow: 1; }
.project-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.project-stack span { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--violet-light); }
.project-link {
  font-size: 13px;
  text-decoration: none;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Contact ---------- */
.contact-form { max-width: 480px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; color: var(--text-muted); }
.form-row input, .form-row textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 11px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  resize: vertical;
}
.form-row input:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.contact-form button { align-self: flex-start; }
.form-status { font-size: 13px; color: var(--violet-light); min-height: 18px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding-top: 32px;
  padding-bottom: 32px;
}

/* ---------- Chat bubble ---------- */
.chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--violet);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(124,58,237,0.35);
  cursor: pointer;
  z-index: 60;
}
.chat-bubble svg { width: 24px; height: 24px; }
.chat-hint {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  max-width: 220px;
  z-index: 60;
}
.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(340px, calc(100vw - 32px));
  max-height: 60vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
}
.chat-panel.open { display: flex; }
.chat-panel-head {
  background: var(--surface-2);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.chat-panel-head button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.chat-panel-body {
  padding: 16px;
  overflow-y: auto;
  font-size: 13.5px;
  /* Added: makes the body claim the space between header and footer
     instead of shrinking to fit its content, and lets overflow-y:auto
     actually kick in once messages stack up past the panel's height. */
  flex: 1;
  min-height: 0;
}
.chat-msg { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; max-width: 90%; }
.chat-msg.bot { background: var(--surface-2); color: var(--text-muted); }
/* Added: the visitor's own messages, styled distinctly from the bot's
   and pushed to the right (max-width already caps it below 100%, so
   margin-left: auto is enough to align it) so a conversation reads
   left/right the way chat UIs normally do. */
.chat-msg.user {
  background: var(--violet);
  color: white;
  margin-left: auto;
}

/* Added: the message input + send button row at the bottom of the
   chat panel -- didn't exist before since there was no way to type
   a message yet. Matches .form-row input's look and .btn-primary's
   violet, just sized down for the smaller panel. */
.chat-panel-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.chat-panel-footer input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.chat-panel-footer input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.chat-panel-footer button {
  background: var(--violet);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  section, .footer { padding: 48px 20px; }
  .hero { padding-top: 40px; padding-bottom: 56px; }
  h1 { font-size: 32px; }
  .skills-grid, .projects-grid { grid-template-columns: 1fr; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .chat-hint { display: none; }
  .chat-panel { right: 16px; bottom: 16px; }
  .chat-bubble { right: 16px; bottom: 16px; }
}