:root {
  --bg: #09090b;
  --bg-elevated: rgba(24, 24, 27, 0.56);
  --bg-elevated-hover: rgba(32, 32, 37, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-soft: #71717a;
  --accent-1: #38bdf8;
  --accent-2: #34d399;
  --btn-primary-bg: #fafafa;
  --btn-primary-text: #09090b;
  --spotlight: rgba(56, 189, 248, 0.14);
  --nav-bg: rgba(9, 9, 11, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --bg-elevated-hover: rgba(255, 255, 255, 0.96);
  --border: rgba(9, 9, 11, 0.09);
  --border-strong: rgba(9, 9, 11, 0.18);
  --text: #09090b;
  --text-muted: #52525b;
  --text-soft: #71717a;
  --accent-1: #0284c7;
  --accent-2: #059669;
  --btn-primary-bg: #09090b;
  --btn-primary-text: #fafafa;
  --spotlight: rgba(2, 132, 199, 0.1);
  --nav-bg: rgba(250, 250, 250, 0.78);
  --shadow: 0 20px 50px rgba(9, 9, 11, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out);
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* Ambient Layers */
#ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  pointer-events: none;
  opacity: 0.75;
}

.ambient-glow {
  position: fixed;
  border-radius: 9999px;
  filter: blur(110px);
  z-index: -2;
  pointer-events: none;
  opacity: 0.22;
  animation: floatSlow 18s ease-in-out infinite alternate;
}

.ambient-glow-1 {
  width: 44vw;
  height: 44vw;
  max-width: 560px;
  max-height: 560px;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, var(--accent-1), transparent 70%);
}

.ambient-glow-2 {
  width: 38vw;
  height: 38vw;
  max-width: 480px;
  max-height: 480px;
  bottom: -10%;
  right: -8%;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  animation-delay: -9s;
}

@keyframes floatSlow {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(32px, 24px, 0) scale(1.08);
  }
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  z-index: 100;
  transition: width 0.08s linear;
}

.container {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* Navbar */
.navbar-wrap {
  position: fixed;
  top: 1rem;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding-inline: 1rem;
  pointer-events: none;
}

.navbar {
  pointer-events: auto;
  width: min(1080px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 9999px;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, background-color 0.35s ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #09090b;
}

.brand-name {
  font-size: 0.92rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(128, 128, 138, 0.12);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-out);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

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

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 7.5rem;
  padding-bottom: 4rem;
}

.hero-inner {
  max-width: 780px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.9rem;
  border-radius: 9999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--accent-2);
  flex-shrink: 0;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  border: 1.5px solid var(--accent-2);
  animation: pulseRing 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.pulse-dot-sm {
  width: 7px;
  height: 7px;
}

@keyframes pulseRing {
  0% {
    transform: scale(0.75);
    opacity: 0.85;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 6.2vw, 4.4rem);
  line-height: 1.07;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.hero-title span {
  display: block;
}

.gradient-text {
  background: linear-gradient(110deg, var(--text) 15%, var(--accent-1) 60%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 1.5rem 0 0;
  max-width: 62ch;
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.82rem 1.35rem;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.25s ease, background-color 0.25s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s var(--ease-out);
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.18);
}

.btn-primary:hover svg {
  transform: translateX(3px);
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated-hover);
  transform: translateY(-2px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.35rem;
  margin-top: 3.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  color: var(--text-soft);
}

.meta-val {
  font-size: 0.9rem;
  font-weight: 600;
}

.meta-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.scroll-cue {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 40px;
  display: flex;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.scroll-cue:hover {
  opacity: 1;
}

.scroll-line {
  width: 1.5px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, var(--text-muted), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%, 100% {
    transform: translateY(-5px);
    opacity: 0.3;
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
}

/* Hero initial staggered animation */
.hero-reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: heroIn 0.85s var(--ease-out) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes heroIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sections */
.section {
  padding-block: 5.25rem;
}

.section-header {
  margin-bottom: 2.25rem;
}

.section-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.section-kicker {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent-1);
  margin-bottom: 0.55rem;
}

.section-title {
  margin: 0;
  font-size: clamp(1.7rem, 3.6vw, 2.45rem);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.glass-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.25s ease, transform 0.35s var(--ease-out), background-color 0.25s ease;
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), var(--spotlight), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.spotlight-card:hover::before {
  opacity: 1;
}

.spotlight-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.25rem;
}

.about-copy {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.1rem;
}

.about-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
}

.bento-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
}

.stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, var(--text), var(--accent-1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.stat-wide {
  grid-column: span 2;
}

.stat-wide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-tag {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}

.stat-wide-text {
  margin: 0.5rem 0 0;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Projects */
.filter-bar {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 9999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.filter-btn {
  padding: 0.42rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.filter-btn.active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.project-card {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.project-card.is-hidden {
  display: none;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
}

.badge-live .badge-dot {
  background: #34d399;
}

.badge-game .badge-dot {
  background: #38bdf8;
}

.badge-web .badge-dot {
  background: #f59e0b;
}

.project-year {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.project-body {
  flex: 1;
}

.project-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-desc {
  margin: 0.65rem 0 0;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.24rem 0.62rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(128, 128, 138, 0.1);
  border: 1px solid var(--border);
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}

.link-pill:hover {
  color: var(--accent-1);
}

.link-pill svg {
  width: 13px;
  height: 13px;
}

.detail-btn {
  padding: 0.35rem 0.78rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.detail-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Stack */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.stack-group {
  padding: 1.6rem;
}

.stack-cat {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.stack-items span {
  padding: 0.42rem 0.85rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  background: rgba(128, 128, 138, 0.08);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, transform 0.2s var(--ease-out);
}

.stack-items span:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* Contact */
.contact-section {
  padding-bottom: 4rem;
}

.contact-card {
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

.contact-title {
  margin: 0.4rem 0 0;
  font-size: clamp(1.7rem, 3.8vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.contact-desc {
  margin: 0.9rem auto 0;
  max-width: 50ch;
  color: var(--text-muted);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 2rem;
}

/* Footer */
.footer {
  padding-bottom: 2.5rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-soft);
}

.footer-copy {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

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

/* Scroll Reveal */
html.js-anim .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s var(--ease-out), transform 0.75s var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

html.js-anim .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  padding: 1.85rem;
  animation: modalPop 0.3s var(--ease-out);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent-1);
}

.modal-title {
  margin: 0.25rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-summary {
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.68;
}

.modal-highlights {
  margin: 0 0 1.4rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 0.65rem 1.15rem;
  border-radius: 9999px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  z-index: 120;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 920px) {
  .about-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .nav-links {
    display: none;
  }

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

  .meta-divider {
    display: none;
  }

  .hero-meta {
    gap: 1rem 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-reveal,
  .reveal,
  .ambient-glow,
  .pulse-dot::after,
  .scroll-line {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

