:root {
    color-scheme: dark;
    --ink: #050812;
    --ink-soft: #0a1020;
    --white: #f8f9fc;
    --muted: #b6bece;
    --orange: #ff5b27;
    --orange-bright: #ff7a18;
    --blue: #1357e8;
    --blue-bright: #1b83ff;
    --border: rgba(255, 255, 255, 0.16);
    --glass: rgba(13, 19, 35, 0.72);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --pointer-x: 50%;
    --pointer-y: 38%;
    --scene-x: 0px;
    --scene-y: 0px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--ink);
}

body {
    isolation: isolate;
    min-width: 320px;
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    background: var(--ink);
    color: var(--white);
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.is-leaving .gateway {
    opacity: 0;
    transform: scale(.985);
}

.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient::before,
.ambient::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.ambient::before {
    inset: -12px;
    background: #050812 center / cover no-repeat;
    background-image: image-set(
        url("assets/gateway-background-desktop.webp") type("image/webp"),
        url("assets/gateway-background-desktop.png") type("image/png")
    );
    filter: saturate(1.04) contrast(1.03);
    transform: translate3d(var(--scene-x), var(--scene-y), 0) scale(1.018);
    transition: transform 900ms var(--ease-out);
    will-change: transform;
}

.ambient::after {
    inset: 0;
    background:
        radial-gradient(circle at var(--pointer-x) var(--pointer-y), rgba(255, 255, 255, .075), transparent 25rem),
        linear-gradient(rgba(255, 255, 255, .014) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .014) 1px, transparent 1px),
        linear-gradient(180deg, rgba(2, 4, 10, .02), rgba(2, 4, 10, .16));
    background-size: auto, 72px 72px, 72px 72px, auto;
    mask-image: linear-gradient(to bottom, black, black 78%, rgba(0, 0, 0, .86));
}

.gateway {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto minmax(420px, 1fr) auto;
    gap: clamp(14px, 2vh, 22px);
    width: min(100%, 1440px);
    min-height: 100svh;
    margin-inline: auto;
    padding: clamp(22px, 3.5vh, 38px) clamp(20px, 4vw, 64px) clamp(18px, 2.6vh, 28px);
    transition: opacity 240ms ease, transform 240ms ease;
}

.brand {
    display: flex;
    justify-content: center;
    min-height: 54px;
}

.brand img {
    width: clamp(160px, 15vw, 220px);
    height: auto;
    object-fit: contain;
}

.intro {
    text-align: center;
}

.intro h1 {
    max-width: 1120px;
    margin: 0 auto;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(3rem, 5.8vw, 5.35rem);
    font-weight: 700;
    letter-spacing: -.052em;
    line-height: .92;
    text-wrap: balance;
}

.intro p {
    margin: clamp(12px, 1.8vh, 18px) 0 0;
    color: var(--muted);
    font-size: clamp(.98rem, 1.35vw, 1.22rem);
    line-height: 1.6;
}

.portals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(18px, 2.4vw, 34px);
    width: min(100%, 1230px);
    min-height: 0;
    margin-inline: auto;
    perspective: 1400px;
}

.portal {
    --accent: var(--orange);
    --accent-bright: var(--orange-bright);
    --rot-x: 0deg;
    --rot-y: 0deg;
    --image-x: 0px;
    --image-y: 0px;
    --spot-x: 50%;
    --spot-y: 35%;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: minmax(180px, 1fr) auto;
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: clamp(26px, 2.4vw, 38px);
    background:
        radial-gradient(circle at var(--spot-x) var(--spot-y), color-mix(in srgb, var(--accent) 13%, transparent), transparent 36%),
        linear-gradient(145deg, rgba(255,255,255,.1), rgba(255,255,255,.025) 42%, rgba(255,255,255,.07)),
        var(--glass);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, .38),
        inset 0 1px 0 rgba(255,255,255,.18),
        inset 0 -1px 0 color-mix(in srgb, var(--accent) 38%, transparent);
    color: var(--white);
    text-decoration: none;
    transform: rotateX(var(--rot-x)) rotateY(var(--rot-y));
    transform-style: preserve-3d;
    transition:
        transform 460ms var(--ease-out),
        border-color 280ms ease,
        box-shadow 340ms ease;
    will-change: transform;
}

