/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ---------- Theme tokens ---------- */
:root {
  --accent: #3b82f6;
  --head-font: 'Outfit', system-ui, sans-serif;
  --body-font: 'DM Sans', system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #08080c;
  --fg: #f0f0f4;
  --fg-soft: rgba(240, 240, 244, 0.72);
  --fg-muted: rgba(240, 240, 244, 0.42);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.07);
  --nav-bg: rgba(8, 8, 12, 0.82);
  --nav-border: rgba(255, 255, 255, 0.07);
  --menu-bg: rgba(8, 8, 12, 0.97);
  --nav-link-idle: rgba(255, 255, 255, 0.5);
  --btn-primary-fg: #000;
  --btn-ghost-border: rgba(255, 255, 255, 0.12);
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
  --bg: #fcfcfe;
  --fg: #111114;
  --fg-soft: rgba(17, 17, 20, 0.72);
  --fg-muted: rgba(17, 17, 20, 0.42);
  --card-bg: rgba(0, 0, 0, 0.025);
  --card-border: rgba(0, 0, 0, 0.07);
  --nav-bg: rgba(252, 252, 254, 0.82);
  --nav-border: rgba(0, 0, 0, 0.06);
  --menu-bg: rgba(252, 252, 254, 0.97);
  --nav-link-idle: rgba(0, 0, 0, 0.45);
  --btn-primary-fg: #fff;
  --btn-ghost-border: rgba(0, 0, 0, 0.12);
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.08);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.5s, color 0.5s;
}

/* ---------- Keyframes ---------- */
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
@keyframes orbDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.1); }
  66% { transform: translate(30px, -20px) scale(0.95); }
}
@keyframes orbDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -40px) scale(1.15); }
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
@keyframes scrollDot {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(8px); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: 22px 32px;
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: padding 0.4s cubic-bezier(0.22,1,0.36,1),
              background-color 0.4s cubic-bezier(0.22,1,0.36,1),
              border-color 0.4s cubic-bezier(0.22,1,0.36,1),
              backdrop-filter 0.4s cubic-bezier(0.22,1,0.36,1);
  font-family: var(--body-font);
}
.nav.scrolled {
  padding: 14px 32px;
  background: var(--nav-bg);
  border-bottom-color: var(--nav-border);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
}

.nav-brand {
  font-family: var(--head-font);
  font-size: 18px; font-weight: 700; color: var(--accent);
  text-decoration: none; letter-spacing: -0.5px;
  transition: transform 0.3s;
}
.nav-brand:hover { transform: scale(1.1); }

.nav-desk {
  display: flex; gap: 28px; align-items: center;
}
.nav-link {
  position: relative;
  color: var(--nav-link-idle);
  text-decoration: none; font-size: 13px; letter-spacing: 0.4px;
  text-transform: uppercase; font-weight: 500;
  transition: color 0.3s;
}
.nav-link:hover, .nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: ""; position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}

.theme-toggle, .menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--fg);
  padding: 4px; line-height: 1;
  transition: transform 0.3s, opacity 0.3s;
}
.theme-toggle { font-size: 18px; opacity: 0.5; }
.theme-toggle:hover { opacity: 1; transform: rotate(30deg); }
.menu-btn { font-size: 22px; }

/* Theme icon swap */
.theme-icon-dark, .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }
:root[data-theme="light"] .theme-icon-light { display: inline; }

.menu-icon-close { display: none; }
.menu-btn[aria-expanded="true"] .menu-icon-open { display: none; }
.menu-btn[aria-expanded="true"] .menu-icon-close { display: inline; }

.nav-mob-wrap { display: none; align-items: center; gap: 12px; }

@media (max-width: 768px) {
  .nav-desk { display: none; }
  .nav-mob-wrap { display: flex; }
  .nav, .nav.scrolled { padding-left: 22px; padding-right: 22px; }
}

/* ---------- Mobile menu ---------- */
.menu-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--menu-bg);
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 36px;
  animation: fadeIn 0.3s ease-out;
}
.menu-overlay.open { display: flex; }
.menu-close {
  position: absolute; top: 22px; right: 32px;
  background: none; border: none; cursor: pointer;
  color: var(--fg); font-size: 28px;
}
.menu-link {
  color: var(--fg); text-decoration: none;
  font-size: 22px; font-weight: 500;
  font-family: var(--head-font);
  opacity: 0;
  animation: slideUp 0.4s ease-out forwards;
}
.menu-overlay.open .menu-link:nth-child(2) { animation-delay: 0.10s; }
.menu-overlay.open .menu-link:nth-child(3) { animation-delay: 0.16s; }
.menu-overlay.open .menu-link:nth-child(4) { animation-delay: 0.22s; }
.menu-overlay.open .menu-link:nth-child(5) { animation-delay: 0.28s; }
.menu-overlay.open .menu-link:nth-child(6) { animation-delay: 0.34s; }

