/* components.css - buttons, links, form controls, focus, selection, scrollbar.
   Load AFTER the layout/motion CSS so these win.
   Palette is taken from the game itself: void, cold title white, city ember/amber,
   crimson, nebula violet. Restrained palette. */

:root {
  --ns-void:   #05060a;  /* page ground, same as the game's void */
  --ns-panel:  #0c0e16;
  --ns-input:  #08090e;
  --ns-ink:    #eef1f8;  /* cold white of the title */
  --ns-muted:  #a4adc2;
  --ns-ember:  #ff7a1a;  /* the burning city */
  --ns-amber:  #ffb020;  /* city glow, focus + selection */
  --ns-gold:   #ffd76a;  /* Black Gold highlight, success */
  --ns-crimson:#ff5a70;  /* red, tuned for AA text on dark (6.7:1) */
  --ns-nebula: #7a5cff;  /* Nebula violet, used only as a hairline accent */
  --ns-edge:   #6b7088;  /* control borders, 4.07:1 on input */
  --ns-btn:    #e9edf5;  /* button face: the title white, slightly warmed down */
  --ns-btn-ink:#05060a;
}

/* ---- selection, caret, scrollbar ---- */
::selection { background: var(--ns-amber); color: var(--ns-void); }
input, textarea { caret-color: var(--ns-amber); }
html { scrollbar-color: #4a3a2a var(--ns-void); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ns-void); }
::-webkit-scrollbar-thumb { background: #4a3a2a; border: 2px solid var(--ns-void); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--ns-ember); }

/* ---- links: cold white, ember underline, amber on hover ---- */
a { color: var(--ns-ink); text-decoration: underline; text-decoration-color: var(--ns-ember); text-decoration-thickness: 1px; text-underline-offset: .22em; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--ns-amber); text-decoration-color: var(--ns-amber); }
a:active { color: var(--ns-ember); }

/* ---- focus: one amber ring everywhere, offset so it reads on white faces too ---- */
:focus-visible { outline: 2px solid var(--ns-amber); outline-offset: 4px; border-radius: 0; }
:focus:not(:focus-visible) { outline: none; }
.skip { background: var(--ns-btn); color: var(--ns-btn-ink); }
.skip:focus-visible { outline-offset: 2px; }

/* ---- buttons ---- */
.btn {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .9rem 1.5rem;
  font: 600 1rem/1 var(--body, system-ui, sans-serif); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: var(--ns-btn-ink); background: var(--ns-btn);
  border: 1px solid var(--ns-btn); border-radius: 0;
  box-shadow: none; cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
/* a thin ember bar under the face: the only ornament */
.btn::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ns-ember); z-index: 1; transition: background-color .12s; }
.btn:hover { background: var(--ns-ember); border-color: var(--ns-ember); color: #140600; }
.btn:hover::after { background: var(--ns-crimson); }
.btn:active { background: var(--ns-amber); border-color: var(--ns-amber); color: #140600; transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ns-amber); outline-offset: 4px; }

/* hover-only glitch: two slivers of the face slip sideways once, then settle */
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: var(--ns-crimson); clip-path: inset(0 0 100% 0);
}
@media (prefers-reduced-motion: no-preference) {
  .btn:hover::before { animation: ns-slip .34s steps(1, end) 1; }
  @keyframes ns-slip {
    0%   { opacity: 1; transform: translate(-5px, 0); clip-path: inset(10% 0 60% 0); }
    33%  { opacity: 1; transform: translate(4px, 0);  clip-path: inset(55% 0 20% 0); }
    66%  { opacity: 1; transform: translate(-2px, 0); clip-path: inset(30% 0 45% 0); }
    100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  }
}

/* ghost: same shape, no face, for secondary actions */
.btn--ghost { background: transparent; color: var(--ns-ink); border-color: #8a7a68; }
.btn--ghost::after { background: transparent; }
.btn--ghost:hover { background: transparent; color: var(--ns-amber); border-color: var(--ns-amber); }
.btn--ghost:hover::after { background: var(--ns-amber); }

/* disabled / sending */
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] {
  background: #14161f; border-color: #3a3f52; color: #8a8f9f; cursor: not-allowed; transform: none;
}
.btn:disabled::after, .btn[disabled]::after { background: #3a3f52; }
.btn:disabled::before, .btn[disabled]::before { display: none; }
.btn.is-sending, .btn[aria-busy="true"] { cursor: progress; }
.btn.is-sending::after, .btn[aria-busy="true"]::after { background: var(--ns-amber); }
@media (prefers-reduced-motion: no-preference) {
  .btn.is-sending::after, .btn[aria-busy="true"]::after { animation: ns-load 1s steps(6, end) infinite; transform-origin: left; }
  @keyframes ns-load { 0% { transform: scaleX(.1); } 100% { transform: scaleX(1); } }
}

/* ---- form controls ---- */
form label { color: var(--ns-ink); font-weight: 600; }
input[type="email"], input[type="text"], input[type="search"], textarea {
  width: 100%; min-height: 52px; padding: .8rem 1rem;
  font: 400 1.0625rem var(--body, system-ui, sans-serif); color: var(--ns-ink);
  background: var(--ns-input); border: 1px solid var(--ns-edge); border-radius: 0;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #8890a6; opacity: 1; }
input:hover:not(:disabled) { border-color: #9096ac; }
input:focus-visible { outline: 2px solid var(--ns-amber); outline-offset: 3px; border-color: var(--ns-amber); }
input:disabled { background: #14161f; color: #8a8f9f; border-color: #3a3f52; cursor: not-allowed; }
input[aria-invalid="true"] { border-color: var(--ns-crimson); box-shadow: inset 3px 0 0 var(--ns-crimson); }
input:-webkit-autofill { -webkit-text-fill-color: var(--ns-ink); box-shadow: 0 0 0 100px var(--ns-input) inset; caret-color: var(--ns-amber); }

/* ---- status line: loading, success, error ---- */
.status { min-height: 1.6em; margin: .9rem 0 0; font-weight: 600; color: var(--ns-muted); }
.status.loading { color: var(--ns-amber); }
.status.ok  { color: var(--ns-gold); }
.status.err { color: var(--ns-crimson); }
.status.err::before { content: "ERR "; letter-spacing: .08em; }
.privacy { color: var(--ns-muted); font-size: .95rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- nav / footer links share the link treatment, quieter ---- */
nav a, .foot a { text-decoration-color: #5b5f70; }
nav a:hover, .foot a:hover { text-decoration-color: var(--ns-amber); }

@media (forced-colors: active) {
  .btn { border: 2px solid ButtonText; }
  .btn::before, .btn::after { display: none; }
}
