/* ═══════════════════════════════════════════════════════════════
   n0ko Portfolio — Style Guide Implementation
   Derived from server-room-dark.jpg hero banner
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* -- Background Scale (dark corridor floors -> ceiling) -- */
  --bg-void:        #050810;
  --bg-primary:     #0A0E17;
  --bg-secondary:   #0F1420;
  --bg-tertiary:    #151B2B;
  --bg-surface:     #1A2332;

  /* -- Cyan Accent (ceiling LED strips) -- */
  --cyan-400:       #00D4FF;
  --cyan-500:       #00B8DB;
  --cyan-600:       #0097B2;
  --cyan-glow:      rgba(0, 212, 255, 0.25);
  --cyan-glow-strong: rgba(0, 212, 255, 0.45);

  /* -- Red Accent (rack status LEDs) -- */
  --red-500:        #CC2936;
  --red-600:        #A3212B;
  --red-glow:       rgba(204, 41, 54, 0.20);

  /* -- Green Signal (status indicators) -- */
  --green-500:      #00FF9F;
  --green-glow:     rgba(0, 255, 159, 0.20);

  /* -- Text Scale -- */
  --text-primary:   #E8ECF1;
  --text-secondary: #8B95A8;
  --text-muted:     #4E5972;
  --text-on-cyan:   #050810;

  /* -- Borders -- */
  --border-subtle:  #1C2436;
  --border-hover:   #00D4FF33;
  --border-focus:   #00D4FF;

  /* -- Shadows -- */
  --shadow-card:    0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-cyan:    0 0 20px var(--cyan-glow), 0 0 60px rgba(0, 212, 255, 0.10);

  /* -- Typography -- */
  --font-mono:  'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* -- Spacing Scale (8px base) -- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-8);
}

/* ── Navigation ── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--cyan-400);
  text-shadow: 0 0 12px var(--cyan-glow);
}

.logo-tld {
  color: var(--text-muted);
  font-weight: 500;
  text-shadow: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cyan-400);
}

.nav-links a.active {
  border-bottom: 2px solid var(--cyan-400);
  padding-bottom: 2px;
}

/* ── Hero Section ── */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background: url('/static/images/server-room-dark.webp') center center / cover no-repeat;
  z-index: 0;
}

/* Fallback for browsers without WebP */
.no-webp .hero-backdrop {
  background-image: url('/static/images/server-room-dark.jpg');
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg,
      rgba(5, 8, 16, 0.92) 0%,
      rgba(5, 8, 16, 0.75) 40%,
      rgba(5, 8, 16, 0.45) 70%,
      rgba(5, 8, 16, 0.30) 100%
    ),
    linear-gradient(180deg,
      transparent 60%,
      var(--bg-void) 100%
    );
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  padding: var(--space-8);
}

.hero-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5rem);
  letter-spacing: -0.04em;
  color: var(--cyan-400);
  text-shadow:
    0 0 20px var(--cyan-glow-strong),
    0 0 60px rgba(0, 212, 255, 0.15);
  margin-bottom: var(--space-4);
}

/* n0ko retained as the personal alias beneath the nkt-labs mark */
.hero-byline {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: calc(var(--space-2) * -1);
  margin-bottom: var(--space-4);
}

.hero-byline .prompt {
  color: var(--cyan-400);
}

.hero-byline strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.hero-description {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
}

/* ── Buttons ── */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--cyan-400);
  color: var(--text-on-cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.btn-primary:hover {
  background: var(--cyan-500);
  box-shadow: 0 0 24px var(--cyan-glow-strong);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--cyan-400);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  border-color: var(--cyan-400);
  color: var(--text-primary);
}

/* ── Sections ── */
.section {
  background: var(--bg-void);
  padding: var(--space-24) 0;
  border-top: 1px solid var(--border-subtle);
}

.section:nth-of-type(even) {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 60%),
    var(--bg-void);
}

.section-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
}

.section-title .prompt {
  color: var(--cyan-400);
}

