/* The page on top of the ASCII three.js layer (js/scene.js): terminal style,
   mono everywhere, TUI panels over the full width. Home (hero, projects,
   stack, system, links) and /uptime. tui.css has the base, panel and server card. */

/* tint the base from green-black to purple-black */
:root {
  --term-bg: #08070c;
  --term-bg2: #0e0c15;
  --term-fg: #ece6f8;
  --term-dim: #8a82a3;
  --term-faint: #2b2639;
  --v-soft: #b9b0cf;
  --v-panel: rgba(8, 7, 12, 0.86);
  --v-gutter: clamp(16px, 4vw, 48px);
  /* the top bar: 42 px and its line, plus the status bar strip on phones */
  --nav-h: calc(43px + env(safe-area-inset-top, 0px));
}

body {
  background:
    radial-gradient(ellipse 70% 50% at 75% 18%, #20103a 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 5% 70%, #150b28 0%, transparent 60%),
    var(--term-bg);
  background-attachment: fixed;
}

#scene-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  pointer-events: none;
}
/* scene.js adds .on after its first frame: fade in, no pop */
#scene-bg { opacity: 0; transition: opacity 1.2s ease; }
#scene-bg.on { opacity: 1; }

.dim { color: var(--term-dim); }
.cursor { animation: tui-blink 1s steps(1) infinite; }
/* FocusOnNavigate focuses the h1 on load; no ring for that */
h1:focus { outline: none; }

.v-wrap { max-width: 1320px; margin: 0 auto; padding: 0 var(--v-gutter); }
.v-page, .v-nav, .v-footer { position: relative; z-index: 1; }

/* page change (tui.js): the old page slides up and out, the new one comes in
   from below and is uncovered top to bottom, like a terminal printing it */
.v-page, .v-footer { animation: v-enter 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.v-leaving .v-page, .v-leaving .v-footer {
  opacity: 0;
  transform: translateY(-14px);
  filter: blur(2px);
  transition: opacity 0.26s ease-in, transform 0.26s ease-in, filter 0.26s ease-in;
}
@keyframes v-enter {
  from { opacity: 0; transform: translateY(16px); clip-path: inset(0 0 100% 0); }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}
.v-page .tui-panel { background: var(--v-panel); }
.v-page .tui-panel > .tui-panel-title,
.v-page .tui-panel > .tui-panel-badge { background: var(--term-bg); }

/* ─── tmux bar on top ─── */
.v-nav { border-bottom: 1px solid var(--term-faint); background: rgba(8, 7, 12, 0.85); }
.v-nav .row { display: flex; align-items: center; gap: 16px; height: 42px; }
/* tmux bars run edge to edge, the content keeps .v-wrap's column */
.v-nav .v-wrap, .v-footer .v-wrap { max-width: none; }
.v-nav .brand { color: var(--term-primary); font-weight: 700; }
.v-nav .brand .dot { color: var(--term-primary); }
.v-nav .spacer, .v-footer .spacer { flex: 1; }
.v-nav nav { display: flex; height: 100%; }
.v-nav nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--term-dim);
  border-left: 1px solid var(--term-faint);
}
.v-nav nav a .n { color: var(--term-faint); font-weight: 700; }
.v-nav nav a:hover { color: var(--term-fg); }
.v-nav nav a.on { background: var(--term-primary); color: var(--term-bg); font-weight: 700; }
.v-nav nav a.on .n { color: var(--term-bg); }

/* ─── hero ─── */
.v-hero {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0 80px;
}
.v-hero > .v-wrap { width: 100%; }
.v-prompt { color: var(--term-fg); font-size: 14px; }
.v-prompt .host { color: var(--term-primary); }
.v-logo { margin: 22px 0 14px; font: inherit; }
.v-logo pre {
  margin: 0;
  color: var(--term-primary);
  /* 65 columns must fit the phone width, last column included */
  font-size: min(15px, calc((100vw - 2 * var(--v-gutter)) / 40));
  line-height: 1.15;
}
.v-who { font-size: 15px; color: var(--v-soft); }
.v-typed {
  margin-top: 30px;
  min-height: 1.5em;
  color: var(--term-fg);
  font-size: clamp(15px, 1.35vw, 20px);
  line-height: 1.5;
}
.v-typed .arr { color: var(--term-primary); }
.v-typed .cursor { color: var(--term-primary); }
/* solid cursor while letters come and go, blinking while it holds */
.v-typed.typing .cursor { animation: none; }

