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

:root {
  --bg: #000000;
  --text: #00ff41;
  --text-dim: #00aa2a;
  --accent: #ffff00;
  --link: #00ffff;
  --link-hover: #ff00ff;
  --border: #00ff41;
  --scanline: rgba(0, 255, 65, 0.03);
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

body {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  position: relative;
  animation: flicker 8s infinite;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* CRT flicker */
@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.97; }
  15% { opacity: 0.94; }
  20% { opacity: 0.98; }
  100% { opacity: 0.97; }
}

/* Header / Terminal Window */
.terminal-window {
  border: 2px solid var(--border);
  margin-bottom: 24px;
}

.terminal-titlebar {
  background: var(--text);
  color: var(--bg);
  padding: 2px 8px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.5px;
}

.terminal-titlebar .buttons {
  display: flex;
  gap: 4px;
}

.terminal-titlebar .btn {
  width: 14px;
  height: 14px;
  border: 1px solid var(--bg);
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  cursor: default;
}

.terminal-body {
  padding: 16px;
}

.terminal-body h1 {
  font-family: 'Space Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.terminal-body .subtitle {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 12px;
}

.terminal-body .bio {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.terminal-body .bio a {
  color: var(--accent);
  text-decoration: none;
}

.terminal-body .contact {
  font-size: 12px;
  color: var(--text-dim);
}

.terminal-body .contact a {
  color: var(--link);
  text-decoration: none;
}

.terminal-body .contact a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--text);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Legend */
.legend {
  border: 1px solid var(--text-dim);
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.legend-title {
  width: 100%;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.legend span {
  white-space: nowrap;
}

/* Filter controls */
.filters {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filters button {
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.filters button:hover,
.filters button.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Counter */
.counter {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-style: italic;
}

/* Story list */
.stories {
  list-style: none;
}

.stories li {
  padding: 6px 0;
  border-bottom: 1px solid #0a2a0a;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: background 0.1s;
}

.stories li:hover {
  background: #0a1a0a;
}

.stories .emoji {
  flex-shrink: 0;
  font-size: 14px;
  width: 22px;
  text-align: center;
  padding-top: 1px;
}

.stories .headline {
  flex: 1;
}

.stories .headline a {
  color: var(--link);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}

.stories .headline a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.stories .headline .coauthor {
  color: var(--text-dim);
  font-size: 11px;
}

/* Must Reads */
.must-reads {
  border: 1px solid var(--text-dim);
  padding: 14px;
  margin-bottom: 20px;
}

.must-reads-title {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.must-reads-title:hover {
  color: var(--link-hover);
}

.must-reads-toggle {
  font-size: 12px;
  color: var(--text-dim);
}

.must-reads-item {
  padding: 10px 0;
  border-bottom: 1px solid #0a2a0a;
}

.must-reads-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.must-reads-item a {
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
}

.must-reads-item a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.must-reads-item p {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}

/* Footer */
.footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--text-dim);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.footer a {
  color: var(--link);
  text-decoration: none;
}

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

/* Loading Screen */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.loader-fade {
  opacity: 0;
}

.loader-content {
  max-width: 500px;
  padding: 0 20px;
}

.loader-line {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
}

.loader-line:first-child {
  color: var(--accent);
  font-weight: 700;
}

.loader-line:last-child {
  color: var(--text);
}

.loader-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--text);
  animation: blink 1s step-end infinite;
  margin-top: 4px;
}

.site-content {
  opacity: 0;
}

.site-content.site-visible {
  opacity: 1;
}

/* Responsive */
@media (max-width: 480px) {
  .terminal-body h1 {
    font-size: 22px;
  }
  .legend {
    gap: 4px 12px;
  }
}
