/* Ainme Blog — Phase 5 retro-modern theme
   Tokens: neon magenta/cyan/green on dark CRT grid.
   Motion respects prefers-reduced-motion.
*/

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-panel: rgba(18, 18, 26, 0.92);
  --text: #f5f5ff;
  --muted: #9a9ab0;
  --magenta: #ff00ff;
  --cyan: #00ffff;
  --green: #39ff14;
  --yellow: #f0e130;
  --border: #2a2a3a;
  --border-glow: rgba(0, 255, 255, 0.35);
  --focus: #00ffff;
  --danger: #ff2a6d;
  --font-body: "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Courier New", ui-monospace, "Cascadia Code", monospace;
  --radius: 6px;
  --wrap: 1080px;
  --header-h: 4.25rem;
  --shadow-neon: 0 0 18px rgba(255, 0, 255, 0.28);
  --shadow-cyan: 0 0 14px rgba(0, 255, 255, 0.25);
  --ease: 160ms ease;
  --scanline-opacity: 0.07;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.65;
  background-color: var(--bg);
  background-image:
    /* fine CRT scanlines */
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, var(--scanline-opacity)) 2px,
      rgba(0, 0, 0, var(--scanline-opacity)) 4px
    ),
    /* neon grid */
    linear-gradient(rgba(0, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 255, 0.03) 1px, transparent 1px),
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 0, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(0, 255, 255, 0.06), transparent 45%),
    var(--bg);
  background-size:
    auto,
    36px 36px,
    36px 36px,
    auto,
    auto,
    auto;
  background-attachment: fixed;
}

/* Soft CRT vignette */
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0.85;
}

/* Subtle screen noise (static) */
body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9997;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* —— Focus & links —— */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.2);
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--ease), text-shadow var(--ease);
}

a:hover {
  color: var(--magenta);
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.35);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--magenta);
  color: #000;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 0.55rem 1rem;
  z-index: 10000;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
  top: 0;
  outline-offset: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}

/* —— Header / nav —— */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0, 255, 255, 0.08);
}

.site-header::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--magenta), var(--cyan), transparent);
  opacity: 0.55;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  line-height: 1.1;
  color: var(--magenta);
  text-decoration: none;
  text-shadow: 0 0 14px rgba(255, 0, 255, 0.55);
  position: relative;
  transition: text-shadow var(--ease), transform var(--ease);
}

.logo:hover {
  color: var(--magenta);
  text-shadow:
    -2px 0 var(--cyan),
    2px 0 var(--magenta),
    0 0 18px rgba(255, 0, 255, 0.55);
}

.logo:hover,
.glitch-hover:hover {
  animation: glitch-skew 0.35s steps(2, end) 1;
}

@keyframes glitch-skew {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 1px);
  }
  40% {
    transform: translate(2px, -1px);
  }
  60% {
    transform: translate(-1px, 0);
  }
  100% {
    transform: translate(0);
  }
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.25rem;
  font-size: 0.92rem;
  align-items: center;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: color var(--ease), border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--cyan);
  border-color: rgba(0, 255, 255, 0.35);
  background: rgba(0, 255, 255, 0.06);
  text-shadow: none;
}

.nav a[aria-current="page"] {
  color: var(--cyan);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-cyan);
  background: rgba(0, 255, 255, 0.08);
}

.nav-admin {
  color: var(--green) !important;
}

.nav-admin:hover,
.nav-admin:focus-visible {
  border-color: rgba(57, 255, 20, 0.45) !important;
  color: var(--green) !important;
}

.nav-rss {
  color: var(--muted) !important;
}

.nav-toggle {
  display: none;
  font-family: var(--font-display);
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-cyan);
}

.nav-toggle:hover {
  background: rgba(0, 255, 255, 0.08);
}

.nav-toggle[aria-expanded="true"] {
  border-color: var(--magenta);
  color: var(--magenta);
  box-shadow: var(--shadow-neon);
}

.site-main {
  padding: 2rem 0 3.5rem;
  position: relative;
  z-index: 1;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.35rem 0 2.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.25));
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
}

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

.footer-meta a:hover {
  color: var(--cyan);
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--magenta);
  opacity: 0.85;
}

/* —— Full-page scroll-scrub (homepage) —— */
body.has-home-scroll {
  background-attachment: scroll;
}

body.has-home-scroll .site-main {
  /* Flush under sticky header — no phantom top gap */
  padding-top: 0;
  padding-bottom: 0;
}

body.has-home-scroll .site-footer {
  position: relative;
  z-index: 2;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(8px);
}

