/* Prevent mobile tap-highlight flashing when clicking interactive island canvas & controls */
.journey-section,
.journey-sticky,
.journey-canvas,
canvas,
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

.journey-section,
.journey-sticky,
.journey-canvas {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

/* Top bar: language selector (left), centered logo + larger icon (middle), download CTA (right) */
header.nav:not(.is-open) .nav__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

header.nav:not(.is-open) .lang-switch {
  grid-column: 1;
  justify-self: start;
}

header.nav:not(.is-open) .nav__logo {
  grid-column: 2;
  justify-self: center;
  gap: 10px;
}

header.nav:not(.is-open) .nav__actions,
header.nav:not(.is-open) .nav__toggle {
  grid-column: 3;
  justify-self: end;
  margin-left: 0;
}

header.nav .nav__logo-icon,
.nav__logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.nav__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  background: var(--surface);
  color: var(--ink);
}

.lang-switch__icon {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.78;
}

.lang-select {
  height: 100%;
  padding: 0 2px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

@media (max-width: 639px) {
  header.nav {
    padding-inline: 0;
  }
  header.nav:not(.is-open) .wrap.nav__bar {
    width: 100%;
    max-width: none;
    gap: 6px;
    padding-inline: 10px;
  }
  header.nav:not(.is-open) .nav__logo {
    font-size: clamp(13px, 3.7vw, 15px);
    gap: 5px;
  }
  header.nav .nav__logo-icon,
  .nav__logo-icon {
    width: 26px;
    height: 26px;
  }
  .lang-switch {
    height: 30px;
    padding: 0 5px;
    gap: 3px;
    max-width: 62px;
  }
  .lang-switch__icon {
    width: 14px;
    height: 14px;
  }
  .lang-select {
    font-size: 11px;
    max-width: 36px;
  }
}

/* Centered header block for Castaways section */
.naufragos-showcase .castaways-head {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s-4);
}

.naufragos-showcase .castaways-head__copy {
  width: 100%;
  max-width: 72ch;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.naufragos-showcase .castaways-skin-bar {
  justify-content: center;
}

.naufragos-showcase .castaways-head__actions {
  justify-content: center;
}

/* Centered CTA block in Footer */
footer.closing .closing__cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

footer.closing .closing__cta .section-head {
  max-width: 68ch;
  width: 100%;
  margin-inline: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}

footer.closing .closing__cta .btn {
  margin-inline: auto;
}

/* ---------------------------------------------------------------- SplitText (React Bits port) */
.split-parent {
  display: inline-block;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
}

.split-parent--castaways {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.7vw, 2.45rem);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.025em;
  color: var(--p-inv-ink);
  max-width: min(100%, 36ch);
  margin: 0 auto var(--s-4);
}

.split-line {
  display: block;
}

.split-word,
.split-char {
  display: inline-block;
}

/* ---------------------------------------------------------------- Journey Horizontal Sea Overlay + ScrollFloat */
.journey-horizontal-anchor {
  position: absolute;
  top: 18%;
  left: 0;
  width: 1px;
  height: 14%;
  pointer-events: none;
}

.journey-horizontal-fade-anchor {
  position: absolute;
  top: 38%;
  left: 0;
  width: 1px;
  height: 18%;
  pointer-events: none;
}

.journey-interact-anchor {
  position: absolute;
  top: 58%;
  left: 0;
  width: 1px;
  height: 14%;
  pointer-events: none;
}

.journey-interact-fade-anchor {
  position: absolute;
  top: 75%;
  left: 0;
  width: 1px;
  height: 14%;
  pointer-events: none;
}

/* Hide animated headings before JS mounts to prevent FOUC flash on refresh */
#journey-weather-text:not(.blur-text):not(.scroll-float),
#journey-interact-text:not(.blur-text):not(.scroll-float),
#naufragos-h:not(.blur-text),
#close-h:not(.blur-text),
#close-sub:not(.blur-text) {
  opacity: 0;
  visibility: hidden;
}

