:root {
  --bg: #06060b;
  --panel: rgba(14, 14, 24, 0.82);
  --panel-solid: #0e0e18;
  --line: #22223a;
  --line-strong: #34345a;
  --text: #ececf5;
  --muted: #9b9bb6;
  --accent: #00e5ff;
  --accent-2: #ff2e88;
  --accent-3: #8b5cf6;
  --radius: 14px;
  --max: 1200px;
  --gut: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Faint grid + glow behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 85% 0%, rgba(139, 92, 246, .16), transparent 70%),
    radial-gradient(50% 40% at 0% 30%, rgba(0, 229, 255, .08), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 48px 48px;
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }

a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

::selection { background: var(--accent-2); color: #fff; }

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gut);
  transition: background .3s, border-color .3s, padding .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(6, 6, 11, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
  padding-top: 12px;
  padding-bottom: 12px;
}
.logo { font-weight: 600; font-size: 1.15rem; text-decoration: none; letter-spacing: .05em; }
.blink { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.nav-links { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  position: relative;
  transition: color .2s;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); }

.lang-toggle {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 14px rgba(0, 229, 255, .25); }

/* ---------- Hero ---------- */

.hero {
  min-height: 92vh;
  min-height: 92svh;
  max-width: var(--max);
  margin: 0 auto;
  padding: 130px var(--gut) 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.hero-inner > * { animation: rise .9s var(--ease) both; }
.hero-inner > :nth-child(2) { animation-delay: .1s; }
.hero-inner > :nth-child(3) { animation-delay: .25s; }
.hero-inner > :nth-child(4) { animation-delay: .4s; }

.hero-kicker { color: var(--accent); font-size: .9rem; letter-spacing: .15em; margin-bottom: 14px; opacity: .85; }

.hero-name {
  font-size: clamp(3rem, 11vw, 7.5rem);
  line-height: .95;
  font-weight: 700;
  letter-spacing: -.035em;
}

.glitch {
  position: relative;
  display: inline-block;
  background: linear-gradient(95deg, #fff 0%, #dfe3ff 45%, var(--accent) 80%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.glitch::before { color: var(--accent-2); animation: glitch 5s steps(1) infinite; }
.glitch::after { color: var(--accent); animation: glitch 5s steps(1) .12s infinite; }

.hero-role {
  margin-top: 22px;
  font-size: clamp(1.1rem, 2.8vw, 1.6rem);
  color: var(--text);
  min-height: 1.6em;
}
.prompt { color: var(--accent-2); margin-right: 6px; }
.caret { color: var(--accent); animation: blink 1s steps(1) infinite; }

.socials { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(14, 14, 24, .6);
  backdrop-filter: blur(6px);
  text-decoration: none;
  font-weight: 500;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s, color .25s;
}
.socials svg { width: 19px; height: 19px; flex: none; }
.socials a:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 6px 24px rgba(0, 229, 255, .2);
}
.socials-sm { margin-top: 26px; gap: 10px; }
.socials-sm a { padding: 9px 15px; font-size: .92rem; }

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  opacity: .7;
  transition: opacity .2s;
  animation: rise 1s .9s var(--ease) both;
}
.scroll-hint:hover { opacity: 1; }
.mouse {
  display: block;
  width: 24px; height: 38px;
  border: 2px solid var(--muted);
  border-radius: 14px;
  position: relative;
}
.mouse span {
  position: absolute;
  left: 50%; top: 7px;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: wheel 1.6s ease-in-out infinite;
}

/* ---------- Sections ---------- */

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 90px var(--gut);
}

.section-head { margin-bottom: 44px; }
.section-index {
  display: inline-block;
  color: var(--accent);
  font-size: .85rem;
  letter-spacing: .15em;
  margin-bottom: 6px;
}
.section-index::before { content: '// '; color: var(--muted); }
.section-head h2 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.02em; }
.section-head p { color: var(--muted); margin-top: 10px; max-width: 60ch; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---------- Project card ---------- */

.project-list { display: flex; flex-direction: column; gap: clamp(40px, 7vw, 72px); }

.project {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(20, 20, 34, .7), rgba(8, 8, 14, .7));
  position: relative;
  transition: border-color .4s, box-shadow .4s;
}
/* Animated gradient edge on hover */
.project::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, var(--accent), var(--accent-3), var(--accent-2), var(--accent));
  background-size: 300% 300%;
  -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 .4s;
  pointer-events: none;
  animation: gradient-move 6s linear infinite;
}
.project:hover::before { opacity: 1; }
.project:hover { box-shadow: 0 20px 60px -20px rgba(139, 92, 246, .35); }

/* Media (left) */
.p-media { padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }

.slider {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  background: #000;
}
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide video, .slide iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.slide-empty { background: linear-gradient(135deg, var(--accent-3), var(--accent)); opacity: .3; }

