/* token */
:root {
  --bg:          #f0f7ff;
  --surface:     #ffffff;
  --surface2:    #e2f0fb;
  --border:      #c8dff2;
  --accent:      #3b8bd4;
  --accent-soft: #d6ebfa;
  --text:        #0d1f35;
  --muted:       #4d7da8;
  --nav-bg:      rgba(240,247,255,0.88);
  --shadow:      0 2px 24px rgba(59,139,212,0.10);
}
[data-theme="dark"] {
  --bg:          #050f1f;
  --surface:     #0c1e36;
  --surface2:    #112843;
  --border:      #1e3a58;
  --accent:      #5ba8e8;
  --accent-soft: #0d2a46;
  --text:        #d6eaf8;
  --muted:       #7eaed4;
  --nav-bg:      rgba(5,15,31,0.92);
  --shadow:      0 2px 24px rgba(0,0,0,0.45);
}

/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html   { scroll-behavior: smooth; }
body   {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
a      { text-decoration: none; color: inherit; }
ul     { list-style: none; }
img    { display: block; max-width: 100%; }

/* keyframes */

/* Loader */
@keyframes loader-fill    { to   { width: 100%; } }
@keyframes loader-fade    { 80%  { opacity:1 } 100% { opacity:0; pointer-events:none } }
@keyframes loader-letters { from { opacity:0; transform:translateY(14px) } to { opacity:1; transform:none } }

/* Hero pop-in (spring) */
@keyframes pop-in {
  0%   { opacity:0; transform:translateY(28px) scale(.96); }
  60%  { transform:translateY(-5px) scale(1.015); }
  100% { opacity:1; transform:none; }
}

/* Scroll spring pop */
@keyframes spring-pop {
  0%   { opacity:0; transform:translateY(26px) scale(.97); }
  65%  { transform:translateY(-5px) scale(1.01); }
  100% { opacity:1; transform:none; }
}

/* Skill tag stagger */
@keyframes skill-pop {
  0%   { opacity:0; transform:scale(.65) rotate(-5deg); }
  70%  { transform:scale(1.1) rotate(1deg); }
  100% { opacity:1; transform:none; }
}

/* Avatar */
@keyframes orbit-cw   { to { transform:rotate(360deg);  } }
@keyframes orbit-ccw  { to { transform:rotate(-360deg); } }
@keyframes float-y    { 0%,100%{ transform:translateY(0)   } 50%{ transform:translateY(-10px) } }
@keyframes init-pulse { 0%,100%{ opacity:.28 } 50%{ opacity:.52 } }
@keyframes green-pulse{
  0%,100%{ box-shadow:0 0 0 0   rgba(34,197,94,.55) }
  50%    { box-shadow:0 0 0 7px rgba(34,197,94,0)    }
}

/* Blobs */
@keyframes blob {
  0%,100%{ transform:translate(0,0)      scale(1)    }
  33%    { transform:translate(22px,-28px) scale(1.04) }
  66%    { transform:translate(-14px,18px) scale(.97)  }
}

/* Misc */
@keyframes spin        { to { transform:rotate(360deg) } }
@keyframes feedback-in { from { opacity:0; transform:translateY(-5px) } to { opacity:1; transform:none } }
@keyframes shimmer     { from { transform:translateX(-100%) } to { transform:translateX(100%) } }

/* Animation utilities */
.pop-in {
  opacity: 0;
  animation: pop-in .65s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: var(--d, 0s);
}

/* Scroll-triggered — JS adds .visible */
.sp { opacity: 0; }
.sp.visible {
  animation: spring-pop .6s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: var(--d, 0s);
}
.sk { opacity: 0; }
.sk.visible {
  animation: skill-pop .45s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + .1s);
}

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: loader-fade .5s ease 1.4s forwards;
  pointer-events: none;
}
.loader-box      { text-align: center; }
.loader-initials {
  font-family: 'DM Serif Display', serif;
  font-size: 3.5rem;
  color: var(--accent);
  letter-spacing: -.02em;
  margin-bottom: 1.5rem;
}
.loader-initials span:nth-child(1) { display:inline-block; animation: loader-letters .5s .08s ease both; }
.loader-initials span:nth-child(2) { display:inline-block; animation: loader-letters .5s .22s ease both; }
.loader-track {
  width: 180px;
  height: 3px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
}
.loader-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 4px;
  animation: loader-fill 1.1s .1s cubic-bezier(.4,0,.2,1) forwards;
}
/* cursor glow */
#cursor-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,139,212,.09) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: left .1s ease, top .1s ease;
  left: -999px;
  top: -999px;
}

/* ══════════════════════════════════════════
   NAV
══════════════════════════════════════════ */
nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -.02em;
}
.nav-links {
  display: flex;
  gap: 2rem;
}
.nav-link {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  position: relative;
  padding-bottom: 3px;
  transition: color .2s;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: width .25s ease;
}
.nav-link:hover       { color: var(--accent); }
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }
.nav-link.active        { color: var(--accent); }

