/* =========================================================
   DESIGN SYSTEM
   Dark navy + electric blue. Change tokens here to re-theme.
   ========================================================= */
:root {
  /* Color */
  --navy-950: #050b18;
  --navy-900: #0a1628;
  --navy-800: #0f1f3a;
  --navy-700: #16294a;
  --navy-600: #1e3a64;
  --blue-500: #2b8cff;
  --blue-400: #38a8ff;
  --blue-300: #7cc4ff;
  --text-100: #e8f0ff;
  --text-300: #a9b8d4;
  --text-500: #6d7f9f;

  --bg: var(--navy-900);
  --surface: rgba(22, 41, 74, 0.55);
  --surface-hover: rgba(30, 58, 100, 0.7);
  --border: rgba(124, 196, 255, 0.12);
  --border-strong: rgba(56, 168, 255, 0.55);
  --accent: var(--blue-400);
  --accent-glow: rgba(56, 168, 255, 0.35);

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.75rem, 3.5vw, 2.25rem);
  --fs-hero: clamp(2.75rem, 9vw, 5.5rem);
  --fs-hero-sub: clamp(1.4rem, 4vw, 2.5rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --section-y: clamp(4.5rem, 10vw, 7.5rem);

  /* Shape & motion */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 68px;
  --container: 1120px;
  color-scheme: dark;
}

/* =========================================================
   BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text-300);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: var(--text-100); line-height: 1.2; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
strong { color: var(--text-100); font-weight: 600; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-right, 0px));
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85rem 1.75rem;
  font: 600 var(--fs-sm)/1 var(--font-sans);
  letter-spacing: 0.01em;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-400));
  box-shadow: 0 6px 24px -6px var(--accent-glow);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 32px -6px rgba(56, 168, 255, 0.6); }
.btn--outline { color: var(--blue-300); border-color: var(--border-strong); background: transparent; }
.btn--outline:hover { background: rgba(56, 168, 255, 0.1); border-color: var(--accent); color: #fff; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--sm { padding: 0.7rem 1.3rem; }
.btn--block { width: 100%; }

/* =========================================================
   NAVIGATION
   ========================================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 100;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(10, 22, 40, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav__logo { font-weight: 800; font-size: var(--fs-xl); color: var(--text-100); letter-spacing: -0.02em; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; align-items: center; gap: var(--space-2); }
.nav__link {
  position: relative;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-300);
  transition: color 0.2s;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: var(--space-3); right: var(--space-3); bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav__link:hover, .nav__link.is-active { color: var(--text-100); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); }
.nav__link--cta {
  margin-left: var(--space-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--blue-300);
}
.nav__link--cta::after { display: none; }
.nav__link--cta:hover, .nav__link--cta.is-active { background: rgba(56, 168, 255, 0.1); color: #fff; }

.nav__toggle {
  display: none;
  width: 42px; height: 42px;
  background: none; border: 0; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav__toggle span {
  width: 22px; height: 2px; background: var(--text-100); border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(43, 140, 255, 0.18), transparent 70%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 45%, #0b1d3a 100%);
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__glow {
  position: absolute;
  width: 640px; height: 640px;
  left: 50%; top: 50%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 168, 255, 0.16), transparent 65%);
  filter: blur(20px);
  animation: glowDrift 12s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glowDrift {
  0%   { transform: translate(-12%, -8%) scale(1); }
  100% { transform: translate(12%, 10%) scale(1.15); }
}
.hero__content { position: relative; z-index: 1; padding-top: var(--nav-h); }
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.hero__name {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  background: linear-gradient(100deg, #ffffff 30%, var(--blue-300) 70%, var(--blue-400));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__title {
  margin-top: var(--space-3);
  font-size: var(--fs-hero-sub);
  font-weight: 700;
  color: var(--text-300);
}
.hero__tagline {
  max-width: 600px;
  margin: var(--space-5) auto 0;
  font-size: var(--fs-lg);
  color: var(--text-300);
}
.hero__actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-6);
}
.hero__content > * { animation: fadeUp 0.9s var(--ease) both; }
.hero__content > :nth-child(2) { animation-delay: 0.1s; }
.hero__content > :nth-child(3) { animation-delay: 0.2s; }
.hero__content > :nth-child(4) { animation-delay: 0.3s; }
.hero__content > :nth-child(5) { animation-delay: 0.4s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero__scroll {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  translate: -50% 0;
  width: 26px; height: 42px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  z-index: 1;
}
.hero__scroll span {
  position: absolute;
  left: 50%; top: 8px;
  width: 4px; height: 8px;
  translate: -50% 0;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* =========================================================
   SECTIONS (shared)
   ========================================================= */
