/* Home: the descent through floors 8, 10, 12 and 15 below the surface. */
.home-intro { padding: 24px; text-align: center; }
.home-intro h1 { color: var(--link); font-size: clamp(22px, 3vw, 30px); overflow-wrap: anywhere; }
.home-intro p { margin: 14px 0 0; }
.home-intro-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.home-intro-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; }
.floor { position: relative; padding: 200px 0 110px; image-rendering: pixelated; overflow-x: clip; }
.floor > * { image-rendering: auto; }
.floor::before { content: ''; position: absolute; inset: 0; pointer-events: none; }
.floor .in-wrap { position: relative; z-index: 3; max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* floor 8 overlaps the surface by 80px with its own grass strip: put the surface tile's clean edge there */
.surface { --surface-edge: 80px; }

/* each texture is cut to the exact section height so the original borders meet */
.f8 { margin-top: -80px; height: 1088px; padding-top: 196px; background: #3a2414 url('../assets/generated/scenes/floor-8.png') calc(50% + 28px) top / 3840px 1088px repeat-x; }
.f8 .in-wrap { max-width: 980px; }
.f8::before { background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .12) 100%); }
.f10 { height: 864px; padding-top: 136px; background: #6e6e6e url('../assets/generated/scenes/floor-10.png') center top / 3840px 960px repeat-x; }
.f10::before { background: linear-gradient(180deg, rgba(0, 0, 0, .12) 0, rgba(0, 0, 0, .24) 100%); }
.f12 { height: 768px; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; background: #3a1a0c url('../assets/generated/scenes/floor-12.png') center top / 3840px 768px repeat-x; }
.f12 .in-wrap { width: 100%; max-width: 960px; }
.f12::before { background: linear-gradient(180deg, rgba(0, 0, 0, .24) 0, rgba(0, 0, 0, .36) 100%); }
.f15 { min-height: 920px; padding-top: 520px; background: #4a4a4a url('../assets/generated/scenes/floor-15.png?v=2') center top / 3840px 1152px repeat-x; }
.f15::before { background: radial-gradient(ellipse 34% 26% at 50% 20%, rgba(255, 90, 0, .14), rgba(255, 90, 0, 0)), linear-gradient(180deg, rgba(0, 0, 0, .36) 0, rgba(0, 0, 0, .52) 100%); }

/* floor heading */
.sign-floor { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 28px; text-align: center; }
.f8 .sign-floor, .f12 .sign-floor { margin-bottom: 0; }
.sign-floor h2 { font-size: clamp(32px, 4vw, 46px); color: #fff; text-shadow: 0 3px 0 #000, 0 0 18px #000; }
.sign-floor p { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: #f1e6cf; text-shadow: 0 1px 0 #000, 0 0 10px #000; }

/* creatures enter when the floor scrolls into view, then patrol */
.m { position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: center; opacity: 0; transition: transform 1.6s var(--ease), opacity .9s; }
.in .m { opacity: 1; transform: none; }
.m img { image-rendering: pixelated; }
.pat { display: flex; flex-direction: column; align-items: center; animation: pat 11s linear infinite; }
.pat img { image-rendering: pixelated; animation: face 11s steps(1) infinite; }
/* the rotworm sprite sits off-centre in its frame */
.pat:has(> img[src*="rotworm"]) > :not(img) { transform: translateX(30px); }
.pat img[src*="rotworm"] { transform-origin: 74% 50%; }
.say { position: absolute; z-index: 4; opacity: 0; }
.in .say { animation: speak 7s infinite; }
.ff { position: absolute; z-index: 1; width: 64px; height: 64px; opacity: 0; image-rendering: pixelated; transition: opacity .6s; }
.in .ff { opacity: 1; }

/* floor 10: creatures walking in single file */
.path { position: relative; height: 190px; margin-top: 20px; overflow: hidden; }
.train { position: absolute; top: 0; left: 100%; display: flex; align-items: flex-end; gap: 26px; width: max-content; animation: file 46s linear infinite; }
.walker { display: flex; flex-direction: column; align-items: center; }
.walker img { image-rendering: pixelated; }
.walker .gt { font-size: 12.5px; }
.w-troll > :not(img), .w-rotworm > :not(img) { transform: translateX(30px); }

/* floor 12: store teaser cards */
.offers { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin: 26px auto 8px; }
.offer {
  width: 200px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 16px; text-align: center;
  background: #3c3c3c var(--tex-stone) 0 0 / 96px 96px; border: 2px solid; border-color: #7a7a7a #1a1a1a #1a1a1a #7a7a7a; box-shadow: 0 0 0 1px #000, 0 14px 26px #000b;
}
.offer .pic { width: 96px; height: 96px; display: grid; place-items: center; background: #1c1c1c; border: 1px solid; border-color: #0d0d0d #6a6a6a #6a6a6a #0d0d0d; }
.offer .pic img { image-rendering: pixelated; }
.offer b { font: 700 13px var(--font-game); color: #fff; text-shadow: var(--outline); }
.offer small { display: flex; align-items: center; gap: 5px; font: 700 12px var(--font-game); color: var(--gold-text); text-shadow: var(--outline); }
.offer small img { width: 16px; height: 16px; image-rendering: pixelated; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 28px; }
.f12 .cta { margin-top: 18px; }

/* floor 15: the demon above the closing call */
.demonwalk { position: absolute; z-index: 3; left: calc(50% + 40px); top: 372px; opacity: 0; transition: opacity 1s; }
.in .demonwalk { opacity: 1; }
.demonwalk .pat { position: relative; animation-duration: 9s; }
.demonwalk .pat img { animation-duration: 9s; }
.bub { position: absolute; left: 0; right: 0; top: -24px; display: grid; justify-items: center; pointer-events: none; }
.bub .say { position: static; grid-area: 1 / 1; }
.final { text-align: center; }
.final h2 { margin-top: 6px; font-size: clamp(34px, 4.4vw, 54px); color: #fff; text-shadow: 0 3px 0 #000, 0 0 24px #000; }
.final p { margin: 14px auto 0; font-size: 18px; font-weight: 700; color: #ffe9cf; text-shadow: 0 1px 0 #000, 0 0 10px #000; }

@keyframes pat { 0% { transform: translateX(0); } 46% { transform: translateX(-140px); } 50% { transform: translateX(-140px); } 96% { transform: translateX(0); } 100% { transform: translateX(0); } }
@keyframes face { 0% { transform: scaleX(1); } 48% { transform: scaleX(-1); } 98% { transform: scaleX(1); } }
@keyframes speak { 0%, 12% { opacity: 0; transform: translateY(6px); } 18% { opacity: 1; transform: none; } 52% { opacity: 1; transform: translateY(-8px); } 60%, 100% { opacity: 0; transform: translateY(-12px); } }
@keyframes file { from { transform: translateX(0); } to { transform: translateX(calc(-100vw - 100%)); } }

@media (min-width: 900px) { .sign-floor p, .final p { white-space: nowrap; } }
@media (max-width: 1100px) { .m.hide-md { display: none; } }
@media (max-width: 900px) { .f10, .f12 { height: auto; min-height: 864px; } }
@media (max-width: 860px) { .m.gut { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .pat, .pat img, .train { animation: none; }
  .m { transition: none; opacity: 1; transform: none; }
  .say, .in .say { animation: none; opacity: 1; }
  .ff { transition: none; opacity: 1; }
}
