/* =====================================================================
   Ocean Star Shipping — loaders
   ---------------------------------------------------------------------
   1. Page loader: porthole that fills with water (include/loader.php)
      .is-intro / .is-return / .is-arriving  → first visit / reload / after a link
      .is-done    → tide recedes upwards, then .is-hidden
      .is-enter → .is-leaving  → tide rises from the bottom before navigating
   2. Image skeletons (shimmer while lazy photos load)
   3. Map, hero-video and form "busy" loaders
   ===================================================================== */

.os-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------------
   1. Page loader
   --------------------------------------------------------------------- */
.os-loader {
    --ld-top: #031326;
    --ld-bottom: #0d4073;
    --ld-sea-edge: #1a5281;      /* bottom colour incl. the translucent sea layers */
    --ld-aqua: #22c1dc;
    --ld-aqua-soft: #8fe6f3;
    --ld-brass: #f5a524;
    --ld-ease: cubic-bezier(.76, 0, .24, 1);
    --ld-edge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 70' preserveAspectRatio='none'%3E%3Cpath d='M0 0h1440v34c-120 26-240 26-360 0S840 8 720 34 480 60 360 34 120 8 0 34z'/%3E%3C/svg%3E");
    --ld-sea: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 40Q150 0 300 40T600 40T900 40T1200 40V200H0z'/%3E%3C/svg%3E");

    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(60vmin circle at 78% 52%, rgba(34, 193, 220, .16), transparent 60%),
        radial-gradient(55vmin circle at 16% 58%, rgba(27, 135, 201, .22), transparent 60%),
        linear-gradient(180deg, var(--ld-top) 0%, #072a4e 55%, var(--ld-bottom) 100%);
    transform: translateY(0);
    will-change: transform;
}

.js .os-loader {
    display: flex;
    /* safety net: never block the page, even if the script fails */
    animation: os-ld-failsafe .5s ease 7s forwards;
}

@keyframes os-ld-failsafe {
    to { opacity: 0; visibility: hidden; }
}

/* wavy edges: top one shows while the tide rises, bottom one while it recedes */
.os-loader::before,
.os-loader::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 70px;
    pointer-events: none;
    -webkit-mask: var(--ld-edge) center / 100% 100% no-repeat;
    mask: var(--ld-edge) center / 100% 100% no-repeat;
}

.os-loader::before {
    bottom: calc(100% - 1px);
    background: var(--ld-top);
    transform: scaleY(-1);
}

.os-loader::after {
    top: calc(100% - 1px);
    background: var(--ld-sea-edge);
}

/* --- states --- */
.os-loader.is-done {
    transform: translateY(calc(-100% - 72px));
    transition: transform .85s var(--ld-ease) .1s;
    pointer-events: none;
}

.os-loader.is-hidden { display: none !important; }

.os-loader.is-enter {
    transform: translateY(calc(100% + 72px));
    transition: none;
    animation: none;
}

.os-loader.is-leaving {
    transform: translateY(0);
    transition: transform .45s var(--ld-ease);
    animation: none;
}

/* --- inner layout --- */
.os-loader__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 24px 40px;
    text-align: center;
    transition: opacity .35s ease, transform .5s var(--ld-ease);
}

.os-loader.is-done .os-loader__inner {
    opacity: 0;
    transform: translateY(-28px) scale(.96);
}

.os-loader.is-enter .os-loader__inner { opacity: 0; transform: translateY(40px); }
.os-loader.is-leaving .os-loader__inner { transition-delay: .12s; }

/* --- porthole --- */
.os-loader__porthole {
    position: relative;
    width: 150px;
    height: 150px;
}

.os-loader__ring {
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(34, 193, 220, 0) 0deg, rgba(34, 193, 220, 0) 190deg, var(--ld-aqua) 300deg, var(--ld-brass) 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
    animation: os-ld-spin 1.3s linear infinite;
}

/* rim with compass ticks */
.os-loader__rim {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(143, 230, 243, .28);
    box-shadow: 0 0 46px rgba(34, 193, 220, .28), inset 0 0 18px rgba(0, 0, 0, .4);
}

.os-loader__rim::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: repeating-conic-gradient(from -1deg, rgba(255, 255, 255, .55) 0deg 2deg, transparent 2deg 30deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
    opacity: .7;
}

/* the "star" in Ocean Star */
.os-loader__spark {
    position: absolute;
    top: -16px;
    right: -14px;
    z-index: 3;
    color: var(--ld-brass);
    filter: drop-shadow(0 0 8px rgba(245, 165, 36, .8));
    animation: os-ld-spark 2.4s ease-in-out infinite;
}

.os-loader__glass {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    isolation: isolate;
    background: radial-gradient(circle at 50% 35%, #0b3a69 0%, #051c36 78%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), inset 0 -12px 30px rgba(0, 0, 0, .35);
}

/* glass reflection */
.os-loader__glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .3), transparent 30%);
    pointer-events: none;
}

