/* TheNeonAnarchist — app downloads site */

:root {
  --bg: #040404;
  --bg-grid: rgba(89, 218, 1, .06);
  --surface: #0d0d12;
  --surface-2: #15151d;
  --border: #2a2a36;
  --text: #ECEAF4;
  --text-muted: #A9A6BC;

  --lime: #59DA01;
  --magenta: #FC00C8;
  --purple: #C924D6;
  --violet: #8461E6;
  --blue: #4E97F5;
  --cyan: #4CDADF;
  --grad-brand: linear-gradient(90deg, #FC00C8, #A148E0 50%, #4E97F5);

  --font-display: "Audiowide", system-ui, sans-serif;
  --font-body: "Exo 2", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r-sm: 6px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;

  --glow-lime: 0 0 6px rgba(89, 218, 1, .6), 0 0 18px rgba(89, 218, 1, .25);
  --glow-magenta: 0 0 6px rgba(252, 0, 200, .55), 0 0 22px rgba(252, 0, 200, .25);
  --glow-blue: 0 0 6px rgba(78, 151, 245, .55), 0 0 22px rgba(78, 151, 245, .25);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--lime);

  --maxw: 1120px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --nav-h: 64px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--nav-h) + var(--s4)); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  overflow-x: hidden;
}

/* Grid + ambient glows live on a fixed layer so they can drift independently */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  inset: -40px 0 0 0;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: grid-drift 30s linear infinite;
}
body::after {
  background:
    radial-gradient(600px circle at 100% 0%, rgba(252, 0, 200, .10), transparent 60%),
    radial-gradient(600px circle at 0% 100%, rgba(76, 218, 223, .08), transparent 60%);
}

@keyframes grid-drift {
  from { transform: translateY(0); }
  to   { transform: translateY(40px); }
}

img { max-width: 100%; display: block; }

a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; margin: 0 0 var(--s4); letter-spacing: .01em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 var(--s4); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

[hidden] { display: none !important; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4); }
main { flex: 1; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s4); top: -100px; z-index: 100;
  background: var(--lime); color: var(--bg); padding: var(--s2) var(--s4);
  border-radius: var(--r-sm); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--s2); }

.mono { font-family: var(--font-mono); font-size: .85rem; color: var(--text-muted); }

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(4, 4, 4, .85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-nav .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }

.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--text); min-width: 0; }
.brand img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.brand span { font-family: var(--font-display); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-links { display: flex; align-items: center; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  color: var(--text-muted); text-decoration: none; font-weight: 600;
  position: relative; transition: color .2s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: 8px;
  height: 2px; background: var(--lime); box-shadow: var(--glow-lime);
}

.nav-links .support-pill {
  min-height: 36px; margin-left: var(--s2); padding: 0 var(--s4);
  border: 1px solid var(--magenta); border-radius: var(--r-pill);
  color: var(--text); font-size: .9rem;
  transition: box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.nav-links .support-pill:hover { box-shadow: var(--glow-magenta); background: rgba(252, 0, 200, .08); }
.nav-links .support-pill:focus-visible { border-radius: var(--r-pill); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--s2) var(--s4) var(--s4);
    background: rgba(4, 4, 4, .97);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0 var(--s2); }
  .nav-links a[aria-current="page"]::after { left: var(--s2); right: auto; width: 40px; }
  .nav-links .support-pill { margin: var(--s2) 0 0; justify-content: center; min-height: 44px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  border-radius: var(--r-pill); border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: box-shadow .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), transform .1s var(--ease);
}
.btn:focus-visible { border-radius: var(--r-pill); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--lime); color: var(--bg); }
.btn-primary:hover, .btn-primary:focus-visible { color: var(--bg); box-shadow: var(--glow-lime); }
.btn-primary:focus-visible { box-shadow: var(--focus), var(--glow-lime); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--blue); box-shadow: var(--glow-blue); }

