:root {
  --bg: #05070b;
  --panel: #0b0f16;
  --panel-2: #10151f;
  --ink: #eef3fa;
  --muted: #8b96a8;
  --line: rgba(120, 200, 255, 0.14);
  --cyan: #47e6ff;
  --violet: #8b6cff;
  --glow: 0 0 24px rgba(71, 230, 255, 0.35);
  --max: 1180px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  /* faint blueprint grid behind everything */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(71, 230, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 230, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; }
em { font-style: normal; color: var(--cyan); }

/* Top bar */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px max(16px, calc((100vw - var(--max)) / 2 + 24px));
  background: linear-gradient(to bottom, rgba(5, 7, 11, 0.85), rgba(5, 7, 11, 0));
  backdrop-filter: blur(6px);
}
.mark {
  color: var(--ink); font: 500 14px/1 var(--mono); letter-spacing: 0.18em;
  display: flex; align-items: center; gap: 10px;
}
.mark:hover { text-decoration: none; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
  box-shadow: var(--glow); animation: pulse 2.4s ease-in-out infinite;
}
.top nav { display: flex; gap: 26px; font: 13px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--ink); text-decoration: none; }
.top nav .cv-link { color: var(--cyan); }

/* Hero */
.hero {
  position: relative; min-height: 100svh; overflow: hidden;
  display: flex; align-items: flex-end;
  padding: 120px max(16px, calc((100vw - var(--max)) / 2 + 24px)) 96px;
}
.hero-slides { position: absolute; inset: 0; }
.hero-slides img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.08);
  transition: opacity 1.6s ease, transform 9s linear;
  filter: saturate(1.1) contrast(1.05);
}
.hero-slides img.on { opacity: 1; transform: scale(1); }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(5, 7, 11, 0) 0%, rgba(5, 7, 11, 0.55) 70%),
    linear-gradient(to top, var(--bg) 4%, rgba(5, 7, 11, 0.55) 45%, rgba(5, 7, 11, 0.35) 100%);
}
#grid { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

.hud { position: absolute; inset: 88px 24px 28px; z-index: 2; pointer-events: none; font: 11px var(--mono); letter-spacing: 0.14em; color: rgba(200, 240, 255, 0.75); }
.hud .c { position: absolute; width: 22px; height: 22px; border: 1.5px solid rgba(71, 230, 255, 0.7); }
.hud .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.hud .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.hud .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.hud .br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.hud-tl, .hud-tr, .hud-bl, .hud-br { position: absolute; }
.hud-tl { top: 4px; left: 34px; }
.hud-tl::first-letter { color: #ff5d5d; }
.hud-tr { top: 4px; right: 34px; color: var(--cyan); }
.hud-bl { bottom: 4px; left: 34px; }
.hud-br { bottom: 4px; right: 34px; }

.hero-text { position: relative; z-index: 3; max-width: 760px; }
.eyebrow {
  font: 500 13px var(--mono); letter-spacing: 0.3em; color: var(--cyan);
  margin: 0 0 14px; text-shadow: var(--glow);
}
h1 {
  font: 700 clamp(48px, 9vw, 112px)/0.95 var(--display);
  letter-spacing: -0.03em; margin: 0 0 22px;
  background: linear-gradient(180deg, #ffffff 30%, #a9c6e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tag { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.5; color: #d3dcea; max-width: 30em; margin: 0 0 32px; }
.links { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 0; }
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 999px;
  font: 500 13px var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--cyan); color: #021014; box-shadow: var(--glow);
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 0 36px rgba(71, 230, 255, 0.6); }
.btn.ghost { background: rgba(255, 255, 255, 0.04); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.25); box-shadow: none; backdrop-filter: blur(6px); }
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }

.scroll { position: absolute; z-index: 3; left: 50%; bottom: 26px; width: 22px; height: 36px; margin-left: -11px; border: 1.5px solid rgba(255, 255, 255, 0.4); border-radius: 12px; }
.scroll span { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--cyan); animation: wheel 1.8s ease-in-out infinite; }

