/* Gem Tower Defense site styles. Dark retro theme matching the game. */

@font-face {
  font-family: 'Minercraftory';
  src: url('/fonts/Minercraftory.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'ByteBounce';
  src: url('/fonts/ByteBounce.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'PixelDraft';
  src: url('/fonts/PixelDraft-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #10151a;
  --panel: #1a222c;
  --panel-deep: #141b23;
  --line: #f0f7ff;
  --text: #e8eef6;
  --muted: #9fb0c3;
  --gold: #ffd670;
  --green: #2f6b42;
  --green-bright: #46b06c;
  --blue: #30618a;
  --aqua: #7ee7ff;
  --shadow: rgba(0, 0, 0, 0.55);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'ByteBounce', 'Courier New', monospace;
  font-size: 25px;
  line-height: 1.5;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

img.pixel, .pixel { image-rendering: pixelated; }

h1, h2, h3 {
  font-family: 'Minercraftory', 'ByteBounce', monospace;
  font-weight: normal;
  line-height: 1.25;
  text-shadow: 3px 3px 0 rgba(13, 13, 13, 0.65);
}
h1 { font-size: 34px; }
h2 { font-size: 26px; color: var(--gold); margin-bottom: 20px; }
h3 { font-size: 18px; margin-bottom: 8px; }

p { margin-bottom: 16px; }
a { color: var(--aqua); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: #fff; }
ul { margin: 0 0 16px 26px; }
li { margin-bottom: 8px; }
strong { color: var(--gold); font-weight: normal; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* --- Header ---------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  background: rgba(10, 14, 18, 0.82);
  border-bottom: 2px solid rgba(240, 247, 255, 0.18);
  backdrop-filter: blur(3px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 58px;
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Minercraftory', monospace;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(13, 13, 13, 0.65);
}
.site-header .brand img { width: 32px; height: 32px; }
.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 24px;
  font-size: 23px;
}
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--gold); }

/* --- Hero ------------------------------------------------------------ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 540px;
  overflow: hidden;
}
#title-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-cta {
  position: absolute;
  left: 50%;
  top: 74%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: rgba(240, 247, 255, 0.7);
  font-size: 28px;
  text-decoration: none;
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* Pixel-art button / badge, echoing the game's makeButtonTexture chrome. */
.pixel-btn {
  display: inline-block;
  font-family: 'Minercraftory', monospace;
  font-size: 15px;
  color: #f0f7ff;
  text-shadow: 2px 2px 0 rgba(13, 13, 13, 0.6);
  background: var(--green);
  border: 2px solid #0a0a0f;
  padding: 14px 22px 12px;
  text-decoration: none;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.22),
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    5px 5px 0 var(--shadow);
}
a.pixel-btn:hover { filter: brightness(1.12); color: #fff; }
.pixel-btn.badge { cursor: default; }
.pixel-btn small {
  display: block;
  font-family: 'ByteBounce', monospace;
  font-size: 21px;
  color: var(--gold);
  margin-top: 6px;
  text-shadow: none;
}

/* --- Sections ---------------------------------------------------------- */
.section {
  padding: 72px 0;
  /* Anchor jumps stop with the section top just below the fixed header. */
  scroll-margin-top: 58px;
}
.section.alt { background: var(--panel-deep); }

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 26px 28px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px;
  margin-top: 26px;
}
.feature {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 20px;
}
.feature .num {
  font-family: 'Minercraftory', monospace;
  font-size: 28px;
  color: var(--gold);
  display: block;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 rgba(13, 13, 13, 0.65);
}
.feature p { margin: 0; color: var(--muted); font-size: 22px; }

/* Gem gallery */
.gem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 18px;
  margin-top: 26px;
  text-align: center;
}
.gem-grid figure { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gem-grid img { width: 64px; height: 64px; }
.gem-grid figcaption { font-size: 23px; color: var(--muted); }

/* Enemy parade: sprites animated straight off the shared spritesheet.
   --row picks the variant (family index * 5 + tier - 1). */
.parade {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 30px;
}
.enemy-sprite {
  --row: 0;
  width: 64px;
  height: 64px;
  background-image: url('/assets/sprites/enemies.png?v=2');
  /* Sheet cells are 20px: a 16px frame inside 2px transparent gutters
     (stops edge bleed from neighbouring frames). Shown at 4x: 80px cells,
     8px inset to the frame itself. */
  background-size: 480px 4400px;
  background-position: -8px calc(var(--row) * -80px - 8px);
  image-rendering: pixelated;
  animation: walk-cycle 0.72s steps(6) infinite;
}
@keyframes walk-cycle {
  to { background-position: -488px calc(var(--row) * -80px - 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .enemy-sprite, .hero-scroll { animation: none; }
}

/* --- Legal / content pages --------------------------------------------- */
.page-main { padding: 118px 0 80px; }
.page-main .panel { margin-top: 24px; }
.page-main h1 { color: var(--gold); }
.page-main h2 { font-size: 20px; color: var(--text); margin: 28px 0 12px; }
.page-main .updated { color: var(--muted); font-size: 20px; margin-top: 10px; }
.page-main .backlink { font-size: 20px; }

.contact-box {
  margin-top: 22px;
  padding: 18px 22px;
  border: 2px dashed rgba(240, 247, 255, 0.4);
  font-size: 23px;
}

/* --- Footer ------------------------------------------------------------ */
.site-footer {
  border-top: 2px solid rgba(240, 247, 255, 0.18);
  background: #0b1014;
  padding: 44px 0 36px;
  font-size: 20px;
  color: var(--muted);
}
.site-footer .cols {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
}
.footer-brand {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.footer-brand img { width: 58px; height: 58px; }
.footer-brand .name {
  font-family: 'PixelDraft', monospace;
  font-size: 26px;
  color: #f4f7ff;
  line-height: 1;
  /* PixelDraft keeps ~5px of empty descent below the glyphs; drop the
     block so the visible bottom of "Games" meets the cat's feet. */
  transform: translateY(5px);
}
.footer-brand .name span { color: #b394e0; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--muted); }
.site-footer nav a:hover { color: var(--gold); }
.site-footer .legal { margin-top: 22px; font-size: 18px; }

@media (max-width: 640px) {
  body { font-size: 22px; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .site-header nav { gap: 14px; font-size: 19px; }
  .site-header .brand span { display: none; }
  .section { padding: 52px 0; }
  .panel { padding: 20px; }
  .hero-cta { top: 76%; width: min(92vw, 420px); }
}