.section { padding-block: var(--section-y); position: relative; }
.section:nth-of-type(odd) { background: linear-gradient(180deg, transparent, rgba(5, 11, 24, 0.35), transparent); }

.section__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-2xl);
  font-weight: 800;
  margin-bottom: var(--space-7);
}
.section__title span { font-family: var(--font-mono); font-size: 0.75em; font-weight: 500; color: var(--accent); }
.section__title::after {
  content: "";
  flex: 1;
  max-width: 320px;
  height: 1px;
  margin-left: var(--space-4);
  background: linear-gradient(90deg, var(--border-strong), transparent);
}
.section__title--center { justify-content: center; }
.section__title--center::after { display: none; }

.subsection__title { font-size: var(--fs-xl); margin: var(--space-8) 0 var(--space-5); }

.card-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

/* Scroll reveal */
.reveal { opacity: 0.35; transform: translateY(16px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-visible, .no-js .reveal { opacity: 1; transform: none; }

/* =========================================================
   ABOUT
   ========================================================= */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-7); align-items: start; }
.about__text p { font-size: var(--fs-lg); }
.about__text p + p { margin-top: var(--space-5); }
.about__card {
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.interest-list li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; color: var(--text-100); }
.interest-list__icon { font-size: 1.15rem; width: 1.6rem; text-align: center; }
.about__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  text-align: center;
}
.about__stats strong { display: block; font-size: var(--fs-xl); color: var(--accent); }
.about__stats span { font-size: var(--fs-xs); color: var(--text-500); line-height: 1.3; display: block; }

/* =========================================================
   EXPERIENCE
   ========================================================= */
