/* ---------- base ---------- */
:root {
  --bg: #07090f;
  --bg-soft: #0c1018;
  --panel: rgba(16, 21, 32, 0.6);
  --border: rgba(120, 180, 255, 0.12);
  --border-strong: rgba(120, 180, 255, 0.28);
  --text: #d8e1f0;
  --text-dim: #8893a8;
  --text-faint: #5a6478;
  --accent: #5ee0ff;
  --accent-soft: rgba(94, 224, 255, 0.15);
  --accent-glow: rgba(94, 224, 255, 0.35);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
a:hover { border-bottom-color: var(--accent); }

/* ---------- background effects ---------- */
body {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(94, 224, 255, 0.12), transparent 60%),
    radial-gradient(ellipse 70% 60% at 85% 10%, rgba(167, 139, 250, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(94, 224, 255, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(94, 224, 255, 0.18) 0%, transparent 35%),
    radial-gradient(circle at 85% 30%, rgba(167, 139, 250, 0.16) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(94, 224, 255, 0.08) 0%, transparent 45%);
  filter: blur(60px);
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
  animation: drift 24s ease-in-out infinite;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 70% 60%, rgba(94, 224, 255, 0.10) 0%, transparent 30%),
    radial-gradient(circle at 30% 50%, rgba(167, 139, 250, 0.08) 0%, transparent 35%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: drift 32s ease-in-out infinite reverse;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(3%, -2%) scale(1.05); }
  66%      { transform: translate(-2%, 3%) scale(0.97); }
}

/* subtle grain so the gradient doesn't band on dark screens */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(7, 9, 15, 0.78);
}

.brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}
.brand-bracket { color: var(--accent); }
.brand-name { margin: 0 2px; }
.brand-cursor {
  color: var(--accent);
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- tabs ---------- */
.tabs {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tab {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 7px;
  transition: color 0.25s ease;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--text);
}

.tab-index {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  opacity: 0.7;
  font-weight: 500;
}

.tab.active .tab-index { opacity: 1; }

.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(94, 224, 255, 0.08);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  transition: left 0.35s cubic-bezier(0.65, 0, 0.35, 1),
              width 0.35s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 1;
  box-shadow: 0 0 24px var(--accent-soft) inset;
}

/* ---------- content ---------- */
.content {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  margin: 0 auto;
  padding: 80px 48px 120px;
}

.panel {
  display: none;
  animation: fadeUp 0.5s ease;
}
.panel.active { display: block; }

/* Account for sticky topbar when scrolling to anchors */
#about-section,
#research-section,
#beyond-section {
  scroll-margin-top: 110px;
}

/* Divider/spacing between About, Research, and Beyond sections within home panel */
#research-section {
  margin-top: 96px;
  padding-top: 56px;
  border-top: 1px solid var(--border);
}

#beyond-section {
  margin-top: 56px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 56px;
  align-items: center;
  margin-bottom: 72px;
}

.hero-text { min-width: 0; }

.hero-photo {
  position: relative;
  width: 288px;
  flex-shrink: 0;
}

.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(1.02);
}

.photo-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(94, 224, 255, 0.18) 0%,
    transparent 35%,
    transparent 65%,
    rgba(167, 139, 250, 0.18) 100%);
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 2;
}

.photo-frame::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 50%, rgba(167, 139, 250, 0.3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
}

.hero-photo::before,
.hero-photo::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--accent);
  opacity: 0.6;
  pointer-events: none;
}
.hero-photo::before {
  top: -8px;
  left: -8px;
  border-right: none;
  border-bottom: none;
}
.hero-photo::after {
  bottom: -8px;
  right: -8px;
  border-left: none;
  border-top: none;
}

