:root {
  --bg: #0b0a08;
  --panel: #14120e;
  --panel-2: #1b1813;
  --line: #3a3224;
  --line-soft: #26211a;
  --gold: #c9a45c;
  --gold-bright: #e8c780;
  --gold-dim: #8c7340;
  --text: #d9d1c1;
  --muted: #8b8272;
  --red: #a3262a;
  --amber: #c98a2e;
  --green: #5c8a4a;

  --ama: #b9a26a;
  --asn: #9a7fb5;
  --bar: #b5694a;
  --dru: #6f9a5a;
  --nec: #7fa6a0;
  --pal: #d6c27e;
  --sor: #6f8fc9;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, #1a150e 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 17px/1.55 "Spectral", Georgia, serif;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

h2, h3, th, .label, dt, .rank, .tier-ends {
  font-family: "Cinzel", "Trajan Pro", serif;
  letter-spacing: 0.06em;
}

/* Hero */
/* Sized to the artwork's own proportions so the full scene shows at every width and zoom level.
   Everything inside scales with the viewport width, so phone and desktop look the same. */
.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 7992 / 4872;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  z-index: -3;
  animation: kenburns 32s ease-in-out infinite alternate, fade-in 2.2s ease-out both;
}
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 70% 55% at 50% 48%, rgba(8, 6, 4, 0.72) 0%, rgba(8, 6, 4, 0.25) 70%, transparent 100%),
    linear-gradient(180deg, rgba(8, 6, 4, 0.55) 0%, transparent 25%, transparent 60%, var(--bg) 100%);
}
.embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.hero-content { text-align: center; padding: 0 16px; }
.hero-crest {
  width: max(30px, 5vw);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(255, 120, 30, 0.45));
  animation: rise 1.2s 0.3s ease-out both;
}
.hero-title {
  margin: 1vw 0 0;
  font-family: "Metamorphous", "Cinzel", serif;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: 0.04em;
}
.t-line {
  display: block;
  background: linear-gradient(180deg, #fff1c9 0%, #e8c780 35%, #b8862f 65%, #6e4a17 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #1a0f05) drop-shadow(0 0 22px rgba(255, 110, 20, 0.35));
  animation: title-in 1.6s 0.5s cubic-bezier(.2, .7, .2, 1) both, flicker 5s 2.2s infinite;
}
.t-line:first-child { font-size: 3vw; letter-spacing: 0.3em; margin-right: -0.3em; }
.t-big { font-size: 10vw; animation-delay: 0.8s, 2.5s; }
.hero-sub {
  margin: 1.4vw 0 0;
  font-family: "Cinzel", serif;
  font-size: max(9px, 1.2vw);
  letter-spacing: 0.4em;
  margin-right: -0.4em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 1px 6px #000;
  animation: rise 1.2s 1.5s ease-out both;
}
.hero-sub::before, .hero-sub::after {
  content: "";
  display: inline-block;
  width: 4vw;
  height: 1px;
  margin: 0 1vw;
  vertical-align: middle;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.hero-sub::after { background: linear-gradient(90deg, var(--gold), transparent); }
.hero-est {
  margin: 0.7vw 0 0;
  font-family: "Cinzel", serif;
  font-size: max(8px, 1vw);
  letter-spacing: 0.25em;
  margin-right: -0.25em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 6px #000;
  animation: rise 1.2s 1.8s ease-out both;
}

.scroll-cue {
  position: absolute;
  bottom: 2vw;
  left: 50%;
  width: 28px;
  height: 44px;
  margin-left: -14px;
  border: 1px solid var(--gold-dim);
  border-radius: 14px;
  animation: rise 1s 2.2s ease-out both;
}
.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--gold);
  animation: scroll-dot 1.8s ease-in-out infinite;
}

