/* WoW-style theme: dark stone background, gold-trimmed panels, Cinzel titles,
   HP (Horse Points) shown as gold bars, tooltips like the game's. Dark only, like the game.
   Layout: one centred column; sticky header with crest + tabs; each view is a
   heading, optional summary frames, then panels with tables or charts. */
:root {
  color-scheme: dark;
  --bg: #0b0a08;
  --panel: #15110c;
  --panel-2: #1d1811;
  --panel-hover: #251e14;
  --ink: #ece2c8;            /* parchment */
  --muted: #a99d84;
  --line: #3a2f1f;
  --gold: #ffd100;           /* the game's gold text */
  --gold-soft: #d8b04a;
  --gold-dim: #8c6b2a;
  --trim: linear-gradient(135deg, #9a7634, #3d2d12 35%, #b8914a 55%, #3d2d12 80%, #8c6b2a);
  --pos: #4ade4a;
  --neg: #ff5a4a;
  --tip-bg: rgba(6, 9, 26, 0.95);
  --tip-line: #7d7f92;
  --chart-line: #ffd100;
  --chart-grid: #2a2318;
  --hp-hi: #ffd34a; --hp-lo: #a8640f;     /* HP bar: saddle gold */
  /* Item quality colours, as in game */
  --q0: #9d9d9d; --q1: #ffffff; --q2: #1eff00; --q3: #0070dd; --q4: #a335ee;
  --q5: #ff8000; --q6: #e6cc80; --q7: #00ccff;
  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.5 var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 190, 80, 0.13), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(120, 40, 20, 0.12), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 6px);
  background-attachment: fixed;
}
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
a { color: var(--gold-soft); text-decoration: none; transition: color .15s, text-shadow .15s; }
a:hover { color: var(--gold); text-shadow: 0 0 8px rgba(255, 209, 0, .35); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, tr:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
code { font: 0.92em ui-monospace, Menlo, Consolas, monospace; color: var(--gold); background: #000a; border: 1px solid var(--line); padding: 1px 6px; border-radius: 3px; }
.muted { color: var(--muted); }
.pos { color: var(--pos); font-weight: 600; }
.neg { color: var(--neg); font-weight: 600; }
.gold { color: var(--gold); }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(#1a140c, #0f0c08);
  border-bottom: 2px solid transparent;
  border-image: var(--trim) 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .6);
}
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; }
.brand:hover { text-shadow: none; }
.crest {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; flex: none;
  font: 700 15px/1 var(--font-display); color: var(--gold); letter-spacing: .03em;
  background: radial-gradient(circle at 35% 30%, #4a3418, #1a1008 70%) padding-box, var(--trim) border-box;
  border: 3px solid transparent; box-shadow: 0 0 0 1px #000, 0 2px 8px #000;
  text-shadow: 0 1px 2px #000;
}
.brand-name { font: 700 22px/1.15 var(--font-display); color: var(--gold); text-shadow: 0 1px 2px #000, 0 0 14px rgba(255, 190, 60, .25); letter-spacing: .04em; }
.brand-sub { font-size: 13px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a {
  padding: 7px 14px; border-radius: 6px 6px 2px 2px; color: var(--muted);
  font: 600 14px/1.2 var(--font-display); letter-spacing: .03em;
  background: linear-gradient(#2a1b10, #160e08); border: 1px solid #3c2a16; border-bottom-color: #000;
  transition: color .15s, background .15s, transform .15s;
}
.tabs a:hover { color: var(--gold); text-shadow: none; transform: translateY(-1px); }
.tabs a[aria-current="page"] {
  color: var(--gold); background: linear-gradient(#5a2a12, #2a140a);
  border-color: var(--gold-dim); box-shadow: inset 0 1px 0 rgba(255, 220, 120, .25), 0 0 12px rgba(255, 140, 40, .15);
}

/* ---------------------------------------------------------------- views */
main { padding-block: 28px 56px; display: flex; flex-direction: column; gap: 18px; }
main > section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
main > section > * { min-width: 0; } /* wide tables scroll inside their frame, not the page */
.view-head { display: flex; flex-direction: column; gap: 4px; }
h1 {
  font: 700 34px/1.15 var(--font-display); margin: 0; color: var(--gold); letter-spacing: .03em; text-wrap: balance;
  text-shadow: 0 2px 3px #000, 0 0 22px rgba(255, 180, 50, .18);
}
h2 {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 0;
  font: 700 18px/1.3 var(--font-display); color: var(--gold-soft); letter-spacing: .05em;
}
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-dim), transparent); }
.view-head p { margin: 0; }
.back { font: 600 14px var(--font-display); letter-spacing: .03em; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search, select {
  font: inherit; color: var(--ink); background: #000c; border: 1px solid #4a4a4a; border-radius: 3px; padding: 7px 10px;
  box-shadow: inset 0 2px 6px #000;
}
.search { width: min(320px, 100%); }
.search::placeholder { color: #7a705e; }
.search:focus, select:focus { border-color: var(--gold-dim); outline: none; box-shadow: inset 0 2px 6px #000, 0 0 0 1px var(--gold-dim); }

/* Gold-trimmed panel, the base of every box */
.panel, .table-wrap, .tile, .chart-box, .example, .rules-table {
  background: linear-gradient(var(--panel-2), var(--panel)) padding-box, var(--trim) border-box;
  border: 1px solid transparent; border-radius: 6px;
  box-shadow: 0 0 0 1px #000, 0 8px 22px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 220, 140, .06);
}

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:last-child, th:last-child { white-space: normal; }
tbody tr:last-child td { border-bottom: 0; }
th { background: linear-gradient(#2a2015, #1a140d); font-size: 12px; border-bottom: 1px solid var(--gold-dim); }
th button { all: unset; cursor: pointer; font: 700 12px var(--font-display); color: var(--gold-soft); letter-spacing: .06em; text-transform: uppercase; }
th button:hover { color: var(--gold); }
th[aria-sort="ascending"] button, th[aria-sort="descending"] button { color: var(--gold); }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
.num { text-align: right; }
th.num button { display: block; text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable td { transition: background .15s; }
tr.clickable:hover td { background: var(--panel-hover); }
tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
/* Date line at the start of each raid night (loot tables sorted by date). */
tbody tr.night td {
  padding: 16px 12px 6px; background: none; border-bottom: 1px solid var(--gold-dim);
  font: 700 14px/1.2 var(--font-display); color: var(--gold-soft); letter-spacing: .04em;
}
tbody tr.night:first-child td { padding-top: 10px; }
tbody tr.night .muted { font: 400 13px/1.2 var(--font-body); letter-spacing: 0; }
td.empty { color: var(--muted); text-align: center; padding: 28px; font-style: italic; }
.animate tbody tr { animation: row-in .4s var(--ease) both; animation-delay: calc(min(var(--r, 0), 24) * 22ms); }

/* Rank: gold, silver, bronze for the top three (not .r1-.r3: Wowhead styles those) */
.rank { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding-inline: 4px; border-radius: 50%; font: 700 13px var(--font-display); color: var(--muted); }
.rank.place-1, .rank.place-2, .rank.place-3 { border: 1px solid currentColor; box-shadow: 0 0 10px -2px currentColor; background: #0008; }
.rank.place-1 { color: #ffd100; } .rank.place-2 { color: #d4dbe3; } .rank.place-3 { color: #e0904a; }

/* HP bar: fills up when the page opens */
.hpbar {
  position: relative; display: block; min-width: 140px; height: 20px; border-radius: 3px; overflow: hidden;
  background: linear-gradient(#1c140a, #0e0a05); border: 1px solid #000; box-shadow: 0 0 0 1px #4a3a22, inset 0 2px 4px #000;
}
.hpbar > i {
  position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); transform-origin: left;
  background: linear-gradient(var(--hp-hi), var(--hp-lo)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
  animation: bar-grow 1s var(--ease) both; animation-delay: calc(min(var(--r, 0), 24) * 22ms + 150ms);
}
.table-wrap:not(.animate) .hpbar > i { animation: none; } /* no replay when re-sorting */
.hpbar > i::after { /* moving sheen */
  content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  transform: translateX(-100%); animation: sheen 2.8s ease-in-out 1.2s infinite;
}
.hpbar > b {
  position: relative; display: block; text-align: center; font: 700 13px/18px var(--font-body); color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}
.hpbar.big { height: 26px; }
.hpbar.big > b { font-size: 15px; line-height: 24px; }

/* Items: quality colour as in game; Wowhead adds the icon */
.item { color: var(--q, var(--ink)); font-weight: 600; text-shadow: 0 1px 1px #000; }
.item.quality-0 { --q: var(--q0); } .item.quality-1 { --q: var(--q1); } .item.quality-2 { --q: var(--q2); } .item.quality-3 { --q: var(--q3); }
.item.quality-4 { --q: var(--q4); } .item.quality-5 { --q: var(--q5); } .item.quality-6 { --q: var(--q6); } .item.quality-7 { --q: var(--q7); }
.item-link:hover { text-shadow: none; }
.item-link:hover .item { text-decoration: underline; text-shadow: 0 0 10px var(--q, var(--gold)); }
h1 .item { font-weight: 700; text-shadow: 0 2px 3px #000, 0 0 18px color-mix(in srgb, var(--q, var(--gold)) 35%, transparent); }
a.ext { font-size: 14px; font-weight: 600; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 3px; font-size: 13px; font-weight: 700; background: #0009; color: var(--muted); border: 1px solid #3a3226; }
.badge.awarded { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 45%, #000); }
.badge.disenchanted { color: #c79cff; border-color: color-mix(in srgb, #c79cff 45%, #000); }
.tier { display: inline-block; min-width: 30px; padding: 0 6px; border-radius: 3px; text-align: center; font: 700 12px/20px var(--font-display); letter-spacing: .04em; border: 1px solid; background: #0009; }
.tier.t101 { color: var(--gold); border-color: var(--gold-dim); box-shadow: 0 0 8px -2px var(--gold); }
.tier.t100 { color: #7ab8ff; border-color: #2c4f7a; }
.tier.t99 { color: #b9b2a3; border-color: #4a4438; }

/* ---------------------------------------------------------------- summary frames */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; transition: transform .2s var(--ease), box-shadow .2s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px #000, 0 12px 26px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 190, 60, .12); }
.tile-label { font: 700 12px var(--font-display); color: var(--gold-soft); letter-spacing: .07em; text-transform: uppercase; }
.tile-value { font: 700 30px/1.2 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; text-shadow: 0 2px 3px #000; overflow-wrap: anywhere; }
.tile-value.small { font-size: 17px; line-height: 1.35; padding-block: 6px 4px; font-family: var(--font-body); }
.tile-note { font-size: 13px; color: var(--muted); }
.stats-line { line-height: 1.9; }
.stats-line strong { color: var(--ink); }

/* Player header */
.char-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.char-head .hpbar { flex: 1 1 260px; max-width: 420px; }

/* ---------------------------------------------------------------- chart */
.chart-box { position: relative; padding: 10px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { stroke: var(--gold-dim); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 12px var(--font-body); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255, 209, 0, .45)); }
.chart .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s var(--ease) .2s forwards; }
.chart .area { fill: url(#hp-area); opacity: 0; animation: fade-in .8s ease 1s forwards; }
.chart .dot { fill: var(--chart-line); stroke: var(--panel); stroke-width: 2; }
.chart .dot.end { animation: pulse 2s ease-in-out 1.6s infinite; transform-box: fill-box; transform-origin: center; }
.chart .crosshair { stroke: var(--gold-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: crosshair; }

/* Tooltips in the game's style (ours and Wowhead's) */
.chart-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 14px)); pointer-events: none; z-index: 5;
  background: var(--tip-bg); border: 1px solid var(--tip-line); border-radius: 4px; padding: 7px 11px;
  font-size: 13px; line-height: 1.45; white-space: nowrap; color: #fff;
  box-shadow: 0 0 0 1px #000, 0 6px 16px rgba(0, 0, 0, .6);
}
.chart-tip strong { color: var(--gold); }
.wowhead-tooltip { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); }

/* ---------------------------------------------------------------- How it works */
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 10px; }
.prose h2 { margin-top: 14px; }
.prose p, .prose ul { margin: 0; }
.prose li + li { margin-top: 5px; }
.prose li::marker { color: var(--gold-dim); }
.prose strong { color: var(--gold); }
.rules-table { width: auto; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.rules-table td:last-child { white-space: normal; }
.example { padding: 12px 16px; box-shadow: 0 0 0 1px #000, inset 3px 0 0 var(--gold); }

/* ---------------------------------------------------------------- motion */
main > * { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } }
@keyframes bar-grow { from { transform: scaleX(0); } }
@keyframes sheen { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .chart .line.draw { stroke-dasharray: none; stroke-dashoffset: 0; }
  .chart .area { opacity: 1; }
}

@media (max-width: 560px) {
  h1 { font-size: 26px; }
  th, td { padding: 8px; }
  .tabs a { padding: 6px 10px; font-size: 13px; }
  .hpbar { min-width: 110px; }
}
