/* The Reaper's Rest — landing page
   "Ember Tavern" palette from the game (Assets/Scripts/UI/UiKit.cs) */
@font-face {
  font-family: "Lilita One";
  src: url("assets/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --maroon: #2A0E12;   /* pages */
  --panel: #160A0C;    /* boxes */
  --red: #E8364A;
  --amber: #F2B33D;
  --blue: #5A55E0;
  --green: #3DDC6A;
  --cream: #FFF1D6;    /* text */
  --grey: #A88F85;     /* quiet text */
  --ink: #120707;      /* black text on buttons */
  --sky-top: #0b0414;
  --pixel: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--maroon);
  color: var(--cream);
  font-family: "Lilita One", "Trebuchet MS", system-ui, sans-serif;
  font-size: 19px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--amber); }
strong { color: var(--amber); font-weight: normal; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* Retro screen: scanlines + soft dither over the whole page */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ---------- Buttons (flat, colored, black text, dark lip) ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-block;
  padding: 14px 26px 17px;
  border: 3px solid #000;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  letter-spacing: .04em;
  box-shadow: inset 0 -7px 0 rgba(0,0,0,.28), 0 6px 0 rgba(0,0,0,.45);
  transition: transform .08s steps(2), filter .1s;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), 0 2px 0 rgba(0,0,0,.45); }
.btn-amber { background: var(--amber); }
.btn-blue { background: var(--blue); }
.btn-red { background: var(--red); }

/* Dark red-brown panel with a black edge */
.panel {
  background: var(--panel);
  border: 3px solid #000;
  border-radius: 16px;
  box-shadow: 0 0 0 3px #3b161b, 0 18px 40px rgba(0,0,0,.55);
}

.kicker {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 16px;
  letter-spacing: .18em;
}
h2 { font-size: clamp(30px, 4.4vw, 50px); line-height: 1.08; margin: 0 0 16px; font-weight: normal; }
h3 { font-size: clamp(26px, 3vw, 36px); line-height: 1.1; margin: 0 0 10px; font-weight: normal; }
h2, h3, .title { text-shadow: 0 4px 0 #000; }

/* ================= HERO ================= */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  background: var(--sky-top);
  isolation: isolate;
}
.layers { position: absolute; inset: 0; }
.layer {
  position: absolute; left: -3%; top: -3%;
  width: 106%; height: 106%; max-width: none;
  object-fit: cover;
  object-position: 50% 40%;
  image-rendering: pixelated;
  will-change: transform;
  transform-origin: 50% 55%;
}
.dust { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }

/* dark edges like the game camera, and a dark middle so the title reads well */
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background:
    radial-gradient(ellipse 60% 40% at 50% 42%, rgba(10,4,8,.62), transparent 100%),
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(0,0,0,.75) 100%),
    linear-gradient(transparent 70%, rgba(18,6,18,.9));
}

.topbar {
  position: absolute; z-index: 10; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px max(16px, 3vw);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--cream); text-decoration: none; font-size: 20px; letter-spacing: .06em;
  text-shadow: 0 3px 0 #000;
}
.brand-skull {
  width: 28px; height: 28px;
  background: url("assets/img/favicon.svg") center / contain no-repeat;
  image-rendering: pixelated;
}
.topbar-links { display: flex; gap: 22px; }
.topbar-links a {
  color: var(--cream); text-decoration: none; font-size: 17px; letter-spacing: .06em;
  text-shadow: 0 3px 0 #000; opacity: .9;
}
.topbar-links a:hover { color: var(--amber); opacity: 1; }