.journey-weather-overlay {
  position: absolute;
  right: 3.5vw;
  top: 31%;
  z-index: 3;
  pointer-events: none;
  width: min(40vw, 560px);
}

.journey-weather-overlay--interact {
  top: 23%;
}

.scroll-float {
  margin: 0;
  padding-inline: 0.08em;
  overflow: hidden;
  text-align: right;
}

.scroll-float--open {
  overflow: visible;
  overflow-x: clip;
}

.scroll-float-text {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.85vw, 2.75rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: #ffffff;
  text-shadow: 0 3px 18px rgba(7, 25, 34, 0.62), 0 1px 4px rgba(0, 0, 0, 0.5);
}

.scroll-float-word {
  display: inline-block;
  white-space: nowrap;
}

.scroll-float-char {
  display: inline-block;
}

.scroll-float-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 639px) {
  .journey-weather-overlay,
  .journey-weather-overlay--interact {
    left: 6vw;
    right: 6vw;
    top: 22%;
    width: auto;
  }
  .scroll-float,
  .scroll-float-text {
    text-align: center;
  }
  .scroll-float-text {
    font-size: clamp(1.25rem, 5.2vw, 1.65rem);
  }
}

/* ---------------------------------------------------------------- FoldText (React Bits port) */
.fold-text {
  display: inline-block;
  color: var(--fold-text-color, currentColor);
  font-family: var(--font-display);
  font-size: var(--fold-text-font-size, inherit);
  font-weight: var(--fold-text-font-weight, inherit);
  line-height: 1.08;
  letter-spacing: -0.03em;
  white-space: pre-wrap;
  user-select: text;
  text-align: center;
}

.fold-text--sub {
  font-family: var(--font-text);
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.fold-text-sr-only {
  position: absolute;
  user-select: none;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fold-text-visual {
  display: inline;
}

.fold-text-word {
  display: inline-block;
  white-space: nowrap;
}

.fold-text-segment {
  display: inline-block;
  perspective: var(--fold-perspective, 700px);
  vertical-align: baseline;
}

.fold-text-segment[data-fold-split='line'] {
  display: block;
}

.fold-text-piece {
  --fold-shade: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.22) 42%,
    rgba(255, 255, 255, 0.26) 100%
  );
  position: relative;
  display: inline-block;
  backface-visibility: hidden;
  transform-origin: 50% 0%;
}

