/* ─── RLM Hub terminal hub ─────────────────────────────────────────────
 * Dark default, mustard accent. Light flip via [data-theme="light"].
 * Background effect via [data-bg="scan|grid|noise|none"]. CRT via [data-crt="1|0"].
 */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/InstrumentSerif-Italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/InstrumentSerif-Regular.woff2') format('woff2');
}

:root {
  --paper:  #050807;
  --ink:    #e6e3da;
  --dim:    rgba(230, 227, 218, 0.55);
  --muted:  rgba(230, 227, 218, 0.18);
  --rule:   rgba(230, 227, 218, 0.10);
  --accent: #f0b400;

  --status-live:     #3ad27c;
  --status-beta:     #f0b400;
  --status-wip:      #3aa5ff;
  --status-idea:     #b46cff;
  --status-private:  #5dd5ff;
  --status-archived: #888888;
  --error:           #ff5b5b;

  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: 'Geist',      ui-sans-serif, system-ui, sans-serif;
  --font-serif:'Instrument Serif', Georgia, serif;

  --max-w: 1180px;
}

[data-theme="light"] {
  --paper: #f5f3ec;
  --ink:   #14171d;
  --dim:   rgba(20, 23, 29, 0.60);
  --muted: rgba(20, 23, 29, 0.18);
  --rule:  rgba(20, 23, 29, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--paper); }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
  text-shadow: 0 0 4px rgba(230, 227, 218, 0.35);
}
[data-theme="light"] body { text-shadow: none; }

/* Background effects */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
}
[data-bg="scan"]  body::before { background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 3px); }
[data-bg="grid"]  body::before { background-image: linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px); background-size: 24px 24px; }
[data-bg="noise"] body::before { background-image: radial-gradient(rgba(255,255,255,0.10) 0.5px, transparent 0.5px); background-size: 4px 4px; }
[data-theme="light"][data-bg="scan"]  body::before { background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.04) 0 1px, transparent 1px 3px); }
[data-theme="light"][data-bg="grid"]  body::before { background-image: linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px); background-size: 24px 24px; }
[data-theme="light"][data-bg="noise"] body::before { background-image: radial-gradient(rgba(0,0,0,0.08) 0.5px, transparent 0.5px); background-size: 4px 4px; }

/* CRT flicker */
@keyframes rlm-flicker { 0%, 100% { opacity: 1; } 96% { opacity: 0.96; filter: brightness(1.08); } }
[data-crt="1"] body { animation: rlm-flicker 9s infinite; }

.rlm-term {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 32px 32px;
  min-height: 100vh;
}

