/* NIX web components. Needs nix-tokens.css first. Everything is scoped under .nix-*
 * so it can be dropped onto any of the six sites without touching their own styles. */

.nix-wire { height: 2px; background: var(--wire); border: 0; border-radius: 2px; }

.nix-card {
  background: var(--surface);
  color: var(--text);
  border: var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--sp-section);
  font-family: var(--font-ui);
}
.nix-card h2, .nix-card h3 { color: var(--text-strong); line-height: var(--lh-tight); margin: 0 0 var(--sp-cluster); }
.nix-eyebrow { font: 500 var(--fs-xs)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.nix-muted { color: var(--text-muted); }

.nix-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-tight);
  min-height: 40px; padding: 0 var(--sp-element);
  font: 600 var(--fs-sm)/1 var(--font-ui);
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), background-color .12s var(--ease), border-color .12s var(--ease);
}
.nix-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nix-btn:active { transform: translateY(1px); }
.nix-btn--primary { background: var(--accent); color: var(--on-accent); }
.nix-btn--primary:hover { filter: brightness(1.06); }
.nix-btn--ghost { background: transparent; color: var(--text); border-color: var(--control-border); }
.nix-btn--ghost:hover { border-color: var(--accent); }
.nix-btn[disabled] { opacity: .55; cursor: progress; }

.nix-field { display: grid; gap: var(--sp-tight); margin-bottom: var(--sp-element); }
.nix-field label { font: 500 var(--fs-sm)/1.3 var(--font-ui); color: var(--text); }
.nix-field .nix-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.nix-input, .nix-select, .nix-textarea {
  width: 100%; box-sizing: border-box;
  font: 400 var(--fs-md)/1.4 var(--font-ui); color: var(--text);
  background: var(--surface-sunk); border: 1px solid var(--control-border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.nix-textarea { min-height: 120px; resize: vertical; }
.nix-input:focus, .nix-select:focus, .nix-textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.nix-input[aria-invalid="true"], .nix-textarea[aria-invalid="true"] { border-color: var(--danger); }

.nix-status { font-size: var(--fs-sm); margin-top: var(--sp-cluster); min-height: 1.4em; }
.nix-status--ok { color: var(--ok); }
.nix-status--err { color: var(--danger); }

/* Honeypot: off-screen, not display:none (some bots skip hidden inputs). */
.nix-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.nix-socials { display: flex; flex-wrap: wrap; gap: var(--sp-cluster); list-style: none; margin: 0; padding: 0; }
.nix-socials a {
  display: inline-flex; align-items: center; gap: var(--sp-tight);
  color: var(--text-muted); text-decoration: none;
  font: 500 var(--fs-sm)/1 var(--font-mono);
  padding: 6px 10px; border: 1px solid var(--control-border); border-radius: var(--radius-sm); min-height: 32px;
}
.nix-socials a:hover, .nix-socials a:focus-visible { color: var(--accent-ink); border-color: var(--accent); outline: none; }
.nix-socials svg { width: 16px; height: 16px; fill: currentColor; }

/* ---- Patterns from Rook's UI picks (IM-0866/0867), as original work. One look: solid plum cards,
 * a citron-to-cyan edge on the leading card only, glass only on floating bars and sheets. ---- */

/* Leading card: rounded citron-to-cyan edge (use once per view, per Pip). */
.nix-card--edge {
  border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--wire) border-box;
}

/* Glass, for floating bars, docks and sheets only. Fade or move the panel itself, never its parent. */
.nix-glass {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  border: var(--hairline);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nix-glass { background: var(--surface); } }
@media (prefers-reduced-transparency: reduce) { .nix-glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* Cards you can press: small lift on hover, settle on press, citron glow. */
.nix-card--link { display: block; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.nix-card--link:hover { transform: translateY(-2px); border-color: var(--accent);
  box-shadow: 0 10px 32px -14px rgba(var(--accent-rgb), .45); }
.nix-card--link:active { transform: translateY(0) scale(.99); }
.nix-card--link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nix-btn--primary:active { transform: translateY(1px) scale(.98); }

/* Bento grid for project and showcase sections. Wide tiles span two columns on desktop. */
.nix-bento { display: grid; gap: var(--sp-element); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 900px) { .nix-bento > .nix-bento__wide { grid-column: span 2; } }

/* Theme switch: add .nix-theme-switching to <html>, change data-theme, remove it on the next frame,
 * so the page doesn't animate every colour at once. */
.nix-theme-switching *, .nix-theme-switching *::before, .nix-theme-switching *::after { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .nix-btn, .nix-card--link { transition: none; }
  .nix-card--link:hover, .nix-card--link:active, .nix-btn:active, .nix-btn--primary:active { transform: none; }
}