.v-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.v-btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--term-primary);
  color: var(--term-fg);
  font-weight: 700;
  transition: background .15s, color .15s, box-shadow .15s;
}
.v-btn:hover { color: var(--term-fg); box-shadow: 0 0 22px -6px var(--term-primary); }
.v-btn.solid { background: var(--term-primary); color: var(--term-bg); }
.v-btn.solid:hover { color: var(--term-bg); }

/* live status line across the bottom of the hero */
.v-ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  white-space: nowrap;
  padding: 7px 0;
  background: #2a1a4d;
  border-top: 1px solid #4a3383;
}
.v-ticker .run { display: inline-flex; animation: v-marquee 160s linear infinite; }
.v-ticker .set { display: inline-flex; }
.v-ticker .item { color: #ece0ff; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; }
.v-ticker .sep { color: var(--term-secondary); margin: 0 18px; }
@keyframes v-marquee { to { transform: translateX(-50%); } }

/* ─── section heads: "$ cmd ───────── meta" ─── */
.v-sec { padding-top: clamp(64px, 8vw, 110px); }
.v-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 26px;
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 700;
  color: var(--term-fg);
}
.v-head .rule { flex: 1; border-top: 1px dashed var(--term-faint); }
.v-head .meta { color: var(--term-dim); font-size: 12px; font-weight: 400; }

/* ─── projects ─── */
.v-proj { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px 40px; }
.v-card { display: block; color: var(--term-fg); }
.v-card .tui-panel { display: flex; flex-direction: column; height: 100%; padding: 24px 22px 20px; }
.v-card:hover { color: var(--term-fg); }
.v-card:hover .tui-panel { border-color: var(--term-primary); box-shadow: 0 0 34px -12px var(--term-primary); }
.v-card .tui-panel-title { font-size: 13px; }
.v-card .tag { color: var(--term-blue); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.v-card .line { margin-top: 8px; color: var(--v-soft); line-height: 1.55; }
.v-card .line { font-size: 17px; }
.v-card .points { list-style: none; margin: 16px 0 0; padding: 0; color: var(--term-dim); font-size: 13px; line-height: 1.7; }
.v-card .points li::before { content: "- "; color: var(--term-primary); }
/* tags and link sit at the bottom, however tall the list next to the card is */
.v-card .stack { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: auto; padding-top: 22px; color: var(--term-primary); font-size: 12px; }
.v-card .go { margin-top: 14px; color: var(--term-dim); font-size: 12px; transition: color .15s; }
.v-card:hover .go { color: var(--term-primary); }

/* the other projects: small rows next to the card */
.v-more { list-style: none; margin: 0; padding: 0; }
.v-more li + li { border-top: 1px dashed var(--term-faint); }
.v-more a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
  padding: 12px 4px;
  color: var(--term-fg);
}
.v-more .name { font-weight: 700; }
.v-more .url { justify-self: end; color: var(--term-dim); font-size: 12px; }
.v-more .line { grid-column: 1 / -1; color: var(--term-dim); font-size: 12px; }
.v-more a:hover .name, .v-more a:hover .url { color: var(--term-primary); }

/* ─── stack ─── */
/* stack: one panel a focus, the tools as tags */
.v-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.v-stack .focus { --acc: var(--term-primary); padding: 26px 24px 24px; }
.v-stack .f1 { --acc: var(--term-secondary); }
.v-stack .tools { display: flex; flex-wrap: wrap; gap: 8px; }
.v-stack .tools span { padding: 5px 12px; border: 1px solid var(--term-faint); border-left: 2px solid var(--acc); color: var(--term-fg); font-size: 13px; }
.v-stack .tools span:hover { border-color: color-mix(in srgb, var(--acc) 35%, transparent); border-left-color: var(--acc); }

/* work: a timeline down the left, newest first, on a panel so the objects
   behind do not run through the text */