/* ─── Window chrome ───────────────────────────────────────────────── */
.rlm-chrome {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--muted);
  padding-bottom: 10px; margin-bottom: 14px;
  flex-wrap: wrap; gap: 8px;
}
.rlm-lockup { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.rlm-mark { display: inline-flex; align-items: baseline; letter-spacing: -0.05em; }
.rlm-rlm { font-family: var(--font-sans); font-weight: 700; font-size: 22px; line-height: 1; }
.rlm-pt  { font-family: var(--font-serif); font-style: italic; font-size: 21px; line-height: 1; color: var(--accent); margin-left: 2px; text-shadow: 0 0 6px rgba(240, 180, 0, 0.5); }
.rlm-prompt-label { color: var(--dim); font-size: 12px; }
.rlm-uptime-badge { color: var(--dim); font-size: 11px; }

/* Theme toggle (top-right of chrome) */
.rlm-chrome-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rlm-theme-toggle {
  font-family: var(--font-mono); font-size: 11px;
  background: transparent; color: var(--dim);
  border: 1px solid var(--muted); border-radius: 3px;
  padding: 3px 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  letter-spacing: 0.05em;
}
.rlm-theme-toggle:hover {
  color: var(--accent); border-color: var(--accent);
  background: rgba(240, 180, 0, 0.08);
}
[data-theme="light"] .rlm-theme-toggle:hover { background: rgba(240, 180, 0, 0.12); }
.rlm-theme-toggle:focus-visible {
  outline: 1px solid var(--accent); outline-offset: 2px;
}
.rlm-theme-icon { font-size: 13px; line-height: 1; }

/* ─── Boot ─────────────────────────────────────────────────────────── */
.rlm-boot { font-family: var(--font-mono); font-size: 13px; }
.rlm-boot-line { display: grid; grid-template-columns: 64px 64px 1fr; gap: 10px; padding: 1px 0; }
.rlm-boot-line .rlm-bt   { color: var(--dim); }
.rlm-boot-line .rlm-bk--ok      { color: var(--status-live); font-weight: 700; }
.rlm-boot-line .rlm-bk--warn    { color: var(--status-beta); font-weight: 700; }
.rlm-boot-line .rlm-bk--info    { color: var(--ink); opacity: 0.7; }
.rlm-boot-line .rlm-bk--welcome { color: var(--accent); font-weight: 700; text-shadow: 0 0 6px var(--accent); }
.rlm-boot-line .rlm-bx          { color: var(--ink); }
.rlm-boot-line .rlm-bx--welcome { color: var(--accent); text-shadow: 0 0 6px var(--accent); }
.rlm-boot-skip-hint { margin-top: 8px; color: var(--dim); font-size: 11px; }
.rlm-cursor-blink {
  display: inline-block; width: 8px; height: 14px; background: var(--ink);
  margin-left: 2px; vertical-align: middle;
  animation: rlm-blink 1s steps(2) infinite;
  box-shadow: 0 0 6px var(--ink);
}
@keyframes rlm-blink { 50% { opacity: 0; } }

/* ─── Strips (map + tails) ────────────────────────────────────────── */
.rlm-strip {
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  margin-bottom: 10px;
  position: relative;
}
.rlm-strip-head { color: var(--dim); margin-bottom: 4px; }
.rlm-pulse { color: var(--accent); animation: rlm-blink 1.4s steps(2) infinite; }

.rlm-map {
  font-family: var(--font-mono); font-size: 9px; line-height: 1.05;
  white-space: pre; color: var(--ink); opacity: 0.7;
  margin: 0;
}
.rlm-map-tag {
  position: absolute; right: 4px; top: 8px;
  font-size: 9px; color: var(--accent); text-align: right; opacity: 0.9;
}
.rlm-map-sub { display: block; color: var(--ink); opacity: 0.55; }

.rlm-tail-lines { display: flex; flex-direction: column; }
.rlm-tail-line { display: grid; grid-template-columns: 90px auto auto 1fr auto; gap: 12px; align-items: baseline; font-size: 12px; }
.rlm-tail-line.rlm-now-line { display: block; }
.rlm-tail-line .rlm-ts { color: var(--dim); }
.rlm-tail-line .rlm-ok { color: var(--status-live); }
.rlm-tail-line .rlm-fail { color: var(--error); }
.rlm-tail-line .rlm-host { color: var(--ink); }
.rlm-tail-line .rlm-ms-fast { color: var(--status-live); }
.rlm-tail-line .rlm-ms-mid  { color: var(--status-beta); }
.rlm-tail-line .rlm-ms-slow { color: var(--error); }

/* ─── Scrollback (rendered command output) ──────────────────────── */
.rlm-scrollback { display: flex; flex-direction: column; }
.rlm-sb-block { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.rlm-sb-cmd  { color: var(--dim); }
.rlm-sb-cmd .rlm-dollar { color: var(--accent); margin-right: 6px; }
.rlm-sb-out  { margin-top: 6px; }
.rlm-err     { color: var(--error); }
.rlm-pre     { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; margin: 0; white-space: pre-wrap; color: var(--ink); }
.rlm-pre--accent { color: var(--accent); text-shadow: 0 0 6px var(--accent); }

/* ─── ls table ────────────────────────────────────────────────────── */
.rlm-view { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.rlm-ls-head, .rlm-row {
  display: grid;
  grid-template-columns: 24px 32px 1.4fr 2.6fr 1fr 110px 80px;
  gap: 12px;
  align-items: center;
}
.rlm-ls-head {
  padding: 4px 0; opacity: 0.5; font-size: 11px;
  border-bottom: 1px dashed var(--rule); margin-bottom: 4px;
}
.rlm-row { padding: 4px 0; cursor: pointer; outline: none; }
.rlm-row .rlm-cursor { color: var(--accent); opacity: 0; }
.rlm-row.is-selected { background: rgba(230, 227, 218, 0.08); box-shadow: inset 3px 0 0 var(--accent); }
[data-theme="light"] .rlm-row.is-selected { background: rgba(20, 23, 29, 0.06); }
.rlm-row.is-selected .rlm-cursor { opacity: 1; }
.rlm-row.is-selected .rlm-name { color: var(--accent); text-shadow: 0 0 6px var(--accent); }
.rlm-num   { color: var(--dim); }
.rlm-name  { color: var(--accent); }
.rlm-desc  { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rlm-stack { color: var(--dim); font-size: 11px; }
.rlm-status[data-status="live"]     { color: var(--status-live); }
.rlm-status[data-status="beta"]     { color: var(--status-beta); }
.rlm-status[data-status="wip"]      { color: var(--status-wip); }
.rlm-status[data-status="idea"]     { color: var(--status-idea); }
.rlm-status[data-status="private"]  { color: var(--status-private); }
.rlm-status[data-status="archived"] { color: var(--status-archived); }
.rlm-updated { color: var(--dim); text-align: right; font-size: 11px; }
.rlm-ls-foot {
  margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--rule);
  display: flex; justify-content: space-between; opacity: 0.55; font-size: 11px;
}

/* Cat / readme block */
.rlm-readme { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; }
.rlm-readme h1 { color: var(--accent); font-weight: 700; font-size: 13px; margin: 0; }
.rlm-readme p { color: var(--dim); margin: 4px 0 10px; }
.rlm-readme dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px; margin: 0; }
.rlm-readme dt { color: var(--dim); }
.rlm-readme dd { margin: 0; color: var(--ink); }
.rlm-readme a  { color: var(--accent); text-decoration: none; }

/* ─── Prompt ──────────────────────────────────────────────────────── */
.rlm-prompt {
  position: sticky; bottom: 0;
  margin-top: 14px;
  background: var(--paper);
  border-top: 1px solid var(--muted); padding-top: 10px;
  display: flex; align-items: center; gap: 8px;
}
.rlm-dollar { color: var(--accent); }
#rlm-input {
  flex: 1; background: transparent; border: none; color: inherit;
  font-family: inherit; font-size: inherit; outline: none;
  caret-color: var(--ink); text-shadow: inherit;
  padding: 4px 0;
}
.rlm-stat { color: var(--dim); font-size: 11px; }

/* ─── Footer ──────────────────────────────────────────────────────── */
.rlm-foot {
  margin-top: 24px; padding-top: 14px;
  border-top: 1px dashed var(--rule);
  display: flex; flex-direction: column; gap: 10px;
  font-size: 11px;
}
.rlm-foot-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.rlm-tag {
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 6px; border: 1px solid currentColor; border-radius: 3px;
  opacity: 0.7;
}
.rlm-tag--os   { color: var(--status-live); }
.rlm-tag--lang { color: var(--status-wip); }
.rlm-tag--db   { color: var(--status-idea); }
.rlm-tag--svc  { color: var(--status-beta); }
.rlm-tag--tool { color: var(--dim); }

.rlm-foot-socials { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--dim); }
.rlm-social { color: var(--ink); text-decoration: none; }
.rlm-social .rlm-handle { color: var(--dim); margin-left: 4px; }
.rlm-social:hover { color: var(--accent); }
.rlm-copy { margin-left: auto; color: var(--dim); }

/* ─── Vignette overlay ────────────────────────────────────────────── */
.rlm-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  display: none;
}
[data-crt="1"] .rlm-vignette { display: block; }
[data-theme="light"] .rlm-vignette { background: radial-gradient(ellipse at center, transparent 65%, rgba(0,0,0,0.20) 100%); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .rlm-term { padding: 16px 16px 24px; }
  .rlm-ls-head, .rlm-row {
    grid-template-columns: 18px 26px 1fr 80px 70px;
  }
  .rlm-ls-head > :nth-child(4),
  .rlm-row    > :nth-child(4),
  .rlm-ls-head > :nth-child(5),
  .rlm-row    > :nth-child(5) { display: none; }
  .rlm-map { font-size: 7px; }
  .rlm-map-tag { position: static; text-align: left; margin-top: 6px; }
}

.rlm-noscript {
  margin: 24px; padding: 12px 16px;
  border: 1px dashed var(--rule); color: var(--dim);
}
