/* Nexus human-facing pages. One accent: Ceyebr gold. */

:root {
  --nx-bg: #f3f2ef;
  --nx-surface: #ffffff;
  --nx-text: #1c1c1c;
  --nx-muted: #5c5c5c;
  --nx-border: #d9d6cf;
  --nx-accent: #cba052;
  --nx-accent-text: #1c1c1c;
  --nx-danger: #9b2c1c;
  --nx-danger-bg: #fdecea;
  --nx-danger-border: #e8b4ac;
  --nx-ok: #1b5e20;
  --nx-ok-bg: #e8f5e9;
  --nx-ok-border: #b7dfb9;
  --nx-err: #8a1f11;
  --nx-shadow: 0 1px 2px rgba(28, 28, 28, 0.04), 0 8px 24px rgba(28, 28, 28, 0.05);
  --nx-radius: 12px;
  --nx-font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --nx-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --nx-bg: #121212;
    --nx-surface: #1c1c1c;
    --nx-text: #f0eee8;
    --nx-muted: #a8a49c;
    --nx-border: #333129;
    --nx-danger: #f0b4aa;
    --nx-danger-bg: #3a1c18;
    --nx-danger-border: #6a322b;
    --nx-ok: #b6dfb8;
    --nx-ok-bg: #1a3320;
    --nx-ok-border: #2d5333;
    --nx-err: #f0b4aa;
    --nx-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 var(--nx-font);
  color: var(--nx-text);
  background: var(--nx-bg);
}

a {
  color: var(--nx-text);
  text-decoration-color: var(--nx-accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 2px;
}

a:hover {
  color: var(--nx-accent-text);
  background: var(--nx-accent);
}

:focus-visible {
  outline: 2px solid var(--nx-accent);
  outline-offset: 2px;
}

.nx-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.15rem;
  border-bottom: 1px solid var(--nx-border);
  background: var(--nx-surface);
}

.nx-brand {
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--nx-text);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.nx-brand:hover {
  background: var(--nx-accent);
  color: var(--nx-accent-text);
}

.nx-sep {
  color: var(--nx-muted);
}

.nx-crumb {
  color: var(--nx-muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.nx-main {
  width: min(46rem, calc(100% - 2rem));
  margin: 1.35rem auto 3rem;
}

h1 {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.02rem;
  font-weight: 650;
  margin: 0 0 0.7rem;
}

h3 {
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
}

p,
ol,
ul {
  margin: 0.45rem 0;
}

.nx-card,
.nx-panel {
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow);
  padding: 1.05rem 1.15rem 1.15rem;
  margin: 0 0 1rem;
}

.muted,
.nx-muted {
  color: var(--nx-muted);
}

.err,
.ok {
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  margin: 0 0 1rem;
}

.err {
  color: var(--nx-err);
  background: var(--nx-danger-bg);
  border: 1px solid var(--nx-danger-border);
}

.ok {
  color: var(--nx-ok);
  background: var(--nx-ok-bg);
  border: 1px solid var(--nx-ok-border);
}

label {
  display: block;
  font-weight: 550;
  margin: 0 0 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  display: block;
  width: 100%;
  max-width: 32rem;
  margin: 0.15rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--nx-text);
  background: var(--nx-surface);
  border: 1px solid var(--nx-border);
  border-radius: 8px;
}

textarea {
  min-height: 6.5rem;
  resize: vertical;
  font-family: var(--nx-mono);
  font-size: 0.88rem;
  line-height: 1.45;
}

input[type="file"] {
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
}

button,
.btn,
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  margin: 0.15rem 0.4rem 0.15rem 0;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: var(--nx-accent-text);
  background: var(--nx-accent);
  border: 1px solid var(--nx-accent);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.btn:hover,
.nx-btn:hover {
  filter: brightness(0.96);
}

button.secondary,
.nx-btn-secondary {
  color: var(--nx-text);
  background: transparent;
  border-color: var(--nx-border);
}