/* Stats strip */
.stats {
  max-width: var(--max); margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats div { padding: 28px 8px; display: flex; flex-direction: column; gap: 4px; }
.stats div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.stats b { font: 600 clamp(28px, 4vw, 40px)/1 var(--display); color: var(--ink); }
.stats span { font: 12px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Sections */
main, footer { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.block { padding-top: 120px; }
.head { margin-bottom: 40px; }
.kicker { font: 500 12px var(--mono); letter-spacing: 0.24em; color: var(--cyan); margin: 0 0 12px; }
h2 { font: 600 clamp(30px, 4.2vw, 48px)/1.08 var(--display); letter-spacing: -0.02em; margin: 0 0 14px; }
.sub { color: var(--muted); font-size: 17px; max-width: 40em; margin: 0; }

/* Lab cards: big, cinematic */
.labs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.labs .card:first-child { grid-column: 1 / -1; }
.labs .card:first-child .shot { aspect-ratio: 21 / 9; }
.labs .card:first-child .shot img { object-position: center 0%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; }

.card { position: relative; }
.card h3 { font: 600 19px/1.3 var(--display); margin: 16px 0 4px; }
.card p { font-size: 15px; color: var(--muted); margin: 0; }
.card.text-only { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.card.text-only h3 { margin-top: 0; }
.idx { font: 11px var(--mono); letter-spacing: 0.18em; color: var(--cyan); }

.shot {
  position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in;
  aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel);
  transition: border-color .3s, box-shadow .3s;
}
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2, .7, .2, 1), filter .4s; filter: brightness(.9); }
.shot::after {
  /* scanline + vignette, like looking through a headset */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45));
}
.shot:hover { border-color: rgba(71, 230, 255, 0.6); box-shadow: 0 0 0 1px rgba(71, 230, 255, 0.25), 0 18px 60px rgba(71, 230, 255, 0.12); }
.shot:hover img { transform: scale(1.05); filter: brightness(1.02); }
.shot .n {
  position: absolute; right: 12px; bottom: 12px; z-index: 1;
  background: rgba(5, 7, 11, 0.7); color: var(--ink); border: 1px solid var(--line);
  font: 11px var(--mono); letter-spacing: 0.1em; padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(6px);
}
.shot .tagline {
  position: absolute; left: 12px; top: 12px; z-index: 1;
  font: 11px var(--mono); letter-spacing: 0.16em; color: var(--cyan);
  background: rgba(5, 7, 11, 0.6); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line);
}

/* 3D models */
.models { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.model {
  position: relative; margin: 0; overflow: hidden; border-radius: 12px;
  border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 35%, #ffffff, #c9ced6);
  transition: border-color .3s, transform .3s, box-shadow .3s;
}
.model img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.model figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 22px 12px 10px;
  font: 500 13px/1.3 var(--display); color: #fff;
  background: linear-gradient(to top, rgba(5, 7, 11, 0.88), transparent);
}
.model:hover { border-color: rgba(71, 230, 255, 0.6); transform: translateY(-3px); box-shadow: 0 14px 40px rgba(71, 230, 255, 0.14); }
.model:hover img { transform: scale(1.06); }
.store-links { margin-top: 28px; }
.model.feature { grid-column: span 2; grid-row: span 2; display: block; color: #fff; }
.model.feature img { height: 100%; aspect-ratio: auto; }
.model.feature .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 16px;
  font: 600 20px/1.2 var(--display); background: linear-gradient(to top, rgba(5, 7, 11, 0.9), transparent);
}
.model.feature em { display: block; margin-top: 6px; font: 500 12px var(--mono); letter-spacing: 0.14em; font-style: normal; color: var(--cyan); }
.model.feature:hover { text-decoration: none; }