.v-work-panel { padding: 28px 26px 26px 32px; }
.v-work { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--term-faint); }
.v-work > li { position: relative; padding: 0 0 30px 28px; }
.v-work > li:last-child { padding-bottom: 0; }
.v-work > li::before {
  content: "";
  position: absolute;
  left: -6px;
  /* on the middle of the title's first line: line-height 1.6 puts it at
     0.8 of the title's font size; the marker is 11 px with its border */
  top: calc(clamp(17px, 1.6vw, 20px) * 0.8 - 5.5px);
  width: 9px;
  height: 9px;
  border: 1px solid var(--term-dim);
  background: var(--term-bg);
}
.v-work > li.now::before { border-color: var(--term-primary); background: var(--term-primary); box-shadow: 0 0 10px var(--term-primary); }
.v-work .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.v-work .role { color: var(--term-fg); font-size: clamp(17px, 1.6vw, 20px); font-weight: 700; }
/* flex gap, because Razor drops the space after the @if around the name */
.v-work .at { display: inline-flex; flex-wrap: wrap; gap: 0 1ch; color: var(--v-soft); font-size: 13px; }
.v-work .at a { color: var(--v-soft); border-bottom: 1px dashed var(--term-dim); }
.v-work .at a:hover { color: var(--term-primary); border-bottom-color: var(--term-primary); }
.v-work .when { margin-left: auto; color: var(--term-dim); font-size: 12px; }
.v-work .now .when { color: var(--term-primary); }
.v-work ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 32px; }
.v-work ul li { position: relative; padding-left: 2.2ch; color: var(--v-soft); font-size: 13px; line-height: 1.5; }
.v-work ul li::before { content: ">"; position: absolute; left: 0; color: var(--term-primary); font-weight: 700; }

/* ─── system: full-width band ─── */
.v-full {
  position: relative;
  margin-top: clamp(64px, 8vw, 110px);
  padding: clamp(48px, 6vw, 80px) 0;
  background: rgba(20, 12, 38, 0.9);
  border-top: 1px solid #3a2a63;
  border-bottom: 1px solid #3a2a63;
}
.v-sys {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.v-fetch {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  padding: 22px 24px;
  border: 1px solid var(--term-faint);
  background: rgba(8, 7, 12, 0.7);
}
.v-fetch .art { margin: 4px 0 0; color: var(--term-primary); line-height: 1.25; font-size: 14px; }
.v-fetch .info { flex: 1; min-width: 0; }
.v-fetch .title .u { color: var(--term-primary); font-weight: 700; }
.v-fetch .rule { color: var(--term-faint); }
.v-fetch .row { display: grid; grid-template-columns: 9ch minmax(0, 1fr); column-gap: 2ch; }
.v-fetch .row .k { color: var(--term-primary); font-weight: 700; }
.v-fetch .row .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-fetch.offline .tui-bar { opacity: 0.5; }
.v-fetch .swatch { margin-top: 12px; letter-spacing: 0; line-height: 1; }

.v-big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }
.v-big .stat { border-left: 2px solid var(--term-primary); padding-left: 16px; }
.v-big .stat:nth-child(2n) { border-left-color: var(--term-secondary); }
.v-big .num { font-size: clamp(40px, 4.6vw, 64px); font-weight: 700; line-height: 1.05; color: var(--term-fg); }
.v-big .unit { color: var(--term-primary); font-size: 0.5em; margin-left: 4px; }
.v-big .label { color: var(--term-dim); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.v-big .v-btn { grid-column: span 2; justify-self: start; }

/* ─── links: "github ........ github.com/x →" ─── */
.v-links a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 4px;
  color: var(--term-fg);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
}
.v-links .dots { flex: 1; border-bottom: 2px dotted var(--term-faint); transform: translateY(-6px); }
.v-links .url { color: var(--term-dim); font-size: 14px; font-weight: 400; }
.v-links .go { color: var(--term-primary); opacity: 0; transition: opacity .15s, transform .15s; }
.v-links a:hover .k { color: var(--term-primary); }
.v-links a:hover .url { color: var(--term-fg); }
.v-links a:hover .go { opacity: 1; transform: translateX(4px); }

