/* Horus — styled after the kilo house shell: dark-only zinc surfaces,
   Inter body / Fraunces display, PrimeNG Aura form tokens, one primary ramp
   (sky, sampled from the logo). Tokens mirror what the kilo preset resolves
   to so a page here sits next to a kilo app without looking foreign. */
:root {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --p-primary-300: #7dd3fc;
  --p-primary-400: #38bdf8;
  --p-primary-500: #0ea5e9;
  --p-primary-color: var(--p-primary-400);
  --p-primary-hover-color: var(--p-primary-300);
  --p-primary-contrast-color: #18181b;

  --p-surface-0: #ffffff;
  --p-surface-400: #a1a1aa;
  --p-surface-500: #71717a;
  --p-surface-700: #3f3f46;
  --p-surface-800: #27272a;
  --p-surface-900: #18181b;
  --p-surface-950: #09090b;

  --p-text-color: var(--p-surface-0);
  --p-text-muted-color: var(--p-surface-400);
  --p-content-background: var(--p-surface-900);
  --p-content-border-color: var(--p-surface-700);
  --p-content-hover-background: var(--p-surface-800);
  --p-form-field-background: var(--p-surface-950);
  --p-form-field-border-color: var(--p-surface-700);
  --p-form-field-hover-border-color: var(--p-surface-500);
  --p-form-field-focus-border-color: var(--p-primary-color);
  --p-border-radius: 6px;

  --page-gutter: 1rem;
  --page-gutter-sm: 0.5rem;
  --page-top-gap: 1.5rem;
}

* { box-sizing: border-box; }
html { background: #131316; }
body {
  margin: 0;
  color: var(--p-text-color);
  background: #131316;
  font: 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .font-display { font-family: var(--font-display); font-optical-sizing: auto; }
code { font-family: var(--font-mono); }
a { color: var(--p-primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }
.text-muted { color: var(--p-text-muted-color); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Titlebar: frosted charcoal, "Brand / Page" ---- */
.app-shell-titlebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #4b5563;
  background: rgba(19, 19, 22, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand-logo { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.titlebar-brand { font-weight: 600; font-size: 1.25rem; color: #e5e7eb; }
.titlebar-sep { color: #9ca3af; }
.titlebar-icon { width: 1.25rem; height: 1.25rem; color: var(--p-text-muted-color); flex-shrink: 0; }
.titlebar-title { font-weight: 600; font-size: 1.25rem; }
.titlebar-location { color: var(--p-text-muted-color); font-size: 0.9rem; margin-left: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar-extras { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.peer-switch select {
  font: inherit;
  color: var(--p-text-color);
  background: var(--p-form-field-background);
  border: 1px solid var(--p-form-field-border-color);
  border-radius: var(--p-border-radius);
  padding: 0.35rem 0.6rem;
}

/* ---- Page ---- */
.app-page { margin: var(--page-gutter-sm); padding-top: var(--page-top-gap); max-width: 64rem; }
@media (min-width: 768px) { .app-page { margin: var(--page-gutter) auto; padding: var(--page-top-gap) var(--page-gutter) 0; } }
.app-title-bar-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }

.node-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  background: var(--p-content-background);
  border: 1px solid var(--p-content-border-color);
  border-radius: var(--p-border-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.node-hero { height: 6.5rem; width: auto; max-width: 45%; flex-shrink: 0; opacity: 0.9; }
@media (max-width: 640px) { .node-card { flex-direction: column; align-items: flex-start; } .node-hero { max-width: 100%; height: auto; width: 100%; } }
.node-facts { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; }
.node-facts div { display: flex; flex-direction: column; }
.node-facts dt { font-size: 0.75rem; color: var(--p-text-muted-color); }
.node-facts dd { margin: 0; font-weight: 500; }

/* ---- Form: PrimeNG Aura inputs, selectbuttons and buttons ---- */
.lg-form { display: grid; gap: 1rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label, .field-label { font-size: 0.8rem; color: var(--p-text-muted-color); }
.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; }
input[type=text] {
  width: 100%;
  font: inherit;
  font-family: var(--font-mono);
  color: var(--p-text-color);
  background: var(--p-form-field-background);
  border: 1px solid var(--p-form-field-border-color);
  border-radius: var(--p-border-radius);
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type=text]::placeholder { color: var(--p-surface-500); }
input[type=text]:hover { border-color: var(--p-form-field-hover-border-color); }
input[type=text]:focus {
  border-color: var(--p-form-field-focus-border-color);
  box-shadow: 0 0 0 1px var(--p-form-field-focus-border-color);
}

.selectbutton { display: inline-flex; }
.selectbutton input { position: absolute; opacity: 0; width: 0; height: 0; }
.selectbutton span {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--p-form-field-background);
  color: var(--p-text-muted-color);
  border: 1px solid var(--p-form-field-border-color);
  border-left-width: 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s;
}
.selectbutton label:first-child span { border-left-width: 1px; border-radius: var(--p-border-radius) 0 0 var(--p-border-radius); }
.selectbutton label:last-child span { border-radius: 0 var(--p-border-radius) var(--p-border-radius) 0; }
.selectbutton span:hover { background: var(--p-content-hover-background); color: var(--p-text-color); }
.selectbutton input:checked + span { background: var(--p-primary-color); color: var(--p-primary-contrast-color); border-color: var(--p-primary-color); }
.selectbutton input:focus-visible + span { box-shadow: 0 0 0 1px var(--p-primary-color); position: relative; z-index: 1; }

.actions { display: flex; gap: 0.5rem; margin-left: auto; }
.p-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--p-border-radius);
  border: 1px solid var(--p-primary-color);
  background: var(--p-primary-color);
  color: var(--p-primary-contrast-color);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.p-button svg { width: 1rem; height: 1rem; }
.p-button:hover { background: var(--p-primary-hover-color); border-color: var(--p-primary-hover-color); }
.p-button:focus-visible { outline: none; box-shadow: 0 0 0 1px #131316, 0 0 0 3px var(--p-primary-color); }
.p-button[disabled] { opacity: 0.6; cursor: default; }
.p-button-secondary { background: transparent; border-color: var(--p-content-border-color); color: var(--p-text-muted-color); }
.p-button-secondary:hover:not([disabled]) { background: var(--p-content-hover-background); border-color: var(--p-content-border-color); color: var(--p-text-color); }

/* ---- Output ---- */
.lg-output {
  min-height: 16rem;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--p-surface-950);
  color: #d4d4d8;
  border: 1px solid var(--p-content-border-color);
  border-radius: var(--p-border-radius);
  font: 13px/1.5 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}
.lg-output.error { color: #fca5a5; }

.page-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-top: 1rem; font-size: 0.85rem; }
.app-shell-build-stamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--p-text-muted-color);
  opacity: 0.7;
  white-space: nowrap;
  user-select: all;
}
