/* Independently clipped fields. Only transforms change per animation frame. */
.mocha-whale-scene, .mocha-whales-control { display: none; }
.mocha-whales-control[hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) {
  body.has-mocha-ocean { isolation: isolate; }
  body.has-mocha-ocean > .wp-site-blocks { position: relative; z-index: 1; }
  .mocha-whale-scene {
    display: block; position: fixed; inset: var(--mocha-adminbar, 0px) 0 0;
    margin: 0; pointer-events: none; z-index: 0; overflow: hidden; contain: layout paint;
  }
  .mocha-whale-field {
    position: absolute; top: 0; bottom: 0; left: var(--field-left, 0px);
    width: var(--field-width, 248px); overflow: hidden; contain: layout paint;
    clip-path: inset(0); isolation: isolate;
  }
  .mocha-pod {
    position: absolute; top: 0; left: 0;
    width: var(--pod-width, 420px); height: var(--pod-height, 310px); opacity: 0;
  }
  .mocha-pod-heading { position: absolute; inset: 0; transform: scaleX(var(--pod-direction, 1)); }
  .mocha-whale { position: absolute; }
  .mocha-whale-adult { top: 0; left: 13%; width: 87%; }
  .mocha-whale-young { top: 48%; left: 0; width: 57%; opacity: .9; }
  .mocha-swimmer { display: block; width: 100%; height: auto; overflow: visible; }
  /* A small, constant blur on each drawing suggests depth through water.
     The field itself stays sharply clipped; no filter is animated. */
  .mocha-whale-scene[data-model="shadow"] .mocha-swimmer { filter: blur(1.1px); opacity: .88; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-young { opacity: .7; }
  .mocha-whale-rig { transform-origin: 250px 134px; }
  .mocha-whale-tail { transform-origin: 146px 134px; }
  .mocha-whale-near-fin { transform-origin: 279px 143px; }
  .mocha-whale-far-fin { transform-origin: 267px 108px; }
  .mocha-whale-scene.is-swimming .mocha-pod { opacity: var(--pod-opacity, .23); animation: mocha-whale-pass var(--pod-duration, 29s) linear both; }
  .mocha-whale-scene.is-swimming .mocha-whale-rig { animation: mocha-whale-breathe var(--whale-body-cycle, 12.6s) ease-in-out infinite; }
  .mocha-whale-scene.is-swimming .mocha-whale-tail { animation: mocha-whale-stroke var(--whale-tail-cycle, 10.8s) ease-in-out infinite; }
  .mocha-whale-scene.is-swimming .mocha-whale-near-fin { animation: mocha-whale-fin var(--whale-body-cycle, 12.6s) ease-in-out infinite; }
  .mocha-whale-scene.is-swimming .mocha-whale-far-fin { animation: mocha-whale-far-fin var(--whale-body-cycle, 12.6s) ease-in-out infinite; }
  .mocha-whale-scene.is-swimming .mocha-whale-young .mocha-whale-rig,
  .mocha-whale-scene.is-swimming .mocha-whale-young .mocha-whale-near-fin,
  .mocha-whale-scene.is-swimming .mocha-whale-young .mocha-whale-far-fin { animation-duration: var(--whale-young-body-cycle, 10.44s); animation-delay: var(--whale-young-body-delay, -3.24s); }
  .mocha-whale-scene.is-swimming .mocha-whale-young .mocha-whale-tail { animation-duration: var(--whale-young-tail-cycle, 9.36s); animation-delay: var(--whale-young-tail-delay, -4.32s); }
  /* The fuller shadow silhouette flexes as one body, with a covered tail joint. */
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-tail { transform-origin: 145px 145px; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-far-fin { transform-origin: 267px 143px; }
  .mocha-whale-scene[data-model="shadow"].is-swimming .mocha-whale-rig { animation-name: mocha-shadow-breathe; }
  .mocha-whale-scene[data-model="shadow"].is-swimming .mocha-whale-tail {
    animation-name: mocha-shadow-stroke; animation-duration: var(--whale-body-cycle, 12.6s);
  }
  .mocha-whale-scene[data-model="shadow"].is-swimming .mocha-whale-young .mocha-whale-tail {
    animation-duration: var(--whale-young-body-cycle, 10.44s); animation-delay: var(--whale-young-body-delay, -3.24s);
  }
  .mocha-whale-scene.is-paused .mocha-pod,
  .mocha-whale-scene.is-paused .mocha-whale-rig,
  .mocha-whale-scene.is-paused .mocha-whale-tail,
  .mocha-whale-scene.is-paused .mocha-whale-near-fin,
  .mocha-whale-scene.is-paused .mocha-whale-far-fin { animation-play-state: paused; }
  .mocha-whales-control {
    align-items: center; align-self: flex-start; gap: 7px;
    margin: 12px 0 0; padding: 6px 0; min-height: 30px; border: 0;
    background: transparent; color: var(--mocha-blue, #244A63); border-radius: 0;
    font: 11px/1.4 Arial, Helvetica, sans-serif; cursor: pointer;
  }
  .mocha-whales-control:hover .mocha-whales-control-label { text-decoration: underline; text-underline-offset: 3px; }
}
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  body.has-mocha-ocean:has(.mocha-whale-scene) .mocha-sidebar { background: transparent; }
  body:has(.mocha-sidebar) > .mocha-whale-scene {
    background: linear-gradient(to right, var(--mocha-cream, #f1ece2) 0, var(--mocha-cream, #f1ece2) var(--ocean-menu-width, var(--mocha-sidebar-width, 248px)), transparent var(--ocean-menu-width, var(--mocha-sidebar-width, 248px)));
  }
  .mocha-sidebar > .mocha-whales-control { display: inline-flex; }
}
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .mocha-whale-scene {
    top: calc(var(--mocha-adminbar, 0px) + var(--ocean-header-height, 80px)); bottom: auto;
    /* A stable viewport avoids restarting a pass when browser toolbars slide. */
    height: calc(100vh - var(--mocha-adminbar, 0px) - var(--ocean-header-height, 80px));
    height: calc(100svh - var(--mocha-adminbar, 0px) - var(--ocean-header-height, 80px));
  }
  .mocha-footer > .mocha-whales-control { display: inline-flex; min-height: 44px; font-size: 12px; }
}
/* Samsung's forced-dark mode may not expose a dark media preference.
   A balanced mobile pigment remains visible on paper and darkened canvases.
   Only pigment and transparency change; no extra artwork or filter work. */
@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .mocha-whale-scene.is-swimming .mocha-pod { opacity: calc(var(--pod-opacity, .23) * 1.6); }
  .mocha-whale-scene[data-model="shadow"] .mocha-swimmer { opacity: 1; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-young { opacity: .85; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-rig > path,
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-tail path { fill: #6f93a3; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-near-fin path { fill: #64899b; }
  .mocha-whale-scene[data-model="shadow"] .mocha-whale-far-fin path { fill: #7e9fac; }
}
@keyframes mocha-whale-pass {
  0% { transform: translate3d(var(--pod-start-x), var(--pod-start-y), 0); }
  100% { transform: translate3d(var(--pod-end-x), var(--pod-end-y), 0); }
}
@keyframes mocha-whale-breathe {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}
@keyframes mocha-whale-stroke {
  0%, 100% { transform: rotate(-6deg) scaleY(.96); }
  50% { transform: rotate(7deg) scaleY(1.04); }
}
@keyframes mocha-whale-fin {
  0%, 100% { transform: rotate(-7deg) scaleY(.96); }
  50% { transform: rotate(7deg) scaleY(1.03); }
}
@keyframes mocha-whale-far-fin {
  0%, 100% { transform: rotate(6deg); }
  50% { transform: rotate(-6deg); }
}
@keyframes mocha-shadow-breathe {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-3px) rotate(1.5deg); }
}
@keyframes mocha-shadow-stroke {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(5deg); }
}
