:root {
  --bg: #0a0e17;
  --bg-soft: #0d1220;
  --surface: #131a29;
  --surface-2: #1a2338;
  --border: #232d45;
  --text: #eef1f8;
  --text-dim: #97a1ba;
  --text-faint: #5c657c;
  --cyan: #45e0d8;
  --blue: #5b8cff;
  --amber: #ffb454;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --container: 1180px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--text-dim); max-width: 62ch; }

a { color: inherit; text-decoration: none; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 12px 18px;
  z-index: 999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo-mark {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.logo-mark .dot { color: var(--cyan); }

.nav {
  display: flex;
  gap: 32px;
  margin-left: auto;
  margin-right: 32px;
}
.nav a {
  color: var(--text-dim);
  font-size: 0.95rem;
  transition: color 0.2s ease;
}
.nav a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  margin: 0 7px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #061019;
  font-weight: 600;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-outline {
  border-color: var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-ghost {
  border-color: var(--border);
  color: var(--text-dim);
  padding: 9px 18px;
  font-size: 0.9rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--cyan); }
.nav-cta { flex-shrink: 0; }

/* Hero */
.hero {
  position: relative;
  padding: 150px 0 100px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 180, 84, 0.15);
}

.hero h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  margin-bottom: 12px;
}

.hero-role {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--cyan);
  margin-bottom: 20px;
}

.hero-pitch {
  font-size: 1.05rem;
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 28px 0 32px;
}

.hero-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 0.88rem;
  color: var(--text-faint);
}
.hero-meta a { color: var(--text-faint); border-bottom: 1px solid transparent; }
.hero-meta a:hover { color: var(--cyan); border-color: var(--cyan); }

/* Hero code panel */
.hero-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}

.panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.panel-bar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.panel-title {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

.panel-code {
  margin: 0;
  padding: 22px 20px 26px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.85;
  overflow-x: auto;
}
.panel-code .k { color: var(--blue); }
.panel-code .s { color: var(--cyan); }
.panel-code .n { color: var(--amber); }
.panel-code .kw { color: var(--blue); font-weight: 500; }
.panel-code .cl { color: var(--amber); }
.panel-code .cm { color: var(--text-faint); font-style: italic; }

.code-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.code-tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.code-tab:hover { color: var(--text-dim); }
.code-tab.active {
  color: var(--cyan);
  background: var(--surface);
  border-color: var(--border);
}

.ln {
  display: block;
  opacity: 0;
  transform: translateY(4px);
  animation: lineIn 0.4s ease forwards;
  animation-delay: calc(var(--d) * 0.18s);
}
@keyframes lineIn {
  to { opacity: 1; transform: translateY(0); }
}
.cursor {
  display: inline-block;
  color: var(--cyan);
  animation: blink 1s step-end infinite;
  animation-delay: 1.9s;
}
@keyframes blink { 50% { opacity: 0; } }

/* Sections */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-lede { color: var(--text-dim); margin-top: -6px; margin-bottom: 40px; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 60px;
  align-items: start;
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.fact dd { margin: 0; font-weight: 600; font-size: 0.98rem; }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.skill-card h3 { font-size: 1.05rem; margin-bottom: 16px; }

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-list li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
}
.tag-list-mono li { color: var(--cyan); border-color: rgba(69, 224, 216, 0.25); background: rgba(69, 224, 216, 0.05); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.timeline-item { position: relative; padding-left: 34px; }
.timeline-marker {
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(69, 224, 216, 0.15);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 20px;
  bottom: -8px;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}
.timeline-head h3 { margin-bottom: 2px; font-size: 1.15rem; }
.timeline-date { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); }
.timeline-org { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 12px; }
.timeline-content ul { margin: 0; padding-left: 20px; color: var(--text-dim); }
.timeline-content li { margin-bottom: 6px; }
.timeline-content { padding-bottom: 36px; }

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(69, 224, 216, 0.4);
}
.project-card h3 { font-size: 1.1rem; margin-bottom: 10px; }
.project-card p { font-size: 0.92rem; margin-bottom: 16px; }

.projects-note {
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--text-faint);
}

/* Ripple / press feedback */
.btn, .chip, .code-tab, .project-card, .contact-card {
  position: relative;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  opacity: 0.6;
  pointer-events: none;
  animation: rippleAnim 0.55s ease-out forwards;
}
@keyframes rippleAnim {
  to { transform: scale(1); opacity: 0; }
}
.btn:active, .chip:active, .code-tab:active { transform: scale(0.96); }

/* Nav active state */
.nav a { position: relative; }
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--cyan);
  transition: width 0.25s ease;
}
.nav a:hover::after, .nav a.active::after { width: 100%; }
.nav a.active { color: var(--text); }

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.chip {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan);
  background: rgba(69, 224, 216, 0.06);
  border: 1px solid rgba(69, 224, 216, 0.25);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--cyan); background: rgba(69, 224, 216, 0.12); transform: translateY(-2px); }

/* SQL Console */
.sql-console {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: 0 30px 60px -25px rgba(0,0,0,0.55);
}
.sql-console .panel-bar { border-radius: var(--radius) var(--radius) 0 0; }

.sql-editor {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.sql-prompt {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 0.92rem;
  flex-shrink: 0;
}
.sql-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 8px 0;
}
.sql-input::placeholder { color: var(--text-faint); }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; flex-shrink: 0; }

.sql-suggestions {
  position: absolute;
  top: 100%;
  left: 18px;
  right: 18px;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  list-style: none;
  padding: 6px;
  z-index: 20;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.7);
}
.sql-suggestions li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.sql-suggestions li span.hint { color: var(--text-faint); font-size: 0.75rem; }
.sql-suggestions li:hover, .sql-suggestions li.active {
  background: rgba(69, 224, 216, 0.1);
  color: var(--cyan);
}

.sql-result {
  padding: 20px 18px 24px;
  min-height: 90px;
}
.sql-placeholder {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: 0;
}
.sql-message {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.sql-error {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #ff9a7b;
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.7;
}
.sql-loading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-faint);
}
.sql-loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  animation: dots 1s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.result-table-wrap { overflow-x: auto; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.result-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 500;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.result-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  animation: rowIn 0.35s ease forwards;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-table tr:last-child td { border-bottom: none; }

/* Stats band */
.stats-band { padding: 64px 0; }
.stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { font-size: 0.85rem; color: var(--text-dim); }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 60px;
  align-items: start;
}
.contact-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.contact-card:hover { border-color: var(--cyan); transform: translateY(-3px); }
.contact-card-static:hover { transform: none; border-color: var(--border); }
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: lowercase;
}
.contact-value { font-weight: 600; font-size: 0.98rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer-inner a { color: var(--text-faint); }
.footer-inner a:hover { color: var(--cyan); }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-panel { order: -1; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .stats-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav { display: none; }
  .nav-cta { display: none; }
  .nav-toggle { display: flex; }
  .site-header.open .nav {
    display: flex;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    gap: 18px;
  }
  .hero { padding: 120px 0 70px; }
  .skills-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .stats-inner { grid-template-columns: 1fr 1fr; }
  .contact-cards { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
}