/* RaidSlot's dashboard: mobile first (360px up), light and dark from the
   system setting. Tokens live on :root; components only use tokens. */

:root {
  color-scheme: light dark;

  /* Type scale (1.2 ratio) and spacing (4px base). */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.2rem;
  --text-xl: 1.44rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius: 12px;
  --radius-sm: 8px;
  --touch: 44px;

  /* Light: the icon's navy and blue. Text pairs are >= 4.5:1. */
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --border: #d5dde8;
  --text: #0f1a2a;
  --muted: #4a5a70;
  --accent: #0759c9;
  --accent-text: #ffffff;
  --accent-soft: #e2edfc;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #1d7a3e;
  --warn: #8a5a00;
  --focus: #0759c9;
  --dot-ring: rgba(15, 26, 42, 0.55);
  --topbar: #071221;
  --topbar-text: #e8f1ff;
  --topbar-muted: #a9bbd3;
  --shadow: 0 1px 2px rgba(15, 26, 42, 0.06), 0 1px 3px rgba(15, 26, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a111c;
    --surface: #121c2b;
    --surface-2: #1a2638;
    --border: #273650;
    --text: #e6edf7;
    --muted: #9aabc2;
    --accent: #4cc3f5;
    --accent-text: #04111f;
    --accent-soft: #11304a;
    --danger: #ff8a80;
    --danger-soft: #3a1618;
    --ok: #6fd28f;
    --warn: #f2c14e;
    --focus: #7dd6ff;
    --dot-ring: rgba(230, 237, 247, 0.6);
    --topbar: #050b14;
    --shadow: none;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-md)/1.5 var(--font);
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-md); }

/* Header: brand and nav. On a phone the nav sits under the brand as
   three equal tabs; from 640px it moves beside it. */

.topbar {
  background: var(--topbar);
  color: var(--topbar-text);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
}
.brand { font-size: var(--text-lg); letter-spacing: 0.01em; }
.brand a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  color: inherit;
  text-decoration: none;
}
.brand img { width: 32px; height: 32px; }

.nav { display: flex; gap: var(--space-1); width: 100%; }
.nav a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: var(--touch);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--topbar-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.nav a:hover { color: var(--topbar-text); background: rgba(255, 255, 255, 0.06); }
.nav a.active { color: var(--topbar-text); background: rgba(76, 195, 245, 0.16); box-shadow: inset 0 -2px 0 #4cc3f5; }
.topbar :focus-visible { outline-color: #7dd6ff; }

@media (min-width: 640px) {
  .nav { width: auto; margin-left: auto; }
  .nav a { flex: 0 0 auto; padding: var(--space-1) var(--space-3); }
}

/* Page body. */

.raidslot {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}
.raidslot > div > * + * { margin-top: var(--space-4); }

.page-title { margin-bottom: var(--space-1); }
.lede { color: var(--muted); margin: 0 0 var(--space-4); }
.hint { color: var(--muted); font-size: var(--text-sm); }
.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}
.back {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-weight: 600;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
  margin: var(--space-4) 0;
}
.card h2, .card h3 { margin-bottom: var(--space-3); }
.empty { color: var(--muted); }

/* Buttons and form controls: 44px targets, 16px text so phones don't zoom. */

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: 600 var(--text-md)/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, button:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-small { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }

input, select {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: var(--text-md)/1.3 var(--font);
}
input::placeholder { color: var(--muted); opacity: 0.8; }
input:focus-visible, select:focus-visible { border-color: var(--focus); }

.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.form-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
.actions { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.actions .btn { width: 100%; }
.input-row { display: flex; flex-direction: column; gap: var(--space-2); }
.officer .field { margin-top: var(--space-4); }
.officer .actions { margin-top: 0; }

@media (min-width: 560px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  .actions .btn { width: auto; }
  .input-row { flex-direction: row; }
  .input-row input { flex: 1; }
}

/* Home: the raid list as tappable rows. */

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.event {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--touch);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.event:hover { border-color: var(--accent); }
.event-title { font-weight: 650; color: var(--accent); }
.event-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.badge {
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.calendar a { overflow-wrap: anywhere; }
.danger-zone { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* Roster: officer tools, composition, then one card per section. */

.composition p { margin: var(--space-1) 0; font-size: var(--text-sm); }
.composition p:first-of-type { font-weight: 600; }

.sections { display: grid; gap: var(--space-4); margin-top: var(--space-4); }
.sections .card { margin: 0; }
@media (min-width: 760px) {
  .sections { grid-template-columns: 1fr 1fr; align-items: start; }
}

.roster { list-style: none; margin: 0; padding: 0; }
.roster li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
}
.roster li:first-child { border-top: 0; padding-top: 0; }
.roster-line { min-width: 0; }

/* A class dot: the WoW colour, ringed so white (Priest) and yellow (Rogue)
   read on light, and dark blue (Shaman) and red (DK) read on dark. */
.class-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--class-color, transparent);
  box-shadow: 0 0 0 1px var(--dot-ring);
  transform: translateY(1px);
}
.class-dot.none { box-shadow: inset 0 0 0 1px var(--border); }

/* Characters and attendance: plain lists of rows. */

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.item-body { flex: 1 1 200px; min-width: 0; }
.item.main { border-color: var(--accent); background: var(--accent-soft); }
.item.outcome-in { border-left: 4px solid var(--ok); }
.item.outcome-bench { border-left: 4px solid var(--warn); }
.item.outcome-absent { border-left: 4px solid var(--danger); }
.summary { font-size: var(--text-lg); font-weight: 650; }

@media (prefers-reduced-motion: no-preference) {
  .btn, button, .event, .nav a { transition: background-color 120ms, border-color 120ms, color 120ms; }
}
