:root {
  --bg: #0b1424;
  --bg2: #0e1a2e;
  --line: #182742;
  --cyan: #22d3ee;
  --teal: #2dd4bf;
  --violet: #a78bfa;
  --pink: #f472b6;
  --gold: #f4a259;
  --text: #e6edf3;
  --muted: #8b98a9;
  --radius: 14px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: rgba(34, 211, 238, .25); }

a { color: inherit; }

#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .8;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(11, 20, 36, .72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 800; letter-spacing: 2px; text-decoration: none; font-size: 1.05rem; }
.brand span { color: var(--cyan); }

.nav .links { display: flex; gap: 1.4rem; align-items: center; }
.nav .links a { text-decoration: none; color: var(--muted); font-size: .92rem; transition: color .2s; }
.nav .links a:hover { color: var(--text); }
.nav .links a.cta {
  color: var(--bg);
  background: var(--cyan);
  padding: .4rem 1rem;
  border-radius: 999px;
  font-weight: 600;
}
.nav .links a.cta:hover { background: var(--teal); color: var(--bg); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  background: var(--bg);
  overflow: hidden;
}

/* animated aurora blobs */
.aurora { position: absolute; inset: 0; overflow: hidden; }
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .45;
  animation: drift 20s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) {
  width: 44vw; height: 44vw; left: -10vw; top: -12vw;
  background: radial-gradient(circle, rgba(34, 211, 238, .55), transparent 70%);
}
.aurora span:nth-child(2) {
  width: 38vw; height: 38vw; right: -8vw; top: 22vh;
  background: radial-gradient(circle, rgba(167, 139, 250, .5), transparent 70%);
  animation-delay: -7s; animation-duration: 24s;
}
.aurora span:nth-child(3) {
  width: 30vw; height: 30vw; left: 30vw; bottom: -14vw;
  background: radial-gradient(circle, rgba(244, 114, 182, .4), transparent 70%);
  animation-delay: -13s; animation-duration: 28s;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vw, -4vh) scale(1.15); }
}
.hero-inner { position: relative; z-index: 2; max-width: 720px; }

.kicker {
  color: var(--muted);
  letter-spacing: 3px;
  font-size: .85rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.jp {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  color: var(--cyan);
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(3rem, 10vw, 5.5rem);
  letter-spacing: .35em;
  text-indent: .35em;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(244, 162, 89, .15);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background: linear-gradient(180deg, #ffe9c4, var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.typing {
  margin-top: 1rem;
  font-size: 1.25rem;
  color: var(--cyan);
  min-height: 2rem;
  font-weight: 500;
}
.caret { animation: blink 1s steps(1) infinite; color: var(--cyan); }
@keyframes blink { 50% { opacity: 0; } }

.lede { color: var(--muted); margin: 1.2rem auto 2rem; max-width: 560px; font-size: 1.05rem; }
.lede strong { color: var(--text); font-weight: 600; }

.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  text-decoration: none;
  padding: .8rem 1.8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .2s, box-shadow .2s, background .2s;
  display: inline-block;
}
.btn.primary { background: linear-gradient(90deg, var(--cyan), var(--teal)); color: #06222b; }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(34, 211, 238, .35); }
.btn.ghost { border: 1px solid var(--line); color: var(--text); background: rgba(14, 26, 46, .6); }
.btn.ghost:hover { border-color: var(--cyan); transform: translateY(-2px); }

.scroll-hint {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  text-decoration: none;
  font-size: 1.4rem;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 8px); } }

