/* ---------- Design tokens ---------- */
:root {
  --color-bg: #0a0f1d;
  --color-bg-alt: #0e1526;
  --color-surface: #131f38;
  --color-surface-2: #17233f;
  --color-border: #223256;
  --color-text: #e8edf6;
  --color-text-muted: #9fb0cc;
  --color-accent: #5b8def;
  --color-accent-strong: #8b7ff5;
  --color-accent-2: #35c9c1;
  --color-accent-contrast: #071022;
  --color-status-progress-bg: #2c2410;
  --color-status-progress-text: #e8c766;
  --gradient-accent: linear-gradient(120deg, #5b8def 0%, #8b7ff5 55%, #35c9c1 100%);

  --font-heading: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: 3.5rem;
  --space-6: 5.5rem;

  --radius: 12px;
  --radius-lg: 18px;
  --max-width: 68rem;
  --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 20px 45px -16px rgba(91, 141, 239, 0.35);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg: #f5f7fb;
    --color-bg-alt: #eceff6;
    --color-surface: #ffffff;
    --color-surface-2: #f2f5fb;
    --color-border: #dbe2f0;
    --color-text: #10192e;
    --color-text-muted: #4b5872;
    --color-accent: #3763c9;
    --color-accent-strong: #6a4fd6;
    --color-accent-2: #128f88;
    --color-accent-contrast: #ffffff;
    --color-status-progress-bg: #fdf1cf;
    --color-status-progress-text: #7a5a09;
    --gradient-accent: linear-gradient(120deg, #3763c9 0%, #6a4fd6 55%, #128f88 100%);
    --shadow-card: 0 10px 30px -14px rgba(20, 30, 60, 0.25);
    --shadow-card-hover: 0 22px 40px -18px rgba(55, 99, 201, 0.28);
    color-scheme: light;
  }
}

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

html {
  scroll-behavior: smooth;
  font-size: 112.5%;
}

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

/* ---------- Background decor ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: drift 22s ease-in-out infinite alternate;
}

.blob-a {
  width: 32rem;
  height: 32rem;
  top: -12rem;
  left: -8rem;
  background: var(--color-accent);
}

.blob-b {
  width: 26rem;
  height: 26rem;
  top: 30vh;
  right: -10rem;
  background: var(--color-accent-strong);
  animation-delay: -7s;
}

.blob-c {
  width: 24rem;
  height: 24rem;
  bottom: -10rem;
  left: 20vw;
  background: var(--color-accent-2);
  animation-delay: -14s;
}

@media (prefers-color-scheme: light) {
  .blob {
    opacity: 0.18;
  }
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(3rem, 2rem) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none;
  }
}

img {
  max-width: 100%;
  display: block;
  image-orientation: from-image;
}

a {
  color: var(--color-accent-strong);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

ul {
  margin: 0;
  padding: 0;
}

h1, h2, h3 {
  line-height: 1.15;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

h2 {
  position: relative;
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-2);
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 3.5rem;
  height: 4px;
  border-radius: 999px;
  background: var(--gradient-accent);
}

.hero h2::after,
.contact-inner h2::after {
  left: 50%;
  transform: translateX(-50%);
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 var(--space-1);
}

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  padding: var(--space-2);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--font-heading);
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover,
.button:focus-visible {
  text-decoration: none;
  transform: translateY(-2px);
}

.button-primary {
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: 0 12px 24px -10px rgba(91, 141, 239, 0.55);
}

.button-primary:hover,
.button-primary:focus-visible {
  box-shadow: 0 16px 32px -10px rgba(139, 127, 245, 0.6);
}

.button-secondary {
  background: color-mix(in srgb, var(--color-surface) 60%, transparent);
  color: var(--color-text);
  border-color: var(--color-border);
  backdrop-filter: blur(6px);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  box-shadow: 0 10px 24px -14px rgba(91, 141, 239, 0.4);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .site-header {
    background: rgba(245, 247, 251, 0.85);
  }
}

.site-header.scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: 0 12px 30px -20px rgba(0, 0, 0, 0.6);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-2);
}

.brand {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.7rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand:hover {
  text-decoration: none;
  filter: brightness(1.15);
}

.primary-nav ul {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.nav-link {
  position: relative;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding-bottom: 4px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--gradient-accent);
  transition: right 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
  color: var(--color-text);
  text-decoration: none;
}

.nav-link:hover::after,
.nav-link.active::after {
  right: 0;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  margin-inline: 8px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-6) var(--space-5);
}

.hero-inner {
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.portrait {
  width: 10.5rem;
  height: 10.5rem;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  padding: 5px;
  background: var(--gradient-accent);
  box-shadow: 0 20px 50px -18px rgba(91, 141, 239, 0.55);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portrait:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 26px 60px -16px rgba(139, 127, 245, 0.6);
}

.portrait img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #fff;
  border: 3px solid var(--color-bg);
}

.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  margin: 0 0 0.3rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 0.4rem;
}

.hero-location {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 var(--space-3);
}

.hero-lede {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  list-style: none;
  font-size: 0.95rem;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.button .icon {
  width: 1rem;
  height: 1rem;
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--space-5);
}

.section-alt {
  position: relative;
  background: var(--color-bg-alt);
}

.section-alt::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--color-accent) 4%, transparent) 50%, transparent);
  pointer-events: none;
}

.section-note {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin: calc(var(--space-3) * -1) 0 var(--space-4);
}

.about-grid {
  display: grid;
  gap: var(--space-3);
  max-width: 48rem;
  color: var(--color-text-muted);
}

.pillars {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.pillars h3 {
  color: var(--color-text);
}

.pillars p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--color-surface), var(--color-surface-2));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: color-mix(in srgb, var(--color-accent-strong) 45%, var(--color-border));
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3);
}

.tag-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.tag-list li {
  padding-left: 1.1rem;
  position: relative;
}

.tag-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.tag-list-compact {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list-compact li {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tag-list-compact li:hover {
  border-color: var(--color-accent-strong);
  color: var(--color-text);
  transform: translateY(-1px);
}

.tag-list-compact li::before {
  content: none;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--space-3);
}

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.project-head h3 {
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-progress {
  background: var(--color-status-progress-bg);
  color: var(--color-status-progress-text);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .status-badge::before {
    animation: none;
  }
}

.project-detail {
  color: var(--color-text-muted);
  font-size: 0.93rem;
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: var(--space-3);
  font-weight: 600;
  font-size: 0.9rem;
  transition: gap 0.2s ease;
}

.project-link:hover {
  gap: 0.55rem;
}

/* ---------- Experience ---------- */
.experience-card .project-head {
  align-items: baseline;
}

.experience-dates {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.experience-meta {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0 0 var(--space-3);
}

.experience-card .tag-list li::before {
  top: 0.6em;
}

/* ---------- Credentials ---------- */
.credentials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3);
}

