/* ==========================================================================
   /home/twilight — minimal black/white hacker-terminal theme
   ========================================================================== */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --fg: #e8e8e8;
  --dim: #7a7a7a;
  --dimmer: #4a4a4a;
  --border: #2a2a2a;
  --invert-bg: #e8e8e8;
  --invert-fg: #0a0a0a;
  --glow: rgba(232, 232, 232, 0.55);
  --max-w: 800px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* subtle CRT texture — scanlines + vignette, very low opacity */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 2px
  );
  mix-blend-mode: overlay;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  box-shadow: inset 0 0 180px rgba(0, 0, 0, 0.65);
}
@media (max-width: 640px) {
  body::before { display: none; }
}

::selection { background: var(--fg); color: var(--bg); }

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--dimmer);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--bg);
  background: var(--fg);
  text-decoration: none;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* ---- terminal window chrome -------------------------------------------- */

.term-window {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 40px 80px -30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.term-titlebar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #101010;
}
.term-dots { display: flex; gap: 0.4rem; flex-shrink: 0; }
.term-dots i {
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  border: 1px solid var(--dimmer);
  display: block;
}
.term-title {
  color: var(--dim);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-body { padding: 2rem 1.5rem 2.5rem; }

/* ---- header / nav ---------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  text-shadow: 0 0 12px var(--glow);
}
.site-title a { text-decoration: none; }
.site-title .prompt { color: var(--dim); text-shadow: none; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}
.site-nav a {
  position: relative;
  text-decoration: none;
  color: var(--dim);
}
.site-nav a::before { content: "> "; color: var(--dimmer); }
.site-nav a:hover { color: var(--bg); background: var(--fg); animation: glitch 0.35s steps(2, end) 1; }
@keyframes glitch {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0, 0); }
}

/* ---- headings / prose -------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin: 2.2em 0 0.8em;
}
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }

h1 { font-size: 1.3rem; }
h2 { font-size: 1.15rem; }
h3, h4, h5, h6 { font-size: 1rem; }

h1::before, h2::before, h3::before { content: "$ "; color: var(--dim); }

p { margin: 0 0 1.1em; }

blockquote {
  margin: 1.2em 0;
  padding: 0.4em 1em;
  border-left: 2px solid var(--dim);
  color: var(--dim);
}
blockquote p:last-child { margin-bottom: 0; }

ul, ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}
li { margin-bottom: 0.35em; }
ul > li::marker { color: var(--dim); content: "- "; }
ol > li::marker { color: var(--dim); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

code {
  font-family: var(--mono);
  background: #141414;
  border: 1px solid var(--border);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  font-size: 0.9em;
}

pre {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1em 1.1em;
  overflow-x: auto;
  margin: 1.3em 0;
  position: relative;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85em;
  line-height: 1.55;
}

/* chroma-highlighted blocks get a titlebar with dots + language tag */
.highlight {
  position: relative;
  margin: 1.3em 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.highlight pre {
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 2.1em 1.1em 1em;
}
.highlight::before {
  content: "● ● ●";
  position: absolute;
  top: 0.7em;
  left: 1.1em;
  color: var(--dimmer);
  font-size: 0.6em;
  letter-spacing: 0.3em;
  z-index: 1;
}
.highlight code[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 0.65em;
  right: 1.1em;
  font-size: 0.68em;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.4em 0;
  border: 1px solid var(--border);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.3em 0;
  display: block;
  overflow-x: auto;
  font-size: 0.92em;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.5em 0.75em;
  text-align: left;
  vertical-align: top;
}
th { color: var(--dim); font-weight: 700; }

/* ---- post list ---------------------------------------------------------- */

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.55em 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:first-child { border-top: 1px solid var(--border); }
.post-list .date {
  color: var(--dim);
  font-size: 0.85em;
  flex-shrink: 0;
  width: 6.5em;
}
.post-list a { text-decoration: none; }
.post-list a:hover { text-decoration: underline; background: none; color: var(--fg); }
.post-list a::before { content: "- "; color: var(--dimmer); }

/* ---- post meta ----------------------------------------------------------- */

.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-top: 0; }
.post-header h1::before { content: ""; }
.post-meta {
  color: var(--dim);
  font-size: 0.85em;
  margin-top: 0.4em;
}
.post-meta::before { content: "# stat -> "; color: var(--dimmer); }

/* ---- footer --------------------------------------------------------------- */

.site-footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.8em;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}
.site-footer a { color: var(--dim); }
.site-footer a:hover { color: var(--bg); background: var(--fg); }
.site-footer .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--fg);
  box-shadow: 0 0 8px var(--glow);
  vertical-align: -0.15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---- homepage prompt ------------------------------------------------------- */

.prompt-block { margin: 1.5rem 0 2rem; }
.prompt-line {
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
}
.prompt-line .ps1 { color: var(--fg); white-space: nowrap; }
.prompt-line .ps1::before { content: "twilight@0xw:~$ "; }
.type-out { color: var(--fg); }
.prompt-out {
  color: var(--dim);
  margin: 0.5em 0 0 0;
  padding-left: 0;
  overflow-wrap: anywhere;
}

.home-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.home-links a { text-decoration: none; }
.home-links a::before { content: "> "; color: var(--dimmer); }

.blink-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--fg);
  box-shadow: 0 0 8px var(--glow);
  vertical-align: -0.15em;
  animation: blink 1s steps(1) infinite;
}

/* ---- 404 -------------------------------------------------------------------- */

.notfound {
  color: var(--dim);
  white-space: pre-wrap;
}
.notfound .ok { color: #ff5c5c; }

/* ---- responsive -------------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap { padding: 1.5rem 1rem 3rem; }
  body { font-size: 14px; }
  .post-list li { flex-direction: column; gap: 0.15rem; }
  .post-list .date { width: auto; }
}
