/*
 * The online game's look, shared by every page of the website: its fonts, colours and wood, and its title screen,
 * which the landing page (/ and /fr/) copies. The values are the game's own (client/src/styles.css and game.css, as
 * play.ragingkingdoms.com serves them); change them there first, then here, so the two stay alike.
 */

@font-face { font-family: "Cinzel"; font-weight: 600; font-display: swap; src: url("/fonts/cinzel-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 700; font-display: swap; src: url("/fonts/cinzel-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Cardo"; font-weight: 400; font-display: swap; src: url("/fonts/cardo-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Cardo"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/cardo-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Cardo"; font-weight: 700; font-display: swap; src: url("/fonts/cardo-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #2a1d12;
  --ink-soft: #6b5640;
  --edge: #b9a07a;
  --accent: #8e2a1a;
  --font-display: "Cinzel", "Cardo", serif;
  --font-body: "Cardo", Georgia, serif;

  --wood-light: #3b2717;
  --wood: #24170e;
  --wood-dark: #150d07;
  --parchment-light: #f8efd8;
  --parchment: #f1e5c8;
  --parchment-deep: #e2cfa4;
  --gold: #d6b05a;
  --gold-light: #f3dc95;
  --gold-dark: #8c6a28;
  --crimson-light: #bf432b;
  --crimson: #8e2a1a;
  --crimson-dark: #5e160c;
  --heading: #5b1d12;
  --tex-wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.005 0.11' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.04 0 0 0 0 0.02 0 0 0 0 0.01 0 0 0 1.1 -0.32'/%3E%3C/filter%3E%3Crect width='640' height='640' filter='url(%23w)'/%3E%3C/svg%3E");
  --tex-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.32 0 0 0 0 0.15 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23p)'/%3E%3C/svg%3E");
  --parchment-fill:
    var(--tex-paper),
    radial-gradient(ellipse at 15% 0%, rgb(255 255 255 / 0.5), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgb(160 115 55 / 0.22), transparent 60%),
    linear-gradient(var(--parchment-light), var(--parchment));
  --parchment-frame:
    inset 0 0 0 2px rgb(255 250 235 / 0.8),
    inset 0 0 0 3px rgb(168 130 47 / 0.55),
    inset 0 0 28px rgb(130 85 30 / 0.2),
    0 8px 22px rgb(0 0 0 / 0.5);

  /* The title screen's picture: the box's illustration, and its smaller copy for phones. */
  --lobby-art: url("/img/game/box-front.webp");
  --lobby-art-phone: url("/img/game/box-front-phone.webp");
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

/* The game's candlelit table: dark wood. */
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  background:
    radial-gradient(ellipse at 50% 35%, rgb(255 170 80 / 0.1), transparent 60%),
    radial-gradient(ellipse at center, transparent 45%, rgb(0 0 0 / 0.6) 100%),
    var(--tex-wood),
    linear-gradient(170deg, var(--wood-light), var(--wood) 45%, var(--wood-dark));
  background-color: var(--wood);
  background-attachment: fixed;
}

a,
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The language switch: two halves, the one in use in crimson. */
.lang-switch {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid rgb(138 106 50);
  border-radius: 8px;
  overflow: hidden;
}

.speed-choice {
  display: block;
  padding: 6px 4px;
  border: 0;
  border-radius: 0;
  background: rgb(255 250 235 / 0.6);
  color: var(--ink);
  font: 600 0.78rem var(--font-display);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
}

.speed-choice + .speed-choice {
  border-left: 1px solid rgb(138 106 50);
}

.speed-choice:hover {
  background: rgb(255 250 235 / 0.95);
}

.speed-choice-on,
.speed-choice-on:hover {
  background: var(--crimson);
  color: rgb(255 250 243);
}

.speed-choice:focus-visible {
  outline: 3px solid var(--gold-dark);
  outline-offset: -5px;
}

.speed-choice-on:focus-visible {
  outline-color: var(--gold-light);
}

/* ---------- The landing page: the game's title screen ---------- */

.lobby {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

@supports (height: 100dvh) {
  .lobby {
    min-height: 100dvh;
  }
}

.lobby-title {
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 2.2vh, 24px);
  padding: 2vh 16px 20px clamp(16px, 6vw, 120px);
}

.lobby-title > *,
.lobby-title .title-menu {
  width: min(480px, 100%);
  margin-inline: 0;
}

.lobby-title::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: var(--lobby-art) 0% 82% / max(140vw, 115vh) auto no-repeat;
}

