/* Serpent Survival's website. One file, no build step.
   The colours are the game's icon palette (Docs/UI/Icons.md); the type is its UI font, Alegreya Sans. */

@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1C1F13;        /* the logo's outline colour: the page */
  --ink-raised: #24281A;
  --line: #3A4029;
  --bone: #EFE6CB;
  --bone-dim: #C6BEA3;
  --lit: #FFFAE8;
  --sand: #CDB27E;
  --tan: #9A7A52;
  --umber: #3B2620;
  --leaf: #586B3A;

  --wrap: 68rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section: clamp(4rem, 9vw, 7.5rem);

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone-dim);
  font-family: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.125rem, 1.02rem + 0.35vw, 1.3rem);
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

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

p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

p + p {
  margin-top: 1em;
}

a {
  color: var(--sand);
  text-underline-offset: 0.18em;
}

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

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

strong {
  font-weight: 700;
  color: var(--bone);
}

/* Headings wear the logo's lettering: black capitals, bone to sand, an umber block shadow. */
h2,
h3 {
  margin: 0;
  font-weight: 900;
  text-transform: uppercase;
  font-variant-numeric: lining-nums;
  text-wrap: balance;
  color: var(--bone);
}

h2 {
  margin-bottom: 0.9em;
  font-size: clamp(1.55rem, 1.15rem + 1.9vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: 0.07em;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  h2 {
    width: fit-content;
    background: linear-gradient(var(--bone) 25%, var(--sand));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0.055em 0.055em 0 var(--umber));
  }
}

h3 {
  margin-bottom: 0.7em;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--sand);
}

.wrap,
.wrap-wide {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
}

.wrap-wide {
  max-width: calc(80rem + 2 * var(--gutter));
}

.nowrap {
  white-space: nowrap;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--bone);
  color: var(--ink);
  font-weight: 700;
}

.skip:focus {
  top: 1rem;
}

/* The diamondback's diamonds, as in the logo. */
.ornament {
  height: 1.5rem;
  margin-bottom: 2.5rem;
  background: url("../img/diamonds.svg") center / contain no-repeat;
}

/* The call to action. */
.button {
  display: inline-block;
  padding: 0.8em 1.7em 0.85em;
  border: 2px solid var(--ink);
  background: linear-gradient(var(--bone), var(--sand));
  box-shadow: inset 0 2px 0 var(--lit), inset 0 -3px 0 var(--tan), 5px 5px 0 var(--umber);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.button:hover {
  color: var(--ink);
  background: linear-gradient(var(--lit), var(--bone));
  transform: translate(2px, 2px);
  box-shadow: inset 0 2px 0 var(--lit), inset 0 -3px 0 var(--tan), 3px 3px 0 var(--umber);
}

.button:active {
  transform: translate(5px, 5px);
  box-shadow: inset 0 2px 0 var(--lit), inset 0 -3px 0 var(--tan), 0 0 0 var(--umber);
}

/* ---------- The top bar ---------- */

.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
}

.top-mark {
  border-radius: 50%;
}

.top-mark img {
  width: 3rem;
  height: 3rem;
}

