:root {
  color-scheme: light;
  --cursor-x: 50%;
  --cursor-y: 26%;
  --bg: #f3f9ff;
  --surface: #ffffff;
  --surface-muted: #eaf5ff;
  --ink: #18324a;
  --text: #3b5770;
  --muted: #6f889f;
  --accent: #8ecae6;
  --accent-strong: #3f8fb7;
  --accent-soft: #dff3ff;
  --border: #cfe6f6;
  --shadow: 0 14px 34px rgba(80, 143, 181, 0.12);
  --radius: 8px;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(190, 229, 255, 0.7), transparent 34%),
    radial-gradient(circle at 85% 18%, rgba(213, 240, 255, 0.8), transparent 28%),
    var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
}

.ambient-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-background::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(63, 143, 183, 0.34) 0, transparent 10rem),
    radial-gradient(circle at calc(var(--cursor-x) + 5%) calc(var(--cursor-y) + 4%), rgba(255, 255, 255, 0.58) 0, transparent 6.5rem),
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.24) 46%, transparent 54%),
    linear-gradient(rgba(63, 143, 183, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 143, 183, 0.07) 1px, transparent 1px);
  background-size: auto, auto, 180% 180%, 64px 64px, 64px 64px;
  background-position: center, center, 0% 50%, 0 0, 0 0;
  mix-blend-mode: multiply;
  opacity: 0.9;
  transform: translate3d(0, 0, 0);
  animation: backgroundDrift 28s ease-in-out infinite alternate;
}

.ambient-blob {
  position: absolute;
  display: block;
  width: clamp(220px, 26vw, 420px);
  aspect-ratio: 1;
  border-radius: 45% 55% 62% 38% / 52% 38% 62% 48%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.58), rgba(142, 202, 230, 0.28) 42%, rgba(63, 143, 183, 0.08) 72%, transparent 76%);
  filter: blur(12px);
  opacity: 0.58;
  mix-blend-mode: multiply;
  transform: translate3d(0, 0, 0);
}

.blob-a {
  left: 6%;
  top: 12%;
  animation: lavaBlobA 32s ease-in-out infinite alternate;
}

.blob-b {
  right: 8%;
  top: 18%;
  width: clamp(180px, 22vw, 340px);
  opacity: 0.48;
  animation: lavaBlobB 38s ease-in-out infinite alternate;
}

.blob-c {
  left: 38%;
  bottom: 4%;
  width: clamp(240px, 30vw, 460px);
  opacity: 0.42;
  animation: lavaBlobC 44s ease-in-out infinite alternate;
}

.blob-d {
  right: -4%;
  bottom: 16%;
  width: clamp(170px, 18vw, 300px);
  opacity: 0.38;
  animation: lavaBlobD 36s ease-in-out infinite alternate;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px max(24px, calc((100vw - var(--max-width)) / 2));
  background: rgba(243, 249, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.82rem;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.94rem;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.resume-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(80, 143, 181, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.resume-link:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.resume-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero,
.section,
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.hero {
  position: relative;
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 48px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 72px;
}

.hero-copy {
  max-width: 860px;
}

.hero-game {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.game-stage {
  position: relative;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
}

.hero-game canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1.28;
  min-height: 320px;
  cursor: pointer;
  outline: none;
}

.hero-game canvas:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.game-restart {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  transform: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(63, 143, 183, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-strong);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(80, 143, 181, 0.1);
}

.game-restart svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-stage.game-ended .game-restart {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, 34px);
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-color: var(--accent);
}

.game-restart:hover {
  background: #ffffff;
  border-color: var(--accent);
}

.game-input {
  padding: 10px 14px;
  border-top: 1px solid rgba(63, 143, 183, 0.16);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 750;
  text-align: center;
}

.hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: capitalize;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-weight: 750;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  margin: 28px 0 0;
  color: var(--text);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  font-weight: 700;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #10334a;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(63, 143, 183, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(80, 143, 181, 0.08);
  transform: translateX(-50%);
  overflow: hidden;
}

.scroll-cue::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  border: 1px solid rgba(63, 143, 183, 0.18);
  animation: scrollCuePulse 2.2s ease-in-out infinite;
}

.scroll-cue svg {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: scrollCueFlow 1.6s ease-in-out infinite;
}

.scroll-cue:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--ink);
}

@keyframes backgroundDrift {
  from {
    background-position: center, center, 0% 50%, 0 0, 0 0;
  }

  to {
    background-position: center, center, 100% 50%, 64px 36px, 64px 36px;
  }
}

@keyframes scrollCueFlow {
  0%, 100% {
    opacity: 0.68;
    transform: translateY(-3px);
  }

  50% {
    opacity: 1;
    transform: translateY(4px);
  }
}

@keyframes scrollCuePulse {
  0%, 100% {
    opacity: 0.8;
    transform: scale(0.86);
  }

  50% {
    opacity: 0.2;
    transform: scale(1.22);
  }
}

