/* ============================================================
   DESIGN TOKENS
   bg: deep blue-black (not pure black) — a server-room-at-night feel
   amber (now phosphor green): status/active accent, cyan: secondary/portfolio accent
   mono face carries data + structure; Inter carries prose (bios, descriptions)
   ============================================================ */
:root {
  --bg: #0B0E14;
  --surface: #131826;
  --surface-2: #1A2235;
  --border: #262F42;
  --text: #E4E7EB;
  --text-dim: #7C879C;
  --text-faint: #4B5468;

  --amber: #3ECF6E;
  --amber-dim: #1F6B3A;
  --cyan: #3FD0C9;
  --cyan-dim: #256863;
  --red: #FF5D5D;

  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, sans-serif;

  --radius: 3px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(63, 208, 201, 0.05), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(255, 176, 32, 0.04), transparent 40%);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding-bottom: 4rem;
}

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

/* ============================================================
   STATUS BAR — signature element: a live terminal handshake readout
   ============================================================ */
.statusbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 24, 38, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
  font-family: var(--mono);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.statusbar__prompt { color: var(--text); white-space: nowrap; }
.prompt__user { color: var(--amber); }
.prompt__at, .prompt__colon { color: var(--text-faint); }
.prompt__host { color: var(--cyan); }
.prompt__cursor {
  animation: blink 1.1s steps(1) infinite;
  color: var(--amber);
}
@keyframes blink { 50% { opacity: 0; } }

.statusbar__links {
  color: var(--text-dim);
  margin-right: auto;
}

.statusbar__services {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.statusbar__services li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}
.dot[data-state="ok"] { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.dot[data-state="error"] { background: var(--red); box-shadow: 0 0 6px var(--red); }
.dot[data-state="pending"] { background: var(--text-faint); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ============================================================
   RACK — the three main units
   ============================================================ */
.rack {
  max-width: 1440px;
  margin: 2.5rem auto;
  padding: 0 clamp(1.25rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.rack__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  align-items: stretch;
}
.rack__row .unit { display: flex; flex-direction: column; }
.rack__row .unit .unit__body { flex: 1; }

@media (max-width: 760px) {
  .rack__row { grid-template-columns: 1fr; }
}

.unit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-left-color 0.3s ease;
}
.unit[data-live="true"] { border-left-color: var(--amber); }

.unit__label {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono);
}
.unit__index { color: var(--text-faint); font-size: 0.75rem; }
.unit__title {
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}
.unit__source {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.unit__body { padding: 1.5rem; }

.unit__placeholder {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.85rem;
  margin: 0;
}

.unit__error {
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.85rem;
  margin: 0;
}

/* ---------- Profile (Steam) ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.profile-header img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.profile-header__name { font-weight: 600; font-size: 1.1rem; }
.profile-header__state {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.stat-row {
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.stat-row b { color: var(--text); font-size: 1rem; display: block; font-weight: 700; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.game-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  font-size: 0.78rem;
  overflow: hidden;
}
.game-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  object-position: center;
  border-radius: 2px;
  margin-bottom: 0.4rem;
  background: var(--bg); /* shows while loading, avoids layout flash */
}
.game-card__name { font-weight: 500; }
.game-card__time { color: var(--text-dim); font-family: var(--mono); font-size: 0.72rem; }

/* ---------- Portfolio (GitHub) ---------- */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.repo-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.repo-card__name {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--cyan);
  font-size: 0.9rem;
}
.repo-card__desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0.4rem 0 0.6rem;
  line-height: 1.4;
}
.repo-card__meta {
  display: flex;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.activity-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.activity-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}
.activity-list li span:first-child { color: var(--text); }

/* ---------- Homelab (Proxmox) ---------- */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.node-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.node-card__name {
  font-family: var(--mono);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.meter {
  height: 5px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.meter__fill { height: 100%; background: var(--amber); }
.meter-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.guest-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.guest-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 500;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.guest-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.guest-table tr:hover td { background: var(--surface-2); }
.guest-table .status-running { color: var(--amber); }
.guest-table .status-stopped { color: var(--text-faint); }

.guest-table .guest-name {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.guest-icon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--surface);
  object-fit: contain;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footfoot {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 3vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.footfoot button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.footfoot button:hover { color: var(--text); border-color: var(--amber); }

@media (max-width: 600px) {
  .statusbar { gap: 0.75rem; }
  .statusbar__links { order: 3; width: 100%; }
  .profile-header { flex-wrap: wrap; }
}