/* C&C Game Studio */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Big Shoulders Display";
  src: url("../fonts/big-shoulders-display-latin.woff2") format("woff2");
  font-weight: 600 900;
  font-display: swap;
}

@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
}

@font-face {
  font-family: "Top Secret";
  src: url("../fonts/top_secret-webfont.woff") format("woff");
  font-display: swap;
}

:root {
  /* Palette: field slate with amber and olive signal colors. */
  --c-slate: #1c2321;
  --c-slate-raised: #252e2b;
  --c-line: #3b4541;
  --c-paper: #ece4d2;
  --c-dust: #a8a08c;
  --c-amber: #f0a43a;
  --c-amber-hover: #ffbb5c;
  --c-ink: #1a1408;
  --c-olive: #a3b674;
  --c-navy: #1f255b;
  --c-night: #0a0e2e;

  --f-body: "Archivo", system-ui, sans-serif;
  --f-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --f-mono: "Martian Mono", ui-monospace, monospace;
  --f-stencil: "Top Secret", var(--f-display);

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-height: 64px;
  --radius: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  /* Header height plus its 1px bottom border: a section starts right under the header. */
  scroll-padding-top: calc(var(--header-height) + 1px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-slate);
  color: var(--c-paper);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

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

a {
  color: var(--c-amber);
}

a:hover {
  color: var(--c-amber-hover);
}

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

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon-sprite {
  display: none;
}

.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--c-amber);
  color: var(--c-ink);
}

.skip-link:focus {
  top: 8px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  min-height: 48px;
  padding: .7em 1.3em;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font: 700 1rem/1 var(--f-body);
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease);
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: var(--c-amber);
  color: var(--c-ink);
}

.button--primary:hover {
  background: var(--c-amber-hover);
  color: var(--c-ink);
}

.button--ghost {
  border-color: color-mix(in srgb, var(--c-paper) 35%, transparent);
  background: transparent;
  color: var(--c-paper);
}

.button--ghost:hover {
  border-color: var(--c-paper);
  color: var(--c-paper);
}

.button--small {
  min-height: 40px;
  padding: .55em 1em;
  font-size: .9375rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--c-paper);
  font-size: 1.1rem;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--c-paper);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.store-badge img {
  width: auto;
  height: 48px;
}

/* Labels */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tag,
.video figcaption,
.game-dialog__title {
  font-family: var(--f-mono);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tag {
  padding: .45em .75em;
  border: 1px solid color-mix(in srgb, var(--c-paper) 25%, transparent);
  border-radius: 2px;
  color: var(--c-dust);
}

.tag--alert {
  border-color: var(--c-amber);
  color: var(--c-amber);
}

.tag--ok {
  border-color: var(--c-olive);
  color: var(--c-olive);
}

/* Reticle frame: the corner brackets close in on hover, like a target lock. */

.screen {
  --reticle-gap: 10px;
  --reticle-len: 22px;
  --reticle-width: 2px;
  --reticle-color: color-mix(in srgb, var(--c-paper) 45%, transparent);

  position: relative;
  display: block;
}

.screen::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--reticle-gap));
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(var(--reticle-color) 0 0) top left / var(--reticle-len) var(--reticle-width),
    linear-gradient(var(--reticle-color) 0 0) top left / var(--reticle-width) var(--reticle-len),
    linear-gradient(var(--reticle-color) 0 0) top right / var(--reticle-len) var(--reticle-width),
    linear-gradient(var(--reticle-color) 0 0) top right / var(--reticle-width) var(--reticle-len),
    linear-gradient(var(--reticle-color) 0 0) bottom left / var(--reticle-len) var(--reticle-width),
    linear-gradient(var(--reticle-color) 0 0) bottom left / var(--reticle-width) var(--reticle-len),
    linear-gradient(var(--reticle-color) 0 0) bottom right / var(--reticle-len) var(--reticle-width),
    linear-gradient(var(--reticle-color) 0 0) bottom right / var(--reticle-width) var(--reticle-len);
  background-repeat: no-repeat;
  transition: inset .3s var(--ease);
}

.screen:hover,
.screen:focus-visible {
  --reticle-color: var(--c-amber);
}

.screen:hover::after,
.screen:focus-visible::after {
  inset: -4px;
}

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

.video {
  display: grid;
  gap: 14px;
}

.video figcaption {
  color: var(--c-dust);
}

