/* ============================================================
   benjamin-dreier.de — terminal theme
   One accent (amber). Green/red are status semaphores only.
   Change --accent to retheme.
   ============================================================ */

:root {
  --bg: #0b0e14;
  --panel: #11161f;
  --panel-2: #161c27;
  --border: #232c3a;
  --text: #c8d3e0;
  --muted: #6b7888;
  --accent: #6fff00;        /* phosphor amber */
  --green: #3ddc97;         /* status: live / ok */
  --red: #ff5c57;           /* status: down / error */

  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 960px;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 50% -10%, #131a26 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 48px);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- terminal window ---- */
.term {
  width: 100%;
  max-width: var(--maxw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 24px 60px -20px rgba(0,0,0,0.7);
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(var(--panel-2), var(--panel));
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: #2a3342; flex: none; }
.dot--live { background: var(--green); box-shadow: 0 0 8px -1px var(--green); }
.term__title { margin-left: 4px; color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.term__title b { color: var(--text); font-weight: 600; }
.term__live { margin-left: auto; font-size: 11px; color: var(--green); text-transform: uppercase; letter-spacing: .14em; }

/* ---- screen / hero ---- */
.screen { position: relative; padding: clamp(18px, 3vw, 30px) clamp(18px, 4vw, 40px) 26px; }

.hero { position: relative; }
/* the one indulgence: faint scanlines, hero only */
.hero::before {
  content: ""; position: absolute; inset: -30px -40px 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

.line { white-space: pre-wrap; word-break: break-word; }
.prompt { color: var(--accent); }
.prompt .path { color: var(--green); }
.out { color: var(--text); }
.dim { color: var(--muted); }
.hi { color: var(--accent); }

h1.name {
  font-size: clamp(28px, 6vw, 46px);
  line-height: 1.05;
  margin: 2px 0;
  letter-spacing: -0.01em;
  color: #f3f6fb;
  text-shadow: 0 0 22px rgba(255,176,0,0.18);
  font-family: var(--mono);
}
.blink { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.caret::after { content: "▋"; color: var(--accent); animation: blink 1.1s steps(1) infinite; margin-left: 2px; }

/* divider between hero and swappable content */
.screen__rule { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

/* ---- content area (swapped by fragments) ---- */
#content-area { min-height: 220px; }

/* a $ command line acts as each page's title/eyebrow */
.cmd-head { color: var(--accent); margin: 0 0 14px; font-size: 14px; }
.cmd-head .path { color: var(--green); }
.cmd-head .arg { color: var(--text); }

h2, h3 { font-family: var(--mono); color: #f3f6fb; line-height: 1.2; }
h2 { font-size: 22px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 26px 0 8px; }

/* ---- tools / about as status units ---- */
.units { margin: 6px 0 0; }
.unit {
  display: grid;
  grid-template-columns: 16px 8rem 1fr auto;
  gap: 12px; align-items: baseline; padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.unit:last-child { border-bottom: 0; }
a.unit { color: inherit; }
a.unit:hover { text-decoration: none; }
a.unit:hover .u { text-decoration: underline; }
.unit .st { font-size: 18px; line-height: 1; }
.st--live { color: var(--green); }
.st--soon { color: var(--muted); }
.st--down { color: var(--red); }
.unit .u { color: var(--accent); }
.unit .desc { color: var(--muted); }
.badge {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge--live { color: var(--green); border-color: rgba(61,220,151,.35); }

/* ---- about cards ---- */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.fact { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; background: var(--panel-2); }
.fact h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.fact p { margin: 0; color: var(--text); }
.about-img {
  float: right; width: 180px; max-width: 40%; margin: 0 0 14px 18px;
  border: 1px solid var(--border); border-radius: 10px; filter: grayscale(.2) contrast(1.05);
}

/* ---- skills as progress bars ---- */
.skill-group { margin-bottom: 26px; }
.skill { margin: 12px 0; }
.skill__top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.skill__name { color: var(--text); }
.skill__pct { color: var(--accent); }
.bar { height: 8px; background: #0c1118; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ffd166); border-radius: 999px; }
.skill__note { color: var(--muted); font-size: 12px; margin-top: 5px; }
.skill__honesty { margin-top: 20px; }

/* ---- blog list (ls style) ---- */
.posts { margin-top: 6px; }
.post {
  display: grid; grid-template-columns: 6rem 1fr auto; gap: 14px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px dashed var(--border); color: inherit;
}
.post:hover { text-decoration: none; }
.post:hover .post__title { text-decoration: underline; color: var(--accent); }
.post__meta { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.post__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.post__title { color: var(--text); }
.post__sub { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.post:hover .post__sub { color: var(--text); }
.post__cat { color: var(--green); font-size: 12px; white-space: nowrap; }

/* ---- blog post header ---- */
.post-head { margin: 4px 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.post-head .blogtitle { margin: 0 0 12px; }
.post-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.post-head__meta .sep { color: var(--border); }
.post-head__meta time { font-variant-numeric: tabular-nums; }
.tag {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
}
.tag--cat { color: var(--green); border-color: rgba(61,220,151,.35); }

/* ---- article prose ---- */
.prose { font-family: var(--sans); font-size: 16px; line-height: 1.75; max-width: 70ch; }
.prose .blogtitle, .blogtitle { font-family: var(--mono); font-size: 24px; color: #f3f6fb; margin: 0 0 18px; }
.prose p { margin: 0 0 16px; }
.prose .lead { font-size: 18px; line-height: 1.7; color: #dde5f0; margin-bottom: 22px; }
.prose h3 { margin: 30px 0 12px; font-size: 16.5px; color: #f3f6fb; }
.prose h3::before { content: "# "; color: var(--accent); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(255,176,0,.4); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { color: #f3f6fb; font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 1.3em; }
.prose li { margin: 4px 0; }

/* ---- callout / aside note ---- */
.note {
  margin: 0 0 18px; padding: 14px 16px 14px 18px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
}
.note__tag { display: block; font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.note p { margin: 0; font-size: 15px; }

/* ---- code block with a terminal-style title bar ---- */
.code-block { margin: 0 0 20px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #0c1118; }
.code-block__bar {
  display: flex; align-items: center; gap: 7px; padding: 9px 14px;
  background: linear-gradient(var(--panel-2), var(--panel)); border-bottom: 1px solid var(--border);
}
.code-block__bar .dot { width: 10px; height: 10px; }
.code-block__name { margin-left: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.code-block pre, .code-block .blog-content pre { margin: 0; border: 0; border-radius: 0; }
.prose code, .blog-content code { font-family: var(--mono); font-size: 0.9em; background: #0c1118; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.prose pre, .blog-content pre { overflow-x: auto; padding: 18px 20px; border-radius: 10px; background: #0c1118; border: 1px solid var(--border); margin: 0 0 18px; }
.prose pre code, .blog-content pre code { background: none; border: 0; padding: 0; font-size: 13.5px; line-height: 1.6; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted); }
.back-link:hover { color: var(--accent); }

/* ---- playground form ---- */
.field { margin-bottom: 16px; }
.field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; background: #0c1118; color: var(--text); font-family: var(--mono); font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.field input::placeholder, .field textarea::placeholder { color: #44505f; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }

.run {
  font-family: var(--mono); font-size: 14px; cursor: pointer;
  color: var(--bg); background: var(--accent); font-weight: 600;
  border: 0; border-radius: 8px; padding: 10px 20px;
}
.run:hover { filter: brightness(1.08); }
.run:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }

/* ---- tool playground: try-it + reference side by side ---- */
.tool-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px; align-items: start; margin-top: 22px;
}
.tool-try {
  padding: 18px 20px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.tool-try .api-ref__label:first-child { margin-top: 0; }
.tool-try .field:first-of-type { margin-top: 4px; }
.tool-try .run { width: 100%; }
.tool-try .result-label { margin-top: 20px; }
@media (max-width: 720px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- API reference ---- */
.api-ref {
  padding: 18px 20px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.api-ref .api-ref__label:first-child { margin-top: 0; }
.api-ref__endpoint { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-family: var(--mono); font-size: 14px; }
.method {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  padding: 2px 9px; border-radius: 6px; border: 1px solid var(--border);
}
.method--get { color: var(--green); border-color: rgba(61,220,151,.35); }
.method--post { color: var(--accent); border-color: rgba(255,176,0,.4); }
.api-ref__path { color: var(--text); }
.api-ref__base { margin-left: auto; color: var(--muted); font-size: 12.5px; word-break: break-all; }
.api-ref__label { font-family: var(--mono); font-size: 12px; color: var(--accent); margin: 18px 0 8px; }

.params { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.params td { padding: 5px 10px 5px 0; border-bottom: 1px dashed var(--border); vertical-align: top; }
.params tr:last-child td { border-bottom: 0; }
.params__name { color: var(--accent); white-space: nowrap; }
.params__name .req { color: var(--red); margin-left: 1px; }
.params__type { color: var(--green); white-space: nowrap; }
.params__desc { color: var(--text); }
.params__eg { color: var(--muted); white-space: nowrap; }

.snippet { position: relative; }
.snippet pre {
  overflow-x: auto; margin: 0; padding: 14px 70px 14px 16px;
  background: #0c1118; border: 1px solid var(--border); border-radius: 10px;
}
.snippet pre code { font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre; }
.copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: 11px; cursor: pointer;
  color: var(--muted); background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; transition: color .15s, border-color .15s;
}
.copy:hover { color: var(--accent); border-color: rgba(255,176,0,.4); }
.copy[data-copied] { color: var(--green); border-color: rgba(61,220,151,.35); }
.snippet__static {
  overflow-x: auto; margin: 0; padding: 14px 16px;
  background: #0c1118; border: 1px solid var(--border); border-radius: 10px;
}
.snippet__static code { font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre; }
.api-ref__spec { margin: 18px 0 0; font-size: 13.5px; }

.result-label { color: var(--muted); font-size: 13px; margin: 26px 0 8px; }
pre.result { overflow-x: auto; padding: 16px 18px; border-radius: 10px; background: #0c1118; border: 1px solid var(--border); margin: 0; min-height: 60px; }
pre.result code { font-family: var(--mono); font-size: 13.5px; }
pre.result code[data-tool-error="true"] { color: var(--red); }

/* ---- nav command bar ---- */
nav.cmd { width: 100%; max-width: var(--maxw); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
nav.cmd a {
  font-family: var(--mono); color: var(--muted); text-decoration: none;
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
  transition: color .15s, border-color .15s, background .15s;
}
nav.cmd a::before { content: "› "; color: var(--border); }
nav.cmd a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
nav.cmd a:hover::before { color: var(--accent); }
nav.cmd a.active { color: var(--accent); border-color: rgba(255,176,0,.4); }
nav.cmd a.active::before { content: "$ "; color: var(--accent); }

/* ---- status footer ---- */
.statusline {
  width: 100%; max-width: var(--maxw); margin-top: 14px;
  display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 12.5px; color: var(--muted);
}
.statusline b { color: var(--text); font-weight: 600; }
.fuel { letter-spacing: 1px; color: var(--accent); }

/* ---- interactive bash terminal (/bash) ---- */
.bash {
  margin-top: 18px;
  background: #0c1118;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.bash__output {
  max-height: 52vh;
  overflow-y: auto;
  font-size: 13.5px;
}
.bash__line {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 2px;
}
.bash__line.err { color: var(--red); }
.bash__line a { color: var(--accent); }
.bash__img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; border: 1px solid var(--border); }

.bash__input-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  overflow: hidden;
}
/* the typed text is mirrored here; a blinking block cursor follows it, so the
   real input can stay invisible (no box, no native caret) like a real shell. */
.bash__typed { white-space: pre; color: var(--text); }
.bash__cursor { color: var(--accent); margin-left: -2px; }
.bash__cursor--off { animation: none; opacity: .35; }
/* the real input sits transparently over the row to capture focus + keystrokes */
.bash__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
}
.bash__input:focus-visible { outline: none; }

/* help: vertical, aligned command list */
.bash__help-intro { color: var(--text); margin-bottom: 6px; }
.bash__cmd { display: grid; grid-template-columns: 13ch 1fr; gap: 2px 14px; }
.bash__cmd dt { color: var(--accent); }
.bash__cmd dd { margin: 0; color: var(--text); }
.bash__help-tools { color: var(--text); margin-top: 8px; }

/* matrix overlay (temporary, sits over the screen) */
.bash__matrix {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity .6s;
}
.bash__matrix--fade { opacity: 0; }

/* ---- boot reveal (pure CSS, staggered) ---- */
@keyframes boot-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
[data-boot] > * { animation: boot-in .34s ease both; }
[data-boot] > *:nth-child(1) { animation-delay: .00s; }
[data-boot] > *:nth-child(2) { animation-delay: .06s; }
[data-boot] > *:nth-child(3) { animation-delay: .12s; }
[data-boot] > *:nth-child(4) { animation-delay: .18s; }
[data-boot] > *:nth-child(5) { animation-delay: .24s; }
[data-boot] > *:nth-child(6) { animation-delay: .30s; }
[data-boot] > *:nth-child(n+7) { animation-delay: .36s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blink, .caret::after { animation: none; }
  [data-boot] > * { animation: none; }
  body.crt::after { animation: none; }
}

/* ---- konami "CRT / 1337" mode (toggled by konami.js) ----
   One amber accent retones the whole site; a scanline overlay + faint flicker
   sell the old-CRT look. Status greens go amber too, on purpose. */
body.crt {
  --accent: #ffb000;
  --green: #ffb000;
}
body.crt .dot--live { background: #ffb000; box-shadow: 0 0 8px -1px #ffb000; }
body.crt .term__live { color: #ffb000; }
body.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.16) 2px 4px);
  mix-blend-mode: multiply;
  animation: crt-flicker 4s steps(40) infinite;
}
@keyframes crt-flicker { 0%,100% { opacity: .85; } 50% { opacity: 1; } }

.crt-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 16px);
  z-index: 9999;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.crt-toast--show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .unit { grid-template-columns: 16px 1fr auto; }
  .unit .desc { display: none; }
  .facts { grid-template-columns: 1fr; }
  .post { grid-template-columns: 1fr auto; }
  .post__meta { display: none; }
  .about-img { float: none; display: block; width: 160px; margin: 0 0 16px; }
}
