/* Skelsol spooky UI kit: the Vision visual style (ADR 0009).
 *
 * Palette: near-black background, maroon accent, white text. Dark
 * throughout: no orange, no white background sections. Shared by both
 * web apps, so they look like siblings by construction.
 *
 * Components: top bar, hero with giant display type, numbered
 * sections, vertical edge text, stats row, tables, forms, buttons.
 *
 * A fixed graveyard backdrop sits behind the whole page, so the
 * background never reads as flat black. Its detail lives at the
 * left and right edges; the middle stays near-black for text.
 *
 * Motion: a Halloween layer in the hero (floating art, drifting fog,
 * flickering glow, twinkling stars, bats) plus a soft glow pulse on
 * primary buttons. All motion uses transform/translate/opacity only,
 * so it stays cheap, and `prefers-reduced-motion` turns it off.
 */

:root {
  --skel-bg: #0a0a0a;
  --skel-bg-raised: #141414;
  --skel-accent: #7f1d1d;
  --skel-accent-bright: #b91c1c;
  --skel-text: #ffffff;
  --skel-muted: rgba(255, 255, 255, 0.6);
  --skel-faint: rgba(255, 255, 255, 0.14);
  --skel-line: rgba(255, 255, 255, 0.16);
  --skel-display-font: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --skel-body-font: "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--skel-bg);
  color: var(--skel-text);
  font-family: var(--skel-body-font);
  font-size: 15px;
  line-height: 1.5;
}

/* ---- Page background ----------------------------------------------
 * A fixed graveyard backdrop behind everything. The image itself is
 * composed with its detail (gnarled trees, tombstones) at the left
 * and right edges and near-black fog in the middle; the gradient
 * below deepens that middle, so white text stays readable anywhere
 * on the page. The layer is static (no motion to disable for
 * reduced-motion visitors) and sits behind all content via a
 * negative z-index, so it can never intercept clicks. The image
 * lives in each app's public/assets/ as page-bg.jpg; this shared
 * stylesheet references it with a path relative to dist/spooky.css,
 * where the build copies this file.
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      rgba(10, 10, 10, 0.25),
      rgba(10, 10, 10, 0.78) 30%,
      rgba(10, 10, 10, 0.78) 70%,
      rgba(10, 10, 10, 0.25)
    ),
    url("./assets/page-bg.jpg") center / cover no-repeat;
}

a {
  color: var(--skel-text);
}

/* ---- Top bar ---------------------------------------------------- */

.skel-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--skel-line);
  position: sticky;
  top: 0;
  background: var(--skel-bg);
  z-index: 10;
}

.skel-wordmark {
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: auto;
}

.skel-wordmark em {
  font-style: normal;
  color: var(--skel-accent-bright);
}

.skel-network-switch {
  display: flex;
  border: 1px solid var(--skel-line);
}