lite-youtube {
  max-width: none;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--c-line) 70%, transparent);
  background: color-mix(in srgb, var(--c-slate) 88%, transparent);
  backdrop-filter: blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: calc(var(--container) + 2 * var(--gutter));
  min-height: var(--header-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand {
  color: var(--c-paper);
  font-family: var(--f-stencil);
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
}

.brand:hover {
  color: var(--c-amber);
}

.site-nav {
  position: relative;
  display: flex;
  gap: 28px;
  margin-left: auto;
}

.site-nav a {
  color: var(--c-paper);
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav__short {
  display: none;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--c-amber);
}

.site-nav a[aria-current] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* Game sections */

.game {
  padding-bottom: clamp(64px, 9vw, 120px);
  background: var(--game-bg);
}

/* Each game sits on a color taken from its banner or its own art. */
.game--roma {
  --game-bg: #263022;
}

.game--cnc3 {
  --game-bg: #4a2a16;
}

.game--spec-ops {
  --game-bg: #474c71;
  --c-dust: #d0cce0;
  --c-olive: #cbdc9c;
}

.game--cnc {
  --game-bg: var(--c-night);
}

.game__banner {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(140px, 16vw, 280px);
  overflow: hidden;
}

.game--hero .game__banner {
  min-height: clamp(140px, 14vw, 240px);
}

.game__banner-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mask-image: linear-gradient(to bottom, #000 50%, transparent 96%);
}

/* Logos scale with the banner height, so they keep the same share of the banner at every width. */
.game__logo {
  position: relative;
  z-index: 1;
  width: clamp(240px, 27.4vw, 480px);
  filter: drop-shadow(0 6px 24px rgb(0 0 0 / 45%));
}

.game--hero .game__logo {
  width: clamp(175px, 17.5vw, 300px);
}

/* Command & Control has no logo image: the title is set in its stencil face. */
.game__logo--text {
  align-self: start;
  width: auto;
  margin-top: clamp(12px, 1.8vw, 32px);
  color: var(--c-navy);
  font-family: var(--f-stencil);
  font-size: clamp(2rem, 3.9vw, 4.25rem);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  filter: drop-shadow(0 2px 12px rgb(255 255 255 / 35%));
}

.game__logo--text span {
  display: block;
}

.game__body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(32px, 5vw, 72px);
}

.game__body--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.game__info {
  max-width: 60ch;
}

.game__info p + p {
  margin-top: 12px;
}

/* A short notice about a follow-up release, e.g. a remaster. */
.game__news {
  display: grid;
  justify-items: start;
  gap: 14px;
  margin-top: 32px;
  padding: 18px 20px;
  border-left: 3px solid var(--c-amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--c-ink) 22%, transparent);
}

.game__lead {
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.4;
}

.screens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

/* Terms of Service */

.page-terms {
  background: var(--c-night);
}

.site-header__back {
  margin-left: auto;
}

.terms {
  max-width: calc(46rem + 2 * var(--gutter));
  padding-block: 64px 96px;
  color: color-mix(in srgb, var(--c-paper) 88%, transparent);
  font-size: 1rem;
}

.terms__title {
  font-family: var(--f-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  color: var(--c-paper);
}

.terms__note {
  margin: 12px 0 40px;
  color: var(--c-dust);
}

.terms h2 {
  margin: 40px 0 12px;
  color: var(--c-paper);
  font-size: 1.25rem;
}

.terms h3 {
  margin: 24px 0 8px;
  color: var(--c-paper);
  font-size: 1.0625rem;
}

.terms p + p {
  margin-top: 12px;
}

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

/* Footer */

/* One shade darker than the last game section (Command & Control). */
.site-footer {
  border-top: 1px solid color-mix(in srgb, var(--c-paper) 8%, transparent);
  padding-block: 40px;
  background: #060920;
  color: var(--c-dust);
  font-size: .9375rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 40px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-paper);
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--c-amber);
}

.site-footer__copy {
  margin-left: auto;
}

/* Game dialog */

.game-dialog {
  width: min(1120px, 100vw - 32px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-slate);
  color: var(--c-paper);
}

.game-dialog::backdrop {
  background: rgb(10 13 12 / 88%);
  backdrop-filter: blur(4px);
}

.game-dialog__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 20px;
  border-bottom: 1px solid var(--c-line);
}

.game-dialog__title {
  margin-right: auto;
  color: var(--c-paper);
  font-size: .75rem;
}

.game-dialog__stage {
  display: grid;
  place-items: center;
  width: min(100%, (100dvh - 32px - 61px) * 1.6);
  aspect-ratio: 8 / 5;
  margin-inline: auto;
  background: #000;
  color: var(--c-paper);
  text-align: center;
}

.game-dialog__stage .ruffle-game {
  display: block;
  width: 100%;
  height: 100%;
}

.game-dialog__error {
  max-width: 32ch;
  padding: 24px;
}

/* Small screens */

@media (max-width: 860px) {
  /* One header row: games get short names so the whole list fits. */
  .site-header__inner {
    gap: 16px;
  }

  .site-nav {
    min-width: 0;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav__full {
    display: none;
  }

  .site-nav__short {
    display: inline;
  }

  .game__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .screens {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-footer__copy {
    margin-left: 0;
  }
}

@media (max-width: 380px) {
  .site-header__inner {
    gap: 12px;
  }

  .brand {
    font-size: 1.5rem;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav a {
    font-size: .875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
  }
}
