/* ==========================================================================
   The first screen: the words on the left; on the right, the climbers'
   cards fanned as a hand, on the app's sample data. world.css sets all of it
   in a painted scene, shows all six cards and stands the dealt one proud.

   Every card is one of the game's own paintings, drawn at no more than half
   its pixels, so it is sharp on a 2x screen.

   boot.js deals the climber (data-climber on <html>) before first paint.
   ========================================================================== */
.hero {
  position: relative;
  display: grid;
  overflow: hidden;
  isolation: isolate;
  /* Fills most of the window under the nav on a laptop. On taller windows it
     stops short (by up to 72px, starting at 760px tall) so the words never
     float in a wide band of empty night and the next section's edge shows.
     svh where the browser has it. */
  --hero-trim: clamp(0px, (100vh - 760px) * 0.45, 72px);
  min-height: clamp(600px, calc(100vh - var(--nav-h) - var(--v-outline-w) - var(--hero-trim)), 820px);
  min-height: clamp(600px, calc(100svh - var(--nav-h) - var(--v-outline-w) - var(--hero-trim)), 820px);
  border-bottom: 8px solid var(--v-ink);
  background: var(--v-bg-deep);
}
/* The field: the app's fine dot screen, so the night is not flat. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--v-line) 1px, transparent 1.3px);
  background-size: 14px 14px;
  opacity: 0.5;
  pointer-events: none;
}

/* The link-preview picture (og-v2.jpg) is this hero at 1200x630 with nothing
   that dates: no nav, no live count, no version numbers. */
.og .nav,
.og .hero-presence,
.og .hero-meta {
  display: none;
}
.og .hero {
  height: 630px;
  min-height: 0;
  border-bottom: 0;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 3vw, 56px);
  padding-block: clamp(20px, 3vh, 40px);
}

/* Wide windows: the words keep their own measure and the picture sits in the
   middle of what is left, so the spare room falls evenly either side of it. */
@media (min-width: 1440px) {
  .hero-inner {
    grid-template-columns: minmax(0, 36rem) minmax(0, 1fr);
  }
}

/* ---- Copy -------------------------------------------------------------------- */
.hero-copy {
  display: grid;
  justify-items: start;
  gap: clamp(10px, 1.2vw, 20px);
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* The live count always starts a row of its own: its text arrives after the
   page has drawn, and a chip row that re-wraps would shift everything. */
.hero-chips::after {
  content: "";
  flex-basis: 100%;
  order: 1;
}
/* The zero-height break gets a row gap on both sides, and a negative margin
   on the break itself is clamped away; pulling the chip up takes one back. */
.hero-chips .hero-presence {
  order: 2;
  margin-top: -8px;
}
.hero-title {
  font-family: var(--v-font-display);
  font-size: var(--t-hero);
  font-weight: var(--v-display-weight);
  line-height: 0.94;
  text-shadow: 4px 4px 0 var(--v-ink);
  transform: rotate(var(--v-title-tilt));
  transform-origin: 0 60%;
}
.hero-title span {
  display: block;
}
.hero-title .is-gold {
  color: var(--v-title);
}
.hero-title .is-paper {
  color: var(--v-text);
}
.hero-lede {
  max-width: 35rem;
  color: var(--v-text);
  font-size: clamp(1rem, 0.85rem + 0.42vw, 1.25rem);
  font-weight: 500;
  line-height: 1.5;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--v-text-2);
  font-size: var(--t-sm);
  font-weight: 600;
}
.hero-meta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--v-text);
  font-weight: 700;
  text-decoration-line: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
.hero-meta a:hover {
  color: var(--v-title);
}
.hero-meta .version {
  color: var(--v-title);
  font-weight: 800;
}
.hero-presence {
  gap: 8px;
  font-weight: 700;
  white-space: normal;
}

/* ---- The stage: the hand of climber cards ------------------------------------ */
.hero-stage {
  /* A hand card's width: five of them, overlapping, span the stage. */
  --hand-w: min(172px, 21.5cqw);
  position: relative;
  display: grid;
  justify-items: center;
  justify-self: center;
  width: 100%;
  max-width: 764px;
  container: hero-stage / inline-size;
}
/* The tag sits on the stage's corner. */
.hand-tag {
  position: absolute;
  top: -14px;
  right: max(10px, calc((100% - 746px) / 2 + 10px));
  z-index: 3;
  transform: rotate(3deg);
}