.nav-right  { display: flex; align-items: center; gap: 1rem; }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 22px;
  border-radius: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background .3s;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  top: 2px; left: 2px;
  transition: transform .3s;
}
[data-theme="dark"] .theme-toggle::after { transform: translateX(18px); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer */
.nav-drawer {
  display: none;
  flex-direction: column;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  padding: .9rem 2rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color .2s, background .2s;
}
.nav-drawer a:hover { color: var(--accent); background: var(--accent-soft); }

/* layout */
main         { padding-top: 60px; }
section      { padding: 6rem 2rem; }
.container   { max-width: 1100px; margin: 0 auto; }
.label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .75rem;
}
h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  letter-spacing: -.025em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1rem;
}
/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.65rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  transition: opacity .2s, border-color .2s, color .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.15);
  transform: translateX(-100%);
  transition: transform .3s ease;
}
.btn-primary:hover::before { transform: translateX(0); }
.btn-primary:hover          { opacity: .92; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

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

/* Spinner inside button */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

/* hero */
#hero {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Background blobs */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .14;
  pointer-events: none;
  z-index: 0;
}
.b1 { width:500px; height:500px; background:var(--accent); top:-100px; right:-100px; animation:blob 8s ease-in-out infinite; }
.b2 { width:350px; height:350px; background:#7ec8e3;        bottom:-80px; left:20%;  animation:blob 11s ease-in-out infinite reverse; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.eyebrow-line {
  display: block;
  width: 24px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: 1.25rem;
}
h1 em { font-style: italic; color: var(--accent); }
.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.75;
  margin-bottom: 2.5rem;
}

/* Avatar */
.hero-visual  { display: flex; justify-content: center; align-items: center; }
.avatar-wrap  { position: relative; width: 320px; height: 320px; }

.orbit-outer {
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  animation: orbit-cw 14s linear infinite;
}
.orbit-dot {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .65;
}
.orbit-dot:nth-child(1) { top:0;        left:50%;    transform:translate(-50%,-50%); }
.orbit-dot:nth-child(2) { bottom:14px;  right:12px; }
.orbit-dot:nth-child(3) { bottom:14px;  left:12px;  }

.orbit-dashed {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  animation: orbit-ccw 22s linear infinite;
}

.avatar-circle {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-soft), var(--surface2));
  border: 2px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.avatar-letters {
  font-family: 'DM Serif Display', serif;
  font-size: 6rem;
  color: var(--accent);
  line-height: 1;
  user-select: none;
  animation: init-pulse 4s ease-in-out infinite;
}

/* Float tags */
.ftag {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .85rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  box-shadow: var(--shadow);
  white-space: nowrap;
  z-index: 5;
}
.ftag-1 { top:10px;   right:-32px; animation: float-y 3.2s ease-in-out infinite; }
.ftag-2 { bottom:60px; left:-40px; animation: float-y 3.8s ease-in-out infinite 1s; }
.ftag-3 { top:50%;    right:-44px; animation: float-y 4.1s ease-in-out infinite .5s; }

/* Badge */
.badge {
  position: absolute;
  bottom: 10px; right: -20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .5rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .45rem;
  z-index: 5;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: green-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
.badge-text { color: var(--accent); }

/* about */
#about { background: var(--surface); }
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.about-text p {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1rem;
}
.skills { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.tag {
  padding: .35rem .85rem;
  border-radius: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 500;
  color: var(--accent);
  cursor: default;
  transition: background .2s, color .2s, transform .2s;
}
.tag:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }

.stats        { display: flex; flex-direction: column; gap: 1.5rem; }
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 30px rgba(59,139,212,.14); }
.stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-label { font-size: .85rem; color: var(--muted); }

/* contact */
#contact { background: var(--bg); }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.contact-info p {
  color: var(--muted);
  line-height: 1.75;
  max-width: 400px;
  margin-bottom: 2rem;
}
.contact-links  { display: flex; flex-direction: column; gap: 1rem; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.contact-item:hover {
  border-color: var(--accent);
  transform: translateX(5px);
  box-shadow: 0 4px 20px rgba(59,139,212,.10);
}
.contact-item:hover .ci-icon { background: var(--accent); color: #fff; }
.ci-icon {
  width: 40px; height: 40px;
  background: var(--accent-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  transition: background .2s, color .2s;
}
.ci-label { font-size: .72rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.ci-value { font-size: .9rem; color: var(--text); font-weight: 500; }

/* Form */
.contact-form  { display: flex; flex-direction: column; gap: 1.1rem; }
.form-group    { display: flex; flex-direction: column; gap: .4rem; }
label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
input, textarea {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .72rem 1rem;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .6; }
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,139,212,.12);
}
textarea { resize: vertical; min-height: 130px; }

/* Feedback */
.feedback {
  padding: .65rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  animation: feedback-in .3s ease forwards;
}
.feedback.success { color:#15803d; background:#dcfce7; border:1px solid #bbf7d0; }
.feedback.error   { color:#b91c1c; background:#fee2e2; border:1px solid #fecaca; }
[data-theme="dark"] .feedback.success { color:#86efac; background:rgba(34,197,94,.12); border-color:rgba(34,197,94,.25); }
[data-theme="dark"] .feedback.error   { color:#fca5a5; background:rgba(239,68,68,.10); border-color:rgba(239,68,68,.25); }

/* footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .8rem;
  color: var(--muted);
}
.footer-socials { display: flex; gap: 1rem; }
.footer-socials a {
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color .2s, transform .2s;
}
.footer-socials a:hover { color: var(--accent); transform: translateY(-2px); }

/* responsive */
@media (max-width: 768px) {
  .nav-links   { display: none; }
  .hamburger   { display: flex; }
  .hero-visual { display: none; }
  .hero-grid,
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }
  section      { padding: 4rem 1.25rem; }
  .ftag        { display: none; }
}

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