/* The Armory's look, copied from the guild site (irresponsible-parents.eu). */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('cinzel-v26-latin-wght.woff2') format('woff2');
}

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

:root {
  --gold: #e2b34c;
  --gold-light: #f2cd72;
  --gold-dark: #93702c;
  --bg-dark: #0d0b08;
  --bg-card: #17130f;
  --edge: #292219;
  --text: #f0e9da;
  --text-dim: #a39a88;
  --text-faint: #7c7365;
  --text-ghost: #56503f;
  --red: #f87171;

  /* Blizzard's class colours, by playable class id. */
  --class-1: #c69b6d;  /* Warrior */
  --class-2: #f48cba;  /* Paladin */
  --class-3: #aad372;  /* Hunter */
  --class-4: #fff468;  /* Rogue */
  --class-5: #ffffff;  /* Priest */
  --class-7: #0070dd;  /* Shaman */
  --class-8: #3fc7eb;  /* Mage */
  --class-9: #8788ee;  /* Warlock */
  --class-11: #ff7c0a; /* Druid */

  /* Blizzard's item quality colours. */
  --quality-poor: #9d9d9d;
  --quality-common: #ffffff;
  --quality-uncommon: #1eff00;
  --quality-rare: #0070dd;
  --quality-epic: #a335ee;
  --quality-legendary: #ff8000;
  --quality-artifact: #e6cc80;
  --quality-heirloom: #00ccff;
}

html { color-scheme: dark; }

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(226,179,76,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(226,179,76,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.site-header, main, footer {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* --- Header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--edge);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  flex: none;
  filter: drop-shadow(0 0 12px rgba(226,179,76,0.3));
}

.brand-name {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
}

.back-link {
  flex: none;
  font-size: 0.9rem;
  color: var(--gold);
  text-decoration: none;
}
.back-link:hover { color: var(--gold-light); text-decoration: underline; }

/* --- Page heading --- */
h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--gold);
  letter-spacing: 0.05em;
  text-align: center;
  margin-top: 2rem;
}

.lede {
  text-align: center;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.taken-at {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
  margin: 0.5rem 0 1.75rem;
}

.status {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem 0;
}
.status.error { color: var(--red); }

/* --- Roster --- */
.roster {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}

.roster th {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--edge);
}

.roster td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--edge);
  color: var(--text-dim);
}

.roster tbody tr:last-child td { border-bottom: none; }

.roster .level { text-align: right; font-variant-numeric: tabular-nums; }
.roster th.level { text-align: right; }

.member-name {
  font-weight: 700;
  color: var(--class-colour, var(--text));
}
.member-surname {
  font-weight: 400;
  color: var(--text-faint);
}

.rank-name { color: var(--text); }

.member-link {
  color: inherit;
  text-decoration: none;
}
.member-link:hover .member-name,
.member-link:focus-visible .member-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.not-on-armory {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-ghost);
  white-space: nowrap;
}

/* At phone width each member is a two-line card instead of a table row. */
@media (max-width: 600px) {
  .roster thead { display: none; }
  .roster, .roster tbody { display: block; }
  .roster tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name level"
      "build rank";
    column-gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--edge);
  }
  .roster tbody tr:last-child { border-bottom: none; }
  .roster td { padding: 0; border: none; }
  .roster .name { grid-area: name; }
  .roster .level { grid-area: level; }
  .roster .level::before { content: 'Level '; color: var(--text-faint); }
  .roster .build { grid-area: build; font-size: 0.9rem; }
  .roster .rank { grid-area: rank; font-size: 0.9rem; text-align: right; }
}

/* --- Character page --- */
.crumb {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.crumb a { color: var(--gold); text-decoration: none; }
.crumb a:hover { color: var(--gold-light); text-decoration: underline; }
.status a { color: var(--gold); }

.hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-top: 1rem;
}

/* The render box: the class colour shows through until the image loads,
   and stays, with the initial, if it never does. */
.render {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--class-colour) 35%, transparent) 0%, transparent 70%),
    var(--bg-card);
}
.render-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 5rem;
  color: var(--class-colour);
  opacity: 0.55;
}
.render img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}
.render.loaded .render-placeholder { display: none; }

.character-name {
  text-align: left;
  margin-top: 0;
  color: var(--class-colour);
}
.character-name .member-name { color: var(--class-colour); }
.character-name .member-surname { font-size: 0.7em; }

.character-build { color: var(--text); font-size: 1.05rem; }
.character-rank { color: var(--gold); font-family: 'Cinzel', serif; letter-spacing: 0.04em; }

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.facts dt { color: var(--text-faint); }
.facts dd { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.panel { margin-top: 2rem; }

h2 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.empty { color: var(--text-faint); font-size: 0.9rem; }

.gear {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.gear th {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--edge);
}
.gear td {
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--edge);
  color: var(--text-dim);
}
.gear tbody tr:last-child td { border-bottom: none; }
.gear .slot { color: var(--text-faint); white-space: nowrap; }
.gear .item { font-weight: 600; }
.gear .ilvl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.quality-poor { color: var(--quality-poor) !important; }
.quality-common { color: var(--quality-common) !important; }
.quality-uncommon { color: var(--quality-uncommon) !important; }
.quality-rare { color: var(--quality-rare) !important; }
.quality-epic { color: var(--quality-epic) !important; }
.quality-legendary { color: var(--quality-legendary) !important; }
.quality-artifact { color: var(--quality-artifact) !important; }
.quality-heirloom { color: var(--quality-heirloom) !important; }

.talent-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.talent-group {
  background: var(--bg-card);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.talent-group h3 {
  font-size: 1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--edge);
}
.talent-group.active { border-color: var(--gold); }
.active-group {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  white-space: nowrap;
}
.talent-group h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--class-colour);
  margin-top: 0.6rem;
}
.talent-group h4 .points {
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  color: var(--text-faint);
  font-weight: 400;
}
.talent-group ul { list-style: none; }
.talent-group li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0;
  font-size: 0.92rem;
}
.talent-name { color: var(--text-dim); }
.talent-rank { color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }

.character ~ .taken-at { margin-top: 2rem; }

@media (max-width: 600px) {
  .hero { grid-template-columns: 1fr; gap: 1rem; }
  .render { max-width: 260px; width: 100%; margin: 0 auto; }
  .identity { text-align: center; }
  .character-name { text-align: center; }
  .facts { grid-template-columns: auto auto; justify-content: center; text-align: left; }

  .gear thead { display: none; }
  .gear, .gear tbody { display: block; }
  .gear tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "item ilvl"
      "slot slot";
    column-gap: 0.75rem;
    padding: 0.5rem 0.9rem;
    border-bottom: 1px solid var(--edge);
  }
  .gear tbody tr:last-child { border-bottom: none; }
  .gear td { padding: 0; border: none; }
  .gear .item { grid-area: item; }
  .gear .ilvl { grid-area: ilvl; }
  .gear .ilvl::before { content: 'ilvl '; color: var(--text-faint); font-size: 0.8rem; }
  .gear .slot { grid-area: slot; font-size: 0.8rem; }
}

/* --- Footer --- */
footer {
  text-align: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
  margin-top: 3rem;
  border-top: 1px solid var(--edge);
  color: var(--text-faint);
  font-size: 0.85rem;
}
footer a { color: var(--gold-dark); }
footer .flavour {
  font-style: italic;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-ghost);
}

@media (max-width: 420px) {
  .brand img { width: 40px; height: 40px; }
  .brand-name { font-size: 1rem; }
}
