/* ==========================================================================
   히어로 : 각 화면 맨 위의 이미지 배너
   이미지 위에 화면 제목(흰색 큰 글씨)과 소개 문구를 가운데 배치한다.

   마크업 한 번(.afcs-hero)으로 4개 화면이 모두 같은 모양이 되며,
   화면마다 달라지는 값(이미지 초점, 어둡기)은 맨 아래 변수 블록에서만 조절한다.
   좌우 화살표와 하단 막대는 pager.js 가 자동으로 만들어 넣는다.
   ========================================================================== */
.afcs-hero {
    position: relative;
    min-height: var(--afcs-hero-min-height);
    overflow: hidden;
    overflow: clip;
    isolation: isolate;
    container-type: inline-size;
    background-color: #1b1f24;
    color: var(--afcs-on-image);
    text-align: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    /* 세로 스크롤은 브라우저에 맡기고, 가로 스와이프만 pager.js 가 처리한다 */
    touch-action: pan-y;
}

.afcs-hero.is-dragging {
    cursor: grabbing;
}

/* 화면 전환 및 드래그 시 함께 움직이는 영역 : 배경 사진 + 어두운 막 + 이미지 속 글자 */
.afcs-hero__stage {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: var(--afcs-hero-min-height);
    overflow: hidden;
    overflow: clip;
    isolation: isolate;
    background-color: #1b1f24;
    transform: translateX(var(--afcs-drag, 0px));
    transition: transform 0.25s var(--afcs-ease);
}

.afcs-hero.is-dragging .afcs-hero__stage,
.afcs-hero.is-dragging .afcs-hero__stage--peek {
    transition: none;
    will-change: transform;
}

.afcs-hero__stage--leaving,
.afcs-hero__stage--peek {
    position: absolute;
    inset: 0;
    z-index: 1;
    height: 100%;
    min-height: 0;
    pointer-events: none;
}

.afcs-hero__stage--peek-prev {
    transform: translateX(calc(-100% + var(--afcs-drag, 0px)));
}

.afcs-hero__stage--peek-next {
    transform: translateX(calc(100% + var(--afcs-drag, 0px)));
}

.afcs-hero__image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--afcs-hero-focus, 50% 50%);
    pointer-events: none;
    -webkit-user-drag: none;
}

/* 글씨가 어떤 사진 위에서도 읽히도록 이미지 위에 어두운 막을 씌운다 */
.afcs-hero__stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--afcs-hero-overlay, rgb(0 0 0 / 0.45));
}

.afcs-hero__content {
    width: min(100% - 176px, 880px);
    padding: 48px 0 64px;
}

.afcs-hero__title {
    margin: 0 0 22px;
    font-size: clamp(40px, 6.2vw, 76px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--afcs-on-image);
    text-transform: none;
    text-shadow: 0 2px 28px rgb(0 0 0 / 0.35);
}

.afcs-hero__lead {
    max-width: 40em;
    margin: 0 auto;
    font-size: clamp(15px, 1.7vw, 19px);
    line-height: 1.85;
    color: rgb(255 255 255 / 0.94);
    text-shadow: 0 1px 14px rgb(0 0 0 / 0.4);
    word-break: keep-all;
    /* 좁은 화면에서 줄이 넘칠 때 마지막 줄에 한두 글자만 남는 것을 막는다 (미지원 브라우저는 기본 줄바꿈) */
    text-wrap: balance;
}

/* --------------------------------------------------------------------------
   좌우 화살표 (클릭으로 이전/다음 화면 이동)
   -------------------------------------------------------------------------- */
.afcs-hero__arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    padding: 0;
    color: var(--afcs-on-image);
    background: rgb(0 0 0 / 0.18);
    border: 1px solid rgb(255 255 255 / 0.55);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.afcs-hero__arrow:hover,
.afcs-hero__arrow:focus-visible {
    background: rgb(255 255 255 / 0.22);
    border-color: var(--afcs-on-image);
}

.afcs-hero__arrow:focus-visible,
.afcs-hero__dot:focus-visible {
    outline: 2px solid var(--afcs-on-image);
    outline-offset: 3px;
}

.afcs-hero__arrow::before {
    content: "";
    width: 11px;
    height: 11px;
    border: solid currentColor;
    border-width: 2px 2px 0 0;
}

.afcs-hero__arrow--prev {
    left: clamp(12px, 3vw, 40px);
}

