/* ===== Design tokens ===== */
:root {
  --bg: #0a0b0d;
  --surface: #131519;
  --surface-2: #191c21;
  --border: #262a31;
  --text: #e8eaed;
  --muted: #9aa0a8;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-ink: #04201b;

  --container: 1080px;
  --radius: 14px;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
}

/* ===== Base ===== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  background: var(--bg);
}

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

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}
.brand-dot { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.nav a {
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); }
.nav-cta {
  color: var(--accent) !important;
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 999px;
}
.nav-cta:hover, .nav-cta.active { border-color: var(--accent); }

/* Header solid state on scroll */
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  box-shadow: 0 6px 24px -16px rgba(0,0,0,0.9);
}

.nav-toggle, .nav-burger { display: none; }
.nav-burger {
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
}
.nav-burger span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 1.25rem;
}
.lead {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 46ch;
  margin: 0 0 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.hero-socials {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  padding: 0;
  margin: 2.25rem 0 0;
}
.hero-socials a {
  font-size: 0.9rem;
  color: var(--muted);
  position: relative;
}
.hero-socials a:hover { color: var(--accent); }

.hero-portrait {
  position: relative;
  justify-self: center;
}
.hero-portrait img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: cover;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8);
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: auto -14px -14px auto;
  width: 60%;
  height: 60%;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  z-index: -1;
  opacity: 0.4;
}

/* ===== Sections ===== */
.section { padding-block: clamp(3rem, 7vw, 5rem); }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}
.section-num {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.section-link, .section-head .section-link {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--accent);
}
.section-link:hover { text-decoration: underline; }

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 3rem;
}
.about-body p { color: var(--muted); margin-top: 0; }
.about-body p + p { margin-bottom: 0; }
.about-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  align-content: start;
}
.about-facts li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.fact-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.fact-label { color: var(--muted); font-size: 0.95rem; }

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.skill-card h3 { font-size: 1.15rem; margin-bottom: 1rem; }
.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-list li {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}
.tag-list.small li { font-size: 0.78rem; padding: 0.25rem 0.65rem; }

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.project-media { aspect-ratio: 16 / 10; overflow: hidden; }
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-media.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  text-align: center;
  padding: 1rem;
}
.project-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.project-body h3 { font-size: 1.15rem; }
.project-body p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.project-links { display: flex; gap: 1.25rem; margin-top: auto; padding-top: 0.5rem; }
.project-links a { font-size: 0.88rem; color: var(--accent); font-weight: 500; }
.project-links a:hover { text-decoration: underline; }

/* ===== Credentials ===== */
.credentials-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.cred-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.cred-list li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.cred-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== Experience timeline ===== */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 1.25rem;
  padding-bottom: 2rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.timeline-content h3 { font-size: 1.15rem; }
.timeline-date { color: var(--accent); font-size: 0.85rem; font-weight: 500; }
.timeline-org { color: var(--text); font-weight: 500; margin: 0.25rem 0 0.5rem; }
.timeline-content p:last-child { color: var(--muted); margin: 0; }

/* ===== Blog ===== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}
.blog-card:hover { border-color: var(--accent); }
.blog-card time { color: var(--muted); font-size: 0.82rem; }
.blog-card h3 { font-size: 1.15rem; }
.blog-card h3 a:hover { color: var(--accent); }
.blog-card p { color: var(--muted); font-size: 0.95rem; margin: 0; flex: 1; }
.read-more { color: var(--accent); font-size: 0.88rem; font-weight: 500; }

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 3rem;
}
.contact-intro h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1rem; }
.contact-intro p { color: var(--muted); margin: 0 0 1.5rem; max-width: 40ch; }
.contact-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.contact-links a { color: var(--text); }
.contact-links a:hover { color: var(--accent); }
.contact-loc { color: var(--muted); }

.contact-form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.88rem; color: var(--muted); }
.field input,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }
.contact-form .btn { justify-self: start; }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block: 2rem;
}
.footer-inner p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.heart { color: var(--accent); }
.back-top { font-size: 0.9rem; color: var(--accent); }
.back-top:hover { text-decoration: underline; }

/* ===== Scroll reveal (only when JS is active) ===== */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
/* Stagger children when a container reveals */
.js [data-reveal][data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js [data-reveal][data-reveal-stagger].is-visible > * { opacity: 1; transform: none; }
.js [data-reveal][data-reveal-stagger].is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.js [data-reveal][data-reveal-stagger].is-visible > *:nth-child(3) { transition-delay: 0.16s; }
.js [data-reveal][data-reveal-stagger].is-visible > *:nth-child(4) { transition-delay: 0.24s; }

/* ===== Form status ===== */
.form-status {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0;
  min-height: 1.2em;
}
.form-status.is-error { color: #ff6b6b; }
.contact-form button[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .nav-burger { display: flex; }
  .nav {
    position: fixed;
    inset: 72px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav a { padding: 0.75rem 0; width: 100%; }
  .nav-cta { margin-top: 0.5rem; }
  .nav-toggle:checked ~ .nav { max-height: 360px; }

  .hero { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; }
  .hero-portrait img { width: 240px; height: 300px; }
  .hero-portrait::after { display: none; }

  .about-grid,
  .skills-grid,
  .projects-grid,
  .credentials-grid,
  .blog-grid,
  .contact-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
