:root {
  --bg:        #1c1512;
  --bg-soft:   #251c17;
  --bg-edge:   #3a2d24;
  --ink:       #e6d8c3;
  --ink-dim:   #a08d76;
  --amber:     #e0a458;
  --amber-dim: #9c7443;
  --green:     #9cb974;
  --grey:      #6b6258;
  --red:       #cf6a5a;

  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

a { color: var(--amber); }
a:hover { color: var(--ink); }

.hero { margin-bottom: 3rem; }

.prompt {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink-dim);
  margin: 0 0 0.5rem;
}
.prompt .host { color: var(--green); }
.prompt .path { color: var(--amber); }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.15em;
  background: var(--amber);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-family: var(--mono);
  font-size: 2.6rem;
  margin: 0;
  color: var(--amber);
  letter-spacing: 0.02em;
}

.tagline {
  color: var(--ink-dim);
  margin: 0.4rem 0 1.4rem;
}

.hero-nav {
  font-family: var(--mono);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.hero-nav a { text-decoration: none; }
.hero-nav a::before { content: "./"; color: var(--ink-dim); }

section { margin-bottom: 3rem; }

h2 {
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--ink);
  border-bottom: 1px solid var(--bg-edge);
  padding-bottom: 0.4rem;
}
.h-mark { color: var(--amber-dim); margin-right: 0.4rem; }

.term {
  background: var(--bg-soft);
  border: 1px solid var(--bg-edge);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
}
.term-cmd {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--amber-dim);
  margin-top: 0;
}
.term p:last-child { margin-bottom: 0; }

.links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.links li + li { border-top: 1px dashed var(--bg-edge); }
.links a {
  display: flex;
  gap: 1rem;
  padding: 0.6rem 0.4rem;
  text-decoration: none;
}
.links a:hover { background: var(--bg-soft); }
.link-label {
  font-family: var(--mono);
  color: var(--ink-dim);
  min-width: 7.5rem;
}
.links a:hover .link-label { color: var(--amber); }
.link-value { color: var(--ink); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--bg-soft);
  border: 1px solid var(--bg-edge);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}
.card h3 {
  font-family: var(--mono);
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.card p { margin: 0 0 0.5rem; font-size: 0.95rem; }
.card-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin-bottom: 0 !important;
}

.dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  margin-right: 0.35em;
}
.dot-on   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-warn { background: var(--amber); }
.dot-off  { background: var(--grey); }

.specs {
  font-family: var(--mono);
  font-size: 0.85rem;
  border-collapse: collapse;
  margin-top: 1rem;
}
.specs td { padding: 0.15rem 0; vertical-align: top; }
.specs td:first-child {
  color: var(--amber-dim);
  padding-right: 1.5rem;
  white-space: nowrap;
}

.term-window {
  background: var(--bg-soft);
  border: 1px solid var(--bg-edge);
  border-radius: 8px;
  overflow: hidden;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--bg-edge);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.tb-dot { width: 0.7em; height: 0.7em; border-radius: 50%; display: inline-block; opacity: 0.85; }
.tb-r { background: var(--red); }
.tb-y { background: var(--amber); }
.tb-g { background: var(--green); }
.tb-title { margin-left: 0.4rem; }
.tb-live { margin-left: auto; display: flex; align-items: center; gap: 0.4em; color: var(--green); }
.tb-live .dot { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.term-scroll {
  height: 24rem;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-edge) transparent;
}
.term-scroll::-webkit-scrollbar { width: 8px; }
.term-scroll::-webkit-scrollbar-thumb { background: var(--bg-edge); border-radius: 4px; }

#termout div {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.3em;
}
#termout a { color: var(--amber); }
.t-dim { color: var(--ink-dim); }
.t-acc { color: var(--amber); }
.t-ok  { color: var(--green); }
.t-err { color: var(--red); }
.t-banner {
  color: var(--amber);
  font-size: 0.55rem;
  line-height: 1.15;
  white-space: pre !important;
  overflow-x: auto;
}

