/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* palette — dark (default) */
  --bg:          #080c14;
  --bg-card:     #0d1220;
  --bg-card-2:   #111827;
  --border:      rgba(99,132,255,.18);
  --border-2:    rgba(99,132,255,.08);
  --text:        #e2e8f0;
  --text-muted:  #8892a4;
  --accent:      #6384ff;
  --accent-2:    #a78bfa;
  --accent-glow: rgba(99,132,255,.35);
  --success:     #34d399;
  --neon:        #6384ff;
  --neon-2:      #a78bfa;
  --font-mono:   'Space Mono', monospace;
  --radius:      14px;
  --radius-sm:   8px;
  --nav-h:       64px;
  --transition:  .22s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:          #f0f4ff;
  --bg-card:     #ffffff;
  --bg-card-2:   #f8faff;
  --border:      rgba(99,132,255,.22);
  --border-2:    rgba(99,132,255,.10);
  --text:        #1a2035;
  --text-muted:  #5a6480;
  --accent-glow: rgba(99,132,255,.18);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

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

ul { list-style: none; }

/* ============================================================
   AMBIENT BACKGROUND
   ============================================================ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(99,132,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,132,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow--1 {
  width: 600px; height: 600px;
  top: -200px; left: -100px;
  background: radial-gradient(circle, rgba(99,132,255,.15) 0%, transparent 70%);
  animation: glow-drift 12s ease-in-out infinite alternate;
}
.bg-glow--2 {
  width: 500px; height: 500px;
  bottom: -100px; right: -80px;
  background: radial-gradient(circle, rgba(167,139,250,.12) 0%, transparent 70%);
  animation: glow-drift 15s ease-in-out infinite alternate-reverse;
}

.bg-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: .025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

@keyframes glow-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  background: rgba(8,12,20,.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border-2);
}

.nav__logo {
  font-family: 'Space Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.nav__logo span { color: var(--accent); }

.nav__links {
  display: flex;
  gap: 2rem;
}
.nav__links a {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
  letter-spacing: .03em;
}
.nav__links a:hover { color: var(--accent); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ============================================================
   SECTIONS
   ============================================================ */
main { position: relative; z-index: 1; }

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 8rem) clamp(1.5rem, 5vw, 3rem);
}

.section__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 3rem;
  display: flex;
  align-items: baseline;
  gap: .75rem;
}

.section__num {
  font-family: 'Space Mono', monospace;
  font-size: .875rem;
  color: var(--accent);
  font-weight: 400;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: var(--nav-h) clamp(1.5rem, 5vw, 3rem) 0;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.hero__inner { max-width: 680px; }

.hero__eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: .8rem;
  color: var(--accent);
  letter-spacing: .1em;
  margin-bottom: 1.25rem;
  opacity: .9;
}

.hero__name {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__title {
  font-size: clamp(.85rem, 1.8vw, 1rem);
  color: var(--text-muted);
  letter-spacing: .04em;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero__title span { color: var(--accent); margin: 0 .4rem; }

.hero__intro {
  font-size: clamp(.95rem, 1.6vw, 1.05rem);
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 2.5rem;
  max-width: 560px;
}
.hero__intro strong { color: var(--text); }

.hero__cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* orbit decoration */
.hero__orbit {
  position: absolute;
  right: -60px; top: 50%;
  transform: translateY(-50%);
  width: 420px; height: 420px;
  pointer-events: none;
  opacity: .5;
}
.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  animation: spin 20s linear infinite;
}
.orbit-ring--2 {
  inset: 40px;
  border-color: rgba(167,139,250,.2);
  animation-duration: 14s;
  animation-direction: reverse;
}
.orbit-core {
  position: absolute;
  width: 80px; height: 80px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  filter: blur(10px);
  animation: pulse-core 3s ease-in-out infinite alternate;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-core {
  from { transform: translate(-50%,-50%) scale(.85); opacity: .6; }
  to   { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
}
.btn--primary:hover {
  background: var(--accent-2);
  box-shadow: 0 0 36px rgba(167,139,250,.45);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* ============================================================
   ABOUT
   ============================================================ */
.about {
  display: grid;
  gap: 2rem;
  max-width: 760px;
}
.about p { color: var(--text-muted); font-size: 1.05rem; line-height: 1.8; }
.about p strong { color: var(--text); }

.about__highlights {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.about__highlights li {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-muted);
  font-size: .95rem;
}
.about__highlights li::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.skill-card:hover {
  border-color: var(--border);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.3);
}

.skill-card__category {
  font-family: 'Space Mono', monospace;
  font-size: .7rem;
  color: var(--accent);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .85rem;
}

.skill-card__items {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .5rem;
}
.skill-card__items li {
  font-size: .88rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.5;
}
.skill-card__items li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: .72rem;
  top: .15em;
}

/* ============================================================
   TIMELINE / EXPERIENCE
   ============================================================ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding: 0 0 3rem 2rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.45rem;
  top: .35rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-item__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .35rem;
}

.timeline-item__role {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.timeline-item__date {
  font-family: 'Space Mono', monospace;
  font-size: .72rem;
  color: var(--accent);
  letter-spacing: .06em;
}

.timeline-item__company {
  font-size: .88rem;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: .85rem;
}

.timeline-item__list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.timeline-item__list li {
  font-size: .92rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
}
.timeline-item__list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 20px 50px rgba(0,0,0,.35), 0 0 0 1px var(--accent-glow);
}

.project-card__icon {
  font-size: 2rem;
  line-height: 1;
}

.project-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.project-card__desc {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.project-card__tag {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99,132,255,.08);
  border: 1px solid rgba(99,132,255,.2);
  border-radius: 99px;
  padding: .2rem .7rem;
}

.project-card__link {
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: auto;
  transition: gap var(--transition);
}
.project-card__link:hover { gap: .6rem; }

/* ============================================================
   CERTS
   ============================================================ */
.certs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: border-color var(--transition), transform var(--transition);
}
.cert-card:hover {
  border-color: var(--border);
  transform: translateY(-3px);
}

.cert-badge {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: .03em;
  text-align: center;
}

.cert-card__body { flex: 1; min-width: 0; }

.cert-card__body strong {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: .25rem;
}

.cert-card__body span {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
}

.cert-card__verify {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent);
  margin-top: .3rem;
}

