/* =====================================================================
   GitHub Achievements Guide — "Arcade" dark theme
   Neon cyan/purple/pink on GitHub-dark surfaces. Ships with the site.
   ===================================================================== */

:root {
  /* Surfaces */
  --bg:        #0a0d12;
  --bg-2:      #0d1117;
  --surface:   #12181f;
  --surface-2: #161b22;
  --elevated:  #1b2330;
  --border:    #263041;
  --border-2:  #30363d;

  /* Text */
  --text:      #e6edf3;
  --muted:     #9aa7b4;
  --dim:       #8792a0;

  /* Neon accents */
  --cyan:   #22d3ee;
  --blue:   #58a6ff;
  --purple: #bc8cff;
  --pink:   #ff7eb6;
  --green:  #7ee787;
  --gold:   #ffd166;

  --accent-grad: linear-gradient(90deg, #58a6ff 0%, #bc8cff 50%, #ff7eb6 100%);
  --accent-grad-br: linear-gradient(135deg, #22d3ee 0%, #bc8cff 55%, #ff7eb6 100%);

  --radius:    14px;
  --radius-lg: 20px;
  --ring: 0 0 0 1px var(--border);
  --shadow: 0 10px 30px -10px rgba(0,0,0,.7);
  --glow-cyan:   0 0 24px -2px rgba(34,211,238,.55);
  --glow-purple: 0 0 24px -2px rgba(188,140,255,.55);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;

  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---- Decorative background ------------------------------------------ */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(88,166,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88,166,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 340px at 12% -5%, rgba(34,211,238,.16), transparent 60%),
    radial-gradient(680px 380px at 92% 4%, rgba(188,140,255,.16), transparent 60%),
    radial-gradient(520px 320px at 60% 100%, rgba(255,126,182,.10), transparent 60%);
}

/* ---- Links / a11y --------------------------------------------------- */
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--cyan); color: #04121a; padding: .6rem 1rem;
  border-radius: 0 0 10px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---- Layout helpers ------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }

.eyebrow {
  display: inline-block; font-size: .78rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--cyan); font-weight: 700;
  margin: 0 0 10px;
}
.section-title {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 800;
  margin: 0 0 8px; letter-spacing: -.02em;
}
.section-sub { color: var(--muted); margin: 0 0 32px; max-width: 60ch; }

/* ---- Header / nav --------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(10,13,18,.72);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; }
.brand-mark { font-size: 1.35rem; filter: drop-shadow(0 0 10px rgba(255,209,102,.5)); }
.brand-text { letter-spacing: -.01em; }
.brand-accent {
  background: var(--accent-grad); -webkit-background-clip: text;
  background-clip: text; color: transparent; margin-left: 2px;
}
.nav-links { display: flex; align-items: center; gap: 22px; font-size: .93rem; }
.nav-links a { color: var(--muted); font-weight: 600; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 7px 16px !important; color: var(--text) !important;
  background: var(--surface-2); transition: box-shadow .2s, border-color .2s, transform .2s;
}
.nav-cta:hover { border-color: var(--purple); box-shadow: var(--glow-purple); transform: translateY(-1px); }
@media (max-width: 640px) {
  .nav-links a:not(.nav-cta):not(.nav-keep) { display: none; }
  .nav-links { gap: 14px; }
}

/* ---- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: .95rem; padding: 12px 22px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  transition: transform .18s ease, box-shadow .22s ease, border-color .2s;
}
.btn-primary {
  color: #04121a; background: var(--accent-grad-br);
  box-shadow: 0 8px 26px -8px rgba(188,140,255,.7);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -8px rgba(188,140,255,.85); color: #04121a; }
.btn-ghost {
  color: var(--text); background: var(--surface-2); border-color: var(--border-2);
}
.btn-ghost:hover { border-color: var(--cyan); box-shadow: var(--glow-cyan); color: var(--text); transform: translateY(-2px); }

/* ---- Hero ----------------------------------------------------------- */
.hero { position: relative; padding: 84px 0 40px; text-align: center; }
.hero-badge-row {
  display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; flex-wrap: wrap;
}
.hero-chip {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  color: var(--green); background: rgba(126,231,135,.1);
  border: 1px solid rgba(126,231,135,.28); padding: 5px 12px; border-radius: 999px;
}
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 1.04; font-weight: 900;
  letter-spacing: -.03em; margin: 6px auto 18px; max-width: 15ch;
}
.hero h1 .grad {
  background: var(--accent-grad); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.hero-sub {
  font-size: clamp(1.02rem, 2vw, 1.25rem); color: var(--muted);
  max-width: 56ch; margin: 0 auto 30px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 34px; justify-content: center; flex-wrap: wrap;
  margin-top: 46px; color: var(--muted);
}
.hero-stat { text-align: center; }
.hero-stat b {
  display: block; font-size: 1.9rem; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero-stat span { font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; }

/* ---- Quickstart callout -------------------------------------------- */
.quickstart {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.quickstart::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent-grad);
}
.quickstart h3 { margin: 0 0 6px; font-size: 1.3rem; }
.quickstart p { color: var(--muted); margin: 0 0 18px; }
.flow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: .9rem; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-top: 16px;
}
.flow .step { color: var(--text); }
.flow .arrow { color: var(--cyan); }
.flow .win { color: var(--gold); font-weight: 700; }