.lobby-title::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(12 7 3 / 0.88), rgb(12 7 3 / 0.6) min(36vw, 540px), transparent min(56vw, 900px)),
    linear-gradient(transparent 75%, rgb(12 7 3 / 0.55));
}

.lobby-hero {
  text-align: center;
}

.lobby-hero h1 {
  margin: 0;
  line-height: 0;
}

.lobby-logo {
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 10px 24px rgb(0 0 0 / 0.65)) drop-shadow(0 0 30px rgb(255 180 80 / 0.18));
  animation: logo-in 0.7s ease-out;
}

.lobby-title .lobby-logo {
  width: auto;
  max-width: 100%;
  height: clamp(150px, 34vh, 400px);
  object-fit: contain;
}

.lobby-tagline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 0;
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.8);
}

.lobby-tagline::before,
.lobby-tagline::after {
  content: "";
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.lobby-tagline::after {
  transform: scaleX(-1);
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.3vh, 12px);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.title-button {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 7px 20px 7px 12px;
  border: 1px solid rgb(138 106 50);
  border-radius: 10px;
  background:
    linear-gradient(#ffffff0f, transparent 45%, #00000040),
    var(--tex-wood),
    linear-gradient(170deg, #4a3019, #2a190c);
  box-shadow:
    inset 0 0 0 1px rgb(0 0 0 / 0.5),
    inset 0 1px rgb(255 220 160 / 0.18),
    0 6px 16px rgb(0 0 0 / 0.5);
  color: rgb(246 234 208);
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, filter 0.15s;
  animation: rise-in 0.45s ease-out both;
}

/* The menu rises in after the logo, one button after the other. */
.title-button:nth-child(1) {
  animation-delay: 0.25s;
}

.title-button:nth-child(2) {
  animation-delay: 0.33s;
}

.title-button:hover,
.title-button:focus-visible {
  border-color: var(--gold-light);
  filter: brightness(1.22);
  transform: translate(6px);
}

.title-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* The first choice is the crimson one. */
.title-button:first-child {
  border-color: rgb(226 187 98);
  background:
    linear-gradient(#ffffff1a, transparent 45%, #00000040),
    linear-gradient(var(--crimson-light), var(--crimson) 55%, var(--crimson-dark));
}

.title-button-art {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgb(253 246 228), rgb(205 183 133));
  box-shadow:
    inset 0 0 0 2px rgb(0 0 0 / 0.25),
    0 2px 6px rgb(0 0 0 / 0.5);
}

.title-button-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-button-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.title-button-text strong {
  color: rgb(255 243 220);
  font: 700 1.22rem var(--font-display);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.7);
}

/* The small links at the bottom right, and the language. */
.lobby-title > .title-footer {
  position: fixed;
  right: 18px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 18px;
  width: auto;
  max-width: calc(100vw - 36px);
  margin: 0;
}

.title-footer a.link {
  position: relative;
  color: rgb(243 220 149 / 0.8);
  font: 600 0.74rem var(--font-display);
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.9);
}

.title-footer a.link:hover,
.title-footer a.link:focus-visible {
  color: var(--gold-light);
  text-decoration: underline;
}

.title-footer .lang-switch {
  border-color: rgb(243 220 149 / 0.55);
  border-radius: 6px;
}

.title-footer .lang-switch .speed-choice {
  padding: 3px 9px;
  font-size: 0.7rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lobby-logo,
  .title-button {
    animation: none;
  }
}

@media (width <= 900px) {
  .lobby-title {
    align-items: center;
    padding: 2vh 16px 20px;
  }

  .lobby-title::before {
    background: var(--lobby-art) 50% 30% / cover no-repeat;
  }

  .lobby-title::after {
    background: linear-gradient(rgb(12 7 3 / 0.35), rgb(12 7 3 / 0.55) 30%, rgb(12 7 3 / 0.92) 62%);
  }

  .lobby-title > .title-footer {
    position: static;
    justify-content: center;
    gap: 2px 16px;
    width: min(480px, 100%);
    max-width: none;
  }
}

@media (width <= 900px) and (height >= 501px) {
  .lobby-title {
    padding-top: calc(52px + 2vh);
  }
}

@media (width <= 640px), (height <= 500px) and (width <= 1000px) {
  .title-button {
    min-height: 44px;
  }

  .speed-choice {
    font-size: 0.84rem;
  }

  .title-footer a.link::after {
    content: "";
    position: absolute;
    inset: 0 -6px;
  }
}

@media (width <= 640px) {
  .lobby-title {
    --title-logo: clamp(92px, 19dvh, 170px);
    --title-art-top: calc(var(--title-logo) + 44px - 74vw);
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }

  .lobby-title .lobby-logo {
    height: var(--title-logo);
  }

  .lobby-title::before {
    background: var(--lobby-art-phone, var(--lobby-art)) 46% var(--title-art-top) / 135vw auto no-repeat;
    mask-image: linear-gradient(black calc(var(--title-art-top) + 112vw), transparent calc(var(--title-art-top) + 134vw));
  }

  .lobby-title::after {
    background: linear-gradient(#0c070380, #0c070314 calc(var(--title-logo) + 30px), #0c070314 calc(var(--title-art-top) + 96vw), #0c0703e6 calc(var(--title-art-top) + 128vw));
  }

  /*
   * The game's menu sits at the bottom, its five buttons filling the space under the picture. With two, they stand in
   * the middle of that space instead, just under the picture, and the footer stays at the bottom.
   */
  .lobby-title .title-menu {
    gap: 6px;
    margin-block: auto;
  }

  .title-button {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 5px 12px 5px 8px;
  }

  .title-button-art {
    width: 44px;
    height: 44px;
  }

  .title-button-text strong {
    font-size: 1.05rem;
  }

  .lobby-tagline {
    gap: 10px;
    font-size: 0.74rem;
    letter-spacing: 0.24em;
    white-space: nowrap;
  }

  .lobby-tagline::before,
  .lobby-tagline::after {
    width: 32px;
  }

  .lobby-title > .title-footer {
    gap: 0 12px;
  }

  .title-footer a.link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
  }

  /* On a phone the language sits at the top right, as in the game. */
  .lobby-title > .title-footer .lang-switch {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  .lobby-title > .title-footer .lang-switch .speed-choice {
    min-height: 32px;
    padding: 4px 10px;
    display: grid;
    place-items: center;
  }

  .lobby-title > .title-footer .lang-switch .speed-choice + .speed-choice {
    border-left: 1px solid rgb(243 220 149 / 0.4);
  }
}

@media (width <= 640px) and (height >= 501px) {
  .lobby-title {
    --title-bar: 46px;
    --title-logo: clamp(84px, 17dvh, 150px);
    --title-art-top: calc(var(--title-logo) + 44px + var(--title-bar) - 74vw);
    padding-top: calc(10px + var(--title-bar));
  }

  .lobby-title::after {
    background: linear-gradient(#0c070380, #0c070314 calc(var(--title-logo) + 30px + var(--title-bar)), #0c070314 calc(var(--title-art-top) + 96vw), #0c0703e6 calc(var(--title-art-top) + 128vw));
  }
}

/* A phone on its side: the logo on the left, the menu on the right. */
@media (height <= 500px) and (width <= 1000px) {
  .lobby-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 46%);
    grid-template-rows: 1fr auto auto;
    align-content: center;
    gap: 6px 20px;
    padding: 8px 16px;
  }

  .lobby-title > * {
    width: auto;
  }

  .lobby-title > .lobby-hero {
    grid-area: 1 / 1 / -1;
    align-self: start;
    margin-top: 42px;
  }

  .lobby-title > .title-menu,
  .lobby-title > .title-footer {
    grid-column: 2;
    width: auto;
    max-width: none;
  }

  .lobby-title > .title-menu {
    align-self: end;
    gap: 5px;
  }

  .lobby-title > .title-footer {
    position: static;
    justify-content: center;
  }

  .lobby-title .lobby-logo {
    height: clamp(56px, 19dvh, 96px);
  }

  .title-button {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 4px 12px 4px 8px;
  }

  .title-button-art {
    width: 40px;
    height: 40px;
  }

  .title-footer a.link {
    min-height: 36px;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
  }

  .lobby-title::before {
    background: var(--lobby-art-phone, var(--lobby-art)) left -5vw bottom / auto 128dvh no-repeat;
    mask-image: linear-gradient(90deg, black 34%, transparent 52%);
  }

  .lobby-title::after {
    background: linear-gradient(rgb(12 7 3 / 0.45), transparent 38%), linear-gradient(90deg, transparent 30%, rgb(12 7 3 / 0.6) 54%);
  }

  .lobby-tagline {
    font-size: 0.74rem;
    white-space: nowrap;
  }
}
