/* ===== CUSTOM PROPERTIES ===== */
:root {
  /* Backgrounds (layered dark surfaces) */
  --bg-void: #050510;
  --bg-primary: #0A0A1A;
  --bg-elevated: #111128;
  --bg-surface: #1A1A3E;
  --bg-overlay: #22224A;

  /* Text */
  --text-primary: #F5F5F7;
  --text-secondary: #A1A1B5;
  --text-muted: #6E6E82;
  --text-faint: #3A3A50;

  /* Accent */
  --accent: #0A84FF;
  --accent-hover: #409CFF;
  --accent-muted: rgba(10, 132, 255, 0.15);
  --accent-glow: rgba(10, 132, 255, 0.4);

  /* Highlight (high-contrast secondary) */
  --highlight: #00E87B;
  --highlight-muted: rgba(0, 232, 123, 0.15);

  /* Effects */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --glow-card: 0 0 40px rgba(10, 132, 255, 0.08);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --container-padding: clamp(1.5rem, 5vw, 4rem);
  --section-padding: clamp(5rem, 12vh, 10rem);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

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

ul { list-style: none; }
img { max-width: 100%; display: block; }

.mono {
  font-family: var(--font-mono);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: var(--container-padding);
}

/* ===== TYPOGRAPHY ===== */
.section__title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.section__subtitle {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 300;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 4rem;
}

/* ===== NAVIGATION ===== */
#navbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#navbar.visible {
  opacity: 1;
  pointer-events: all;
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.625rem 1.5rem;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
}

.nav__logo {
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  gap: 1.5rem;
}

.nav__links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.25s ease;
  letter-spacing: 0.01em;
}

.nav__links a:hover {
  color: var(--text-primary);
}

.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__hamburger span {
  width: 18px;
  height: 1.5px;
  background: var(--text-muted);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__hamburger[aria-expanded="true"] span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.nav__hamburger[aria-expanded="true"] span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* ===== HERO ===== */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem var(--container-padding);
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 140%;
  height: 80%;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(10, 132, 255, 0.12), transparent 70%);
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__portrait {
  margin-bottom: 1.5rem;
}

.hero__portrait img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  box-shadow: 0 0 40px rgba(10, 132, 255, 0.12);
  margin: 0 auto;
}

.hero__label {
  display: inline-block;
  font-size: 0.8125rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  min-height: 1.3em;
}

.hero__label .typed-cursor {
  color: var(--accent);
}

.hero__name {
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero__tagline {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero__summary {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.25s ease, gap 0.25s ease;
}

.hero__cta:hover {
  color: var(--accent-hover);
  gap: 0.75rem;
}

.hero__cta .arrow {
  transition: transform 0.25s ease;
}

.hero__cta:hover .arrow {
  transform: translateX(4px);
}

.hero__scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: bobDown 2s ease-in-out infinite;
}

@keyframes bobDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ===== EVOLUTION TIMELINE ===== */
#evolution {
  position: relative;
  height: 400vh;
}

.evolution__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: var(--container-padding);
  overflow: hidden;
}

.evolution__progress {
  position: absolute;
  left: 50%;
  top: 20%;
  bottom: 20%;
  width: 1px;
  transform: translateX(-50%);
  z-index: 2;
}

.evolution__years {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.evolution__year {
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.2vw, 1rem);
  color: var(--text-faint);
  transition: color 0.5s ease;
  white-space: nowrap;
  text-align: center;
}

/* Alternate year labels to match chapter side */
.evolution__year:nth-child(odd) {
  transform: translateX(calc(-100% - 20px));
}

.evolution__year:nth-child(even) {
  transform: translateX(20px);
}

.evolution__year.active {
  color: var(--accent);
}

.evolution__line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
  transform: translateX(-50%);
}

.evolution__dot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: top 0.1s linear;
}

.evolution__content {
  width: 100%;
  max-width: 1200px;
  position: relative;
  height: 70%;
}

.evolution__chapter {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* Odd chapters (1, 3) on the left */
.evolution__chapter:nth-child(odd) {
  left: 0;
  text-align: left;
}

/* Even chapters (2, 4) on the right */
.evolution__chapter:nth-child(even) {
  right: 0;
  text-align: left;
}

.evolution__chapter.active {
  opacity: 1;
  pointer-events: auto;
}

.evolution__code {
  margin-bottom: 1.5rem;
}

.evolution__code pre {
  font-size: clamp(0.7rem, 1vw, 0.875rem);
  line-height: 1.5;
  color: #B8B8CC;
  padding: 1.25rem 1.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre;
}

.evolution__title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.evolution__text {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: #CDCDE0;
  line-height: 1.7;
  max-width: 560px;
}

/* ===== SKILLS ===== */
#skills {
  padding: var(--section-padding) 0;
}

#skills .section__title {
  margin-bottom: 4rem;
}

.skills__stack {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.skills__band {
  display: flex;
  align-items: center;
  gap: 2rem;
  opacity: 0;
  transform: translateY(20px);
}

.skills__band.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.skills__label {
  flex-shrink: 0;
  width: 120px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9898B0;
  text-align: right;
}

.skills__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.pill {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #D0D0E2;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  cursor: default;
}

.pill:hover {
  color: var(--accent);
  border-color: rgba(10, 132, 255, 0.3);
  box-shadow: var(--glow-card);
}

/* ===== EXPERIENCE ===== */
#experience {
  padding: var(--section-padding) 0;
}

#experience .section__title {
  margin-bottom: 4rem;
}

.experience__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.experience__card {
  padding: 2rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.experience__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow-card);
}

