/* Animation layer for justinwrenspeaks.com, shared by the homepage and the
   Speaking page. Moved out of index.astro on 5 Oct 2026, otherwise unchanged. */
      /* ---------------------------------------------------------------
         1. WHICH BOARD SHOWS
         Two real layouts, each its own pen.dev design. Neither is a
         reflow of the other.
         --------------------------------------------------------------- */
      body { display: block !important; }
      #jw-stage { width: 100%; overflow: hidden; }
      .jw-board { transform-origin: top left; margin: 0 auto; }
      @media (max-width: 899px) { [data-pencil-name="Justin Wren Homepage"] { display: none !important; } }
      @media (min-width: 900px) { [data-pencil-name="Justin Wren Homepage — Mobile"] { display: none !important; } }

      /* ---------------------------------------------------------------
         2. PILLARS FIX (desktop board only)
         The desktop export carried a stray 75% group opacity on the
         section, which greyed the #FFFFFF heading and dulled the
         #FFEE32 icons. BUILD-SPEC's partial-opacity table does not list
         it. The mobile board does not have it.
         --------------------------------------------------------------- */
      [data-pencil-name="Justin Wren Homepage"] [data-pencil-name="Pillars"] { opacity: 1 !important; }
      /* 5 Oct 2026: Underglow + ::before band removed so the pillars match the Speaking page (Hanz). */

      /* ---------------------------------------------------------------
         3. REEL LIGHTBOX
         His brief: the video opens inline and never leaves the site.
         The iframe is only built on open, so the page costs nothing to
         Vimeo until someone presses play.
         --------------------------------------------------------------- */
      .jw-hot { cursor: pointer; }
      .jw-modal {
        position: fixed; inset: 0; z-index: 9999;
        background: rgba(0,0,0,0.94);
        display: flex; align-items: center; justify-content: center;
        padding: 4vmin; opacity: 0; pointer-events: none;
        transition: opacity .28s ease;
      }
      /* display:flex above outranks the [hidden] attribute. Without this
         the closed modal stays a full-screen invisible panel over the
         page and swallows every click on the site. */
      .jw-modal[hidden] { display: none !important; }
      .jw-modal.is-open { opacity: 1; pointer-events: auto; }
      .jw-modal-frame {
        width: min(1200px, 92vw); aspect-ratio: 16 / 9;
        background: #000; box-shadow: 0 0 0 1px rgba(255,213,0,.2), 0 30px 90px #000;
        transform: scale(.96); transition: transform .28s ease;
      }
      .jw-modal.is-open .jw-modal-frame { transform: scale(1); }
      .jw-modal-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
      .jw-modal-close {
        position: absolute; top: 18px; right: 22px;
        background: none; border: 0; color: #F5F2EA;
        font: 300 44px/1 Inter, system-ui, sans-serif;
        cursor: pointer; padding: 6px 14px;
        transition: color .2s ease, transform .2s ease;
      }
      .jw-modal-close:hover { color: #FFD500; transform: scale(1.12); }
      .jw-modal-close:focus-visible, .jw-hot:focus-visible {
        outline: 3px solid #FFD500; outline-offset: 4px;
      }

      /* ---------------------------------------------------------------
         4. THE DOODLES
         --------------------------------------------------------------- */
      .jw-draw path { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
      .jw-draw.is-in path { animation: jw-draw 1.5s cubic-bezier(.5,.05,.2,1) forwards; }
      @keyframes jw-draw { to { stroke-dashoffset: 0; } }

      /* The red loop round YOU never stops: it draws on, holds, then
         carries on round and draws itself off the far end, which reads
         as one continuous pen stroke rather than a restart. */
      .jw-draw-loop path { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
      .jw-draw-loop.is-in path { animation: jw-draw-loop 5.5s cubic-bezier(.45,.05,.25,1) infinite; }
      @keyframes jw-draw-loop {
        0%   { stroke-dashoffset: var(--len); }
        38%  { stroke-dashoffset: 0; }
        62%  { stroke-dashoffset: 0; }
        100% { stroke-dashoffset: calc(var(--len) * -1); }
      }

      [data-pencil-name="Arrow Doodle"].is-in {
        animation: jw-arrow-wiggle 2.4s ease-in-out 1.3s infinite;
        transform-origin: 10% 90%;
      }
      @keyframes jw-arrow-wiggle {
        0%, 100% { transform: rotate(0deg)    translateX(0); }
        35%      { transform: rotate(-3.5deg) translateX(-5px); }
        70%      { transform: rotate(2.5deg)  translateX(4px); }
      }

      .jw-mozzie { animation: jw-mozzie 13s ease-in-out infinite; will-change: transform; }
      @keyframes jw-mozzie {
        0%   { transform: translate(0,0)         rotate(0deg); }
        12%  { transform: translate(26px,-16px)  rotate(9deg); }
        26%  { transform: translate(8px,-34px)   rotate(-6deg); }
        41%  { transform: translate(-22px,-12px) rotate(-13deg); }
        55%  { transform: translate(-31px,14px)  rotate(5deg); }
        68%  { transform: translate(-6px,26px)   rotate(12deg); }
        82%  { transform: translate(21px,11px)   rotate(-4deg); }
        100% { transform: translate(0,0)         rotate(0deg); }
      }

      /* The pillar icons wiggle, offset so they never move in unison.
         Desktop names them by pillar, mobile numbers them. */
      [data-pencil-name="Icon Purpose"], [data-pencil-name="Icon 1"],
      [data-pencil-name="Icon Performance"], [data-pencil-name="Icon 2"],
      [data-pencil-name="Icon Impact"], [data-pencil-name="Icon 3"] {
        animation: jw-wiggle 3.6s ease-in-out infinite;
        transform-origin: 50% 70%;
      }
      [data-pencil-name="Icon Performance"], [data-pencil-name="Icon 2"] { animation-delay: .5s;  animation-duration: 4.1s; }
      [data-pencil-name="Icon Impact"], [data-pencil-name="Icon 3"]      { animation-delay: 1.1s; animation-duration: 3.2s; }
      @keyframes jw-wiggle {
        0%, 100% { transform: rotate(0deg)  translateY(0); }
        25%      { transform: rotate(-5deg) translateY(-3px); }
        50%      { transform: rotate(0deg)  translateY(-6px); }
        75%      { transform: rotate(5deg)  translateY(-3px); }
      }

      /* PURPOSE / PERFORMANCE / IMPACT each wobble on their own clock.
         JS splits the heading into spans so the separator dots stay put. */
      .jw-word { display: inline-block; animation: jw-wobble 4.2s ease-in-out infinite; }
      .jw-word:nth-of-type(2) { animation-duration: 3.4s; animation-delay: .6s; }
      .jw-word:nth-of-type(3) { animation-duration: 4.9s; animation-delay: 1.2s; }
      @keyframes jw-wobble {
        0%, 100% { transform: rotate(0deg)    translateY(0)    skewX(0deg); }
        25%      { transform: rotate(-1.8deg) translateY(-5px) skewX(1.2deg); }
        50%      { transform: rotate(0deg)    translateY(-8px) skewX(0deg); }
        75%      { transform: rotate(1.8deg)  translateY(-4px) skewX(-1.2deg); }
      }

      /* ---------------------------------------------------------------
         5. THE TAPE STRIPS — scroll to the RIGHT, seamlessly
         --------------------------------------------------------------- */
      [data-pencil-name="Tape"] { justify-content: flex-start !important; }
      .jw-tape-track {
        display: flex; flex-direction: row; align-items: center;
        gap: 28px; flex: 0 0 auto; padding-right: 28px;
        animation: jw-tape 42s linear infinite;
      }
      @keyframes jw-tape { from { transform: translateX(-100%); } to { transform: translateX(0); } }
      [data-pencil-name="Tape Strip"]:hover .jw-tape-track { animation-play-state: paused; }

      /* ---------------------------------------------------------------
         6. TRUSTED BY — the Kyle Scheele move, plus the wall
         assembling itself one logo at a time. The zoom alone was too
         quiet to read.
         --------------------------------------------------------------- */
      /* ONLY THE LOGOS MOVE. The background photo, the dark overlay and
         Justin himself never shift by a pixel, which is the thing Hanz
         has asked for three times now.

         Clipping the section was wrong: it took the photo with it and
         left a black gap above the band. Scaling the section was wrong
         for the same reason. The transform belongs on the LOGO GROUP and
         nothing else.

         One element, not fourteen. transform and opacity are both
         composited, so this costs nothing per frame. The opacity fade is
         what makes it read clearly without having to scale the logos so
         far down that they pile onto Justin's face. */
      [data-pencil-name="Logo Group"], .jw-logo-group {
        transform: scale(var(--z, 1));
        transform-origin: 50% 50%;
        opacity: var(--zo, 1);
        will-change: transform, opacity;
      }
      .jw-js .jw-logo {
        opacity: 0;
        transform: scale(.72) translateY(16px);
        transition: opacity .55s cubic-bezier(.16,.84,.44,1),
                    transform .55s cubic-bezier(.2,1.5,.4,1);
        transition-delay: calc(var(--i, 0) * 85ms);
      }
      .jw-js .jw-logo.is-in { opacity: 1; transform: none; }
      .jw-logo:hover { filter: brightness(1.3); }

      /* ---------------------------------------------------------------
         7. TESTIMONIALS
         The pulled-out word shipped with a fixed height on desktop, so
         GAME CHANGER wrapped straight onto the line beneath it. Its
         974px width is left alone deliberately: that is what lets
         SPECTRUM. run wider than the text column.
         --------------------------------------------------------------- */
      [data-pencil-name="Big Word"] { height: auto !important; }
      [data-pencil-name="Slide 1 Joe Rogan"] { transition: opacity .34s ease; }
      [data-pencil-name="Slide 1 Joe Rogan"].jw-swapping { opacity: 0; }
      [data-pencil-name="Carousel Dots"] { transition: top .34s cubic-bezier(.16,.84,.44,1); }
      [data-pencil-name="Carousel Dots"] > div[data-pencil-name^="Dot "] {
        cursor: pointer; transition: background-color .2s ease, transform .2s ease;
      }
      [data-pencil-name="Carousel Dots"] > div[data-pencil-name^="Dot "]:hover { transform: scale(1.35); }
      [data-pencil-name="Active Marker"] { transition: left .34s cubic-bezier(.16,.84,.44,1); }

      /* ---------------------------------------------------------------
         8. REVEALS AND HOVER
         --------------------------------------------------------------- */
      .jw-js [data-jw-reveal] {
        opacity: 0;
        transform: translateY(var(--jw-rise, 26px)) scale(var(--jw-scale, 1));
        transition: opacity .7s cubic-bezier(.16,.84,.44,1),
                    transform .7s cubic-bezier(.16,.84,.44,1);
        transition-delay: calc(var(--i, 0) * 80ms);
      }
      .jw-js [data-jw-reveal].is-in { opacity: 1; transform: none; }

      [data-pencil-name="Play Button"] { transition: transform .3s cubic-bezier(.16,.84,.44,1); }
      [data-pencil-name="Play Button"]:hover { transform: scale(1.09); }
      [data-pencil-name="Play Ring"] { animation: jw-pulse 2.8s ease-in-out infinite; transform-origin: 50% 50%; }
      @keyframes jw-pulse {
        0%, 100% { opacity: 1;   transform: scale(1); }
        50%      { opacity: .78; transform: scale(1.06); }
      }
      [data-pencil-name^="Link "], [data-pencil-name="Secondary Link"] { transition: color .2s ease; }
      [data-pencil-name^="Link "]:hover,
      [data-pencil-name="Secondary Link"]:hover { color: #FFD500 !important; }
      [data-pencil-name="Nav CTA"], [data-pencil-name="Primary Button"],
      [data-pencil-name="Hero CTA"], [data-pencil-name="Send Enquiry Button"] {
        transition: transform .22s cubic-bezier(.16,.84,.44,1), filter .22s ease;
      }
      [data-pencil-name="Nav CTA"]:hover, [data-pencil-name="Primary Button"]:hover,
      [data-pencil-name="Hero CTA"]:hover, [data-pencil-name="Send Enquiry Button"]:hover {
        transform: translateY(-2px) rotate(-.4deg); filter: brightness(1.08);
      }

      /* ---------------------------------------------------------------
         10. RE-EXPORT FIXES (5 Oct 2026)
         pen.dev exports the pillar icons' glow as box-shadow, which draws
         a square halo behind a transparent icon. The first port turned it
         into drop-shadows that follow the icon shape; keep that.
         --------------------------------------------------------------- */
      /* desktop icons now keep the export glow, same as the Speaking page (Hanz, 5 Oct) */
      [data-pencil-name="Icon 1"], [data-pencil-name="Icon 2"], [data-pencil-name="Icon 3"] {
        box-shadow: 0px 0px 4px 5px #000000FF, 0px 0px 14px 12px #000000FF, 0px 0px 34px 18px #000000E6, 0px 0px 14px 1px #FFFFFF80, 0px 0px 22px 3px #FFEE3273 !important;
      }
      /* ---------------------------------------------------------------
         9. Nobody gets motion sickness from a speaker site.
         --------------------------------------------------------------- */
      @media (prefers-reduced-motion: reduce) {
        .jw-js [data-jw-reveal], .jw-js .jw-logo {
          opacity: 1 !important; transform: none !important; transition: none !important;
        }
        .jw-draw path, .jw-draw-loop path {
          stroke-dasharray: none !important; stroke-dashoffset: 0 !important;
        }
        .jw-tape-track, .jw-mozzie, .jw-word,
        [data-pencil-name="Play Ring"], [data-pencil-name="Arrow Doodle"],
        [data-pencil-name^="Icon "] { animation: none !important; }
        [data-pencil-name="Logo Group"], .jw-logo-group { transform: none !important; opacity: 1 !important; }
      }

/* 5 Oct 2026 (Hanz): no square behind the pillar icons. The export draws the
   glow as a box-shadow on the icon's square box; a drop-shadow follows the
   icon's own shape instead. */
[data-pencil-name="Padlock"], [data-pencil-name="Glove"], [data-pencil-name="Drop"],
[data-pencil-name="Icon 1"], [data-pencil-name="Icon 2"], [data-pencil-name="Icon 3"] {
  box-shadow: none !important;
  filter: drop-shadow(0 0 6px #000000) drop-shadow(0 0 16px #000000E6) drop-shadow(0 0 30px #000000B3);
}
