:root {
  --bg: #0a0d12;
  --bg-alt: #0e1319;
  --surface: #131a22;
  --surface-glass: rgba(255, 255, 255, 0.035);
  --surface-glass-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef3f4;
  --text-dim: #9fb0b8;
  --accent: #5ff2c0;
  --accent-2: #5f9bf2;
  --accent-dim: #2f8f6f;
  --gradient-primary: linear-gradient(135deg, var(--accent), var(--accent-2));
  --shadow-card: 0 24px 60px -28px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 0 1px var(--border), 0 20px 50px -24px rgba(95, 242, 192, 0.25);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --max-w: 980px;
  --blur: blur(18px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient background: faint grid + slow-drifting gradient blobs */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(95, 242, 192, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 242, 192, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.22;
  animation: drift 26s ease-in-out infinite alternate;
}

.bg-blobs span:nth-child(1) {
  width: 46vw;
  height: 46vw;
  top: -14vw;
  left: -10vw;
  background: var(--accent);
}

.bg-blobs span:nth-child(2) {
  width: 38vw;
  height: 38vw;
  top: 10vh;
  right: -12vw;
  background: var(--accent-2);
  animation-delay: -8s;
  animation-duration: 32s;
}

.bg-blobs span:nth-child(3) {
  width: 30vw;
  height: 30vw;
  bottom: -10vw;
  left: 20vw;
  background: var(--accent-2);
  opacity: 0.14;
  animation-delay: -16s;
  animation-duration: 30s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4%, 6%) scale(1.08); }
}

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

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

.icon {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #08110d;
  font-family: var(--mono);
  font-weight: 600;
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 20;
  background: transparent;
}

.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* Top nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.5rem;
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}

.topnav nav {
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 242, 192, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

.topnav nav ul {
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.topnav nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dim);
  padding: 0.2rem 0;
  transition: color 0.15s ease;
}

.topnav nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3rem;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
}

.topnav nav a:hover { color: var(--text); }

.topnav nav a.active {
  color: var(--accent);
}

.topnav nav a.active::after {
  transform: scaleX(1);
}

/* Layout helpers */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

.section {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.section-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0 0 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-left: auto;
}

/* Hero */
.hero {
  padding: 7.5rem 0 5rem;
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  color: var(--accent);
  margin: 0 0 1.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-glass);
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 4.2rem);
  margin: 0 0 0.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero h1 .grad {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  color: var(--text-dim);
  font-size: 1.2rem;
  margin: 0 0 1.5rem;
  font-weight: 500;
}

.hero-lead {
  max-width: 62ch;
  color: var(--text-dim);
  font-size: 1.05rem;
  margin: 0 0 2.25rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.8rem 1.4rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #06110c;
  border-color: transparent;
  box-shadow: 0 14px 30px -14px rgba(95, 242, 192, 0.55);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -14px rgba(95, 242, 192, 0.7); }

.btn-ghost {
  color: var(--text);
  background: var(--surface-glass);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  background: var(--surface-glass-strong);
}

/* Hero stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.stat-number {
  display: block;
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.hero-badges {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 2.75rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface-glass);
}

.hero-badge .icon { color: var(--accent); }

.hero-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.pillar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pillar:hover {
  transform: translateY(-3px);
  border-color: var(--accent-dim);
  color: var(--text);
}

.pillar .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  background: var(--surface-glass-strong);
  color: var(--accent);
  font-size: 1.05rem;
}

/* About */
.about-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-text {
  color: var(--text-dim);
  max-width: 68ch;
  margin: 0 0 1.1rem;
}

.about-graphic {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.about-graphic svg { width: 100%; height: auto; max-width: 260px; }

.about-graphic-svg { color: var(--accent-dim); }

.extra-note {
  margin-top: 2rem;
  font-size: 0.95rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent-dim);
  border-radius: 0 12px 12px 0;
  background: var(--surface-glass);
  color: var(--text-dim) !important;
  max-width: none !important;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2.4rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 1.05rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: linear-gradient(var(--border-strong), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.6rem;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -2.4rem;
  top: -0.1rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1rem;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--border);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.timeline-content h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.timeline-content .at {
  color: var(--accent);
  font-weight: 500;
}

.timeline-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.timeline-domain {
  display: inline-block;
  margin: 0.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-2);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
}

