/* ============ Design tokens ============ */
:root {
  --bg: #0a0a0a;
  --bg-alt: #111111;
  --card: #151515;
  --glass: rgba(21, 21, 21, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-dim: #9b9b9b;
  --accent: #ff5a00;
  --accent-hover: #e64f00;
  --accent-dim: rgba(255, 90, 0, 0.12);
  --glow: 0 0 24px rgba(255, 90, 0, 0.25);
  --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.8);
  --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --nav-h: 72px;
  --radius: 6px;
  --transition: 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #fff;
}

h1, h2, h3 {
  color: var(--text);
  line-height: 1.2;
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: none;
}

ul {
  list-style: none;
}

strong {
  color: var(--text);
  font-weight: 600;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

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

/* ============ Cyberspace background scene ============ */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.bg-scene__nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}

.bg-scene__nebula--red {
  width: 55vw;
  height: 55vw;
  top: -18%;
  right: -12%;
  background: radial-gradient(circle, rgba(255, 60, 10, 0.22) 0%, transparent 65%);
}

.bg-scene__nebula--blue {
  width: 60vw;
  height: 60vw;
  bottom: -22%;
  left: -16%;
  background: radial-gradient(circle, rgba(40, 90, 255, 0.14) 0%, transparent 65%);
}

.bg-scene__grid {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(55deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(-55deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 130px);
}

.bg-scene__shards {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.shard polygon {
  fill: rgba(255, 48, 16, 0.1);
  stroke: rgba(255, 90, 0, 0.45);
  stroke-width: 1.5;
}

.shard {
  filter: drop-shadow(0 0 8px rgba(255, 60, 10, 0.55));
  transform-origin: center;
  transform-box: fill-box;
}

.shard--1 { animation: shardFloat 26s ease-in-out infinite alternate; }
.shard--2 { animation: shardFloat 32s ease-in-out infinite alternate-reverse; }
.shard--3 { animation: shardFloat 22s ease-in-out infinite alternate; animation-delay: -8s; }
.shard--4 { animation: shardFloat 36s ease-in-out infinite alternate-reverse; animation-delay: -14s; }
.shard--5 { animation: shardFloat 28s ease-in-out infinite alternate; animation-delay: -5s; }

@keyframes shardFloat {
  from { transform: translate(0, 0) rotate(-4deg); }
  to { transform: translate(18px, -26px) rotate(5deg); }
}

.bg-scene__particle {
  fill: rgba(255, 120, 60, 0.8);
  animation: particlePulse 4s ease-in-out infinite;
}

.bg-scene__particle.p2 { animation-delay: -1s; fill: rgba(120, 160, 255, 0.7); }
.bg-scene__particle.p3 { animation-delay: -2s; }
.bg-scene__particle.p4 { animation-delay: -0.5s; fill: rgba(120, 160, 255, 0.6); }
.bg-scene__particle.p5 { animation-delay: -3s; }
.bg-scene__particle.p6 { animation-delay: -1.7s; }

@keyframes particlePulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.9; }
}

.bg-scene__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  padding: 14px 30px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    transform var(--transition), box-shadow var(--transition);
}

.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

.btn--ghost:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn--small {
  padding: 9px 20px;
  font-size: 13px;
}

.btn--large {
  padding: 17px 42px;
  font-size: 15px;
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  transition: box-shadow var(--transition);
}

.nav--scrolled {
  box-shadow: var(--shadow);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__links a:not(.btn) {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

.nav__links a:not(.btn):hover {
  color: var(--accent);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 110;
}

.nav__toggle span {
  width: 26px;
  height: 2px;
  background: var(--accent);
  transition: transform var(--transition), opacity var(--transition);
}

.nav__toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav__toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ============ Hero ============ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 40px) 0 60px;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  background: var(--accent);
  z-index: -1;
}

.hero::before {
  width: 220px;
  height: 220px;
  top: -60px;
  right: -60px;
  opacity: 0.9;
}

.hero::after {
  width: 140px;
  height: 280px;
  bottom: 10%;
  left: -90px;
  opacity: 0.85;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero__chip {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 800;
}

.hero__subtitle {
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 10px;
}

.hero__desc {
  max-width: 520px;
  margin-top: 24px;
  font-size: 16px;
}

.hero__cta {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero__visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero__lines {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: rotate(-2deg) scale(1); }
  to { transform: rotate(2deg) scale(1.04); }
}

.hero__frame {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--glow), var(--shadow);
  border: 1px solid var(--glass-border);
}

.hero__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0) 55%, rgba(10, 10, 10, 0.55) 100%);
  pointer-events: none;
}

.hero__portrait {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  filter: saturate(0.85) contrast(1.05);
}