button.danger,
.nx-btn-danger {
  color: #fff;
  background: #9b2c1c;
  border-color: #9b2c1c;
}

@media (prefers-color-scheme: dark) {
  button.danger,
  .nx-btn-danger {
    color: #1c1c1c;
    background: #e8a399;
    border-color: #e8a399;
  }
}

code,
pre,
.nx-mono {
  font-family: var(--nx-mono);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

code {
  padding: 0.08em 0.28em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--nx-border) 45%, var(--nx-surface));
}

pre {
  background: color-mix(in srgb, var(--nx-border) 35%, var(--nx-surface));
  border: 1px solid var(--nx-border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  overflow: auto;
}

pre code {
  padding: 0;
  background: transparent;
}

.help {
  white-space: pre-wrap;
  background: color-mix(in srgb, var(--nx-border) 30%, var(--nx-surface));
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  font-size: 0.92rem;
}

.row,
.nx-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nx-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  border: 1px solid var(--nx-border);
  color: var(--nx-muted);
  background: color-mix(in srgb, var(--nx-border) 28%, var(--nx-surface));
}

.nx-badge-managed,
.nx-badge-running,
.nx-badge-ok {
  color: var(--nx-ok);
  background: var(--nx-ok-bg);
  border-color: var(--nx-ok-border);
}

.nx-badge-unmanaged,
.nx-badge-skipped {
  color: var(--nx-muted);
}

.nx-badge-clean,
.nx-badge-published {
  color: var(--nx-ok);
  background: var(--nx-ok-bg);
  border-color: var(--nx-ok-border);
}

.nx-badge-dirty,
.nx-badge-changed {
  color: var(--nx-accent-text);
  background: var(--nx-accent);
  border-color: var(--nx-accent);
}

.nx-badge-error {
  color: var(--nx-err);
  background: var(--nx-danger-bg);
  border-color: var(--nx-danger-border);
}

.nx-sites,
.nx-plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nx-site {
  padding: 0.85rem 0;
  border-top: 1px solid var(--nx-border);
}

.nx-site:first-child {
  border-top: 0;
  padding-top: 0.15rem;
}

.nx-site-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.nx-site-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.nx-site-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.nx-site-actions form {
  margin: 0;
}

.nx-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.nx-step {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-top: 1px solid var(--nx-border);
}

.nx-step:first-child {
  border-top: 0;
}

.preview,
.nx-preview {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.preview svg,
.nx-preview svg {
  flex: 0 0 auto;
  border: 1px solid var(--nx-border);
  border-radius: 8px;
  background: #fff;
}

.nx-files {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
}

.nx-file {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.22rem 0;
  font-family: var(--nx-mono);
  font-size: 0.84rem;
}

.nx-kind {
  flex: 0 0 1.1rem;
  font-weight: 700;
}

.nx-kind-A { color: var(--nx-ok); }
.nx-kind-M { color: #8a6e2e; }
.nx-kind-D { color: var(--nx-err); }
.nx-kind-R { color: var(--nx-muted); }

@media (prefers-color-scheme: dark) {
  .nx-kind-M { color: var(--nx-accent); }
}

.nx-file code {
  background: transparent;
  padding: 0;
}

.nx-actions form {
  margin: 0.75rem 0 0;
}

article > h1:first-child {
  margin-top: 0;
}

article ul {
  padding-left: 1.2rem;
}

@media (max-width: 40rem) {
  .nx-main {
    width: calc(100% - 1.4rem);
    margin-top: 1rem;
  }

  .nx-header {
    padding: 0.65rem 0.85rem;
  }

  .nx-card,
  .nx-panel {
    padding: 0.9rem 0.85rem 1rem;
  }

  input[type="text"],
  input[type="password"],
  textarea,
  select {
    max-width: none;
  }

  .nx-site-actions,
  .nx-actions form p {
    width: 100%;
  }

  button,
  .btn,
  .nx-btn {
    width: 100%;
    margin-right: 0;
  }

  .nx-site-actions button {
    width: auto;
    min-width: 6.5rem;
  }
}