.timeline-content p {
  color: var(--text-dim);
  margin: 0.6rem 0 0;
  max-width: 62ch;
}

.mini-list {
  margin-top: 0.8rem;
}

.mini-list li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.mini-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Case study callout */
.case-study {
  margin-top: 1.1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent-dim);
  background: var(--surface-glass);
  border-radius: 0 12px 12px 0;
}

.case-study-item {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  color: var(--text-dim);
  max-width: 62ch;
}

.case-study-item:last-child { margin-bottom: 0; }

.case-study-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.project-card {
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
}

.project-card-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--surface-glass-strong);
  color: var(--accent);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.project-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.project-card p {
  color: var(--text-dim);
  margin: 0;
  font-size: 0.92rem;
}

.project-stat {
  display: inline-flex;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--accent);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-glass-strong);
  border: 1px solid var(--border);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

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

.inline-link {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.15s ease;
}

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

/* Skills */
.skills-group {
  margin-bottom: 1.5rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-glass);
}

.skills-group:last-child { margin-bottom: 0; }

.skills-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 1.2rem;
}

.skills-heading .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  background: var(--surface-glass-strong);
  color: var(--accent);
  font-size: 1rem;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bar-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gradient-primary);
  box-shadow: 0 0 12px rgba(95, 242, 192, 0.5);
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-fill.filled { width: var(--fill, 0%); }

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--bg-alt);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

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

.cert-badge {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.cert-badge:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.cert-badge .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--surface-glass-strong);
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cert-badge span:last-child {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Contact */
.contact-card {
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.contact-lead {
  margin: 0;
}

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

.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* Reveal-on-scroll (progressive enhancement: content is visible by default,
   and only hidden-then-animated-in once JS confirms it's running) */
html.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--stagger, 0) * 70ms);
}

html.js .reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 860px) {
  .about-layout { grid-template-columns: 1fr; }
  .about-graphic { order: -1; max-width: 180px; margin: 0 auto 1rem; }
}

@media (max-width: 640px) {
  .topnav { padding: 1rem 1.1rem; }
  .brand { flex-shrink: 0; }
  .topnav nav ul { gap: 0.8rem; font-size: 0.72rem; }
  .topnav nav { mask-image: linear-gradient(to right, black 85%, transparent 100%); }
  .section { padding: 4rem 0; }
  .hero { padding: 5.5rem 0 3.5rem; }
  .timeline-head { flex-direction: column; align-items: flex-start; }
  .contact-card { padding: 1.75rem 1.25rem; }
  .section-title { font-size: 1.3rem; gap: 0.65rem; }
  .section-icon { width: 2.2rem; height: 2.2rem; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal,
  .bar-fill,
  .btn,
  .stat-card,
  .pillar,
  .project-card,
  .cert-badge {
    transition: none !important;
  }
  .brand .dot, .eyebrow .dot, .bg-blobs span { animation: none !important; }
}

/* Print / save-as-PDF: readable on paper regardless of scroll/animation state.
   Redefine the theme tokens rather than patching each selector, so every
   component that reads var(--text)/var(--text-dim)/etc. inherits correct
   light-mode contrast automatically. */
@media print {
  :root {
    --bg: #fff;
    --bg-alt: #fff;
    --surface: #fff;
    --surface-glass: #fff;
    --surface-glass-strong: #f3f3f3;
    --border: #ccc;
    --border-strong: #999;
    --text: #111;
    --text-dim: #333;
    --accent: #111;
    --accent-2: #444;
    --accent-dim: #666;
    --shadow-card: none;
    --shadow-glow: none;
  }

  .bg-grid, .bg-blobs, .topnav, .skip-link, .hero-actions, .hero-pillars,
  .site-footer, .scroll-progress {
    display: none;
  }

  body { background: #fff; }

  a { text-decoration: underline; }

  html.js .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .bar-fill {
    width: var(--fill, 0%) !important;
    transition: none !important;
    box-shadow: none !important;
  }

  .section { padding: 1.25rem 0; }

  .btn-primary { background: #fff; }

  .timeline-marker { box-shadow: none; }

  *, .stat-card, .pillar, .project-card, .cert-badge, .skills-group, .eyebrow {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .timeline-item,
  .project-card,
  .case-study,
  .skills-group,
  .cert-badge,
  .stat-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
