/* ================= tokens ================= */
:root {
  --bg: #0a0c10;
  --bg-2: #0e1118;
  --surface: #12151d;
  --line: rgba(255, 255, 255, .08);
  --text: #e9edf3;
  --muted: #8b95a3;
  --accent: #ffa02e;      /* amber — games */
  --purple: #8f7bff;      /* violet — AI / professional work */
  --radius: 16px;
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-poster: 'Archivo Black', 'Arial Black', 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --maxw: 1160px;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/public/fonts/space-grotesk.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo Black';
  src: url('/public/fonts/archivo-black.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ================= base ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.015em; }
::selection { background: var(--accent); color: #0a0c10; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ================= nav ================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(10, 12, 16, .72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 28px); }
.nav-links a:not(.btn) {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); transition: color .2s;
}
.nav-links a:not(.btn):hover { color: var(--text); }

/* ================= buttons & chips ================= */
.btn {
  display: inline-block; background: var(--accent); color: #0a0c10;
  font-weight: 600; font-size: 15px; padding: 12px 22px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: transform .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); filter: none; }
.btn-small { padding: 8px 16px; font-size: 13px; border-radius: 10px; }
.btn-big { font-size: clamp(16px, 2.2vw, 20px); padding: 16px 32px; }
.btn-tiny { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: transparent; color: #ff7a7a; border-color: rgba(255, 122, 122, .35); }
.btn-danger:hover { background: rgba(255, 122, 122, .12); filter: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
}
.chip-accent { color: #0a0c10; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.chip-purple { color: #cfc6ff; border-color: rgba(143, 123, 255, .45); }
.chip-dark { background: rgba(10, 12, 16, .72); backdrop-filter: blur(6px); color: var(--text); }

/* ================= hero ================= */
.hero {
  position: relative; min-height: 86vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; text-align: center; padding: 40px 20px;
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(640px 420px at 22% 28%, rgba(255, 160, 46, .11), transparent 65%),
    radial-gradient(760px 520px at 78% 72%, rgba(143, 123, 255, .10), transparent 65%);
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, black 30%, transparent 75%);
}
.hero-inner { position: relative; max-width: 900px; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px;
  margin-bottom: 34px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 160, 46, .5); }
  70% { box-shadow: 0 0 0 9px rgba(255, 160, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 160, 46, 0); }
}
.hero-title {
  font-family: var(--font-poster);
  font-size: clamp(3rem, 10.5vw, 7.6rem);
  font-weight: 400; line-height: .98; letter-spacing: -0.015em;
  text-transform: uppercase; margin-bottom: 30px;
}
.hero-title span { display: block; }
.outline {
  color: transparent;
  -webkit-text-stroke: 2px var(--text);
  paint-order: stroke;
}
@supports not (-webkit-text-stroke: 2px black) { .outline { color: var(--muted); } }
.hero-sub { color: var(--muted); font-size: clamp(16px, 2vw, 19px); max-width: 620px; margin: 0 auto 30px; }
.hero-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .04em; color: var(--muted);
}
.hero-meta a:hover { color: var(--accent); }
.hero-meta .dot { opacity: .5; }
.scroll-cue {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 18px; animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 9px); } }

/* ================= sections ================= */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(60px, 9vw, 110px) clamp(16px, 4vw, 40px); }
.section-head { display: flex; align-items: center; gap: 18px; margin-bottom: 44px; }
.section-head .tick { width: 14px; height: 14px; background: var(--accent); flex-shrink: 0; }
.section-head h2 {
  font-family: var(--font-poster); font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.6rem); text-transform: uppercase; letter-spacing: -0.01em;
}

/* ================= work grid ================= */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card:hover {
  transform: translateY(-5px); border-color: rgba(255, 160, 46, .5);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}
.card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-media img { transform: scale(1.045); }
.card-media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s;
}
.card:hover .card-media video { opacity: 1; }
.card-badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; }
.card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.card-body h3 { font-size: 21px; }
.card-tagline { color: var(--muted); font-size: 15px; }

.card-featured { grid-column: 1 / -1; }
@media (min-width: 880px) {
  .card-featured { display: grid; grid-template-columns: 1.5fr 1fr; }
  .card-featured .card-media { aspect-ratio: auto; min-height: 380px; height: 100%; }
  .card-featured .card-body { justify-content: center; padding: 40px; gap: 14px; }
  .card-featured .card-body h3 { font-size: clamp(26px, 3vw, 36px); }
  .card-featured .card-tagline { font-size: 17px; }
}
.empty { color: var(--muted); }

/* ================= beyond games ================= */
.ai-panel {
  border: 1px solid rgba(143, 123, 255, .35);
  background: linear-gradient(180deg, rgba(143, 123, 255, .09), rgba(143, 123, 255, .02));
  border-radius: 24px; padding: clamp(24px, 4vw, 44px);
  box-shadow: 0 0 60px rgba(143, 123, 255, .07) inset;
  display: flex; flex-direction: column; gap: 26px;
}
.ai-lead { color: var(--muted); font-size: clamp(16px, 2vw, 19px); max-width: 640px; }
.ai-row {
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center;
  background: rgba(10, 12, 16, .55); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px); transition: border-color .25s, transform .25s;
}
.ai-row:hover { border-color: rgba(143, 123, 255, .6); transform: translateY(-3px); }
.ai-copy { display: flex; flex-direction: column; gap: 10px; }
.ai-copy h3 { font-size: clamp(20px, 2.6vw, 26px); }
.waveform { display: flex; align-items: center; gap: 4px; height: 72px; }
.waveform i {
  width: 4px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, var(--purple), var(--accent));
  animation: wave 1.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.09s);
}
@keyframes wave { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@media (max-width: 680px) { .waveform { display: none; } }

/* ================= about ================= */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(28px, 5vw, 60px); }
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }
.about-text p { margin-bottom: 1em; color: var(--text); }
.about-skills h4 {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin-bottom: 16px;
}