.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 200px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--border-strong), var(--border) 80%, transparent);
}
.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-6);
  padding-bottom: var(--space-7);
}
.timeline__item::before {
  content: "";
  position: absolute;
  left: 195px; top: 7px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 168, 255, 0.15), 0 0 16px var(--accent-glow);
}
.timeline__meta { display: flex; flex-direction: column; gap: var(--space-1); padding-right: var(--space-5); }
.timeline__date { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--accent); }
.timeline__place { font-size: var(--fs-sm); color: var(--text-500); }
.timeline__body {
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.timeline__body:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.timeline__body h3 { font-size: var(--fs-lg); margin-bottom: var(--space-3); }
.timeline__body .at { color: var(--accent); font-weight: 600; }
.timeline__body li { position: relative; padding-left: var(--space-5); font-size: var(--fs-sm); }
.timeline__body li + li { margin-top: var(--space-2); }
.timeline__body li::before {
  content: "▹";
  position: absolute; left: 0; top: 0;
  color: var(--accent);
}

.edu { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); margin-top: var(--space-4); }
.edu__card {
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.edu__card h3 { font-size: var(--fs-lg); }
.edu__card p { font-size: var(--fs-sm); margin-top: var(--space-1); }

/* =========================================================
   SKILLS & CERTIFICATIONS
   ========================================================= */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.skill-card {
  position: relative;
  padding: var(--space-5);
  padding-top: calc(var(--space-5) + 10px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.skill-card::before {
  content: "";
  position: absolute;
  top: var(--space-5); left: var(--space-5);
  width: 22px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.skill-card:hover { transform: translateY(-3px); border-color: var(--border-strong); background: var(--surface-hover); }
.skill-card:hover::before { width: 40px; }
.skill-card h3 { font-size: var(--fs-base); font-weight: 700; margin-top: var(--space-2); }
.skill-card span {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.cert-card {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.cert-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.cert-card__badge {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: var(--radius);
  font: 600 var(--fs-xs) var(--font-mono);
  color: var(--blue-300);
  background: rgba(56, 168, 255, 0.1);
  border: 1px solid var(--border-strong);
}
.cert-card h4 { font-size: var(--fs-sm); }
.cert-card p { font-size: var(--fs-xs); color: var(--text-500); }

/* =========================================================
   PROJECTS
   ========================================================= */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.project-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(500px circle at var(--mx, 50%) var(--my, 0%), rgba(56, 168, 255, 0.1), transparent 45%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 50px -20px rgba(43, 140, 255, 0.45);
}
.project-card:hover::before { opacity: 1; }
.project-card__status {
  align-self: flex-start;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.project-card h3 { font-size: var(--fs-xl); font-weight: 800; }
.project-card__sub { color: var(--blue-300); font-size: var(--fs-sm); font-weight: 500; margin: var(--space-1) 0 var(--space-4); }
.project-card > p:not(.project-card__sub) { font-size: var(--fs-sm); flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-5) 0; }
.tags li {
  padding: 0.3rem 0.7rem;
  font: 500 0.7rem var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue-300);
  background: rgba(56, 168, 255, 0.1);
  border-radius: 999px;
}
.project-card .btn { align-self: flex-start; }

/* =========================================================
   CONTACT
   ========================================================= */
.contact { max-width: 680px; text-align: center; }
.contact__intro { font-size: var(--fs-lg); margin: calc(-1 * var(--space-5)) 0 var(--space-6); }
.contact-form {
  text-align: left;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-100); margin-bottom: var(--space-2); }
.field input, .field textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--text-100);
  background: rgba(5, 11, 24, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-500); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 168, 255, 0.18); }
.field.has-error input, .field.has-error textarea { border-color: #ff6b81; }
.form-status { min-height: 1.4em; margin-top: var(--space-3); font-size: var(--fs-sm); text-align: center; }
.form-status.is-error { color: #ff8a9c; }
.form-status.is-success { color: var(--blue-300); }
.contact__direct { margin-top: var(--space-5); font-size: var(--fs-sm); }
.contact__direct a { color: var(--accent); border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.contact__direct a:hover { border-color: var(--accent); }

/* =========================================================
   FOOTER
   ========================================================= */
.footer { padding: var(--space-6) 0; border-top: 1px solid var(--border); background: var(--navy-950); }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.footer__links { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.footer__links a { font-size: var(--fs-sm); transition: color 0.2s; }
.footer__links a:hover { color: var(--accent); }
.footer__copy { font-size: var(--fs-sm); color: var(--text-500); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .about { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .cert-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 5px; }
  .timeline__item { grid-template-columns: 1fr; gap: var(--space-3); padding-left: var(--space-6); }
  .timeline__item::before { left: 0; }
  .timeline__meta { flex-direction: row; gap: var(--space-3); flex-wrap: wrap; }
}

@media (max-width: 760px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-4) var(--space-4) var(--space-5);
    background: rgba(10, 22, 40, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav__links.is-open { opacity: 1; transform: none; visibility: visible; }
  .nav.menu-open { background: rgba(10, 22, 40, 0.97); }
  .nav__link { padding: var(--space-3) var(--space-2); font-size: var(--fs-base); }
  .nav__link::after { display: none; }
  .nav__link.is-active { color: var(--accent); }
  .nav__link--cta { margin: var(--space-3) 0 0; text-align: center; }

  .projects-grid, .edu { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .section__title::after { display: none; }
  .footer__inner { flex-direction: column; text-align: center; }
  .footer__links { justify-content: center; }
}

@media (max-width: 480px) {
  .hero__actions { flex-direction: column; align-items: stretch; max-width: 300px; margin-inline: auto; }
  .skills-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .skill-card { padding: var(--space-4); padding-top: calc(var(--space-4) + 10px); }
  .skill-card::before { top: var(--space-4); left: var(--space-4); }
  .project-card, .contact-form, .about__card { padding: var(--space-5); }
  .timeline__body { padding: var(--space-4) var(--space-5); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
