/* WoW Tracker. Dark by default with a light theme; the RadMage Labs look shared with D4 Tracker and
   GW2 Timer. System fonts only, so the page makes no outside requests. */

:root {
  --bg: #0d0e11;
  --surface: #15171b;
  --surface-2: #1c1f24;
  --line: #2a2e35;
  --line-strong: #3b4048;
  --text: #ebe7df;
  --text-dim: #a8a297;
  --text-faint: #8d877c;
  --gold: #e2a93b;
  --holiday: #e8833a;
  --darkmoon: #b98ae6;
  --bonus: #4fb3d9;
  --boss: #e06a5f;
  --outdoor: #6cc27a;
  --monthly: #d8c26a;
  --minor: #e08bb0;
  --ok: #7cc48a;
  --warn: #e6b450;
  --focus: #f0c674;
  --radius: 10px;
  --accent: var(--gold);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f7f5f0;
  --line: #e0dcd4;
  --line-strong: #c9c2b7;
  --text: #1c1a17;
  --text-dim: #57524b;
  --text-faint: #6f695f;
  --gold: #8a5e06;
  --holiday: #a44a0b;
  --darkmoon: #7240a8;
  --bonus: #11648a;
  --boss: #a8352b;
  --outdoor: #2c7a3a;
  --monthly: #7a6400;
  --minor: #a3346a;
  --ok: #2f7d3e;
  --warn: #85590a;
  --focus: #85590a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -40px; z-index: 10;
  padding: 6px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-strong);
}
.skip:focus { top: 8px; }

/* Header */

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; margin-right: auto; }
.brand h1 { margin: 0; font: 600 21px/1.2 var(--serif); letter-spacing: 0.02em; white-space: nowrap; }
.brand .tag { color: var(--text-faint); font-size: 12px; }
.brand .tag a { color: var(--text-dim); text-decoration: none; }
.brand .tag a:hover { text-decoration: underline; }
.tools { display: flex; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface-2); cursor: pointer; font-size: 13px; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-faint); }
.btn[aria-pressed="true"] { border-color: var(--focus); color: var(--text); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.link-btn { min-height: 30px; border: 0; background: none; padding: 0 2px; color: var(--text-dim); text-decoration: underline; cursor: pointer; font-size: 13px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  min-height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-dim);
}
.seg-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--focus); }
.region .seg-btn { min-height: 34px; font-weight: 600; }
.region .seg-btn[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }

/* Layout */

