/* Base: fonts, colors, reset, layout and the pieces every section shares.
   Breakpoints used across the stylesheets: 1199px, 959px, 719px and 389px. */

@font-face { font-family: "Jersey 10"; src: url("../fonts/jersey-10.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("../fonts/pixelify-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
/* Pixelify's 5 reads almost like an S, so text takes its digits from Jersey 10, sized to Pixelify's, as the game does. */
@font-face {
  font-family: "Jersey 10 Digits";
  src: url("../fonts/jersey-10.woff2") format("woff2");
  unicode-range: U+0030-0039;
  font-weight: 400 700;
  size-adjust: 117.8%;
  ascent-override: 78%;
  descent-override: 23.7%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* The game's night theme. */
  --night: #0e1016;
  --night-band: #12151d;
  --plate: #1a1e2a;
  --plate-raised: #222838;
  --line: #2c3243;
  --line-strong: #3b4357;
  --text: #eef1f8;
  --muted: #a7aec0;
  --dim: #7c8499;

  /* The torch orange of the game's main buttons. */
  --torch: #ffa43a;
  --torch-deep: #d8621a;
  --torch-light: #ffc07a;

  /* Each section takes the color of its page in the game. */
  --heroes: #57b9ff;
  --summon: #b57cff;
  --fusion: #ff5fd2;
  --dungeon: #ff6a5c;
  --forge: #ff6b3d;
  --porter: #6ee06a;
  --market: #ffd447;
  --invites: #7fe3ff;

  /* Rarities, as in the game. */
  --common: #c9ced6;
  --uncommon: #6ee06a;
  --rare: #4aa8ff;
  --epic: #b670ff;
  --legendary: #ffb22e;
  --mythic: #ff4d6d;

  --display: "Jersey 10", "Trebuchet MS", sans-serif;
  --text-font: "Jersey 10 Digits", "Pixelify Sans", "Trebuchet MS", sans-serif;
  --mono: ui-monospace, Consolas, "Courier New", monospace;

  --corners: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 4px 4px);
  --corners-small: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px), 0 3px, 3px 3px);

  --accent: var(--torch);
  --header-height: 84px;

  font-family: var(--text-font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--night);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 12px); }
