/*
 * The website of Cog Siege: the colours, the brass panels, and the rivets of
 * the interface of the game, the serif of the word mark, and nothing to load
 * from another site. Phone first: the wider screens come at the end of each part.
 */

:root {
  --dark: #1b1612;
  --dark-rgb: 27 22 18;
  --panel: #241d17;
  --raised: #2f261d;
  --line: #4a3b2b;
  --line-strong: #8a6a3b;
  --brass: #b08d57;
  --gold: #e6c15a;
  --gold-light: #f3d98a;
  --text: #e8d9b8;
  --muted: #b7a88e;
  --online: #8fd18a;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* A raised panel: a light edge on top, a shade at the bottom, as the light of the art. */
  --bevel: inset 0 1px 0 rgb(255 243 196 / 10%), inset 0 -2px 0 rgb(0 0 0 / 30%);
  /* Four brass rivets, one in each corner of a panel. */
  --rivets:
    radial-gradient(circle at 8px 8px, var(--brass) 1.6px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 8px) 8px, var(--brass) 1.6px, transparent 2.2px),
    radial-gradient(circle at 8px calc(100% - 8px), var(--brass) 1.6px, transparent 2.2px),
    radial-gradient(
      circle at calc(100% - 8px) calc(100% - 8px),
      var(--brass) 1.6px,
      transparent 2.2px
    );
  color-scheme: dark;
}

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

html {
  background: var(--dark);
}

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.6 var(--sans);
  background: radial-gradient(ellipse at 50% 0, #2c241c 0, var(--dark) 70%) no-repeat var(--dark);
}

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

a:hover {
  color: var(--gold-light);
}

h1,
h2,
h3 {
  color: var(--gold);
  font-family: var(--serif);
  line-height: 1.25;
}

kbd {
  padding: 0 6px;
  font: 0.9em var(--sans);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 2;
  padding: 6px 12px;
  background: var(--panel);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mark {
  display: block;
}

.wordmark {
  font-family: var(--serif);
  letter-spacing: 0.12em;
}

/* A panel of brass: the ground of the cards, the steps, the guilds, and the matches. */
.panel,
.card,
.step,
.guild,
.waiting-list li {
  background: var(--rivets), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--bevel);
}

/* The bar at the top: the brand, two pages, and the way to the game. */
.top {
  display: flex;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--gold);
  font: 700 20px var(--serif);
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand .mark {
  width: 36px;
  height: 36px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  justify-content: flex-end;
}

.nav a {
  color: var(--text);
  text-decoration: none;
}

.nav a[aria-current='page'] {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 6px;
}

.nav .nav-play {
  padding: 4px 16px;
  color: var(--dark);
  font-weight: 700;
  background: var(--gold);
  border-radius: 4px;
  box-shadow: var(--bevel);
}

main {
  display: block;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* The buttons. */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-block;
  padding: 12px 22px;
  color: var(--gold);
  font-weight: 600;
  font-size: 18px;
  text-align: center;
  text-decoration: none;
  border: 2px solid var(--brass);
  border-radius: 6px;
}

.button:hover {
  color: var(--gold);
  background: var(--panel);
}

.button.primary {
  color: var(--dark);
  background: linear-gradient(var(--gold-light), var(--gold) 45%, #c9a043);
  border-color: var(--gold);
  box-shadow:
    var(--bevel),
    0 0 24px rgb(230 193 90 / 25%);
}

.button.primary:hover {
  color: var(--dark);
  background: var(--gold-light);
}

.button.big {
  width: 100%;
  max-width: 320px;
  padding: 16px 32px;
  font: 700 24px var(--serif);
  letter-spacing: 0.08em;
}

.button-link {
  font-weight: 600;
  text-underline-offset: 4px;
}

/* The first screen: the loop of a match behind the name, the line, and the button Play. */
.hero {
  position: relative;
  display: grid;
  min-height: calc(100svh - 64px);
  margin: 0 -16px;
  overflow: hidden;
  text-align: center;
  place-items: center;
}

.hero-loop {
  position: absolute;
  inset: 0;
}

.hero-loop img,
.hero-loop video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 75%;
}