.top-nav {
  display: none;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.top-nav a {
  color: var(--bone);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-shadow: 0 1px 6px rgb(28 31 19 / 0.9);
  text-transform: uppercase;
}

.top-nav a:hover {
  color: var(--lit);
  text-decoration: underline;
  text-decoration-color: var(--sand);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* ---------- The hero ----------
   Narrow screens: the whole square key art, the logo lapping over its foot.
   Wide screens: the header capsule's layout, art on the left, the logo on the right in the dark. */

.hero {
  position: relative;
}

.hero-art {
  position: relative;
  height: min(100vw, 34rem);
  overflow: hidden;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(28 31 19 / 0.5), transparent 22%),
    linear-gradient(transparent 55%, var(--ink));
}

.hero-inner {
  position: relative;
  margin-top: -5.5rem;
  padding: 0 var(--gutter) 1rem;
}

.hero-words {
  text-align: center;
}

.hero h1 {
  margin: 0;
}

.hero h1 img {
  width: min(76vw, 26rem);
  margin-inline: auto;
}

.hero-line {
  max-width: 22em;
  margin: 1.4rem auto 1.8rem;
  color: var(--bone);
  font-size: 1.25em;
  line-height: 1.3;
  text-wrap: balance;
}

.hero-note {
  margin-top: 1.5rem;
  color: var(--sand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

@media (min-width: 820px) {
  .top-nav {
    display: flex;
  }

  .hero {
    display: grid;
    align-items: center;
    min-height: min(92vh, 70rem);
    padding-block: 6rem 4rem;
  }

  .hero-art {
    position: absolute;
    inset: 0;
    height: auto;
  }

  /* The snake is in the picture's left half: on a tall window the picture is cut at its sides, and the cut comes
     off the right, the logo's side. */
  .hero-art img {
    object-position: 18% 50%;
  }

  .hero-art::after {
    background:
      linear-gradient(rgb(28 31 19 / 0.6), transparent 20%),
      linear-gradient(transparent 72%, var(--ink)),
      linear-gradient(to right, transparent 40%, rgb(28 31 19 / 0.86) 78%);
  }

  .hero-inner {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    max-width: 120rem;
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .hero-words {
    width: clamp(22rem, 34vw, 42rem);
  }

  .hero h1 img {
    width: 100%;
  }

  .hero-line {
    text-shadow: 0 1px 10px rgb(28 31 19 / 0.9);
  }
}

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

  .hero-words > * {
    animation: rise 0.7s ease-out both;
  }

  .hero-words > :nth-child(2) {
    animation-delay: 0.12s;
  }

  .hero-words > :nth-child(3) {
    animation-delay: 0.22s;
  }

  .hero-words > :nth-child(4) {
    animation-delay: 0.32s;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.8rem);
  }
}

/* ---------- The introduction ---------- */

.intro {
  padding-block: calc(var(--section) * 0.6) calc(var(--section) * 0.75);
  text-align: center;
}

.lead,
.lead-more {
  max-width: 44rem;
  margin-inline: auto;
  text-wrap: pretty;
}

.lead {
  color: var(--bone);
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 1.9rem);
  line-height: 1.3;
  text-wrap: balance;
}

.lead-more {
  margin-top: 1.4em;
}

/* ---------- Screenshots ---------- */

.shots-section {
  padding-bottom: calc(var(--section) * 0.25);
}

.shots-section h2 {
  margin-inline: auto;
}

.shots {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

@media (min-width: 640px) {
  .shots {
    grid-template-columns: 1fr 1fr;
  }
}

.shots a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--ink-raised);
}

.shots img {
  width: 100%;
  transition: transform 0.3s ease-out;
}

.shots a:hover,
.shots a:focus-visible {
  border-color: var(--sand);
}

@media (prefers-reduced-motion: no-preference) {
  .shots a:hover img {
    transform: scale(1.03);
  }
}

.shots figcaption {
  margin-top: 0.6rem;
  font-size: 0.9em;
  line-height: 1.35;
}

/* ---------- Two sections side by side ---------- */

.pair {
  display: grid;
  gap: var(--section) clamp(2.5rem, 6vw, 5.5rem);
  padding-block: var(--section);
}

@media (min-width: 820px) {
  .pair {
    grid-template-columns: 1fr 1fr;
  }
}

.points li {
  position: relative;
  padding-left: 1.7em;
}

.points li + li {
  margin-top: 0.85em;
}

.points li::before,
.features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 0.6em;
  height: 0.9em;
  background: url("../img/diamond.svg") center / contain no-repeat;
}

/* ---------- The band of art ---------- */

.band {
  position: relative;
  border-block: 1px solid var(--line);
  background: var(--ink-raised);
}

.band-art {
  position: relative;
  aspect-ratio: 21 / 9;
  overflow: hidden;
}

.band-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 40%;
}

.band-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 60%, var(--ink-raised));
}

.band-inner {
  position: relative;
  padding-block: 1.5rem 3.5rem;
}