@keyframes lavaBlobA {
  0% {
    border-radius: 45% 55% 62% 38% / 52% 38% 62% 48%;
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    border-radius: 58% 42% 46% 54% / 38% 56% 44% 62%;
    transform: translate3d(12vw, 18vh, 0) scale(1.12);
  }
}

@keyframes lavaBlobB {
  0% {
    border-radius: 52% 48% 40% 60% / 44% 58% 42% 56%;
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    border-radius: 40% 60% 58% 42% / 60% 38% 62% 40%;
    transform: translate3d(-14vw, 24vh, 0) scale(1.16);
  }
}

@keyframes lavaBlobC {
  0% {
    border-radius: 48% 52% 58% 42% / 62% 44% 56% 38%;
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    border-radius: 62% 38% 44% 56% / 46% 62% 38% 54%;
    transform: translate3d(-10vw, -24vh, 0) scale(0.92);
  }
}

@keyframes lavaBlobD {
  0% {
    border-radius: 54% 46% 64% 36% / 42% 62% 38% 58%;
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    border-radius: 38% 62% 42% 58% / 60% 40% 58% 42%;
    transform: translate3d(-18vw, -12vh, 0) scale(1.18);
  }
}

.section {
  padding-top: 84px;
  padding-bottom: 84px;
}

.section.muted {
  max-width: none;
}

.section.muted > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.section-heading {
  margin-bottom: 34px;
}

.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  text-transform: capitalize;
}

.timeline {
  display: grid;
  gap: 16px;
}

.card,
.skill-block {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card::before,
.skill-block::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 38%, rgba(142, 202, 230, 0.18) 48%, transparent 58%);
  opacity: 0;
  transform: translateX(-120%);
  transition: opacity 0.22s ease, transform 0.5s ease;
}

.card {
  padding: 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.skill-block {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.card:hover,
.skill-block:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: var(--accent);
  box-shadow: 0 18px 44px rgba(80, 143, 181, 0.18);
  transform: translateY(-4px);
}

.card:hover::before,
.skill-block:hover::before {
  opacity: 1;
  transform: translateX(120%);
}

.card > *,
.skill-block > * {
  position: relative;
  z-index: 1;
}

.card h3,
.skill-block h3 {
  margin: 0;
  color: var(--ink);
  text-transform: capitalize;
}

.card p,
.skill-block p {
  margin: 12px 0 0;
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.card-top span {
  color: var(--muted);
  font-size: 0.94rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.tags li {
  padding: 5px 10px;
  border-radius: var(--radius);
  background: #e5f6ff;
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.project-grid,
.skills-grid,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.compact {
  min-height: 210px;
}

.compact a {
  display: inline-block;
  margin-top: 18px;
  font-weight: 750;
}

.skill-block {
  padding: 22px;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

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

.contact-section {
  text-align: center;
}

.contact-grid {
  max-width: 420px;
  margin: 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contact-grid a {
  display: grid;
  place-items: center;
  width: 64px;
  min-height: 64px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 750;
  color: var(--accent-strong);
  justify-self: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.contact-grid a:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.contact-grid svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 28px;
  padding-bottom: 28px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.site-footer > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.footer-note {
  font-size: 0.88rem;
}

.footer-socials {
  display: flex;
  gap: 8px;
}

.footer-socials a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-strong);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.footer-socials a:hover {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-2px);
}

.footer-socials svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .project-grid,
  .skills-grid,
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 100px;
  }

  .site-header {
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 16px;
    gap: 8px;
  }

  /* Dissolve the wrapper so brand, resume, and nav sit in the same flex context */
  .header-actions {
    display: contents;
  }

  /* Brand stays left on row 1 and stretches to push Resume to the right */
  .brand {
    flex: 1;
  }

  /* Resume stays on row 1, pinned to the right */
  .resume-link {
    order: 2;
  }

  /* Nav fills row 2 as a scrollable strip — no wrapping, no overflow */
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px;
    padding-bottom: 2px;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.88rem;
  }

  .hero,
  .section,
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero {
    padding-top: 56px;
    padding-bottom: 78px;
  }

  .section {
    padding-top: 60px;
    padding-bottom: 60px;
  }

  .project-grid,
  .skills-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-background::before,
  .ambient-blob,
  .card,
  .card::before,
  .reveal,
  .resume-link,
  .skill-block,
  .skill-block::before,
  .scroll-cue,
  .scroll-cue::before,
  .scroll-cue svg {
    animation: none;
    transition: none;
  }

  .card:hover,
  .skill-block:hover,
  .resume-link:hover {
    transform: none;
  }

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

  .card:hover::before,
  .skill-block:hover::before {
    opacity: 0;
  }

  .ambient-background::before {
    background:
      radial-gradient(circle at 50% 24%, rgba(142, 202, 230, 0.22) 0, transparent 18rem),
      linear-gradient(rgba(63, 143, 183, 0.06) 1px, transparent 1px),
      linear-gradient(90deg, rgba(63, 143, 183, 0.05) 1px, transparent 1px);
    background-size: auto, 64px 64px, 64px 64px;
  }

  .ambient-blob {
    opacity: 0.24;
  }
}
