@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --bg: #0a0a0a;
  --green: #39ff14;
  --dim: #1a3a0a;
  --muted: #4a7a2a;
}

html {
  height: 100%;
  background-color: var(--bg);
}

body {
  color: var(--green);
  font-family: 'Press Start 2P', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background-color: var(--bg);
}

/* CRT scanlines */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

/* ── Home page ───────────────────────────────── */

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  text-align: center;
  padding: 3rem 2rem;
  width: 100%;
  max-width: 700px;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.subtitle {
  font-size: 0.5rem;
  letter-spacing: 0.4em;
  color: var(--muted);
}

.title {
  font-size: clamp(1.4rem, 5vw, 2.8rem);
  letter-spacing: 0.15em;
  text-shadow:
    0 0 10px var(--green),
    0 0 30px var(--green),
    0 0 60px rgba(57, 255, 20, 0.3);
  animation: flicker 6s infinite;
}

.bio {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--muted);
  max-width: 480px;
  text-align: center;
}

/* Menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  align-items: flex-start;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.1s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Press Start 2P', monospace;
}

.menu-item .cursor {
  opacity: 0;
  color: var(--green);
  font-size: 0.6rem;
  transition: opacity 0.1s;
}

.menu-item:hover {
  color: var(--green);
  text-shadow:
    0 0 8px var(--green),
    0 0 20px rgba(57, 255, 20, 0.4);
}

.menu-item:hover .cursor {
  opacity: 1;
  animation: blink 0.8s step-end infinite;
}

/* Footer */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

footer p {
  font-size: 0.4rem;
  letter-spacing: 0.3em;
  color: var(--dim);
}

.footer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--dim);
  filter: grayscale(40%) brightness(0.8);
  opacity: 0.6;
}

/* ── Writings page ───────────────────────────── */

body.inner {
  justify-content: flex-start;
  align-items: center;
}

.page {
  max-width: 680px;
  width: 100%;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: flex-start;
}

.back-link {
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.back-link:hover { color: var(--green); }

.page-title {
  font-size: clamp(0.9rem, 3vw, 1.4rem);
  letter-spacing: 0.15em;
  text-shadow: 0 0 10px var(--green), 0 0 30px rgba(57,255,20,0.3);
  border-bottom: 1px solid var(--dim);
  padding-bottom: 1.5rem;
  width: 100%;
}

.writings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.writing-item a {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.writing-item a:hover {
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

.writing-date {
  font-size: 0.4rem;
  color: var(--dim);
  letter-spacing: 0.2em;
}

/* ── Node connector screen ───────────────────── */

body.node-screen {
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.node-ui {
  position: relative;
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.node-hint {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.45rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap;
  animation: blink 1.2s step-end infinite;
  z-index: 10;
}

.node-back {
  position: absolute;
  top: 2rem;
  left: 2rem;
  font-size: 0.45rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  z-index: 10;
}
.node-back:hover { color: var(--green); }

.node-footer {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

svg.node-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.node-dot {
  cursor: crosshair;
  pointer-events: all;
}

.node-dot circle {
  fill: var(--bg);
  stroke: var(--green);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px var(--green));
  transition: fill 0.15s;
}

.node-dot:hover circle,
.node-dot.active circle {
  fill: var(--green);
}

.node-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  fill: var(--muted);
  text-anchor: middle;
  letter-spacing: 0.1em;
}

.connector-line {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  filter: drop-shadow(0 0 4px var(--green));
  animation: dash 1s linear infinite;
}

.preview-line {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

@keyframes dash {
  to { stroke-dashoffset: -20; }
}

/* ── Animations ──────────────────────────────── */

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

@keyframes flicker {
  0%, 95%, 97%, 100% { opacity: 1; }
  96%                { opacity: 0.85; }
  96.5%              { opacity: 1; }
  98%                { opacity: 0.9; }
}