.portal--supplier {
    --accent: var(--blue);
    --accent-bright: var(--blue-bright);
}

.portal:hover {
    border-color: color-mix(in srgb, var(--accent) 68%, white 16%);
    box-shadow:
        0 38px 80px rgba(0, 0, 0, .48),
        0 18px 55px color-mix(in srgb, var(--accent) 21%, transparent),
        inset 0 1px 0 rgba(255,255,255,.26),
        inset 0 -1px 0 color-mix(in srgb, var(--accent) 65%, transparent);
}

.portal:focus-visible {
    outline: 3px solid var(--white);
    outline-offset: 5px;
}

.portal__edge {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(115deg, color-mix(in srgb, var(--accent) 46%, transparent), transparent 22%, transparent 72%, color-mix(in srgb, var(--accent) 32%, transparent));
    opacity: .55;
    pointer-events: none;
}

.portal__light {
    position: absolute;
    top: -18%;
    left: var(--spot-x);
    width: 36%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    filter: blur(54px);
    opacity: .5;
    transform: translateX(-50%);
    pointer-events: none;
}

.portal__brand {
    position: absolute;
    top: clamp(18px, 2vw, 26px);
    left: clamp(18px, 2vw, 28px);
    z-index: 3;
    display: flex;
    min-height: 44px;
    align-items: center;
    transform: translateZ(38px);
}

.portal__brand--customer img {
    width: clamp(108px, 10vw, 142px);
    height: auto;
}

.portal__brand--supplier {
    gap: 9px;
    font-size: clamp(1rem, 1.4vw, 1.28rem);
    font-weight: 700;
    letter-spacing: -.045em;
}

.portal__brand--supplier svg {
    width: 29px;
    height: 29px;
    fill: none;
    stroke: var(--blue-bright);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.portal__visual {
    position: relative;
    z-index: 2;
    display: grid;
    min-height: 0;
    place-items: center;
    padding: 26px 26px 0;
    pointer-events: none;
    transform: translateZ(70px);
}

.portal__visual img {
    display: block;
    width: min(85%, 430px);
    max-height: 350px;
    object-fit: contain;
    filter: drop-shadow(0 28px 26px rgba(0, 0, 0, .5));
    transform: translate3d(var(--image-x), var(--image-y), 0);
    transition: transform 520ms var(--ease-out), filter 300ms ease;
    animation: float-object 5.4s ease-in-out infinite;
}

.portal--supplier .portal__visual img {
    width: min(88%, 450px);
    animation-delay: -2.5s;
}

.portal:hover .portal__visual img {
    filter: drop-shadow(0 36px 32px color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, .62)));
}

.portal__content {
    position: relative;
    z-index: 4;
    display: grid;
    gap: clamp(16px, 2vh, 22px);
    padding: 0 clamp(24px, 3vw, 38px) clamp(24px, 3vw, 36px);
    transform: translateZ(52px);
}

.portal__copy {
    display: grid;
    gap: 8px;
}

.portal__title {
    font-size: clamp(1.75rem, 2.45vw, 2.45rem);
    font-weight: 700;
    letter-spacing: -.045em;
    line-height: 1.08;
}

.portal__description {
    max-width: 31rem;
    color: var(--muted);
    font-size: clamp(.88rem, 1.1vw, 1rem);
    line-height: 1.65;
}

.portal__action {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 65%, white 12%);
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent-bright), var(--accent));
    box-shadow:
        0 14px 32px color-mix(in srgb, var(--accent) 26%, transparent),
        inset 0 1px 0 rgba(255,255,255,.32);
    padding: 0 22px;
    font-size: clamp(.9rem, 1.15vw, 1.02rem);
    font-weight: 700;
    letter-spacing: -.025em;
}

.portal__action svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
    transition: transform 300ms var(--ease-out);
}

.portal:hover .portal__action svg,
.portal:focus-visible .portal__action svg {
    transform: translateX(6px);
}

.footer {
    color: rgba(248, 249, 252, .62);
    text-align: center;
}