.os-loader__water {
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: 0;
    z-index: 1;
    height: calc(var(--p, 0) * 1% + 4px);
    background: linear-gradient(180deg, #2bc4de 0%, #1b87c9 45%, #0d4073 100%);
    transition: height .35s ease-out;
}

.os-loader__wave {
    position: absolute;
    left: 0;
    bottom: calc(100% - 1px);
    width: 200%;
    height: 12px;
    fill: #2bc4de;
    animation: os-ld-wave 2.2s linear infinite;
}

.os-loader__wave--back {
    height: 16px;
    opacity: .45;
    animation-duration: 3.6s;
    animation-direction: reverse;
}

.os-loader__logo {
    position: relative;
    z-index: 2;
    width: auto !important;
    height: 76px !important;
    max-width: none !important;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
    animation: os-ld-float 3s ease-in-out infinite;
}

/* --- text --- */
.os-loader__brand {
    margin: 6px 0 0 !important;
    padding-left: .42em;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .42em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .92);
}

.os-loader__status {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin: 0 !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .62);
}

.os-loader__dots::after {
    content: "";
    display: inline-block;
    width: 1.1em;
    text-align: left;
    animation: os-ld-dots 1.4s steps(1, end) infinite;
}

.os-loader__pct {
    min-width: 3.2em;
    margin-left: 6px;
    font-weight: 700;
    text-align: left;
    color: var(--ld-aqua-soft);
    font-variant-numeric: tabular-nums;
}

/* --- night sky + sea --- */
.os-loader__stars,
.os-loader__stars::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    pointer-events: none;
    box-shadow:
        8vw 12vh 0 0 rgba(255, 255, 255, .8), 22vw 6vh 0 0 rgba(255, 255, 255, .5),
        37vw 18vh 0 1px rgba(255, 255, 255, .35), 51vw 9vh 0 0 rgba(255, 255, 255, .7),
        64vw 22vh 0 0 rgba(255, 255, 255, .45), 77vw 7vh 0 1px rgba(143, 230, 243, .6),
        90vw 15vh 0 0 rgba(255, 255, 255, .6), 15vw 28vh 0 0 rgba(255, 255, 255, .35),
        45vw 31vh 0 0 rgba(255, 255, 255, .45), 83vw 33vh 0 0 rgba(255, 255, 255, .4);
    animation: os-ld-twinkle 3.2s ease-in-out infinite alternate;
}

.os-loader__stars::after {
    content: "";
    box-shadow:
        4vw 20vh 0 0 rgba(255, 255, 255, .5), 29vw 11vh 0 0 rgba(143, 230, 243, .7),
        58vw 16vh 0 1px rgba(255, 255, 255, .3), 70vw 4vh 0 0 rgba(255, 255, 255, .6),
        95vw 26vh 0 0 rgba(255, 255, 255, .5), 40vw 4vh 0 0 rgba(255, 255, 255, .55),
        12vw 38vh 0 0 rgba(255, 255, 255, .25), 74vw 40vh 0 0 rgba(255, 255, 255, .3);
    animation-duration: 2.3s;
    animation-delay: -1.2s;
}

.os-loader__sea {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24vh;
    pointer-events: none;
}

.os-loader__sea::before,
.os-loader__sea::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    background: rgba(34, 193, 220, .07);
    -webkit-mask: var(--ld-sea) 0 100% / 1200px 100% repeat-x;
    mask: var(--ld-sea) 0 100% / 1200px 100% repeat-x;
    animation: os-ld-sea 16s linear infinite;
}

.os-loader__sea::after {
    height: 72%;
    background: rgba(255, 255, 255, .05);
    animation-duration: 10s;
    animation-direction: reverse;
}

/* --- entrance of the loader content --- */
.os-loader.is-intro .os-loader__porthole { animation: os-ld-pop .9s var(--ld-ease) both; }
.os-loader.is-intro .os-loader__brand { animation: os-ld-rise .8s .25s var(--ld-ease) both; }
.os-loader.is-intro .os-loader__status { animation: os-ld-rise .8s .4s var(--ld-ease) both; }
.os-loader.is-return .os-loader__porthole { animation: os-ld-pop .5s var(--ld-ease) both; }
.os-loader.is-return .os-loader__brand,
.os-loader.is-return .os-loader__status { animation: os-ld-rise .5s .1s var(--ld-ease) both; }

/* --- keyframes --- */
@keyframes os-ld-spin { to { transform: rotate(360deg); } }
@keyframes os-ld-wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes os-ld-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes os-ld-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes os-ld-sea { to { -webkit-mask-position: -1200px 100%; mask-position: -1200px 100%; } }
@keyframes os-ld-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes os-ld-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@keyframes os-ld-spark {
    0%, 100% { transform: scale(.75) rotate(0deg); opacity: .7; }
    50% { transform: scale(1.1) rotate(45deg); opacity: 1; }
}

@keyframes os-ld-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

@media (max-width: 480px) {
    .os-loader__porthole { width: 124px; height: 124px; }
    .os-loader__logo { height: 62px !important; }
    .os-loader__brand { font-size: 11px; letter-spacing: .34em; padding-left: .34em; }
    .os-loader::before,
    .os-loader::after { height: 44px; }
}