.home-scroll {
  --scroll-p: 0;
  --header-offset: 4.25rem; /* sticky nav clearance */
  position: relative;
  min-height: 0;
}

.home-scroll__stage {
  --stage-shift: 0%;
  position: fixed;
  /* Sit under the sticky header so the film starts in the content band */
  top: var(--header-offset);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #000;
  /* Promote to compositor layer for smooth parallax */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.home-scroll__canvas,
.home-scroll__poster {
  position: absolute;
  /* Slight overscan so parallax shift never shows edges */
  inset: -4%;
  width: 108%;
  height: 108%;
  left: -4%;
  top: -4%;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.06);
  transform: translate3d(0, calc(var(--scroll-p, 0) * -2.5%), 0)
    scale(calc(1.04 + var(--scroll-p, 0) * 0.07));
  will-change: transform;
  backface-visibility: hidden;
}

.home-scroll__canvas {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.home-scroll__canvas.is-ready {
  opacity: 1;
}

.home-scroll__canvas.is-hidden {
  display: none;
}

.home-scroll__poster {
  opacity: 1;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.home-scroll__poster.is-visible {
  opacity: 1;
  z-index: 1;
}

.home-scroll__canvas.is-ready + .home-scroll__poster,
.home-scroll__stage .home-scroll__poster:not(.is-visible) {
  opacity: 0;
  pointer-events: none;
}

.home-scroll__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(10, 10, 15, 0.55) 0%,
      rgba(10, 10, 15, calc(0.45 + var(--scroll-p) * 0.25)) 40%,
      rgba(10, 10, 15, calc(0.75 + var(--scroll-p) * 0.15)) 100%
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px
    );
}

.home-scroll__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.08);
}

.home-scroll__progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  box-shadow: 0 0 12px rgba(255, 0, 255, 0.45);
  will-change: transform;
}

.home-scroll__content {
  position: relative;
  z-index: 1;
  /* Scroll runway: long enough to scrub the clip, not a huge empty first screen */
  min-height: 220vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 4rem;
}

.home-scroll__intro {
  /* Content starts just under the nav — no large empty band */
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding-top: calc(var(--header-offset) + 1.25rem);
  padding-bottom: 2.5rem;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.home-scroll__title {
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.8);
}

.home-scroll__lead {
  color: rgba(245, 245, 255, 0.9);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
  max-width: 36rem;
}

.home-scroll__hint {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.35s ease;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.35);
}

.home-scroll__hint.is-faded {
  opacity: 0;
  pointer-events: none;
}

.home-scroll__hint-icon {
  display: inline-block;
  animation: scroll-hint-bounce 1.4s ease-in-out infinite;
}

@keyframes scroll-hint-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

.home-scroll__main {
  padding-top: 2rem;
  padding-bottom: 3rem;
  flex: 1 0 auto;
  will-change: transform;
  backface-visibility: hidden;
}

