/* ============================================
   The Year of 3K — Blog Aesthetic
   Vectorheart × Gen X Soft Club × Shounen × Cosmic Horror
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,wght@0,400;0,500;1,400&family=EB+Garamond:ital@0;1&display=swap');

/* --- CSS Variables --- */
:root {
  /* Void Base — cosmic horror */
  --void-900: #0B0710;
  --void-800: #11091C;
  --void-700: #1A0A2E;
  --void-600: #2D1547;

  /* Warm Text — gen x soft club */
  --cream-100: #F5EDE0;
  --cream-200: #E8DCC8;
  --cream-300: #D4C4A8;
  --warm-400:  #C4B89E;

  /* Neon Accents — vectorheart */
  --neon-pink:   #FF2D95;
  --neon-cyan:   #00E5FF;
  --neon-purple: #B026FF;

  /* Energy Accents — shounen */
  --shounen-orange: #FF6A00;
  --shounen-red:    #E63946;
  --shounen-yellow: #F4D03F;
  --shounen-blue:   #3A86FF;

  /* Typography */
  --font-display: 'Bebas Neue', 'Arial Black', sans-serif;
  --font-body: 'DM Sans', 'Georgia', serif;
  --font-quote: 'EB Garamond', 'Georgia', serif;

  /* Layout */
  --content-width: 680px;
  --content-padding: 24px;

  /* Effects */
  --grain-opacity: 0.035;
  --scanline-opacity: 0.025;
  --glow-spread: 15px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--cream-200);
  background: var(--void-900);

  /* Background gradient — deep space radial */
  background-image:
    radial-gradient(ellipse at 50% 0%, var(--void-700) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, var(--void-600) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 80%, #0B0710 0%, transparent 50%);

  background-attachment: fixed;
  min-height: 100vh;

  /* Grain overlay via pseudo-element */
  position: relative;
}

/* --- Grain Texture (CSS-only) --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Scanlines --- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  opacity: var(--scanline-opacity);
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(255, 255, 255, 0.03) 1px,
    rgba(255, 255, 255, 0.03) 2px
  );
}

/* --- Stars Background --- */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.stars::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  box-shadow:
    /* Large cluster — 30 stars */
    120px 45px 1.5px 0 rgba(255,255,255,0.8),
    340px 120px 1px 0 rgba(255,255,255,0.6),
    560px 80px 2px 0 rgba(255,255,255,0.7),
    780px 200px 1px 0 rgba(255,255,255,0.5),
    200px 300px 1.5px 0 rgba(255,255,255,0.6),
    500px 400px 0.5px 0 rgba(255,255,255,0.4),
    700px 350px 1px 0 rgba(255,255,255,0.7),
    900px 150px 1px 0 rgba(255,255,255,0.5),
    150px 500px 0.5px 0 rgba(255,255,255,0.3),
    350px 600px 1px 0 rgba(255,255,255,0.6),
    650px 550px 1.5px 0 rgba(255,255,255,0.5),
    850px 700px 1px 0 rgba(255,255,255,0.4),
    100px 750px 0.5px 0 rgba(255,255,255,0.3),
    300px 850px 1px 0 rgba(255,255,255,0.5),
    600px 900px 1px 0 rgba(255,255,255,0.6),
    900px 800px 1.5px 0 rgba(255,255,255,0.4),
    750px 100px 0.5px 0 rgba(255,255,255,0.5),
    50px 200px 1px 0 rgba(255,255,255,0.4),
    250px 650px 0.5px 0 rgba(255,255,255,0.3),
    450px 280px 1px 0 rgba(255,255,255,0.6),
    950px 450px 0.5px 0 rgba(255,255,255,0.3),
    80px 880px 1.5px 0 rgba(255,255,255,0.5),
    400px 50px 0.5px 0 rgba(255,255,255,0.4),
    600px 750px 1px 0 rgba(255,255,255,0.5),
    820px 620px 0.5px 0 rgba(255,255,255,0.6),
    280px 400px 1px 0 rgba(255,255,255,0.3),
    520px 180px 0.5px 0 rgba(255,255,255,0.4),
    680px 480px 1.5px 0 rgba(255,255,255,0.5),
    160px 150px 0.5px 0 rgba(255,255,255,0.3),
    420px 700px 1px 0 rgba(255,255,255,0.4);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-100);
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin-bottom: 1rem;
  /* Gradient text for big headers — vectorheart meets shounen */
  background: linear-gradient(135deg, var(--cream-100) 0%, var(--neon-pink) 50%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--cream-100);
}

h3 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1.25rem;
}

a {
  color: var(--neon-pink);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

a:hover {
  color: var(--neon-cyan);
  text-shadow: 0 0 var(--glow-spread) rgba(0, 229, 255, var(--glow-alpha));
}

/* Glitch link effect on hover */
a:hover::after {
  content: attr(href);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--neon-pink);
  clip-path: inset(40% 0 60% 0);
  animation: glitch-link 0.3s steps(2) infinite;
  pointer-events: none;
}

@keyframes glitch-link {
  0% { transform: translate(-1px, 0); }
  50% { transform: translate(2px, 2px); }
  100% { transform: translate(-2px, -1px); }
}

/* Only apply glitch on external links, not nav */
nav a:hover::after {
  display: none;
}