.hero-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-alias {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-credentials {
  margin-top: 18px;
  font-size: clamp(15px, 1.3vw, 18px);
  color: var(--text-dim);
  line-height: 1.65;
  letter-spacing: 0.01em;
}

.hero-contact {
  margin-top: 14px;
  font-size: clamp(14px, 1.2vw, 16px);
  font-family: var(--mono);
  letter-spacing: 0.01em;
}

.hero-contact a {
  color: var(--accent);
}

.contact-sep {
  color: var(--text-faint);
  margin: 0 8px;
}

.accent {
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 580px;
  line-height: 1.6;
}

.section-title {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.section-sub {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 48px;
}

/* ---------- card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  padding: 26px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  backdrop-filter: blur(6px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card.has-image {
  padding: 0;
}

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

.card-image {
  position: relative;
  width: 100%;
  height: 205px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card.has-image:hover .card-image img {
  transform: scale(1.04);
}

.card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(7, 9, 15, 0.6) 100%);
  pointer-events: none;
}

/* TFT — transparent logo on dark gradient backdrop */
.image-tft {
  background:
    radial-gradient(ellipse at center, rgba(94, 224, 255, 0.10), transparent 70%),
    linear-gradient(135deg, #0d1422 0%, #181226 100%);
}
.image-tft img {
  object-fit: contain;
  padding: 50px 70px;
  filter: drop-shadow(0 0 18px rgba(94, 224, 255, 0.25));
}

/* HZD — already dark, slight cool grade */
.image-hzd {
  background: #0a0d14;
}
.image-hzd img {
  object-position: center 6%;
  filter: saturate(0.95) contrast(1.03);
}

/* Wind — kitesurfing, near-square photo; frame kite + rider */
.image-wind {
  background: #0c1018;
}
.image-wind img {
  object-position: center 78%;
  filter: saturate(0.92) contrast(1.04);
}

/* Snow — portrait photo, frame the trail + riders */
.image-snow {
  background: #0c1018;
}
.image-snow img {
  object-position: center 75%;
  filter: saturate(0.85) contrast(1.04) brightness(0.96);
}

/* CapStore — pixel art on teal background; gently darken to match theme */
.image-capstore {
  background: #0f1822;
}
.image-capstore img {
  filter: brightness(0.92) contrast(1.04) saturate(0.92);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, var(--accent-glow) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.card:hover::before { opacity: 1; }

.card-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}

.card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.card p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Feature card — the big About bio block */
.card.card-feature {
  grid-column: 1 / -1;
  padding: 34px 38px;
}

.card.card-feature h3 {
  font-size: 22px;
  margin-bottom: 14px;
  letter-spacing: -0.015em;
}

.card.card-feature p {
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--text);
  line-height: 1.75;
}

@media (max-width: 720px) {
  .card.card-feature {
    grid-column: span 1;
    padding: 26px 24px;
  }
}

#beyond .card-grid {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 960px) {
  #beyond .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  #beyond .card-grid {
    grid-template-columns: 1fr;
  }
}

.game-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.game-pills span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  border: 1px solid rgba(94, 224, 255, 0.18);
}

/* ---------- projects ---------- */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project {
  border-top: 1px solid var(--border);
  transition: padding-left 0.25s ease;
}

.project:last-child { border-bottom: 1px solid var(--border); }

.project:hover { padding-left: 8px; }

.project-summary {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 32px;
  padding: 28px 0;
  cursor: pointer;
  list-style: none;
  align-items: start;
}

.project-summary::-webkit-details-marker { display: none; }
.project-summary::marker { content: ""; }

.project-body h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.project-body p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.project-venue {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.venue-highlight {
  background: linear-gradient(90deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px var(--accent-glow);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-strong);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.project-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.project-link .link-arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.project-link:hover .link-arrow {
  transform: translate(2px, -2px);
}

.project-chevron {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--text-faint);
  line-height: 1;
  padding-top: 4px;
  text-align: right;
  transition: transform 0.25s ease, color 0.25s ease;
}

.project[open] .project-chevron {
  transform: rotate(45deg);
  color: var(--accent);
}

.project-expanded {
  padding: 4px 0 32px 0;
}

.project-videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.project-video {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1117;
}

.project-video video {
  display: block;
  width: 100%;
  height: auto;
}

.project-video.placeholder {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(94, 224, 255, 0.04), rgba(167, 139, 250, 0.04));
}

.project-video figcaption {
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.project-video.placeholder figcaption {
  border-top: none;
  color: var(--text-faint);
}

/* Force consistent aspect ratio: letterbox narrower videos to match the wider one */
.videos-letterbox .project-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 3456 / 1814;
  object-fit: contain;
  background: #0d1117;
}

.videos-16-9 .project-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0d1117;
}

/* ---------- beyond (feature layout) ---------- */
#beyond-section .section-title,
#research-section .section-title {
  font-size: clamp(20px, 1.8vw, 24px);
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 20px;
}

.beyond-feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 36px;
  background: rgba(255, 255, 255, 0.015);
}

.beyond-photo {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  width: 188px;
  max-width: 100%;
}

.beyond-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.beyond-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15.5px;
  color: var(--text-dim);
  line-height: 1.65;
}

.beyond-text p {
  margin: 0;
}

/* ---------- footer ---------- */
.footer {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 48px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
}

.footer-dot { opacity: 0.5; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    gap: 18px;
    padding: 20px 24px;
  }
  .content {
    padding: 48px 24px 80px;
  }
  .tab {
    padding: 9px 14px;
    font-size: 12px;
  }
  .project-summary {
    grid-template-columns: 1fr 24px;
    gap: 16px;
  }
  .project-videos {
    grid-template-columns: 1fr;
  }
  .beyond-feature {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 22px;
  }
  .beyond-photo {
    width: 160px;
    justify-self: center;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 56px;
  }
  .hero-photo {
    width: 216px;
    order: -1;
  }
}
