/* ==========================================================================
   MysticCraft — the Codex
   Palette and type are deliberate: myth speaks in carved stone (Cinzel),
   lore speaks in an old book (EB Garamond), mechanics speak in a terminal
   (JetBrains Mono). Keeping those three voices separate is the whole idea.
   ========================================================================== */

:root {
  --ink:        #0B0A0F;  /* violet-undertone black, not neutral */
  --ink-raised: #131118;
  --ink-edge:   #1F1B26;
  --blood:      #7A0E1E;  /* deep oxblood */
  --blood-lit:  #A81A2C;
  --bone:       #C9C4B4;  /* moonlight */
  --bone-dim:   #8A8578;
  --brass:      #B08D3F;  /* the Originals */
  --verdigris:  #2E4B45;  /* witch green */
  --parchment:  #E8E1D3;

  --display: 'Cinzel', Georgia, serif;
  --body:    'EB Garamond', Georgia, serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* Full moon nights recolor the site. Driven by app.js. */
:root.full-moon {
  --blood: #8B1522;
  --brass: #D8BA6A;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* A faint vertical grain, like paper held to a light. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
}

a { color: var(--bone); text-decoration-color: rgba(176,141,63,0.5); text-underline-offset: 0.2em; }
a:hover { color: var(--parchment); text-decoration-color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--parchment);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; }

.wrap { width: min(1200px, 100% - calc(var(--gutter) * 2)); margin-inline: auto; position: relative; z-index: 1; }
.narrow { width: min(var(--measure) + 8rem, 100% - calc(var(--gutter) * 2)); margin-inline: auto; }

section { padding-block: clamp(3rem, 8vw, 6rem); }

/* Eyebrow labels encode WHAT KIND of text follows: myth, mechanic, or notice. */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.eyebrow::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--ink-edge), transparent); }
.eyebrow.myth { color: var(--brass); }
.eyebrow.blood { color: var(--blood-lit); }

/* ============================ NAV ============================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,10,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-edge);
}
.nav-inner { display: flex; align-items: center; gap: 2rem; padding-block: 1rem; }
.brand {
  font-family: var(--display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--parchment); text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--blood-lit); }
.nav-links { display: flex; gap: 1.5rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; text-decoration: none; color: var(--bone-dim);
  padding-block: 0.35rem; border-bottom: 1px solid transparent; transition: 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--parchment); border-bottom-color: var(--blood); }
.nav-toggle { display: none; background: none; border: 1px solid var(--ink-edge); color: var(--bone); padding: 0.5rem 0.75rem; font-family: var(--mono); font-size: 0.7rem; cursor: pointer; margin-left: auto; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; gap: 0; margin: 0; }
  .nav-links.open { display: flex; padding-bottom: 1rem; }
  .nav-links a { padding: 0.6rem 0; border-bottom: 1px solid var(--ink-edge); }
  .nav-inner { flex-wrap: wrap; }
}

/* ============================ HERO ============================ */
.hero { position: relative; min-height: 88vh; display: grid; place-items: center; overflow: hidden; text-align: center; }
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(122,14,30,0.16), transparent 60%);
  pointer-events: none;
}
.moon {
  width: clamp(180px, 32vw, 340px); aspect-ratio: 1; border-radius: 50%;
  margin: 0 auto 2.5rem; position: relative;
  background: radial-gradient(circle at 36% 32%, #F2EDE0, #B9B3A2 55%, #6F6A5E);
  box-shadow: 0 0 90px rgba(201,196,180,0.14), inset -18px -12px 44px rgba(0,0,0,0.55);
}
/* The shadow that makes the phase. Offset is set inline by app.js. */
.moon-shadow {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--ink);
  transition: transform 1.2s ease;
}
.hero h1 { margin-bottom: 0.25em; }
.hero .tagline {
  font-family: var(--body); font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  color: var(--bone-dim); max-width: 46ch; margin: 0 auto 2.5rem;
}
.moon-status {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--bone-dim); margin-bottom: 1.5rem;
}
.moon-status strong { color: var(--brass); font-weight: 500; }
:root.full-moon .moon-status strong { color: var(--blood-lit); }

/* ======================= SERVER ADDRESS ======================= */
.ip-block { display: inline-flex; align-items: stretch; border: 1px solid var(--ink-edge); background: var(--ink-raised); }
.ip-block code {
  font-family: var(--mono); font-size: clamp(0.9rem, 2vw, 1.1rem);
  padding: 0.9rem 1.4rem; color: var(--parchment); letter-spacing: 0.05em;
}
.ip-copy {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--blood); color: var(--parchment); border: none;
  padding-inline: 1.25rem; cursor: pointer; transition: 0.2s;
}
.ip-copy:hover { background: var(--blood-lit); }
.ip-copy.copied { background: var(--verdigris); }

.status-line {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.1em;
  color: var(--bone-dim); margin-top: 1rem;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bone-dim); margin-right: 0.5rem; vertical-align: middle; }
.dot.online { background: #4E9A5F; box-shadow: 0 0 8px rgba(78,154,95,0.8); }
.dot.offline { background: var(--blood-lit); }

/* ============================ BUTTONS ============================ */
.btn {
  display: inline-block; font-family: var(--mono); font-size: 0.75rem;
  letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  padding: 0.9rem 1.8rem; border: 1px solid var(--blood); color: var(--parchment);
  background: transparent; cursor: pointer; transition: 0.2s;
}
.btn:hover { background: var(--blood); color: var(--parchment); }
.btn.solid { background: var(--blood); }
.btn.solid:hover { background: var(--blood-lit); }
.btn.ghost { border-color: var(--ink-edge); color: var(--bone-dim); }
.btn.ghost:hover { border-color: var(--brass); color: var(--parchment); background: transparent; }
.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: 2rem; }

