/* Echo Hub
   The EML site's layout (site.css) with Echo Hub's own type and color: Chakra Petch for display, IBM Plex
   Sans for text, cool blue-black surfaces, and signal blue in place of EML orange as the accent. The accent
   keeps its site.css variable names (--orange, --orange-text) so every component picks it up. */

:root {
  --bg: #0d1117;
  --bg-deep: #090c11;
  --surface: #141a22;
  --surface-2: #1a222c;
  --surface-th: #121820;
  --line: #26303c;
  --line-soft: #1d252f;
  --line-strong: #3b4756;
  --hover: #18202a;
  --code-bg: #1d2530;
  --target: #142235;
  --mark-bg: #1d3b63;

  --orange: #2f86eb;
  --orange-text: #6cb0ff;
  --link: #6cb0ff;
  --link-hover: #a3cdff;

  --f-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f2f4f7;
  --bg-deep: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-th: #f7f9fb;
  --line: #d9dee6;
  --line-soft: #e6eaf0;
  --line-strong: #b4bdc9;
  --hover: #eef2f7;
  --code-bg: #eceff4;
  --target: #e8f0fb;
  --mark-bg: #cfe0f7;
  --orange: #1f63c4;
  --orange-text: #1f63c4;
  --link: #1f63c4;
  --link-hover: #174b95;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f4f7;
    --bg-deep: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --surface-th: #f7f9fb;
    --line: #d9dee6;
    --line-soft: #e6eaf0;
    --line-strong: #b4bdc9;
    --hover: #eef2f7;
    --code-bg: #eceff4;
    --target: #e8f0fb;
    --mark-bg: #cfe0f7;
    --orange: #1f63c4;
    --orange-text: #1f63c4;
    --link: #1f63c4;
    --link-hover: #174b95;
  }
}

/* Chakra Petch is wider than the EML condensed face and tops out at 700, so headings run a size smaller. */
.hub h1, .hub h2, .hub h3 { font-weight: 700; }
.hub .page-head h1 { font-size: clamp(38px, 6.4vw, 72px); letter-spacing: 0; }
.hub .hero h1 { font-size: clamp(46px, 8vw, 96px); line-height: 0.95; letter-spacing: 0; }

/* Near-black on the dark theme's blue and white on the light theme's darker blue, both above 4.5:1. The nav
   link color would otherwise win over the button text in the header. */
