@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Space+Grotesk:wght@400;700&display=swap');

:root {
  --green: #00ff41;
  --green-dim: #00cc33;
  --green-dark: #003a00;
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --fg-dim: #bbb;
  --glitch-blue: #00d4ff;
  --glitch-purple: #b800ff;
}

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

html, body {
  width: 100%; min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Share Tech Mono', monospace;
  overflow-x: hidden;
}

/* ── Background layers ── */
#shader-root {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  background: var(--bg);
}
#shader-root canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 0.3;
}

#ascii-overlay {
  position: fixed; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0.15;
}
#ascii-overlay img {
  width: 100%; max-width: 1400px;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}

#scanlines {
  position: fixed; inset: 0; z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

#vignette {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
}

/* ── Page content ── */
#page {
  position: relative; z-index: 10;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.5rem;
  padding-top: 5.5rem;
}

/* ── Navigation ── */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0, 255, 65, 0.15);
  flex-wrap: wrap;
  gap: 0.5rem;
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  background: rgba(5, 5, 5, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: padding 0.3s;
}
@media (max-width: 600px) {
  nav.nav-scrolled {
    padding: 0.6rem 1.5rem;
    border-bottom-color: rgba(0, 255, 65, 0.25);
    background: rgba(5, 5, 5, 0.85);
  }
}
.nav-title {
  font-size: 1.3rem; font-weight: 700;
  color: var(--green); text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}
.nav-title::before {
  content: '> ';
}
@keyframes blink {
  50% { opacity: 0; }
}
.nav-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.nav-links a {
  color: var(--fg-dim); text-decoration: none;
  font-size: 0.9rem; text-transform: uppercase;
  letter-spacing: 0.1em; position: relative;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--green);
}
.nav-links a::after {
  content: '';
  position: absolute; bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--green);
  transition: width 0.3s;
}
.nav-links a:hover::after { width: 100%; }
.nav-icon {
  height: 1.2rem; width: auto;
  opacity: 0.5;
  transition: opacity 0.2s;
  vertical-align: middle;
  filter: brightness(0) invert(1);
}
.nav-icon:hover { opacity: 1; }

/* ── Page transitions ── */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: 0.2s ease-out both vt-fade-out;
}
::view-transition-new(root) {
  animation: 0.25s ease-out both vt-fade-in;
}
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
main {
  flex: 1;
  max-width: 780px;
  width: 100%;
  margin: 2rem auto;
  padding: 2rem;
  background: rgba(5, 5, 5, 0.75);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-radius: 4px;
  animation: page-enter 0.35s ease-out;
}

/* ── Homepage ── */
.home main {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  min-height: 60vh;
  background: none;
  border: none;
  backdrop-filter: none;
}
.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 20px rgba(0,255,65,0.3);
  margin-bottom: 0.5rem;
  animation: glitch-text 4s infinite;
}
.hero .tagline {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--fg-dim);
  margin-bottom: 2rem;
  line-height: 1.6;
}
.hero .tagline span {
  color: var(--green);
}

@keyframes glitch-text {
  0%, 90%, 100% { transform: none; opacity: 1; }
  92% { transform: translate(-2px, 1px) skewX(-1deg); opacity: 0.9; text-shadow: 2px 0 var(--glitch-blue), -2px 0 var(--glitch-purple); }
  94% { transform: translate(2px, -1px) skewX(1deg); opacity: 0.95; text-shadow: -2px 0 var(--glitch-blue), 2px 0 var(--glitch-purple); }
  96% { transform: translate(-1px, 0) skewX(0deg); }
}

.social-links {
  display: flex; gap: 1.5rem; justify-content: center;
  margin-top: 1.5rem;
}
.social-links a {
  color: var(--fg-dim);
  font-size: 1.4rem;
  transition: all 0.3s;
}
.social-links a:hover {
  color: var(--green);
  text-shadow: 0 0 10px rgba(0,255,65,0.5);
  transform: translateY(-2px);
}

/* ── Content pages ── */
article h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  color: var(--green);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0,255,65,0.15);
}
article h1::before { content: '# '; opacity: 0.5; }

