/* WoW Forever guild app.
   Cool slate stone, bone text, Vanilla's red-and-gold button for primary actions,
   and the game's own class and item-quality colours for every name and item. */

:root {
  --slate: #1c2226;
  --panel: #252d32;
  --panel-2: #2c353b;
  --line: #3a454c;
  --line-soft: #2f383e;
  --bone: #e9e3d3;
  --dust: #9aa3a8;
  --dust-2: #737d83;
  --red: #8e1e14;
  --red-hi: #b0291c;
  --gold: #f2c45a;
  --green: #5fd068;
  --bad: #ff6b5b;
  --uncommon: #1eff00;
  --rare: #3d8ff0;
  --epic: #b45ef5;
  --legendary: #ff8000;
  --display: 'Marcellus', 'Palatino Linotype', Georgia, serif;
  --body: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --radius: 4px;
  --side: 232px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--slate); color: var(--bone);
  font: 400 16px/1.5 var(--body); font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(to right, #181d20 var(--side), var(--slate) var(--side));
  display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh;
}
body.no-nav { grid-template-columns: 1fr; background: var(--slate); }
body.no-nav .sidebar nav { display: none; }

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover .player, a.plain:hover .item { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0; letter-spacing: .01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
small, .muted { color: var(--dust); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }
.neg { color: var(--bad); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: #000; padding: 6px 10px; z-index: 50; }
.skip:focus { left: 8px; }

/* Sidebar ---------------------------------------------------------------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #181d20; border-right: 1px solid var(--line-soft); padding: 18px 12px; gap: 18px;
}
body.no-nav .sidebar { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand a { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.3rem; color: var(--gold); line-height: 1.15; }
.crest { width: 26px; height: 30px; flex: none; background: url('/favicon.svg') center/contain no-repeat; }
.menu-btn { display: none; }
#nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
#nav a {
  display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: var(--radius);
  color: var(--dust); text-decoration: none; font-weight: 500;
}
#nav a:hover { color: var(--bone); background: var(--panel); }
#nav a.active { color: var(--bone); background: var(--panel); box-shadow: inset 3px 0 0 var(--gold); }
.badge { background: var(--red); color: var(--gold); border-radius: 10px; padding: 0 7px; font-size: .78rem; font-weight: 700; }
.me-box { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
body.no-nav .me-box { margin: 0; flex-direction: row; align-items: center; }
.me-link { display: flex; gap: 10px; align-items: center; }
.me-link span { display: flex; flex-direction: column; line-height: 1.25; }
.avatar { border-radius: 50%; background: var(--panel-2); color: var(--dust); display: inline-grid; place-items: center; font-weight: 700; flex: none; object-fit: cover; }

/* Page ---------------------------------------------------------------------- */
main { min-width: 0; outline: none; }
.page { max-width: 1240px; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.page.loading { color: var(--dust); }
main[aria-busy] .page { opacity: .65; transition: opacity .2s .15s; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.page-head .sub { color: var(--dust); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.panel > header h2 { font-size: 1.15rem; }
.panel > .body { padding: 14px 16px; }
.panel > .body.flush { padding: 0; }
.panel > footer { padding: 10px 16px; border-top: 1px solid var(--line-soft); }

.motd { border-left: 3px solid var(--gold); padding: 10px 16px; background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; color: var(--bone); }

/* Names and items, as they appear in game ----------------------------------- */
.player { color: var(--c); font-weight: 500; }
.item { color: var(--q); font-weight: 500; }
.role { display: inline-block; width: 1.2em; text-align: center; }

/* Buttons --------------------------------------------------------------------- */
.btn {
  font: 500 .95rem/1 var(--body); border-radius: var(--radius); padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--bone); white-space: nowrap;
}
.btn:hover { border-color: var(--dust-2); }
.btn:disabled { opacity: .55; cursor: default; }
/* The Vanilla panel button: deep red, gold lettering, a bevel. */
.btn.primary {
  background: linear-gradient(#a8261a, var(--red) 55%, #6e150d); color: var(--gold); border: 1px solid #4a0d07;
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, .25), 0 1px 0 #000; font-family: var(--display); font-size: 1rem; letter-spacing: .02em;
}
.btn.primary:hover { background: linear-gradient(#bf3022, var(--red-hi) 55%, #7d1a10); }
.btn.primary:active { background: linear-gradient(#6e150d, var(--red)); box-shadow: inset 0 1px 3px #000; }
.btn.danger { background: transparent; border-color: #6b2a24; color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 9px; font-size: .85rem; }
.btn.on { border-color: var(--gold); color: var(--gold); }
.icon-btn { background: none; border: 0; color: var(--dust); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.icon-btn:hover { color: var(--bone); background: var(--panel-2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg > * { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg > *:last-child { border-right: 0; }

/* Forms ------------------------------------------------------------------------- */
input, select, textarea {
  font: inherit; color: var(--bone); background: #161b1e; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--red-hi); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-weight: 500; font-size: .92rem; }
.hint { color: var(--dust); font-size: .85rem; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-error { color: var(--bad); }
.form-error[hidden] { display: none; }
fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
legend { padding: 0 6px; color: var(--dust); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 140px; }

/* Tables -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-weight: 500; color: var(--dust); font-size: .88rem; white-space: nowrap; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tr:last-child td { border-bottom: 0; }
th button.sort { all: unset; cursor: pointer; }
th button.sort:hover { color: var(--bone); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.list > li:last-child { border-bottom: 0; }

.tag { display: inline-block; border: 1px solid var(--line); color: var(--dust); border-radius: 3px; padding: 0 6px; font-size: .82rem; line-height: 1.5; white-space: nowrap; }
.tag.ok { border-color: #2f6b36; color: var(--green); }
.tag.warn { border-color: #7a6025; color: var(--gold); }
.tag.bad { border-color: #6b2a24; color: var(--bad); }
.tag.info { border-color: #2c4f78; color: var(--rare); }

.bar { display: inline-block; width: 100%; min-width: 60px; height: 6px; background: #161b1e; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.bar > span { display: block; height: 100%; background: var(--gold); }
.bar.green > span { background: var(--green); }

.money { white-space: nowrap; }
.coin { margin-right: 4px; }
.coin i { font-style: normal; font-size: .8em; margin-left: 1px; }
.coin-g i { color: #f2c45a; } .coin-s i { color: #c7ced3; } .coin-c i { color: #c9814d; }

.empty { padding: 28px 16px; text-align: center; color: var(--dust); display: flex; flex-direction: column; gap: 12px; align-items: center; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.tabs a, .tabs button { all: unset; cursor: pointer; padding: 8px 14px; color: var(--dust); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--bone); }
.tabs .active { color: var(--bone); border-bottom-color: var(--gold); }
.tabs a:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--gold); }

/* Stats strip ------------------------------------------------------------------------ */
.stats { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
.stat { padding: 12px 18px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; min-width: 130px; flex: 1; }
.stat:last-child { border-right: 0; }
.stat b { font-family: var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--dust); font-size: .88rem; }

/* Events ------------------------------------------------------------------------------- */
.event-row { display: grid; grid-template-columns: 74px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: rgba(255, 255, 255, .025); }
.event-row:hover h3 { text-decoration: underline; text-decoration-color: var(--dust-2); }
.when { display: flex; flex-direction: column; align-items: center; line-height: 1.1; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 4px; background: #1a2024; }
.when b { font-family: var(--display); font-size: 1.45rem; font-weight: 400; }
.when small { font-size: .78rem; }
.event-row .meta { color: var(--dust); font-size: .92rem; }
.comp { display: flex; gap: 10px; color: var(--dust); font-size: .9rem; flex-wrap: wrap; }
.comp .full { color: var(--green); }
.comp .short { color: var(--gold); }
.event-row.cancelled h3 { text-decoration: line-through; color: var(--dust); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
.cal > div { min-height: 96px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .dow { min-height: 0; color: var(--dust); font-size: .85rem; padding: 6px; }
.cal .out { background: #1f262a; }
.cal .out .d { color: var(--dust-2); }
.cal .today .d { color: #000; background: var(--gold); border-radius: 10px; padding: 0 6px; }
.cal .d { font-size: .85rem; align-self: flex-start; }
.cal a.ev { display: block; font-size: .82rem; text-decoration: none; color: var(--bone); background: var(--panel-2); border-left: 3px solid var(--gold); padding: 2px 5px; border-radius: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal a.ev.raid { border-left-color: var(--red-hi); }
.cal a.ev.done { opacity: .6; }
.cal a.ev.cancelled { text-decoration: line-through; opacity: .5; }

/* The raid frame: four role columns. */
.raid-frame { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.role-col { background: #1f262a; border: 1px solid var(--line-soft); border-radius: var(--radius); min-width: 0; }
.role-col > header { padding: 8px 10px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.role-col > header b { font-family: var(--display); font-weight: 400; }
.role-col ul { list-style: none; margin: 0; padding: 4px; }
.slot { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 3px; min-height: 30px; }
.slot:hover { background: var(--panel); }
.slot .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .flags { display: flex; gap: 4px; align-items: center; }
.slot.bench { opacity: .6; }
.slot.tentative .player { font-style: italic; }
.slot select { width: auto; padding: 2px 4px; font-size: .8rem; }
.res { font-size: .78rem; color: #ff8c5a; }
.res.low { color: var(--bad); }

.boss-list { display: flex; flex-wrap: wrap; gap: 6px; }
.boss { border: 1px solid var(--line); border-radius: 3px; padding: 3px 9px; font-size: .9rem; background: transparent; color: var(--dust); cursor: default; font-family: var(--body); }
button.boss { cursor: pointer; }
.boss.dead { color: var(--bone); border-color: #6b5320; background: #2f2a1c; }
.boss.dead::before { content: '☠ '; color: var(--gold); }

.prog { display: flex; flex-direction: column; gap: 4px; }
.prog .bar > span { background: linear-gradient(90deg, var(--red-hi), var(--gold)); }

/* Item tooltip-like detail ------------------------------------------------------------------ */
.tooltip { background: #0d1418; border: 1px solid #5b6770; border-radius: 4px; padding: 12px 14px; box-shadow: 0 0 0 1px #000; max-width: 420px; display: flex; flex-direction: column; gap: 2px; }
.tooltip .item { font-size: 1.15rem; }

/* Quest log ---------------------------------------------------------------------------------- */
.quest { display: grid; grid-template-columns: 1fr 220px; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.quest:last-child { border-bottom: 0; }
.quest h3 { color: var(--gold); }
.quest .desc { color: var(--dust); margin: 3px 0 6px; }
.quest .side { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.reward { color: var(--bone); }
.reward b { color: var(--gold); font-weight: 500; }

/* Modal and toasts ------------------------------------------------------------------------- */
dialog.modal { border: 1px solid var(--line); background: var(--panel); color: var(--bone); border-radius: 6px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
dialog.modal.wide { width: min(780px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(8, 10, 12, .7); }
.modal form { gap: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-body { padding: 16px 18px; overflow-y: auto; max-height: calc(100vh - 200px); }
.modal .form-error { padding: 0 18px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }

.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--green); padding: 10px 14px; border-radius: var(--radius); max-width: 360px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); transition: opacity .4s; }
.toast-error { border-left-color: var(--bad); }
.toast.out { opacity: 0; }

.countdown.soon { color: var(--bad); font-weight: 700; }
.login-box { max-width: 460px; margin: 8vh auto; text-align: left; display: flex; flex-direction: column; gap: 18px; }
.login-box h1 { font-size: 2.4rem; color: var(--gold); }
.discord-btn { display: inline-flex; align-items: center; gap: 10px; justify-content: center; text-decoration: none; padding: 12px 18px; }
.prose p + p { margin-top: .7em; }
.prose { white-space: pre-wrap; max-width: 70ch; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--dust); }
.kv dd { margin: 0; }
.char-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.char-card:last-child { border-bottom: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.class-dist { display: flex; flex-direction: column; gap: 6px; }
.class-dist .r { display: grid; grid-template-columns: 90px 1fr 28px; gap: 8px; align-items: center; font-size: .92rem; }
.class-dist .bar > span { background: var(--c); }

@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .raid-frame { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; background: var(--slate); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .menu-btn { display: inline-block; }
  body.no-nav .menu-btn { display: none; }
  #nav, .sidebar .me-box { display: none; }
  body.menu-open .sidebar { flex-wrap: wrap; }
  body.menu-open #nav { display: flex; width: 100%; order: 3; }
  body.menu-open .sidebar .me-box { display: flex; width: 100%; order: 4; flex-direction: row; justify-content: space-between; }
  .page { padding: 18px 16px 48px; gap: 18px; }
  h1 { font-size: 1.6rem; }
  .event-row { grid-template-columns: 60px 1fr; }
  .event-row > :last-child { grid-column: 2; }
  .quest { grid-template-columns: 1fr; }
  .cal > div { min-height: 64px; padding: 3px; }
  .cal a.ev { font-size: .7rem; padding: 1px 3px; }
  .stat { min-width: 45%; border-bottom: 1px solid var(--line-soft); }
  .raid-frame { grid-template-columns: 1fr; }
  th, td { padding: 7px 8px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
td .actions { flex-wrap: nowrap; }
.stat .money { font-family: var(--body); font-size: 1.35rem; }
body.no-nav { grid-template-rows: auto 1fr; }
@media (max-width: 760px) {
  body { grid-template-rows: auto 1fr; }
  body.no-nav .sidebar .me-box { display: flex; }
  body.no-nav .me-link span { display: none; }
}