/* The video covers the still picture once it plays: never a blank between them. */
.hero-loop video {
  opacity: 0;
  transition: opacity 0.6s;
}

.hero-loop.playing video {
  opacity: 1;
}

/* Darkened under the text. */
.hero-loop::after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(
    rgb(var(--dark-rgb) / 70%),
    rgb(var(--dark-rgb) / 60%) 35%,
    rgb(var(--dark-rgb) / 85%) 65%,
    rgb(var(--dark-rgb) / 90%)
  );
}

.hero-text {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 24px 16px 32px;
}

.hero .mark {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  filter: drop-shadow(0 4px 12px rgb(0 0 0 / 60%));
}

.hero h1 {
  margin: 8px 0 4px;
  font-size: clamp(40px, 12vw, 76px);
  text-shadow: 0 2px 12px rgb(0 0 0 / 80%);
}

.tagline {
  max-width: 520px;
  margin: 0 auto 28px;
  color: var(--text);
  font: italic 22px/1.4 var(--serif);
  text-shadow: 0 2px 8px rgb(0 0 0 / 80%);
}

.online {
  margin: 20px 0 0;
  color: var(--online);
}

.online::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  vertical-align: 2px;
  content: '';
  background: var(--online);
  border-radius: 50%;
}

.week {
  margin: 16px 0 0;
  color: var(--muted);
}

/* The sections of the home page. */
.section {
  padding: 40px 0 0;
}

.section > h2 {
  margin: 0 0 16px;
  font-size: 30px;
  text-align: center;
}

.section-lead {
  max-width: 640px;
  margin: -4px auto 20px;
  color: var(--muted);
  text-align: center;
}

.more {
  margin: 16px 0 0;
  text-align: center;
}

/* The public matches waiting for players: cards, hidden when none waits. */
.waiting-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.waiting-list li {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.waiting-about {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.waiting-about strong {
  overflow-wrap: anywhere;
}

.waiting-about span {
  color: var(--muted);
  font-size: 14px;
}

.waiting-list .button {
  flex: none;
  padding: 8px 16px;
  font-size: 16px;
}

/* How it works, in three steps, with their number on a dial. */
.steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 20px 20px 8px;
  text-align: center;
  counter-increment: step;
}

.step::before {
  position: absolute;
  top: 12px;
  left: 12px;
  display: grid;
  width: 36px;
  height: 36px;
  color: var(--dark);
  font: 700 18px var(--serif);
  content: counter(step);
  background: radial-gradient(circle, var(--gold-light), var(--gold) 60%, var(--brass));
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  place-items: center;
}

.step img,
.step .mark {
  width: 96px;
  height: 96px;
  margin: 0 auto;
}

.step h3 {
  margin: 8px 0 4px;
  font-size: 22px;
}

.step p {
  margin-top: 0;
  color: var(--muted);
}

/* The towers and the monsters: a row of cards that slides with a finger. */
.cards {
  display: grid;
  grid-auto-columns: 168px;
  grid-auto-flow: column;
  gap: 12px;
  margin: 0 -16px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  list-style: none;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 16px;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--line-strong) transparent;
}

.card {
  padding: 16px 14px 4px;
  text-align: center;
  scroll-snap-align: start;
}

.card img {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.card h3 {
  margin: 8px 0 4px;
  font-size: 18px;
}

.card p {
  margin-top: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* The four guilds, each in its colour, with its bomb, its booster, its trap, and its tower. */
.guilds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.guild {
  padding: 16px 20px 12px;
  border-top: 4px solid var(--guild);
}

.guild-rime {
  --guild: #8fd3ff;
}

.guild-foundry {
  --guild: #ff8a3d;
}

.guild-alchemists {
  --guild: #8fd18a;
}

.guild-voltaics {
  --guild: #e6d25a;
}

.guild h3 {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  font-size: 22px;
}

.guild-sign {
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--guild);
}

.guild > p {
  margin: 6px 0 10px;
  color: var(--muted);
}

.parts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.parts li {
  display: grid;
  grid-template-columns: 76px 32px 1fr;
  gap: 10px;
  align-items: center;
}

.part-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.parts img,
.part-picture {
  width: 32px;
  height: 32px;
}

svg.part-picture {
  padding: 3px;
  color: var(--guild);
}

/* A trap has no drawing of its own outside the lane: a plate of its colour. */
.part-picture.trap {
  display: block;
  background: radial-gradient(circle, var(--guild) 0 3px, transparent 4px);
  border: 2px dashed var(--guild);
  border-radius: 50%;
}

/* The pictures: the two of a phone side by side, the one of a computer under them. */
.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.shots figure {
  margin: 0;
}

.shots .shot-desktop {
  grid-column: 1 / -1;
}

.shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
}