/* ─── tmux bar at the bottom ─── */
.v-footer { margin-top: clamp(64px, 8vw, 110px); background: rgba(8, 7, 12, 0.92); border-top: 1px solid var(--term-faint); }
.v-footer .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding-top: 8px; padding-bottom: 8px; color: var(--term-dim); font-size: 12px; }
.v-footer .mode { background: var(--term-primary); color: var(--term-bg); font-weight: 700; padding: 1px 8px; }
.v-footer a, .v-uptime .note a { color: var(--term-dim); }
.v-footer a:hover, .v-uptime .note a:hover { color: var(--term-primary); }

/* ─── imprint / privacy ─── */
/* exactly one screen under the nav: the panel in the middle, the footer at
   the bottom, the § of scene.js behind it */
.v-legal-screen { display: flex; flex-direction: column; min-height: calc(100svh - var(--nav-h)); }
.v-legal-screen .v-footer { margin-top: 0; }
.v-legal { flex: 1; display: flex; flex-direction: column; width: 100%; padding-top: clamp(24px, 5vh, 56px); padding-bottom: 24px; }
.v-legal .v-head .v-back { margin-left: 16px; }
.v-legal .center { flex: 1; display: grid; place-items: center; }
.v-legal .tui-panel { width: min(100%, 620px); padding: 36px 28px 30px; text-align: center; background: rgba(8, 7, 12, 0.78); }
.v-legal .wip { color: var(--term-primary); font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; text-shadow: 0 0 18px var(--term-primary-glow); }
.v-legal p { margin: 12px 0 0; color: var(--v-soft); }

/* ─── /uptime ─── */
/* A status page that fills one screen at any size: everything is sized in em
   and the font follows the viewport, so a big screen gets a bigger page, not
   more empty space. */
.v-uptime {
  box-sizing: border-box;
  max-width: min(100%, 180vh);
  height: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  padding-top: 1.6em;
  padding-bottom: 1em;
  font-size: clamp(12px, min(1.55vh, 1.05vw), 26px);
}
.v-uptime .v-head { margin-bottom: 1.1em; font-size: 1.45em; }
.v-uptime .v-head .meta { font-size: 0.55em; }
/* the way back: a button in the head row, Esc does the same (tui.js) */
.v-back {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.3em 0.8em;
  border: 1px solid var(--term-faint);
  background: rgba(8, 7, 12, 0.6);
  color: var(--term-fg);
  font-size: 0.55em;
  font-weight: 700;
  white-space: nowrap;
}
.v-back .key { padding: 0 0.45em; border: 1px solid var(--term-dim); border-radius: 3px; color: var(--term-dim); font-weight: 400; }
.v-back:hover { border-color: var(--term-primary); color: var(--term-primary); }
.v-back:hover .key { border-color: var(--term-primary); color: var(--term-primary); }
.v-uptime .tui-panel { padding: 1.1em 1.4em 0.8em; }
/* lighter than elsewhere, the network behind shows through */
.v-uptime .tui-panel, .v-uptime .v-overall { background: rgba(8, 7, 12, 0.6); }
.v-uptime .tui-panel > .tui-panel-title,
.v-uptime .tui-panel > .tui-panel-badge { top: -0.75em; font-size: 0.8em; }

/* the overall state on top */
.v-overall {
  --st: var(--term-dim);
  border: 1px solid var(--term-faint);
  border-left: 3px solid var(--st);
  background: var(--v-panel);
  padding: 1.3em 1.6em 1em;
  margin-bottom: 1.6em;
}
.v-overall.up { --st: var(--term-primary); }
.v-overall.down { --st: var(--term-red); }
.v-overall .top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.8em 2.6em; }
.v-overall .state { display: flex; align-items: center; gap: 0.6em; color: var(--st); font-size: 2.1em; font-weight: 700; }
.v-overall .nums { display: flex; flex-wrap: wrap; gap: 0.6em 2.6em; }
.v-overall .nums b { display: block; color: var(--term-fg); font-size: 1.7em; }
.v-overall .nums .ok b { color: var(--term-primary); }
.v-overall .nums .bad b { color: var(--term-red); }
.v-overall .nums span { color: var(--term-dim); font-size: 0.85em; }
.v-overall .v-strip.big { height: 2.4em; margin-top: 1.1em; }
.v-overall .axis { display: flex; justify-content: space-between; margin-top: 0.5em; color: var(--term-dim); font-size: 0.8em; }
.v-overall .dot { width: 0.45em; height: 0.45em; flex: none; border-radius: 50%; background: var(--term-dim); }
.v-overall.up .dot { background: var(--term-primary); box-shadow: 0 0 8px var(--term-primary); animation: tui-pulse 2.4s ease-in-out infinite; }
.v-overall.down .dot { background: var(--term-red); box-shadow: 0 0 8px var(--term-red); }

