/* ==========================================================================
   Custom Theme: retro-arcade x modern minimalism
   ========================================================================== */

:root {
  /* Palette */
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --border: #2f2f2f;
  --text: #e6e6e6;
  --text-muted: #9a9a9a;
  --accent: #b026ff;        /* fills, borders, glows */
  --accent-text: #cf6bff;   /* brighter variant for text/links (better contrast) */
  --accent-glow: rgba(176, 38, 255, 0.45);

  /* Typography */
  --font-pixel: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --container: 960px;
  --prose: 700px;
  --radius: 4px;
  --space: 1rem;
  --pixel-shadow: 4px 4px 0 var(--accent);
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, video, svg { max-width: 100%; height: auto; display: block; }
::selection { background: var(--accent); color: #fff; }

/* Links ------------------------------------------------------------------ */
a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color 0.15s ease, text-shadow 0.15s ease, background-color 0.15s ease;
}
a:hover { color: #fff; text-shadow: 0 0 10px var(--accent-glow); }
a:focus-visible, button:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 0.5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Pixel-font headings ---------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-pixel);
  font-weight: 400;
  line-height: 1.5;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Header ----------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
  flex-wrap: wrap;
}
.site-title {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  color: #fff;
  text-shadow: 2px 2px 0 var(--accent);
}
.site-title:hover { color: #fff; text-shadow: 2px 2px 0 var(--accent), 0 0 14px var(--accent-glow); }
.site-title__cursor {
  color: var(--accent-text);
  margin-right: 0.5rem;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent-text); text-shadow: none; }
.site-nav a.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

/* Hero ------------------------------------------------------------------- */
.hero {
  padding: 4rem 0 3rem;
  text-align: left;
}
.hero__eyebrow {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--accent-text);
  margin: 0 0 1.25rem;
  text-transform: uppercase;
}
.hero__title {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  margin: 0 0 1.25rem;
  text-shadow: 3px 3px 0 var(--accent);
}
.hero__tagline {
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1.15rem;
  margin: 0 0 2rem;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 0.9rem 1.3rem;
  border: 2px solid var(--accent);
  border-radius: 0;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}
.btn:hover {
  color: #fff;
  text-shadow: none;
  background: #c24dff;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
.btn--ghost { background: transparent; color: var(--accent-text); }
.btn--ghost:hover { background: var(--accent); color: #fff; }

/* Sections --------------------------------------------------------------- */
.section { padding-bottom: 3rem; }
.section__title, .page-title {
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.9rem;
  border-bottom: 2px solid var(--border);
}
.section__title::before {
  content: "■ ";
  color: var(--accent);
}
.section__more { margin-top: 2rem; text-align: center; }
.page-header { padding: 3rem 0 0.5rem; }
.page-title { font-size: clamp(1rem, 3.5vw, 1.4rem); border: 0; padding: 0; }
.empty { color: var(--text-muted); }

/* Cards ------------------------------------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translate(-3px, -3px);
  border-color: var(--accent);
  box-shadow: var(--pixel-shadow);
}
.card__date {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.card__title {
  font-size: 0.8rem;
  margin: 0.9rem 0;
  line-height: 1.7;
}
.card__title a { color: #fff; }
.card__title a:hover { color: var(--accent-text); text-shadow: none; }
.card__summary {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}
.card__footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.card__meta { color: var(--text-muted); }
.card__more { font-family: var(--font-pixel); font-size: 0.6rem; text-transform: uppercase; }

/* Single post ------------------------------------------------------------ */
.post { max-width: var(--prose); margin-inline: auto; padding: 3rem 0 4rem; }
.post__title {
  font-size: clamp(1.1rem, 4vw, 1.7rem);
  margin: 0 0 1.25rem;
  text-shadow: 2px 2px 0 var(--accent);
}
.post__meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 2rem; }
.tags a {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.tags a:hover { border-color: var(--accent); text-shadow: none; }

/* Prose (post content) --------------------------------------------------- */
.prose { font-size: 1.0625rem; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: 1.05rem; margin-top: 2.5em; }
.prose h3 { font-size: 0.9rem; margin-top: 2em; }
.prose h4 { font-size: 0.8rem; }
.prose a { border-bottom: 1px solid var(--accent); }
.prose a:hover { background: var(--accent); border-color: var(--accent); text-shadow: none; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose img { border: 2px solid var(--border); border-radius: var(--radius); margin-inline: auto; }
.prose hr { border: 0; border-top: 2px dashed var(--border); margin: 2.5em 0; }

.prose blockquote {
  margin-inline: 0;
  padding: 0.5rem 1.25rem;
  background: var(--surface);
  border-left: 4px solid var(--accent);
  color: var(--text-muted);
}
.prose blockquote > * { margin: 0.5em 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  color: var(--accent-text);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}
.prose pre {
  background: var(--surface) !important;  /* overrides Chroma inline background */
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.5;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: 0.9rem; }

.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.6rem 0.9rem; text-align: left; }
.prose th { background: var(--surface); font-weight: 600; }

/* Prev / next ------------------------------------------------------------ */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}
.post-nav__link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.post-nav__link:hover { border-color: var(--accent); text-shadow: none; }
.post-nav__link--next { grid-column: 2; text-align: right; }
.post-nav__label { font-family: var(--font-pixel); font-size: 0.55rem; color: var(--accent-text); text-transform: uppercase; }
.post-nav__title { color: var(--text); font-size: 0.95rem; line-height: 1.4; }

/* Pagination ------------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0 3rem;
}
.pagination__status { font-family: var(--font-pixel); font-size: 0.65rem; color: var(--text-muted); }

/* Footer ----------------------------------------------------------------- */
.site-footer {
  border-top: 2px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer p { margin: 0; }
.footer-badge { font-family: var(--font-pixel); font-size: 0.55rem; text-transform: uppercase; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 2.5rem 0 2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .post { padding-top: 2rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__link--next { grid-column: auto; text-align: left; }
  .footer-inner { flex-direction: column; }
}

/* Respect reduced-motion preferences ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Plain pages ------------------------------------------------------------ */
.page .post__title { margin-bottom: 2rem; }

/* Gallery ---------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.5rem 0 3rem;
}
.gallery-item {
  display: block;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.gallery-item:hover {
  transform: translate(-3px, -3px);
  border-color: var(--accent);
  box-shadow: var(--pixel-shadow);
}

/* Lightbox */
.lightbox {
  border: 2px solid var(--accent);
  background: var(--bg);
  padding: 0;
  max-width: 92vw;
  max-height: 92vh;
  box-shadow: 8px 8px 0 var(--accent);
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.88); }
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: var(--accent);
  border: 0;
  cursor: pointer;
}

@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

.lightbox { text-align: center; }
.lightbox__caption {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--surface);
  border-top: 2px solid var(--border);
}

.gallery-item__caption {
  display: block;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-muted);
  border-top: 2px solid var(--border);
}
.gallery-item:hover .gallery-item__caption { color: var(--accent-text); }