main {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 16px 20px 28px;
  display: grid; gap: 18px; align-content: start;
}
main > * { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.notice-bar { margin: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--warn); color: var(--warn); font-size: 13px; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.section-head h2 { margin: 0; font: 600 18px/1.2 var(--serif); letter-spacing: 0.02em; }
.section-head h2:focus { outline: none; }
.section-head .link-btn { margin-left: auto; }
.hint { color: var(--text-faint); font-size: 12.5px; }
.explain { margin: -2px 0 10px; color: var(--text-dim); font-size: 13px; max-width: 75ch; }
.empty { margin: 0; padding: 12px 14px; color: var(--text-faint); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Summary: clock, resets, next event */

.summary { padding: 12px 14px 10px; }
.summary-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 18px;
}
.summary-list li { display: grid; align-content: start; min-width: 0; }
.summary-list .label { color: var(--text-faint); font-size: 12px; }
.summary-list .value { font-weight: 600; font-size: 19px; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-list .sub { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-list .next-name { font-size: 16px; }
.region-line { margin: 8px 0 0; color: var(--text-faint); font-size: 12px; }
.region-line strong { color: var(--gold); font-weight: 600; }

/* Controls */

.controls { padding: 12px 14px; display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 11px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  border: 1px solid var(--line); background: transparent; color: var(--text-faint); text-decoration: line-through;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.4; }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.chip[aria-pressed="true"]::before { opacity: 1; }
.control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.field select {
  min-height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text);
}

/* Category colors, shared by chips, cards, rows and the calendar */

[data-cat="holiday"] { --accent: var(--holiday); }
[data-cat="darkmoon"] { --accent: var(--darkmoon); }
[data-cat="bonus"] { --accent: var(--bonus); }
[data-cat="timewalking"] { --accent: var(--bonus); }
[data-cat="world-boss"] { --accent: var(--boss); }
[data-cat="outdoor"] { --accent: var(--outdoor); }
[data-cat="monthly"] { --accent: var(--monthly); }
[data-cat="minor"] { --accent: var(--minor); }

/* Happening now: cards. The active card breathes in its own color, as in D4 Tracker. */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.event {
  position: relative; overflow: hidden;
  padding: 13px 15px 11px; display: flex; flex-direction: column; gap: 5px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  animation: breathe 4.5s ease-in-out infinite;
}
.event::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: 0.85; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 0 2px 0 color-mix(in srgb, var(--accent) 15%, transparent); }
  50% { box-shadow: 0 0 0 1px var(--accent), 0 0 14px 1px color-mix(in srgb, var(--accent) 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .event { animation: none; box-shadow: 0 0 0 1px var(--accent); }
}
.event-head { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: -6px; }
.event-head h3 { margin: 0; font: 600 16.5px/1.25 var(--serif); letter-spacing: 0.01em; min-width: 0; overflow-wrap: anywhere; }
.pill {
  margin-left: auto; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: var(--accent); border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.where { margin: 0; color: var(--text-dim); font-size: 13px; }
.countdown { margin: 0; font-variant-numeric: tabular-nums; }
.countdown .big { font-weight: 600; }
.countdown .since { color: var(--text-faint); font-size: 12.5px; }
.note { margin: 0; color: var(--text-faint); font-size: 12.5px; }
.src { margin: 0; color: var(--text-faint); font-size: 12px; }
.src a { color: var(--text-dim); }

.badges, .line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.line1 { margin-left: -6px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--text-dim);
}
.badge.cat { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.badge.predicted { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 65%, transparent); border-style: dashed; cursor: help; }

.star-btn {
  min-width: 30px; min-height: 30px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--text-faint); font-size: 17px; line-height: 1; cursor: pointer;
}
.star-btn:hover { color: var(--text); border-color: var(--line); }
.star-btn.on { color: var(--focus); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* Coming up: rows */

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row {
  display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; background: var(--surface);
}
.row .when { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; line-height: 1.25; }
.row .t { font-weight: 600; font-size: 15.5px; }
.row .utc { color: var(--text-faint); font-size: 11.5px; }
.row .in { color: var(--text-dim); font-size: 12.5px; }
.row .name { font-weight: 600; overflow-wrap: anywhere; }
.row .line2 { color: var(--text-faint); font-size: 12.5px; }
.row .actions { margin-top: 0; justify-content: flex-end; }
.day-sep, .group {
  list-style: none; margin: 8px 0 0; padding: 0 2px; color: var(--text-faint);
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.day-sep:first-child, .group:first-child { margin-top: 0; }

/* Weekly overview */

.week { padding: 14px 16px; }
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 22px; }
.week-col h3 { margin: 0 0 6px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.week-col h3 .dates { color: var(--text-faint); font-weight: 400; }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.week-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding-left: 10px; border-left: 3px solid var(--accent); }
.week-list .name { font-weight: 600; }
.week-list .span { color: var(--text-faint); font-size: 12.5px; }
.week-list .none { border-left-color: var(--line); color: var(--text-faint); font-size: 13px; }

/* Event calendar: an agenda by month */

.calendar { display: grid; gap: 14px; }
.month h3 { margin: 0 0 6px; font: 600 15px/1.2 var(--serif); color: var(--text-dim); letter-spacing: 0.02em; }
.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.agenda li {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2px 12px; align-items: baseline;
  padding: 6px 10px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 7px; background: var(--surface);
}
.agenda li.is-now { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.agenda .dates { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-dim); }
.agenda .what { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; }
.agenda .name { font-weight: 600; overflow-wrap: anywhere; }
.agenda .sub { color: var(--text-faint); font-size: 12.5px; }
/* Where schedules are not known yet: a quiet dashed line, never an empty "nothing" */
.gap { margin: 6px 0 0; padding: 2px 0 2px 10px; border-left: 2px dashed var(--line-strong); color: var(--text-faint); font-size: 12.5px; }
.gap-cats { color: var(--text-dim); text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
.month .gap { margin: 0 0 6px; }
.month-none { margin: 0; color: var(--text-faint); font-size: 12.5px; }
.week-col .gap { margin-top: 8px; }
.compact .gap { font-size: 12px; }
.untracked { margin: 10px 0 0; color: var(--text-faint); font-size: 12.5px; max-width: 90ch; }

/* Compact: one tight line per event */

.compact .row { padding: 5px 10px; grid-template-columns: 104px minmax(0, 1fr) auto; }
.compact .row .line2, .compact .note, .compact .src, .compact .row .utc, .compact .event .where, .compact .explain { display: none; }
.compact .row .actions .btn { display: none; }
.compact .event { padding: 9px 12px 8px; }
.compact .event .actions { display: none; }
.compact .agenda li { padding: 3px 10px; }
.compact .agenda .sub { display: none; }

/* News */

.news { padding: 12px 16px; }
.news .section-head { margin-bottom: 0; }
#news-body { margin-top: 8px; }
.news-note { margin: 0 0 8px; color: var(--text-faint); font-size: 12.5px; }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.news-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.news-list a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; min-width: 0; }
.news-list a:hover { text-decoration: underline; }
.news-list .meta { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }
.news-shop { margin-top: 6px; font-size: 12.5px; }

/* Footer, dialogs, toast */

.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 14px 20px 18px; color: var(--text-faint); font-size: 12.5px; text-align: center;
}
.site-footer p { margin: 4px auto; max-width: 900px; }
.site-footer a, .site-footer .link-btn { color: var(--text-dim); font-size: 13px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 14px; margin-bottom: 4px; }
.footer-links a, .footer-links .link-btn { display: inline-flex; align-items: center; min-height: 30px; }
.site-footer .revision { color: var(--text-dim); }
.legal { font-size: 11.5px; color: var(--text-faint); }
.compact .site-footer .legal { display: none; }

dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto;
  padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 { margin: 0 0 8px; font: 600 19px/1.2 var(--serif); }
dialog h3 { margin: 14px 0 4px; font-size: 14px; }
dialog p, dialog li { font-size: 13.5px; color: var(--text-dim); }
dialog a { color: var(--text); }
.dialog-close { float: right; margin: -4px -6px 0 8px; }
.hidden-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.hidden-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px);
  max-width: calc(100vw - 24px); padding: 9px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Phones */

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 8px 10px; }
  .brand { flex-basis: 100%; }
  .tools { margin-left: auto; }
  main { padding: 12px 12px 24px; gap: 14px; }
  .summary-list { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .summary-list .value { font-size: 17px; }
  .summary-list .next { grid-column: 1 / -1; }
  .cards { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row .when { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .row .actions { justify-content: flex-start; }
  .compact .row { grid-template-columns: minmax(0, 1fr); }
  .agenda li { grid-template-columns: 1fr; }
}
