/* Telemetry Bureau — styling borrowed from Relay99 (cream sidebar, dark bezel,
   teal/orange readouts, Space Mono). Space Mono is self-hosted (SIL OFL). */
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/SpaceMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/SpaceMono-Bold.woff2') format('woff2');
}

:root {
  --bg: #060a09;
  --bezel: #0a0f0d;
  --panel: #0c1310;
  --panel-deep: #090f0d;
  --line: #22332c;
  --line-soft: #182620;
  --teal: #79e6d5;
  --teal-bright: #a6f4e7;
  --teal-dim: #2c4c45;
  --orange: #ff9a4d;
  --orange-dim: #5a3a1e;
  --cream: #d8cdab;
  --cream-deep: #b3a780;
  --green: #5fd79b;
  --text: #9fb4ac;
  --label: #7d948c;
  --head: #c8d9d2;
  --bright: #d5e4de;
  --font: 'Space Mono', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-bright); }

/* ---------- Sidebar ---------- */

#sidebar {
  position: sticky;
  top: 14px;
  width: 232px;
  flex: 0 0 232px;
  max-height: calc(100vh - 28px);
  background: var(--cream);
  border-radius: 14px;
  border: 1px solid #3a3a32;
  display: flex;
  flex-direction: column;
  overflow: auto;
  box-shadow: inset 0 0 40px rgba(60, 50, 20, 0.18);
}

.emblem { padding: 18px 18px 4px; }
.emblem img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #23312e, 0 6px 18px rgba(35, 49, 46, 0.35);
}

.brand { text-align: center; padding: 12px 8px 10px; }
.brand h1 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0.08em;
  color: #23312e;
  font-weight: 700;
}
.brand p {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: #55604f;
  margin-top: 4px;
}

#nav { display: flex; flex-direction: column; gap: 7px; padding: 10px 14px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
  color: #3c473f;
}
.nav-item svg { width: 15px; height: 15px; flex: 0 0 auto; }
.nav-item:hover { background: rgba(35, 49, 46, 0.08); color: #3c473f; }
.nav-item.active {
  background: #16211f;
  color: var(--teal);
  border-color: #3f5a54;
  box-shadow: 0 0 0 2px rgba(22, 33, 31, 0.25), 0 0 12px rgba(60, 120, 110, 0.35);
}

.status-box {
  margin: auto 14px 14px;
  background: #131d1a;
  border: 1px solid #2c3b36;
  border-radius: 8px;
  padding: 7px 11px 9px;
}
.status-label { font-size: 7.5px; letter-spacing: 0.2em; color: #718778; }
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
}
.status-row span:first-child {
  color: var(--green);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(95, 215, 155, 0.6);
}

.lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: lamp 2.4s ease-in-out infinite;
  flex: 0 0 auto;
}
.lamp.warn { background: var(--orange); box-shadow: 0 0 8px var(--orange); animation-duration: 3.2s; }
@keyframes lamp { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- Main frame ---------- */

#frame {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bezel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#hdr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.hdr-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; letter-spacing: 0.22em; color: #cfe0da; font-weight: 700;
}
.hdr-right { display: flex; align-items: stretch; gap: 16px; }
.hdr-sep { width: 1px; background: var(--line-soft); }
.hdr-label { display: block; font-size: 8px; letter-spacing: 0.2em; color: var(--label); margin-bottom: 3px; }
.hdr-value { font-size: 15px; color: var(--bright); letter-spacing: 0.06em; }
.hdr-value.teal { color: var(--teal); text-shadow: 0 0 8px rgba(121, 230, 213, 0.45); }
.hdr-value.orange { color: var(--orange); text-shadow: 0 0 8px rgba(255, 154, 77, 0.45); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.panel-title {
  font-size: 10.5px; letter-spacing: 0.2em; color: var(--teal); font-weight: 700;
  margin-bottom: 10px;
}

/* About */

#about { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
.lede { font-size: 13px; line-height: 1.75; color: var(--text); }
.lede + .lede { margin-top: 10px; }
.lede b { color: var(--bright); }
.lede em { color: var(--teal); font-style: normal; }
.lede .quote { color: var(--cream-deep); }

.readouts {
  background: var(--panel-deep);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 14px;
  align-self: start;
}
.readout { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.readout:last-child { border-bottom: 0; }
.readout dt { font-size: 8.5px; letter-spacing: 0.18em; color: var(--label); align-self: center; }
.readout dd { font-size: 11px; color: var(--bright); letter-spacing: 0.04em; text-align: right; }

/* Section heads */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 6px 4px 0;
}
.section-head h2 { font-size: 12px; letter-spacing: 0.22em; color: var(--head); font-weight: 700; }
.section-head p { font-size: 9px; letter-spacing: 0.14em; color: var(--label); }

.group-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 9.5px; letter-spacing: 0.22em; color: var(--label); font-weight: 700;
  margin: 6px 4px -4px;
}
.group-title::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--line-soft); }

