/* Gory Jurassic layer for the player hub: the parallax scene (built by jungle.js), claw marks,
   blood and heartbeat touches. Loaded after glass.css. Colours come from tokens.css (Jurassic
   scene block). The layout stays as it is: effects live behind the glass and in small reactions.
   base.css stops every animation and transition for "reduce motion"; jungle.js holds the scene still. */

/* ---- the scene: fixed behind everything, above the page's ground and contours */
.jg-scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.jg-layer { position: absolute; left: -4vw; right: -4vw; top: -6vh; bottom: -42vh; will-change: transform; }
/* each silhouette sits on the viewport's bottom edge; below it, the same colour fills the ground
   that scrolling reveals */
.jg-shape { position: absolute; left: 0; right: 0; bottom: 42vh; width: 100%; display: block; }
.jg-layer::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(42vh + 2px); }
.jg-far { color: var(--jg-far); }
.jg-far .jg-shape { height: 46vh; opacity: .9; }
.jg-far::after { background: var(--jg-far); opacity: .9; }
.jg-mid { color: var(--jg-mid); }
.jg-mid .jg-shape { height: 30vh; }
.jg-mid::after { background: var(--jg-mid); }
.jg-near { color: var(--jg-near); left: -2vw; right: -2vw; }
.jg-near::after { content: none; }
.jg-near .jg-shape { width: min(34vw, 420px); height: min(42vh, 440px); }
.jg-fern-l { left: 0; right: auto; }
.jg-fern-r { left: auto; right: 0; }

/* the volcano's crater glows and smokes (crater at 80% across, near the top of the far layer) */
.jg-ember { position: absolute; left: calc(80.6% - 110px); bottom: calc(42vh + 46vh * .66); width: 220px; height: 160px;
  background: radial-gradient(closest-side, var(--jg-ember-core), var(--jg-ember) 45%, transparent 75%); filter: blur(6px);
  animation: jg-ember 5s ease-in-out infinite; }
@keyframes jg-ember { 0%, 100% { opacity: .75; transform: scale(1); } 45% { opacity: 1; transform: scale(1.08); } 70% { opacity: .85; } }
.jg-smoke { position: absolute; left: calc(80.6% - 70px); bottom: calc(42vh + 46vh * .7); width: 140px; height: 260px;
  background: radial-gradient(40% 30% at 50% 80%, var(--jg-smoke), transparent 70%), radial-gradient(35% 25% at 40% 45%, var(--jg-smoke), transparent 70%), radial-gradient(30% 20% at 60% 15%, var(--jg-smoke), transparent 70%);
  filter: blur(10px); animation: jg-smoke 14s linear infinite; }
@keyframes jg-smoke { from { transform: translate(0, 20px) scale(.9); opacity: .2; } 30% { opacity: 1; } to { transform: translate(40px, -120px) scale(1.4); opacity: 0; } }

/* mist: two soft bands drifting slowly in opposite directions over the treeline */
.jg-mist-band { position: absolute; left: -20%; right: -20%; bottom: calc(42vh + 8vh); height: 22vh;
  background: radial-gradient(60% 50% at 30% 60%, var(--jg-mist), transparent 70%), radial-gradient(50% 45% at 75% 50%, var(--jg-mist), transparent 70%);
  animation: jg-drift 60s ease-in-out infinite alternate; }
.jg-mist-2 { bottom: calc(42vh + 18vh); height: 16vh; opacity: .7; animation-duration: 85s; animation-direction: alternate-reverse; }
@keyframes jg-drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
@media (max-width: 700px) { .jg-near .jg-shape { width: 45vw; height: 30vh; } .jg-far .jg-shape { height: 34vh; } }

