/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 70px; }

:root {
  --bg:       #0d0d12;
  --surface:  #13131a;
  --border:   #1e1e2e;
  --accent:   #7c6ff7;
  --accent2:  #50e3c2;
  --text:     #e2e2f0;
  --muted:    #7a7a9a;
  --font-mono: 'Courier New', Courier, monospace;
  --radius:   8px;
  --nav-h:    60px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(16px, 1vw + 0.7rem, 18px);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }

main { flex: 1; }
a:hover { color: var(--accent2); }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .65rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  border: none;
}
.btn:hover { opacity: .85; transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  color: var(--accent2);
  border: 1.5px solid var(--accent2);
}

/* ── Nav ───────────────────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13,13,18,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: .1em;
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.8rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  font-size: .9rem;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

.nav-github {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--accent) !important;
  border: 1px solid var(--border);
  padding: .3rem .8rem;
  border-radius: var(--radius);
  transition: border-color .2s !important;
}
.nav-github:hover { border-color: var(--accent) !important; }

.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
#hero {
  position: relative;
  height: min(100vh, 850px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-stack {
  position: relative;
}
.hero-stack #hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.hero-stack > section {
  position: relative;
  z-index: 1;
}
.hero-stack #hero,
.hero-stack #credits {
  background: transparent;
}

#hero.hero--short {
  height: clamp(320px, 35vh, 380px);
  padding-top: calc(var(--nav-h) + 2rem);
}

.hero-content {
  position: relative;
  text-align: center;
  z-index: 1;
  max-width: 700px;
  padding: 2rem;
}

.hero-label {
  font-family: var(--font-mono);
  color: var(--accent2);
  font-size: .85rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: .75rem;
}

.hero-content h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}



/* ── Sections ──────────────────────────────────────────────────────────── */
section:not(#hero):not(.blog-page) {
  padding: 1.25rem 0;
}
section:nth-child(even) { background: var(--surface); }
section.blog-page {
  padding: calc(var(--nav-h) + 3rem) 0 4rem;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: .5rem;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  display: block;
  height: 3px;
  width: 40px;
  background: var(--accent);
  margin-top: .4rem;
  border-radius: 2px;
}
.section-sub {
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* ── About ─────────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 2rem;
  align-items: start;
}
.about-text p { color: var(--muted); margin-bottom: 1rem; }

.skills-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .75rem;
}
.skills-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.skills-list li {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent2);
  padding-left: 1.2rem;
  position: relative;
}
.skills-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── Recent Posts (homepage) ───────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.post-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color .25s, transform .25s;
  text-decoration: none;
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.post-card h3 {
  color: var(--text);
  font-size: 1.1rem;
  margin: .5rem 0;
}

.post-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.post-excerpt {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: .75rem;
}

.post-link {
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
}

.posts-more {
  margin-top: 2rem;
  text-align: center;
}

/* ── Credits / Shipped Titles ──────────────────────────────────────────── */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 400px));
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}
.credit-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 400px;
}
.credit-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.credit-info {
  padding: 1.25rem;
}
.credit-info h3 {
  color: var(--text);
  font-size: 1.15rem;
  margin: 0 0 .35rem;
}
.credit-role {
  color: var(--accent);
  font-size: .9rem;
  font-weight: 600;
  margin: 0 0 .15rem;
}
.credit-studio {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .04em;
  margin: 0;
}

/* ── Blog Header ───────────────────────────────────────────────────────── */
.blog-page .section-sub {
  margin-bottom: 1rem;
}

.blog-list-item {
  display: block;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: padding-left .2s;
}
.blog-list-item:hover {
  padding-left: .5rem;
}
.blog-list-item:first-child {
  border-top: 1px solid var(--border);
}

.blog-list-item h2 {
  color: var(--text);
  font-size: 1.2rem;
  margin: .3rem 0;
}

/* ── Blog Post ─────────────────────────────────────────────────────────── */
.blog-post {
  padding-top: calc(var(--nav-h) + 4rem);
  padding-bottom: 6rem;
}

.blog-post-header {
  max-width: 820px;
  margin: 0 auto 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.blog-post-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin: .5rem 0;
}

.blog-post-desc {
  color: var(--muted);
  font-size: 1.1rem;
  margin-top: .75rem;
}

.blog-post-tags {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent2);
  background: rgba(80, 227, 194, 0.08);
  padding: .2rem .6rem;
  border-radius: 4px;
  border: 1px solid rgba(80, 227, 194, 0.15);
}

/* Blog post body content */
.blog-post-content {
  max-width: 820px;
  margin: 0 auto;
}

.blog-post-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.blog-post-content h3 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: .75rem;
}

.blog-post-content p {
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.blog-post-content ul,
.blog-post-content ol {
  color: var(--muted);
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.blog-post-content li {
  margin-bottom: .4rem;
}

.blog-post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: .5rem 1.2rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
  background: rgba(124, 111, 247, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.blog-post-content code {
  font-family: var(--font-mono);
  font-size: .88rem;
  background: var(--surface);
  padding: .15rem .4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.blog-post-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.blog-post-content pre code {
  background: none;
  border: none;
  padding: 0;
}

.blog-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.blog-post-content .image-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
}

.blog-post-content .image-row img {
  max-height: 180px;
  max-width: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
  margin: 0;
}

.blog-post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-post-footer {
  max-width: 820px;
  margin: 4rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* ── Game ───────────────────────────────────────────────────────────────── */
#game {
  padding-top: calc(var(--nav-h) + 4rem);
}
#game .section-sub { margin-top: .5rem; }

.game-wrapper {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 2rem;
}

#snake-canvas {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  display: block;
  max-width: 100%;
}

.game-ui {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 140px;
}

.game-score, .game-best {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--muted);
}
.game-score span, .game-best span { color: var(--accent2); font-weight: 700; }

.game-controls {
  font-size: .82rem;
  color: var(--muted);
}
kbd {
  background: var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: .78rem;
}

.game-back {
  margin-top: 3rem;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
#footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: .88rem;
}
.footer-github {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted) !important;
}
.footer-github:hover { color: var(--text) !important; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--surface); padding: 1rem 2rem; border-bottom: 1px solid var(--border); gap: 1rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .game-wrapper { justify-content: center; }
  #snake-canvas { width: 100%; height: auto; }
  #hero.hero--short { height: 40vh; min-height: 250px; }
  #credits { padding-top: 0; }
  #credits .credits-grid { margin-top: 0.5rem; }
  .credits-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .credits-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  .credit-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
  }
}
