/*
 * Briggs server site.
 * Plan: deepslate ground, bone text, one verdigris accent (oxidized copper).
 * Two type roles: a DIN signage face for words, a console mono for things you type.
 * One motif: the pixel step (stepped skyline under the header, notched corners on the address plate).
 */

:root {
  /* color tokens */
  --ground: #1d1f23;        /* deepslate, the page */
  --ground-raised: #272a30; /* header band, address plate */
  --ground-sunk: #17181b;   /* status strip inside the plate */
  --ink: #ece7dc;           /* bone, main text */
  --ink-soft: #aaa69d;      /* secondary text */
  --seam: #3a3e45;          /* block seams, empty bars, fallback heads */
  --verdigris: #7cc4a6;     /* the one accent: links, online, the copy button */
  --verdigris-deep: #4c8a72;/* the copy button's block edge */
  --redstone: #e8907a;      /* offline state only */

  /* type roles */
  --font-sign: Bahnschrift, "DIN Alternate", "DIN Next", "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-console: "Cascadia Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  /* four sizes, big jumps */
  --size-small: 0.875rem;
  --size-body: 1.0625rem;
  --size-mid: clamp(1.25rem, 1rem + 1.4vw, 1.75rem);
  --size-big: clamp(2.75rem, 1.4rem + 7vw, 5rem);

  /* rhythm: body line height is 1.5 x 17px; spacing works in halves and wholes of it */
  --unit: 1.5rem;
  --gutter: 1rem;

  --press: 120ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sign);
  font-size: var(--size-body);
  line-height: 1.5;
  font-synthesis: none;
  font-variant-numeric: lining-nums;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }

h2 {
  font-size: var(--size-mid);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
  text-wrap: balance;
  margin-bottom: calc(var(--unit) * 0.75);
}

h3 {
  font-size: var(--size-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: calc(var(--unit) * 0.5);
}

a {
  color: var(--verdigris);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

@media (hover: hover) {
  a:hover { text-decoration-thickness: 2px; }
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--ground);
  font-weight: 700;
  z-index: 10;
}
.skip-link:focus { top: var(--gutter); }

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

/* ---------- header band ---------- */

.masthead {
  position: relative;
  background-color: var(--ground-raised);
  /* faint block seams: a 32px stone grid */
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.16) 1px, transparent 1px);
  background-size: 32px 32px;
}

.masthead-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: calc(var(--unit) * 2) var(--gutter) calc(var(--unit) * 1.5);
}

.ident {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-slot { display: none; }
.logo-slot.has-image { display: block; flex: none; }
.logo {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  background: var(--ground-sunk);
}

.site-name {
  font-size: var(--size-big);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
  min-width: 0;
}

.tagline {
  max-width: 34em;
  margin-top: calc(var(--unit) * 0.75);
  color: var(--ink-soft);
  font-size: var(--size-body);
  text-wrap: pretty;
}

.watch { margin-top: var(--unit); }

.watch-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.watch-link {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--verdigris);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.25;
}
@media (hover: hover) {
  .watch-link:hover { background: rgba(124, 196, 166, 0.14); }
}

.banner-slot.has-image { line-height: 0; }
.banner {
  display: block;
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
}

/* The stepped skyline: the ground rises into the header in 8px blocks. */
.masthead::after {
  content: "";
  display: block;
  height: 32px;
  margin-top: -1px;
  background: var(--ground);
  clip-path: polygon(
    0 100%, 0 50%, 7% 50%, 7% 25%, 12% 25%, 12% 50%, 22% 50%, 22% 75%,
    30% 75%, 30% 50%, 41% 50%, 41% 25%, 58% 25%, 58% 50%, 66% 50%, 66% 75%,
    79% 75%, 79% 50%, 86% 50%, 86% 25%, 93% 25%, 93% 50%, 100% 50%, 100% 100%
  );
}

/* ---------- page layout ---------- */

.layout {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--unit) var(--gutter) calc(var(--unit) * 2);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: calc(var(--unit) * 2.5);
}

.prose, .rule-list, .schedule-list { max-width: 36em; }
.prose > * + * { margin-top: calc(var(--unit) * 0.75); }

/* Two columns once there is room for a full measure plus the roster.
   The last row is 1fr so a long roster grows that row, not the gaps between sections. */
@media (min-width: 60rem) {
  .layout {
    grid-template-columns: minmax(0, 38rem) minmax(16rem, 1fr);
    grid-template-rows: repeat(5, auto) 1fr;
    column-gap: calc(var(--unit) * 3);
  }
  .layout > section { grid-column: 1; }
  .layout > .players {
    grid-column: 2;
    grid-row: 1 / 7;
    align-self: start;
  }
}

/* ---------- the address plate ---------- */

.plate {
  background: var(--ground-raised);
  clip-path: polygon(
    0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px)
  );
}

.plate-address { padding: calc(var(--unit) * 0.75 + 8px) 1.25rem var(--unit); }

