.identity__portrait {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.identity:not([data-ocean-discovered]) .identity__portrait::after {
  position: absolute;
  inset: -3px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  content: "";
  opacity: 0;
  pointer-events: none;
  animation: ocean-invitation 10s 3s ease-out infinite;
}

@keyframes ocean-invitation {
  0% { opacity: 0; transform: scale(1); }
  5% { opacity: 0.65; }
  18%, 100% { opacity: 0; transform: scale(1.45); }
}

.identity__avatar {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  background: var(--soft);
  transition: background 300ms ease;
}

.identity__avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 88%;
  transform: scale(1.65) translate(3%, 2%);
  transition: opacity 220ms ease, transform 400ms var(--ease);
}

.identity__fish {
  position: absolute;
  width: 30px;
  height: 16px;
  left: 4px;
  top: 11px;
  overflow: visible;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.6) rotate(-15deg);
  transition: opacity 250ms ease, transform 450ms var(--ease);
}

.identity:is(:focus-visible, [aria-expanded="true"]) .identity__avatar {
  background: transparent;
}

.identity:is(:focus-visible, [aria-expanded="true"]) .identity__avatar-image {
  opacity: 0;
  transform: scale(1.35) translate(3%, 2%);
}

.identity:is(:focus-visible, [aria-expanded="true"]) .identity__fish {
  opacity: 1;
  transform: translateX(2px) rotate(-5deg);
}

@media (hover: hover) and (pointer: fine) {
  .identity:hover .identity__avatar { background: transparent; }
  .identity:hover .identity__avatar-image {
    opacity: 0;
    transform: scale(1.35) translate(3%, 2%);
  }
  .identity:hover .identity__fish {
    opacity: 1;
    transform: translateX(2px) rotate(-5deg);
  }
}

.identity__splash {
  position: absolute;
  left: 19px;
  top: 20px;
  pointer-events: none;
}

.identity__splash i {
  position: absolute;
  width: 4px;
  height: 6px;
  border-radius: 60%;
  background: var(--muted);
  opacity: 0;
  --spray-x: -22px;
  --spray-y: -22px;
}

.identity__splash i:nth-child(2) { --spray-x: 3px; --spray-y: -30px; }
.identity__splash i:nth-child(3) { --spray-x: 25px; --spray-y: -14px; }

.identity.is-arriving .identity__splash i {
  animation: ocean-droplet 650ms ease-out both;
}

.little-ocean {
  position: fixed;
  z-index: 110;
  inset: auto 0 0;
  height: clamp(190px, 28vh, 260px);
  isolation: isolate;
  color: var(--muted);
}

.little-ocean.is-arriving {
  animation: ocean-arrive 550ms var(--ease) both;
}

.little-ocean[hidden] { display: none; }

.little-ocean::before {
  position: absolute;
  inset: 59px 0 0;
  content: "";
  background: var(--soft);
}

.little-ocean__surface {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 60px;
  overflow: hidden;
  pointer-events: none;
}

.little-ocean__wave {
  fill: var(--soft);
  animation: ocean-tide 12s linear infinite;
}

.little-ocean__wave--back {
  fill: var(--line);
  animation-duration: 18s;
  animation-direction: reverse;
}

.little-ocean__water {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
  overflow: hidden;
  touch-action: manipulation;
}

.little-ocean__water:focus-visible {
  outline-color: var(--ink);
  outline-offset: -5px;
}

.little-ocean__fish {
  position: absolute;
  left: 0;
  top: 0;
  width: 54px;
  height: 28px;
  pointer-events: none;
  will-change: transform;
}

.little-ocean__fish-shape {
  display: block;
  width: 54px;
  height: 28px;
  overflow: visible;
  fill: var(--accent);
  transform: scaleX(var(--fish-direction, 1)) rotate(var(--fish-tilt, 0deg));
}

.little-ocean__tail {
  transform-origin: 16px 16px;
  animation: ocean-tail 700ms ease-in-out infinite alternate;
}

.little-ocean__caption {
  position: absolute;
  left: var(--gutter);
  bottom: 25px;
  margin: 0;
  font-size: 12px;
  pointer-events: none;
}

.little-ocean__close {
  position: absolute;
  right: var(--gutter);
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}

.little-ocean__close:hover { text-decoration: underline; }

.little-ocean__ripple {
  position: absolute;
  width: var(--ripple-width, 124px);
  height: var(--ripple-height, 56px);
  border: 1px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: ocean-ripple var(--ripple-duration, 1000ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.little-ocean__ripple::after {
  position: absolute;
  inset: 10%;
  border: 1px solid var(--muted);
  border-radius: inherit;
  content: "";
}

.little-ocean__splash {
  position: absolute;
  left: 50%;
  top: 46px;
  pointer-events: none;
}

.little-ocean__splash i {
  position: absolute;
  width: 5px;
  height: 9px;
  border-radius: 60%;
  background: var(--muted);
  opacity: 0;
  --spray-x: -42px;
  --spray-y: -28px;
}

.little-ocean.is-arriving .little-ocean__splash i {
  animation: ocean-droplet 700ms 360ms ease-out both;
}

.little-ocean__splash i:nth-child(2) { --spray-x: -18px; --spray-y: -44px; }
.little-ocean__splash i:nth-child(3) { --spray-x: 5px; --spray-y: -54px; }
.little-ocean__splash i:nth-child(4) { --spray-x: 29px; --spray-y: -36px; }
.little-ocean__splash i:nth-child(5) { --spray-x: 46px; --spray-y: -16px; }

@keyframes ocean-arrive {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes ocean-tide {
  to { transform: translateX(-600px); }
}

@keyframes ocean-tail {
  from { transform: scaleX(0.75) skewY(-8deg); }
  to { transform: scaleX(1) skewY(8deg); }
}

@keyframes ocean-droplet {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  20% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--spray-x), var(--spray-y)) scale(0.7); }
}

@keyframes ocean-ripple {
  from { opacity: 0.7; transform: translate(-50%, -50%) scale(var(--ripple-start, 0.194)); }
  65% { opacity: 0.3; }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.little-ocean.is-still,
.little-ocean.is-still *,
.little-ocean__ripple.is-still,
body[data-motion="paused"] .identity__splash i {
  animation: none;
}

body[data-motion="paused"] .identity .identity__portrait::after {
  animation: none;
}

.little-ocean__ripple.is-still { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .identity *, .identity .identity__portrait::after, .little-ocean, .little-ocean * {
    animation: none;
    transition: none;
  }
}

@media (max-width: 420px) {
  .little-ocean__caption,
  .little-ocean__close { font-size: 11px; }
}