/* ---- claw marks: page heads end in three slashes instead of a plain rule */
.ph-head, .ph-main .me-head, .ph-main .inv-head { position: relative; border-bottom-color: var(--glass-well-line, var(--line-soft)); }
.ph-head::after, .ph-main .me-head::after, .ph-main .inv-head::after {
  content: ""; position: absolute; left: -4px; bottom: -9px; width: 132px; height: 18px; pointer-events: none;
  background: linear-gradient(90deg, var(--gore-hi), var(--gore) 70%);
  -webkit-mask: var(--claw-mask) no-repeat left center / contain; mask: var(--claw-mask) no-repeat left center / contain;
  opacity: .8; filter: drop-shadow(0 0 6px var(--gore-glow));
}

/* a hovered link-card gets a faint claw scratch in its corner */
@media (hover: hover) and (pointer: fine) {
  a.stat:hover, .ph-main .g-card:hover, .mk-card:hover, .overview-shortcut:hover {
    background: var(--gore-scratch) no-repeat right 10px top 8px / 44px 44px,
      linear-gradient(160deg, var(--glass-sheen-a), var(--glass-sheen-b) 42%, transparent), var(--glass-hover), var(--glass-tint);
  }
}

/* ---- blood: primary buttons drip on hover */
.ph-app .btn-primary, .ui-dlg .btn-primary { position: relative; overflow: visible; }
.ph-app .btn-primary::before, .ph-app .btn-primary::after, .ui-dlg .btn-primary::before, .ui-dlg .btn-primary::after {
  content: ""; position: absolute; top: calc(100% - 1px); width: 5px; height: 0; border-radius: 0 0 3px 3px; background: var(--gore-hi);
  pointer-events: none; transition: height .38s cubic-bezier(.55, 0, .8, .2);
}
.ph-app .btn-primary::before, .ui-dlg .btn-primary::before { left: 22%; }
.ph-app .btn-primary::after, .ui-dlg .btn-primary::after { left: 64%; width: 4px; transition-delay: .12s; }
.ph-app .btn-primary:hover:not(:disabled)::before, .ui-dlg .btn-primary:hover::before { height: 10px; }
.ph-app .btn-primary:hover:not(:disabled)::after, .ui-dlg .btn-primary:hover::after { height: 6px; }

/* growth bars fill like a vein: dark when empty, fresh blood that pulses */
.bar-growth { background: var(--gore-vein); box-shadow: inset 0 1px 2px var(--black); }
.bar-growth > span { background: linear-gradient(90deg, var(--gore), var(--gore-hi)); box-shadow: 0 0 10px -2px var(--gore-glow); animation: gore-vein 2.4s ease-in-out infinite; }
@keyframes gore-vein { 0%, 100% { filter: brightness(1); } 12% { filter: brightness(1.35); } 24% { filter: brightness(1.05); } 36% { filter: brightness(1.25); } }

/* ---- heartbeat: live and online dots beat (lub-dub) instead of glowing steadily */
.status-dot.on, .is-on .ph-dot, .ph-online.is-on .ph-dot, .ph-live.is-on .ph-live-sub::before, .ff-face.is-on .ff-presence {
  animation: gore-beat 1.3s ease-in-out infinite;
}
@keyframes gore-beat { 0%, 40%, 100% { transform: scale(1); } 10% { transform: scale(1.4); } 20% { transform: scale(1); } 28% { transform: scale(1.25); } }

/* ---- popups and toasts tear in, a claw swipe across the popup as it opens */
.ui-dlg[open], .ph-daily[open] { animation: gore-tear-in .32s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes gore-tear-in {
  from { clip-path: polygon(0 0, 18% 0, 0 30%, 0 100%, 0 100%); opacity: .2; transform: translateY(6px); }
  60% { clip-path: polygon(0 0, 100% 0, 100% 70%, 85% 100%, 0 100%); opacity: 1; }
  to { clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%, 0 100%); transform: none; }
}
.ui-dlg[open]::before { content: ""; position: absolute; inset: -10% -20%; pointer-events: none; z-index: 1;
  background: var(--gore-hi); -webkit-mask: var(--claw-mask) no-repeat center / 70% auto; mask: var(--claw-mask) no-repeat center / 70% auto;
  animation: gore-swipe .5s ease-out both; }