.term-inline { display: flex; align-items: baseline; }
.term-ps1 { color: var(--green); white-space: pre; }
#termin {
  flex: 1;
  min-width: 4rem;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  color: var(--ink);
  font: inherit;
  caret-color: var(--amber);
}
#termin.masked { color: transparent; }

footer {
  border-top: 1px solid var(--bg-edge);
  padding-top: 1.2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-dim);
  text-align: center;
}
footer p { margin: 0.2rem 0; }
footer strong { color: var(--amber); }
.foot-small { font-size: 0.75rem; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 2.1rem; }
  .link-label { min-width: 5.5rem; }
  .term-scroll { height: 20rem; font-size: 0.8rem; }
}

/* ---------- CRT mode (on by default; toggle with the `crt` command) ---------- */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.3s;
}
body.crt .crt-overlay { opacity: 1; }

/* fine static scanlines, with a subtle fast flicker */
body.crt .crt-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.17) 0px,
    rgba(0, 0, 0, 0.17) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: crt-flicker 0.13s steps(2, end) infinite;
}

/* gentle overall brightness pulse + a faint phosphor glow on the shell */
body.crt .wrap { animation: crt-bright 4s ease-in-out infinite; }
body.crt .term-scroll,
body.crt .hero h1,
body.crt .prompt { text-shadow: 0 0 2px currentColor; }

@keyframes crt-flicker { 0% { opacity: 0.88; } 100% { opacity: 1; } }
@keyframes crt-roll { 0% { top: -30%; } 100% { top: 100%; } }
@keyframes crt-bright { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.05); } }

/* respect users who prefer less motion: keep the scanlines, drop the movement */
@media (prefers-reduced-motion: reduce) {
  body.crt .crt-overlay::before { animation: none; }
  body.crt .crt-overlay::after { animation: none; opacity: 0; }
  body.crt .wrap { animation: none; }
}

html[data-theme="green"] {
  --bg: #0a100a; --bg-soft: #101a10; --bg-edge: #1f331f;
  --ink: #b4e0a4; --ink-dim: #6d9660; --amber: #7ee07e; --amber-dim: #4d9950;
  --green: #a4ff9c; --grey: #52664f; --red: #d98052;
}
html[data-theme="amber"] {
  --bg: #140d03; --bg-soft: #1c1305; --bg-edge: #38270c;
  --ink: #ffb642; --ink-dim: #a8762c; --amber: #ffd27a; --amber-dim: #c9922f;
  --green: #ffc963; --grey: #7a5c26; --red: #ff7a4d;
}
html[data-theme="ice"] {
  --bg: #0e1319; --bg-soft: #141c26; --bg-edge: #253244;
  --ink: #c6d6e6; --ink-dim: #77899d; --amber: #6db3e8; --amber-dim: #497ba3;
  --green: #7ec8a8; --grey: #566476; --red: #d97070;
}
html[data-theme="paper"] {
  --bg: #f2e9d8; --bg-soft: #e9dcc2; --bg-edge: #d2c0a0;
  --ink: #3a2f22; --ink-dim: #7d6c52; --amber: #a05f1c; --amber-dim: #b0793b;
  --green: #4c7a2c; --grey: #9c8f78; --red: #a03c2c;
}
html[data-theme="mono"] {
  --bg: #101010; --bg-soft: #191919; --bg-edge: #2d2d2d;
  --ink: #d9d9d9; --ink-dim: #8c8c8c; --amber: #f2f2f2; --amber-dim: #a6a6a6;
  --green: #cccccc; --grey: #666666; --red: #bfbfbf;
}
html[data-theme="synthwave"] {
  --bg: #180a2b; --bg-soft: #22103b; --bg-edge: #3d1f66;
  --ink: #f5c2ff; --ink-dim: #a06fd0; --amber: #ff4fd8; --amber-dim: #c04fb0;
  --green: #4ff0d0; --grey: #5a3f80; --red: #ff5b6e;
}
html[data-theme="blood"] {
  --bg: #150404; --bg-soft: #210808; --bg-edge: #3d1010;
  --ink: #e8b0b0; --ink-dim: #a05a5a; --amber: #ff4444; --amber-dim: #b03030;
  --green: #d0a040; --grey: #6a3030; --red: #ff2020;
}
