/* v0.8 "Into the mine": scroll story (mine.js). A tall section with one sticky full-screen stage. */
.mine { position: relative; height: 560vh; background: #0A0810; padding: 0; border-top: 3px solid var(--ink); }
.mine-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.mine-stage { position: absolute; inset: 0; background: #0A0810; }
.mine-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mine-svg * { transform-box: fill-box; }
.m-forest, .m-cam, .m-cage, .m-tunnel, .tf { transform-box: view-box; }
/* crypto mine: coin veins glint in the walls, the cart sparkles, bad news drifts out like gas */
.m-news, .nw, .m-pick, .m-bird, .m-fly, .m-katana, .m-blade, .m-ghosts path { transform-box: view-box; }
.nw { will-change: transform, opacity; }
.vc { animation: m-vein 2.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes m-vein { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.m-glint path { transform-box: fill-box; transform-origin: center; animation: m-glint 1.6s ease-in-out infinite; }
.m-glint path:nth-child(2) { animation-delay: -.8s; }
@keyframes m-glint { 0%, 100% { scale: .3; opacity: 0; } 50% { scale: 1; opacity: 1; } }

/* the cage swings from its ring; the bird leans from its feet and shivers */
.m-swing { transform-origin: 50% 0%; rotate: var(--swing, 0deg); }
.m-lean { transform-origin: 50% 92%; rotate: var(--lean, 0deg); }
.m-shake { --amp: 0; animation: m-shiver .09s steps(2) infinite; }
@keyframes m-shiver {
  0% { translate: calc(var(--amp) * -1px) calc(var(--amp) * .3px); }
  50% { translate: calc(var(--amp) * 1px) calc(var(--amp) * -.4px); }
  100% { translate: calc(var(--amp) * -.6px) calc(var(--amp) * .5px); }
}
.m-lamp, .m-hl-glow { animation: m-flicker 2.6s infinite; }
.m-hl-glow { animation-delay: -1.1s; }
@keyframes m-flicker { 0%, 100% { opacity: 1; } 8% { opacity: .78; } 10% { opacity: 1; } 47% { opacity: .92; } 49% { opacity: .62; } 52% { opacity: .95; } 80% { opacity: .86; } }

/* expressions */
.m-bird .e-happy, .m-bird .e-calm, .m-bird .e-scared, .m-bird .e-lids, .m-bird .b-open, .m-bird .s-sweat, .m-bird .s-shiver, .m-bird .s-ruffle, .m-bird .s-heart { display: none; }
.ex-happy .e-happy, .ex-relief .e-happy { display: inline; }
.ex-calm .e-calm { display: inline; }
.ex-worry .e-scared, .ex-fear .e-scared, .ex-faint .e-scared { display: inline; }
.ex-faint .e-lids { display: inline; }
.ex-fear .b-closed, .ex-faint .b-closed { display: none; }
.ex-fear .b-open, .ex-faint .b-open { display: inline; }
.ex-worry .s-sweat, .ex-fear .s-sweat, .ex-faint .s-sweat { display: inline; }
.ex-fear .s-shiver, .ex-faint .s-shiver, .ex-fear .s-ruffle, .ex-faint .s-ruffle { display: inline; }
.ex-relief .s-heart { display: inline; }
.ex-worry .e-pupils circle { r: 8px; }
.ex-fear .e-pupils circle, .ex-faint .e-pupils circle { r: 5px; }
.ex-worry .e-pupils, .ex-fear .e-pupils { animation: m-dart 1.6s steps(1) infinite; }
@keyframes m-dart { 0% { translate: 0 0; } 18% { translate: -6px 2px; } 34% { translate: 6px -1px; } 52% { translate: -3px -4px; } 70% { translate: 7px 3px; } 86% { translate: -7px 0; } }
.ex-faint .e-pupils { translate: 0 6px; }
.s-sweat { animation: m-sweat 1.5s ease-in infinite; }
@keyframes m-sweat { 0% { translate: 0 -6px; opacity: 0; } 20% { opacity: 1; } 100% { translate: 2px 34px; opacity: 0; } }
.b-low { animation: m-chatter .12s steps(2) infinite; }
@keyframes m-chatter { 0% { translate: 0 0; } 100% { translate: 0 4px; } }
.s-shiver { animation: m-blink-lines .22s steps(2) infinite; }
@keyframes m-blink-lines { 0% { opacity: 1; } 100% { opacity: .2; } }
.ex-fear .m-wl, .ex-faint .m-wl { translate: 6px 0; } .ex-fear .m-wr, .ex-faint .m-wr { translate: -6px 0; }
.ex-relief .s-heart { animation: m-heart-up 1.8s ease-out infinite; }
@keyframes m-heart-up { 0% { translate: 0 10px; opacity: 0; scale: .6; } 25% { opacity: 1; scale: 1.1; } 100% { translate: 0 -30px; opacity: 0; scale: .9; } }

/* atmosphere overlays */
.mine-dust, .mine-gas, .mine-dark, .mine-pulse, .mine-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.mine-dust { background-image: radial-gradient(rgba(255, 220, 170, .55) 1px, transparent 1.6px), radial-gradient(rgba(255, 220, 170, .35) 1px, transparent 1.4px); background-size: 140px 140px, 90px 90px; background-position: 0 0, 40px 60px; animation: m-dust 14s linear infinite; }
@keyframes m-dust { to { background-position: 30px -280px, 70px -200px; } }
.mine-gas i { position: absolute; left: -20%; right: -20%; bottom: -10%; height: 70%; background: radial-gradient(60% 50% at 30% 80%, rgba(150, 205, 110, .38), transparent 70%), radial-gradient(50% 45% at 75% 85%, rgba(120, 190, 120, .32), transparent 70%); animation: m-gas 11s ease-in-out infinite alternate; }
.mine-gas i:nth-child(2) { height: 55%; animation-duration: 15s; animation-direction: alternate-reverse; opacity: .8; }
.mine-gas i:nth-child(3) { height: 40%; animation-duration: 9s; opacity: .7; }
@keyframes m-gas { from { transform: translateX(-6%) translateY(4%); } to { transform: translateX(6%) translateY(-6%); } }
.mine-dark { background: radial-gradient(ellipse 46% 52% at 50% 58%, transparent 0%, rgba(4, 3, 8, .55) 55%, rgba(2, 1, 5, .96) 100%); }
.mine-pulse { box-shadow: inset 0 0 160px 40px rgba(120, 10, 30, .55); animation: m-beat var(--beat, .85s) ease-in-out infinite; }
@keyframes m-beat { 0%, 100% { filter: brightness(1); transform: scale(1); } 12% { filter: brightness(1.6); transform: scale(1.015); } 24% { filter: brightness(1); transform: scale(1); } 36% { filter: brightness(1.35); } }
.mine-flash { background: #fff; }

/* HUD */
.mine-hud { position: absolute; z-index: 3; right: 28px; top: 132px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 240, 220, .8); }
.mine-hud span { background: rgba(10, 8, 16, .55); border: 1.5px solid rgba(255, 240, 220, .25); border-radius: 999px; padding: 4px 12px; }
.mine-hud b { color: #FFD84A; font-weight: 700; font-variant-numeric: tabular-nums; }
.mine-hud.co-high span:nth-child(2) b { color: #FF5A6E; }
.h-bird i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5BE38F; margin-right: 8px; vertical-align: 1px; }
.mine-hud[data-state="uneasy"] .h-bird i { background: #FFB547; animation: cute-pulse .7s infinite; }
.mine-hud[data-state="faint"] .h-bird i { background: #FF5A6E; animation: cute-pulse .35s infinite; }
.mine-hud[data-state="faint"] .h-bird b { color: #FF5A6E; }
.mine-stage.lit .mine-hud { color: var(--ink); }
.mine-stage.lit .mine-hud span { background: rgba(255, 255, 255, .8); border-color: var(--ink); }
.mine-stage.lit .mine-hud b { color: var(--ink); }

/* captions */
.mine-caps { position: absolute; z-index: 4; left: 0; right: 0; bottom: 9vh; display: grid; place-items: center; padding: 0 24px; pointer-events: none; }
.mc { grid-area: 1 / 1; margin: 0; max-width: 22ch; text-align: center; font: 700 clamp(28px, 4.2vw, 58px)/1.08 var(--display); letter-spacing: -.02em; color: #FFF4E0; text-shadow: 0 3px 24px rgba(0, 0, 0, .65); opacity: 0; translate: 0 18px; transition: opacity .45s ease, translate .6s var(--spring); }
.mc.on { opacity: 1; translate: 0 0; }
.mc:not(.mc-final) { max-width: 640px; font-size: clamp(22px, 2.9vw, 40px); }
.mc strong { display: block; font-weight: 700; }
.mc-k { display: inline-block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #FFD84A; text-shadow: none; }
.mc small { display: block; margin-top: 8px; font: 500 clamp(14px, 1.25vw, 17px)/1.45 var(--sans); letter-spacing: 0; color: rgba(255, 244, 224, .78); text-shadow: none; }
.mine-stage.lit .mc-k { color: #8A5E00; }
.mine-stage.lit .mc small { color: var(--text-2); }
.mine-stage.lit .mc { color: var(--ink); text-shadow: none; }
.mc:not(.mc-final) { background: rgba(10, 8, 16, .78); border: 2px solid rgba(255, 240, 220, .22); border-radius: 26px; padding: 14px 26px 16px; }
.mine-stage.lit .mc:not(.mc-final) { background: rgba(255, 255, 255, .86); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); }
.mc-final { max-width: 760px; background: rgba(255, 255, 255, .92); border: 3px solid var(--ink); border-radius: 30px; box-shadow: 0 8px 0 var(--ink); padding: 26px 30px 28px; text-shadow: none; pointer-events: auto; position: relative; bottom: 34vh; }
.mc-final h3 { font-size: clamp(24px, 3vw, 38px); line-height: 1.08; color: var(--ink); }
.mc-final p { margin: 12px auto 18px; max-width: 54ch; font: 500 16.5px/1.5 var(--sans); color: var(--text-2); letter-spacing: 0; }
.mc-final .btn { pointer-events: auto; }

.mine-debug .mine-pin { position: fixed; inset: 0; z-index: 999; }

/* reduced motion: one static frame, no pin */
.mine-static { height: auto; }
.mine-static .mine-pin { position: relative; height: 100vh; }
.mine-static .mc:not(.mc-final) { display: none; }

@media (max-width: 760px) {
  .mine { height: 480vh; }
  .mine-hud { right: 12px; top: 130px; font-size: 10.5px; }
  .mc-final { bottom: 0; }
  .mine-caps { bottom: auto; top: 214px; }
  .mine-stage:not(.lit) .mine-caps { top: auto; bottom: 4vh; }
  .mc:not(.mc-final) { padding: 12px 18px 14px; }
  .mc-final { padding: 20px 18px 22px; border-radius: 22px; }
  .mc-final p { font-size: 14.5px; }
}

/* ending: smug turn, wing slashes, folded wings */
.m-bird .e-smug{display:none}
.m-bird.ex-smug .e-smug,.ex-smug .e-smug{display:inline}
.ex-smug .e-happy,.ex-smug .e-calm,.ex-smug .e-scared,.ex-smug .b-open,.ex-smug .s-sweat,.ex-smug .s-shiver{display:none}
.m-wl{transform-origin:85% 6%}
.m-wr{transform-origin:15% 6%}
.mine-slash{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:6}
.mine-slash path{fill:none;stroke:#fff;stroke-width:7;stroke-linecap:round;stroke-dasharray:1;stroke-dashoffset:1;opacity:0;filter:drop-shadow(0 0 10px #fff) drop-shadow(0 0 22px #FFD84A)}
.mine-pin { contain: strict; }
.mine-stage, .mine-svg { will-change: transform; }

/* v1.6.1: smaller final card, kept low so the canary stays in view */
.mc-final { max-width: 440px; padding: 14px 20px 16px; border-radius: 22px; border-width: 2.5px; box-shadow: 0 5px 0 var(--ink); bottom: 0; }
.mc-final h3 { font-size: clamp(17px, 1.6vw, 22px); }
.mc-final p { margin: 6px auto 12px; max-width: 40ch; font-size: 14px; line-height: 1.4; }
.mc-final .btn { padding: 8px 16px; font-size: 14px; }
@media (max-width: 760px) { .mc-final { max-width: 320px; padding: 12px 14px 14px; } .mc-final p { font-size: 13px; } }