/* Project cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
#frame { counter-reset: ch; }

.card {
  counter-increment: ch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--teal-dim); box-shadow: 0 0 14px rgba(60, 120, 110, 0.18); }

.media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: radial-gradient(circle at 50% 45%, #0f1a17 0%, var(--panel-deep) 70%);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.media.logo img { width: 42%; max-width: 116px; aspect-ratio: 1; object-fit: contain; border-radius: 18px; }
/* Landscape wordmark logos (Relay99) sit on their own cream plate. */
.media.logo.wide img { width: 78%; max-width: 280px; aspect-ratio: auto; height: auto; border-radius: 12px; }
/* Small UI captures (a popup) shown at near-natural size, not stretched. */
.media.fit img { width: 86%; max-width: 380px; height: auto; border-radius: 4px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.media.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.media::after {
  content: 'CH-' counter(ch, decimal-leading-zero);
  position: absolute; top: 7px; right: 9px;
  font-size: 8px; letter-spacing: 0.18em; color: var(--label);
  background: rgba(6, 10, 9, 0.72); padding: 2px 6px; border-radius: 4px;
}
/* No logo and no screenshot yet: a test-card in place of a picture. */
.media.nosignal {
  flex-direction: column; gap: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(121, 230, 213, 0.035) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 45%, #0f1a17 0%, var(--panel-deep) 70%);
}
.media.nosignal b { font-size: 26px; letter-spacing: 0.12em; color: var(--teal-dim); }
.media.nosignal span { font-size: 8px; letter-spacing: 0.24em; color: var(--label); }

.card-body { padding: 11px 14px 13px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.card-head { display: flex; align-items: center; gap: 9px; }
.card-head h3 { font-size: 12px; letter-spacing: 0.16em; color: var(--head); font-weight: 700; }
.card-head .state { margin-left: auto; font-size: 8px; letter-spacing: 0.18em; color: var(--green); }
.card-head .state.warn { color: var(--orange); }
.card p { font-size: 11px; line-height: 1.6; color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 2px; }
.tags span {
  font-size: 8.5px; letter-spacing: 0.1em; color: var(--label);
  border: 1px solid var(--teal-dim); border-radius: 6px; padding: 2px 7px;
}
.card-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 10px; letter-spacing: 0.12em; font-weight: 700;
  border: 1px solid var(--teal-dim); border-radius: 7px; padding: 5px 11px;
  background: rgba(121, 230, 213, 0.05);
}
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.card-link:hover { border-color: var(--teal); background: rgba(121, 230, 213, 0.1); }

footer {
  border-top: 1px solid var(--line-soft);
  padding: 12px 4px 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  font-size: 9px; letter-spacing: 0.12em; color: var(--label);
}

/* ---------- Narrow screens: sidebar becomes a header ---------- */

@media (max-width: 860px) {
  body { flex-direction: column; align-items: stretch; padding: 10px; gap: 10px; }
  #sidebar {
    position: static; width: auto; flex: none; max-height: none;
    display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center;
  }
  .emblem { padding: 12px 0 12px 12px; }
  .brand { text-align: left; padding: 12px; }
  .brand h1 { font-size: 17px; }
  #nav { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0 10px 10px; }
  .nav-item { padding: 6px 10px; font-size: 9.5px; }
  .nav-item svg { display: none; }
  .status-box { display: none; }
  #about { grid-template-columns: minmax(0, 1fr); }
  .hdr-right { width: 100%; justify-content: space-between; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .section-head { flex-direction: column; gap: 4px; }
}