/* The hand: the other climbers, fanned. --i is a card's place among the ones
   showing (0 to 4); the fan is built from how far that is from the middle. */
.hand {
  display: flex;
  justify-content: center;
  margin-top: clamp(14px, 2.6cqw, 22px);
}
.hand-card {
  --i: var(--n);
  --d: calc(var(--i) - 2);
  position: relative;
  display: grid;
  flex: none;
  width: var(--hand-w);
  margin-inline: calc(var(--hand-w) * -0.07);
  overflow: hidden;
  border: var(--v-outline);
  border-radius: var(--v-radius-md);
  background: var(--v-paper);
  box-shadow: var(--v-shadow);
  color: var(--v-on-paper);
  rotate: calc(var(--d) * 4.5deg);
  translate: 0 calc(var(--d) * var(--d) * 5px);
  transform-origin: 50% 100%;
  animation:
    deal 420ms var(--ease-out) calc(260ms + var(--i) * 70ms) both,
    bob 4.6s ease-in-out calc(1400ms + var(--i) * 320ms) infinite alternate;
}
.hand-name {
  padding: 4px 9px 5px;
  border-bottom: var(--v-outline);
  background: var(--c);
  font-family: var(--v-font-heading);
  font-size: clamp(0.875rem, 2.5cqw, 1.125rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.hand-new {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0 6px;
  border: 1.5px solid var(--v-ink);
  border-radius: var(--v-radius-pill);
  background: var(--v-paper);
  font-size: var(--t-xs);
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
}
.hand-art {
  position: relative;
  aspect-ratio: 5 / 4;
  border-bottom: var(--v-outline);
  background: var(--art) center / cover no-repeat var(--v-bg);
}
.hand-foot {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 5px 6px 7px;
}
.hand-rate {
  font-family: var(--v-font-display);
  font-size: clamp(1.25rem, 4cqw, 1.875rem);
  font-weight: var(--v-display-weight);
  line-height: 1;
}
.hand-rate small {
  font-size: 0.6em;
}
.hand-rate--none {
  color: var(--v-on-paper-2);
}
.hand-runs {
  color: var(--v-on-paper-2);
  font-size: var(--t-xs);
  font-weight: 800;
}

/* Dealt once on load; then the hand shifts a little, as a held hand does. */
@keyframes deal {
  from {
    opacity: 0;
    translate: 0 36px;
  }
}
@keyframes bob {
  to {
    transform: translateY(-4px);
  }
}

/* ---- A narrow stage (phones): the card stands upright, the hand is two rows --- */
@container hero-stage (max-width: 519px) {
  .hand-tag {
    right: max(10px, calc((100% - 406px) / 2 + 10px));
  }
  .hand {
    flex-wrap: wrap;
    gap: 10px;
    width: min(100%, 406px);
  }
  .hand-card,
  .hand-card:nth-child(n) {
    width: calc((min(100cqw, 406px) - 20px) / 3);
    margin-inline: 0;
    rotate: none;
    translate: none;
  }
  /* Small cards: the small painting is enough. */
  .hand-art {
    background-image: var(--art-sm);
  }
  .hand-name {
    font-size: var(--t-sm);
  }
  .hand-rate {
    font-size: 1.375rem;
  }
}

/* ---- Tablets and phones: the words, then the picture -------------------------- */
@media (max-width: 1099px) {
  .hero {
    min-height: 0;
  }
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(28px, 5vw, 44px);
    padding-block: clamp(24px, 5vw, 44px) clamp(32px, 6vw, 56px);
  }
  .hero-lede {
    max-width: 40rem;
  }
  .hero-cta {
    width: 100%;
  }
  .hero-meta a {
    min-height: 44px;
  }
}
/* Tablets: the headline on the left, the words and buttons beside it. */
@media (min-width: 700px) and (max-width: 1099px) {
  .hero-copy {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto 1fr auto auto;
    column-gap: clamp(24px, 4vw, 56px);
  }
  .hero-chips {
    grid-column: 1 / -1;
  }
  .hero-title {
    grid-row: 2 / span 3;
    grid-column: 1;
    align-self: center;
  }
  .hero-lede,
  .hero-cta,
  .hero-meta {
    grid-column: 2;
  }
  .hero-lede {
    align-self: end;
  }
}
@media (max-width: 899px) {
  .hero-title {
    line-height: 0.98;
    text-shadow: 3px 3px 0 var(--v-ink);
  }
}
@media (max-width: 699px) {
  /* The desktop apps are no use on a phone; they stay in the Download section. */
  .hero-meta {
    display: none;
  }
}
@media (max-width: 599px) {
  .hero-cta .btn {
    flex: 1 1 100%;
  }
  /* A full-width button centres both of its lines; left-aligned, the title
     sat about 7px left of the button's middle. */
  .hero-cta .btn-stack {
    text-align: center;
  }
}

/* ---- Each climber: colour, numbers, painting ---------------------------------- */
/* The win rates repeat the numbers written on the cards (the app's sample
   data), so the bar and the figure cannot disagree. */
[data-c="ironclad"] {
  --c: var(--v-char-ironclad);
  --rate: 48.4%;
  --art: url("/assets/art/epoch/ironclad-560-v1.webp");
  --art-sm: url("/assets/art/epoch/ironclad-1x-v1.webp");
  --art-2x: url("/assets/art/epoch/ironclad-2x-v1.webp");
}
[data-c="silent"] {
  --c: var(--v-char-silent);
  --rate: 53.3%;
  --art: url("/assets/art/epoch/silent-560-v1.webp");
  --art-sm: url("/assets/art/epoch/silent-1x-v1.webp");
  --art-2x: url("/assets/art/epoch/silent-2x-v1.webp");
}
[data-c="defect"] {
  --c: var(--v-char-defect);
  --rate: 53.8%;
  --art: url("/assets/art/epoch/defect-560-v1.webp");
  --art-sm: url("/assets/art/epoch/defect-1x-v1.webp");
  --art-2x: url("/assets/art/epoch/defect-2x-v1.webp");
}
/* The Regent stands at the painting's left edge: a centred crop cut him to a
   sliver, so his card keeps the left of the picture. */
.hand-card[data-c="regent"] .hand-art {
  background-position: left center;
}
[data-c="regent"] {
  --c: var(--v-char-regent);
  --rate: 44.4%;
  --art: url("/assets/art/epoch/regent-560-v1.webp");
  --art-sm: url("/assets/art/epoch/regent-1x-v1.webp");
  --art-2x: url("/assets/art/epoch/regent-2x-v1.webp");
}
[data-c="necrobinder"] {
  --c: var(--v-char-necrobinder);
  --rate: 20%;
  --art: url("/assets/art/epoch/necrobinder-560-v1.webp");
  --art-sm: url("/assets/art/epoch/necrobinder-1x-v1.webp");
  --art-2x: url("/assets/art/epoch/necrobinder-2x-v1.webp");
}
[data-c="fool"] {
  --c: var(--v-char-fool);
  --art: url("/assets/art/epoch/fool-560-v1.webp");
  --art-sm: url("/assets/art/epoch/fool-1x-v1.webp");
}

/* ---- The roll ------------------------------------------------------------------ */
/* Each hand card's place in the markup (0 to 5). */
.hand-card:nth-child(1) {
  --n: 0;
}
.hand-card:nth-child(2) {
  --n: 1;
}
.hand-card:nth-child(3) {
  --n: 2;
}
.hand-card:nth-child(4) {
  --n: 3;
}
.hand-card:nth-child(5) {
  --n: 4;
}
.hand-card:nth-child(6) {
  --n: 5;
}
/* Without world.css the rolled climber's hand card steps out, and the cards
   after it move up one place so the fan stays even. */
[data-climber="ironclad"] .hand-card[data-c="ironclad"],
[data-climber="silent"] .hand-card[data-c="silent"],
[data-climber="defect"] .hand-card[data-c="defect"],
[data-climber="regent"] .hand-card[data-c="regent"],
[data-climber="necrobinder"] .hand-card[data-c="necrobinder"] {
  display: none;
}
[data-climber="ironclad"] .hand-card:nth-child(n + 2),
[data-climber="silent"] .hand-card:nth-child(n + 3),
[data-climber="defect"] .hand-card:nth-child(n + 4),
[data-climber="regent"] .hand-card:nth-child(n + 5),
[data-climber="necrobinder"] .hand-card:nth-child(n + 6) {
  --i: calc(var(--n) - 1);
}