.label {
  font-size: var(--size-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.address {
  margin-top: 0.25rem;
  font-family: var(--font-console);
  font-size: clamp(1.125rem, 0.75rem + 2.6vw, 1.75rem);
  line-height: 1.3;
  font-weight: 400;
}
.address code {
  font: inherit;
  -webkit-user-select: all;
  user-select: all;
}

.copy-row {
  margin-top: calc(var(--unit) * 0.75);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.copy-btn {
  appearance: none;
  border: 0;
  border-radius: 0;
  margin: 0 0 4px;
  min-height: 2.75rem;
  min-width: 9.5rem;
  padding: 0.625rem 1.125rem;
  background: var(--verdigris);
  color: var(--ground);
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--verdigris-deep);
  transition: transform var(--press);
}
.copy-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--verdigris-deep);
}

.copy-msg {
  font-size: var(--size-small);
  color: var(--ink);
  min-width: 0;
  flex: 1 1 12rem;
}
.copy-msg:empty { display: none; }

/* status strip, laid out like a row in the multiplayer server list */
.status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.875rem;
  row-gap: 0.5rem;
  align-items: start;
  padding: calc(var(--unit) * 0.75) 1.25rem calc(var(--unit) * 0.75 + 8px);
  background: var(--ground-sunk);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  margin-top: 3px;
}
.bars span {
  width: 4px;
  background: var(--seam);
}
.bars span:nth-child(1) { height: 6px; }
.bars span:nth-child(2) { height: 10px; }
.bars span:nth-child(3) { height: 14px; }
.bars span:nth-child(4) { height: 18px; }

.plate[data-state="online"] .bars span { background: var(--verdigris); }
.plate[data-state="offline"] .bars span:nth-child(1) { background: var(--redstone); }

.status-line { font-weight: 700; }
.plate[data-state="online"] .status-line { color: var(--verdigris); }
.plate[data-state="offline"] .status-line { color: var(--redstone); }

.status-detail {
  font-size: var(--size-small);
  color: var(--ink-soft);
}
.status-detail:empty { display: none; }

.status-facts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--seam);
}
.status-facts div { display: flex; gap: 0.5rem; align-items: baseline; }
.status-facts dt {
  font-size: var(--size-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.status-facts dd {
  font-family: var(--font-console);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 40rem) {
  .status { grid-template-columns: auto minmax(0, 1fr) auto; }
  .status-facts {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    padding-top: 0;
    border-top: 0;
    text-align: right;
  }
}

/* ---------- join steps ---------- */

.steps-block { margin-top: calc(var(--unit) * 1.25); }

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  max-width: 36em;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
  min-height: 1.75rem;
}
.steps li + li { margin-top: calc(var(--unit) * 0.5); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.625rem;
  height: 1.625rem;
  display: grid;
  place-items: center;
  font-family: var(--font-console);
  font-size: var(--size-small);
  line-height: 1;
  color: var(--ground);
  background: var(--ink-soft);
}

/* ---------- roster ---------- */

.roster-count {
  font-family: var(--font-console);
  font-size: var(--size-small);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: calc(var(--unit) * -0.5);
  margin-bottom: calc(var(--unit) * 0.75);
}
.roster-count:empty { display: none; }

.roster {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.75rem 1rem;
}
@media (min-width: 60rem) {
  .roster { grid-template-columns: minmax(0, 1fr); gap: 0.625rem; }
}

.roster li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas: "head name" "head tag";
  column-gap: 0.75rem;
  align-items: center;
  min-height: 40px;
}

.head {
  grid-area: head;
  display: block;
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  background: var(--seam);
}
.head-fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-console);
  font-weight: 700;
  color: var(--ink);
}

.player-name {
  grid-area: name;
  font-family: var(--font-console);
  font-size: 0.9375rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  align-self: end;
}
.roster li:not(.is-online) .player-name { grid-row: 1 / 3; align-self: center; }

.online-tag {
  grid-area: tag;
  align-self: start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--verdigris);
}

.roster li.is-online .head { box-shadow: 0 0 0 2px var(--verdigris); }

.roster-msg {
  color: var(--ink-soft);
  max-width: 30em;
}
.roster-msg:empty { display: none; }

/* ---------- rules and schedule ---------- */

.rule-list, .schedule-list {
  padding-left: 1.25rem;
}
.rule-list li + li, .schedule-list li + li { margin-top: calc(var(--unit) * 0.375); }
.rule-list li::marker, .schedule-list li::marker { color: var(--verdigris); }

/* ---------- footer ---------- */

.foot {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--unit) var(--gutter) calc(var(--unit) * 2);
  border-top: 1px solid var(--seam);
  font-size: var(--size-small);
  color: var(--ink-soft);
}
.foot p + p { margin-top: 0.375rem; }

@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
  .copy-btn:active { transform: none; }
}