/* ---------- Sections ---------- */
.section { padding: 120px 32px; position: relative; }
.section-narrow { max-width: 760px; margin: 0 auto; }
.section-contact { max-width: 560px; margin: 0 auto; }

.section-head { margin-bottom: 56px; }
.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: 3px;
  text-transform: uppercase; color: var(--accent);
  font-family: var(--body-font);
}
.section-bar {
  margin-top: 12px; height: 2px; border-radius: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  width: 0;
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1) 0.2s;
}
.reveal.is-visible .section-bar { width: 60px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 120px 32px 80px;
  overflow: hidden;
}
.constellation {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 20%, transparent 80%);
          mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 20%, transparent 80%);
}
.orbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px);
}
.orb-1 {
  width: 500px; height: 500px; top: -10%; right: -10%;
  background: radial-gradient(circle, rgb(from var(--accent) r g b / 0.07) 0%, transparent 70%);
  animation: orbDrift1 20s ease-in-out infinite;
}
.orb-2 {
  width: 400px; height: 400px; bottom: 0; left: -5%;
  filter: blur(60px);
  background: radial-gradient(circle, rgb(from var(--accent) r g b / 0.04) 0%, transparent 70%);
  animation: orbDrift2 25s ease-in-out infinite;
}
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute; border-radius: 50%;
  background: var(--accent);
  animation: floatY var(--dur, 20s) ease-in-out var(--delay, 0s) infinite;
}

.hero-inner {
  text-align: center; max-width: 720px; position: relative; z-index: 1;
}