.cert-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.cert-card--link:hover { border-color: var(--accent); }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { max-width: 580px; }

.contact__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.contact__actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.contact__form {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.contact__form input,
.contact__form textarea {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: .92rem;
  padding: .85rem 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  resize: vertical;
}
.contact__form input::placeholder,
.contact__form textarea::placeholder { color: var(--text-muted); }
.contact__form input:focus,
.contact__form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.contact__status {
  font-size: .85rem;
  min-height: 1.4em;
  color: var(--success);
}
.contact__status--error { color: #f87171; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-2);
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: .82rem;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .65s ease, transform .65s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav__links { display: none; }

  .hero { min-height: calc(100svh - var(--nav-h)); padding-top: calc(var(--nav-h) + 2rem); }
  .hero__orbit { display: none; }

  .timeline { padding-left: 1.25rem; }

  .projects { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   ANIMATIONS ADDON — stagger, 3D hover, gradient borders
   ============================================================ */

/* Override base transitions to include 3D-capable values */
.skill-card, .timeline-item, .project-card, .cert-card {
  transition:
    transform .45s cubic-bezier(.2,.7,.2,1),
    box-shadow .45s ease,
    border-color .35s ease,
    opacity .5s ease;
  will-change: transform;
}

/* Stagger entrance delays */
.skills .skill-card:nth-child(1)  { transition-delay: .00s; }
.skills .skill-card:nth-child(2)  { transition-delay: .06s; }
.skills .skill-card:nth-child(3)  { transition-delay: .12s; }
.skills .skill-card:nth-child(4)  { transition-delay: .18s; }
.skills .skill-card:nth-child(5)  { transition-delay: .24s; }
.projects .project-card:nth-child(odd)  { transition-delay: .05s; }
.projects .project-card:nth-child(even) { transition-delay: .10s; }

/* 3D lift on hover */
.skill-card:hover,
.project-card:hover {
  transform: translateY(-8px) rotateX(3deg) rotateY(-3deg);
  box-shadow: 0 24px 60px rgba(0,0,0,.40);
}
.timeline-item:hover { transform: translateX(8px) scale(1.01); }

/* Animated gradient border sweep on project cards */
.project-card {
  position: relative;
  isolation: isolate;
}
.project-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, var(--neon), transparent 40%, transparent 60%, var(--neon-2));
  background-size: 200% 200%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .4s ease;
  animation: borderSweep 4s linear infinite;
  z-index: 0;
}
.project-card:hover::before { opacity: 1; }
@keyframes borderSweep {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Cert badge pulse on hover */
.cert-card:hover .cert-badge {
  animation: badgePulse 1.2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 rgba(99,132,255,0); }
  50%     { transform: scale(1.08); box-shadow: 0 0 18px rgba(99,132,255,.5); }
}

/* Reduced-motion overrides for addon animations */
@media (prefers-reduced-motion: reduce) {
  .project-card::before { animation: none; }
  .cert-card:hover .cert-badge { animation: none; }
  .skill-card:hover, .project-card:hover { transform: translateY(-4px); }
  .timeline-item:hover { transform: none; }
}