@keyframes kenburns {
  from { transform: scale(1.04) translate(0, 0); }
  to   { transform: scale(1.14) translate(-2%, -1.5%); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes title-in {
  from { opacity: 0; letter-spacing: 0.5em; filter: blur(8px); }
  to   { opacity: 1; }
}
@keyframes flicker {
  0%, 100% { filter: drop-shadow(0 2px 0 #1a0f05) drop-shadow(0 0 22px rgba(255, 110, 20, 0.35)); }
  45%      { filter: drop-shadow(0 2px 0 #1a0f05) drop-shadow(0 0 30px rgba(255, 130, 30, 0.55)); }
  50%      { filter: drop-shadow(0 2px 0 #1a0f05) drop-shadow(0 0 16px rgba(255, 90, 10, 0.3)); }
  55%      { filter: drop-shadow(0 2px 0 #1a0f05) drop-shadow(0 0 26px rgba(255, 120, 25, 0.5)); }
}
@keyframes scroll-dot {
  0%   { opacity: 0; transform: translateY(0); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(16px); }
}

/* Sticky nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 10, 8, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topnav .wrap { display: flex; align-items: center; gap: 2px; overflow-x: auto; }
.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-family: "Cinzel", serif;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  text-transform: uppercase;
  padding: 14px 12px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.topnav a:hover, .topnav a.active { color: var(--gold-bright); border-bottom-color: var(--gold-dim); }
.topnav .nav-brand {
  font-family: "Metamorphous", serif;
  font-weight: 400;
  font-size: 1rem;
  color: var(--gold);
  margin-right: auto;
  padding-left: 0;
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Framed art */
.framed {
  margin: 0;
  border: 1px solid var(--gold-dim);
  padding: 6px;
  background: #0a0907;
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px var(--line), 0 10px 30px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.framed img { display: block; width: 100%; height: auto; transition: transform 6s ease; }
.framed:hover img { transform: scale(1.05); }
.framed figcaption {
  padding: 10px 4px 4px;
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.recruit { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.recruit-art { margin-top: 28px; }
.archives .framed { max-width: 495px; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Panels */
main { padding-top: 28px; padding-bottom: 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--line-soft);
  padding: 24px;
  scroll-margin-top: 64px;
}
h2 {
  margin: 0 0 20px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold);
  text-transform: uppercase;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
h3 {
  margin: 28px 0 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gold-dim);
  text-transform: uppercase;
}
.muted { color: var(--muted); }

/* Refreshed banner */
.refreshed {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 26px 16px;
  border: 1px solid var(--gold-dim);
  background:
    linear-gradient(180deg, rgba(201, 164, 92, 0.08), rgba(201, 164, 92, 0.02)),
    var(--panel);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--line);
}
.refreshed-label {
  font-family: "Cinzel", serif;
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.refreshed-date {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: clamp(1.3rem, 5.5vw, 2.8rem);
  line-height: 1.15;
  color: var(--gold-bright);
  text-wrap: balance;
}
.refreshed-meta { color: var(--muted); font-size: 0.95rem; }
.refreshed-age {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
}
.age-clock {
  font-family: "Spectral", serif;
  font-weight: 500;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.04em;
}
.age-label { color: var(--muted); font-size: 0.9rem; }
.refreshed.stale .refreshed-date,
.refreshed.stale .age-clock { color: var(--amber); }

/* Coffers */
.coffers { display: grid; gap: 22px; }
.gold-main { display: flex; flex-direction: column; }
.label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.gold-value {
  font-family: "Cinzel", serif;
  font-size: clamp(2rem, 7vw, 3rem);
  color: var(--gold-bright);
  line-height: 1.15;
}
.tier-ends { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--gold); }
.tier-ends.muted { color: var(--muted); font-family: "Spectral", serif; letter-spacing: 0; font-size: 0.9rem; }
.bar {
  height: 14px;
  margin: 6px 0;
  background: #0a0907;
  border: 1px solid var(--line);
  padding: 2px;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7a5f2c, var(--gold) 70%, var(--gold-bright));
  transition: width 0.8s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.stats > div { background: var(--panel-2); padding: 12px 14px; }
dt { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }
dd { margin: 2px 0 0; font-size: 1.2rem; color: var(--text); }
.stats.compact { margin-bottom: 18px; }

/* Roster */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; }
.rank { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.rank-gm { color: var(--gold); }
.rank-officer { color: var(--text); }
.name { color: var(--text); font-weight: 500; }
.gm-row .name { color: var(--gold-bright); }
.gm-mark { color: var(--gold); margin-right: 6px; }
.cls { white-space: nowrap; }
.cls-dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 8px;
  transform: rotate(45deg);
  background: var(--c, var(--muted));
  vertical-align: 1px;
}
.lvl { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.lvl-bar { width: 60px; height: 4px; background: #0a0907; border: 1px solid var(--line-soft); }
.lvl-bar span { display: block; height: 100%; background: var(--gold-dim); }

/* Composition */
.classes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.class-card {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-top: 2px solid var(--c);
  padding: 14px;
}
.class-card.empty { border-top-color: var(--line); opacity: 0.85; }
.class-head { display: flex; justify-content: space-between; align-items: baseline; }
.class-name { font-family: "Cinzel", serif; font-size: 0.95rem; color: var(--c); }
.class-card.empty .class-name { color: var(--muted); }
.class-count { font-size: 1.5rem; color: var(--text); }
.class-members { margin: 6px 0 0; font-size: 0.9rem; color: var(--muted); }
.class-card.empty .class-members { color: var(--red); }
.class-card.wanted .class-members { color: var(--amber); }

.needs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.need {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--c);
  padding: 14px 16px;
}
.need-pri {
  grid-row: span 2;
  align-self: start;
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border: 1px solid currentColor;
}
.pri-high { color: var(--red); }
.pri-medium { color: var(--amber); }
.pri-low { color: var(--muted); }
.need-title { font-weight: 500; }
.need-title .role { color: var(--muted); font-weight: 400; }
.need-reason { font-size: 0.95rem; color: var(--muted); }

/* Charter */
.charter { margin: 0; padding: 0; list-style: none; counter-reset: art; display: grid; gap: 16px; }
.charter li {
  counter-increment: art;
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0 8px;
}
.charter li::before {
  content: counter(art, upper-roman);
  grid-row: span 2;
  font-family: "Cinzel", serif;
  color: var(--gold-dim);
  font-size: 1.1rem;
}
.charter strong { font-family: "Cinzel", serif; font-weight: 500; color: var(--gold); letter-spacing: 0.04em; }
.charter p { margin: 2px 0 0; color: var(--text); }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .panel { padding: 18px 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lvl-bar { display: none; }
  .hero-sub { letter-spacing: 0.22em; margin-right: -0.22em; }
  .hero-est { letter-spacing: 0.15em; margin-right: -0.15em; }
  .scroll-cue { display: none; }
  .topnav .nav-brand { display: none; }
  .topnav .wrap { justify-content: space-between; }
  .topnav a { padding: 14px 6px; font-size: 0.72rem; letter-spacing: 0.04em; }
  .recruit { grid-template-columns: 1fr; }
  .recruit-art { margin-top: 0; }
  td, th { padding: 9px 8px; }
}
