/* The harbor stays part of the walk while its own close ship remains visible. */
.ghost-harbor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "intro"
    "sea"
    "controls"
    "log";
  row-gap: 0;
  padding: clamp(68px, 9vh, 112px) clamp(20px, 5vw, 72px) 0;
  background: transparent;
}

.ghost-harbor > header {
  grid-area: intro;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0;
  text-align: center;
}

.ghost-harbor > header h2 {
  max-width: 12ch;
  margin: 22px auto 24px;
  font-size: clamp(42px, 7vw, 62px);
  line-height: 1.02;
}

.ghost-harbor > header > p:last-child {
  max-width: 38rem;
  margin: 0 auto;
  color: #c0d0c2;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.75;
  text-wrap: pretty;
}

.ghost-harbor .ship-sea {
  grid-area: sea;
  display: block;
  position: relative;
  width: 100%;
  height: clamp(250px, 72vw, 330px);
  margin: 16px auto 0;
  overflow: hidden;
  background-color: transparent;
  background-image: none;
}

/* Keep one hull anchored to its chapter. The world continues behind it,
   without camera projection or frustum culling moving the ship off-screen. */
html.pj-on .ghost-harbor .ship-sea {
  display: block;
  visibility: visible;
  pointer-events: none;
}

.ghost-harbor .ship {
  left: 50%;
  bottom: 28px;
  width: min(100%, 420px);
  height: auto;
  aspect-ratio: 8 / 5;
  transform: translateX(-50%);
  transition: left 5.5s steps(80, end);
}

.ghost-harbor .ship.ship-departing { left: calc(100% + 300px); }
.still-frames .ghost-harbor .ship { transition: none; }
.outside-world[data-ambient="off"] .ghost-harbor .ship { transition: none; }

.ghost-harbor .ship svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ghost-harbor .sea {
  height: 72px;
  background: none;
  opacity: 0;
}

.ghost-harbor .crew-controls {
  grid-area: controls;
  width: min(100%, 960px);
  max-width: 960px;
  margin: 12px auto 0;
  padding: 0;
  box-sizing: border-box;
}

.ghost-harbor .crew-stepper {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2.5vw, 32px);
  margin-bottom: 12px;
}

.ghost-harbor .crew-step-btn {
  min-width: 0;
  min-height: 54px;
  padding: 10px 4px 12px;
  border: 0;
  border-bottom: 1px solid rgba(184, 194, 186, .36);
  background: rgba(20, 36, 28, .16);
  color: #c9d5ca;
  box-shadow: none;
}

.ghost-harbor .crew-step-btn:hover,
.ghost-harbor .crew-step-btn.active {
  border-bottom-color: #e8982a;
  background: rgba(36, 59, 43, .28);
  box-shadow: none;
}

.ghost-harbor .crew-step-btn.active .step-num {
  color: #e8982a;
}

.ghost-harbor .crew-step-btn:focus-visible,
.ghost-harbor .crew-range:focus-visible,
.ghost-harbor #pass-log:focus-visible {
  outline: 2px solid #e8982a;
  outline-offset: 4px;
}

.ghost-harbor .crew-slider-bar {
  margin: 8px 0 16px;
}

.ghost-harbor .crew-range {
  display: block;
  min-height: 40px;
}

.ghost-harbor .ship-log {
  grid-area: log;
  width: min(100%, 960px);
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 0 clamp(58px, 8vw, 88px);
  box-sizing: border-box;
}

.ghost-harbor .ship-log h3 {
  max-width: 22ch;
  margin: 18px 0;
  font-size: clamp(25px, 3.2vw, 34px);
  line-height: 1.2;
}

.ghost-harbor #crew-entry {
  max-width: 47rem;
  min-height: 0;
  margin: 0;
  color: #d4dfd3;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.5;
  text-wrap: pretty;
}

.ghost-harbor #pass-log {
  min-height: 44px;
  margin: 16px 0 20px;
  padding: 10px 0;
  color: #f1d29a;
  border-bottom-color: rgba(232, 152, 42, .62);
  cursor: pointer;
}

.ghost-harbor #pass-log:hover {
  color: #f2eee4;
  border-bottom-color: #e8982a;
}

.ghost-harbor .ship-explanation {
  max-width: 48rem;
  margin: 0;
  color: #b7c7b8;
  font-size: 13px;
  line-height: 1.8;
  text-wrap: pretty;
}

@media (min-width: 880px) {
  .ghost-harbor {
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    grid-template-areas:
      "intro sea"
      "controls controls"
      "log log";
    column-gap: clamp(30px, 5vw, 76px);
    align-items: center;
    padding: clamp(76px, 9vh, 112px) clamp(28px, 6vw, 96px) 0;
  }

  .ghost-harbor > header {
    max-width: 36rem;
    margin: 0;
    text-align: left;
  }

  .ghost-harbor > header h2 {
    margin: 22px 0 24px;
    font-size: clamp(46px, 4.5vw, 66px);
  }

  .ghost-harbor > header > p:last-child {
    margin: 0;
  }

  .ghost-harbor .ship-sea {
    height: clamp(310px, 33vw, 440px);
    margin: 0;
  }

  .ghost-harbor .ship {
    bottom: 34px;
    width: min(100%, 560px);
  }

  .ghost-harbor .sea {
    height: 82px;
  }

  .ghost-harbor .crew-controls {
    margin-top: 8px;
  }

  .ghost-harbor .ship-log {
    padding-top: 16px;
  }
}

@media (max-width: 700px) {
  .ghost-harbor {
    padding-top: 40px;
    padding-right: 22px;
    padding-left: 22px;
  }

  .ghost-harbor > header h2 {
    max-width: none;
    margin: 18px auto;
    font-size: clamp(36px, 9.4vw, 42px);
  }

  .ghost-harbor > header > p:last-child {
    font-size: 14px;
    line-height: 1.6;
  }

  .ghost-harbor .ship-sea {
    height: 164px;
    margin-top: 12px;
  }

  .ghost-harbor .ship {
    width: min(100%, 240px);
    bottom: 6px;
  }

  .ghost-harbor .crew-controls,
  .ghost-harbor .ship-log {
    width: 100%;
  }

  .ghost-harbor .crew-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .ghost-harbor .crew-step-btn {
    min-height: 64px;
    padding: 8px 6px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
  }

  .ghost-harbor .crew-step-btn .step-name {
    font-size: 11px;
    line-height: 1.25;
    letter-spacing: 0;
  }

  .ghost-harbor .crew-slider-bar {
    margin: 4px 0 8px;
  }

  .ghost-harbor .crew-range {
    min-height: 44px;
  }

  .ghost-harbor #crew-entry {
    font-size: clamp(21px, 6vw, 26px);
  }

  .ghost-harbor .ship-log {
    padding-bottom: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ghost-harbor .ship,
  .ghost-harbor .sea {
    animation: none;
    transition: none;
  }

  .ghost-harbor .ship svg {
    transition: none;
  }
}
