.lk-tide {
  --tide-ink: #233c39;
  --tide-paper: #f3e7c9;
  --tide-teal: #205253;
  max-width: 1180px;
  margin: clamp(30px, 6vw, 82px) auto;
  padding-inline: clamp(16px, 5vw, 52px);
  color: var(--tide-ink);
}

.lk-page .lk-tide > h2 {
  margin-block: 0 clamp(16px, 2.8vw, 30px);
  text-wrap: balance;
}

.lk-tide .lk-tide-poster,
.lk-tide-stage {
  display: block;
  width: 100%;
  aspect-ratio: 1440 / 820;
  height: auto;
  box-sizing: border-box;
  border: 1px solid #5b7162;
  background: #244d57;
}

.lk-tide .lk-tide-poster,
.lk-tide .lk-tide-graphic {
  background: #244d57 url("station-tide-background.svg?v=pier") center / 100% 100% no-repeat;
}

.lk-tide-stage {
  --tide-x: 0%;
  --tide-y: 0%;
  --tide-zoom: 1;
  --tide-rays: .78;
  --tide-shade: .12;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
}

.lk-tide-graphic {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  transform: translate3d(var(--tide-x), var(--tide-y), 0) scale(var(--tide-zoom));
  transform-origin: top left;
  transition: transform 510ms cubic-bezier(.24, .67, .24, 1);
}

.lk-tide-stage.is-adjusting .lk-tide-graphic {
  transition: none;
}

.lk-tide .tide-rays {
  opacity: var(--tide-rays);
}

.lk-tide .tide-deep-shade {
  opacity: var(--tide-shade);
}

.lk-tide .tide-sail {
  transform-box: view-box;
  transform-origin: 831px 352px;
}

.lk-tide .tide-sail {
  animation: tide-sail 5.2s ease-in-out infinite;
}

.lk-tide .tide-bubbles {
  animation: tide-bubbles 5.4s linear infinite;
}

.lk-tide .tide-bubbles-b {
  animation-delay: -2.4s;
}


@keyframes tide-sail {
  0%, 100% { transform: rotate(-2.5deg) scaleX(.99); }
  56% { transform: rotate(2.8deg) scaleX(1.035); }
}

.lk-tide .tide-kick {
  transform-box: view-box;
  transform-origin: 20px 32px;
  animation: tide-kick 2.8s ease-in-out infinite;
}
.lk-tide .tide-kick-student { animation-delay: -.8s; animation-duration: 2.4s; }
@keyframes tide-kick {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(4deg); }
}
@keyframes tide-bubbles {
  0% { opacity: 0; transform: translate(4px, 14px); }
  20% { opacity: .83; }
  72% { opacity: .65; }
  100% { opacity: 0; transform: translate(-8px, -42px); }
}

.lk-tide-controls {
  display: grid;
  grid-template-columns: 1fr minmax(165px, .76fr);
  align-items: center;
  column-gap: clamp(16px, 3vw, 34px);
  row-gap: 10px;
  padding: clamp(12px, 2vw, 20px);
  box-sizing: border-box;
  border: 1px solid #aaaf90;
  border-top: 0;
  background: var(--tide-paper);
}

.lk-tide-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid #a8a986;
  border-radius: 7px;
  background: #e9dcb6;
}

.lk-tide .lk-tide-modes button {
  min-height: 44px;
  padding: 5px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--tide-ink);
  font: 700 14px/1.2 Arial, sans-serif;
  cursor: pointer;
}

.lk-tide .lk-tide-modes button[aria-pressed="true"] {
  background: var(--tide-teal);
  color: #ffefb9;
}

.lk-tide-depth {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--tide-ink);
  font: 700 13px/1.2 Arial, sans-serif;
}

.lk-tide-depth input {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  margin: 0;
  accent-color: var(--tide-teal);
  cursor: ew-resize;
}

.lk-tide .lk-tide-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  justify-content: space-between;
  gap: 2px 12px;
  font: 13px/1.45 Arial, sans-serif;
}

.lk-tide-context a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lk-tide :is(button, input, a):focus-visible {
  outline: 3px solid #9a4720;
  outline-offset: 3px;
}

