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

:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #1c2128;
  --border:    #30363d;
  --accent:    #58a6ff;
  --accent2:   #3fb950;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --tag-bg:    #1f3040;
  --tag-color: #79c0ff;
  --radius:    8px;
  --font-mono: 'Courier New', Courier, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Typewriter cursor ── */
.cursor {
  display: inline-block;
  color: var(--accent2);
  font-weight: 100;
  animation: blink 1s step-end infinite;
  margin-left: 1px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Scroll fade-in ── */
.fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── About card ── */
.about-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.about-card p {
  font-size: 0.925rem;
  color: var(--muted);
  line-height: 1.7;
}

.about-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--accent2);
  margin-top: 0.25rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--accent2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent2); }
  50%       { opacity: 0.5; box-shadow: 0 0 12px var(--accent2); }
}

/* ── Skill bars ── */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text);
}

.bar-pct {
  color: var(--muted);
  font-family: var(--font-mono);
}

.bar-track {
  height: 5px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Layout ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
}

header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.contact {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.contact .sep {
  margin: 0 0.5rem;
  color: var(--muted);
}

/* ── Sections ── */
section {
  margin-bottom: 2.5rem;
}

section h2 {
  font-size: 1.15rem;
  font-family: var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.accent {
  color: var(--accent2);
  margin-right: 0.4rem;
}

/* ── Skill Cards ── */
.skill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.skill-card:hover {
  border-color: var(--accent);
}

.skill-icon {
  font-size: 1rem;
}

/* ── Timeline (Education) ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  align-items: start;
  transition: border-color 0.2s;
}

.timeline-item:hover {
  border-color: var(--accent);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  padding-top: 0.15rem;
}

.timeline-content h3 {
  font-size: 1rem;
  font-weight: 600;
}

.degree {
  font-size: 0.875rem;
  color: var(--accent2);
  margin-top: 0.1rem;
}

.degree-note {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 0.2rem;
}

/* ── Jobs ── */
.jobs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.job {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.2s;
}

.job:hover {
  border-color: var(--accent);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.job-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.job-title {
  font-size: 0.85rem;
  color: var(--accent2);
  margin-top: 0.1rem;
}

.job-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
  padding-top: 0.15rem;
}

.job ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.job ul li {
  margin-bottom: 0.2rem;
}

/* ── Projects ── */
.projects {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.2s;
}

.project:hover {
  border-color: var(--accent);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.project-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.project-sub {
  font-size: 0.8rem;
  color: var(--accent2);
  margin-top: 0.1rem;
}

.project p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.project code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--tag-color);
  background: var(--tag-bg);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

/* ── Tech Grid ── */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.tech-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.tech-block h4 {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.6rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  border: 1px solid #2d4a6a;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ── Download Button ── */
.header-actions {
  margin-top: 1rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.1rem;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.btn-download:hover {
  background: var(--accent);
  color: #0d1117;
  text-decoration: none;
}

.btn-download svg {
  width: 16px;
  height: 16px;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Chatbot Widget ── */
.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.chat-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(88, 166, 255, 0.6);
}

.chat-toggle svg {
  width: 26px;
  height: 26px;
}

.chat-window {
  width: 320px;
  height: 430px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  transform-origin: bottom right;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.25s;
}

.chat-window.hidden {
  transform: scale(0.85) translateY(8px);
  opacity: 0;
  pointer-events: none;
}

.chat-header {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.chat-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.chat-header p {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 0.1rem;
}

.chat-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  line-height: 1;
  font-size: 1.2rem;
  transition: color 0.2s;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-msg {
  max-width: 88%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-line;
}

.chat-msg.bot {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.chat-msg.user {
  background: var(--accent);
  color: #0d1117;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  font-weight: 500;
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--muted); }

.chat-send {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #0d1117;
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.chat-send:hover { background: #79c0ff; }
.chat-send:active { transform: scale(0.95); }

/* ── Responsive ── */
@media (max-width: 600px) {
  header h1 { font-size: 1.8rem; }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .job-header {
    flex-direction: column;
  }

  .tech-grid {
    grid-template-columns: 1fr;
  }
}
