/* ============================================================
   jeremymsparks.com — dark terminal / 80s neon aesthetic
   Built on ZPARX NeonFlux design tokens.
   ============================================================ */

:root {
  /* --- NeonFlux tokens --- */
  --color-lime-300: #5cffa6;
  --color-lime-400: #1fff8f;
  --color-lime-500: #15d473;
  --color-lime-700: #0c6b3a;
  --color-magenta-400: #c64fff;

  --color-ink-0: #050505;
  --color-ink-800: #121212;
  --color-ink-700: #1c1c1c;
  --color-ink-500: #3d3d3d;
  --color-ink-300: #8a8a8a;
  --color-ink-50: #f5f5f5;

  --bg-canvas: var(--color-ink-0);
  --bg-surface: var(--color-ink-800);
  --bg-raised: var(--color-ink-700);
  --fg-default: var(--color-ink-50);
  --fg-muted: var(--color-ink-300);
  --accent-default: var(--color-lime-400);
  --accent-hover: var(--color-lime-300);
  --accent-active: var(--color-lime-500);
  --border-default: var(--color-ink-700);
  --border-strong: var(--color-ink-500);
  --glow-primary: var(--color-lime-400);
  --glow-secondary: var(--color-magenta-400);

  --font-display: "Space Mono", ui-monospace, monospace;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 2px;
  --radius-md: 4px;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-canvas);
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--fg-default);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}

/* CRT scanline overlay */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0px,
    rgba(0, 0, 0, 0.35) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
  mix-blend-mode: overlay;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 49;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-default);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--accent-default);
  text-decoration: none;
  text-shadow: 0 0 8px rgba(31, 255, 143, 0.5);
  /* The name plus its blinking-cursor span are two inline nodes with no space
     between them — without this, a flex row squeezed for width can still
     break the line between "JMS" and "_", splitting the brand mark in two. */
  white-space: nowrap;
  flex-shrink: 0;
}

.cursor {
  display: inline-block;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--accent-default);
  text-shadow: 0 0 6px rgba(31, 255, 143, 0.5);
}

/* ---------- hero ---------- */

.hero {
  padding: 72px 24px 48px;
  text-align: center;
}

.glow-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--accent-default);
  text-shadow:
    0 0 4px rgba(31, 255, 143, 0.8),
    0 0 18px rgba(31, 255, 143, 0.45),
    0 0 40px rgba(31, 255, 143, 0.25);
}

.intro {
  max-width: 560px;
  margin: 0 auto 32px;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

.muted {
  color: var(--fg-muted);
  font-size: 1.02rem;
}

.cta-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent-default);
  color: var(--bg-canvas);
  box-shadow: 0 0 16px -2px rgba(31, 255, 143, 0.6);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  background: var(--accent-active);
}

.btn-outline {
  border-color: var(--border-strong);
  color: var(--fg-default);
}

.btn-outline:hover {
  border-color: var(--accent-default);
  color: var(--accent-default);
}

/* ---------- sections ---------- */

.section {
  padding: 48px 24px;
}

.section-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 1.1rem;
  color: var(--fg-default);
  margin: 0 0 24px;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 12px;
}

h1 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--fg-default);
}

/* ---------- post grid / cards ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: var(--accent-default);
  box-shadow: 0 0 20px -4px rgba(31, 255, 143, 0.4);
  transform: translateY(-2px);
}

.post-card-image {
  aspect-ratio: 1200 / 630;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-raised);
  border-bottom: 1px solid var(--border-default);
}

.post-card-body {
  padding: 16px 18px 20px;
}

.post-card-body h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 4px 0 8px;
  color: var(--fg-default);
}

.meta {
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.03em;
  margin: 0;
}

.meta a {
  color: var(--fg-muted);
}

.excerpt {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin: 0 0 12px;
}

.read-more {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--accent-default);
}

/* ---------- tool grid / cards ----------
   Same card as a post, one size up: bigger minimum track so the screenshot is
   actually readable, and auto-fit so a lone tool fills the row instead of
   sitting in a half-width column. */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 28px;
}

