/* terminal-retro is dark-first by identity — a green-phosphor CRT
   aesthetic is the design. The :root defaults below are dark so any
   build without explicit color_scheme renders dark. The light variant
   (dark phosphor on warm cream paper, evoking a line-printer session)
   kicks in only when:
     1. config.yml `color_scheme: auto` AND OS prefers light, OR
     2. config.yml `color_scheme: light` (forced).
   Set `color_scheme: dark` to lock the original CRT look regardless
   of OS preference. */
:root {
  --bg: #0c0f0a;
  --window-bg: #11150f;
  --bar: #1a1f17;
  --fg: #c8e6a0;
  --muted: #6b8a52;
  --accent: #7dff42;
  --rule: #2a3322;
  --hover: #1d2418;
  --window-shadow: 0 0 0 1px rgba(125, 255, 66, 0.08), 0 20px 60px rgba(0, 0, 0, 0.4);
  --scanline-blend: multiply;
  --scanline-color: rgba(0, 0, 0, 0.18);
  --mono: 'JetBrains Mono', 'SFMono-Regular', 'Menlo', 'Consolas', monospace;
}

/* Light variant — printer-paper cream with deep-olive ink and
   forest-green accents. Vintage line-printer / VT-paper feel rather
   than a modern IDE light theme. */
@media (prefers-color-scheme: light) {
  :root:not(.scheme-dark) {
    --bg: #efe9d8;
    --window-bg: #f7f1de;
    --bar: #e1d9bd;
    --fg: #1f3508;
    --muted: #5d6f3e;
    --accent: #2d6e0f;
    --rule: #c4b894;
    --hover: #ece2c4;
    --window-shadow: 0 0 0 1px rgba(45, 110, 15, 0.06), 0 12px 32px rgba(70, 50, 10, 0.14);
    --scanline-color: rgba(45, 70, 15, 0.10);
  }
}
:root.scheme-light {
  --bg: #efe9d8;
  --window-bg: #f7f1de;
  --bar: #e1d9bd;
  --fg: #1f3508;
  --muted: #5d6f3e;
  --accent: #2d6e0f;
  --rule: #c4b894;
  --hover: #ece2c4;
  --window-shadow: 0 0 0 1px rgba(45, 110, 15, 0.06), 0 12px 32px rgba(70, 50, 10, 0.14);
  --scanline-color: rgba(45, 70, 15, 0.10);
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    var(--scanline-color) 3px,
    transparent 4px
  );
  mix-blend-mode: var(--scanline-blend);
}

.container { width: 100%; max-width: 560px; }

.window {
  background: var(--window-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--window-shadow);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--rule);
}

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-r { background: #ff5f56; }
.dot-y { background: #ffbd2e; }
.dot-g { background: #27c93f; }

.window-title {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.window-body { padding: 24px 22px 28px; }

.prompt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 18px 0 10px;
  white-space: pre-wrap;
}

.profile { text-align: left; }

.profile-pic {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
  margin: 8px 0 14px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  filter: contrast(1.05);
}

.name {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.caret {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

.description {
  font-size: 14px;
  color: var(--fg);
  text-wrap: pretty;
  max-width: 60ch;
  margin-bottom: 8px;
}

.links { display: flex; flex-direction: column; }

.link-button {
  display: grid;
  grid-template-columns: 14px 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.link-button:hover,
.link-button:focus-visible {
  background: var(--hover);
  border-left-color: var(--accent);
  color: var(--accent);
  padding-left: 12px;
  outline: none;
}

.link-prefix { color: var(--accent); font-weight: 700; }
.link-icon i { font-size: 12px; color: var(--muted); }
.link-button:hover .link-icon i,
.link-button:focus-visible .link-icon i { color: var(--accent); }

.link-text { word-break: break-word; }
.link-button-text { color: var(--muted); font-size: 12px; margin-left: 4px; }

.button-container { margin-top: 4px; }

.button-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 6px;
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-button i { font-size: 14px; }

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
  outline: none;
}

.footer {
  margin-top: 8px;
  padding: 12px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.footer a { color: var(--accent); border-bottom: 1px dashed var(--accent); }
.copyright { margin-top: 8px; opacity: 0.75; }

@media (max-width: 480px) {
  .window-body { padding: 20px 16px; }
  .name { font-size: 19px; }
}

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

/* "Latest" link variant — phosphor-green tag, blink */
.link-button.link-latest {
  align-items: start;
  grid-template-columns: 14px 22px auto 1fr;
}
.link-latest-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  padding: 1px 6px;
  margin-right: 6px;
  text-shadow: none;
  animation: latest-blink 1.6s steps(2, start) infinite;
}
.link-latest .link-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
          line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.4;
}
@keyframes latest-blink {
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .link-latest-badge { animation: none; }
}
