/* TerraKK Terra Orbit Lite v4. CSS-native orbit + 8 pose sprite animation. */
.terrakk-terra-v4 { position:absolute; inset:0; display:block; width:100%;height:100%;
      pointer-events:none !important; user-select:none; overflow:visible; background:transparent; }
    /* Portfolio adapter: exactly the existing .art-disc rules in Ruina.
       CSS percentages follow responsive layout and zoom without measuring it.
       Leave the disc's clipping and all project buttons untouched. */
    .hero-art > .terrakk-terra-v4 { inset:7%; width:auto; height:auto; }
    @media (max-width:720px) {
      .hero-art > .terrakk-terra-v4 { inset:6%; }
    }
    .terrakk-terra-v4, .terrakk-terra-v4 * { box-sizing:border-box; pointer-events:none !important; }
    .terrakk-terra-v4 .ttv4-start { position:absolute; inset:0; transform:rotate(var(--ttv4-start)); }
    .terrakk-terra-v4 .ttv4-arm { position:absolute; inset:0; transform-origin:50% 50%;
      will-change:transform;
      animation:ttv4-orbit var(--ttv4-lap) var(--ttv4-orbit-easing) infinite var(--ttv4-direction); }
    .terrakk-terra-v4 .ttv4-dog { position:absolute; left:50%;top:0; width:var(--ttv4-dog-width);
      contain:paint; overflow:hidden;
      aspect-ratio:16/11; transform:translate(-50%,-88%);
      }
    .terrakk-terra-v4 .ttv4-dog::before { content:''; position:absolute;
      left:0; top:0; width:800%; height:100%;
      background-image:var(--ttv4-atlas); background-repeat:no-repeat;
      background-size:100% 100%;
      will-change:transform;
      animation:ttv4-gait var(--ttv4-stride) steps(8,end) infinite; }
    .terrakk-terra-v4 .ttv4-ball-offset {position:absolute;inset:0;transform:rotate(var(--ttv4-ball-lead));}
    .terrakk-terra-v4 .ttv4-ball {position:absolute; left:50%;top:0;
      width:var(--ttv4-ball-width);height:var(--ttv4-ball-width);
      transform:translate(-50%,-100%); }
    .terrakk-terra-v4 .ttv4-ball-face { display:block; width:100%;height:100%;position:relative;
      border-radius:50%; border:0.5px solid #677c10;
      background:radial-gradient(circle at 29% 27%,#f1ff98,#cce333 57%,#91ad12 96%);
      animation:ttv4-spin var(--ttv4-ball-spin) linear infinite var(--ttv4-direction); }
    .terrakk-terra-v4 .ttv4-ball-face::after { content:'';position:absolute;inset:11%;
      border-radius:50%;border-left:1px solid #faffdf;border-right:1px solid #faffdf;transform:rotate(29deg); }
    @media (prefers-reduced-motion:reduce) {
      .terrakk-terra-v4 .ttv4-arm,.terrakk-terra-v4 .ttv4-dog::before,
      .terrakk-terra-v4 .ttv4-ball-face {animation:none !important;}
    }
    /* Explicit consent overrides only Terra, including the portfolio wildcard. */
    .terrakk-terra-v4.ttv4-motion-opt-in .ttv4-arm {
      animation:ttv4-orbit var(--ttv4-lap) var(--ttv4-opt-in-easing) infinite var(--ttv4-direction) !important; }
    .terrakk-terra-v4.ttv4-motion-opt-in .ttv4-dog::before {
      animation:ttv4-gait var(--ttv4-stride) steps(8,end) infinite !important; }
    .terrakk-terra-v4.ttv4-motion-opt-in .ttv4-ball-face {
      /* The ball still follows the orbit; skip its tiny independent texture spin
         in reduced-motion opt-in to avoid another continuous compositor task. */
      animation:none !important; }
    .terrakk-terra-v4.ttv4-paused .ttv4-arm,
    .terrakk-terra-v4.ttv4-paused .ttv4-dog::before,
    .terrakk-terra-v4.ttv4-paused .ttv4-ball-face { animation-play-state:paused !important; }
    /* Fits the existing gap below the header, without shifting the portfolio. */
    .terra-motion-controls { position:absolute; right:0; top:calc(100% + 4px);
      display:flex; align-items:center; gap:9px; max-width:100%; z-index:7; }
    #terra-motion-toggle { min-height:26px; padding:5px 9px; border:1px solid var(--accent);
      background:#101812; color:var(--accent); cursor:pointer;
      font:700 9px/1.3 ui-monospace,monospace; letter-spacing:.04em; white-space:nowrap; }
    #terra-motion-toggle:focus-visible { outline:2px solid #fff; outline-offset:2px; }
    #terra-motion-toggle:disabled { opacity:.6; cursor:default; }
    .terra-motion-state { color:var(--sub); font:500 9px/1.3 ui-monospace,monospace; white-space:nowrap; }
    @media(max-width:420px) {
      #terra-motion-toggle,.terra-motion-state {font-size:8px;}
      .terra-motion-controls {gap:6px;}
    }
    /* Animated transform endpoints are independent of inherited custom values. */
    @keyframes ttv4-orbit {from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
    @keyframes ttv4-spin {from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
    /* The tiny atlas moves on a compositor transform inside a clipped window.
       Eight discrete steps show exactly the original poses without repainting
       background-position every frame. The eighth shift is the loop boundary. */
    @keyframes ttv4-gait {
      from{transform:translate3d(0,0,0)} to{transform:translate3d(-100%,0,0)}
    }