@media (max-width: 460px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }
}

.tools-intro {
  margin: 0 0 28px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--accent-default);
  box-shadow: 0 0 24px -4px rgba(31, 255, 143, 0.45);
  transform: translateY(-2px);
}

.tool-card-image {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: top center;
  background-color: var(--bg-raised);
  border-bottom: 1px solid var(--border-default);
}

/* Shown until a screenshot is dropped into public/images/tools/. */
.tool-card-image.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(135deg, rgba(31, 255, 143, 0.06), transparent 60%);
  font-family: var(--font-data);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.tool-card-body {
  padding: 20px 22px 24px;
}

.tool-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  color: var(--accent-default);
  text-shadow: 0 0 8px rgba(31, 255, 143, 0.35);
}

.tool-card-body .meta {
  margin-bottom: 12px;
}

.tool-card-body .excerpt {
  font-size: 0.95rem;
  color: var(--fg-default);
}

.tool-card-body .excerpt:last-of-type {
  margin-bottom: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- prose (about / post pages) ---------- */

.prose {
  max-width: 720px;
}

.prose h1 {
  margin-bottom: 8px;
}

.prose .meta {
  margin-bottom: 24px;
}

.prose p,
.prose li {
  color: var(--fg-default);
  font-size: 1.02rem;
}

.prose a {
  color: var(--accent-default);
  text-decoration: underline;
  text-decoration-color: rgba(31, 255, 143, 0.4);
  text-underline-offset: 2px;
}

.prose a:hover {
  text-shadow: 0 0 8px rgba(31, 255, 143, 0.6);
}

.prose strong {
  color: var(--fg-default);
}

.post-hero-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin: 8px 0 28px;
  display: block;
}

/* Images dropped into the body via Markdown — inline article photos, not the
   hero. Sized to the same treatment so a post reads as one consistent piece. */
.prose img:not(.post-hero-image) {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin: 28px 0;
  display: block;
}

.prose figure {
  margin: 28px 0;
}

.prose figure img {
  margin: 0;
}

.prose figcaption {
  margin-top: 8px;
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-align: center;
}

/* ---------- article typography ----------
   The vocabulary an article is built from: headings that group, lists that
   scan, and a handful of components (callout, pull quote, takeaways, contents)
   that break up a long read. The class names here are the ones the Postify
   prompt in the admin is told to emit — change one and change both. */

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--fg-default);
  /* Bound to the text underneath, spaced away from the section above. */
  margin: 56px 0 14px;
  /* Clears the sticky header when a table-of-contents link jumps here. */
  scroll-margin-top: 88px;
}

.prose h2 {
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

/* The same `//` the footer and the nav use — a section marker, in the site's
   own accent, without another colour or rule to manage. */
.prose h2::before {
  content: "// ";
  color: var(--accent-default);
  opacity: 0.65;
}

.prose h3 {
  font-size: 1.15rem;
  margin-top: 40px;
}

.prose h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-top: 32px;
}

.prose h2 + h3 { margin-top: 24px; }

.prose p {
  margin: 0 0 20px;
  line-height: 1.75;
}

.prose ul,
.prose ol {
  margin: 0 0 24px;
  padding-left: 22px;
}

.prose li { margin-bottom: 10px; line-height: 1.7; }
.prose li:last-child { margin-bottom: 0; }
.prose li > ul,
.prose li > ol { margin: 10px 0 0; }

.prose li::marker {
  color: var(--accent-default);
  font-family: var(--font-data);
  font-size: 0.9em;
}

.prose blockquote {
  margin: 32px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--accent-default);
  color: var(--fg-muted);
  font-style: italic;
}

.prose blockquote p:last-child { margin-bottom: 0; }

/* Pull quote — a line from the article, set apart. Wider than the text column
   on a roomy screen, so it reads as a break rather than another paragraph. */
.prose .pullquote {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--accent-default);
  text-shadow: 0 0 14px rgba(31, 255, 143, 0.25);
  margin: 44px 0;
  padding: 24px 0;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