.fold-text-piece[data-fold-hinge='bottom'] {
  --fold-shade: linear-gradient(0deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
  transform-origin: 50% 100%;
}

.fold-text-piece[data-fold-hinge='left'] {
  --fold-shade: linear-gradient(90deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
  transform-origin: 0% 50%;
}

.fold-text-piece[data-fold-hinge='right'] {
  --fold-shade: linear-gradient(
    270deg,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.22) 42%,
    rgba(255, 255, 255, 0.26) 100%
  );
  transform-origin: 100% 50%;
}

.fold-text-piece[data-fold-style='blinds'] {
  perspective: var(--fold-perspective, 700px);
}

.fold-text-slat {
  position: relative;
  display: inline-block;
  backface-visibility: hidden;
}

.fold-text-slat[data-fold-slat='b'] {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.fold-text-piece::after,
.fold-text-slat::after {
  content: attr(data-fold-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: var(--fold-shade);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: var(--fold-crease, 0);
}

@media (prefers-reduced-motion: reduce) {
  .fold-text-piece,
  .fold-text-slat {
    transform: none !important;
  }

  .fold-text-piece::after,
  .fold-text-slat::after {
    opacity: 0 !important;
  }
}

/* ---------------------------------------------------------------- BlurText (React Bits port) */
.blur-text {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
}

.blur-text-word {
  display: inline-flex;
  transition: filter 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.blur-text-piece {
  display: inline-block;
  will-change: transform, filter, opacity;
}

.blur-text-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  user-select: none;
}

.blur-text--overlay {
  justify-content: flex-end;
  text-align: right;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.85vw, 2.75rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: #ffffff;
  text-shadow: 0 3px 18px rgba(7, 25, 34, 0.62), 0 1px 4px rgba(0, 0, 0, 0.5);
}

html[dir='rtl'] .blur-text--overlay {
  justify-content: flex-start;
  text-align: right;
}

@media (max-width: 639px) {
  .blur-text--overlay,
  html[dir='rtl'] .blur-text--overlay {
    justify-content: center;
    text-align: center;
    font-size: clamp(1.25rem, 5.2vw, 1.65rem);
  }
}

.blur-text--castaways {
  justify-content: center;
  text-align: center;
  margin-inline: auto;
  max-width: 34ch;
}

.closing__cta.close--type {
  align-items: center;
  text-align: center;
}

.closing__cta.close--type > .section-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.blur-text--close {
  justify-content: center;
  text-align: center;
  margin-inline: auto;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.6vw, 2.85rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.blur-text--close-sub {
  justify-content: center;
  text-align: center;
  margin-inline: auto;
  font-family: var(--font-text);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  font-weight: 500;
  line-height: 1.5;
  margin-top: 12px;
}

/* Palm tree tap hint (hand + tap ripple after interact text finishes) */
.palm-tap-hint {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.palm-tap-hint.is-visible {
  opacity: 1;
  visibility: visible;
}

.palm-tap-hint__ring {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%);
  box-shadow: 0 0 14px rgba(13, 116, 128, 0.45);
  opacity: 0;
  transform: scale(0.3);
}

.palm-tap-hint--castaway {
  --tap-delay: 0.28s;
}

.palm-tap-hint--boat {
  --tap-delay: 0.56s;
}

.palm-tap-hint.is-visible .palm-tap-hint__ring {
  animation: palm-tap-ring 1.65s cubic-bezier(0.22, 1, 0.36, 1) var(--tap-delay, 0s) infinite;
}

.palm-tap-hint.is-visible .palm-tap-hint__ring--inner {
  animation: palm-tap-ring 1.65s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--tap-delay, 0s) + 0.22s) infinite;
}

.palm-tap-hint__hand {
  position: absolute;
  left: -18px;
  top: -4px;
  width: 44px;
  height: 44px;
  transform-origin: 18px 4px;
  filter: drop-shadow(0 6px 14px rgba(7, 25, 34, 0.48));
}

.palm-tap-hint.is-visible .palm-tap-hint__hand {
  animation: palm-hand-tap 1.65s ease-in-out var(--tap-delay, 0s) infinite;
}

@keyframes palm-hand-tap {
  0% {
    transform: translate3d(18px, 18px, 0) rotate(-14deg) scale(1);
  }
  32% {
    transform: translate3d(0, 0, 0) rotate(-6deg) scale(1);
  }
  44% {
    transform: translate3d(0, 2px, 0) rotate(-2deg) scale(0.86);
  }
  58% {
    transform: translate3d(4px, 4px, 0) rotate(-8deg) scale(1);
  }
  100% {
    transform: translate3d(18px, 18px, 0) rotate(-14deg) scale(1);
  }
}

@keyframes palm-tap-ring {
  0%, 36% {
    opacity: 0;
    transform: scale(0.3);
  }
  44% {
    opacity: 0.95;
    transform: scale(0.55);
  }
  88% {
    opacity: 0;
    transform: scale(1.9);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@media (max-width: 639px) {
  .palm-tap-hint__hand {
    width: 38px;
    height: 38px;
    left: -15px;
    top: -3px;
  }
  .palm-tap-hint__ring {
    left: -18px;
    top: -18px;
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .palm-tap-hint.is-visible .palm-tap-hint__hand,
  .palm-tap-hint.is-visible .palm-tap-hint__ring {
    animation: none;
  }
}