.slide-video { cursor: pointer; }
.slide-video:not(.playing)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55));
  pointer-events: none;
}
.play {
  position: absolute;
  z-index: 2;
  top: 50%; left: 50%;
  width: 78px; height: 78px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85);
  background: rgba(6, 6, 11, .45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  transition: transform .25s var(--ease), background .25s, border-color .25s;
  animation: pulse 2.2s ease-out infinite;
}
.play svg { width: 34px; height: 34px; fill: #fff; margin-left: 4px; }
.slide-video:hover .play { transform: translate(-50%, -50%) scale(1.08); background: var(--accent-2); border-color: var(--accent-2); }
.v-label {
  position: absolute;
  z-index: 2;
  left: 12px; bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(6, 6, 11, .72);
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v-error { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.s-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 44px; height: 44px;
  margin-top: -22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(6, 6, 11, .6);
  backdrop-filter: blur(6px);
  font-size: 1.7rem;
  line-height: 1;
  display: grid;
  place-items: center;
  padding-bottom: 3px;
  opacity: 0;
  transition: opacity .25s, background .2s, border-color .2s;
}
.s-nav.prev { left: 12px; }
.s-nav.next { right: 12px; }
.slider:hover .s-nav, .slider:focus-within .s-nav { opacity: 1; }
.s-nav:hover { background: var(--accent); border-color: var(--accent); color: #000; }
@media (hover: none) { .s-nav { opacity: .85; width: 38px; height: 38px; margin-top: -19px; font-size: 1.4rem; } }

.counter {
  position: absolute;
  z-index: 3;
  top: 10px; right: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(6, 6, 11, .7);
  font-size: .72rem;
  color: var(--muted);
  pointer-events: none;
}

.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px; }
.dot {
  width: 26px; height: 26px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}
.dot::before {
  content: '';
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  transition: background .25s, border-color .25s, box-shadow .25s, transform .25s;
}
.dot-video::before { width: 20px; border-radius: 6px; }
.dot:hover::before { border-color: var(--text); transform: scale(1.15); }
.dot.active::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* Side (right) */
.p-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.p-title {
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.p-title::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.p-num { display: block; color: var(--accent-2); font-size: .8rem; letter-spacing: .1em; margin-bottom: 4px; }
.p-title h3 {
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.p-info { flex: 1; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.chips li {
  font-size: .78rem;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 255, .35);
  color: var(--accent);
  background: rgba(0, 229, 255, .06);
}

.p-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8rem; color: var(--muted); }
.p-meta b { color: var(--text); font-weight: 600; margin-right: 4px; }

.p-desc { color: #cfcfe0; font-size: .97rem; }

.p-links { display: flex; flex-wrap: wrap; gap: 10px; }

.p-systems { border-top: 1px dashed var(--line-strong); padding-top: 16px; }
.p-systems h4 {
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}
.p-role { font-size: .9rem; color: var(--muted); font-style: italic; margin-bottom: 10px; }
.p-systems ul { list-style: none; display: grid; gap: 7px; }
.p-systems li { position: relative; padding-left: 22px; font-size: .94rem; }
.p-systems li::before {
  content: '▸';
  position: absolute;
  left: 2px;
  color: var(--accent);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .25s, background .25s, border-color .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-sm { padding: 9px 16px; font-size: .9rem; }
.btn-primary {
  background: linear-gradient(100deg, var(--accent-3), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 24px -6px rgba(255, 46, 136, .5);
}
.btn-primary:hover { box-shadow: 0 10px 34px -6px rgba(255, 46, 136, .7); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-ghost { border-color: var(--line-strong); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-steam {
  background: linear-gradient(100deg, #1b2838, #2a475e);
  border-color: #3d6b8f;
  color: #fff;
}
.btn-steam:hover { border-color: #66c0f4; box-shadow: 0 6px 22px -6px rgba(102, 192, 244, .6); }

/* ---------- Contact ---------- */

.contact-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; }

.about { padding: clamp(22px, 3vw, 32px); }
.about-text { font-size: 1.05rem; color: #d8d8e8; }
.about-intro {
  margin-top: 20px;
  font-weight: 600;
  color: var(--accent);
}
.about-intro::before { content: '> '; color: var(--accent-2); font-family: 'JetBrains Mono', monospace; }

.form { padding: clamp(22px, 3vw, 32px); display: flex; flex-direction: column; gap: 18px; }
.form label { display: flex; flex-direction: column; gap: 7px; }
.form label span { font-size: .85rem; font-weight: 500; color: var(--muted); }
.form input, .form textarea {
  font: inherit;
  color: var(--text);
  background: rgba(6, 6, 11, .7);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, .15);
}
.form .btn { align-self: flex-start; min-width: 150px; }
.form-status { font-size: .92rem; min-height: 1.4em; }
.form-status.ok { color: #4ade80; }
.form-status.error { color: #ff6b9a; }
.form-status a { color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Footer ---------- */

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 30px var(--gut) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .82rem;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Reveal ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */

@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); }
  70%, 100% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); }
}
@keyframes gradient-move { to { background-position: 300% 0; } }
@keyframes glitch {
  0%, 86%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  87% { opacity: .85; transform: translate(-5px, 1px); clip-path: inset(10% 0 62% 0); }
  89% { transform: translate(5px, -2px); clip-path: inset(55% 0 18% 0); }
  91% { transform: translate(-3px, 0); clip-path: inset(32% 0 44% 0); }
  93% { opacity: .85; transform: translate(4px, 2px); clip-path: inset(78% 0 4% 0); }
  94% { opacity: 0; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .contact-wrap { grid-template-columns: 1fr; }
  .section { padding-top: 70px; padding-bottom: 70px; }
}

@media (max-width: 520px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: .92rem; }
  .p-media { padding: 8px; }
  .p-title, .p-info { padding: 16px; }
  .play { width: 62px; height: 62px; }
  .play svg { width: 26px; height: 26px; }
  .socials a { padding: 10px 14px; }
  .form .btn { align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