.btn-kofi { background: transparent; color: var(--text); border-color: var(--magenta); }
.btn-discord { background: transparent; color: var(--text); border-color: #5865F2; }
.btn-discord:hover { color: var(--text); box-shadow: 0 0 6px rgba(88, 101, 242, .6), 0 0 22px rgba(88, 101, 242, .25); background: rgba(88, 101, 242, .1); }
.btn-kofi:hover { color: var(--text); box-shadow: var(--glow-magenta); background: rgba(252, 0, 200, .08); }

.btn-download { width: 100%; }
.btn-soon {
  background: transparent; color: var(--text-muted);
  border: 1px dashed var(--border); cursor: not-allowed;
}
.btn-soon:active { transform: none; }

/* ---------- HUD frame (corner brackets) ---------- */
.hud { position: relative; }
.hud > .hud-b { position: absolute; inset: 0; pointer-events: none; }
.hud::before, .hud::after,
.hud > .hud-b::before, .hud > .hud-b::after {
  content: ""; position: absolute; width: 22px; height: 22px;
  border-color: var(--lime); border-style: solid; border-width: 0;
  transform-origin: center; animation: bracket-in .6s var(--ease) both;
}
.hud::before { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.hud::after  { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.hud > .hud-b::before { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.hud > .hud-b::after  { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

@keyframes bracket-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- Hero ---------- */
.hero { padding: var(--s7) 0 var(--s6); text-align: center; }
.hero .container { display: flex; flex-direction: column; align-items: center; }

.logo-frame { padding: var(--s5); margin-bottom: var(--s5); }
.logo-mark { width: 180px; height: 180px; }
/* Transparent logo: glow follows the shape instead of a ring */
.logo-mark img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(201, 36, 214, .45)) drop-shadow(0 0 24px rgba(78, 151, 245, .25));
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(201, 36, 214, .35)) drop-shadow(0 0 18px rgba(78, 151, 245, .15)); }
  50% { filter: drop-shadow(0 0 14px rgba(201, 36, 214, .6)) drop-shadow(0 0 28px rgba(78, 151, 245, .35)); }
}

.hero h1 {
  font-size: clamp(2rem, 1.2rem + 3.5vw, 3.5rem);
  margin-bottom: var(--s2);
  filter: drop-shadow(0 0 14px rgba(252, 0, 200, .35));
  overflow-wrap: anywhere;
}
.hero h1:hover { animation: glitch 120ms steps(2) 1; }
@keyframes glitch {
  0%   { transform: translate(0); }
  33%  { transform: translate(-2px, 1px) skewX(-4deg); }
  66%  { transform: translate(2px, -1px) skewX(3deg); }
  100% { transform: translate(0); }
}

.hero .tagline { color: var(--lime); margin-bottom: var(--s5); }
.hero .bio { max-width: 560px; color: var(--text-muted); font-size: 1.1rem; }
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); margin: var(--s3) 0 var(--s6); }

@media (min-width: 720px) {
  .logo-mark { width: 260px; height: 260px; }
}

