|
81 | 81 | z-index: 0; |
82 | 82 | pointer-events: none; |
83 | 83 | } |
| 84 | + |
| 85 | +/* --- Roakey scroll peeks --------------------------------------------------- |
| 86 | + Decorative mascots anchored at predefined points in the landing page. They |
| 87 | + sit absolutely (out of flow, so they never shift content) and slide in from |
| 88 | + the edge as you scroll past, stopping flush against the side. */ |
| 89 | +.roakey-peek { |
| 90 | + position: absolute; |
| 91 | + height: auto; |
| 92 | + margin: 0; |
| 93 | + pointer-events: none; |
| 94 | + user-select: none; |
| 95 | + z-index: 5; |
| 96 | +} |
| 97 | + |
| 98 | +/* Off-screen peeks must not create horizontal scroll. */ |
| 99 | +html, body { |
| 100 | + overflow-x: clip; |
| 101 | +} |
| 102 | + |
| 103 | +/* Anchor the peeks to the full-width content column. The landing block that |
| 104 | + wraps each directive is narrow and centered, so reaching the true screen |
| 105 | + edge from it would require a viewport-based offset that overshoots past the |
| 106 | + clip box (the vertical scrollbar makes the right side fall fully outside, |
| 107 | + hiding the tail). Promoting `main` to the containing block lets us anchor |
| 108 | + flush with a plain `left: 0` / `right: 0`, fully inside the clip box. */ |
| 109 | +main:has(.roakey-peek) { |
| 110 | + position: relative; |
| 111 | +} |
| 112 | +.myst-landing-block:has(.roakey-peek) { |
| 113 | + position: static; |
| 114 | +} |
| 115 | + |
| 116 | +/* Head peeks in from the left edge */ |
| 117 | +.roakey-peek-left { |
| 118 | + left: 0; |
| 119 | + width: 170px; |
| 120 | + transform: translateX(-100%); |
| 121 | +} |
| 122 | + |
| 123 | +/* Tail peeks in from the right edge */ |
| 124 | +.roakey-peek-tail { |
| 125 | + right: 0; |
| 126 | + width: 190px; |
| 127 | + transform: translateX(100%); |
| 128 | +} |
| 129 | + |
| 130 | +/* Slide in as the peek scrolls through the viewport (Chromium/Edge). */ |
| 131 | +@supports (animation-timeline: view()) { |
| 132 | + /* Both peeks only reveal on wide viewports, where the gutters beside the |
| 133 | + centered content column have room for them. On narrower screens they would |
| 134 | + cover the content, so they stay hidden off-screen. */ |
| 135 | + @media (min-width: 1536px) { |
| 136 | + .roakey-peek-left { |
| 137 | + animation: roakey-peek-left linear both; |
| 138 | + animation-timeline: view(); |
| 139 | + animation-range: entry 0% entry 100%; |
| 140 | + } |
| 141 | + .roakey-peek-tail { |
| 142 | + animation: roakey-peek-tail linear both; |
| 143 | + animation-timeline: view(); |
| 144 | + animation-range: entry 0% entry 100%; |
| 145 | + } |
| 146 | + } |
| 147 | + @keyframes roakey-peek-left { |
| 148 | + 0% { transform: translateX(-100%); } |
| 149 | + 100% { transform: translateX(0); } |
| 150 | + } |
| 151 | + /* Stop before the wooden board enters the viewport, so only the tail shows |
| 152 | + (the board occupies the right ~10% of the image). */ |
| 153 | + @keyframes roakey-peek-tail { |
| 154 | + 0% { transform: translateX(100%); } |
| 155 | + 100% { transform: translateX(13%); } |
| 156 | + } |
| 157 | +} |
| 158 | + |
| 159 | +@media (prefers-reduced-motion: reduce) { |
| 160 | + .roakey-peek-left, |
| 161 | + .roakey-peek-tail { |
| 162 | + animation: none; |
| 163 | + } |
| 164 | +} |
0 commit comments