.skel-network-switch button {
  background: transparent;
  color: var(--skel-muted);
  border: 0;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.skel-network-switch button[aria-pressed="true"] {
  background: var(--skel-accent);
  color: var(--skel-text);
}

/* ---- Hero -------------------------------------------------------- */

.skel-hero {
  position: relative;
  overflow: hidden;
  padding: 4rem 2rem 3rem;
  border-bottom: 1px solid var(--skel-line);
}

.skel-hero-art {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  width: min(38vw, 420px);
  opacity: 0.9;
  pointer-events: none;
  /* Float and sway: the standalone translate/rotate properties
   * compose with the transform above, and keep working on mobile
   * where the transform is none. */
  animation: skel-float 7s ease-in-out infinite;
}

@keyframes skel-float {
  0%,
  100% {
    translate: 0 -6px;
    rotate: -1deg;
  }
  50% {
    translate: 0 8px;
    rotate: 1deg;
  }
}

/* Maroon glow behind the hero art (the art itself is inline SVG). */
.skel-hero-art .skel-glow {
  filter: drop-shadow(0 0 24px var(--skel-accent-bright))
    drop-shadow(0 0 64px var(--skel-accent));
  /* Candle-like flicker: irregular opacity steps, never a full blink. */
  animation: skel-flicker 5s linear infinite;
}

@keyframes skel-flicker {
  0%,
  100% {
    opacity: 1;
  }
  8% {
    opacity: 0.86;
  }
  10% {
    opacity: 0.97;
  }
  24% {
    opacity: 0.9;
  }
  26% {
    opacity: 1;
  }
  56% {
    opacity: 0.92;
  }
  58% {
    opacity: 0.99;
  }
  74% {
    opacity: 0.88;
  }
  76% {
    opacity: 0.97;
  }
}

/* The small stars in the hero art (the circles in the second <g>;
 * the ghost's face uses ellipses, so this never touches it). */
.skel-hero-art g:last-child circle {
  animation: skel-twinkle 3.5s ease-in-out infinite;
}

.skel-hero-art g:last-child circle:nth-of-type(2) {
  animation-delay: 1.1s;
}

.skel-hero-art g:last-child circle:nth-of-type(3) {
  animation-delay: 2.2s;
}

.skel-hero-art g:last-child circle:nth-of-type(4) {
  animation-delay: 0.6s;
}

@keyframes skel-twinkle {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

.skel-display {
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: clamp(3.5rem, 12vw, 10rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0;
  position: relative;
}

.skel-display .skel-display-accent {
  color: var(--skel-accent-bright);
  text-shadow: 0 0 28px rgba(185, 28, 28, 0.55);
}

.skel-hero-tagline {
  color: var(--skel-muted);
  max-width: 34rem;
  margin: 1.5rem 0 0;
  position: relative;
}

/* ---- Halloween motion: fog and bats --------------------------------
 * Decorative layers inside the hero (aria-hidden in the markup).
 * The hero already clips overflow, so nothing here can cause a
 * horizontal scrollbar. Two fog layers drift at different speeds
 * for depth; three bats cross on long, staggered flights, so the
 * sky is usually empty and a bat is a small surprise, not a swarm.
 */

.skel-fog {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -2rem;
  height: 14rem;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 48% 65% at 20% 60%,
      rgba(255, 255, 255, 0.12),
      transparent 70%
    ),
    radial-gradient(
      ellipse 42% 60% at 65% 70%,
      rgba(255, 255, 255, 0.09),
      transparent 70%
    ),
    radial-gradient(
      ellipse 36% 55% at 85% 60%,
      rgba(255, 255, 255, 0.1),
      transparent 70%
    );
  animation: skel-fog-drift 28s ease-in-out infinite alternate;
}

.skel-fog--back {
  bottom: 2rem;
  opacity: 0.75;
  animation-duration: 38s;
  animation-delay: -12s;
}

@keyframes skel-fog-drift {
  from {
    translate: -5% 0;
  }
  to {
    translate: 5% 0;
  }
}

.skel-bat {
  position: absolute;
  left: 0;
  opacity: 0.75;
  pointer-events: none;
  animation: skel-bat-fly 26s linear infinite;
}

.skel-bat--1 {
  top: 14%;
  animation-duration: 16s;
}

.skel-bat--2 {
  top: 26%;
  animation-duration: 22s;
  animation-delay: -8s;
}

.skel-bat--3 {
  top: 8%;
  animation-duration: 28s;
  animation-delay: -15s;
}

@keyframes skel-bat-fly {
  from {
    translate: -12vw 0;
  }
  25% {
    translate: 28vw -14px;
  }
  50% {
    translate: 55vw 10px;
  }
  75% {
    translate: 82vw -10px;
  }
  to {
    translate: 112vw 0;
  }
}

/* Wing flap on the inner SVG: the wrapper flies, the bat flaps. */
.skel-bat svg {
  display: block;
  transform-origin: center;
  animation: skel-bat-flap 0.7s ease-in-out infinite;
}

@keyframes skel-bat-flap {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0.55);
  }
}

/* ---- Numbered sections ------------------------------------------- */

.skel-section {
  padding: 3rem 2rem;
  border-bottom: 1px solid var(--skel-line);
  position: relative;
}

.skel-section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 2rem;
}

.skel-section-number {
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: 1rem;
  color: var(--skel-accent-bright);
}

.skel-section-label {
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Vertical edge text ------------------------------------------ */

.skel-vertical {
  position: absolute;
  right: 0.5rem;
  top: 3rem;
  writing-mode: vertical-rl;
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--skel-faint);
  pointer-events: none;
  user-select: none;
}

/* ---- Stats row ----------------------------------------------------- */

.skel-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0;
  border: 1px solid var(--skel-line);
}

.skel-stat {
  padding: 1.5rem;
  border-right: 1px solid var(--skel-line);
}

.skel-stat:last-child {
  border-right: 0;
}

.skel-stat-value {
  font-family: var(--skel-display-font);
  font-weight: 900;
  font-size: 2.25rem;
  line-height: 1;
  display: block;
}

.skel-stat-label {
  color: var(--skel-muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-top: 0.5rem;
}

/* ---- Tables -------------------------------------------------------- */

.skel-table {
  width: 100%;
  border-collapse: collapse;
}

.skel-table th,
.skel-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--skel-line);
}