/* ---------- Social row ---------- */
.social-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); list-style: none; margin: 0; padding: 0; }
.social-row a {
  --accent: var(--lime);
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.social-row a:hover, .social-row a:focus-visible { color: var(--text); border-color: var(--accent); box-shadow: 0 0 6px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.social-row a:focus-visible { border-radius: 50%; box-shadow: var(--focus); }
.social-row svg { width: 20px; height: 20px; fill: currentColor; }
/* Narrow phones: wrap 4 + 3 instead of leaving one icon alone */
@media (max-width: 420px) { .social-row { max-width: 216px; margin-inline: auto; } }
.social-row.compact a { width: 44px; height: 44px; }
.social-row.compact svg { width: 18px; height: 18px; }

/* ---------- Sections ---------- */
.section { padding: var(--s7) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.section-head h2 { margin: 0; }
.section-head .mono a { color: var(--lime); }

.page-head { padding: var(--s7) 0 var(--s5); }
.page-head h1 { font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); margin-bottom: var(--s2); }
.page-head p { color: var(--text-muted); margin: 0; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-direction: column; gap: var(--s4); margin-bottom: var(--s5); }
.search {
  position: relative; max-width: 420px;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: var(--text-muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 44px; padding: 0 var(--s4) 0 42px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  font: inherit;
  transition: border-color .2s var(--ease);
}
.search input::placeholder { color: var(--text-muted); }
.search input:hover { border-color: var(--violet); }
.search input:focus-visible { border-radius: var(--r-pill); border-color: var(--lime); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  min-height: 36px; padding: 0 var(--s4);
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: .8rem; cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--violet); }
.chip[aria-pressed="true"] { color: var(--bg); background: var(--lime); border-color: var(--lime); }
.chip:focus-visible { border-radius: var(--r-pill); }

.result-count { margin: 0 0 var(--s4); }

/* ---------- Project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s5); }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card::before, .card::after {
  content: ""; position: absolute; z-index: 2; width: 16px; height: 16px;
  border: 0 solid var(--lime); opacity: .4; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.card::before { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.card::after  { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; }
.card:hover, .card:focus-within { transform: translateY(-2px); box-shadow: var(--glow-blue); border-color: rgba(78, 151, 245, .5); }
.card:hover::before, .card:hover::after,
.card:focus-within::before, .card:focus-within::after { opacity: 1; }

.card-media {
  aspect-ratio: 16 / 9; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.media-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(252, 0, 200, .25), transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(78, 151, 245, .25), transparent 60%),
    var(--surface-2);
}
.media-fallback svg { width: 64px; height: 64px; filter: drop-shadow(0 0 8px rgba(89, 218, 1, .5)); }

.card-body { display: flex; flex-direction: column; flex: 1; padding: var(--s5); }
.card-body h3 { margin-bottom: var(--s1); }
.card-body h3 a { color: var(--text); text-decoration: none; }
.card-body h3 a:hover { color: var(--lime); }
.card-meta { margin-bottom: var(--s3); }
.card-desc {
  color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: var(--s3);
}
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0 0 var(--s4); padding: 0; }
.tag {
  font-family: var(--font-mono); font-size: .72rem; color: var(--cyan);
  border: 1px solid rgba(76, 218, 223, .35); border-radius: var(--r-pill);
  padding: 2px var(--s2);
}
.card-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); align-items: stretch; }
.card-foot .details-link { align-self: center; font-size: .9rem; min-height: 32px; display: inline-flex; align-items: center; }

.empty {
  text-align: center; padding: var(--s7) var(--s4);
  border: 1px dashed var(--border); border-radius: var(--r-md);
  color: var(--text-muted);
}
.empty p { margin: 0; font-family: var(--font-mono); }

/* Fade-up on scroll (class added by JS only when motion is allowed) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.card.reveal { transition: opacity .5s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease); }
.card.reveal.in:hover, .card.reveal.in:focus-within { transform: translateY(-2px); }

/* ---------- Detail page ---------- */
.detail { padding: var(--s6) 0 var(--s7); }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: var(--s4); color: var(--lime); text-decoration: none; font-family: var(--font-mono); font-size: .9rem; }
.back-link:hover { color: var(--text); }
.detail-grid { display: grid; gap: var(--s6); }
@media (min-width: 860px) { .detail-grid { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.detail-media { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.detail h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); margin-bottom: var(--s3); overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.badge {
  font-family: var(--font-mono); font-size: .78rem;
  padding: 3px var(--s3); border-radius: var(--r-pill);
  border: 1px solid var(--border); color: var(--text);
  background: var(--surface);
}
.badge.version { border-color: rgba(89, 218, 1, .5); color: var(--lime); }
.detail-desc { color: var(--text-muted); font-size: 1.05rem; white-space: pre-line; }
.detail .btn-download { width: auto; min-width: 220px; margin: var(--s3) 0 var(--s5); }
.changelog { padding-left: var(--s5); color: var(--text-muted); }
.changelog li { margin-bottom: var(--s1); }

/* ---------- Request + Ko-fi cards ---------- */
.info-cards { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); max-width: 880px; }
.info-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3);
  justify-content: center;
  padding: var(--s6) var(--s5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.info-card h2 { font-size: 1.25rem; margin: 0; }
.info-card p { color: var(--text-muted); margin: 0; max-width: 460px; }
.info-card .btn { margin-top: var(--s2); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--s7);
  padding: var(--s6) 0 var(--s5);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .9rem;
}
.site-footer .container { display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center; }
.footer-brand { display: flex; align-items: center; gap: var(--s3); color: var(--text); text-decoration: none; font-family: var(--font-display); }
.footer-brand img { width: 32px; height: 32px; object-fit: contain; }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s5); }
.footer-meta p { margin: 0; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding: var(--s8) 0; }
.not-found .code { font-family: var(--font-display); font-size: clamp(4rem, 3rem + 6vw, 7rem); line-height: 1; margin-bottom: var(--s4); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-property: color, background-color, border-color !important;
  }
  .card:hover, .card:focus-within, .btn:active { transform: none; }
  .reveal { opacity: 1; transform: none; }
}