/* --- Navigation --- */
nav {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 2rem var(--content-padding);
  max-width: var(--content-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

nav .site-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-100);
  text-decoration: none;
  transition: all 0.3s ease;
}

nav .site-title:hover {
  color: var(--neon-pink);
  text-shadow: 0 0 20px rgba(255, 45, 149, 0.4);
}

/* The "3K" glitch */
nav .site-title .year-glitch {
  display: inline-block;
  transition: all 0.3s ease;
}

nav:hover .year-glitch {
  animation: glitch-text 0.4s steps(2) infinite;
}

@keyframes glitch-text {
  0% { transform: translate(0); }
  25% { transform: translate(-2px, 2px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 1px); }
  100% { transform: translate(0); }
}

nav .tagline {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--warm-400);
  font-style: italic;
  flex: 1;
  text-align: right;
}

@media (max-width: 600px) {
  nav .tagline {
    text-align: left;
    flex-basis: 100%;
  }
}

/* --- Main Content --- */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem var(--content-padding) 4rem;
  position: relative;
  z-index: 1;
}

/* --- Post List (Homepage) --- */
.post-list {
  list-style: none;
  margin-top: 2rem;
}

.post-list li {
  margin-bottom: 0.2rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s ease;
}

.post-list li:hover {
  border-bottom-color: rgba(255, 45, 149, 0.2);
  padding-left: 0.5rem;
}

.post-list a {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--cream-200);
  text-decoration: none;
  text-transform: uppercase;
  line-height: 1.2;
}

.post-list a:hover {
  color: var(--cream-100);
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.post-list time {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--warm-400);
  margin-top: 0.3rem;
  font-style: italic;
}

/* --- Post Page --- */
article header {
  margin-bottom: 3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 2rem;
}

article header h1 {
  margin-bottom: 0.5rem;
}

article header time {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--warm-400);
  font-style: italic;
}

/* --- Content Typography --- */
article p, article li {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--cream-200);
}

article strong {
  color: var(--cream-100);
  font-weight: 600;
}

article em {
  font-style: italic;
  color: var(--cream-300);
}

article blockquote {
  font-family: var(--font-quote);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--cream-300);
  border-left: 3px solid var(--neon-pink);
  padding-left: 1.5rem;
  margin: 2rem 0;
  opacity: 0.85;
}

article blockquote p {
  font-family: var(--font-quote);
}

article ul, article ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

article li {
  margin-bottom: 0.3rem;
}

article hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 45, 149, 0.3),
    transparent
  );
  margin: 3rem 0;
}

/* --- Code Blocks (vectorheart — machine language) --- */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.9rem;
  background: rgba(0, 229, 255, 0.06);
  color: var(--neon-cyan);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--void-800);
  border: 1px solid rgba(0, 229, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.3),
    0 0 5px rgba(0, 229, 255, 0.05);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* --- Images --- */
img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 2rem 0;
  filter: saturate(0.6) contrast(1.1) brightness(0.95);
  transition: all 0.5s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

img:hover {
  filter: saturate(0.8) contrast(1.1) brightness(1.05);
  border-color: rgba(255, 45, 149, 0.2);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.05);
}

/* --- Footer --- */
footer {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem var(--content-padding) 4rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

footer p {
  font-size: 0.8rem;
  color: var(--warm-400);
  opacity: 0.6;
}

footer a {
  color: var(--warm-400);
  font-size: 0.8rem;
}

footer a:hover {
  color: var(--neon-pink);
}

/* --- Footnotes / Small Text --- */
small, .footnotes {
  font-size: 0.85rem;
  color: var(--warm-400);
  opacity: 0.7;
}

/* --- Page Load Animation (shounen — staggered reveals) --- */
nav {
  animation: fadeSlideUp 0.6s ease forwards;
}

main {
  animation: fadeSlideUp 0.8s ease 0.15s both;
}

footer {
  animation: fadeSlideUp 0.6s ease 0.3s both;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Post list items stagger */
.post-list li:nth-child(1) { animation: fadeSlideUp 0.5s ease 0.2s both; }
.post-list li:nth-child(2) { animation: fadeSlideUp 0.5s ease 0.3s both; }
.post-list li:nth-child(3) { animation: fadeSlideUp 0.5s ease 0.4s both; }
.post-list li:nth-child(4) { animation: fadeSlideUp 0.5s ease 0.5s both; }
.post-list li:nth-child(5) { animation: fadeSlideUp 0.5s ease 0.6s both; }
.post-list li:nth-child(6) { animation: fadeSlideUp 0.5s ease 0.7s both; }
.post-list li:nth-child(7) { animation: fadeSlideUp 0.5s ease 0.8s both; }
.post-list li:nth-child(8) { animation: fadeSlideUp 0.5s ease 0.9s both; }
.post-list li:nth-child(9) { animation: fadeSlideUp 0.5s ease 1.0s both; }
.post-list li:nth-child(10) { animation: fadeSlideUp 0.5s ease 1.1s both; }

/* --- Mobile --- */
@media (max-width: 600px) {
  :root {
    --content-padding: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  nav .site-title {
    font-size: 1.3rem;
  }

  .post-list a {
    font-size: 1.2rem;
  }

  article p {
    font-size: 0.95rem;
  }

  body::before {
    opacity: calc(var(--grain-opacity) * 0.5);
  }

  body::after {
    opacity: calc(var(--scanline-opacity) * 0.5);
  }
}

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