/*
 * Shared structure for every brand site. Colours, fonts and the header rule come from custom
 * properties that brands/<brand>/assets/brand.css overrides; nothing here hardcodes a brand.
 *
 * There are no transitions or animations anywhere, so prefers-reduced-motion needs no override.
 */

:root {
  --font-heading: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  --font-weight-heading: 700;
  --font-weight-header-title: 500;

  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #d8d8d8;
  --link: #1a5fb4;
  --accent: #1a5fb4;
  --accent-hover: #164d92;
  --accent-text: #ffffff;
  /* Split out so a brand whose accent is too light to outline against the canvas can override it. */
  --focus: var(--accent);

  --header-bg: #1a1a1a;
  --header-text: #ffffff;
  --header-rule: 0 solid transparent;
  --header-height: 56px;
  --logo-height: 30px;

  --footer-bg: #ffffff;
  --footer-text: #6b6b6b;

  --radius: 8px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
}

a:hover {
  text-decoration: none;
}

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

.site-header :focus-visible {
  outline-color: var(--header-text);
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  line-height: 1.25;
  margin: 0 0 12px;
}

h1 {
  font-size: 1.875rem;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1.125rem;
}

p {
  margin: 0 0 12px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.breakable {
  overflow-wrap: anywhere;
}

/* Header */

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: var(--header-rule);
}

.site-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  min-height: var(--header-height);
  padding: 8px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.site-header__logo {
  height: var(--logo-height);
  width: auto;
}

.site-header__title {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-header-title);
  font-size: 1.0625rem;
}

.language-switch {
  display: flex;
  gap: 16px;
}

.language-switch a {
  color: var(--header-text);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.language-switch a:hover {
  border-bottom-color: var(--header-text);
}

.language-switch a[aria-current='page'] {
  font-weight: var(--font-weight-heading);
  border-bottom-color: var(--accent);
}

/* Content */

.content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.lede {
  font-size: 1.125rem;
  max-width: 60ch;
}

.meta {
  color: var(--text-muted);
}

.subhead {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  margin: 24px 0 8px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0 0;
}

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

.empty {
  color: var(--text-muted);
}

/* Product cards: the whole card is the target, not just the line of link text. */

.card {
  position: relative;
}

.card:hover {
  border-color: var(--text-muted);
}

.card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

/* Guarded: without :has() the ring has to stay on the link itself, or focus goes unseen. */
@supports selector(:has(*)) {
  .card:has(.card__link:focus-visible) {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }

  .card__link:focus-visible {
    outline: none;
  }
}

.note,
.verify {
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 24px;
}

/* Which file do I need? */

.helper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

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

.helper > summary {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  cursor: pointer;
}

.helper .subhead:first-of-type {
  margin-top: 16px;
}

.screenshot {
  margin: 12px 0;
}

.screenshot img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  /* The capture is several times the size it is shown at, so it stays sharp on a dense
     display; this caps what it takes up on a roomy one. */
  max-width: min(37rem, 100%);
}

/* Install */

.install-steps {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

.install-steps li {
  margin-bottom: 8px;
}

/* Releases */

.release {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.release--latest {
  border-top: 0;
  padding-top: 0;
}

.release > summary {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  cursor: pointer;
}

.notes {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

/* Downloads */

.files {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.files li {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0 16px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.files__arch {
  grid-row: 1;
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  /* Matches the padding the filename carries, so the two line up. */
  padding: 10px 0;
}

.files__name {
  grid-row: 1;
  grid-column: 2;
  /* The filename is the row's only target, so it has to be tall enough to hit on its own. */
  display: inline-block;
  padding: 10px 0;
}

.files__meta,
.files__sum {
  grid-column: 2;
}

.files__meta {
  font-size: 0.875rem;
}

/* Footer */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

.site-footer__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 24px;
  font-size: 0.875rem;
}

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

.site-footer a {
  color: inherit;
}

/* Small screens: one column, and each file's details stack under its architecture. */

@media (max-width: 40rem) {
  .content {
    padding: 24px 16px 32px;
  }

  .site-header__inner,
  .site-footer__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .panel {
    padding: 16px;
  }

  .files li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px 0;
  }

  /* Everything stacks, so the placements that pair the architecture with the filename on
     one line have to be given up as well — left in, they would conjure a second column. */
  .files__arch,
  .files__name,
  .files__meta,
  .files__sum {
    grid-row: auto;
    grid-column: 1;
  }

  h1 {
    font-size: 1.5rem;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .language-switch {
    display: none;
  }

  .panel,
  .helper {
    break-inside: avoid;
  }

  details {
    display: block;
  }

  details > *:not(summary) {
    display: block;
  }
}