/* ---------- stats strip ---------- */
.strip {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 6vw, 4rem);
  padding: 2.2rem 1rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(14, 26, 46, .5);
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat .num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--cyan);
}
.stat .num.accent { color: var(--pink); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .stat .num {
    background: linear-gradient(180deg, #cffafe, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .stat .num.accent {
    background: linear-gradient(180deg, #fbcfe8, var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
  }
}
.stat .lbl { color: var(--muted); font-size: .8rem; letter-spacing: 2px; text-transform: uppercase; }

/* ---------- sections ---------- */
.section {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 5rem 1.5rem 1rem;
}

.section h2 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: .4rem;
}
.section h2 .jp { font-size: 1.1rem; margin-left: .6rem; letter-spacing: 4px; }
.sub { color: var(--muted); margin-bottom: 2.2rem; }

/* ---------- projects ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  opacity: 0;
  transform: translateY(16px);
}
.card.visible { opacity: 1; transform: none; }
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, .5);
  box-shadow: 0 12px 40px rgba(34, 211, 238, .12);
}

.card-top { display: flex; justify-content: space-between; align-items: baseline; }
.card h3 { font-size: 1.15rem; color: var(--cyan); font-weight: 700; }
.card .stars { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.card p { color: var(--muted); font-size: .93rem; flex: 1; }
.card-meta { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.card .go { color: var(--teal); font-size: .88rem; font-weight: 600; }

/* ---------- stack ---------- */
.stack-group { margin-bottom: 1.5rem; }
.stack-group h3 { color: var(--muted); font-size: .8rem; letter-spacing: 2px; text-transform: uppercase; margin-bottom: .7rem; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pills span {
  padding: .42rem .95rem;
  border-radius: 999px;
  font-size: .86rem;
  color: var(--text);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(139,152,184,.22);
  transition: transform .2s, border-color .2s;
}
.pills span:hover { transform: translateY(-2px); border-color: var(--cyan); }

/* ---------- about / contact ---------- */
.about-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.about-card .muted, .muted { color: var(--muted); }

.contact { text-align: center; padding-bottom: 6rem; }
.contact .sub { margin-bottom: 2rem; }

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .nav { padding: 1rem; }
  .nav .links a:not(.cta) { display: none; }
  .strip { gap: 1.2rem; }
  /* one column on phones: the 300px min track would clip on narrow screens */
  .grid { grid-template-columns: 1fr; }
}

/* ---------- lightning divider ---------- */
.divider {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  margin-top: -1px;
  background: var(--bg);
}
.divider img { width: min(680px, 100%); display: block; opacity: .9; }

/* ---------- skeleton shimmer ---------- */
.card.skeleton { opacity: 1; transform: none; pointer-events: none; gap: 1rem; }
.sk-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #101c30 25%, #16294a 50%, #101c30 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-line.sk-title { height: 20px; width: 55%; }
.sk-line.short { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- project card ranks + topics ---------- */
.card .rank {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.card-top { gap: .6rem; }
.card-top .spacer { flex: 1; }
.topics { display: flex; flex-wrap: wrap; gap: .4rem; }
.topics span {
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .15rem .6rem;
}

/* ---------- journey timeline ---------- */
.timeline { position: relative; margin-left: .6rem; padding-left: 1.8rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet), var(--pink));
  opacity: .5;
  border-radius: 2px;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.8s ease .2s;
}
.timeline.drawn::before { transform: scaleY(1); }
.t-item { position: relative; margin-bottom: 1.4rem; }
.t-dot {
  position: absolute;
  left: -1.8rem;
  top: 1.5rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, .7);
  animation: dot-breathe 3.6s ease-in-out infinite;
}
@keyframes dot-breathe { 50% { transform: scale(1.28); } }
.t-item:nth-child(2) .t-dot { border-color: var(--teal); box-shadow: 0 0 12px rgba(45, 212, 191, .7); }
.t-item:nth-child(3) .t-dot { border-color: var(--violet); box-shadow: 0 0 12px rgba(167, 139, 250, .7); }
.t-item:nth-child(4) .t-dot { border-color: var(--pink); box-shadow: 0 0 12px rgba(244, 114, 182, .7); }
.t-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  transition: border-color .25s, transform .25s;
}
.t-card:hover { border-color: rgba(34, 211, 238, .4); transform: translateX(4px); }
.t-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.t-head h3 { font-size: 1.05rem; font-weight: 700; }
.t-when { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.t-card p { color: var(--muted); font-size: .93rem; }
.t-list { margin: .7rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .55rem; }
.t-list li { position: relative; padding-left: 1.3rem; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.t-list li::before { content: '▸'; position: absolute; left: 0; color: var(--cyan); }
.t-list strong { color: var(--text); font-weight: 600; }
.t-card.featured {
  border: 1px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
              linear-gradient(120deg, var(--cyan), var(--violet), var(--pink)) border-box;
}
.t-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .5rem;
  margin: 1rem 0 .2rem;
}
.t-stat {
  background: rgba(34, 211, 238, .06);
  border: 1px solid rgba(34, 211, 238, .18);
  border-radius: 10px;
  padding: .55rem .3rem;
  text-align: center;
}
.t-stat b {
  display: block;
  font-size: 1.05rem;
  color: var(--teal);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .t-stat b {
    background: linear-gradient(90deg, var(--cyan), var(--teal));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
.t-stat span { font-size: .68rem; color: var(--muted); line-height: 1.3; display: block; margin-top: .15rem; }
@media (max-width: 640px) { .t-stats { grid-template-columns: repeat(3, 1fr); } }

/* ---------- project card links ---------- */
.card-title-link { color: var(--cyan); text-decoration: none; }
.card-title-link:hover { text-decoration: underline; }
.card-links { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .2rem; }
.mini-btn {
  display: inline-flex; align-items: center;
  font-size: .82rem; font-weight: 600;
  padding: .4rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text);
  text-decoration: none; background: rgba(34, 211, 238, .06);
  transition: border-color .2s, background .2s, transform .2s;
}
.mini-btn:hover { border-color: var(--cyan); background: rgba(34, 211, 238, .14); transform: translateY(-1px); }
.mini-btn.live { border-color: rgba(45, 212, 191, .55); color: var(--teal); }
.mini-btn.soon { border-style: dashed; color: var(--muted); cursor: default; }
.mini-btn.soon:hover { border-color: var(--line); background: rgba(34, 211, 238, .06); transform: none; }

/* ---------- cursor glow (desktop only) ---------- */
#glow {
  position: fixed;
  width: 520px; height: 520px;
  left: 0; top: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(34, 211, 238, .07) 0%, transparent 60%);
  transform: translate(-50%, -50%);
}