body { margin: 0; min-width: 320px; background: var(--night); }
/* Decorations that bleed past a section edge never make the page scroll sideways. */
main { overflow-x: clip; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
summary { cursor: pointer; }
img, canvas, video { display: block; max-width: 100%; }
img, canvas { image-rendering: pixelated; }
button, a, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--torch); outline-offset: 5px; }
::selection { background: var(--torch); color: #2b1408; }
.icon-sprite { display: none; }

/* ---------- Layout ---------- */
.wrap { width: min(1224px, calc(100% - 96px)); margin-inline: auto; }
.section { padding-block: 120px; }
/* A band sets a section apart with a slightly lighter night. */
.band { background: var(--night-band); border-block: 1px solid var(--line); }

.skip-link { position: fixed; z-index: 30; top: -100px; left: 16px; padding: 14px 18px; background: var(--torch); color: #2b1408; }
.skip-link:focus { top: 16px; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; }
h2 { font-size: 68px; line-height: .88; letter-spacing: -.2px; }
h3 { font-size: 34px; line-height: 1; }
h4 { font-size: 26px; line-height: 1; }
.lead { max-width: 440px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.inline-link { color: var(--torch); }
.inline-link:hover { text-decoration: underline; }

/* A section opens with its marker, the section's icon lit in its color, then the title and the lead. */
.section-head { display: grid; justify-items: start; gap: 22px; }
.marker {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  background: color-mix(in srgb, var(--accent) 12%, var(--plate));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 26px color-mix(in srgb, var(--accent) 22%, transparent);
  clip-path: var(--corners);
}
.marker img { max-width: 44px; max-height: 44px; height: auto; }
.marker .hero-sprite { --scale: 3; }
.marker-glyph { color: var(--accent); font: 46px/1 var(--display); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 30px 15px;
  border: 0;
  color: #2b1408;
  background: var(--torch);
  box-shadow: inset 0 -6px 0 var(--torch-deep), inset 0 3px 0 var(--torch-light);
  clip-path: var(--corners);
  font: 30px/1 var(--display);
  white-space: nowrap;
  transition: filter .15s, transform .15s;
}
.button:hover { filter: brightness(1.08); transform: translateY(-2px); }
.button:active { transform: translateY(1px); }
.button-small { min-height: 44px; padding: 8px 20px 11px; font-size: 24px; box-shadow: inset 0 -4px 0 var(--torch-deep), inset 0 2px 0 var(--torch-light); }
/* The quiet button: a dark plate, for the second choice beside the main one. */
.button-quiet { color: var(--text); background: var(--plate-raised); box-shadow: inset 0 -5px 0 #141824, inset 0 0 0 2px var(--line-strong); }
.button-quiet:hover { color: var(--torch); }
.button .social-icon { width: 20px; height: 20px; }

.social-links { display: flex; align-items: center; gap: 8px; }
.social { display: grid; place-items: center; width: 40px; height: 40px; color: #c3c9d6; background: var(--plate); box-shadow: inset 0 0 0 2px var(--line); clip-path: var(--corners-small); transition: color .15s, background .15s; }
.social:hover { color: var(--torch); background: var(--plate-raised); }
.social-icon { width: 18px; height: 18px; flex: none; }

/* ---------- Copyable addresses ---------- */
.address-row { display: flex; align-items: center; gap: 12px; }
.address-row code { flex: 1; min-width: 0; color: var(--text); font: 15px/1.5 var(--mono); overflow-wrap: anywhere; user-select: all; }
.copy-button, .wallet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-width: 88px;
  min-height: 42px;
  padding: 8px 14px 10px;
  border: 0;
  color: var(--text);
  background: var(--plate-raised);
  box-shadow: inset 0 -3px 0 #141824, inset 0 0 0 2px var(--line-strong);
  clip-path: var(--corners-small);
  font: 22px/1 var(--display);
  transition: color .15s, background .15s;
}
.copy-button:hover, .wallet-link:hover { color: var(--torch); background: #2a3144; }
.copy-button.copied { color: var(--porter); }

/* ---------- Sprites ---------- */
/* A hero portrait: a 16 x 16 crop of the idle sheet's first frame, as in the game's menus. */
.hero-sprite {
  --scale: 4;
  --crop-x: 9;
  --crop-y: 6;
  display: block;
  flex: none;
  width: calc(16px * var(--scale));
  height: calc(16px * var(--scale));
  background-repeat: no-repeat;
  background-size: calc(512px * var(--scale)) calc(128px * var(--scale));
  background-position: calc(-1px * var(--crop-x) * var(--scale)) calc(-1px * var(--crop-y) * var(--scale));
  image-rendering: pixelated;
}
.hero-sprite.swordsman { background-image: url("../assets/heroes/swordsman-idle.png"); }
.hero-sprite.spearman { --crop-x: 8; --crop-y: 4; background-image: url("../assets/heroes/spearman-idle.png"); }
.hero-sprite.archer { --crop-x: 8; --crop-y: 6; background-image: url("../assets/heroes/archer-idle.png"); }
.hero-sprite.is-idle { animation: hero-idle 3.2s steps(16) infinite; }
@keyframes hero-idle { to { background-position-x: calc(-1px * var(--crop-x) * var(--scale) - 512px * var(--scale)); } }

/* A small empty card: the rarity frame of --frame (0 Common to 5 Mythic) at --scale. */
.mini-card {
  --frame: 0;
  --scale: 1;
  display: block;
  width: calc(40px * var(--scale));
  height: calc(56px * var(--scale));
  background: url("../assets/ui/rarity-frames.png") calc(-40px * var(--scale) * var(--frame)) 0 / calc(240px * var(--scale)) calc(56px * var(--scale)) no-repeat;
  image-rendering: pixelated;
}
/* A mint card: the card back with the holographic effect playing over it. */
.mint-card {
  --scale: 2;
  position: relative;
  display: block;
  width: calc(40px * var(--scale));
  height: calc(56px * var(--scale));
  background: url("../assets/ui/card-back.png") 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.mint-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background: url("../assets/ui/card-holo-anim.png") 0 0 / calc(1000px * var(--scale)) 100% no-repeat;
  image-rendering: pixelated;
  mix-blend-mode: screen;
  opacity: .5;
  animation: holo-loop 2.5s steps(25) infinite;
}
@keyframes holo-loop { to { background-position-x: calc(-1000px * var(--scale)); } }

/* Sprites inside [data-play] only move while it is on screen (js/motion.js marks it .is-playing). */
[data-play]:not(.is-playing), [data-play]:not(.is-playing) * { animation-play-state: paused !important; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1199px) {
  .wrap { width: calc(100% - 64px); }
  h2 { font-size: 60px; }
}
@media (max-width: 959px) {
  .section { padding-block: 96px; }
  h2 { font-size: 56px; }
}
@media (max-width: 719px) {
  :root { --header-height: 68px; font-size: 16px; }
  .wrap { width: calc(100% - 32px); }
  .section { padding-block: 72px; }
  h2 { font-size: 52px; }
  h3 { font-size: 30px; }
  .lead { font-size: 16px; }
  .section-head { gap: 18px; }
  .marker { width: 52px; height: 52px; }
  .button { min-height: 54px; font-size: 27px; padding-inline: 24px; }
  .address-row { flex-wrap: wrap; }
  .address-row code { flex-basis: 100%; font-size: 14px; }
  .address-row .copy-button, .address-row .wallet-link { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