/* Scroll reveal */
.section[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section[data-reveal].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Services (nkt-labs offerings) ── */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

.service-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: var(--space-8);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.service-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}

.service-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.service-slug {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--cyan-400);
  letter-spacing: -0.01em;
}

.service-lede {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 70ch;
  margin-bottom: var(--space-6);
}

.service-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 720px) {
  .service-cols { grid-template-columns: 1fr 1fr; }
}

.service-col h4 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.service-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.service-col li {
  position: relative;
  padding-left: var(--space-4);
  margin-bottom: var(--space-3);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.service-col li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--cyan-600);
}

.service-col li strong {
  color: var(--text-primary);
  font-weight: 600;
}

.service-foot {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── About ── */
.about-content {
  max-width: 640px;
}

.about-content p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-4);
}

.about-content .philosophy {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--cyan-400);
  letter-spacing: 0.02em;
  margin-top: var(--space-4);
}

/* ── Projects Grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
}

.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.75rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card:hover {
  border-color: var(--cyan-400);
  box-shadow: var(--shadow-card), 0 0 30px var(--cyan-glow);
  transform: translateY(-2px);
}

/* icarus — flagship in-house project, marked ahead of the open-source release */
.project-card--featured {
  border-color: var(--border-hover);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.08);
}

.project-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--cyan-400);
}

.project-card h3 {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.project-card p {
  font-family: var(--font-sans);
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.project-github-link {
  display: block;
  font-size: 0.8rem;
  color: var(--cyan-400);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.project-card:hover .project-github-link {
  opacity: 1;
}

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

.tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(0, 212, 255, 0.08);
  color: var(--cyan-400);
  border: 1px solid rgba(0, 212, 255, 0.15);
}

/* ── Contact ── */
.contact-content {
  max-width: 480px;
}

.contact-content p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  gap: 1rem;
}

.contact-link {
  color: var(--cyan-400);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 500;
  transition: color 0.2s ease;
}

.contact-link:hover {
  color: var(--text-primary);
}

/* ── Footer ── */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  background: var(--bg-tertiary);
}

.footer p {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.footer .tagline {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: var(--space-2);
  font-style: italic;
}

.footer-alias {
  color: var(--cyan-600);
}

/* ── Code Blocks ── */
pre, code {
  font-family: var(--font-mono);
}

code {
  background: var(--bg-primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--cyan-400);
}

pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

/* ── Tech Stack Grid ── */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
}

.stack-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.stack-item:hover {
  border-color: var(--cyan-400);
  box-shadow: 0 0 20px var(--cyan-glow);
  transform: translateY(-2px);
}

.stack-icon {
  font-size: 1.75rem;
  color: var(--cyan-400);
  margin-bottom: 0.5rem;
}

.stack-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ── Highlight Section ── */
.highlight-section {
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.03) 0%, transparent 100%);
  border-top: 1px solid rgba(0, 212, 255, 0.15);
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
  padding: var(--space-12) 0;
  margin-bottom: var(--space-8);
}

.highlight-section .section-title,
#case-study .section-title {
  margin-bottom: var(--space-3);
}

/* ── Case Study ── */
.case-study-content {
  max-width: 900px;
}

.case-study-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-6);
}

.case-study-title {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  line-height: 1.4;
}

.case-study-role {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.case-study-role strong {
  color: var(--cyan-400);
}

.case-study-desc {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-8);
}

.case-study-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.result-card:hover {
  border-color: var(--cyan-400);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.result-value {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--cyan-400);
  text-shadow: 0 0 12px var(--cyan-glow);
  margin-bottom: 0.25rem;
}