/* ---------- marquee ---------- */
.marquee {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(14, 26, 46, .5);
  padding: .9rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: inline-flex;
  gap: 2.2rem;
  white-space: nowrap;
  animation: marquee 28s linear infinite;
  padding-right: 2.2rem;
}
.marquee-track span { font-weight: 700; letter-spacing: 3px; font-size: .85rem; color: var(--muted); }
.marquee-track i { color: var(--cyan); font-style: normal; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- animated section headers ---------- */
/* solid text colour on purpose: gradient-clipped text renders as an opaque
   box on browsers without background-clip:text support */
.section h2 {
  color: var(--text);
  display: inline-block;
  position: relative;
  padding-bottom: .5rem;
}
.section h2::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 3px; width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .8s ease .15s;
}
.section h2.inview::after { transform: scaleX(1); }

/* ---------- button shine ---------- */
.btn { position: relative; overflow: hidden; }
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  transition: left .6s ease;
}
.btn:hover::before { left: 130%; }

/* ---------- nav hide on scroll ---------- */
.nav { transition: transform .35s ease; }
.nav.hidden { transform: translateY(-100%); }

/* ---------- floating hero name ---------- */
.hero h1 { animation: floaty 7s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-8px); } }

/* ---------- staggered card entrance ---------- */
.card { transition: opacity .5s ease, transform .5s ease, border-color .25s, box-shadow .25s; }

/* ---------- ambient motion layer (subtle) ---------- */

/* scroll progress hairline */
#progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  z-index: 60; opacity: .9;
  pointer-events: none;
}

/* drifting ambient orbs */
.orb {
  position: fixed; border-radius: 50%;
  filter: blur(90px); pointer-events: none;
  z-index: 0; opacity: .15;
}
.orb-a {
  width: 480px; height: 480px; top: -140px; left: -120px;
  background: radial-gradient(circle, rgba(34, 211, 238, .55), transparent 70%);
}
.orb-b {
  width: 560px; height: 560px; top: 38%; right: -200px;
  background: radial-gradient(circle, rgba(167, 139, 250, .5), transparent 70%);
}
.orb-c {
  width: 420px; height: 420px; bottom: -160px; left: 30%;
  background: radial-gradient(circle, rgba(244, 114, 182, .45), transparent 70%);
}

.orb-a { animation: drift-a 34s ease-in-out infinite alternate; }
.orb-b { animation: drift-b 42s ease-in-out infinite alternate; }
.orb-c { animation: drift-c 38s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(120px, 90px) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-140px, -70px) scale(.92); } }
@keyframes drift-c { to { transform: translate(-90px, -110px) scale(1.08); } }

/* project card sheen sweep */
.card { position: relative; overflow: hidden; }
.card::after {
  content: ''; position: absolute; top: 0; left: -70%;
  width: 45%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .09), transparent);
  transform: skewX(-18deg);
  transition: left .7s ease;
}
.card:hover::after { left: 135%; }

.section h2 .jp { animation: jp-breathe 5s ease-in-out infinite; }
@keyframes jp-breathe { 50% { opacity: .45; } }

/* gentle glow on stats */
.stat .num { text-shadow: 0 0 26px rgba(34, 211, 238, .28); }

/* button press feedback */
.btn:active { transform: translateY(0) scale(.98); }

/* render off-screen sections lazily — big win for scroll smoothness on phones */
.section { content-visibility: auto; contain-intrinsic-size: auto 600px; }

/* on touch devices: keep the blurred fixed nav off and sections lazy-rendered,
   but leave the visible animations running */
@media (hover: none), (max-width: 640px) {
  .nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(4, 10, 22, .92); }
  .orb { filter: blur(40px); opacity: .5; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .section h2, .section h2 .jp, .t-dot,
  .hero h1, .scroll-hint, .marquee-track { animation: none !important; }
  .timeline::before { transform: none; transition: none; }
  #progress { display: none; }
}
