/* The Anvilbound Keys - dark pixel hall
   Ground: blue-charcoal. Fire: hammer-orange. Everything else recedes. */

:root {
  --coal: #07080C;
  --coal-2: #0B1018;
  --stone-900: #10141D;
  --stone-800: #161B26;
  --stone-line: #2A3140;
  --bone: #C4B49A;
  --parch: #D9C7A3;
  --ash: #8A8070;
  --hammer: #F0A020;
  --hammer-2: #E8941A;
  --ember: #FF7A2E;
  --r-common: #A9A395;
  --r-uncommon: #7BA05B;
  --r-rare: #6C93C9;
  --r-epic: #9C79CF;
  --r-legendary: #F0A020;
  --display: "Pirata One", "Luminari", "Grenze Gotisch", serif;
  --body: "Alegreya", "Palatino", Georgia, serif;
  --label: "Alegreya SC", "Alegreya", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--coal);
  color: var(--bone);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--hammer-2); color: var(--coal); }

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- sky */

.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--coal);
}
.sky video,
.sky img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.sky-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 20%, rgba(7, 8, 12, 0.18) 0%, rgba(7, 8, 12, 0.62) 70%, rgba(7, 8, 12, 0.86) 100%),
    rgba(7, 8, 12, 0.42);
}
.sky-noise {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.5) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(0, 0, 0, 0.5) 3px 4px);
  background-size: 4px 4px;
}

/* soot grain over everything */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- boot */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s steps(5);
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { position: relative; text-align: center; }
.boot-word {
  font-family: var(--display);
  font-size: clamp(30px, 6vw, 46px);
  color: var(--hammer);
  letter-spacing: 0.05em;
  margin-top: 18px;
}
.boot-hammer { width: 56px; height: 56px; }
.boot-hammer-head { transform-origin: 8px 8px; }
.boot #boot-strike .boot-hammer-head,
#boot.strike .boot-hammer-head { animation: strike 0.42s steps(3) 0.45s 1 both; }
@keyframes strike {
  0% { transform: rotate(-38deg); }
  60% { transform: rotate(14deg); }
  100% { transform: rotate(0deg); }
}
.boot-spark {
  position: absolute;
  left: 50%;
  top: 44px;
  width: 6px;
  height: 6px;
  background: var(--ember);
  opacity: 0;
}
#boot.strike .boot-spark { animation: spark 0.3s steps(3) 0.78s 1 both; }
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(14px, -18px) scale(2); }
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(7, 8, 12, 0.92);
  border-bottom: 1px solid var(--stone-line);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 24px;
  color: var(--hammer);
  letter-spacing: 0.05em;
}
.mark-hammer { width: 18px; height: 18px; }
.chip {
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--parch);
  background: var(--stone-900);
  border: 2px solid var(--stone-line);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.05), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip-dot {
  width: 6px;
  height: 6px;
  background: var(--ember);
  animation: chippulse 2.4s steps(2) infinite;
}
@keyframes chippulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------------------------------------------------------- hero */

.hero {
  min-height: 62svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px 40px;
}
.eyebrow {
  font-family: var(--label);
  font-size: 14px;
  letter-spacing: 0.34em;
  color: var(--ash);
  margin-bottom: 24px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(54px, 11vw, 108px);
  line-height: 1.02;
  color: var(--hammer);
  letter-spacing: 0.015em;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.65);
}
.hero-sub {
  margin-top: 26px;
  max-width: 40ch;
  font-size: clamp(19px, 2.2vw, 24px);
  font-style: italic;
  color: var(--parch);
}

/* ---------------------------------------------------------------- lore */

#lore {
  display: flex;
  justify-content: center;
  padding: 30px 18px 64px;
}
.lore-panel {
  max-width: 68ch;
  background: rgba(16, 20, 29, 0.82);
  border: 2px solid var(--stone-line);
  box-shadow:
    0 0 0 2px #000,
    inset 2px 2px 0 rgba(255, 255, 255, 0.045),
    inset -2px -2px 0 rgba(0, 0, 0, 0.55);
  padding: clamp(26px, 5vw, 46px);
}
.lore-panel h2 {
  font-family: var(--display);
  font-size: clamp(26px, 4vw, 34px);
  color: var(--hammer-2);
  letter-spacing: 0.03em;
  margin-bottom: 24px;
}
.lore-panel p { margin-bottom: 16px; color: var(--bone); }
.lore-panel p:last-child { margin-bottom: 0; }
.lore-keys {
  list-style: none;
  margin: 22px 0 26px;
  border-top: 1px solid var(--stone-line);
  border-bottom: 1px solid var(--stone-line);
  padding: 18px 0;
}
.lore-keys li { margin-bottom: 12px; }
.lore-keys li:last-child { margin-bottom: 0; }
.lore-keys b { font-weight: 500; }
.k-common { color: var(--r-common); }
.k-uncommon { color: var(--r-uncommon); }
.k-rare { color: var(--r-rare); }
.k-epic { color: var(--r-epic); }
.k-legendary { color: var(--r-legendary); }

