:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1a1a1f;
  --text-muted: #5a5f6b;
  --accent: #3457d5;
  --accent-contrast: #ffffff;
  --border: #e2e4ea;
  --chip-bg: #eef0f7;
  --shadow: 0 4px 20px rgba(20, 20, 30, 0.08);
  --radius: 12px;
  --max-width: 860px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a;
    --bg-alt: #191b24;
    --text: #eef0f5;
    --text-muted: #a2a6b5;
    --accent: #7c93ff;
    --accent-contrast: #0d0e14;
    --border: #2a2d3a;
    --chip-bg: #1f2230;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

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

.site-header {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }

.nav-links { display: flex; gap: 18px; flex-wrap: wrap; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.hero {
  padding: 64px 20px 40px;
  text-align: center;
}

.hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.hero h1 { font-size: 2.4rem; margin: 0 0 6px; }
.hero-title { font-size: 1.2rem; color: var(--accent); margin: 0 0 10px; font-weight: 600; }
.hero-tagline { color: var(--text-muted); max-width: 560px; margin: 0 auto; }

.hero-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-links a, .contact-link {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text);
}
.hero-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.section { padding: 44px 20px; border-top: 1px solid var(--border); }
.section h2 { font-size: 1.5rem; margin-bottom: 18px; }

.stack { display: flex; flex-direction: column; gap: 22px; }

.exp-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.exp-item h3 { margin: 0 0 2px; font-size: 1.05rem; }
.exp-item .exp-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
.exp-item ul { margin: 8px 0 0; padding-left: 20px; }
.exp-item li { margin-bottom: 4px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.project-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.project-card p { margin: 0 0 10px; color: var(--text-muted); font-size: 0.95rem; }
.project-card .chip-row { margin-top: 8px; }

.site-footer {
  padding: 30px 20px 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Chatbot widget */
#chatbot-root { position: fixed; bottom: 0; right: 0; z-index: 50; }

.chat-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 22px;
  width: min(340px, calc(100vw - 44px));
  max-height: min(480px, calc(100vh - 140px));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-header button {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.92rem;
}

.chat-msg { max-width: 85%; padding: 8px 12px; border-radius: 10px; }
.chat-msg.bot { background: var(--bg-alt); align-self: flex-start; }
.chat-msg.user { background: var(--accent); color: var(--accent-contrast); align-self: flex-end; }

.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  border: none;
  padding: 12px 14px;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
}
.chat-input-row input:focus { outline: none; }
.chat-input-row button {
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.9rem; }
  .nav-links { gap: 12px; }
}