@media print {
    .os-loader { display: none !important; }
}

/* ---------------------------------------------------------------------
   2. Image skeletons — shimmer until the lazy photo has loaded
   --------------------------------------------------------------------- */
.js :is(.card-img, .blog-card-img, .blog-img, .sd-service-image-frame, .about-company-col picture, .what-we-do-cols picture):has(img[loading="lazy"]:not(.is-loaded)) {
    background-color: #e3eef7;
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .75) 50%, rgba(255, 255, 255, 0) 70%);
    background-size: 250% 100%;
    background-repeat: no-repeat;
    animation: os-shimmer 1.4s linear infinite;
}

@keyframes os-shimmer {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

/* ---------------------------------------------------------------------
   3a. Map loader
   --------------------------------------------------------------------- */
.map-container { position: relative; }

/* anchor icon sits still on the container; the ring around it spins */
.js .map-container:not(.is-loaded) {
    background: #e3eef7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d4073' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2.5'/%3E%3Cpath d='M12 7.5V21M5 12H3a9 9 0 0 0 18 0h-2M8 11h8'/%3E%3C/svg%3E") 50% calc(50% - 17px) / 24px no-repeat;
}

.js .map-container::before,
.js .map-container::after {
    position: absolute;
    left: 50%;
    z-index: 2;
    pointer-events: none;
    transition: opacity .5s ease, visibility .5s;
}

.js .map-container::before {
    content: "";
    top: calc(50% - 44px);
    width: 54px;
    height: 54px;
    margin-left: -27px;
    border-radius: 50%;
    border: 3px solid rgba(13, 64, 115, .12);
    border-top-color: #22c1dc;
    border-right-color: #0d4073;
    animation: os-ld-spin 1.1s linear infinite;
}

.js .map-container::after {
    content: "Loading map\2026";
    top: calc(50% + 22px);
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    color: #3f5369;
    white-space: nowrap;
}

.js .map-container.is-loaded::before,
.js .map-container.is-loaded::after {
    opacity: 0;
    visibility: hidden;
    animation: none;
}

/* ---------------------------------------------------------------------
   3b. Hero video buffering ring (on the pause / play button)
   --------------------------------------------------------------------- */
.os-video-toggle::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #22c1dc;
    border-right-color: rgba(34, 193, 220, .4);
    opacity: 0;
    transition: opacity .3s;
}

.is-buffering .os-video-toggle { opacity: 1; }
.is-buffering .os-video-toggle::after { opacity: 1; animation: os-ld-spin .9s linear infinite; }

/* ---------------------------------------------------------------------
   3c. Contact form "sending" overlay + button spinners
   --------------------------------------------------------------------- */
.os-form-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: inherit;
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility .35s;
}

.is-sending > .os-form-loader { opacity: 1; visibility: visible; }

.os-form-loader__ship {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 35%, #0b3a69, #051c36 80%);
    box-shadow: 0 0 0 4px rgba(34, 193, 220, .2), 0 14px 30px -12px rgba(8, 42, 78, .6);
}

.os-form-loader__ship::before {
    content: "";
    position: absolute;
    left: -50%;
    bottom: 0;
    width: 200%;
    height: 45%;
    background: #22c1dc;
    border-radius: 40% 45% 0 0;
    animation: os-form-tide 1.6s ease-in-out infinite alternate, os-ld-wave 2s linear infinite;
    opacity: .9;
}

.os-form-loader__ship svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 30px;
    height: 30px;
    margin: -20px 0 0 -15px;
    color: #fff;
    animation: os-ld-float 1.6s ease-in-out infinite;
}

.os-form-loader__text {
    margin: 0 !important;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #0d4073;
}

@keyframes os-form-tide {
    from { height: 38%; }
    to { height: 52%; }
}


/* ---------------------------------------------------------------------
   Reduced motion: keep the progress + spinners (they carry meaning),
   drop the drifting decoration and swap the tide sweep for a fade.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .os-loader__logo,
    .os-loader__sea::before,
    .os-loader__sea::after,
    .os-loader__spark,
    .os-loader.is-intro .os-loader__porthole,
    .os-loader.is-return .os-loader__porthole { animation: none !important; }

    .os-loader.is-done {
        transform: none;
        opacity: 0;
        transition: opacity .4s ease;
    }

    .os-loader.is-enter { transform: none; opacity: 0; }

    .os-loader.is-leaving {
        transform: none;
        opacity: 1;
        transition: opacity .2s ease;
    }

    .os-loader::before,
    .os-loader::after { display: none; }

    .js :is(.card-img, .blog-card-img, .blog-img, .sd-service-image-frame, .about-company-col picture, .what-we-do-cols picture):has(img[loading="lazy"]:not(.is-loaded)) {
        animation: os-skeleton-pulse 1.6s ease-in-out infinite;
        background-image: none;
    }
}

@keyframes os-skeleton-pulse {
    0%, 100% { background-color: #e3eef7; }
    50% { background-color: #eef4fa; }
}
