/* ==========================================================================================
   BitMEX wind-down site — shared stylesheet
   ==========================================================================================

   The design tokens below are lifted verbatim from index.html, which is the visual reference
   for the whole site. index.html keeps its own inline copy of them: it is a standalone splash
   page that must render even if this file 404s, so the duplication is deliberate. If you
   change a token here, change it there too.

   Layout vocabulary used by the content pages:

     .wrap         780px centred column, flex, fills viewport height
     header        site logo, with an optional .header-login opposite it
     .banner       persistent anti-scam warning (amber). Every page except /law-enforcement
     .kicker       mono uppercase eyebrow / dateline above or below an h1
     .lede         17px standfirst in full-brightness text
     .section      h2 + prose block, separated by a hairline rule
     .callout      boxed aside. .callout.warn for the amber scam variant
     .cta          pill button. .cta.secondary for the outline variant, .cta.light for the
                   splash page's white one, .cta-row to pair them
     .linklist     the "quick links" / index-of-documents pattern (.label .desc .arrow).
                   .desc stacks under .label by default (a sentence, as on /legal).
                   .desc.inline sits beside .label instead (a short value, as on /contact)
     .timeline     dated rows, a fixed-width .when beside a .what. Used for milestones and
                   for the post list on /blog
     ol.steps      numbered steps with circled counters. Must be an ol, not a ul
     .table-scroll required wrapper around any table. See the tables section below
     .socials      footer-only row of social icons. Each <a> needs an aria-label
     .faq          <details> accordion used on the FAQ page
     footer        copyright, centered links and social icons above language links
     .entity       the HDR Global legal line, dimmer than body text
     main.post     set on a blog post's <main>, and nothing else. Reads at 720px rather than
                   this site's own 620px, matching the live blog's column before closure

   Note h2 renders as a mono section heading in full-brightness text. Use h3 for a sub-heading
   inside a section.

   ========================================================================================== */

:root {
  /* The browser's default canvas is light, so without this every navigation flashes white
     before this stylesheet paints. */
  color-scheme: dark;

  --bg: #0a0b0d;
  --red: #ff0201;
  --blue: #125bff;
  --blue-hover: #3e77ff;
  --text: #f4f5f7;
  --text-dim: #7a7f8a;
  --line: #202329;
  --line-soft: #292d35;
  --amber: #ffb454;
  --panel: #14161a;
  --sans: Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  padding: 36px;
  /* Softer and higher than the splash page's glow: on a long scrolling document a centred
     ellipse would sit arbitrarily in the middle of the prose. */
  background-image: radial-gradient(
    ellipse 70% 30% at 50% 0%,
    rgba(18, 91, 255, 0.07),
    transparent 70%
  );
  background-repeat: no-repeat;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

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

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* Wraps an <img>, so the generic `a { border-bottom }` rule would draw a rule under the
   logomark. Reset it here rather than relying on selector order. */
.logo,
.logo:hover {
  display: block;
  line-height: 0;
  border-bottom: none;
}

.logo img,
.logo svg {
  height: 24px;
  width: auto;
  display: block;
}

/* Sits opposite the logo, so a visitor who lands deep in the site from a search result can reach
   their account without going back to the splash. */
.header-login {
  flex: none;
  padding: 8px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

.header-login:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* --- anti-scam banner -------------------------------------------------------------------- */

/* Specified as persistent and site-wide in the homepage content doc. Rendered on every page
   so it survives a visitor landing deep in the site from a search result. */
.banner {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 180, 84, 0.25);
  background: rgba(255, 180, 84, 0.07);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #e8d5b5;
}

.banner .icon {
  color: var(--amber);
  flex: none;
  font-size: 14px;
  line-height: 1.5;
}

.banner a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 180, 84, 0.4);
}

.banner a:hover {
  border-bottom-color: var(--amber);
}

/* --- main / page head -------------------------------------------------------------------- */

main {
  flex: 1;
  padding: 56px 0 70px;
}

.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
  color: var(--text);
}

h1 u {
  text-decoration: none;
  border-bottom: 4px solid var(--blue);
}

.lede {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 14px;
  max-width: 620px;
}

p {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-dim);
  margin: 0 0 14px;
  max-width: 620px;
}

a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(18, 91, 255, 0.4);
}

a:hover {
  color: var(--blue-hover);
  border-bottom-color: var(--blue-hover);
}

strong {
  color: var(--text);
  font-weight: 600;
}

/* --- tables ------------------------------------------------------------------------------ */

.table-scroll {
  margin: 0 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: auto;
  font-size: 14.5px;
  line-height: 1.6;
}

th,
td {
  border: 1px solid var(--line);
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

td {
  color: var(--text-dim);
}

th,
table > tbody:first-child > tr:first-child > td {
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- sections ---------------------------------------------------------------------------- */

.section {
  border-top: 1px solid var(--line);
  padding-top: 30px;
  margin-top: 36px;
}

.section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

h2 {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 18px;
}

h3 {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 26px 0 10px;
}

ul,
ol {
  margin: 0 0 14px;
  padding-left: 20px;
  max-width: 620px;
}

li {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-dim);
  margin-bottom: 8px;
}

li::marker {
  color: var(--line-soft);
}

/* Numbered steps, e.g. the homepage's how-to-withdraw list. */
ol.steps {
  list-style: none;
  padding-left: 0;
  counter-reset: step;
}

ol.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 38px;
  margin-bottom: 13px;
  color: var(--text);
}

ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- callout ----------------------------------------------------------------------------- */

