@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500&display=swap');

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

:root {
  --bg: #0e0e10;
  --text: #6e756e;
  --text-secondary: #485048;
  --text-bright: #b0b8b0;
  --border: #1a1e1a;
  --font: 'IBM Plex Mono', 'SF Mono', monospace;
}

html { scroll-behavior: smooth; background: #0e0e10; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 2;
}

/* ── Particles canvas ────────────────────────────── */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ── Nav ─────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.2rem 4.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  background: rgba(14, 14, 16, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-left {
  display: flex;
  gap: 1.5rem;
}

.nav-left a {
  font-size: 0.8rem;
  color: #ff5555;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: #2a2224;
  text-shadow: 0 0 10px rgba(192, 144, 144, 0.25);
  transition: color 0.3s, text-decoration-color 0.3s, text-shadow 0.3s;
}

.nav-left a:hover {
  color: #ff8888;
  text-decoration-color: #504045;
  text-shadow: 0 0 14px rgba(224, 160, 160, 0.5), 0 0 35px rgba(224, 160, 160, 0.2);
}

.nav-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.social-icon {
  color: #ff5555;
  text-decoration: none;
  filter: drop-shadow(0 0 8px rgba(192, 144, 144, 0.25));
  transition: color 0.3s, filter 0.3s;
  display: flex;
  align-items: center;
}

.social-icon:hover {
  color: #ff8888;
  filter: drop-shadow(0 0 12px rgba(224, 160, 160, 0.5)) drop-shadow(0 0 30px rgba(224, 160, 160, 0.2));
}

/* ── Home ────────────────────────────────────────── */
.home {
  padding-top: 8rem;
  padding-bottom: 2rem;
}

.emphasis {
  color: #82aa82;
  text-shadow: 0 0 10px rgba(130, 170, 130, 0.25);
  transition: color 0.3s, text-shadow 0.3s;
}

.emphasis {
  position: relative;
  cursor: default;
  pointer-events: none;
}

.revealed .emphasis, .emphasis.revealed {
  pointer-events: auto;
}

.emphasis:hover {
  color: #a0d0a0;
  text-shadow: 0 0 14px rgba(130, 170, 130, 0.5), 0 0 35px rgba(130, 170, 130, 0.2);
}

.emphasis-tooltip {
  position: fixed;
  background: #161618;
  border: 1px solid #1e2e1e;
  color: #9888a8;
  font-size: 0.75rem;
  line-height: 1.5;
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  white-space: normal;
  width: max-content;
  max-width: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 200;
  font-style: italic;
}

.inline-link {
  color: #90a8d0;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(144, 168, 208, 0.25);
  transition: color 0.3s, text-shadow 0.3s;
}

.inline-link:hover {
  color: #b0c8f0;
  text-shadow: 0 0 14px rgba(144, 168, 208, 0.5), 0 0 35px rgba(144, 168, 208, 0.2);
}

.intro {
  margin-top: 1.5rem;
}

.intro p {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 1em;
  line-height: 1.9;
}

/* ── About ───────────────────────────────────────── */
.about {
  padding-bottom: 6rem;
}

.about.has-top-pad {
  padding-top: 8rem;
}

h1 {
  font-size: 1.6rem;
  font-weight: 500;
  color: #82aa82;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.greeting {
  color: var(--text);
  font-weight: 400;
  text-shadow: none;
}

.about-heading {
  margin-bottom: 0.5rem;
}

.bio {
  margin-bottom: 2rem;
}

.bio p {
  font-weight: 300;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1em;
}


/* ── Writings ────────────────────────────────────── */
.writings {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border);
}

h2 {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.post {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: opacity 0.2s;
}

.post:first-of-type {
  border-top: 1px solid var(--border);
}

.post:hover {
  opacity: 0.6;
}

.post-title {
  color: var(--text-bright);
  font-size: 0.88rem;
  font-weight: 400;
}

.post-date {
  color: var(--text-secondary);
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-left: 2rem;
}

/* ── Footer ──────────────────────────────────────── */
footer {
  padding: 6rem 0 4rem;
}

footer p {
  font-size: 0.7rem;
  color: var(--text-secondary);
  opacity: 0.3;
  font-style: italic;
}

.cursor {
  animation: blink 1.2s step-end infinite;
}

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

/* ── Fade in ─────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Links ───────────────────────────────────────── */
a {
  color: var(--text-bright);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #c0d0c0;
}

::selection {
  background: rgba(128, 160, 128, 0.2);
  color: #fff;
}

/* ── Post page ───────────────────────────────────── */
.post-body {
  margin-top: 2rem;
}

.post-body p {
  font-weight: 300;
  font-size: 1rem;
  margin-bottom: 1.4em;
}

/* ── Boot sequence ────────────────────────────────── */
.boot {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}

.boot-done {
  opacity: 0;
}

.boot-lines {
  max-width: 720px;
  padding: 0 2rem;
}

.boot-lines p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 2;
  min-height: 1.6em;
}

.boot-lines p:last-child {
  color: var(--text-bright);
}

.site-hidden {
  opacity: 0;
}

.site-hidden.site-hidden {
  animation: site-reveal 0.6s ease forwards;
  animation-play-state: paused;
}

main:not(.site-hidden) {
  opacity: 1;
}

/* ── Lain atmosphere ─────────────────────────────── */
.crt-vignette {
  position: fixed;
  top: -2px;
  left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 300;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.015) 0%, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

.crt-scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    transparent 4px
  );
}

/* ── Typing cursor ───────────────────────────────── */
.typing-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: #6e756e;
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: cursor-blink 0.6s step-end infinite;
}

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

/* ── Page reveal ─────────────────────────────────── */
.reveal-type, .reveal-fade {
  opacity: 0;
}

.reveal-type.revealed {
  opacity: 1;
}

.reveal-fade {
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal-fade.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scanline flicker ─────────────────────────────── */
@keyframes scanline-flicker {
  0% { opacity: 1; }
  50% { opacity: 0.96; }
  100% { opacity: 1; }
}

/* ── CRT flicker ─────────────────────────────────── */
main {
  animation: crt-flicker 6s ease-in-out infinite;
}

@keyframes crt-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.92; }
  94% { opacity: 1; }
  95% { opacity: 0.94; }
  96% { opacity: 1; }
  97% { opacity: 0.96; }
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 600px) {
  main { padding: 0 1.5rem; }
  nav { padding: 1.5rem 2rem; }
  h1 { font-size: 1.3rem; }
  .post { flex-direction: column; gap: 0.15rem; }
  .post-date { margin-left: 0; }
}
