/* Water Tribe - light ice blues to deep navy. */
:root {
  --ice: #f3f8fc;
  --frost: #e6f0f8;
  --mist: #cfe1ef;
  --sky: #8dbde3;
  --tide: #3f86c2;
  --sea: #1d5c96;
  --deep: #0f3a66;
  --night: #0a2342;
  --ink: #0e2135;
  --muted: #557089;
  --line: #d4e3ef;
  --paper: #ffffff;
  --serif: "Marcellus", "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ice);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--sea); text-underline-offset: 2px; }
a:hover { color: var(--deep); }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--tide); outline-offset: 2px; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
main { flex: 1; padding: 36px 0 64px; outline: none; }

/* ---- masthead ---------------------------------------------------------- */
.masthead {
  background: var(--night);
  color: #fff;
  border-bottom: 4px solid var(--sky);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 84px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.brand img { width: 52px; height: 52px; background: #fff; border-radius: 50%; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 27px; letter-spacing: .04em; }
.brand-sub { font-size: 13px; color: var(--sky); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.brand:hover { color: #fff; }

.nav { display: flex; gap: 4px; }
.nav a {
  color: #d9e9f6;
  text-decoration: none;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: #fff; }
.nav a.active { color: #fff; border-bottom-color: var(--sky); }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #3b5d82;
  color: #fff;
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
}

/* ---- headings & text --------------------------------------------------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--night); line-height: 1.2; }
h1 { font-size: 40px; margin: 0 0 6px; }
h2 { font-size: 26px; margin: 40px 0 14px; }
h3 { font-size: 20px; margin: 26px 0 10px; }
.lede { color: var(--muted); margin: 0 0 28px; max-width: 62ch; }
.page-head { border-bottom: 1px solid var(--line); margin-bottom: 28px; padding-bottom: 14px; }
.eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--tide); font-weight: 700; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

.prose { max-width: 70ch; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 4px 0; }
.prose blockquote { margin: 18px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--sky); color: var(--muted); }
.prose table { border-collapse: collapse; margin: 16px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 7px 14px 7px 0; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

/* structure page: every h2 starts a tier */
.structure h2 {
  font-size: 22px;
  margin: 34px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.structure h2:first-child { border-top: 0; padding-top: 0; }
.structure ul { list-style: none; padding: 0; }
.structure li { padding: 7px 0 7px 16px; border-left: 3px solid var(--mist); margin: 0; }
.structure li strong { color: var(--night); }

/* ---- home -------------------------------------------------------------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; }
.home-hero { display: flex; gap: 22px; align-items: center; margin-bottom: 18px; }
.home-hero img { width: 112px; height: 112px; flex: none; }
.home-hero h1 { font-size: 46px; }
.side-block { border-top: 3px solid var(--night); padding-top: 12px; margin-bottom: 36px; }
.side-block h2 { font-size: 20px; margin: 0 0 8px; }
.side-block .more { font-size: 15px; font-weight: 600; }
.mini-raid { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-raid .who { font-weight: 600; }
.mini-raid .when, .mini-raid .how { font-size: 14px; color: var(--muted); }
.mini-raid .how { text-align: right; }

/* ---- tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper); }
table.data { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.data th {
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--frost);
  padding: 10px 12px;
  border-bottom: 1px solid var(--mist);
  white-space: nowrap;
}
.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data tr:last-child td { border-bottom: 0; }
.data .r { text-align: right; font-variant-numeric: tabular-nums; }
.data th.r { text-align: right; }
.data th button {
  all: unset;
  cursor: pointer;
  color: inherit;
}
.data th button:hover { color: var(--deep); }
.data th[aria-sort] { color: var(--deep); }
.data th[aria-sort="descending"] button::after { content: " \2193"; }
.data th[aria-sort="ascending"] button::after { content: " \2191"; }
.data .rank { color: var(--muted); width: 1%; }
.data tbody tr.clickable { cursor: pointer; }
.data tbody tr.clickable:hover td { background: #f7fbfe; }
.data tr.open td { background: var(--frost); }
.data .detail-cell { background: #fbfdff; padding: 18px 16px 22px; }
.won { font-weight: 700; color: var(--night); }
.lost { color: var(--muted); }
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid var(--sky);
  color: var(--sea);
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: 1px;
}
.player-link { all: unset; cursor: pointer; color: var(--sea); font-weight: 600; }
.player-link:hover { text-decoration: underline; }

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.side-title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 6px; font-family: var(--serif); font-size: 18px; color: var(--night); }
.side-title span { font-family: var(--sans); font-size: 14px; color: var(--muted); }
.sides .data { font-size: 14.5px; }
.sides .data td, .sides .data th { padding: 6px 8px; }

.bar { height: 6px; background: var(--frost); min-width: 80px; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--sea); }

/* ---- raid toolbar ------------------------------------------------------ */
.tabs-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--mist); margin-bottom: 22px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--deep); }
.tabs button[aria-selected="true"] { color: var(--night); border-bottom-color: var(--sea); }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--mist);
  background: var(--paper);
  padding: 6px 12px;
  margin-bottom: 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--deep);
}
.toggle::before { content: ""; width: 12px; height: 12px; border: 1.5px solid var(--sea); border-radius: 2px; }
.toggle[aria-pressed="true"] { background: var(--frost); border-color: var(--sky); }
.toggle[aria-pressed="true"]::before { background: var(--sea); box-shadow: inset 0 0 0 2px var(--paper); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input, .filters select {
  border: 1px solid var(--mist);
  background: var(--paper);
  padding: 7px 10px;
  border-radius: 3px;
  font-size: 15px;
}
.filters input[type="search"] { min-width: 220px; }

.notice { border-left: 4px solid var(--tide); background: var(--paper); padding: 10px 16px; margin: 0 0 22px; font-size: 15.5px; }
.notice.warn { border-left-color: #b7791f; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--paper); border: 1px dashed var(--mist); }

/* ---- player page ------------------------------------------------------- */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 1px solid var(--line); background: var(--paper); margin: 8px 0 26px; }
.stat-strip div { padding: 14px 16px; border-right: 1px solid var(--line); }
.stat-strip div:last-child { border-right: 0; }
.stat-strip b { display: block; font-size: 26px; font-weight: 600; color: var(--night); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-strip span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chart { background: var(--paper); border: 1px solid var(--line); padding: 12px 12px 4px; margin-bottom: 26px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font: 12px var(--sans); fill: var(--muted); }

/* ---- gallery ----------------------------------------------------------- */
.gallery { columns: 3 280px; column-gap: 18px; }
.gallery figure { margin: 0 0 18px; break-inside: avoid; background: var(--paper); border: 1px solid var(--line); }
.gallery button { all: unset; cursor: zoom-in; display: block; }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption { padding: 8px 12px 10px; font-size: 15px; color: var(--muted); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); }
.lightbox::backdrop { background: rgba(6, 22, 42, .88); }
.lightbox img { display: block; max-height: 82vh; width: auto; margin: 0 auto; }
.lightbox p { color: #e3eff8; text-align: center; margin: 10px 0 0; }
.lightbox form { text-align: right; }
.lightbox-close { background: none; border: 1px solid #6d8fb0; color: #fff; padding: 4px 12px; margin-bottom: 8px; cursor: pointer; border-radius: 3px; }

/* ---- footer ------------------------------------------------------------ */
.footer { background: var(--night); color: #a9c7e2; font-size: 14px; }
.footer-inner { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; padding: 18px 0; }
.footer a { color: #d6e8f6; }

/* ---- small screens ----------------------------------------------------- */
@media (max-width: 860px) {
  .home-grid, .sides { grid-template-columns: 1fr; gap: 28px; }
  h1 { font-size: 32px; }
  .home-hero h1 { font-size: 36px; }
  .home-hero img { width: 84px; height: 84px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .masthead-inner { flex-wrap: wrap; min-height: 72px; padding: 10px 0; }
  .brand img { width: 42px; height: 42px; }
  .brand-name { font-size: 23px; }
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav a { border-bottom: 0; border-left: 3px solid transparent; }
  .nav a.active { border-left-color: var(--sky); }
  .hide-sm { display: none; }
}
