/*
  Bloodstone — Realm Observatory
  Palette: warm forge-dark base, brass instrumentation, bloodstone-red for
  dormant/alert, rune-teal for the living glow of an online realm.
*/
:root {
  --void: #15120e;
  --panel: #211c16;
  --panel-raised: #2a241c;
  --brass: #c39355;
  --brass-dim: #7a6142;
  --bloodstone: #9c2f3e;
  --bloodstone-bright: #c8465a;
  --rune: #5fd0c0;
  --rune-bright: #86e6d8;
  --parchment: #ede1c8;
  --ash: #8d8371;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(156, 47, 62, 0.14), transparent 60%),
    radial-gradient(ellipse 900px 600px at 100% 0%, rgba(95, 208, 192, 0.08), transparent 55%);
  color: var(--parchment);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  position: relative;
}

/* faint hammered-metal grain across the whole page */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(237, 225, 200, 0.05) 1px, transparent 1px);
  background-size: 3px 3px;
}

header.hall,
main,
footer.hall {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- header ---------- */

header.hall {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding-top: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--brass-dim);
}

.crest {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 7px rgba(156, 47, 62, 0.55));
  animation: crest-breathe 6s ease-in-out infinite;
}

@keyframes crest-breathe {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(156, 47, 62, 0.5)); }
  50% { filter: drop-shadow(0 0 11px rgba(156, 47, 62, 0.85)); }
}

@media (prefers-reduced-motion: reduce) {
  .crest {
    animation: none;
  }
}

.hall-text h1 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

.tagline {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}

.ambient {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--ash);
  text-align: right;
  margin: 0;
  white-space: nowrap;
}

/* ---------- wards grid ---------- */

main {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  min-height: 40vh;
}

.wards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--brass-dim);
  border-radius: 4px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ash);
}

.empty strong {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  color: var(--parchment);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* ---------- ward card ---------- */

.ward {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--brass-dim);
  border-radius: 3px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: inset 0 1px 0 rgba(237, 225, 200, 0.04), 0 8px 20px -12px rgba(0, 0, 0, 0.6);
}

.ward::before,
.ward::after,
.ward .rivet-tl,
.ward .rivet-br {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass-dim);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
}

.ward::before { top: 7px; left: 7px; }
.ward::after { top: 7px; right: 7px; }
.ward .rivet-tl { bottom: 7px; left: 7px; }
.ward .rivet-br { bottom: 7px; right: 7px; }

.ward.is-online {
  border-color: color-mix(in srgb, var(--rune) 35%, var(--brass-dim));
}

.ward-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 0.6rem;
}

.sigil {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  overflow: visible;
}

.sigil-ring {
  fill: none;
  stroke-width: 1.4;
}

.sigil-tick {
  stroke-width: 1.4;
}

.sigil-core {
  fill: none;
  stroke-width: 1.4;
}

.sigil.is-online .sigil-ring,
.sigil.is-online .sigil-tick {
  stroke: var(--rune);
  opacity: 0.75;
}

.sigil.is-online .sigil-core {
  stroke: var(--rune-bright);
  filter: drop-shadow(0 0 3px rgba(95, 208, 192, 0.65));
}

.sigil.is-online .sigil-ticks {
  transform-origin: 32px 32px;
  animation: sigil-turn 50s linear infinite;
}

.sigil.is-offline .sigil-ring,
.sigil.is-offline .sigil-tick {
  stroke: var(--ash);
  opacity: 0.3;
}

.sigil.is-offline .sigil-core {
  stroke: var(--ash);
  opacity: 0.35;
}

.sigil-crack {
  stroke: var(--bloodstone-bright);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  opacity: 0.9;
}

@keyframes sigil-turn {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sigil.is-online .sigil-ticks {
    animation: none;
  }
}

.ward-title {
  min-width: 0;
}

.ward-name {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ward.is-online .status { color: var(--rune-bright); }
.ward.is-online .status-dot { background: var(--rune-bright); box-shadow: 0 0 5px var(--rune-bright); }
.ward.is-offline .status { color: var(--bloodstone-bright); }
.ward.is-offline .status-dot { background: var(--bloodstone-bright); }

.motd-title {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--parchment);
  margin: 0 0 0.15rem;
}

.motd-description {
  font-size: 0.85rem;
  color: var(--ash);
  margin: 0 0 0.85rem;
}

.error {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--bloodstone-bright);
  opacity: 0.85;
  margin: 0.15rem 0 0.85rem;
}

.stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
}

.stat-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--parchment);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.roster {
  font-size: 0.82rem;
  color: var(--ash);
  margin: 0 0 0.7rem;
}

.roster b {
  color: var(--parchment);
  font-weight: 500;
}

.ward-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--brass-dim);
  border-top: 1px solid rgba(195, 147, 85, 0.18);
  padding-top: 0.55rem;
  margin-top: 0.4rem;
}

/* ---------- footer ---------- */

footer.hall {
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--brass-dim);
}

footer.hall p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ash);
  max-width: 46ch;
}

footer.hall code {
  font-family: "IBM Plex Mono", monospace;
  color: var(--brass);
}

/* ---------- small screens ---------- */

@media (max-width: 520px) {
  header.hall {
    grid-template-columns: auto 1fr;
    row-gap: 0.4rem;
  }
  .ambient {
    grid-column: 1 / -1;
    text-align: left;
  }
}

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