.hero-text {
  position: absolute; z-index: 5;
  left: 50%; top: 23%;
  width: min(900px, 100% - 32px);
  transform: translateX(-50%);
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.wip-chip {
  margin: 0 0 14px;
  padding: 5px 14px 7px;
  background: var(--red); color: var(--ink);
  border: 3px solid #000; border-radius: 10px;
  font-size: 15px; letter-spacing: .14em;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
  transform: rotate(-2deg);
}
.title {
  margin: 0;
  font-weight: normal;
  font-size: clamp(48px, 9.5vw, 128px);
  line-height: .92;
  color: var(--amber);
  letter-spacing: .01em;
  text-shadow:
    0 6px 0 #000, 4px 4px 0 #000, -4px 4px 0 #000, 4px -2px 0 #000, -4px -2px 0 #000,
    0 0 40px rgba(242,179,61,.35);
}
.title span { display: block; font-size: .42em; color: var(--cream); letter-spacing: .3em; margin-bottom: .08em; }
.tagline {
  margin: 18px 0 26px;
  font-size: clamp(18px, 2.2vw, 24px);
  color: var(--cream);
  text-shadow: 0 3px 0 #000;
}
.hero .buttons { justify-content: center; }

.scroll-hint {
  position: absolute; z-index: 6; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--cream); text-decoration: none; font-size: 14px; letter-spacing: .25em;
  text-shadow: 0 2px 0 #000;
}
.scroll-hint i {
  width: 18px; height: 18px;
  border-right: 4px solid var(--amber); border-bottom: 4px solid var(--amber);
  transform: rotate(45deg);
  animation: bob 1.2s steps(3) infinite;
}
@keyframes bob { 50% { translate: 0 6px; } }