@keyframes gore-swipe { from { opacity: 0; transform: translate(-40%, 20%) rotate(-8deg); } 30% { opacity: .55; } to { opacity: 0; transform: translate(40%, -20%) rotate(-8deg); } }
.ph-toast.show { animation: gore-tear-in .3s cubic-bezier(.2, .9, .3, 1) both; }

/* a claw slash sweeps over the tab you just opened */
.ph-main [role=tab] { position: relative; overflow: hidden; }
.ph-main [role=tab][aria-selected=true]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--gore-hi);
  -webkit-mask: var(--claw-mask) no-repeat center / 90% 70%; mask: var(--claw-mask) no-repeat center / 90% 70%;
  animation: gore-swipe .42s ease-out both;
}

/* ---- errors hit: a red flash at the window's edges and a short shake (ui.js adds .gore-hit) */
.gore-vignette { position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0; box-shadow: inset 0 0 140px 20px var(--gore-hit); }
.gore-vignette.on { animation: gore-flash .55s ease-out; }
@keyframes gore-flash { from { opacity: 1; } to { opacity: 0; } }
@media (max-width: 700px) { .gore-vignette { box-shadow: inset 0 0 56px 6px var(--gore-hit); } }
.gore-shake .ph-body { animation: gore-shake .32s cubic-bezier(.36, .07, .19, .97); }
@keyframes gore-shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ---- cards rise out of the mist on the first paint (jungle.js sets .jg-entering for 1.5 s) */
.jg-entering .ph-main :is(.ph-panel, .dino-card, .now-card, .food-card, .overview-shortcut, .g-card, .skin-card, .mk-card, .hs-card, .stat, .map-workspace) {
  animation: jg-rise .7s cubic-bezier(.2, .8, .25, 1) both;
}
.jg-entering .ph-main :is(.ph-panel, .dino-card, .now-card, .food-card, .overview-shortcut, .g-card, .skin-card, .mk-card, .hs-card, .stat):nth-child(2) { animation-delay: 70ms; }
.jg-entering .ph-main :is(.ph-panel, .dino-card, .now-card, .food-card, .overview-shortcut, .g-card, .skin-card, .mk-card, .hs-card, .stat):nth-child(3) { animation-delay: 140ms; }
.jg-entering .ph-main :is(.ph-panel, .dino-card, .now-card, .food-card, .overview-shortcut, .g-card, .skin-card, .mk-card, .hs-card, .stat):nth-child(n+4) { animation-delay: 210ms; }
@keyframes jg-rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* ---- footprints walk under the top bar while the hub loads */
.jg-tracks { position: fixed; z-index: 70; left: 50%; top: calc(var(--nav-h, 56px) + 10px); display: flex; gap: 14px; transform: translateX(-50%); pointer-events: none; transition: opacity .3s; }
.jg-tracks.done { opacity: 0; }
.jg-tracks svg { width: 16px; height: 16px; color: var(--gore-track); opacity: 0; animation: jg-step 1.2s ease-in-out infinite; }
.jg-tracks .jg-print-r { transform: translateY(6px) rotate(8deg); }
.jg-tracks svg:not(.jg-print-r) { transform: rotate(-8deg); }
@keyframes jg-step { 0% { opacity: 0; } 15% { opacity: 1; } 60% { opacity: .5; } 100% { opacity: 0; } }

/* folded rules (crash game): one line until opened */
.co-rules { margin: .6rem 0; }
.co-rules > summary { cursor: pointer; color: var(--lichen); font-weight: 600; font-size: .9rem; }
.co-rules > summary:hover { color: var(--bone); }
.co-rules[open] > summary { margin-bottom: .4rem; }