@media (max-width: 630px) {
  .lk-tide-controls {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lk-tide-graphic { transition: none; }
}

body[data-motion="off"] .lk-tide .lk-tide-stage [data-tide-animated] { animation: none; }
body[data-motion="off"] .lk-tide-graphic { transition: none; }

/* Каждое судно движется в своей полосе; вся семья и Арни остаются на сапе. */
.lk-tide .tide-route { animation: tide-route 18s ease-in-out infinite; }
.lk-tide .tide-sup { animation-duration: 24s; }
.lk-tide .tide-kayak { animation-duration: 20s; animation-delay: -4s; }
.lk-tide .tide-windsurf { animation-duration: 28s; animation-delay: -9s; }
.lk-tide .tide-boat { animation-duration: 22s; animation-delay: -15s; }
.lk-tide .tide-facing {
  transform-box: view-box;
  transform-origin: 270px 360px;
  transform: scale(.67);
}
.lk-tide .tide-kayak .tide-facing { transform-origin: 566px 360px; }
.lk-tide .tide-windsurf .tide-facing { transform-origin: 866px 360px; }
.lk-tide .tide-boat .tide-facing { transform-origin: 1095px 360px; }
.lk-tide .tide-divers { --out: 88px; --back: -38px; --period: 26s; --phase: -3s; }
.lk-tide .tide-school-a { --out: 90px; --back: -40px; --period: 18s; --phase: -4s; }
.lk-tide .tide-school-b { --out: -85px; --back: 35px; --period: 22s; --phase: -7s; }
.lk-tide .tide-school-c { --out: 86px; --back: -35px; --period: 15s; --phase: -5s; }
.lk-tide :is(.tide-divers, .tide-school) {
  animation: tide-underwater-lap var(--period) ease-in-out var(--phase) infinite;
}
.lk-tide .tide-return {
  transform-box: fill-box;
  transform-origin: center;
  animation: tide-underwater-turn var(--period) ease-in-out var(--phase) infinite;
}
.lk-tide .tide-water-light { animation: tide-light 9s ease-in-out infinite; }
@keyframes tide-route {
  0%, 4%, 96%, 100% { transform: translate(0, 0); }
  46%, 54% { transform: translate(55px, 0); }
}
@keyframes tide-underwater-lap {
  0%, 2%, 98%, 100% { transform: translate(var(--back), 4px); }
  48%, 52% { transform: translate(var(--out), -4px); }
}
@keyframes tide-underwater-turn {
  0%, 50% { opacity: .26; }
  1%, 46%, 100% { transform: rotate(0) scaleX(1); }
  2%, 48%, 52%, 98% { opacity: 1; }
  49.99% { transform: rotate(-4deg) scaleX(.84); animation-timing-function: steps(1, end); }
  50% { transform: rotate(4deg) scaleX(-.84); }
  54%, 96% { transform: rotate(0) scaleX(-1); }
  99.99% { transform: rotate(4deg) scaleX(-.84); animation-timing-function: steps(1, end); }
  100% { opacity: .26; }
}
@keyframes tide-light { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(45px); } }
.lk-tide-swimmer-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translate3d(var(--tide-x), var(--tide-y), 0) scale(var(--tide-zoom));
  transform-origin: top left;
  transition: transform 510ms cubic-bezier(.24, .67, .24, 1);
}
.lk-tide-stage.is-adjusting .lk-tide-swimmer-layer { transition: none; }
.lk-water .lk-panorama-water .lk-tide-swimmer-layer .lk-swim {
  inset-inline: 56% 11%;
  bottom: 7%;
}
@media (prefers-reduced-motion: reduce) {
  .lk-tide-swimmer-layer { transition: none; }
}

.lk-tide [data-tide-animated] {
  animation-play-state: paused;
}

.lk-tide .lk-tide-stage.is-visible [data-tide-animated] {
  animation-play-state: running;
}
/* Separate the rowing boat from the windsurfer, including the oar's reach. */
.lk-tide .tide-boat { animation-name: tide-boat-route; }
@keyframes tide-boat-route {
  0%, 4%, 96%, 100% { transform: translate(65px, 17px); }
  46%, 54% { transform: translate(120px, 17px); }
}