/* ---- Badge grid ----------------------------------------------------- */
.badge-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.badge-card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .28s ease;
}
/* gradient border on hover */
.badge-card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: 2;
  padding: 1px; background: var(--accent-grad-br);
  -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 .28s ease; pointer-events: none;
}
/* pointer-tracked spotlight (JS sets --mx/--my) */
.badge-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0;
  pointer-events: none; opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, -20%), rgba(188,140,255,.16), transparent 60%);
}
.badge-card:hover { transform: translateY(-6px); box-shadow: var(--glow-purple); }
.badge-card:hover::after { opacity: 1; }
.badge-card:hover::before { opacity: 1; }
/* keep real content above the spotlight layer */
.badge-card > .badge-img,
.badge-card > h3,
.badge-card > p,
.badge-card > .badge-meta,
.badge-card > .card-cta { position: relative; z-index: 1; }
.badge-card > .card-link { z-index: 3; }
.badge-card .badge-img {
  width: 64px; height: 64px; object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.6));
}
.badge-card h3 { margin: 0; font-size: 1.12rem; }
.badge-card p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.badge-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.pill {
  font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--muted); white-space: nowrap;
}
.pill.easy   { color: var(--green);  border-color: rgba(126,231,135,.4);  background: rgba(126,231,135,.08); }
.pill.medium { color: var(--gold);   border-color: rgba(255,209,102,.4);  background: rgba(255,209,102,.08); }
.pill.hard   { color: var(--pink);   border-color: rgba(255,126,182,.4);  background: rgba(255,126,182,.08); }
.pill.time   { color: var(--cyan);   border-color: rgba(34,211,238,.35); }
.badge-card .card-link { position: absolute; inset: 0; }
.badge-card .card-cta { font-size: .85rem; font-weight: 700; color: var(--cyan); }

/* ---- Tiers ---------------------------------------------------------- */
.tier-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px;
}
.tier-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.tier-card h3 { margin: 0 0 14px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.tier-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-top: 1px dashed var(--border); }
.tier-row:first-of-type { border-top: 0; }
.tier-row .lvl { color: var(--muted); font-size: .9rem; }
.tier-row .num { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.tier-bronze .num { color: #e0a878; }
.tier-silver .num { color: #cbd5e1; }
.tier-gold   .num { color: var(--gold); }
.single-tier-note {
  margin-top: 20px; color: var(--muted); font-size: .92rem;
  border-left: 3px solid var(--cyan); padding: 8px 0 8px 14px; background: rgba(34,211,238,.05);
  border-radius: 0 8px 8px 0;
}

/* ---- Speedrun quest log -------------------------------------------- */
.quest {
  position: relative; margin: 0; padding: 0; list-style: none;
  border-left: 2px solid var(--border-2); margin-left: 12px;
}
.quest li { position: relative; padding: 0 0 26px 30px; }
.quest li::before {
  content: attr(data-n); position: absolute; left: -17px; top: -2px;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .9rem; color: #04121a;
  background: var(--accent-grad-br); box-shadow: var(--glow-cyan);
}
.quest li b { color: var(--text); }
.quest li span { color: var(--muted); }
.quest-note { color: var(--dim); font-size: .9rem; margin-top: 8px; }

/* ---- FAQ ------------------------------------------------------------ */
.faq { display: grid; gap: 12px; }
.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px 18px; transition: border-color .2s;
}
.faq details[open] { border-color: var(--purple); }
.faq summary {
  cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--cyan); font-size: 1.3rem; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin: 0 0 16px; }

/* ---- Retired badges ------------------------------------------------- */
.retired { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 14px; }
.retired-card {
  background: var(--surface-2); border: 1px dashed var(--border-2);
  border-radius: 12px; padding: 16px 18px; opacity: .85;
}
.retired-card b { color: var(--text); }
.retired-card span { color: var(--dim); font-size: .9rem; }

/* ---- Divider -------------------------------------------------------- */
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--border-2), transparent); border: 0; margin: 8px 0; }