/* ============================ CARDS ============================ */
.grid { display: grid; gap: 1.5rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

.card {
  background: var(--ink-raised); border: 1px solid var(--ink-edge);
  padding: 1.75rem; position: relative; transition: 0.25s;
}
.card:hover { border-color: rgba(176,141,63,0.4); transform: translateY(-2px); }
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--bone-dim); font-size: 1rem; margin: 0; }
.card .kicker {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--bone-dim); display: block; margin-bottom: 0.75rem;
}

/* Race cards get their own edge colour — the races are the spine of the game. */
.card.vampire { border-left: 2px solid var(--blood); }
.card.werewolf { border-left: 2px solid var(--brass); }
.card.witch { border-left: 2px solid #6B4A87; }
.card.human { border-left: 2px solid var(--bone-dim); }
.card.vampire h3 { color: #D4788A; }
.card.werewolf h3 { color: var(--brass); }
.card.witch h3 { color: #B08FD0; }
.card.human h3 { color: var(--parchment); }

/* ======================= THE CODEX (signature) ======================= */
/* Sealed entries mirror the in-game codex: you can see that something
   exists without being able to read it. */
.codex { display: grid; gap: 1px; background: var(--ink-edge); border: 1px solid var(--ink-edge); }
.codex-entry { background: var(--ink-raised); padding: 1.5rem 1.75rem; display: flex; gap: 1.5rem; align-items: baseline; }
.codex-entry .num { font-family: var(--mono); font-size: 0.7rem; color: var(--bone-dim); min-width: 2.5rem; }
.codex-entry .title { font-family: var(--display); font-size: 1.05rem; color: var(--parchment); letter-spacing: 0.03em; }
.codex-entry .how { font-family: var(--mono); font-size: 0.7rem; color: var(--bone-dim); margin-left: auto; text-align: right; letter-spacing: 0.08em; }
.codex-entry.sealed { background: repeating-linear-gradient(45deg, #101016 0 8px, #0E0D13 8px 16px); }
.codex-entry.sealed .title { color: #4A4654; font-family: var(--mono); letter-spacing: 0.3em; }
.codex-entry.sealed .how { color: #3B3845; }

/* ============================ LORE PROSE ============================ */
.lore-body { max-width: var(--measure); }
.lore-body p { margin-block: 1.2em; }
.lore-body p:first-of-type::first-letter {
  font-family: var(--display); font-size: 3.4em; float: left;
  line-height: 0.82; padding-right: 0.1em; color: var(--blood-lit);
}
blockquote {
  border-left: 2px solid var(--blood); margin: 2rem 0; padding: 0.5rem 0 0.5rem 1.5rem;
  font-style: italic; color: var(--bone-dim);
}

/* ============================ TABLES ============================ */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-block: 1.5rem; }
th, td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--ink-edge); }
th { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim); font-weight: 400; }
td { color: var(--bone); }
tbody tr:hover { background: var(--ink-raised); }

/* ============================ STORE ============================ */
.price { font-family: var(--mono); font-size: 1.6rem; color: var(--brass); display: block; margin: 0.5rem 0 1rem; }
.rank-card { text-align: center; }
.rank-card ul { list-style: none; padding: 0; margin: 1.5rem 0; text-align: left; font-size: 0.95rem; }
.rank-card li { padding: 0.4rem 0; border-bottom: 1px solid var(--ink-edge); color: var(--bone-dim); }
.rank-card li::before { content: '—'; color: var(--brass); margin-right: 0.6rem; }
.featured { border-color: var(--brass); }
.featured::before {
  content: 'MOST CHOSEN'; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  background: var(--brass); color: var(--ink); font-family: var(--mono);
  font-size: 0.6rem; letter-spacing: 0.16em; padding: 0.25rem 0.9rem;
}

/* ============================ STAFF ============================ */
.staff-card { text-align: center; }
.avatar { width: 80px; height: 80px; image-rendering: pixelated; border: 1px solid var(--ink-edge); margin-bottom: 1rem; }
.role { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; }
.role.owner { color: var(--blood-lit); }
.role.admin { color: var(--brass); }
.role.mod { color: #B08FD0; }
.role.helper { color: var(--bone-dim); }

/* ============================ NOTICES ============================ */
.notice {
  border: 1px solid var(--ink-edge); border-left: 2px solid var(--brass);
  background: var(--ink-raised); padding: 1.25rem 1.5rem; margin-block: 2rem;
  font-size: 0.98rem; color: var(--bone-dim);
}
.notice strong { color: var(--parchment); }

/* ============================ FOOTER ============================ */
footer { border-top: 1px solid var(--ink-edge); padding-block: 3rem; margin-top: 4rem; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
footer h4 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bone-dim); }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin-bottom: 0.5rem; }
footer a { font-size: 0.95rem; text-decoration: none; color: var(--bone-dim); }
footer a:hover { color: var(--parchment); }
.colophon { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--ink-edge); font-family: var(--mono); font-size: 0.68rem; color: #46424F; letter-spacing: 0.06em; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s, transform 0.7s; }
.reveal.seen { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