/* ================= INTRO ================= */
.intro {
  position: relative;
  padding: 90px 0 40px;
  text-align: center;
  background: linear-gradient(#120612, var(--maroon) 160px);
}
.intro::before { /* castle wall edge on top */
  content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 24px;
  background:
    linear-gradient(90deg, #120612 0 50%, transparent 50%) 0 0 / 48px 12px repeat-x,
    linear-gradient(#120612, #120612) 0 12px / 100% 12px no-repeat;
}
.intro .lead { max-width: 760px; margin: 0 auto; color: #f0dcc2; font-size: clamp(19px, 2vw, 22px); }

/* ================= FEATURES ================= */
.features { width: min(1180px, 100% - 32px); margin: 40px auto 80px; display: grid; gap: 90px; }
.feature {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  align-items: center;
}
.feature.flip { grid-template-columns: 1fr 1.35fr; }
.feature.flip .shot { order: 2; }
.shot {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid #000;
  border-radius: 14px;
  box-shadow: 0 0 0 4px #3b161b, 0 26px 60px rgba(0,0,0,.6);
  background: #000;
}
.shot img {
  position: absolute; left: 0; top: -9%;
  width: 100%; height: 118%;
  object-fit: cover;
  image-rendering: pixelated;
  will-change: transform;
}
.feature-text {
  position: relative; z-index: 2;
  padding: 30px 30px 32px;
  margin-left: -60px;
}
.feature.flip .feature-text { margin-left: 0; margin-right: -60px; }
.feature-text p { margin: 0; color: #f0dcc2; }
.tag {
  display: inline-block;
  margin: 0 0 12px !important;
  padding: 3px 12px 5px;
  border: 3px solid #000; border-radius: 9px;
  color: var(--ink) !important; font-size: 14px; letter-spacing: .14em;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
}
.tag-amber { background: var(--amber); }
.tag-red { background: var(--red); }
.tag-blue { background: var(--blue); }
.tag-green { background: var(--green); }

/* ================= BAND ================= */
.band {
  position: relative;
  height: clamp(380px, 70vh, 720px);
  overflow: hidden;
  border-block: 4px solid #000;
  display: grid; place-items: center;
}
.band-img {
  position: absolute; left: 0; right: 0; top: -25%; height: 150%;
  background-size: cover; background-position: center;
  image-rendering: pixelated;
  filter: brightness(1.7) saturate(1.2);
  will-change: transform;
}
.band::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(22,10,12,.55) 0 30%, rgba(22,10,12,.15) 60%, rgba(22,10,12,.7));
}
.band-text { position: relative; z-index: 2; text-align: center; padding: 0 16px; }
.band-quote {
  margin: 0;
  font-size: clamp(28px, 4.6vw, 58px);
  line-height: 1.1;
  max-width: 900px;
  text-shadow: 0 5px 0 #000;
}

/* ================= TEASER ================= */
.teaser { padding: 110px 0 60px; }
.teaser-grid { display: grid; grid-template-columns: 1fr auto; gap: 60px; align-items: center; }
.teaser-copy > p { color: #f0dcc2; max-width: 560px; }
.gallery { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gallery img {
  width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover;
  border: 3px solid #000; border-radius: 10px;
  box-shadow: 0 0 0 3px #3b161b;
  image-rendering: pixelated;
  transition: transform .15s steps(3);
}
.gallery img:hover { transform: scale(1.04) rotate(-1deg); }
.phone {
  width: min(330px, 80vw);
  aspect-ratio: 9 / 16;
  padding: 12px;
  background: var(--panel);
  border: 4px solid #000;
  border-radius: 34px;
  box-shadow: 0 0 0 4px #3b161b, 0 30px 70px rgba(0,0,0,.6), 0 0 80px rgba(242,179,61,.12);
  transform: rotate(2deg);
}
.phone video { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; background: #000; display: block; }

/* ================= WIP ================= */
.wip { padding: 40px 0 70px; }
.wip-box {
  display: flex; gap: 28px; align-items: center;
  padding: 32px 36px;
  border-color: #000;
  background:
    repeating-linear-gradient(-45deg, rgba(232,54,74,.10) 0 18px, transparent 18px 36px),
    var(--panel);
}
.wip-box h2 { font-size: clamp(26px, 3.4vw, 38px); color: var(--amber); margin-bottom: 8px; }
.wip-box p { margin: 0; color: #f0dcc2; }
.wip-candle {
  flex: none;
  width: 54px; height: 110px;
  background: url("assets/img/candle.svg") center bottom / contain no-repeat;
  image-rendering: pixelated;
  animation: flicker .5s steps(2) infinite;
}
@keyframes flicker { 50% { filter: brightness(1.25); } }

/* ================= DEV ================= */
.dev { padding: 30px 0 120px; }
.dev-grid { display: grid; grid-template-columns: 1fr 260px; gap: 50px; align-items: center; }
.dev-card { padding: 36px; }
.dev-card p { color: #f0dcc2; }
.dev-flag { text-align: center; }
.dev-flag p { margin: 12px 0 0; letter-spacing: .3em; color: var(--grey); }
.flag {
  width: 100%; aspect-ratio: 5/3;
  border: 4px solid #000; border-radius: 12px;
  box-shadow: 0 0 0 4px #3b161b, 0 20px 40px rgba(0,0,0,.5);
  background: url("assets/img/bahrain_flag.svg") center / cover no-repeat;
  image-rendering: pixelated;
  animation: wave 3s steps(6) infinite alternate;
  transform-origin: left center;
}
@keyframes wave { from { transform: skewY(-1.5deg); } to { transform: skewY(1.5deg); } }

/* ================= FOOTER ================= */
.footer { position: relative; background: #0d0507; padding: 60px 0 40px; text-align: center; color: var(--grey); }
.crenel {
  position: absolute; left: 0; right: 0; top: -24px; height: 24px;
  background:
    linear-gradient(90deg, #0d0507 0 50%, transparent 50%) 0 0 / 48px 12px repeat-x,
    linear-gradient(#0d0507, #0d0507) 0 12px / 100% 12px no-repeat;
}
.footer p { margin: 4px 0; }
.footer-brand { color: var(--amber); font-size: 26px; letter-spacing: .08em; text-shadow: 0 3px 0 #000; }
.footer .small { font-size: 15px; opacity: .8; }

/* ================= THE REAPER ================= */
/* One frame of the sprite sheet is 150 x 220 game pixels; --s = how big one game pixel is. */
button { font-family: inherit; }
.reaper {
  --s: 2.2;
  --fw: calc(150px * var(--s));
  --fh: calc(220px * var(--s));
  --bar: calc(36px * var(--s));
  position: fixed; z-index: 40;
  right: 0; bottom: 0;
  width: calc(var(--fw) + 30px);
  height: calc(var(--fh) * .76 + var(--bar));
  pointer-events: none;
  transform: translateY(105%);
  transition: transform .7s steps(7);
}
.reaper.up { transform: translateY(0); }
.reaper.bang, .reaper.aiming { z-index: 80; }
.reaper-body {
  position: absolute; right: 10px;
  width: var(--fw); height: var(--fh);
  margin: 0; padding: 0; border: 0; background: none;
  cursor: pointer; pointer-events: auto;
  /* the bar covers him from the belt down (the belt is at 76% of the frame) */
  bottom: calc(var(--bar) - var(--fh) * .24);
  transform-origin: 50% 80%;
  transition: scale .35s steps(4), translate .35s steps(4);
  animation: breathe 3.2s steps(4) infinite;
  -webkit-tap-highlight-color: transparent;
}
/* on the third poke he leans over the bar toward you */
.reaper.aiming .reaper-body { scale: 1.35; translate: calc(var(--fw) * -.12) calc(var(--fh) * -.06); animation: none; }
.reaper-body:focus-visible { outline: 3px dashed var(--amber); outline-offset: 4px; }
@keyframes breathe { 50% { translate: 0 calc(var(--s) * 2px); } }
.reaper-sprite {
  position: absolute; inset: 0;
  background: url("assets/img/reaper_sheet.png") 0 0 / calc(var(--fw) * 7) var(--fh) no-repeat;
  image-rendering: pixelated;
  background-position-x: calc(var(--frame, 2) * var(--fw) * -1);
  filter: drop-shadow(0 0 18px rgba(90,40,140,.55));
  transition: filter .2s;
}
.reaper.angry .reaper-sprite { filter: drop-shadow(0 0 16px rgba(232,54,74,.85)) brightness(1.08); }
.reaper.angry2 .reaper-body { animation: tremble .12s steps(2) infinite; }
@keyframes tremble { 50% { translate: calc(var(--s) * 1px) 0; } }
/* muzzle flash: drawn here, at the gun's muzzle in the "aim" frame (game pixel 24,121) */
.reaper-flash {
  position: absolute;
  left: calc(24px * var(--s)); top: calc(121px * var(--s));
  width: calc(64px * var(--s)); height: calc(64px * var(--s));
  translate: -50% -50%;
  background:
    radial-gradient(circle, #fff 0 14%, #ffe9a8 15% 28%, #f2b33d 29% 44%, rgba(232,54,74,.85) 45% 58%, transparent 60%);
  clip-path: polygon(50% 0, 60% 35%, 100% 20%, 68% 50%, 100% 80%, 60% 65%, 50% 100%, 40% 65%, 0 80%, 32% 50%, 0 20%, 40% 35%);
  opacity: 0;
  pointer-events: none;
}
.reaper.bang .reaper-flash { animation: bang .32s steps(3) forwards; }
@keyframes bang { 0% { opacity: 1; scale: .6; } 60% { opacity: 1; scale: 1.5; } 100% { opacity: 0; scale: 1.8; } }

/* his bar: dark wood, a candle and a few gold coins */
.reaper-bar {
  position: absolute; right: 0; bottom: 0;
  width: 100%; height: var(--bar);
  background:
    linear-gradient(#7a4422 0 6px, #000 6px 9px, transparent 9px),
    repeating-linear-gradient(90deg, #3b2216 0 46px, #2e190f 46px 49px, #452819 49px 90px, #000 90px 92px);
  border: 3px solid #000; border-bottom: 0;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.6);
}
.bar-candle {
  position: absolute; left: 22px; bottom: 100%;
  width: 26px; height: 54px;
  background: url("assets/img/candle.svg") center bottom / contain no-repeat;
  image-rendering: pixelated;
  animation: flicker .45s steps(2) infinite;
}
.bar-coins {
  position: absolute; left: 62px; bottom: 100%;
  width: 34px; height: 14px;
  background:
    linear-gradient(#000 0 2px, #f2b33d 2px 6px, #b97f1f 6px 8px, #000 8px 9px, #f2b33d 9px 12px, #b97f1f 12px 14px);
  border-radius: 3px 3px 0 0;
  box-shadow: inset 2px 0 0 #000, inset -2px 0 0 #000;
}
/* speech panel (Ember Tavern style) */
.reaper-say {
  position: absolute; right: calc(var(--fw) * .5); bottom: calc(var(--bar) + var(--fh) * .6);
  width: max-content; max-width: min(280px, 62vw);
  padding: 12px 16px 14px;
  background: var(--panel); color: var(--cream);
  border: 3px solid #000; border-radius: 14px;
  box-shadow: 0 0 0 3px #3b161b, 0 12px 30px rgba(0,0,0,.6);
  font-size: 17px; line-height: 1.3;
  opacity: 0; translate: 0 8px; scale: .96;
  transition: opacity .15s steps(2), translate .15s steps(2), scale .15s steps(2);
}
.reaper-say::after {   /* the little tail pointing down-right at his head */
  content: ""; position: absolute; right: 18px; bottom: -11px;
  width: 16px; height: 16px; background: var(--panel);
  border-right: 3px solid #000; border-bottom: 3px solid #000;
  rotate: 45deg;
}
.reaper-say.show { opacity: 1; translate: 0 0; scale: 1; }
.reaper-say p { margin: 0; }
.reaper-say .game { color: var(--red); letter-spacing: .03em; }
.reaper-say .hint { color: var(--grey); font-size: 14px; display: block; margin-top: 4px; }

/* when he shoots: white flash, the page shakes and falls over like a ragdoll */
body.hit::before {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: #fff;
  animation: whiteout .5s steps(4) forwards;
}
@keyframes whiteout { 0% { opacity: .95; } 100% { opacity: 0; } }
body.hit main, body.hit .hero, body.hit .footer {
  animation: ragdoll 1.1s cubic-bezier(.3,1.4,.5,1) forwards;
  transform-origin: 20% 100%;
}
@keyframes ragdoll {
  0% { transform: translate(0,0) rotate(0); }
  10% { transform: translate(-14px, 6px) rotate(-1.5deg); }
  20% { transform: translate(12px, -4px) rotate(1deg); }
  100% { transform: translate(-30px, 60px) rotate(-7deg); filter: grayscale(.6) brightness(.6); }
}
.shot-screen {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(90,0,10,.55), rgba(10,0,2,.9));
  animation: fadein .4s steps(4) .45s both;
}
.shot-screen[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.shot-box { text-align: center; padding: 0 16px; }
.shot-title {
  margin: 0; color: var(--red);
  font-size: clamp(40px, 7vw, 88px); line-height: 1;
  text-shadow: 0 6px 0 #000, 4px 4px 0 #000, -4px 4px 0 #000;
}
.shot-sub { margin: 12px 0 26px; font-size: 22px; color: var(--cream); text-shadow: 0 3px 0 #000; }

/* ================= SMALL SCREENS ================= */
@media (max-width: 860px) {
  .topbar-links { display: none; }
  .feature, .feature.flip { grid-template-columns: 1fr; }
  .feature.flip .shot { order: 0; }
  .feature-text, .feature.flip .feature-text { margin: -40px 14px 0; }
  .features { gap: 60px; }
  .teaser-grid { grid-template-columns: 1fr; justify-items: center; }
  .dev-grid { grid-template-columns: 1fr; }
  .dev-flag { width: 200px; margin: 0 auto; }
  .wip-box { flex-direction: column; text-align: center; padding: 26px 22px; }
  .hero-text { top: 20%; }
  .reaper { --s: 1.1; }
  /* on phones he only peeks over the edge, and comes up when he talks */
  .reaper.up:not(.talking):not(.angry) { transform: translateY(52%); }
  .bar-candle { width: 18px; height: 38px; left: 12px; }
  .bar-coins { left: 36px; }
  .reaper-say { font-size: 15px; max-width: 56vw; }
}
@media (min-width: 861px) and (max-height: 760px) { .reaper { --s: 1.6; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i, .wip-candle, .flag, .reaper-body, .bar-candle { animation: none; }
  body.hit main, body.hit .hero, body.hit .footer { animation: none; }
}