.btn-primary, .btn-primary:hover, .site-nav .btn-primary, .site-nav .btn-primary:hover { color: #0b0f14; }
.btn-primary:hover { background: #6cb0ff; }
:root[data-theme="light"] .btn-primary, :root[data-theme="light"] .site-nav .btn-primary,
:root[data-theme="light"] .btn-primary:hover, :root[data-theme="light"] .site-nav .btn-primary:hover { color: #ffffff; }
:root[data-theme="light"] .btn-primary:hover { background: #174b95; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .btn-primary, :root:not([data-theme="dark"]) .site-nav .btn-primary,
  :root:not([data-theme="dark"]) .btn-primary:hover, :root:not([data-theme="dark"]) .site-nav .btn-primary:hover { color: #ffffff; }
  :root:not([data-theme="dark"]) .btn-primary:hover { background: #174b95; }
}

/* Mark and wordmark */
.hub-mark { width: 34px; height: 34px; flex-shrink: 0; color: var(--text); }
.hub-mark .notch { fill: var(--orange); }
.hub .brand-name { font-family: var(--f-display); font-weight: 700; font-size: 21px; letter-spacing: 0.04em; text-transform: uppercase; }
.footer-brand .hub-mark { width: 44px; height: 44px; }

/* Home: channels panel */
.channel-list { list-style: none; margin: 0; padding: 0; }
.channel-list li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.channel-list li:first-child { border-top: 0; padding-top: 2px; }
.channel-list .ch { font: 500 14px/1.2 var(--f-mono); color: var(--orange-text); }
.channel-list li > span:last-child { font-size: 15px; color: var(--text-2); }

/* Home: the three things the hub does */
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 860px) { .pillars { grid-template-columns: minmax(0, 1fr); } }
.pillar { padding: 22px 22px 20px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--orange); display: flex; flex-direction: column; gap: 10px; }
.pillar-n { margin: 0; font: 500 12px/1 var(--f-mono); letter-spacing: 0.1em; color: var(--muted); }
.pillar h2 { margin: 0; font: 700 26px/1.1 var(--f-display); text-transform: uppercase; }
.pillar > p:not(.pillar-n) { margin: 0; color: var(--text-2); flex: 1; }
.pillar a { font-weight: 600; }
/* Each card's picture, in a band across its top: the logos of teams with open spots, the newest cast, the
   arena (app.js fills the first two and leaves a band out when its data is missing). */
.pillar-art { min-height: 108px; margin: -22px -22px 4px; padding: 16px 22px; display: flex; flex-direction: column; justify-content: center; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.pillar-arena { color: var(--muted); }
.pillar-arena svg { height: 76px; }
.pillar-cast { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 14px; align-items: center; color: var(--text); text-decoration: none; }
.pillar-cast .cast-meta { margin-top: 0; }
.pillar-cast .cast-title { font-size: 18px; }
.pillar-cast-when { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; color: var(--muted); }
.pillar-cast:hover .cast-thumb, .pillar-cast:focus-visible .cast-thumb { border-color: var(--orange); }
.pillar-cast:hover .cast-play, .pillar-cast:focus-visible .cast-play { background: var(--orange); color: #111; }
.pillar-cast:hover .cast-title { color: var(--orange-text); }

/* Home: teams with open spots */
.spot-list { list-style: none; margin: 0; padding: 0; }
.spot-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5em 4.5em;
  align-items: center;
  column-gap: 14px;
  row-gap: 2px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
}
.spot-list li:first-child { border-top: 0; }
.spot-list .tname a { font: 700 17px/1.15 var(--f-display); color: var(--text); text-decoration: none; }
.spot-list .tname a:hover { color: var(--orange-text); }
.spot-open { font: 600 13px/1 var(--f-mono); color: var(--orange-text); white-space: nowrap; }
.spot-cap { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.spot-cap a { color: var(--text-2); }
/* Home: teams that lost a player this week, under the open spots. */
#hub-lost { margin-top: 18px; }
#hub-lost .note { margin-bottom: 0; }

/* Players looking for a team: a roster player whose switch is still on reads quieter, and each card says
   when its profile last changed. */
.profile-onteam strong { color: var(--muted); }
.profile-updated { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Hub rules */
.hub-rules { list-style: none; margin: 0; padding: 0; counter-reset: rule; }
.hub-rules li {
  counter-increment: rule;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  font: 600 19px/1.3 var(--f-display);
}
.hub-rules li:first-child { border-top: 0; }
.hub-rules li::before { content: counter(rule, decimal-leading-zero); font: 500 13px/1 var(--f-mono); color: var(--orange-text); }

/* VOD library */
.vod-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); row-gap: 26px; }
/* A library card holds several links (YouTube, both teams, the match), so it is a box, not one link. */
.vod-card { min-width: 0; }
.vod-card .cast-thumb:hover, .vod-card .cast-thumb:focus-visible { border-color: var(--orange); }
.vod-card .cast-thumb:hover .cast-play, .vod-card .cast-thumb:focus-visible .cast-play { background: var(--orange); color: #111; }
.vod-card .cast-title a { color: var(--text); text-decoration: none; }
.vod-card .cast-title a:hover { color: var(--orange-text); text-decoration: underline; }
.vod-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; font-size: 13px; }
.vod-act { padding: 0; border: 0; background: none; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.vod-act:hover { color: var(--link-hover); }
/* Play here: the player sits above the list, so the filters stay in reach. */
.vod-player { margin: 0 0 22px; scroll-margin-top: 90px; }
.vod-player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; max-width: 960px; }
.vod-player-head strong { font: 700 18px/1.2 var(--f-display); overflow-wrap: anywhere; }
.vod-note { margin: 0 0 10px; }
/* Player POVs, above the library. */
.pov-intro { margin: -6px 0 20px; color: var(--muted); }
.pov-teams { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
#pov-add { margin-top: 30px; }
#pov-add .note { margin: 0 0 12px; }
.pov-add-head { margin: 0 0 12px; font: 700 20px/1.2 var(--f-display); }
.pov-form { align-items: end; }
.pov-form select { max-width: 100%; }

/* Get better */
.steps-tight li { padding-bottom: 14px; }


/* Phones: the wordmark is longer than "EML", so the header tightens to keep every button on screen. */
@media (max-width: 480px) {
  .hub .header-inner { --hdr-gap: 10px; }
  .hub .brand { gap: 8px; }
  .hub .brand-name { font-size: 16px; letter-spacing: 0.02em; }
  .hub .hub-mark { width: 28px; height: 28px; }
  .hub .search-toggle, .hub .theme-toggle { margin-left: 4px; }
  .hub .nav-toggle { padding: 9px 10px; }
}

/* Post templates: fields on the left, the post as it will read on the right. */
.tpl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 28px;
  margin-top: 22px;
  padding: 22px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  scroll-margin-top: 90px;
}
.tpl-head { grid-column: 1 / -1; }
.tpl-head h2 { margin: 0 0 6px; font: 700 28px/1.1 var(--f-display); text-transform: uppercase; }
.tpl-head p { margin: 0; color: var(--text-2); }
.tpl-head .ch { font: 500 14px/1 var(--f-mono); color: var(--orange-text); margin-right: 6px; }
.tpl-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; align-content: start; }
.tpl-fields .field { min-width: 0; }
.tpl-fields .field.wide { grid-column: 1 / -1; }
.tpl-fields input, .tpl-fields select, .tpl-fields textarea { width: 100%; box-sizing: border-box; }
.tpl-fields textarea { resize: vertical; font: inherit; }
.tpl-out { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tpl-label { margin: 0; font: 600 11px/1 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tpl-preview {
  margin: 0;
  flex: 1;
  min-height: 132px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  font: 400 14px/1.6 var(--f-mono);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tpl-ph { color: var(--faint); }
.tpl-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Time maker */
.tm-zone { grid-column: 1 / -1; margin: 0; }
.tm-codes { list-style: none; margin: 0; padding: 0; }
.tm-codes li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "style btn" "show btn" "code btn";
  column-gap: 14px;
  row-gap: 3px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.tm-codes li:first-child { border-top: 0; padding-top: 0; }
.tm-style { grid-area: style; font: 600 11px/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tm-show { grid-area: show; font: 600 17px/1.2 var(--f-display); color: var(--text); }
.tm-codes code { grid-area: code; justify-self: start; font: 400 13px/1.4 var(--f-mono); color: var(--orange-text); background: var(--bg-deep); padding: 2px 6px; }
.tm-codes .btn { grid-area: btn; }

@media (max-width: 860px) {
  .tpl { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 20px; }
}
@media (max-width: 480px) {
  .tpl-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Home: the templates link sits at the right of the channels panel heading. */
#channels h2 { display: flex; justify-content: space-between; gap: 12px; }
#channels h2 a { color: var(--orange-text); text-decoration: none; }
#channels h2 a:hover { text-decoration: underline; }

/* Home hero: the text starts level with the channels panel, headed by the hub mark. */
.hub-hero .hero-inner { align-items: start; }
.hub-hero .hero-inner > div:first-child { padding-top: 24px; }
.hub-hero-mark .hub-mark { width: 72px; height: 72px; margin-bottom: 22px; display: block; }
@media (max-width: 860px) { .hub-hero .hero-inner > div:first-child { padding-top: 0; } .hub-hero-mark .hub-mark { width: 56px; height: 56px; margin-bottom: 16px; } }
/* Under the buttons, a faint line drawing of the arena from above (_build/arena-svg.mjs) fills the rest of the
   text column, as tall as the channels panel beside it leaves room for. Phones stack the two, so it is left out. */
.hub-hero .hero-inner > div:first-child { align-self: stretch; display: flex; flex-direction: column; }
.hero-arena { position: relative; flex: 1 0 150px; margin-top: 36px; color: var(--muted); opacity: 0.4; pointer-events: none; }
.hero-arena svg { position: absolute; inset: 0; }
@media (max-width: 860px) { .hero-arena { display: none; } }

/* Team directory */
.dir-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.dir-item { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); }
.dir-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dir-rank { font: 500 12px/1 var(--f-mono); color: var(--muted); min-width: 28px; }
.dir-name { flex: 1; min-width: 0; font: 700 19px/1.15 var(--f-display); overflow-wrap: anywhere; }
.dir-name .tname a { color: var(--text); text-decoration: none; }
.dir-name .tname a:hover { color: var(--orange-text); }
.dir-full { font: 500 12px/1 var(--f-mono); color: var(--muted); }
.dir-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0; font-size: 15px; color: var(--text-2); }
.dir-cap { margin: 0; font-size: 14px; color: var(--muted); }
.dir-cap a { color: var(--text-2); }
/* Status tags (lost a player, gone quiet), and the roster name a search matched. */
.dir-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
table.data .team-cell .dir-tags { display: flex; margin-top: 5px; }
/* In the compact list a long tag wraps, so the table fits a phone. */
table.data .team-cell .dir-tags .tag { white-space: normal; }
.dir-found { margin: 0; font-size: 13px; color: var(--text-2); }
.dir-meta .delta-up, .dir-meta .delta-down { font-weight: 600; }
.dir-usual .your-time { margin-top: 3px; }

/* Team pages: a section head with two links (Match history: results and casts). */
.head-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }
/* Team pages: the recruiting links of a team with open spots, under its card. */
.team-recruit h3 { color: var(--orange-text); }

/* Player pages: a free agent's open-spot teams with old teammates, the "Free agent" tag in Played with
   most, and the not-found page's two ways on. */
.old-mates li { padding: 8px 0; }
.old-mates-with { display: block; margin-top: 3px; font-size: 14px; color: var(--text-2); }
table.data .team-cell .tag-fa { margin-left: 8px; vertical-align: 2px; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.state-actions button.btn { font-weight: 600; }
/* Player pages: the profile button ("Log in to make your profile") is longer than "This is me", so it gets its
   own line and Save card image starts the next one. */
.me-box a.me-btn { display: table; margin-bottom: 10px; }
.me-box a.me-btn + .card-save { margin-left: 0; }

/* Menu labels stay on one line: Chakra Petch is wider than the EML font, so the hub uses a little
   less spacing and switches to the Menu button a bit sooner. */
.hub .site-nav > a, .hub .nav-group-btn { white-space: nowrap; font-size: 15px; letter-spacing: 0.03em; padding-inline: 9px; }
@media (max-width: 1320px) and (min-width: 1241px) {
  .hub .site-nav > a, .hub .nav-group-btn { font-size: 14px; padding-inline: 6px; }
  .hub .site-nav .btn { margin-left: 8px; padding-inline: 10px; }
}

/* Get better: the three review steps stack in their half of the page, and the "Ready for EML" cards make
   rows of three; a card left alone on the last row takes the full width. */
.steps-tight { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts-3 .fact:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
}
/* Get better: the reviewers' three lines under the review steps. */
.review-guide-head { margin: 4px 0 8px; font: 700 18px/1.2 var(--f-display); text-transform: uppercase; }
.review-guide { margin: 0; padding-left: 20px; color: var(--text-2); }
.review-guide li { margin: 4px 0; }

/* VOD library on phones: two videos a row, as on the EML home page. */
@media (max-width: 640px) {
  .vod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
}

/* Templates: a field left alone on the last row takes the full width. */
.tpl-fields .field:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Focus rings use the hub's blue in both themes (site.css sets an orange one for EML). */
html:root:not([data-hub-none]) { --focus: var(--orange); }

/* Hub player card: the status word fits the hub's wider display font. */
.pcard-stats .v { font-size: 21px; }

/* Templates: an unpicked select reads like a placeholder, not a value. */
.tpl-fields select:invalid { color: var(--faint); }
.tpl-fields select option { color: var(--text); }

/* Templates: "As Discord shows it" beside the "Your post" label, the character count under the post (in the
   loss red past Discord's 2,000), the scrim partners under the scrim form, and the note after a link started
   a new post. */
.tpl-out-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.tpl-look { margin: 0; font-size: 13px; color: var(--text-2); }
.tpl-preview.is-look { font: 400 15px/1.5 var(--f-body); }
.tpl-preview.is-look strong { font-weight: 700; }
.tpl-stamp { padding: 0 3px; background: var(--code-bg); }
.tpl-count { margin: -4px 0 0; font: 500 12px/1.4 var(--f-mono); color: var(--muted); }
.tpl-count.is-over { color: var(--loss); font-weight: 600; }
.tpl-partners { grid-column: 1 / -1; min-width: 0; }
.tpl-partners:empty { display: none; }
.tpl-partners-head { margin: 4px 0 10px; font: 700 18px/1.2 var(--f-display); text-transform: uppercase; }
.tpl-partners .note { margin-bottom: 0; }
.tpl-aside { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }

/* Start here: the progress line and Start over above the steps, this week's dates in "Learn the week", and the
   join-now box as wide as the steps. */
.start-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; max-width: 820px; }
.start-bar .start-progress { margin: 0; }
.start-now { padding: 8px 12px; border-left: 3px solid var(--orange); background: var(--surface-2); color: var(--text); font-weight: 600; }
.start-steps p.start-now { margin-bottom: 8px; }
.hub[data-page="start"] .join-now { max-width: 820px; box-sizing: border-box; }
/* Start here: the "Want a coach?" box first, since the game's coach invite for new players lands on this page. */
.start-coach { max-width: 820px; box-sizing: border-box; margin: 0 0 24px; padding: 16px 18px; border-left: 3px solid var(--orange); background: var(--surface); }
.start-coach h2 { margin: 0 0 6px; font: 800 18px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; }
.start-coach p { margin: 0 0 14px; color: var(--text-2); }

/* Header search: an Echo Hub profile result shows the player's Discord picture. */
.search-kind.search-profile { border-radius: 50%; overflow: hidden; }
.search-kind.search-profile img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* The header's Log in button says so on wide screens, so it does not read as a second "Join Discord"
   (account.js gives the button its Discord icon and the words "Log in with Discord" for screen readers; the
   empty alternative keeps them from hearing "Log in" twice). */
@media (min-width: 1440px) {
  .hub .account-login { display: inline-flex; gap: 8px; width: auto; padding: 0 12px; font: 600 14px/1 var(--f-body); }
  .hub .account-login::after { content: "Log in"; }
  .hub .account-login::after { content: "Log in" / ""; }
}

/* Track a match (app.js initTrack). */
.track-card { display: grid; gap: 12px; justify-items: start; max-width: 760px; margin-bottom: 30px; }
.track-state { margin: 0; color: var(--muted); }
.track-log { margin: 0; padding: 0; list-style: none; max-height: 260px; overflow-y: auto; font-size: 14px; width: 100%; }
.track-log li { padding: 4px 0; border-top: 1px solid var(--line-soft); }
.track-time { font: 500 12px/1 var(--f-mono); color: var(--muted); }
.lft-posts-head { margin: 26px 0 10px; }

/* Get better: the mechanics videos, a grid of small cards (name, one line, the video link and its creator). */
.mech-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.mech-grid > li { margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); scroll-margin-top: 80px; display: flex; flex-direction: column; }
.mech-grid h3 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 700; font-size: 19px; line-height: 1.15; }
.mech-grid p { margin: 0; font-size: 14px; color: var(--text-2); }
.mech-grid p.mech-link { margin-top: auto; padding-top: 10px; color: var(--muted); }
.mech-grid p.mech-link a { font-weight: 600; }