/* =====================================================================
   Guide pages (markdown content)
   ===================================================================== */
.guide-page { padding: 40px 0 80px; }
.guide-container { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.guide-back { margin: 0 0 22px; }
.guide-back a { font-weight: 600; color: var(--muted); }
.guide-back a:hover { color: var(--cyan); }

.markdown-body {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 48px);
  box-shadow: var(--shadow);
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body p:first-of-type img { border-radius: 12px; }
.markdown-body h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 900; letter-spacing: -.02em;
  margin: 0 0 18px; line-height: 1.15;
}
.markdown-body h2 {
  font-size: 1.4rem; margin: 36px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); font-weight: 800;
}
.markdown-body h3 { font-size: 1.15rem; margin: 26px 0 10px; }
.markdown-body p, .markdown-body li { color: var(--text); }
.markdown-body a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(34,211,238,.4); }
.markdown-body a:hover { text-decoration-color: var(--cyan); }
.markdown-body img { max-width: 100%; height: auto; }
.markdown-body p[align="center"] img, .markdown-body p img[align] { filter: drop-shadow(0 6px 24px rgba(0,0,0,.55)); }

.markdown-body blockquote {
  margin: 18px 0; padding: 14px 18px; color: var(--text);
  background: rgba(88,166,255,.07); border-left: 4px solid var(--blue);
  border-radius: 0 10px 10px 0;
}
.markdown-body blockquote > :first-child { margin-top: 0; }
.markdown-body blockquote > :last-child { margin-bottom: 0; }

.markdown-body code {
  font-family: var(--mono); font-size: .88em;
  background: var(--bg-2); border: 1px solid var(--border);
  padding: .15em .4em; border-radius: 6px; color: var(--pink);
}
.markdown-body pre {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; overflow-x: auto; margin: 16px 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.markdown-body pre code { background: none; border: 0; padding: 0; color: #d7e2f0; font-size: .86rem; }

.markdown-body table {
  width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .94rem;
  display: block; overflow-x: auto;
}
.markdown-body th, .markdown-body td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.markdown-body thead th { background: var(--surface-2); color: var(--text); font-weight: 700; }
.markdown-body tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }

.markdown-body hr { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--border-2), transparent); margin: 30px 0; }

.markdown-body details {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 16px; margin: 10px 0;
}
.markdown-body summary { cursor: pointer; font-weight: 700; padding: 12px 0; }

.guide-foot-nav {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap;
}

/* Guides index (guides/README) — style the plain table nicely, reuse markdown-body */
.markdown-body td a { font-weight: 600; }

/* ---- Reveal on scroll ---------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
/* No-JS fallback: never leave content hidden if scripts are blocked or fail */
html.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Footer --------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; background: var(--bg-2); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px; text-align: center; }
.footer-title { font-weight: 800; margin: 0 0 4px; }
.footer-sub { color: var(--muted); margin: 0 0 14px; }
.footer-links { margin: 0 0 14px; color: var(--dim); }
.footer-links a { color: var(--muted); }
.footer-fine { color: var(--dim); font-size: .8rem; max-width: 60ch; margin: 0 auto; }
