/* Proteus website: motion. Loaded after site.css.
   Proteus changes shape and lives in the sea: things drift, swell and morph.
   Everything here is switched off for visitors who ask for reduced motion. */

/* The tide: how far down the page the visitor is. */
.tide { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 20; transform-origin: 0 50%;
        transform: scaleX(var(--tide, 0)); background: linear-gradient(90deg, var(--sea), var(--shallow)); }

/* Header: its lower edge is the surface of the water. */
.top { border-bottom: 0; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 8px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='8' viewBox='0 0 48 8'%3E%3Cpath d='M0 4 q12 -6 24 0 t24 0' fill='none' stroke='%2322c1c9' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 48px 8px; opacity: 0.75; animation: drift 5s linear infinite; }

/* Navigation: a wave runs under the link you are on or point at. */
.top nav a { position: relative; }
.top nav a::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 1px; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='6' viewBox='0 0 20 6'%3E%3Cpath d='M0 3 q5 -4 10 0 t10 0' fill='none' stroke='%2322c1c9' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 20px 6px; opacity: 0; transform: scaleX(0.3);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.top nav a:hover::after, .top nav a.here::after { opacity: 1; transform: scaleX(1); animation: ripple 0.9s linear infinite; }
.top nav a.here::after { animation-duration: 2.4s; }
.top nav a:hover, .top nav a.here { background: transparent; }
.top nav a.here { color: var(--accent); }

@keyframes drift { to { background-position-x: -48px; } }
@keyframes ripple { to { background-position-x: -20px; } }

/* Hero: slow light on the water, a mark that floats on a shape that never settles. */
.hero, .page-head { background-size: 180% 180%; animation: light 18s ease-in-out infinite alternate; }
@keyframes light { from { background-position: 0% 100%; } to { background-position: 100% 0%; } }

.hero .mark { position: relative; animation: float 6s ease-in-out infinite; }
.hero .mark::before { content: ""; position: absolute; inset: -34px; z-index: -1;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.34), rgba(34, 193, 201, 0.16) 60%, transparent 72%);
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; animation: morph 11s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-9px) rotate(-1.5deg); } }
@keyframes morph {
  0%, 100% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; transform: rotate(0deg) scale(1); }
  33% { border-radius: 63% 37% 41% 59% / 55% 62% 38% 45%; transform: rotate(40deg) scale(1.06); }
  66% { border-radius: 36% 64% 52% 48% / 62% 38% 62% 38%; transform: rotate(-25deg) scale(0.97); }
}

/* The word that changes shape. */
/* On a line of its own, so the words before it stay where they are. */
.shift { display: block; color: #bdf3f5; transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease; }
.shift.out { opacity: 0; filter: blur(10px); transform: translateY(0.18em) scale(0.96); }

/* Waves: three layers moving at their own pace. Each path repeats, so sliding it by
   half its length brings it back to where it started. */
.waves { position: absolute; left: 0; right: 0; bottom: -1px; height: 110px; overflow: hidden; pointer-events: none; }
.waves svg { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; display: block; }
.waves path { fill: var(--bg); }
.waves .back { opacity: 0.25; animation: swell 23s linear infinite; }
.waves .mid { opacity: 0.5; animation: swell 15s linear infinite reverse; }
.waves .front { animation: swell 10s linear infinite; }
@keyframes swell { to { transform: translateX(-50%); } }

/* The footer rises out of a wave too. */
footer { position: relative; margin-top: 90px; }
footer::before { content: ""; position: absolute; left: 0; right: 0; top: -39px; height: 40px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='40' viewBox='0 0 240 40' preserveAspectRatio='none'%3E%3Cpath d='M0 22 q60 -30 120 0 t120 0 V40 H0 Z' fill='%230b2559'/%3E%3C/svg%3E") repeat-x;
  background-size: 240px 40px; animation: tide-in 9s linear infinite; }
@keyframes tide-in { to { background-position-x: -240px; } }

/* Things surface as you reach them. */
.reveal { opacity: 0; transform: translateY(26px);
          transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
          transition-delay: var(--delay, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* Icons bob on a card you point at; the main button's colours slide. */
.cards .card:hover .icon { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-6deg); } }
.button.primary { background-size: 160% 160%;
                  transition: background-position 0.5s ease, transform 0.12s ease, box-shadow 0.12s ease; }
.button.primary:hover { background-position: 100% 0; }

/* Test page */
.page-head { position: relative; overflow: hidden; padding-bottom: 104px; }
.page-head .waves { height: 64px; }
.summary { margin-top: -58px; z-index: 1; }
@property --value { syntax: "<number>"; inherits: true; initial-value: 0; }
.score .ring { transition: --value 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.check { animation: surface 0.5s both; animation-delay: var(--delay, 0ms); }
@keyframes surface { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hash b { display: inline-block; }
.hash.fresh b { animation: settle 0.8s ease; }
@keyframes settle { from { opacity: 0; filter: blur(8px); letter-spacing: 0.3em; }
                    to { opacity: 1; filter: none; letter-spacing: 0.05em; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