/* Callout — a tip, a definition, a stat worth its own frame. */
.prose .callout {
  margin: 32px 0;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--accent-default);
  border-radius: var(--radius-md);
}

.prose .callout p:last-child { margin-bottom: 0; }
.prose .callout ul:last-child,
.prose .callout ol:last-child { margin-bottom: 0; }

.prose .callout-title {
  font-family: var(--font-data);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-default);
  margin: 0 0 8px;
}

.prose .callout.is-warning { border-left-color: var(--color-magenta-400); }
.prose .callout.is-warning .callout-title { color: var(--color-magenta-400); }

.prose .callout.is-stat {
  border-left-color: var(--border-strong);
  text-align: center;
}

.prose .callout.is-stat p:not(.callout-title) {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--fg-default);
}

/* Key takeaways — the summary box, usually near the end. */
.prose .key-takeaways {
  margin: 40px 0;
  padding: 22px 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.prose .key-takeaways-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-default);
  margin: 0 0 14px;
}

.prose .key-takeaways ul { margin: 0; }

/* Table of contents — jump links to the h2s below. */
.prose .toc {
  margin: 32px 0 44px;
  padding: 18px 22px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: rgba(18, 18, 18, 0.6);
}

.prose .toc-title {
  font-family: var(--font-data);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 10px;
}

.prose .toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .toc li {
  margin-bottom: 6px;
  font-family: var(--font-data);
  font-size: 0.82rem;
}

.prose .toc li::before {
  content: "> ";
  color: var(--accent-default);
}

.prose .toc a { text-decoration: none; }
.prose .toc a:hover { text-decoration: underline; }

/* Drop cap on the opening paragraph. */
.prose .dropcap::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.1em;
  line-height: 0.82;
  color: var(--accent-default);
  padding: 6px 10px 0 0;
  text-shadow: 0 0 16px rgba(31, 255, 143, 0.35);
}

.prose hr {
  border: 0;
  height: 1px;
  background: var(--border-default);
  margin: 48px 0;
}

/* Tables scroll inside their own box rather than widening the page. */
.prose .table-wrap {
  overflow-x: auto;
  margin: 32px 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
}

.prose th {
  font-family: var(--font-data);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--fg-muted);
  background: var(--bg-surface);
}

.prose tbody tr:last-child td { border-bottom: 0; }

.prose code {
  font-family: var(--font-data);
  font-size: 0.85em;
  color: var(--accent-default);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

.prose pre {
  margin: 28px 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  line-height: 1.6;
}

.prose pre code {
  color: var(--fg-default);
  background: none;
  border: 0;
  padding: 0;
  font-size: 1em;
}

@media (max-width: 620px) {
  .prose h2 { font-size: 1.3rem; }
  .prose .pullquote { font-size: 1.15rem; }
  .prose .dropcap::first-letter { font-size: 2.6em; }
}

/* ---------- contact form ---------- */

.contact-form {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin-top: 20px;
}

.contact-form label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  margin: 16px 0 6px;
}

.contact-form input,
.contact-form textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--fg-default);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent-default);
  box-shadow: 0 0 0 2px rgba(31, 255, 143, 0.25);
}

.contact-form button {
  margin-top: 24px;
  align-self: flex-start;
  cursor: pointer;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-default);
  padding: 28px 24px 60px;
  text-align: center;
}

.site-footer p {
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin: 0;
}

.site-footer a {
  color: var(--fg-muted);
}

.site-footer a:hover {
  color: var(--accent-default);
}

/* Pageview beacon — the site's entire analytics client. Kept out of the layout
   and off the accessibility tree; see netlify/functions/px.mjs. */
.px {
  position: absolute;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

/* Below this a wordmark plus all three nav links no longer share one row
   comfortably (nothing here is allowed to wrap mid-word to make it fit) — so
   the row breaks cleanly in two instead of packing nav into a ragged
   right-aligned block next to a vertically-centered wordmark. */
@media (max-width: 420px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding: 10px 0;
  }
  .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}