.home-scroll__panel {
  /* Light glass shell — video shows through; cards have stronger glass */
  background: rgba(12, 12, 18, 0.28);
  border: 1px solid rgba(0, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.5rem;
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.home-scroll__panel--side {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.home-scroll__panel--side .sidebar {
  position: static;
}

.home-scroll__panel--side .sidebar-block {
  background: rgba(12, 12, 18, 0.42);
  border: 1px solid rgba(0, 255, 255, 0.2);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

/* Glass blog cards over scroll video */
.home-scroll .post-card {
  background: rgba(18, 18, 28, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.home-scroll .post-card:hover {
  background: rgba(24, 20, 36, 0.48);
  border-color: rgba(255, 0, 255, 0.45);
  box-shadow:
    0 0 24px rgba(255, 0, 255, 0.22),
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Softer scanlines so video peeks through */
.home-scroll .post-card.scanlines::after {
  opacity: 0.18;
}

.home-scroll .post-card__title a {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.home-scroll .post-card__excerpt,
.home-scroll .post-card__meta {
  color: rgba(200, 200, 220, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.home-scroll__outro {
  margin-top: 1rem;
  margin-bottom: 2rem;
  background: rgba(12, 12, 18, 0.4);
  will-change: transform;
  backface-visibility: hidden;
}

/* GPU-friendly glass cards (avoid repainting blur every frame if possible) */
.home-scroll .post-card {
  transform: translateZ(0);
}

.home-scroll--static .home-scroll__hint,
.home-scroll--static .home-scroll__progress {
  display: none;
}

.home-scroll--static .home-scroll,
.home-scroll--static.home-scroll {
  min-height: 0;
}

.home-scroll--static .home-scroll__content {
  min-height: 0;
}

.home-scroll--static .home-scroll__canvas,
.home-scroll--static .home-scroll__poster {
  transform: none;
}

.home-scroll--static .home-scroll__canvas {
  display: none;
}

.home-scroll--static .home-scroll__poster {
  opacity: 1 !important;
}

@media (max-width: 800px) {
  .home-scroll {
    --header-offset: 5.5rem; /* taller wrapped nav */
  }

  .home-scroll__content {
    min-height: 200vh;
  }

  .home-scroll__intro {
    padding-top: calc(var(--header-offset) + 0.85rem);
    padding-bottom: 2rem;
  }

  .home-scroll__title {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-scroll__hint-icon {
    animation: none !important;
  }

  .home-scroll__content {
    min-height: 0;
  }

  .home-scroll__stage {
    top: var(--header-offset);
  }

  .home-scroll__canvas,
  .home-scroll__poster {
    transform: none !important;
  }
}

/* —— Hero —— */
.hero {
  padding: 2.25rem 0 2.75rem;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 10% auto auto 0;
  width: min(100%, 28rem);
  height: 60%;
  background: radial-gradient(circle, rgba(0, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #000;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  margin: 0 0 1rem;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.3);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.65rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.neon {
  color: var(--cyan);
  text-shadow:
    0 0 10px rgba(0, 255, 255, 0.55),
    0 0 28px rgba(0, 255, 255, 0.25);
}

.hero-lead,
.lead {
  color: var(--muted);
  max-width: 40rem;
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* —— Buttons —— */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  padding: 0.58rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--ease), filter var(--ease), box-shadow var(--ease), background var(--ease), color var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--magenta);
  color: #000;
  box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
  color: #000;
  filter: brightness(1.1);
  box-shadow: 0 0 24px rgba(255, 0, 255, 0.45);
}

.btn-ghost {
  border-color: var(--cyan);
  color: var(--cyan);
  background: transparent;
  box-shadow: inset 0 0 12px rgba(0, 255, 255, 0.05);
}

.btn-ghost:hover {
  background: rgba(0, 255, 255, 0.1);
  color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* —— Cards / scanlines —— */
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.card:hover {
  border-color: rgba(0, 255, 255, 0.35);
  box-shadow: var(--shadow-cyan);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  color: var(--cyan);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.scanlines {
  position: relative;
  overflow: hidden;
}

.scanlines::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.14) 2px,
    rgba(0, 0, 0, 0.14) 4px
  );
  opacity: 0.4;
  z-index: 0;
}

.scanlines > * {
  position: relative;
  z-index: 1;
}

.scanlines-soft {
  position: relative;
}

.page-block h1 {
  font-family: var(--font-display);
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-shell {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: rgba(18, 18, 26, 0.7);
}

.admin-links {
  padding-left: 1.2rem;
  color: var(--muted);
}

code {
  font-family: var(--font-display);
  color: var(--green);
  font-size: 0.9em;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.25);
}

/* —— Layout —— */
.layout-with-sidebar {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: start;
}

.layout-main {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 5rem;
}

.sidebar-block {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: inset 0 0 24px rgba(0, 255, 255, 0.03);
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 0.75rem;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.25);
}

.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.22rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(0, 255, 255, 0.04);
  transition: border-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.chip:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
  text-shadow: none;
}

.chip-tag {
  border-color: rgba(255, 0, 255, 0.35);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--cyan);
  margin: 0 0 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.45), transparent);
}

.section-more {
  margin-top: 1.5rem;
}

.page-header h1 {
  font-family: var(--font-display);
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* —— Post cards —— */
.post-grid {
  display: grid;
  gap: 1rem;
}

.post-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.post-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.post-card:hover {
  border-color: rgba(255, 0, 255, 0.4);
  box-shadow: var(--shadow-neon);
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0.25rem 0 0.4rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
  text-shadow: none;
}

.post-card__title a:hover {
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.35);
}

.post-card__meta,
.post-card__cats,
.post-card__tags {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.post-card__cats a,
.post-card__tags a {
  margin-right: 0.5rem;
}

.post-card__excerpt {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.post-card__more {
  margin: 0;
  position: relative;
  z-index: 1;
}

.post-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin: 0;
  position: relative;
  z-index: 1;
  min-height: 2rem;
}

/* Read on the left; work title on the right (parallel) */
.post-card__read {
  flex: 0 0 auto;
  order: 1;
}

a.post-card__work,
.post-card__work {
  flex: 0 1 auto;
  order: 2;
  margin-left: auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(100%, 14rem);
  text-align: right;
  text-decoration: none;
}

a.post-card__work:hover {
  color: var(--magenta);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-scroll .post-card__work {
  color: var(--cyan);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.post-work-title,
a.post-work-title {
  font-family: var(--font-display);
  font-size: 0.9em;
  color: var(--cyan);
  letter-spacing: 0.02em;
  text-decoration: none;
}

a.post-work-title:hover {
  color: var(--magenta);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.pagination__status {
  color: var(--muted);
  font-size: 0.9rem;
  font-family: var(--font-display);
}

.result-count,
.filter-pill {
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-pill strong {
  color: var(--green);
}

.post-page__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  line-height: 1.2;
  margin: 0.25rem 0 0.5rem;
  letter-spacing: 0.02em;
}

.post-page__header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-page__tags {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* —— Prose —— */
.prose {
  max-width: 42rem;
}

.prose h1,
.prose h2,
.prose h3 {
  font-family: var(--font-display);
  color: var(--cyan);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.prose p,
.prose li {
  color: var(--text);
}

.prose a {
  color: var(--magenta);
}

.prose pre {
  background: #0d0d14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  box-shadow: inset 0 0 20px rgba(0, 255, 255, 0.04);
}

.prose img,
.prose video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
}

.prose blockquote {
  margin: 1rem 0;
  padding: 0.35rem 0 0.35rem 1rem;
  border-left: 3px solid var(--magenta);
  color: var(--muted);
  background: linear-gradient(90deg, rgba(255, 0, 255, 0.06), transparent);
}

/* —— Forms —— */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.search-form input[type="search"],
.contact-form input,
.contact-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.search-form input[type="search"]:focus-visible,
.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  border-color: var(--cyan);
}

.search-form input[type="search"] {
  flex: 1 1 12rem;
  min-width: 0;
}

.search-form--compact {
  margin: 0;
}

.search-form--compact input[type="search"] {
  width: 100%;
  flex: 1 1 auto;
}

.contact-form {
  display: grid;
  gap: 1rem;
  max-width: 28rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-size: 0.9rem;
  color: var(--muted);
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.flash-ok {
  border: 1px solid var(--green);
  color: var(--green);
  background: rgba(57, 255, 20, 0.08);
}

.flash-error {
  border: 1px solid var(--magenta);
  color: var(--magenta);
  background: rgba(255, 0, 255, 0.08);
}

.archive-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.archive-list li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.archive-list time {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.author-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.author-grid h3 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
  color: var(--magenta);
}

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

/* —— Reactions & comments —— */
.reactions,
.comments {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reaction-form {
  margin: 0;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.reaction-btn:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.reaction-btn.is-active {
  border-color: var(--magenta);
  background: rgba(255, 0, 255, 0.12);
  box-shadow: var(--shadow-neon);
  color: var(--magenta);
}

.reaction-emoji {
  font-size: 1rem;
  line-height: 1;
}

.reaction-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 1ch;
}

.reaction-btn.is-active .reaction-count {
  color: var(--magenta);
}

.comment-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.comment-item {
  padding: 1rem 1.1rem;
}

.comment-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.comment-item__name {
  color: var(--cyan);
  font-family: var(--font-display);
}

.comment-item__meta time {
  color: var(--muted);
  font-size: 0.85rem;
}

.comment-item__body {
  color: var(--text);
  line-height: 1.55;
}

.comment-form {
  margin-top: 1rem;
  max-width: 28rem;
}

.comment-form__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--magenta);
  margin: 0 0 0.35rem;
}

/* Honeypot — hide from humans, leave for bots */
.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* —— Responsive —— */
@media (max-width: 800px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    order: 2;
  }

  .nav-toggle {
    display: inline-block;
    margin-left: auto;
  }

  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 0.75rem;
    gap: 0.25rem;
  }

  .nav.is-open {
    display: flex;
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  body::before {
    opacity: 0.5;
  }
}

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

  .logo:hover,
  .glitch-hover:hover {
    animation: none !important;
    text-shadow: 0 0 12px rgba(255, 0, 255, 0.5);
    transform: none;
  }

  body::after {
    opacity: 0;
  }
}

/* High contrast boost when requested */
@media (prefers-contrast: more) {
  :root {
    --border: #5a5a70;
    --muted: #c0c0d0;
    --scanline-opacity: 0.03;
  }

  .post-card,
  .card,
  .sidebar-block {
    border-width: 2px;
  }
}