/* ---------------------------------------------------------------- keys */

.keys { padding: 10px 18px 90px; }
.keys-heading {
  font-family: var(--display);
  text-align: center;
  font-size: clamp(34px, 5.6vw, 52px);
  color: var(--hammer);
  letter-spacing: 0.02em;
  margin-bottom: 46px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}
.keys-row {
  display: grid;
  gap: 26px;
  max-width: 1560px;
  margin: 0 auto;
}
.stage {
  text-align: center;
  outline: none;
}
.frame {
  position: relative;
  background: var(--stone-900);
  border: 2px solid #000;
  box-shadow:
    0 0 0 2px var(--stone-line),
    inset 2px 2px 0 rgba(255, 255, 255, 0.05),
    inset -2px -2px 0 rgba(0, 0, 0, 0.6);
  padding: 8px;
  transition: box-shadow 0.15s steps(2), filter 0.15s steps(2);
  filter: brightness(0.94);
  overflow: hidden;
}
.frame video,
.frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  image-rendering: pixelated;
  background: #000;
}
.stage:hover .frame,
.stage:focus-visible .frame {
  filter: brightness(1.08);
  box-shadow:
    0 0 0 2px var(--hammer-2),
    inset 2px 2px 0 rgba(255, 255, 255, 0.07),
    inset -2px -2px 0 rgba(0, 0, 0, 0.6);
}
.stage:focus-visible .frame { outline: 2px dashed var(--hammer); outline-offset: 4px; }

.plaque {
  display: inline-block;
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.3em;
  padding: 9px 14px;
  margin-top: 16px;
  background: var(--stone-900);
  border: 2px solid var(--stone-line);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.04), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
}
.plaque-common { color: var(--r-common); }
.plaque-uncommon { color: var(--r-uncommon); border-color: #33422A; }
.plaque-rare { color: var(--r-rare); border-color: #26374F; }
.plaque-epic { color: var(--r-epic); border-color: #3A2C52; }
.plaque-legendary { color: var(--r-legendary); border-color: #59400F; }

.caption {
  display: block;
  margin: 12px auto 0;
  max-width: 30ch;
  font-size: 18px;
  color: var(--ash);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s steps(3), transform 0.18s steps(3);
}
.caption b { font-weight: 500; color: var(--parch); }
.stage:hover .caption,
.stage:focus-visible .caption,
.stage.tapped .caption { opacity: 1; transform: none; }

/* ember particles */
.pxember {
  position: absolute;
  width: 4px;
  height: 4px;
  pointer-events: none;
  z-index: 5;
}

/* ---------------------------------------------------------------- footer */

footer {
  text-align: center;
  padding: 60px 20px 70px;
  border-top: 1px solid var(--stone-line);
  background: rgba(7, 8, 12, 0.6);
}
.foot-line {
  font-family: var(--display);
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.5;
  color: var(--parch);
  letter-spacing: 0.03em;
  max-width: 40ch;
  margin: 0 auto 12px;
}
.foot-sub { color: var(--ash); margin-bottom: 26px; }
.hall-closed {
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: 0.26em;
  color: var(--ash);
  background: var(--stone-900);
  border: 2px solid var(--stone-line);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.03), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
  padding: 12px 18px;
  cursor: not-allowed;
  opacity: 0.75;
}

/* ---------------------------------------------------------------- layout */

/* mobile first: one key per view, snap scroll */
.keys-row { grid-template-columns: 1fr; }
@media (max-width: 1099px) {
  html { scroll-snap-type: y proximity; }
  .stage { scroll-snap-align: center; min-height: 86svh; display: flex; flex-direction: column; justify-content: center; }
  .frame { max-width: min(78vw, 440px); margin: 0 auto; }
  .caption { opacity: 1; transform: none; } /* touch has no hover; captions stay */
}
@media (min-width: 1100px) {
  .keys-row { grid-template-columns: repeat(5, 1fr); }
  body { font-size: 20px; }
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  #boot { display: none; }
  .chip-dot { animation: none; }
  .frame, .caption { transition: none; }
}