.shots figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* The last button Play, at the foot of the page. */
.last {
  margin-top: 48px;
  padding: 32px 16px;
  text-align: center;
  background: var(--rivets), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--bevel);
}

.last > h2 {
  margin-bottom: 4px;
}

.last .lead {
  margin: 0 0 24px;
  color: var(--muted);
}

/* The pages of text. */
.page {
  max-width: 720px;
  margin: 0 auto;
}

.page h1 {
  font-size: 38px;
}

.page h2 {
  margin-top: 32px;
  font-size: 24px;
}

/* A rule of How to play, beside its picture. */
.rule {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 24px;
}

.rule h2 {
  margin-top: 4px;
  margin-bottom: 4px;
}

.rule p {
  margin-top: 0;
}

.rule > img,
.rule-icon {
  width: 56px;
  height: 56px;
}

.rule-icon {
  padding: 12px;
  color: var(--gold);
  background: radial-gradient(circle, var(--raised), var(--panel) 70%);
  border: 2px solid var(--line-strong);
  border-radius: 50%;
}

.news .date {
  margin-top: -12px;
  color: var(--muted);
  font-size: 15px;
}

.imprint {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
}

.imprint dt {
  color: var(--brass);
}

.imprint dd {
  margin: 0;
}

.root {
  padding-top: 48px;
  text-align: center;
}

.root .mark {
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.root-languages {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 0;
  list-style: none;
}

/* The foot: the music, the languages, the pages of the law, and the version. */
.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.languages,
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  justify-content: center;
  margin-bottom: 8px;
}

.languages a[aria-current='true'] {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

/* The button of the main theme, in the foot. */
.music {
  margin: 0 0 12px;
  padding: 6px 14px;
  color: var(--text);
  font: inherit;
  background: transparent;
  border: 1px solid var(--brass);
  border-radius: 4px;
  cursor: pointer;
}

.music[aria-pressed='true'] {
  color: var(--dark);
  background: var(--gold);
  border-color: var(--gold);
}

/* A narrow phone: the mark of the brand, without its name. */
@media (max-width: 420px) {
  .brand span {
    display: none;
  }

  .nav {
    flex-wrap: nowrap;
    gap: 12px;
    font-size: 15px;
  }

  .nav .nav-play {
    padding-inline: 12px;
  }
}

@media (min-width: 720px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .shots {
    /* As wide as their pictures are, so that the three are as high. */
    grid-template-columns: 0.49fr 0.49fr 1.6fr;
  }

  .shots .shot-desktop {
    grid-column: auto;
  }

  .guilds {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* A wide screen: the text on the left, the lane in its frame of brass on the right. */
@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr auto;
    gap: 48px;
    min-height: 0;
    margin: 0;
    padding: 32px 8px 16px 0;
    overflow: visible;
    text-align: left;
  }

  .hero-loop {
    position: relative;
    order: 2;
    height: min(72vh, 640px);
    aspect-ratio: 360 / 960;
    overflow: hidden;
    background: var(--panel);
    border: 3px solid var(--line-strong);
    border-radius: 12px;
    box-shadow:
      0 0 0 6px var(--panel),
      0 0 0 7px var(--line),
      0 16px 48px rgb(0 0 0 / 50%);
  }

  .hero-loop img,
  .hero-loop video {
    object-position: 50% 50%;
  }

  .hero-loop::after {
    display: none;
  }

  .hero-text {
    padding: 0;
  }

  .hero .mark {
    width: 120px;
    height: 120px;
    margin: 0;
  }

  .tagline {
    margin-left: 0;
  }

  .hero .actions {
    align-items: flex-start;
  }

  .cards {
    margin: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cards {
    scroll-behavior: smooth;
  }
}
