/* Home page heavy bag: a 3D bag in the photo hero's place, on a dark stage
   lit from above, beside the hero copy (under it on phones). It shows only
   with .is-3d (set before first paint in the layout) and without reduced
   motion; otherwise, and if three.js fails to load, the photo hero shows as
   it always has. Loaded on the home page only. */

.bag-hero {
  display: none; position: relative; overflow: hidden; isolation: isolate;
  color: var(--canvas);
  background:
    radial-gradient(42% 58% at 74% 34%, rgba(255,255,255,0.16), rgba(255,255,255,0) 70%),
    radial-gradient(120% 90% at 70% 0%, #232325 0%, #111112 46%, var(--night) 78%);
}
@media (prefers-reduced-motion: no-preference) {
  .is-3d .hero { display: none; }
  .is-3d .bag-hero { display: block; }
}
/* A cone of light from the ceiling onto the bag, and a fine grain so the
   dark reads as a room, not a flat fill. */
.bag-hero::before, .bag-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
.bag-hero::before {
  background: conic-gradient(from 180deg at 74% -8%, rgba(255,255,255,0) 168deg, rgba(255,255,255,0.07) 180deg, rgba(255,255,255,0) 192deg);
}
.bag-hero::after {
  opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The canvas covers the whole block, so the bag's shadow is never cut off.
   The script frames the bag, however hard it swings, inside .bag-room. */
.bag-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity 700ms var(--ease-out);
}
.is-ready .bag-canvas { opacity: 1; }
.bag-canvas.can-hit { cursor: pointer; }

/* Phones and narrow screens: the copy and its button, the bag, then the
   hit button under the bag. Clicks pass through the empty room to the
   canvas. */
.bag-layout {
  position: relative; display: grid; grid-template-areas: "copy" "room" "tip";
  pointer-events: none;
}
.bag-copy { grid-area: copy; padding: var(--s6) 0 var(--s2); pointer-events: auto; }
.bag-room { grid-area: room; height: clamp(260px, 42svh, 440px); }
.bag-tip {
  grid-area: tip; display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  padding-bottom: var(--s6); text-align: center; pointer-events: auto;
}

.bag-copy h1 { font-size: clamp(3.4rem, 17vw, 8rem); }
/* Russian runs wider (Oswald): a smaller heading, so words stay whole. */
:lang(ru) .bag-copy h1 { font-size: clamp(2.75rem, 13vw, 6rem); }
.bag-lede {
  margin-top: var(--s4); max-width: 40ch;
  font-size: clamp(16px, 1.5vw, 20px); line-height: 1.45; color: var(--on-night-2);
  /* On phones the bag's chain runs up behind the copy: keep it readable. */
  text-shadow: 0 0 8px var(--night), 0 0 16px var(--night);
}
.bag-copy .btn-find { margin-top: var(--s5); }
.bag-hint { max-width: 32ch; font-size: 14px; line-height: 1.4; color: var(--on-night-2); }

/* Wide screens: the copy and the hit button on the left, the bag on the
   right, in a block as tall as the photo hero. */
@media (min-width: 900px) {
  .bag-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); grid-template-rows: 1fr auto;
    grid-template-areas: "copy room" "tip room";
    column-gap: var(--s7);
    min-height: clamp(560px, calc(100svh - var(--header-h) - 120px), 820px);
  }
  .bag-copy { align-self: end; padding: var(--s8) 0 0; }
  .bag-copy h1 { font-size: clamp(4rem, 9vw, 8rem); }
  .bag-copy .btn-find { margin-top: var(--s6); }
  .bag-room { height: auto; }
  .bag-tip { flex-direction: row; justify-content: flex-start; gap: var(--s4) var(--s5); padding: var(--s5) 0 var(--s8); text-align: left; }
  .bag-hint { max-width: 36ch; }
}
@media (max-width: 640px) {
  .bag-copy .btn-find { width: 100%; }
}