/* FYP */
.fyp-head { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; margin: 0 0 44px; }
.fyp-head > p { margin: 0; font-size: 18px; color: #cdd6e4; }
.facts { margin: 0; display: grid; gap: 16px; align-content: start; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.facts div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; font-size: 15px; }
.facts dt { font: 11px/1.9 var(--mono); letter-spacing: 0.16em; color: var(--muted); }
.facts dd { margin: 0; }
.grid .card h3 { font-size: 16px; }
.grid .card p { font-size: 14px; }

/* Other work */
.other { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.other li { display: grid; grid-template-columns: 300px 1fr; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); transition: background .2s; }
.other li:hover { background: linear-gradient(90deg, rgba(71, 230, 255, 0.05), transparent); }
.other li > a, .other button, .other .name { font: 600 17px var(--display); }
.other button { background: none; border: 0; padding: 0; text-align: left; color: var(--cyan); cursor: pointer; }
.other button:hover { text-decoration: underline; text-underline-offset: 3px; }
.other .name { color: var(--ink); }
.other li > span:last-child { color: var(--muted); }

/* About */
.about-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; }
.about-cols p { margin: 0; font-size: 18px; color: #cdd6e4; }
.cv { list-style: none; padding: 0; margin: 0; font-size: 15px; border-left: 1px solid var(--line); }
.cv li { padding: 8px 0 8px 20px; position: relative; }
.cv li::before { content: ""; position: absolute; left: -4px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: var(--glow); }
.cv span { display: inline-block; width: 78px; font: 12px var(--mono); color: var(--muted); }
.contact { margin-top: 72px; padding: 48px 0 0; border-top: 1px solid var(--line); }
.contact .big { display: inline-block; font: 600 clamp(26px, 5vw, 56px)/1.1 var(--display); letter-spacing: -0.02em; color: var(--ink); margin-bottom: 18px; word-break: break-word; }
.contact .big:hover { color: var(--cyan); text-decoration: none; text-shadow: var(--glow); }
.contact .links a { font: 13px var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.contact .links a:hover { color: var(--cyan); }

footer { padding-top: 80px; padding-bottom: 40px; font: 12px var(--mono); letter-spacing: 0.1em; color: var(--muted); }

/* Reveal on scroll */
/* Content is visible by default; only blocks that start below the fold are hidden,
   and only once the script has run (html.anim), so previews and slow browsers never see gaps. */
.anim .reveal.below { opacity: 0; transform: translateY(24px); }
.reveal { transition: opacity .8s ease, transform .8s ease; }
.anim .reveal.below.in { opacity: 1; transform: none; }

/* Viewer */
dialog { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog::backdrop { background: rgba(3, 5, 8, 0.94); backdrop-filter: blur(4px); }
dialog figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 72px; }
dialog img { max-height: calc(100vh - 140px); width: auto; border-radius: 10px; border: 1px solid var(--line); }
dialog figcaption { color: #c9ccd2; margin-top: 14px; font: 12px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
dialog button { position: fixed; background: none; border: 0; color: #fff; cursor: pointer; font-size: 36px; line-height: 1; padding: 12px; }
dialog button:hover { color: var(--cyan); }
.close { top: 12px; right: 16px; }
.prev { left: 12px; top: 50%; transform: translateY(-50%); }
.next { right: 12px; top: 50%; transform: translateY(-50%); }
dialog.single .nav { display: none; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

@media (max-width: 860px) {
  .labs { grid-template-columns: 1fr; }
  .models { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .model.feature { grid-row: span 1; }
  .model.feature img { aspect-ratio: 4 / 3; }
  .labs .card:first-child .shot { aspect-ratio: 16 / 9; }
  .fyp-head, .about-cols { grid-template-columns: 1fr; gap: 28px; }
  .other li { grid-template-columns: 1fr; gap: 4px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; padding-left: 8px; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .hud-bl, .hud-tr { display: none; }
}
@media (max-width: 560px) {
  .top nav { gap: 14px; font-size: 12px; }
  .top nav a[href="#fyp"], .top nav a[href="#about"] { display: none; }
  .mark, .top nav a { white-space: nowrap; }
  .mark { letter-spacing: 0.12em; }
  .hero { padding-bottom: 88px; }
  .hud { inset: 72px 12px 16px; }
  .block { padding-top: 88px; }
  dialog figure { padding: 56px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