@media (min-width: 1000px) {
  .band-art {
    position: absolute;
    inset: 0 0 0 36%;
    aspect-ratio: auto;
  }

  .band-art img {
    object-position: 55% 40%;
  }

  .band-art::after {
    background: linear-gradient(to right, var(--ink-raised), rgb(36 40 26 / 0.6) 22%, transparent 50%);
  }

  .band-inner {
    padding-block: clamp(4.5rem, 8vw, 7rem);
  }

  .band-words {
    max-width: 40%;
  }
}

/* ---------- Features ---------- */

.features-section {
  padding-block: 0 var(--section);
}

.features-section h2 {
  margin-inline: auto;
}

.features {
  columns: 2 22rem;
  column-gap: clamp(2.5rem, 6vw, 5.5rem);
  font-variant-numeric: lining-nums;
}

.features li {
  position: relative;
  padding: 0.75em 0 0.75em 1.7em;
  border-bottom: 1px solid var(--line);
  break-inside: avoid;
}

.features li::before {
  top: 1.07em;
}

/* ---------- Early Access ---------- */

.early {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
  background: var(--ink-raised);
}

.early-columns {
  display: grid;
  gap: 2.5rem clamp(2rem, 4vw, 3.5rem);
  font-size: 0.95em;
}

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

/* ---------- The last call to action ---------- */

.steam {
  position: relative;
  border-block: 1px solid var(--line);
  background:
    radial-gradient(ellipse at center, rgb(28 31 19 / 0.78), rgb(28 31 19 / 0.3) 75%),
    var(--ink) url("../img/backdrop.webp") center 30% / cover no-repeat;
  text-align: center;
}

.steam-inner {
  padding-block: clamp(4.5rem, 11vw, 9rem);
}

.steam h2 {
  margin: 0 auto 0.5em;
}

.steam p {
  max-width: 26em;
  margin: 0 auto 2rem;
  color: var(--bone);
  text-wrap: balance;
}

/* ---------- The foot ---------- */

.foot {
  padding-block: 2.5rem 3rem;
  font-size: 0.9rem;
  font-variant-numeric: lining-nums;
  text-align: center;
}

.foot p {
  color: var(--bone);
}

.foot .fine {
  max-width: 46rem;
  margin: 0.6rem auto 0;
  color: var(--bone-dim);
  font-size: 0.8rem;
}

/* ---------- The screenshot viewer (js/site.js opens it; without it the links open the picture) ---------- */

html:has(.viewer[open]) {
  overflow: hidden;
}

.viewer {
  width: min(94vw, (100vh - 9rem) * 16 / 9);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bone);
  overflow: visible;
}

.viewer::backdrop {
  background: rgb(14 16 9 / 0.93);
}

.viewer img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--ink-raised);
}

.viewer figcaption {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  text-align: center;
}

.viewer-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(28 31 19 / 0.82);
  color: var(--bone);
  cursor: pointer;
}

.viewer-button:hover {
  border-color: var(--sand);
  color: var(--lit);
}

/* The arrows and the cross are drawn, so they need no characters from a font. */
.viewer-button::before,
.viewer-button::after {
  content: "";
  display: block;
  grid-area: 1 / 1;
}

.viewer-prev,
.viewer-next {
  top: calc(50% - 2.6rem);
}

.viewer-prev {
  left: 0.75rem;
}

.viewer-next {
  right: 0.75rem;
}

.viewer-prev::before,
.viewer-next::before {
  width: 0.7rem;
  height: 0.7rem;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
}

.viewer-prev::before {
  transform: translateX(0.15rem) rotate(45deg);
}

.viewer-next::before {
  transform: translateX(-0.15rem) rotate(-135deg);
}

.viewer-close {
  top: 0.75rem;
  right: 0.75rem;
}

.viewer-close::before,
.viewer-close::after {
  width: 1.3rem;
  height: 3px;
  background: currentColor;
}

.viewer-close::before {
  transform: rotate(45deg);
}

.viewer-close::after {
  transform: rotate(-45deg);
}