.reveal-hero {
  opacity: 0;
  transform: translateY(50px) scale(0.97);
  transition: opacity 0.9s cubic-bezier(0.22,1,0.36,1) var(--d, 0s),
              transform 0.9s cubic-bezier(0.22,1,0.36,1) var(--d, 0s);
}
.reveal-hero.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Photo */
.photo-wrap {
  position: relative; width: 160px; height: 160px;
  margin: 0 auto 36px;
}
.photo-ring {
  position: absolute; border-radius: 50%;
  border: 2px solid transparent;
}
.photo-ring-1 {
  inset: -6px;
  border-top-color: var(--accent);
  opacity: 0.4;
  animation: spin 4s linear infinite;
}
.photo-ring-2 {
  inset: -10px;
  border-width: 1px;
  border-bottom-color: rgb(from var(--accent) r g b / 0.4);
  opacity: 0.3;
  animation: spinReverse 6s linear infinite;
}
.photo {
  width: 160px; height: 160px; border-radius: 50%; overflow: hidden;
  box-shadow:
    0 0 50px rgb(from var(--accent) r g b / 0.13),
    inset 0 0 20px rgb(from var(--accent) r g b / 0.07);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero-eyebrow {
  font-size: 14px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
  font-weight: 500;
  min-height: 1.5em;
}
.caret {
  display: inline;
  border-right: 2px solid var(--accent);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

.hero-name {
  font-family: var(--head-font);
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 700; line-height: 1.05;
  margin: 0 0 28px; letter-spacing: -3px;
  color: var(--fg);
}

.hero-blurb {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 48px;
  text-wrap: pretty;
}

.hero-cta {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}

.scroll-indicator {
  position: absolute; bottom: 32px; left: 50%;
  transform: translateX(-50%);
  opacity: 0; transition: opacity 1s 1.2s;
  display: flex; flex-direction: column; align-items: center;
}
.scroll-indicator.is-visible { opacity: 0.5; }
.scroll-mouse {
  width: 20px; height: 32px; border-radius: 10px;
  border: 1.5px solid var(--fg-muted);
  display: flex; justify-content: center; padding-top: 6px;
}
.scroll-dot {
  width: 2px; height: 8px; border-radius: 1px;
  background: var(--accent);
  animation: scrollDot 2s ease-in-out infinite;
}

/* ---------- Buttons ---------- */
.btn {
  padding: 14px 34px; font-size: 14px; font-weight: 600;
  border-radius: 10px; text-decoration: none;
  font-family: var(--body-font);
  display: inline-block;
  cursor: pointer; border: none;
  transition: box-shadow 0.3s, border-color 0.3s, color 0.3s, transform 0.15s ease-out;
}
.btn-primary {
  background: var(--accent); color: var(--btn-primary-fg);
  box-shadow: 0 4px 30px rgb(from var(--accent) r g b / 0.27);
}
.btn-ghost {
  background: transparent; color: var(--fg-muted);
  border: 1px solid var(--btn-ghost-border);
  font-weight: 500;
}
.btn-ghost:hover { color: var(--fg); border-color: var(--accent); }

/* ---------- Reveal (non-hero) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22,1,0.36,1),
              transform 0.8s cubic-bezier(0.22,1,0.36,1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- About ---------- */
.about-lead {
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.85;
  color: var(--fg-soft);
  text-wrap: pretty;
  margin-bottom: 20px;
}
.about-aside {
  font-size: clamp(16px, 1.8vw, 18px);
  line-height: 1.85;
  color: var(--fg-muted);
  text-wrap: pretty;
}

/* ---------- Experience ---------- */
.timeline { position: relative; padding-left: 32px; }
.timeline-line {
  position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, rgb(from var(--accent) r g b / 0.27), var(--card-border));
}
.timeline-items {
  display: flex; flex-direction: column; gap: 32px;
}
.timeline-item { position: relative; }
.timeline-dot {
  position: absolute; left: -32px; top: 8px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgb(from var(--accent) r g b / 0.27);
}
.card {
  padding: 28px 32px; border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  transition: border-color 0.4s, transform 0.4s, box-shadow 0.4s;
}
.card:hover {
  border-color: rgb(from var(--accent) r g b / 0.27);
  transform: translateY(-2px);
}
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.job-company { font-family: var(--head-font); font-size: 19px; font-weight: 600; color: var(--fg); }
.job-role { font-size: 14px; color: var(--accent); margin-top: 3px; font-weight: 500; }
.job-period { font-size: 13px; color: var(--fg-muted); white-space: nowrap; }
.job-desc { font-size: 15px; line-height: 1.7; color: var(--fg-muted); }

/* ---------- Skills ---------- */
.skill-cats { display: flex; flex-direction: column; gap: 40px; }
.skill-cat-title {
  font-size: 12px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 16px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 8px 18px;
  font-size: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--fg-soft);
  cursor: default;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
.chip:hover {
  background: rgb(from var(--accent) r g b / 0.13);
  border-color: rgb(from var(--accent) r g b / 0.27);
  color: var(--accent);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgb(from var(--accent) r g b / 0.08);
}

/* ---------- Projects ---------- */
.projects { display: flex; flex-direction: column; gap: 20px; }
.project-card {
  display: block; padding: 32px; border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  text-decoration: none;
  position: relative; overflow: hidden;
  transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}
.project-card:hover {
  border-color: rgb(from var(--accent) r g b / 0.27);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.project-overlay {
  position: absolute; inset: 0; border-radius: 16px;
  background: radial-gradient(circle at 0% 0%, rgb(from var(--accent) r g b / 0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s, background 0.4s;
  pointer-events: none;
}
.project-card:hover .project-overlay {
  opacity: 1;
  background: radial-gradient(circle at 50% 50%, rgb(from var(--accent) r g b / 0.05) 0%, transparent 60%);
}
.project-body { position: relative; }
.project-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 10px;
}
.project-title-row { display: flex; align-items: center; gap: 12px; }
.project-num {
  font-size: 11px; font-weight: 600; color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.project-title {
  font-family: var(--head-font);
  font-size: 20px; font-weight: 600;
  color: var(--fg);
}
.project-arrow {
  font-size: 18px; color: var(--fg-muted); flex-shrink: 0;
  display: inline-block;
  transition: transform 0.3s;
}
.project-card:hover .project-arrow { transform: translate(3px, -3px); }
.project-desc {
  font-size: 15px; line-height: 1.7;
  color: var(--fg-muted);
  margin-bottom: 16px;
}
.tech-row { display: flex; gap: 7px; flex-wrap: wrap; }
.tech {
  font-size: 12px; padding: 4px 12px; font-weight: 500;
  background: rgb(from var(--accent) r g b / 0.07);
  color: var(--accent);
  border-radius: 6px;
}

.projects-more { text-align: center; margin-top: 40px; }
.more-link {
  color: var(--fg-muted); font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}
.more-link:hover { color: var(--fg); border-color: var(--accent); }

/* ---------- Contact ---------- */
.contact-lead {
  font-size: 16px; color: var(--fg-muted);
  margin-bottom: 36px; line-height: 1.7;
}
.contact-form {
  display: flex; flex-direction: column; gap: 14px;
}
.field {
  width: 100%; padding: 14px 18px; font-size: 15px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--fg);
  outline: none;
  font-family: var(--body-font);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.field::placeholder { color: var(--fg-muted); }
.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(from var(--accent) r g b / 0.08);
}
textarea.field { resize: vertical; min-height: 120px; }

.recaptcha { display: flex; justify-content: flex-start; }

.contact-links {
  margin-top: 48px;
  display: flex; gap: 12px; flex-wrap: wrap;
}
.social-link {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgb(from var(--accent) r g b / 0.06);
}
.social-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ---------- Footer ---------- */
.footer {
  padding: 36px 32px;
  text-align: center;
  border-top: 1px solid var(--card-border);
}
.footer p { font-size: 13px; color: var(--fg-muted); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-hero { opacity: 1 !important; transform: none !important; }
}