.afcs-hero__arrow--prev::before {
    transform: translateX(2px) rotate(-135deg);
}

.afcs-hero__arrow--next {
    right: clamp(12px, 3vw, 40px);
}

.afcs-hero__arrow--next::before {
    transform: translateX(-2px) rotate(45deg);
}

/* --------------------------------------------------------------------------
   하단 점 (현재 화면 표시 + 바로가기)
   -------------------------------------------------------------------------- */
.afcs-hero__dots {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 4;
    display: flex;
    gap: 10px;
    transform: translateX(-50%);
}

.afcs-hero__dot {
    position: relative;
    width: 28px;
    height: 24px;
    padding: 10px 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: width var(--afcs-slide-duration) var(--afcs-ease);
}

.afcs-hero__dot::before {
    content: "";
    display: block;
    width: 100%;
    height: 4px;
    background: rgb(255 255 255 / 0.45);
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.afcs-hero__dot:hover::before {
    background-color: rgb(255 255 255 / 0.75);
}

.afcs-hero__dot[aria-current="true"] {
    width: 44px;
}

.afcs-hero__indicator {
    position: absolute;
    top: 10px;
    left: 0;
    width: 44px;
    height: 4px;
    background-color: var(--afcs-on-image);
    border-radius: 2px;
    pointer-events: none;
    transform: translateX(calc(var(--afcs-active-dot, 0) * 38px));
    transition: transform var(--afcs-slide-duration) var(--afcs-ease);
}

.afcs-hero__dots.is-static .afcs-hero__dot,
.afcs-hero__dots.is-static .afcs-hero__indicator {
    transition: none;
}

@media (max-width: 767px) {
    .afcs-hero__content {
        width: min(100% - 40px, 880px);
        padding: 40px 0 64px;
    }

    /* 모바일은 손가락 스와이프가 기본 조작이므로 화살표는 숨기고 점만 남긴다 */
    .afcs-hero__arrow {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   히어로 전환 애니메이션
   - 배경 사진과 사진 속 글자(.afcs-hero__stage)가 함께 좌우로 넘어간다.
   - 좌우 화살표와 하단 트랙은 고정되고, 하단 흰색 막대(.afcs-hero__indicator)가
     현재 위치로 부드럽게 이동한다.
   -------------------------------------------------------------------------- */
@keyframes afcs-hero-out-left {
    from {
        transform: translateX(var(--afcs-slide-offset, 0px));
    }

    to {
        transform: translateX(-100%);
    }
}

@keyframes afcs-hero-in-right {
    from {
        transform: translateX(calc(100% + var(--afcs-slide-offset, 0px)));
    }

    to {
        transform: translateX(0);
    }
}

@keyframes afcs-hero-out-right {
    from {
        transform: translateX(var(--afcs-slide-offset, 0px));
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes afcs-hero-in-left {
    from {
        transform: translateX(calc(-100% + var(--afcs-slide-offset, 0px)));
    }

    to {
        transform: translateX(0);
    }
}

.afcs-hero__stage.is-entering-forward,
.afcs-hero__stage.is-entering-backward,
.afcs-hero__stage--leaving {
    will-change: transform;
}

.afcs-hero__stage.is-entering-forward {
    z-index: 2;
    transition: none;
    animation: afcs-hero-in-right var(--afcs-slide-duration) var(--afcs-ease) both;
}

.afcs-hero__stage--leaving.is-leaving-forward {
    transition: none;
    animation: afcs-hero-out-left var(--afcs-slide-duration) var(--afcs-ease) both;
}

.afcs-hero__stage.is-entering-backward {
    z-index: 2;
    transition: none;
    animation: afcs-hero-in-left var(--afcs-slide-duration) var(--afcs-ease) both;
}

.afcs-hero__stage--leaving.is-leaving-backward {
    transition: none;
    animation: afcs-hero-out-right var(--afcs-slide-duration) var(--afcs-ease) both;
}

/* --------------------------------------------------------------------------
   화면 경계 블러 (.afcs-hero__seam)
   - 드래그나 슬라이드 전환 중 두 히어로 배너가 맞닿는 경계선을 부드럽게 뭉개서
     잘린 선이 드러나지 않도록 한다.
   - 반드시 .afcs-hero 의 직계 자식으로 배치해야(.afcs-hero__stage 바깥)
     backdrop-filter 가 양쪽 배너 이미지를 모두 샘플링할 수 있다.
   -------------------------------------------------------------------------- */
.afcs-hero__seam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    width: 160px;
    margin-left: -80px;
    pointer-events: none;
    opacity: 0;
    background: transparent;
    -webkit-backdrop-filter: blur(28px) saturate(1.08);
    backdrop-filter: blur(28px) saturate(1.08);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 32%, #000 68%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 32%, #000 68%, transparent 100%);
}

.afcs-hero__seam--prev {
    transform: translateX(var(--afcs-drag, 0px));
}

.afcs-hero__seam--next {
    transform: translateX(calc(100cqw + var(--afcs-drag, 0px)));
}

.afcs-hero.is-dragging.is-drag-prev .afcs-hero__seam--prev,
.afcs-hero.is-dragging.is-drag-next .afcs-hero__seam--next {
    opacity: var(--afcs-drag-seam-opacity, 1);
    transition: none;
    will-change: transform, opacity;
}

.afcs-hero.is-drag-snapping.is-drag-prev .afcs-hero__seam--prev,
.afcs-hero.is-drag-snapping.is-drag-next .afcs-hero__seam--next {
    opacity: 0;
    transition: transform 0.25s var(--afcs-ease), opacity 0.22s ease;
    will-change: transform, opacity;
}

@keyframes afcs-seam-forward {
    0% {
        opacity: var(--afcs-seam-from-opacity, 0);
        transform: translateX(calc(100cqw + var(--afcs-slide-offset, 0px)));
    }

    8% {
        opacity: 1;
    }

    84% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(0);
    }
}

@keyframes afcs-seam-backward {
    0% {
        opacity: var(--afcs-seam-from-opacity, 0);
        transform: translateX(var(--afcs-slide-offset, 0px));
    }

    8% {
        opacity: 1;
    }

    84% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(100cqw);
    }
}

@supports not (width: 100cqw) {
    .afcs-hero__seam--next {
        transform: translateX(calc(100vw + var(--afcs-drag, 0px)));
    }

    @keyframes afcs-seam-forward {
        0% {
            opacity: var(--afcs-seam-from-opacity, 0);
            transform: translateX(calc(100vw + var(--afcs-slide-offset, 0px)));
        }

        8% {
            opacity: 1;
        }

        84% {
            opacity: 1;
        }

        100% {
            opacity: 0;
            transform: translateX(0);
        }
    }

    @keyframes afcs-seam-backward {
        0% {
            opacity: var(--afcs-seam-from-opacity, 0);
            transform: translateX(var(--afcs-slide-offset, 0px));
        }

        8% {
            opacity: 1;
        }

        84% {
            opacity: 1;
        }

        100% {
            opacity: 0;
            transform: translateX(100vw);
        }
    }
}

.afcs-hero__seam--sliding {
    transition: none;
    will-change: transform, opacity;
}

.afcs-hero__seam--sliding.is-sliding-forward {
    animation: afcs-seam-forward var(--afcs-slide-duration) var(--afcs-ease) both;
}

.afcs-hero__seam--sliding.is-sliding-backward {
    animation: afcs-seam-backward var(--afcs-slide-duration) var(--afcs-ease) both;
}

@media (prefers-reduced-motion: reduce) {
    .afcs-hero__stage,
    .afcs-hero__stage--peek,
    .afcs-hero__seam,
    .afcs-hero__dot,
    .afcs-hero__dot::before,
    .afcs-hero__indicator {
        transition: none;
    }

    .afcs-hero__stage.is-entering-forward,
    .afcs-hero__stage.is-entering-backward,
    .afcs-hero__seam--sliding {
        animation: none;
    }

    .afcs-hero__stage--leaving,
    .afcs-hero__seam {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   화면별 히어로 조절값 (이미지 초점 / 어둡기)
   -------------------------------------------------------------------------- */
.afcs-page-view[data-page="about"] {
    --afcs-hero-focus: 50% 38%;
}

.afcs-page-view[data-page="history"] {
    --afcs-hero-focus: 50% 52%;
    --afcs-hero-overlay: rgb(0 0 0 / 0.58);
}

.afcs-page-view[data-page="process"] {
    --afcs-hero-focus: 50% 50%;
    --afcs-hero-overlay: rgb(8 6 24 / 0.52);
}

.afcs-page-view[data-page="contact"] {
    --afcs-hero-focus: 55% 45%;
    --afcs-hero-overlay: rgb(0 0 0 / 0.42);
}
