:root {
  --bg: #1a1a2e;
  --bg-card: #26264a;
  --bg-input: #16162e;
  --border: #3a3a66;
  --text: #eaeaff;
  --text-muted: #8f8fcf;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --link: #8ab4ff;
}

body.light {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-input: #f0f0f0;
  --border: #ddd;
  --text: #1a1a2e;
  --text-muted: #555;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --link: #2563eb;
}

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

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-weight: 700;
}

.location {
  font-size: 0.9rem;
  opacity: 0.8;
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

section {
  margin-top: 3rem;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

h3 {
  margin-bottom: 0.25rem;
}

h4 {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

p {
  font-size: 0.95rem;
  opacity: 0.92;
}

a {
  color: var(--link);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tags span {
  background: var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* About */
.about-content {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.about-text {
  flex: 1;
}

.about-text p {
  margin-bottom: 0.75rem;
}

.about-avatar {
  text-align: center;
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 100px;
  height: 100px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.avatar-caption {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* Process */
.process-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.step {
  text-align: center;
  padding: 1rem;
}

.step-num {
  display: inline-block;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  line-height: 36px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step h3 {
  margin-bottom: 0.5rem;
}

/* Case Studies */
.case-study {
  padding: 1.5rem;
}

.case-field {
  margin-bottom: 0.75rem;
}

.case-field strong {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.case-field p {
  margin: 0;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

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

.skill-group h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.github-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 1rem;
}

/* CTA */
.cta {
  text-align: center;
  padding: 2rem 1rem;
}

.cta-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  text-decoration: none;
  display: inline-block;
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

footer {
  text-align: center;
  padding: 1.5rem;
  opacity: 0.7;
  font-size: 0.85rem;
}

/* Chat */
.chat {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 360px;
  max-width: calc(100vw - 2.5rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.chat-head button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}

.chat-body {
  height: 340px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.msg {
  max-width: 85%;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.msg.bot {
  align-self: flex-start;
  background: var(--border);
}

.msg.typing {
  opacity: 0.6;
  font-style: italic;
}

.order-panel {
  background: var(--border);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.order-panel p {
  margin: 0.2rem 0;
}

.order-panel .btn {
  margin-top: 0.6rem;
  width: 100%;
}

.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
}

.chat-input button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem 1rem;
}

/* Responsive */
@media (max-width: 600px) {
  .about-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .process-steps {
    grid-template-columns: 1fr;
  }
}