/* one beat a check, oldest left, like Kuma's heartbeat bar */
.v-strip { display: flex; gap: 0.2em; height: 1.7em; }
.v-strip i { flex: 1; min-width: 0; border-radius: 0.25em; background: var(--term-faint); opacity: 0.45; }
.v-strip i.up { background: var(--term-primary); opacity: 0.9; }
.v-strip i.part { background: var(--term-secondary); opacity: 1; }
.v-strip i.down { background: var(--term-red); opacity: 1; }

/* the monitors: one line each, the rows share the rest of the screen */
.v-net { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.v-net-row {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 4.6em 8.5em minmax(0, 1fr) 7em 4.8em minmax(0, 1.5fr);
  column-gap: 1.3em;
  align-items: center;
  padding: 0.35em 0.2em;
}
.v-net-row + .v-net-row { border-top: 1px dashed var(--term-faint); }
.v-net-row .pill { padding: 0.25em 0; border-radius: 0.3em; background: var(--term-faint); color: var(--term-fg); font-size: 0.85em; font-weight: 700; text-align: center; }
.v-net-row.up .pill { background: var(--term-primary); color: var(--term-bg); }
.v-net-row.down .pill { background: var(--term-red); color: var(--term-bg); }
.v-net-row .name { color: var(--term-fg); font-weight: 700; }
.v-net-row .what { color: var(--term-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-net-row .detail { color: var(--term-primary); text-align: right; }
.v-net-row.down .detail, .v-net-row.down .name { color: var(--term-red); }
.v-net-row .ms { text-align: right; color: var(--term-dim); }

.v-uptime .note { display: flex; flex-wrap: wrap; gap: 0 1ch; padding-top: 0.9em; color: var(--term-dim); font-size: 0.85em; }

/* ─── tablet / phone ─── */
@media (max-width: 1000px) {
  .v-proj { grid-template-columns: 1fr; }
  .v-sys { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .v-nav .brand { display: none; }
  .v-nav nav a { padding: 0 9px; font-size: 12px; }
  .v-nav nav a .n { display: none; }

  /* the longest phrase stays on one line down to 360 px */
  .v-typed { font-size: 13px; }

  .v-stack { grid-template-columns: 1fr; }
  .v-work ul { grid-template-columns: 1fr; }
  .v-work .when { margin-left: 0; flex-basis: 100%; }
  .v-head .meta { display: none; }
  /* no Esc key on phones, just a bigger button */
  .v-back { font-size: 12px; padding: 6px 12px; }
  .v-back .key { display: none; }
  .v-back::before { content: "<"; }

  .v-fetch { padding: 18px 16px; }
  .v-fetch .art { display: none; }

  .v-links .dots, .v-links .go { display: none; }
  .v-links a { flex-direction: column; gap: 0; }

  /* phones: fixed sizes, one short line a monitor, the hour strip is on top */
  .v-uptime { font-size: 13px; }
  .v-overall { padding: 1.1em 1.1em 0.9em; }
  .v-overall .state { font-size: 1.45em; }
  .v-overall .nums { gap: 0.6em 1.8em; }
  .v-overall .nums b { font-size: 1.3em; }
  .v-net-row { grid-template-columns: 4.6em minmax(0, 1fr) auto; }
  .v-net-row .what, .v-net-row .ms, .v-net-row .v-strip { display: none; }
}

/* fx calm and off (the nav button, not the system setting): nothing moves */
:root[data-fx] .cursor, :root[data-fx] .v-overall .dot, :root[data-fx] .v-page,
:root[data-fx] .v-footer, :root[data-fx] .v-ticker .run { animation: none; }
:root[data-fx] #scene-bg { transition: none; }
:root[data-fx="off"] #scene-bg { display: none; }
