/* The game's website (site.html): the look of its main menu. The planet looms from the
   top with the title over it, the buttons have the menu's cut corner, the list's dots
   and lines are the campaign map's conquered systems and lanes. */

@font-face {
  font-family: "EssayCaps";
  src: url(essaycaps.woff2) format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --space: #00040a;
  --hull: rgb(52 78 170 / .86);
  --hull-lit: rgb(72 104 212 / .94);
  --hull-low: rgb(34 52 122 / .9);
  --tab: #131d44;
  --line: #5d87ff;
  --text: #e8eefb;
  --dim: #aab8d8;
  --fleet: #2fe62f;
  --gold: #ffae00;
  --caps: "EssayCaps", "Eurostile", "Bank Gothic", system-ui, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --column: 34rem;
  --out: cubic-bezier(.16, 1, .3, 1);
}

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

html {
  background: var(--space) url(stars.webp) center top / 48rem repeat;
  scrollbar-color: #2c3d80 var(--space);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  font: 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, p, ul, figure, address { margin: 0; }

::selection { background: var(--line); color: #000a1f; }

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

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}

a:hover { color: #fff; text-decoration-color: var(--gold); }

/* The planet and the title */

.sky {
  --planet: 100vw;
  position: relative;
  height: calc(var(--planet) * .66);
  padding-top: calc(var(--planet) * .12);
}

.planet {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 50%;
  /* not wider than the page: 100vw counts a scrollbar in */
  width: min(100%, var(--planet));
  /* the picture's lower part is only its haze: left out, and the rest fades into the sky */
  height: calc(var(--planet) * .9);
  object-fit: cover;
  object-position: top;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, #000 72%, transparent);
  translate: -50% 0;
  pointer-events: none;
  user-select: none;
}

h1 {
  font: 400 clamp(1.3rem, 7.2vw, 2.6rem)/1.35 var(--caps);
  letter-spacing: .55em;
  /* the tracking's space after the last letter would push the title off the center */
  padding-left: .55em;
  text-align: center;
  white-space: nowrap;
  color: #fff;
}

h1 span { display: block; }

/* The page */

main, footer {
  max-width: var(--column);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { display: grid; gap: 2.75rem; }

.lead {
  font-size: 1.25rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.stores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .75rem;
  margin-top: 1.75rem;
}

.store {
  position: relative;
  display: grid;
  gap: .15rem;
  padding: .8rem 1rem .9rem 2.4rem;
  border: 2px solid var(--line);
  background: var(--hull);
  color: #fff;
  font-family: var(--caps);
  text-decoration: none;
  transition: background-color .2s var(--out);
}

/* the menu buttons' cut corner: a small triangle, a gap, the button's slanted edge */
.store::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(135deg,
      transparent calc(50% - 6.5px),
      var(--line) calc(50% - 6px) calc(50% - 4.5px),
      var(--space) calc(50% - 4px) calc(50% - 1.5px),
      var(--line) calc(50% - 1px) calc(50% + 1px),
      transparent calc(50% + 1.5px)),
    linear-gradient(var(--line), var(--line)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 0 / 2px 100% no-repeat,
    linear-gradient(135deg, var(--tab) 50%, transparent 50%);
}

.store b {
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: .04em;
  white-space: nowrap;
}

.store span {
  font-size: .9rem;
  letter-spacing: .1em;
  color: #cdd8f3;
}

.store:hover { background: var(--hull-lit); }
.store:active { background: var(--hull-low); }

.fair {
  margin-top: 1.1rem;
  color: var(--dim);
  font-size: .95rem;
  text-wrap: pretty;
}

/* The battle: its sky is the page's, so it has no frame */

.battle { position: relative; margin-inline: calc(var(--gutter) * -1); }

/* dims what lies behind the battle, or the planet's asteroids would shine through it */
.battle::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5% 8% 14%;
  background: var(--space);
  filter: blur(2rem);
}

.battle img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 44%;
  /* only its light counts: the black of its sky lets the page's through */
  mix-blend-mode: screen;
  -webkit-mask-image:
    linear-gradient(to bottom, transparent, #000 9%, #000 88%, transparent),
    linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent, #000 9%, #000 88%, transparent),
    linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-composite: intersect;
}

.battle figcaption {
  padding-inline: var(--gutter);
  color: var(--dim);
  font-size: .95rem;
  text-align: center;
  text-wrap: balance;
}

/* What the game has: systems along a lane, as on the campaign's map */

.lanes {
  display: grid;
  gap: 1.6rem;
  padding: 0;
  list-style: none;
}

.lanes li { position: relative; padding-left: 2.4rem; }

.lanes li::before {
  content: "";
  position: absolute;
  top: .05rem;
  left: 0;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: radial-gradient(circle, var(--fleet) 0 36%, rgb(47 230 47 / .22) 40%);
}

.lanes li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  bottom: -1.65rem;
  left: calc(.65rem - 1px);
  width: 2px;
  background: rgb(47 230 47 / .5);
}

.lanes h2 {
  font: 400 1.2rem/1.3 var(--caps);
  letter-spacing: .05em;
  color: #fff;
}

.lanes p {
  margin-top: .3rem;
  color: var(--dim);
  text-wrap: pretty;
}

/* Support and the legal links */

footer {
  display: grid;
  gap: 1.25rem;
  margin-top: clamp(3.5rem, 9vw, 6rem);
  padding-block: 2rem 2.5rem;
  color: var(--dim);
  font-size: .95rem;
}

footer::before {
  content: "";
  height: 1px;
  background: rgb(93 135 255 / .4);
}

footer h2 {
  font: 400 1.05rem/1.3 var(--caps);
  letter-spacing: .12em;
  color: var(--text);
}

footer p { margin-top: .35rem; }

footer nav { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; }

/* The imprint */

.home {
  max-width: var(--column);
  margin-inline: auto;
  padding: 2.5rem var(--gutter) 0;
  font: 400 1rem/1.3 var(--caps);
  letter-spacing: .3em;
}

.home a { text-decoration: none; }

.legal { display: block; padding-top: 3rem; }

.legal h1 {
  padding: 0;
  font-size: 1.6rem;
  letter-spacing: .08em;
  text-align: left;
}

.legal h1 + p { margin-top: .5rem; color: var(--dim); }

.legal address { margin-top: 1.75rem; font-style: normal; }

.legal address span { display: block; }

.legal h2 {
  margin-top: 2rem;
  font: 400 1rem/1.3 var(--caps);
  letter-spacing: .08em;
}

.legal h2 + p { margin-top: .3rem; }

/* Wide screens: the battle beside the text, the planet's lower edge across the top */

@media (min-width: 56rem) {
  :root { --column: 68rem; }

  .sky {
    --planet: min(100vw, 75rem);
    height: calc(var(--planet) * .21);
    padding-top: calc(var(--planet) * .028);
  }

  /* raised until the sides the picture cuts the planet at are out of sight */
  .planet { top: calc(var(--planet) * -.27); }

  main {
    grid-template-columns: minmax(0, 1fr) minmax(0, clamp(20rem, 30vw, 25rem));
    grid-template-rows: auto 1fr;
    column-gap: clamp(3rem, 8vw, 7rem);
    row-gap: 3.5rem;
  }

  .pitch { grid-area: 1 / 1; padding-top: 2.5rem; }
  .lanes { grid-area: 2 / 1; }

  .battle { grid-area: 1 / 2 / span 2; margin-inline: 0; }
  /* here the battle lies in the asteroids: dimmed up to its edges */
  .battle::before { inset: 0 0 12%; }
  .battle img { aspect-ratio: auto; }
  .battle figcaption { padding-inline: 0; }

  .lead { font-size: 1.4rem; max-width: 30ch; }
  .fair, .lanes p { max-width: 46ch; }

  footer { grid-template-columns: 1fr auto; align-items: end; }
  footer::before { grid-column: 1 / -1; }

  .home, .legal, .legal ~ footer { max-width: 34rem; }
  .legal ~ footer { grid-template-columns: none; }
}

/* Wider than the planet's picture: its haze must not end at an edge */

@media (min-width: 75rem) {
  /* the planet's disc itself (its circle in the picture), and under it an ellipse of
     the haze and the asteroids that is gone before the picture's sides */
  .planet {
    -webkit-mask-image:
      radial-gradient(circle calc(var(--planet) * .64) at 48.75% -19.4%, #000 95%, transparent),
      radial-gradient(50% 46% at 50% 48%, #000 35%, transparent);
    mask-image:
      radial-gradient(circle calc(var(--planet) * .64) at 48.75% -19.4%, #000 95%, transparent),
      radial-gradient(50% 46% at 50% 48%, #000 35%, transparent);
  }
}

/* The one movement: the planet sinks into place and the title closes its ranks */

@media (prefers-reduced-motion: no-preference) {
  .planet { animation: descend 1.8s var(--out) both; }
  .sky h1 { animation: close-ranks 1.8s var(--out) both; }
}

@keyframes descend {
  from { transform: translateY(-5%) scale(1.04); }
}

@keyframes close-ranks {
  /* not wider: on a phone the title would not fit its line */
  from { letter-spacing: .78em; padding-left: .78em; }
}