.result-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.result-detail {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.case-study-quote {
  border-left: 3px solid var(--cyan-400);
  padding: 1rem 1.5rem;
  margin: 0;
  background: rgba(0, 212, 255, 0.03);
  border-radius: 0 6px 6px 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Resume ── */
.resume-content {
  max-width: 640px;
}

.resume-summary {
  margin-bottom: var(--space-8);
}

.resume-summary p {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.resume-cta {
  display: flex;
  gap: 1rem;
}

/* ── GitHub Activity ── */
.github-activity {
  max-width: 720px;
}

.github-chart {
  width: 100%;
  max-width: 720px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  background: var(--bg-secondary);
  margin-bottom: var(--space-6);
}

/* ── Articles Grid ── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
}

.article-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.article-card:hover {
  border-color: var(--cyan-400);
  box-shadow: var(--shadow-card), 0 0 30px var(--cyan-glow);
  transform: translateY(-2px);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-meta .article-source {
  color: var(--cyan-400);
  font-weight: 600;
  opacity: 0.85;
}

.article-card h3 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}

.article-card p {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-2);
}

.article-read-more {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan-400);
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.article-card:hover .article-read-more {
  opacity: 1;
}

.github-link {
  display: flex;
}

/* ── 404 Page ── */
.not-found {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-24) 0;
}

.not-found-content {
  text-align: center;
  max-width: 520px;
}

.not-found-code {
  font-family: var(--font-mono);
  font-size: clamp(5rem, 15vw, 10rem);
  font-weight: 700;
  color: var(--cyan-400);
  text-shadow:
    0 0 20px var(--cyan-glow-strong),
    0 0 60px rgba(0, 212, 255, 0.15);
  line-height: 1;
  margin-bottom: var(--space-8);
}

.not-found-terminal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: left;
  margin-bottom: var(--space-8);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.not-found-terminal p {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.not-found-terminal p:last-child {
  margin-bottom: 0;
}

.not-found-error {
  color: var(--red-500) !important;
}

.cursor-blink {
  color: var(--cyan-400);
  animation: blink 1s step-end infinite;
}

.not-found-message {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

/* ── Focus Ring ── */
*:focus-visible {
  outline: 2px solid var(--cyan-400);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   Chat Widget
   ═══════════════════════════════════════════════════════════════ */

.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
}

.chat-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cyan-400);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--cyan-glow);
  transition: all 0.3s ease;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px var(--cyan-glow-strong);
}

.chat-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-on-cyan);
}

.chat-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cyan-400);
  font-family: var(--font-mono);
  text-shadow: 0 0 8px var(--cyan-glow);
  margin-top: 0.35rem;
  pointer-events: none;
  white-space: nowrap;
  width: max-content;
  transform: translateX(calc(-50% + 24px));
}

.chat-widget.active .chat-label {
  display: none;
}

.chat-container {
  position: absolute;
  bottom: 58px;
  right: 0;
  width: 300px;
  height: 987px;
  max-height: calc(100vh - 120px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-elevated);
}

.chat-header {
  padding: 0.65rem 0.85rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cyan-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  color: var(--text-on-cyan);
}

.chat-title {
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--green-500);
}

