/*** Fonts ***/

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/NunitoSans-Light.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/NunitoSans-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/NunitoSans-Medium.woff2') format('woff2');
}

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/NunitoSans-Bold.woff2') format('woff2');
}

/*** Tokens (light) ***/

:root {
  color-scheme: light;
  --color-bg: #f3f2f0;
  --color-surface: #ffffff;
  --color-surface-muted: #f7f6f4;
  --color-surface-sunken: #efedea;
  --color-border: #e0ddd9;
  --color-border-strong: #c9c5c0;
  --color-text: #1d1c1b;
  --color-text-muted: #64605b;
  --color-accent: #bb0a04;
  --color-accent-hover: #970802;
  --color-accent-soft: #fbe9e8;
  --color-on-accent: #ffffff;
  --color-header-bg: #2a2929;
  --color-hero-bg: #bb0a04;
  --color-footer-bg: #bb0a04;
  --color-footer-text: #ffffff;
  --color-badge-bonus-bg: #fdf1dc;
  --color-badge-bonus-text: #8a5300;
  --color-badge-preload-bg: #e3f3e8;
  --color-badge-preload-text: #1f6b3a;
  --color-badge-version-bg: #ecebe9;
  --color-badge-version-text: #4a4641;
  --color-focus: rgba(187, 10, 4, 0.35);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --font-family: 'Nunito Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/*** Tokens (dark) ***/

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-bg: #151414;
    --color-surface: #1f1e1d;
    --color-surface-muted: #262524;
    --color-surface-sunken: #1a1919;
    --color-border: #34312f;
    --color-border-strong: #4a4643;
    --color-text: #edebe8;
    --color-text-muted: #a7a29c;
    --color-accent: #d0150d;
    --color-accent-hover: #e8291f;
    --color-accent-soft: #3a1513;
    --color-on-accent: #ffffff;
    --color-header-bg: #0c0b0b;
    --color-hero-bg: #a50a04;
    --color-footer-bg: #8e0803;
    --color-footer-text: #ffffff;
    --color-badge-bonus-bg: #3d2c10;
    --color-badge-bonus-text: #f3c470;
    --color-badge-preload-bg: #163222;
    --color-badge-preload-text: #7fd39d;
    --color-badge-version-bg: #2e2c2a;
    --color-badge-version-text: #cfcac4;
    --color-focus: rgba(232, 41, 31, 0.5);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);

    /* messagebox.css */
    --color-box-default-bg: #2a2928;
    --color-box-default-border: #3a3735;
    --color-box-default-font: #edebe8;
    --color-box-success-bg: #163222;
    --color-box-success-border: #24503a;
    --color-box-success-font: #b8e8c9;
    --color-box-warning-bg: #3d2c10;
    --color-box-warning-border: #5c4318;
    --color-box-warning-font: #f3d9a4;
    --color-box-error-bg: #3a1513;
    --color-box-error-border: #5e211d;
    --color-box-error-font: #f6c1bd;
    --color-box-close-button: #a7a29c;
    --color-box-close-button-hover: #ffffff;
  }
}

/*** Base ***/

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
}

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

a:hover {
  color: var(--color-accent-hover);
}

/* soft red ring in the page's accent color instead of the browser's blue outline */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 1px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/*** Header & hero ***/

.site-header {
  display: flex;
  justify-content: center;
  padding: 20px 16px;
  background: var(--color-header-bg);
}

.site-header-logo {
  display: block;
  line-height: 0;
}

.site-header-logo img {
  height: 52px;
  width: auto;
}

.page-hero {
  background: var(--color-hero-bg);
  color: var(--color-on-accent);
}

.page-hero-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 16px;
  text-align: left;
}

.page-hero-icon {
  flex: none;
  font-size: 28px;
}

.page-hero h1 {
  font-size: 28px;
  font-weight: 300;
}

.page-hero-subheading {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.85;
}

/*** Page content ***/

.page-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.page-content-narrow {
  max-width: 760px;
}

.page-content .row {
  margin-bottom: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 36px 0 14px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/*** Buttons ***/

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.button-primary {
  min-width: 170px;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.button-primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-on-accent);
}