.experience__date {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.experience__company {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.experience__role {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.experience__metrics {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.experience__metrics li {
  font-size: 0.875rem;
  color: #CDCDE0;
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.experience__metrics li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.experience__metrics strong {
  color: var(--highlight);
  font-weight: 600;
}

/* ===== ACHIEVEMENTS ===== */
#achievements {
  padding: clamp(3rem, 6vh, 5rem) 0;
}

.achievements__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.achievements__item {
  text-align: center;
}

.achievements__value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--highlight);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.achievements__label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.achievements__divider {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
}

/* ===== PORTFOLIO ===== */
#portfolio {
  padding: var(--section-padding) 0;
}

#portfolio .section__title {
  margin-bottom: 4rem;
}

.portfolio__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.portfolio__card {
  padding: 2rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow-card);
}

.portfolio__name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.portfolio__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.portfolio__techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pill--sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

/* ===== CONTACT SOCIALS ===== */
.contact__socials {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
}

.contact__socials a {
  color: var(--text-muted);
  transition: color 0.25s ease;
}

.contact__socials a:hover {
  color: var(--text-primary);
}

/* ===== SERVICES ===== */
#services {
  padding: var(--section-padding) 0;
}

#services .section__title {
  margin-bottom: 4rem;
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.service__card {
  padding: 2.5rem 2rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  border-top: 2px solid transparent;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.service__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow-card);
}

.service__card:hover::before {
  transform: scaleX(1);
}

.service__number {
  font-size: 2rem;
  font-weight: 400;
  color: var(--highlight);
  display: block;
  margin-bottom: 1rem;
  line-height: 1;
}

.service__name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.service__desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ===== CONTACT ===== */
#contact {
  padding: var(--section-padding) 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.contact__inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.contact__headline {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.contact__sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.contact__actions {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.contact__book {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg-void);
  background: var(--accent);
  border-radius: 9999px;
  transition: background 0.25s ease, gap 0.25s ease, transform 0.25s ease;
}

.contact__book:hover {
  background: var(--accent-hover);
  gap: 0.75rem;
  transform: translateY(-2px);
}

.contact__book .arrow {
  transition: transform 0.25s ease;
}

.contact__book:hover .arrow {
  transform: translateX(4px);
}

.contact__email {
  font-size: clamp(1rem, 2vw, 1.375rem);
  color: var(--accent);
  font-weight: 600;
  position: relative;
  padding-bottom: 2px;
}

.contact__email::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.contact__email:hover::after {
  width: 100%;
}

/* ===== FOOTER ===== */
footer {
  padding: 2rem var(--container-padding);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

/* ===== REVEAL ANIMATION CLASSES ===== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .experience__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .experience__grid .experience__card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    margin: 0 auto;
  }

  .portfolio__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
  }

  .nav__links.open {
    display: flex;
  }

  .nav__hamburger {
    display: flex;
  }

  /* -- Evolution: completely reworked for mobile -- */
  #evolution {
    height: auto;
    padding: var(--section-padding) 0;
  }

  .evolution__sticky {
    position: relative;
    height: auto;
    flex-direction: column;
    padding-top: 0;
    gap: 0;
  }

  .evolution__progress {
    display: none;
  }

  .evolution__content {
    margin-left: 0;
    height: auto;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-inline: var(--container-padding);
  }

  .evolution__chapter {
    position: relative;
    inset: auto;
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    transition: none;
  }

  .evolution__chapter::before {
    content: attr(data-year);
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
  }

  .evolution__chapter[data-chapter="1"]::before { content: "2013"; }
  .evolution__chapter[data-chapter="2"]::before { content: "2020"; }
  .evolution__chapter[data-chapter="3"]::before { content: "2022"; }
  .evolution__chapter[data-chapter="4"]::before { content: "2026"; }

  .evolution__code pre {
    font-size: 0.7rem;
    padding: 1rem;
  }

  .evolution__title {
    font-size: 1.375rem;
  }

  .evolution__text {
    font-size: 0.9375rem;
  }

  /* -- Skills: tighter mobile layout -- */
  .skills__band {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }

  .skills__label {
    text-align: left;
    width: auto;
    font-size: 0.6875rem;
  }

  .skills__pills {
    gap: 0.5rem;
  }

  .pill {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .skills__stack {
    gap: 1.5rem;
  }

  #skills .section__title {
    margin-bottom: 2.5rem;
  }

  /* -- Experience -- */
  .experience__grid {
    grid-template-columns: 1fr;
  }

  .experience__grid .experience__card:last-child {
    max-width: 100%;
  }

  #experience .section__title {
    margin-bottom: 2.5rem;
  }

  /* -- Achievements -- */
  .achievements__row {
    gap: 2rem;
  }

  .achievements__divider {
    display: none;
  }

  /* -- Portfolio -- */
  .portfolio__grid {
    grid-template-columns: 1fr;
  }

  #portfolio .section__title {
    margin-bottom: 2.5rem;
  }

  .section__subtitle {
    margin-bottom: 2.5rem;
  }

  /* -- Services -- */
  .services__grid {
    grid-template-columns: 1fr;
  }

  #services .section__title {
    margin-bottom: 2.5rem;
  }

  /* -- Contact -- */
  .contact__actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero__name {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero__summary {
    font-size: 1rem;
  }

  .evolution__code pre {
    font-size: 0.6rem;
    padding: 0.75rem;
    border-radius: 8px;
  }

  .experience__card {
    padding: 1.5rem 1.25rem;
  }

  .portfolio__card {
    padding: 1.5rem 1.25rem;
  }

  .service__card {
    padding: 1.75rem 1.5rem;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .reveal,
  .skills__band,
  .experience__card,
  .evolution__chapter {
    opacity: 1 !important;
    transform: none !important;
  }
}