.credential-card {
  padding: var(--space-2);
  text-align: center;
}

.credential-link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  cursor: zoom-in;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.credential-link:hover {
  border-color: var(--color-accent-strong);
  box-shadow: 0 14px 30px -16px rgba(91, 141, 239, 0.5);
}

.credential-link img {
  width: 100%;
  height: 16rem;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.credential-link:hover img {
  transform: scale(1.03);
}

.credential-card figcaption {
  padding: var(--space-3) var(--space-2) var(--space-1);
}

.credential-card h3 {
  margin-bottom: 0.2rem;
}

.credential-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.credential-date {
  margin-top: 0.2rem;
}

.credential-detail {
  margin-top: var(--space-2);
  text-align: left;
  font-size: 0.85rem;
}

/* ---------- Contact ---------- */
.contact-inner {
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.footer-inner p {
  margin: 0;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 200;
  animation: fade-in 0.2s ease;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(90vw, 60rem);
  max-height: 88vh;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Responsive nav ---------- */
@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .primary-nav {
    position: fixed;
    top: 60px;
    right: 0;
    left: 30%;
    height: calc(100vh - 60px);
    background: var(--color-bg-alt);
    border-left: 1px solid var(--color-border);
    box-shadow: -16px 0 40px -20px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 60;
  }

  .primary-nav.open {
    transform: translateX(0);
  }

  .primary-nav ul {
    flex-direction: column;
    gap: 0;
    padding: var(--space-3);
  }

  .primary-nav li {
    border-bottom: 1px solid var(--color-border);
  }

  .primary-nav a {
    display: block;
    padding: var(--space-3) var(--space-1);
  }
}