.callout {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 22px 24px;
  margin: 24px 0;
  max-width: 620px;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout h3 {
  margin-top: 0;
}

/* Marks the pinned post on /blog. Replaces a "Pinned" heading, so it carries the label as its
   accessible name. */
.pin {
  width: 14px;
  height: 14px;
  fill: var(--text-dim);
  vertical-align: -1px;
  margin-right: 7px;
}

.callout.warn {
  border-color: rgba(255, 180, 84, 0.25);
  background: rgba(255, 180, 84, 0.05);
}

.callout.warn h3 {
  color: var(--amber);
}

/* --- CTA --------------------------------------------------------------------------------- */

.cta {
  display: inline-block;
  margin-top: 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  font-family: var(--sans);
  text-decoration: none;
  border: none;
  padding: 16px 32px;
  border-radius: 4px;
  cursor: pointer;
}

.cta:hover {
  background: var(--blue-hover);
  color: #fff;
}

/* The splash page's white button, for the one CTA that repeats its call to action. */
.cta.light {
  background: #fff;
  color: #080808;
}

.cta.light:hover {
  background: #eaecef;
  color: #080808;
}

.cta.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.cta.secondary:hover {
  border-color: #3a3f4a;
  background: transparent;
  color: var(--text);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* --- link list --------------------------------------------------------------------------- */

.linklist {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  max-width: 620px;
}

.linklist:last-child {
  margin-bottom: 0;
}

.linklist li {
  margin: 0;
  border-top: 1px solid var(--line);
}

.linklist li:last-child {
  border-bottom: 1px solid var(--line);
}

.linklist a {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 4px 14px;
  padding: 15px 4px;
  border-bottom: none;
  color: var(--text);
}

.linklist a:hover {
  color: var(--blue);
}

.linklist a:hover .arrow {
  color: var(--blue);
  transform: translateX(3px);
}

.linklist .label {
  grid-column: 1;
  font-size: 15.5px;
  font-weight: 500;
}

.linklist .desc {
  grid-column: 1;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}

.linklist .desc.inline {
  grid-column: 2;
  grid-row: 1;
}

.linklist .arrow {
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: center;
  color: var(--line-soft);
  font-family: var(--mono);
  transition: transform 0.12s ease;
}

/* --- timeline (wind-down milestones) ----------------------------------------------------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  max-width: none;
}

.timeline li {
  display: flex;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  margin: 0;
  align-items: baseline;
}

.timeline li:last-child {
  border-bottom: 1px solid var(--line);
}

.section.no-rule {
  border-top: 0;
  padding-top: 0;
}

.timeline .when {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  flex: none;
  width: 170px;
  line-height: 1.6;
}

.timeline .what {
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.65;
}

/* --- FAQ accordion ----------------------------------------------------------------------- */

/* <details> rather than JS: no build step, works with the page's own find-in-page, and
   degrades to plain expanded text if the browser is ancient. */
.faq {
  max-width: 620px;
}

.faq details {
  border-top: 1px solid var(--line);
}

.faq details:last-of-type {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  padding: 16px 26px 16px 0;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
  position: relative;
  list-style: none;
  line-height: 1.6;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '+';
  position: absolute;
  right: 2px;
  top: 15px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text-dim);
}

.faq details[open] summary {
  color: var(--blue);
}

.faq details[open] summary::after {
  content: '\2013';
  color: var(--blue);
}

.faq summary:hover {
  color: var(--blue);
}

.faq details > *:not(summary) {
  margin-left: 0;
}

.faq details p:last-child {
  margin-bottom: 18px;
}

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

footer {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px 24px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-dim);
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}

footer a:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.footer-links {
  text-align: center;
}

.footer-links a {
  white-space: nowrap;
}

.socials {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-top: 4px;
}

.socials a {
  border-bottom: 0;
  display: inline-flex;
  color: var(--text-dim);
}

.socials svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  display: block;
}

.socials a:hover {
  color: var(--blue);
}

.entity {
  margin-top: 18px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #5c616b;
  max-width: none;
}

/* --- blog post body ----------------------------------------------------------------------- */

main.post p,
main.post .lede,
main.post ul,
main.post ol,
main.post .callout,
main.post .linklist {
  max-width: 720px;
}

/* A post's h2 sits directly in <main>, so it gets none of .section's separating margin and would
   otherwise crowd the paragraph above it. */
main.post > h2 {
  margin-top: 42px;
}

/* --- responsive -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .banner .icon {
    display: none;
  }

  body {
    padding: 22px 18px;
  }

  main {
    padding: 40px 0 52px;
  }

  .timeline li {
    flex-direction: column;
    gap: 4px;
  }

  .timeline .when {
    width: auto;
  }

  .linklist a {
    grid-template-columns: 1fr;
  }

  .linklist .desc.inline {
    grid-column: 1;
    grid-row: 2;
  }

  .linklist .arrow {
    display: none;
  }

  th,
  td {
    padding: 8px 11px;
  }

  table {
    font-size: 13.5px;
  }

  footer {
    grid-template-columns: 1fr auto;
  }

  .footer-links {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .socials {
    grid-column: 2;
    grid-row: 1;
  }
}

.language-switcher {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
