/* Necrolink — Costume-grade haunted UI.
 * Near-black bg, phosphor green (#39ff14) + candle orange (#ff7518) accents.
 * Body/secondary text colours are chosen to keep WCAG AA contrast on the dark
 * background. No external fonts/CDNs — system stack only. */

:root {
  --bg: #07090a;
  --bg-2: #0c100d;
  --panel: #0e1310;
  --panel-2: #11181100;
  --stone: #161a16;
  --stone-edge: #2a3329;

  /* Text — all chosen for AA contrast on --bg */
  --ink: #e8f3e3;      /* primary body text  ~15:1 */
  --ink-dim: #9fb89a;  /* secondary text     ~6.4:1 */
  --ink-faint: #6f8a6b; /* meta / hints, large-ish ~4.6:1 on bg, ok for small via weight */

  --green: #39ff14;    /* phosphor — headings, accents, large */
  --green-soft: #7dff5c;
  --orange: #ff7518;   /* candle — warnings, dead/moved */
  --amber: #ffb347;    /* moved */
  --gray: #8a958a;     /* blocked / unknown */

  --shadow: 0 0 0 1px rgba(57, 255, 20, 0.18), 0 10px 30px rgba(0, 0, 0, 0.6);
  --glow-green: 0 0 14px rgba(57, 255, 20, 0.35);
  --glow-orange: 0 0 14px rgba(255, 117, 24, 0.35);

  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #0e1410 0%, rgba(0,0,0,0) 60%),
    radial-gradient(900px 500px at 100% 100%, #100a0a 0%, rgba(0,0,0,0) 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Drifting fog layers ---------------------------------------------------- */
.fog {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.fog::before, .fog::after {
  content: "";
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -20%;
  height: 70%;
  background:
    radial-gradient(60% 60% at 20% 60%, rgba(159,184,154,0.06), rgba(0,0,0,0) 70%),
    radial-gradient(50% 50% at 70% 70%, rgba(57,255,20,0.05), rgba(0,0,0,0) 70%);
  filter: blur(20px);
  animation: drift 38s linear infinite;
}
.fog::after {
  bottom: -30%;
  height: 90%;
  opacity: 0.7;
  animation-duration: 54s;
  animation-direction: reverse;
}
@keyframes drift {
  0%   { transform: translateX(-12%); }
  100% { transform: translateX(12%); }
}

/* Layout ------------------------------------------------------------------ */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 96px;
}

header.hero { padding: 56px 0 24px; text-align: center; }
header.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  color: var(--green);
  text-shadow: var(--glow-green);
  font-weight: 800;
}
header.hero .tag {
  color: var(--ink-dim);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0 auto;
}
header.hero .tag b { color: var(--orange); font-weight: 600; }

section { margin-top: 44px; }
h2 {
  font-size: 1.3rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 14px;
  border-bottom: 1px solid var(--stone-edge);
  padding-bottom: 8px;
}

/* Séance box -------------------------------------------------------------- */
.seance {
  background: linear-gradient(180deg, var(--panel), rgba(14,19,16,0));
  border: 1px solid var(--stone-edge);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.seance form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.seance input[type="url"], .seance input[type="text"] {
  flex: 1 1 320px;
  min-width: 0;
  padding: 12px 14px;
  background: #0a0d0a;
  color: var(--ink);
  border: 1px solid var(--stone-edge);
  border-radius: 10px;
  font: inherit;
}
.seance input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--glow-green);
}
.seance input::placeholder { color: var(--ink-faint); }

button {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:active { transform: translateY(1px); }

.btn-raise {  /* primary: Resurrect */
  background: var(--green);
  color: #04140a;
  box-shadow: var(--glow-green);
}
.btn-raise:hover { background: var(--green-soft); }

.btn-grave {  /* secondary: Visit grave */
  background: transparent;
  color: var(--orange);
  border-color: var(--orange);
}
.btn-grave:hover { background: rgba(255,117,24,0.12); box-shadow: var(--glow-orange); }

.btn-ghost { background: transparent; color: var(--ink-dim); border-color: var(--stone-edge); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-dim); }

.seance .hint { color: var(--ink-faint); font-size: 0.9rem; margin-top: 10px; }