article h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  color: var(--green-dim);
  margin: 2rem 0 0.8rem;
}

article h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  color: var(--green-dim);
  margin: 1.5rem 0 0.5rem;
}

article p {
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

article a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(0,255,65,0.3);
  transition: all 0.2s;
}
article a:hover {
  text-decoration-color: var(--green);
  text-shadow: 0 0 8px rgba(0,255,65,0.3);
}

article code {
  background: rgba(0,255,65,0.08);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  font-size: 0.9em;
  color: var(--green);
}

article pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,255,65,0.1);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
article pre code {
  background: none;
  padding: 0;
}

article blockquote {
  border-left: 2px solid var(--green);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--fg-dim);
  font-style: italic;
}

article ul, article ol {
  margin: 0.5rem 0 1rem 1.5rem;
  line-height: 1.8;
}

article li { margin-bottom: 0.3rem; }

article hr {
  border: none;
  border-top: 1px solid rgba(0,255,65,0.1);
  margin: 2rem 0;
}

article img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid rgba(0,255,65,0.1);
}

article .notice {
  border: 1px solid rgba(0,255,65,0.2);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(0,255,65,0.03);
}
article .notice-title {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--green);
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── List pages ── */
main h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  color: var(--green);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0,255,65,0.15);
}
main h1::before { content: '# '; opacity: 0.5; }

.post-item {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.post-item:last-child { border-bottom: none; }
.post-item a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.2s;
  display: block;
}
.post-item a:hover { color: var(--green); }
.post-item .meta {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-top: 0.3rem;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(0, 255, 65, 0.1);
  font-size: 0.8rem;
  color: var(--fg-dim);
}
footer a { color: var(--green-dim); text-decoration: none; }
footer a:hover { color: var(--green); }

/* ── 404 ── */
.error-page {
  text-align: center;
  padding: 4rem 0;
}
.error-page h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 6rem;
  color: var(--green);
  text-shadow: 0 0 30px rgba(0,255,65,0.3);
}
.error-page p {
  color: var(--fg-dim);
  margin: 1rem 0 2rem;
}

/* ── Terminal cursor ── */
.cursor::after {
  content: '_';
  animation: blink 1s step-end infinite;
}

/* ── Typewriter ── */
#tagline { min-height: 4em; margin-bottom: 2rem; }
.type-cursor {
  animation: blink 0.8s step-end infinite;
  color: var(--green);
  font-size: 1.1em;
}

/* ── Excerpts ── */
.post-item .excerpt {
  font-size: 0.85rem;
  color: var(--fg-dim);
  margin-top: 0.3rem;
  line-height: 1.5;
}

/* ── Post tags/categories ── */
.post-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 255, 65, 0.1);
  display: flex; gap: 1rem; flex-wrap: wrap;
}
.post-tags, .post-categories {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.post-tags a, .post-categories a {
  font-size: 0.8rem;
  color: var(--green-dim);
  text-decoration: none;
  padding: 0.15em 0.5em;
  border: 1px solid rgba(0, 255, 65, 0.15);
  border-radius: 2px;
  transition: all 0.2s;
}
.post-tags a:hover, .post-categories a:hover {
  color: var(--green);
  border-color: var(--green);
  text-shadow: 0 0 8px rgba(0,255,65,0.3);
}

/* ── Dark scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(0,255,65,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,255,65,0.3); }
html { scrollbar-color: rgba(0,255,65,0.15) var(--bg); }

/* ── Hamburger menu ── */
.nav-toggle { display: none; }
.hamburger {
  display: none; cursor: pointer;
  flex-direction: column; gap: 4px;
  padding: 4px;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--green);
  transition: all 0.3s;
}
.nav-toggle:checked + .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked + .hamburger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked + .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Responsive ── */
@media (max-width: 600px) {
  main { padding: 1.5rem 1rem; margin: 1rem auto; }
  .home main { min-height: 50vh; }
  .hamburger { display: flex; }
  .nav-links {
    display: none; width: 100%;
    flex-direction: column; gap: 0.5rem;
    padding-top: 0.5rem;
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }
}
