:root {
  --bg: #0b0d10;
  --bg-soft: #11151a;
  --text: #e8ecf1;
  --text-dim: #8b95a5;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --card: rgba(255, 255, 255, 0.03);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-soft: #ffffff;
  --text: #14181f;
  --text-dim: #5a6472;
  --line: rgba(0, 0, 0, 0.09);
  --card: rgba(255, 255, 255, 0.7);
  --shadow: 0 20px 50px rgba(20, 24, 31, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(700px circle at 15% -5%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(600px circle at 90% 10%, rgba(34, 211, 238, 0.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

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

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

.cursor-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.12), transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 64px);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, padding 0.4s ease, background 0.5s ease;
}

.nav.scrolled {
  border-bottom-color: var(--line);
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

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

.nav-links {
  display: flex;
  gap: clamp(18px, 3vw, 40px);
  font-size: 0.92rem;
  color: var(--text-dim);
}

.nav-links a {
  position: relative;
  transition: color 0.25s ease;
  padding: 4px 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a:hover::after {
  width: 100%;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg) scale(1.05);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-moon {
  display: none;
}

html[data-theme="light"] .icon-sun {
  display: none;
}

html[data-theme="light"] .icon-moon {
  display: block;
}

/* ---------- Layout ---------- */
main {
  position: relative;
  z-index: 2;
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(70px, 11vw, 140px) clamp(20px, 5vw, 40px);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.section-index {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

.hero-eyebrow {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(3rem, 11vw, 7rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, var(--text) 20%, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 14px;
}

.hero-sub {
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  color: var(--text-dim);
  font-weight: 400;
  margin-bottom: 26px;
}

.hero-sub .dot {
  color: var(--accent);
  margin: 0 4px;
}

.hero-desc {
  max-width: 560px;
  color: var(--text-dim);
  font-size: 1.02rem;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 30px;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: transform 0.25s var(--ease), box-shadow 0.3s ease, background 0.3s ease;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #a78bfa);
  color: #fff;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(124, 92, 255, 0.5);
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card);
}

.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: clamp(20px, 5vw, 40px);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.scroll-line {
  width: 60px;
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--accent);
  animation: slide 2s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.about-text p {
  color: var(--text-dim);
  margin-bottom: 18px;
  font-size: 1.03rem;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat {
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
  transition: transform 0.3s var(--ease), border-color 0.3s ease;
}

.stat:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.4);
}

.stat-num {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ---------- Work ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(20px, 3vw, 30px);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  transition: transform 0.4s var(--ease), border-color 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-8px);
  border-color: rgba(124, 92, 255, 0.45);
  box-shadow: var(--shadow);
}

.card-thumb {
  position: relative;
  height: 200px;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  overflow: hidden;
}

.card-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.9;
  transition: transform 0.6s var(--ease), opacity 0.4s ease;
}

.card:hover .card-thumb::before {
  transform: scale(1.08);
}

.thumb-1::before {
  background: linear-gradient(135deg, #7c5cff, #22d3ee);
}
.thumb-2::before {
  background: linear-gradient(135deg, #ff6b9d, #ffa14a);
}
.thumb-3::before {
  background: linear-gradient(135deg, #0ea5e9, #2dd4bf);
}
.thumb-4::before {
  background: linear-gradient(135deg, #a78bfa, #ec4899);
}

.thumb-tag {
  position: relative;
  z-index: 2;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  backdrop-filter: blur(6px);
}

.card-body {
  padding: 22px 24px 26px;
}

.card-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-body p {
  color: var(--text-dim);
  font-size: 0.93rem;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 30px);
}

.skill-group {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.35s ease, transform 0.35s var(--ease);
}

.skill-group:hover {
  border-color: rgba(34, 211, 238, 0.45);
  transform: translateY(-5px);
}

.skill-group h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.skill-group ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-group li {
  font-size: 0.86rem;
  color: var(--text-dim);
  padding: 7px 15px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.skill-group li:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
}

.contact-inner {
  padding: clamp(40px, 7vw, 80px) 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.contact-eyebrow {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  margin-bottom: 16px;
}

.contact h2 {
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 30px;
}

.contact-mail {
  display: inline-block;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--accent);
  transition: color 0.3s ease, letter-spacing 0.3s var(--ease);
}

.contact-mail:hover {
  color: var(--accent);
  letter-spacing: 0.02em;
}

.socials {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 34px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.socials a {
  transition: color 0.25s ease, transform 0.25s ease;
}

.socials a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px clamp(20px, 5vw, 40px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .work-grid {
    grid-template-columns: 1fr;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .nav-links {
    display: none;
  }
  .scroll-hint {
    display: none;
  }
  .footer {
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