.button-secondary {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.button-secondary:hover,
.button-secondary[aria-expanded="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.button-small {
  min-height: 34px;
  padding: 0 14px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 14px;
}

.button-small:hover {
  background: var(--color-accent-hover);
}

.button[hidden] {
  display: none;
}

.button:disabled,
.button.is-busy {
  cursor: default;
}

.button:disabled {
  background: var(--color-surface-sunken);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.button.is-busy {
  opacity: 0.7;
}

.chooser-toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.chooser-toggle[aria-expanded="true"] .chooser-toggle-icon {
  transform: rotate(180deg);
}

/*** Product cards ***/

.product-card {
  margin-bottom: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.product-card-main {
  border-left: 4px solid var(--color-accent);
}

.product-card-main .product-card-title {
  font-size: 24px;
}

.product-card-upcoming {
  background: var(--color-surface-muted);
  box-shadow: none;
}

.product-card-upcoming .product-card-title {
  color: var(--color-text-muted);
}

.product-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 24px;
  padding: 20px 24px;
}

.product-card-subrow {
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
  border-top: 1px solid var(--color-border);
}

.product-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.product-card-badges:empty {
  display: none;
}

.product-card-title {
  font-size: 19px;
  font-weight: 600;
}

.product-card-subtitle {
  font-size: 16px;
  font-weight: 600;
}

.product-card-parent {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.badge-bonus {
  background: var(--color-badge-bonus-bg);
  color: var(--color-badge-bonus-text);
}

.badge-preload {
  background: var(--color-badge-preload-bg);
  color: var(--color-badge-preload-text);
}

.badge-version {
  background: var(--color-badge-version-bg);
  color: var(--color-badge-version-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/*** Details (languages & requirements) ***/

/* full card width below title and buttons, but above an opened "Other downloads" list */
.product-details {
  grid-column: 1 / -1;
  order: 1;
  font-size: 14px;
}

.product-details summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.product-details summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.product-details[open] summary::before {
  transform: rotate(45deg);
}

.product-details summary:hover {
  color: var(--color-text);
}

.product-details-hint {
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
}

.product-details dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 10px 0 0;
  padding: 12px 14px;
  background: var(--color-surface-sunken);
  border-radius: 6px;
}

.product-details dt {
  color: var(--color-text-muted);
  font-weight: 600;
}

.product-details dd {
  margin: 0;
}

/*** Download actions ***/

.download-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.download-form {
  margin: 0;
}

.download-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
}

.download-button-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.download-button-column[hidden] {
  display: none;
}

/* the preselected file is described centered right below the download button */
.download-primary-column {
  align-items: center;
  text-align: center;
}

.download-caption {
  margin: 6px 0 0;
  max-width: 340px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.download-caption-release {
  margin-top: 0;
}

.download-caption[hidden],
.download-caption:empty {
  display: none;
}

/*** Version chooser ***/

.download-chooser {
  grid-column: 1 / -1;
  order: 2;
  margin-top: 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}

.download-chooser[hidden] {
  display: none;
}

.download-chooser-heading {
  padding: 10px 14px;
  background: var(--color-surface-sunken);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.download-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.download-table th {
  padding: 8px 14px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.download-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--color-border);
  vertical-align: middle;
}

.download-table tbody tr:hover {
  background: var(--color-surface-muted);
}

.download-table-platform {
  font-weight: 600;
  white-space: nowrap;
}

.platform-icon {
  display: inline-block;
  width: 22px;
  margin-right: 8px;
  font-size: 18px;
  text-align: center;
  vertical-align: -2px;
}

.download-table-size {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.download-table-description {
  display: block;
}

.download-table-file {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
}

.download-table-languages {
  color: var(--color-text-muted);
  font-size: 13px;
}

.download-table-action {
  width: 1%;
  text-align: right;
}

/*** Key form ***/

.key-form {
  margin-top: 24px;
  padding: 40px 40px 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.08);
}

.key-form-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  background: var(--color-accent-soft);
  border-radius: 50%;
  color: var(--color-accent);
  font-size: 36px;
}

.key-form-title {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}

.key-form-intro {
  max-width: 480px;
  margin: 10px auto 28px;
  color: var(--color-text-muted);
  font-size: 17px;
  text-align: center;
}

.key-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
}

.key-form-row {
  display: flex;
  gap: 8px;
}

.key-form-row .button {
  min-height: 52px;
  padding: 0 24px;
  font-size: 17px;
}

.key-form-row .button .fa-arrow-right {
  margin-left: 4px;
}

.key-form input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  color: var(--color-text);
  font: inherit;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.key-form input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.key-form input:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-focus);
}

.key-form-help {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 28px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 15px;
  text-align: center;
}

.key-form-help .fa-circle-question {
  flex: none;
  font-size: 22px;
}

/*** Info panel ***/

.info-panel {
  margin-top: 40px;
  padding: 24px 28px;
  background: var(--color-accent-soft);
  border-radius: var(--radius);
  font-size: 14px;
}

.info-panel h2 {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 600;
}

.info-panel h3 {
  margin: 18px 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.info-panel p {
  margin: 6px 0 0;
}

.info-panel-with-icon {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 18px;
}

.info-panel-with-icon > * {
  grid-column: 2;
}

.info-panel-with-icon > .info-panel-icon {
  grid-column: 1;
  grid-row: 1 / span 10;
  color: var(--color-accent);
  font-size: 26px;
  line-height: 1;
}

.info-panel-plain {
  margin-top: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.info-panel-footnote {
  color: var(--color-text-muted);
  font-size: 13px;
}

.info-panel .button {
  margin-top: 16px;
}

/*** Footer ***/

.site-footer {
  padding: 28px 16px 20px;
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  text-align: center;
}

.site-footer-games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 24px 48px;
}

.site-footer-games img {
  height: 44px;
  width: auto;
}

.site-footer-legal {
  margin: 20px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.site-footer-legal a {
  margin-left: 10px;
  color: var(--color-footer-text);
  font-weight: 700;
  text-decoration: none;
}

.site-footer-legal a:first-child {
  margin-left: 0;
}

.site-footer-legal a:hover {
  text-decoration: underline;
}

/*** Small screens ***/

@media (max-width: 760px) {
  .page-hero h1 {
    font-size: 22px;
  }

  .product-card-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .download-actions {
    align-items: stretch;
    text-align: left;
  }

  .download-primary-column {
    flex: 1;
    min-width: 0;
  }

  .download-primary-column .button-primary {
    width: 100%;
    min-width: 0;
  }

  .download-table thead {
    display: none;
  }

  .download-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border);
  }

  .download-table tbody tr:first-child {
    border-top: 0;
  }

  .download-table td {
    padding: 0;
    border-top: 0;
  }

  .download-table-action {
    grid-column: 2;
    grid-row: 1 / span 3;
    width: auto;
    align-self: center;
  }

  .key-form-row {
    flex-direction: column;
  }

  .key-form {
    padding: 28px 20px 20px;
  }

  .key-form-title {
    font-size: 26px;
  }

  .site-footer-games img {
    height: 34px;
  }
}