.skel-table th {
  color: var(--skel-muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.skel-table td:first-child,
.skel-table th:first-child {
  padding-left: 0;
}

.skel-mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

/* ---- Forms and buttons --------------------------------------------- */

.skel-input {
  background: var(--skel-bg-raised);
  color: var(--skel-text);
  border: 1px solid var(--skel-line);
  padding: 0.7rem 1rem;
  font: inherit;
  width: 100%;
  max-width: 32rem;
}

.skel-input::placeholder {
  color: var(--skel-muted);
}

.skel-input:focus {
  outline: 1px solid var(--skel-accent-bright);
  border-color: var(--skel-accent-bright);
}

.skel-btn {
  background: var(--skel-accent);
  color: var(--skel-text);
  border: 1px solid var(--skel-accent);
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.skel-btn:hover:not(:disabled) {
  background: var(--skel-accent-bright);
  border-color: var(--skel-accent-bright);
}

.skel-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Soft glow pulse on primary buttons (not the ghost variant):
 * one shared heartbeat, so several buttons breathe in sync. */
.skel-btn:not(.skel-btn-ghost):not(:disabled) {
  animation: skel-btn-glow 4.5s ease-in-out infinite;
}

@keyframes skel-btn-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(185, 28, 28, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.45);
  }
}

.skel-btn-ghost {
  background: transparent;
  border-color: var(--skel-line);
}

.skel-btn-ghost:hover:not(:disabled) {
  background: var(--skel-bg-raised);
  border-color: var(--skel-line);
}

.skel-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ---- Notes, status, activity --------------------------------------- */

.skel-note {
  color: var(--skel-muted);
  font-size: 0.9rem;
}

.skel-status {
  border: 1px solid var(--skel-line);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  background: var(--skel-bg-raised);
}

.skel-status:empty {
  display: none;
}

.skel-activity {
  list-style: none;
  margin: 0;
  padding: 0;
}

.skel-activity li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--skel-line);
}

.skel-activity time {
  color: var(--skel-muted);
  font-size: 0.85rem;
}

.skel-empty {
  color: var(--skel-muted);
  padding: 1rem 0;
}

.skel-footer {
  padding: 2rem;
  color: var(--skel-muted);
  font-size: 0.85rem;
}

/* ---- Graveyard scene -------------------------------------------------
 * Full-width illustration closing the page (Ghost Mint only, for now):
 * skeletons dancing around a jack-o'-lantern. The picture melts into
 * the dark page three ways: the mask fades all four edges, a vignette
 * overlay darkens the corners, and the whole image is dimmed a touch,
 * so no hard rectangle is visible. A very slow zoom keeps it alive;
 * transform-only, so it stays cheap. */
.skel-graveyard {
  margin: 0;
  overflow: hidden;
  position: relative;
}

/* Dark vignette over the picture: transparent in the middle, page
 * background at the edges, so the illustration dissolves into the dark. */
.skel-graveyard::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 90% 90% at 50% 50%,
      transparent 55%,
      rgba(10, 10, 10, 0.85) 100%
    ),
    linear-gradient(
      to bottom,
      var(--skel-bg),
      transparent 25%,
      transparent 75%,
      var(--skel-bg)
    );
}

.skel-graveyard-art {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0.82) saturate(0.9);
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent,
      black 20%,
      black 80%,
      transparent
    ),
    linear-gradient(
      to right,
      transparent,
      black 12%,
      black 88%,
      transparent
    );
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(
      to bottom,
      transparent,
      black 20%,
      black 80%,
      transparent
    ),
    linear-gradient(
      to right,
      transparent,
      black 12%,
      black 88%,
      transparent
    );
  mask-composite: intersect;
  animation: skel-graveyard-zoom 45s ease-in-out infinite alternate;
}

@keyframes skel-graveyard-zoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

@media (max-width: 640px) {
  .skel-hero-art {
    position: static;
    transform: none;
    width: 12rem;
    margin-bottom: 1rem;
  }

  .skel-topbar,
  .skel-hero,
  .skel-section,
  .skel-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* The top bar holds four items now (wordmark, network switch,
   * wallet, sound); let them wrap instead of overflowing. */
  .skel-topbar {
    flex-wrap: wrap;
  }

  .skel-graveyard-art {
    height: 12rem;
    object-fit: cover;
    object-position: center 60%;
  }

  .skel-vertical {
    display: none;
  }
}

/* ---- Reduced motion --------------------------------------------------
 * No animation at all for people who prefer it; the fog and bats
 * (pure decoration) disappear instead of freezing mid-flight. */
@media (prefers-reduced-motion: reduce) {
  .skel-hero-art,
  .skel-hero-art .skel-glow,
  .skel-hero-art g:last-child circle,
  .skel-btn,
  .skel-graveyard-art {
    animation: none;
  }

  .skel-fog,
  .skel-bat {
    display: none;
  }
}