/* ================= contact & footer ================= */
.section-contact { text-align: center; }
.section-contact .section-head { justify-content: center; }
.contact-big { font-family: var(--font-poster); font-weight: 400; font-size: clamp(1.9rem, 5.5vw, 3.6rem); letter-spacing: -0.015em; margin-bottom: 30px; }
.footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 26px clamp(16px, 4vw, 40px);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px;
}
.footer-links { display: flex; gap: 18px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.footer-links a:hover { color: var(--accent); }
.admin-link { opacity: .45; }

/* ================= project page ================= */
.project-page { max-width: var(--maxw); margin: 0 auto; padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 40px); }
.back { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.back:hover { color: var(--accent); }
.project-title { font-family: var(--font-poster); font-weight: 400; font-size: clamp(2.2rem, 6.5vw, 4.2rem); text-transform: uppercase; letter-spacing: -0.015em; margin: 18px 0 10px; }
.project-tagline { color: var(--muted); font-size: clamp(16px, 2.2vw, 20px); max-width: 700px; }
.project-links { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 34px; }
.project-cover { border-radius: 20px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 44px; }
.project-cover img, .project-cover video { width: 100%; }
.project-body { display: grid; grid-template-columns: 260px 1fr; gap: clamp(28px, 5vw, 60px); }
@media (max-width: 800px) { .project-body { grid-template-columns: 1fr; } }
.project-meta { display: flex; flex-direction: column; gap: 22px; align-self: start; position: sticky; top: 88px; }
.meta-item h5 {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin-bottom: 6px;
}
.project-desc { font-size: 17px; }
.project-desc p { margin-bottom: 1.1em; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 44px; }
.gallery img {
  border-radius: 12px; border: 1px solid var(--line); width: 100%; aspect-ratio: 16/9; object-fit: cover;
  transition: transform .25s, border-color .25s; cursor: zoom-in;
}
.gallery a:hover img { transform: scale(1.02); border-color: var(--accent); }
dialog#lightbox { background: transparent; border: none; max-width: 92vw; padding: 0; }
dialog#lightbox::backdrop { background: rgba(5, 6, 9, .88); }
dialog#lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; cursor: zoom-out; }
.notfound { text-align: center; padding: 16vh 20px; }
.notfound .hero-sub { margin-bottom: 28px; }

/* ================= reveal animation ================= */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

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

/* ================= admin ================= */
body.admin { background: var(--bg-2); }
.admin-wrap { max-width: 1060px; margin: 0 auto; padding: 34px clamp(14px, 3vw, 32px) 80px; }
.admin-top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.admin-top h1 { font-size: 21px; }
.admin-top nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.admin-top nav a:not(.btn) { color: var(--muted); }
.admin-top nav a:not(.btn):hover { color: var(--text); }
.inline { display: inline; }
.linklike { background: none; border: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.linklike:hover { color: var(--text); }

.login-card {
  max-width: 380px; margin: 16vh auto 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 36px;
  display: flex; flex-direction: column; gap: 18px;
}
.login-card form { display: flex; flex-direction: column; gap: 18px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.admin-table th {
  text-align: left; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-hidden { opacity: .5; }
.cell-thumb img { width: 76px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.row-title { font-weight: 600; display: block; }
.row-title:hover { color: var(--accent); }
.row-slug { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cell-num { font-family: var(--font-mono); }
.cell-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 3px 10px; margin-right: 6px;
}
.badge-accent { color: #0a0c10; background: var(--accent); border-color: var(--accent); }
.badge-purple { color: #cfc6ff; border-color: rgba(143, 123, 255, .5); }
.badge-warn { color: #ffc46b; border-color: rgba(255, 196, 107, .45); }
.flash {
  background: rgba(255, 160, 46, .1); border: 1px solid rgba(255, 160, 46, .35);
  border-radius: 10px; padding: 10px 16px; margin-bottom: 20px; font-size: 14.5px;
}
.hint { color: var(--muted); font-size: 13.5px; margin-top: 18px; }

.admin-form { display: flex; flex-direction: column; gap: 22px; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px 22px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.field > span { font-weight: 600; }
.field small { color: var(--muted); font-size: 12.5px; }
.field input:not([type="checkbox"]), .field select, .field textarea {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 14.5px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { resize: vertical; line-height: 1.6; }
.current-file { width: 200px; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--line); }
.current-name { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); margin-top: 6px; display: block; }
.gallery-edit { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.gallery-item { width: 140px; font-size: 12.5px; color: var(--muted); }
.gallery-item img { border-radius: 8px; aspect-ratio: 16/9; object-fit: cover; border: 1px solid var(--line); margin-bottom: 4px; }
.form-row { display: flex; gap: 28px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.form-actions { display: flex; gap: 12px; align-items: center; }
.form-error {
  background: rgba(255, 122, 122, .1); border: 1px solid rgba(255, 122, 122, .4);
  border-radius: 10px; padding: 10px 16px; font-size: 14.5px;
}