.footer p {
    margin: 0;
    font-size: clamp(.78rem, 1vw, .92rem);
    letter-spacing: .01em;
}

[data-reveal] {
    opacity: 0;
}

body.is-ready [data-reveal="brand"] {
    animation: reveal-up 800ms 40ms var(--ease-out) forwards;
}

body.is-ready [data-reveal="intro"] {
    animation: reveal-up 900ms 120ms var(--ease-out) forwards;
}

body.is-ready [data-reveal="portal"]:first-child {
    animation: reveal-left 980ms 240ms var(--ease-out) forwards;
}

body.is-ready [data-reveal="portal"]:last-child {
    animation: reveal-right 980ms 320ms var(--ease-out) forwards;
}

body.is-ready [data-reveal="footer"] {
    animation: reveal-up 760ms 480ms var(--ease-out) forwards;
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes reveal-left {
    from { opacity: 0; transform: translate3d(-34px, 36px, 0) rotateY(7deg); }
    to { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0); }
}

@keyframes reveal-right {
    from { opacity: 0; transform: translate3d(34px, 36px, 0) rotateY(-7deg); }
    to { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0); }
}

@keyframes float-object {
    0%, 100% { translate: 0 0; rotate: -1deg; }
    50% { translate: 0 -10px; rotate: 1deg; }
}

@media (max-width: 820px) {
    body {
        overflow-y: auto;
    }

    .ambient::before {
        background-image: image-set(
            url("assets/gateway-background-mobile.webp") type("image/webp"),
            url("assets/gateway-background-mobile.png") type("image/png")
        );
        background-position: center top;
    }

    .ambient::after {
        background:
            radial-gradient(circle at 50% 18%, rgba(255, 255, 255, .06), transparent 21rem),
            linear-gradient(180deg, rgba(2, 4, 10, .04), rgba(2, 4, 10, .22));
    }

    .gateway {
        display: block;
        padding: 22px 16px 28px;
    }

    .brand img {
        width: 158px;
    }

    .intro {
        margin: 26px auto 30px;
    }

    .intro h1 {
        font-size: clamp(2.75rem, 12vw, 4.5rem);
        line-height: .96;
    }

    .intro p {
        max-width: 26rem;
        margin-inline: auto;
    }

    .portals {
        grid-template-columns: 1fr;
        max-width: 580px;
    }

    .portal {
        min-height: 470px;
        transform: none !important;
    }

    .portal__visual img {
        max-height: 255px;
    }

    .footer {
        margin-top: 28px;
    }
}

@media (max-width: 480px) {
    .gateway {
        padding-inline: 12px;
    }

    .brand {
        min-height: 46px;
    }

    .brand img {
        width: 142px;
    }

    .intro {
        margin-top: 22px;
    }

    .intro h1 {
        font-size: clamp(2.45rem, 12vw, 3.2rem);
    }

    .portal {
        min-height: 438px;
        border-radius: 26px;
    }

    .portal__brand {
        top: 16px;
        left: 18px;
    }

    .portal__visual {
        padding-top: 48px;
    }

    .portal__visual img {
        width: min(80%, 300px);
        max-height: 230px;
    }

    .portal__content {
        gap: 14px;
        padding: 0 18px 20px;
    }

    .portal__title {
        font-size: 1.62rem;
    }

    .portal__action {
        min-height: 54px;
        border-radius: 16px;
        padding-inline: 18px;
    }
}

@media (max-height: 760px) and (min-width: 821px) {
    .gateway {
        grid-template-rows: auto auto minmax(360px, 1fr) auto;
        padding-block: 18px 14px;
    }

    .brand img {
        width: 150px;
    }

    .intro h1 {
        font-size: clamp(3rem, 5vw, 4rem);
    }

    .intro p {
        margin-top: 8px;
    }

    .portal {
        min-height: 360px;
    }

    .portal__visual img {
        max-height: 210px;
    }

    .portal__content {
        gap: 12px;
        padding-bottom: 22px;
    }

    .portal__description {
        line-height: 1.45;
    }

    .portal__action {
        min-height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    [data-reveal] {
        opacity: 1;
    }

    .portal,
    .portal__visual img,
    .ambient::before {
        transform: none !important;
    }
}
