/* =========================================================
   Home — "Our background": the vessel on a nautical chart.
   The ship sails inside a clipped stage, so it can never
   overlap the tiles above or the sections below.
   ========================================================= */
.background { position: relative; z-index: 1; align-items: stretch; }

.ship-stage {
    --stage-h: 1020px; /* room for the original +/-200px travel */
    --ship-h: 600px;
    position: relative; isolation: isolate; overflow: hidden; margin: 0;
    height: var(--stage-h); border-radius: 24px;
    background:
        radial-gradient(ellipse at 50% 0, rgba(255, 255, 255, .9), transparent 60%),
        linear-gradient(180deg, #f4f7fc 0%, #e6edf8 100%);
    border: 1px solid #dfe6f2;
    box-shadow: 0 2px 4px rgba(15, 27, 61, .05), 0 24px 60px rgba(15, 27, 61, .12);
}

/* chart grid + compass rose (drifts slower than the ship = depth) */
.ship-chart { position: absolute; inset: -12% 0; width: 100%; height: 124%; z-index: -2; will-change: transform; }
.ship-chart .grid { stroke: #0f1b3d; stroke-opacity: .07; stroke-width: 1; fill: none; }
.ship-chart .grid-major { stroke-opacity: .12; }
.ship-chart .rose { transform-origin: 82% 14%; transform-box: view-box; animation: rose-spin 120s linear infinite; }
.ship-chart .rose * { fill: none; stroke: #12125f; stroke-opacity: .3; stroke-width: 1; }
.ship-chart .rose .n { fill: var(--red); stroke: none; fill-opacity: .8; }
.ship-chart .rose text { fill: #12125f; fill-opacity: .45; stroke: none; font: 700 11px var(--font-ui); text-anchor: middle; }

/* water: faint ripples drifting sideways */
.ship-water { position: absolute; inset: 0; z-index: -1; opacity: .9; pointer-events: none;
    background:
        repeating-linear-gradient(172deg, transparent 0 46px, rgba(42, 116, 184, .07) 46px 48px),
        repeating-linear-gradient(8deg, transparent 0 70px, rgba(42, 116, 184, .05) 70px 72px);
    background-size: 220px 100%, 340px 100%;
    animation: ripple 26s linear infinite;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
    mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
}

/* the vessel */
.ship-track { position: absolute; left: 50%; top: 50%; height: var(--ship-h); aspect-ratio: 291 / 844; translate: -50% -50%; will-change: transform; }
/* multiply drops the PNG's white hull fill, so the ship sits on the chart instead of a white box */
.ship-img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply;
    animation: ship-bob 7s ease-in-out infinite; transform-origin: 50% 60%; }
/* soft contact shadow on the water */
.ship-track::before { content: ""; position: absolute; left: 50%; top: 52%; width: 92%; height: 84%; translate: -42% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgba(18, 18, 95, .22), transparent); filter: blur(14px); }

/* wake: V-shaped trail behind the stern (the bow points down, so the wake trails upward) */
.ship-wake { position: absolute; left: 50%; bottom: 95%; width: 360%; height: 62%; translate: -50% 0; scale: 1 -1; pointer-events: none;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 92%); mask-image: linear-gradient(180deg, #000 0%, transparent 92%); }
.ship-wake path { fill: none; stroke: #2a74b8; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 3 11; vector-effect: non-scaling-stroke; animation: wake-flow 1.8s linear infinite; }
.ship-wake path:nth-child(2n) { stroke-opacity: .55; animation-duration: 2.4s; }
.ship-wake .core { stroke-dasharray: none; stroke-opacity: .25; stroke-width: 10; stroke-linecap: butt; animation: none; filter: blur(6px); }

.ship-stage figcaption { position: absolute; left: 22px; bottom: 18px; right: 22px; display: flex; justify-content: space-between; gap: 12px; font: 600 10.5px/1.3 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: #5b6784; }
.ship-stage figcaption span:first-child::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(226, 0, 26, .5); animation: fix-pulse 2.4s ease-out infinite; }

@keyframes ship-bob { 0%, 100% { transform: translateY(0) rotate(-.9deg); } 50% { transform: translateY(-6px) rotate(.9deg); } }
@keyframes wake-flow { to { stroke-dashoffset: 28; } }
@keyframes ripple { to { background-position: 220px 0, -340px 0; } }
@keyframes rose-spin { to { transform: rotate(360deg); } }
@keyframes fix-pulse { 0% { box-shadow: 0 0 0 0 rgba(226, 0, 26, .45); } 100% { box-shadow: 0 0 0 12px rgba(226, 0, 26, 0); } }

@media (max-width: 980px) {
    .ship-stage { --stage-h: 640px; --ship-h: 380px; max-width: 420px; width: 100%; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .ship-img, .ship-water, .ship-wake path, .ship-chart .rose, .ship-stage figcaption span:first-child::before { animation: none; }
}

.background-text { align-self: center; }