.status-dot.offline {
  background: var(--red-500);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-message {
  max-width: 85%;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-message.error {
  align-self: center;
}

.message-content {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  word-wrap: break-word;
  font-family: var(--font-sans);
}

/* Scope list in the opening welcome card */
.chat-scope {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.chat-scope li {
  position: relative;
  padding-left: 0.85rem;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.chat-scope li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--cyan-400);
}

.chat-message.user .message-content {
  background: var(--cyan-400);
  color: var(--text-on-cyan);
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.chat-message.error .message-content {
  background: rgba(204, 41, 54, 0.1);
  color: var(--red-500);
  border: 1px solid rgba(204, 41, 54, 0.3);
  font-size: 0.75rem;
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.82em;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 0.35rem 0;
}

.message-content pre code {
  background: none;
  padding: 0;
}

.thinking-dots span {
  animation: blink 1.4s infinite;
  font-size: 1.2rem;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

.thinking-text {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.75rem;
}

.tool-info {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tool-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chat-input-container {
  padding: 0.65rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 34px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  border-color: var(--cyan-400);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.chat-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 6px;
  background: var(--cyan-400);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-send:hover {
  transform: scale(1.05);
  background: var(--cyan-500);
}

.chat-send svg {
  width: 14px;
  height: 14px;
  color: var(--text-on-cyan);
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */

/* Mobile: < 768px */
@media (max-width: 767px) {
  .container {
    padding: 0 var(--space-6);
  }

  .nav-links {
    gap: 1.5rem;
  }

  .hero {
    min-height: 70vh;
  }

  .hero-backdrop {
    background-position: 65% center;
  }

  .hero-overlay {
    background:
      linear-gradient(90deg,
        rgba(5, 8, 16, 0.95) 0%,
        rgba(5, 8, 16, 0.85) 50%,
        rgba(5, 8, 16, 0.60) 100%
      ),
      linear-gradient(180deg,
        transparent 60%,
        var(--bg-void) 100%
      );
  }

  .hero-cta {
    flex-direction: column;
  }

  .section {
    padding: var(--space-16) 0;
  }

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

  .stack-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }

  .stack-item {
    padding: 0.75rem;
  }

  .stack-icon {
    font-size: 1.25rem;
  }

  .stack-name {
    font-size: 0.7rem;
  }

  .case-study-results {
    grid-template-columns: repeat(2, 1fr);
  }

  .case-study-title {
    font-size: 1.15rem;
  }

  .result-value {
    font-size: 2rem;
  }

  .github-chart {
    padding: 0.5rem;
  }

  .nav-links {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    white-space: nowrap;
    font-size: 0.78rem;
  }

  .chat-widget {
    bottom: 0.75rem;
    right: 0.75rem;
  }

  .chat-toggle {
    width: 44px;
    height: 44px;
  }

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

  .chat-label {
    font-size: 0.8rem;
    transform: translateX(calc(-50% + 22px));
  }

  .chat-container {
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 80px);
    max-height: 500px;
    right: 0;
    bottom: 54px;
    border-radius: 10px;
  }

  .chat-header {
    padding: 0.5rem 0.65rem;
  }

  .chat-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .chat-title {
    font-size: 0.8rem;
  }

  .chat-status {
    font-size: 0.68rem;
  }

  .chat-messages {
    padding: 0.5rem;
    gap: 0.4rem;
  }

  .message-content {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .chat-input-container {
    padding: 0.5rem;
    gap: 0.4rem;
  }

  .chat-input {
    padding: 0.45rem 0.6rem;
    font-size: 0.76rem;
    min-height: 44px;
  }

  .chat-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .chat-send svg {
    width: 16px;
    height: 16px;
  }
}

/* Tablet: 768px - 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .chat-container {
    width: 280px;
    height: 550px;
    max-height: calc(100vh - 100px);
    bottom: 58px;
  }

  .chat-toggle {
    width: 46px;
    height: 46px;
  }

  .chat-send {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .chat-send svg {
    width: 15px;
    height: 15px;
  }

  .message-content {
    font-size: 0.78rem;
  }

  .chat-input {
    font-size: 0.78rem;
    min-height: 36px;
  }
}

/* Wide: > 1440px */
@media (min-width: 1441px) {
  .chat-container {
    width: 340px;
    height: 1100px;
    max-height: calc(100vh - 120px);
  }

  .chat-toggle {
    width: 52px;
    height: 52px;
  }

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

  .chat-label {
    font-size: 0.95rem;
    transform: translateX(calc(-50% + 26px));
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .chat-title {
    font-size: 0.9rem;
  }

  .chat-status {
    font-size: 0.72rem;
  }

  .message-content {
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
  }

  .chat-input {
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    min-height: 38px;
  }

  .chat-send {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .chat-send svg {
    width: 16px;
    height: 16px;
  }

  .chat-input-container {
    padding: 0.75rem;
    gap: 0.6rem;
  }

  .chat-messages {
    padding: 0.75rem;
    gap: 0.6rem;
  }
}