/* Tombstone card ---------------------------------------------------------- */
.tombstone {
  position: relative;
  margin-top: 18px;
  background: linear-gradient(180deg, #1c221c 0%, #0f140f 100%);
  border: 1px solid var(--stone-edge);
  /* Arched top = tombstone silhouette */
  border-radius: 46% 46% 12px 12px / 120px 120px 12px 12px;
  padding: 30px 26px 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tombstone::before {  /* engraved divider under RIP */
  content: "";
  position: absolute;
  top: 78px; left: 22px; right: 22px;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,0,0,0), var(--stone-edge), rgba(0,0,0,0));
}
.tombstone .rip {
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.3em;
  color: var(--green);
  font-size: 1.25rem;
  text-shadow: var(--glow-green);
  margin-bottom: 4px;
}
.tombstone .dates {
  text-align: center;
  color: var(--ink);
  font-size: 1.02rem;
  margin: 6px 0 4px;
}
.tombstone .dates .sep { color: var(--orange); margin: 0 8px; }
.tombstone .url {
  text-align: center;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  margin: 8px 0 16px;
}
.tombstone .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.tombstone.pending { text-align: center; color: var(--ink-dim); padding: 40px 20px; }
.tombstone.pending .pulse { color: var(--green); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

.tombstone.error { border-color: var(--orange); }
.tombstone.error .rip { color: var(--orange); text-shadow: var(--glow-orange); }

/* Graveyard --------------------------------------------------------------- */
.cohorts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 640px) { .cohorts { grid-template-columns: 1fr; } }

.cohort {
  position: relative;
  background: linear-gradient(180deg, #1c221c 0%, #0f140f 100%);
  border: 1px solid var(--stone-edge);
  border-radius: 40% 40% 10px 10px / 90px 90px 10px 10px;
  padding: 26px 20px 18px;
  box-shadow: var(--shadow);
}
.cohort h3 {
  margin: 0 0 4px;
  text-align: center;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  color: var(--green);
  font-size: 1.05rem;
}
.cohort .sub { text-align: center; color: var(--ink-faint); font-size: 0.82rem; margin-bottom: 14px; }
.cohort .total { text-align: center; font-size: 2rem; font-weight: 800; color: var(--ink); }
.cohort .total small { color: var(--ink-dim); font-size: 0.8rem; font-weight: 400; }

.bars { margin-top: 14px; display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.bar .lbl { color: var(--ink-dim); font-size: 0.86rem; }
.bar .val { color: var(--ink); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.bar .track {
  grid-column: 1 / -1;
  height: 9px;
  background: #0a0d0a;
  border: 1px solid var(--stone-edge);
  border-radius: 999px;
  overflow: hidden;
}
.bar .fill { height: 100%; border-radius: 999px; }
.fill.alive { background: var(--green); box-shadow: 0 0 8px rgba(57,255,20,0.45); }
.fill.dead { background: var(--orange); box-shadow: 0 0 8px rgba(255,117,24,0.45); }
.fill.moved { background: var(--amber); }
.fill.blocked { background: var(--gray); }
.fill.resurrected { background: linear-gradient(90deg, var(--green), var(--green-soft)); }

.claim {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--stone-edge);
  border-radius: 10px;
  background: rgba(57,255,20,0.04);
  color: var(--ink);
  font-size: 0.96rem;
}
.claim b { color: var(--green); }

/* Searchable list --------------------------------------------------------- */
.search { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search input {
  flex: 1 1 260px;
  min-width: 0;
  padding: 10px 12px;
  background: #0a0d0a;
  color: var(--ink);
  border: 1px solid var(--stone-edge);
  border-radius: 10px;
  font: inherit;
}
.search input:focus { outline: none; border-color: var(--green); box-shadow: var(--glow-green); }
.search .count { color: var(--ink-faint); font-size: 0.86rem; }

.list { margin-top: 12px; display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  background: #0b0f0b;
  border: 1px solid var(--stone-edge);
  border-radius: 9px;
}
.row .url {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  min-width: 0;
}
.row a.resurrect { color: var(--green); text-decoration: none; font-weight: 600; white-space: nowrap; }
.row a.resurrect:hover { text-shadow: var(--glow-green); }

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.dead { color: var(--orange); }
.badge.moved { color: var(--amber); }
.badge.blocked { color: var(--gray); }
.badge.alive { color: var(--green); }

.missing { color: var(--ink-faint); font-style: italic; padding: 12px; }

footer { margin-top: 60px; color: var(--ink-faint); font-size: 0.82rem; text-align: center; }
footer a { color: var(--ink-dim); }

/* Accessible focus ring for keyboard users */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Respect reduced motion: kill fog drift + pulse ------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .fog::before, .fog::after { animation: none !important; }
  .tombstone.pending .pulse { animation: none !important; opacity: 1; }
}

/* Visually hidden, available to screen readers */
.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