.hero__scroll {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ============ Stats band ============ */
.stats {
  padding: 40px 0 90px;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat strong {
  display: block;
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stat span {
  font-size: 13px;
  color: var(--text-dim);
}

.stat--highlight {
  background: var(--accent);
  border-color: var(--accent);
}

.stat--highlight strong,
.stat--highlight span {
  color: #fff;
}

/* ============ Sections ============ */
.section {
  padding: 100px 0;
}

.section--alt {
  background: rgba(17, 17, 17, 0.72);
}

.section__title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 800;
  text-align: center;
  margin-bottom: 56px;
}

.section__title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* ============ About ============ */
.about__grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 48px;
  align-items: start;
}

.about__text p + p {
  margin-top: 16px;
}

.about__list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  font-size: 13.5px;
}

.about__list li::before {
  content: "▸ ";
  color: var(--accent);
}

.about__card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.about__avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--accent);
}

.about__loc {
  font-size: 13px;
  margin: 6px 0 24px;
}

.about__stats {
  display: grid;
  gap: 16px;
  text-align: left;
}

.about__stats div {
  display: flex;
  flex-direction: column;
}

.about__stats span {
  font-size: 13px;
}

/* ============ Services ============ */
.services__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.service-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.service-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.service-card__icon {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.service-card h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.service-card p {
  font-size: 13.5px;
}

/* ============ Skills ============ */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-card {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.skill-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.skill-card__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.skill-card h3 {
  margin-bottom: 16px;
  font-size: 20px;
}

.skill-card ul {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.skill-card li::before {
  content: "▸ ";
  color: var(--accent);
}

/* ============ Portfolio filters ============ */
.filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition),
    background var(--transition);
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============ Projects ============ */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.project.hidden {
  display: none;
}

.project:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.project--featured {
  background: var(--accent);
  border-color: var(--accent);
}

.project--featured h3,
.project--featured p,
.project--featured .project__tags,
.project--featured .project__links a {
  color: #fff;
}

.project--featured:hover {
  box-shadow: 0 0 34px rgba(255, 90, 0, 0.45);
}

.project__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.project__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.92);
  padding: 5px;
}

.timeline__logo {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  object-fit: contain;
  vertical-align: -4px;
  margin-right: 6px;
  background: rgba(255, 255, 255, 0.92);
}

.project__links a {
  font-size: 20px;
  color: var(--text-dim);
  transition: color var(--transition);
}

.project__links a:hover {
  color: var(--accent);
}

.project h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.project__star {
  font-size: 12px;
  color: var(--accent);
}

.project--featured .project__star {
  color: #fff;
}

.project p {
  font-size: 14px;
  flex: 1;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--accent);
}

/* ============ Experience timeline ============ */
.timeline {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding-left: 36px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(255, 90, 0, 0.35);
}

.timeline__item {
  position: relative;
  padding-bottom: 44px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: -36px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 10px rgba(255, 90, 0, 0.4);
}

.timeline__date {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
}

.timeline__item h3 {
  font-size: 19px;
  margin-bottom: 8px;
}

/* ============ Freelance CTA band ============ */
.cta-band {
  background: linear-gradient(135deg, #131313 0%, #1c1208 60%, #2a1505 100%);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}

.cta-band::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 0, 0.22) 0%, transparent 70%);
  top: -120px;
  right: -80px;
}

.cta-band__inner {
  text-align: center;
}

.cta-band h2 {
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 800;
}

.cta-band p {
  margin: 14px 0 32px;
}

/* ============ Contact ============ */
.contact__inner {
  max-width: 680px;
  text-align: center;
}

.contact__title {
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 800;
  margin: 12px 0 20px;
}

.contact__desc {
  margin-bottom: 40px;
}

.contact__links {
  margin-top: 48px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 22px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  min-width: 220px;
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.contact__link:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.contact__link-label {
  font-size: 12px;
  color: var(--accent);
}

.contact__link-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

/* ============ Footer ============ */
.footer {
  padding: 32px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 17, 17, 0.85);
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer__socials {
  display: flex;
  gap: 24px;
}

.footer__socials a {
  color: var(--text-dim);
  font-size: 14px;
  transition: color var(--transition);
}

.footer__socials a:hover {
  color: var(--accent);
}

.footer__credit {
  font-size: 12px;
}

/* ============ Reveal animation ============ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero__scroll,
  .hero__lines {
    animation: none;
  }
  .project {
    animation: none;
  }
  .shard,
  .bg-scene__particle {
    animation: none;
  }
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .skills__grid,
  .projects__grid,
  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .about__card {
    max-width: 420px;
  }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero__visual {
    order: -1;
  }

  .hero__portrait {
    max-width: 300px;
  }
}

@media (max-width: 768px) {
  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: fixed;
    inset: 0 0 0 30%;
    background: var(--bg-alt);
    flex-direction: column;
    justify-content: center;
    gap: 36px;
    transform: translateX(100%);
    transition: transform var(--transition);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  }

  .nav__links.open {
    transform: translateX(0);
  }

  .section {
    padding: 80px 0;
  }

  .hero::before,
  .hero::after {
    display: none;
  }
}

@media (max-width: 560px) {
  .skills__grid,
  .projects__grid,
  .services__grid,
  .stats__grid {
    grid-template-columns: 1fr;
  }

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

  body {
    font-size: 15px;
  }

  .hero__portrait {
    max-width: 240px;
  }
}
