/* ================================================================
   [Works 페이지 스타일 - portfolio.css]
   포트폴리오 그리드 카드 레이아웃
   ================================================================ */

#project-web-section {
    justify-content: flex-start;
}

#project-web-section .sub-header { padding-bottom: 0; margin-bottom: 28px; }

body.single-page #page-project-web .fade-in-up:not(.animate):not(.visible) {
    opacity: 0 !important;
    transform: translateY(50px) !important;
}

body.single-page #page-project-web .fade-in-up.animate,
body.single-page #page-project-web .works-card.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

body.single-page #page-project-web .works-card.visible:hover {
    transform: translateY(-6px) !important;
}
.works-filter-wrapper { width: 100%; position: relative; z-index: 2; display: flex; justify-content: center; padding: 0 20px; margin-top: 0; margin-bottom: 42px; }
.works-filter { display: inline-flex; position: relative; background: transparent; border: 2px solid #ff6e2e; border-radius: 50px; padding: 4px; gap: 0; }
.works-filter-indicator { position: absolute; top: 4px; left: 4px; height: calc(100% - 8px); width: 0; background: #ff6e2e; border-radius: 50px; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 0; pointer-events: none; }
.works-filter-btn { position: relative; z-index: 1; padding: 10px 22px; background: transparent; border: none; border-radius: 50px; color: rgba(255, 255, 255, 0.55); font-size: 15px; font-weight: 600; cursor: pointer; transition: color 0.3s ease; white-space: nowrap; }
.works-filter-btn:hover, .works-filter-btn.active { color: #fff; }

body.light-mode .works-filter { border-color: #ff6e2e; }
body.light-mode .works-filter-btn { color: rgba(11, 11, 11, 0.55); }
body.light-mode .works-filter-btn:hover, body.light-mode .works-filter-btn.active { color: #0b0b0b; }

.works-grid-wrapper { width: 100%; position: relative; z-index: 2; padding-top: 8px; box-sizing: border-box; }
.works-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 64px 48px; width: 100%; max-width: 100%; margin: 0 auto; padding: 0 17vw; padding-bottom: 0; box-sizing: border-box; }
.works-load-more-wrapper { grid-column: 1 / -1; display: flex; justify-content: center; margin-top: 4px; }
.works-load-more-wrapper[hidden] { display: none !important; }
.works-load-more-btn {
    min-width: 150px;
    height: 48px;
    padding: 0 28px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    cursor: pointer;
    transition: background-color 0.32s ease, color 0.32s ease, border-color 0.32s ease;
}
.works-load-more-btn:hover,
.works-load-more-btn:focus-visible {
    background: #fff;
    color: #0b0b0b;
    border-color: #fff;
    outline: none;
}

.works-card {
    display: block; background: transparent !important; border: none !important; color: #fff !important; text-decoration: none !important;
    opacity: 0; transform: translateY(60px); 
    contain: layout paint style;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.works-card.visible {
    opacity: 1; transform: translateY(0);
    transition: opacity 1.4s cubic-bezier(0.19, 1, 0.22, 1), transform 1.4s cubic-bezier(0.19, 1, 0.22, 1), filter 0.8s ease;
}

#page-project-web .works-card.visible {
    transition: opacity 1.15s cubic-bezier(0.19, 1, 0.22, 1), transform 1.15s cubic-bezier(0.19, 1, 0.22, 1), filter 0.8s ease !important;
}

.works-card:hover { transform: translateY(-6px); box-shadow: none !important; }
.works-card.visible:hover { transform: translateY(-6px); }

.works-card-thumb { width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: #0b0b0b; border-radius: 16px; position: relative; contain: paint; }
.works-badge-group { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.works-badge { display: inline-flex; align-items: center; justify-content: center; padding: 7px 15px; background: #ff6e2e !important; color: #fff !important; font-size: 13px; font-weight: 600; line-height: 1.2; border-radius: 50px; }
.works-badge-working { background: #fcfcfc !important; color: #ff6e2e !important; }
.works-card:hover .works-card-thumb { box-shadow: 0 0 20px rgba(255, 110, 46, 0.2); }
.works-card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; backface-visibility: hidden; }
.works-card-thumb img.works-thumb-zoom-sm { transform: scale(1.18); }
.works-card:hover .works-card-thumb img { transform: scale(1.08); }
.works-card:hover .works-card-thumb img.works-thumb-zoom-sm { transform: scale(1.275); }

.works-card-info { padding: 18px 4px 0; }
.works-card-info h3 { font-size: 26px; font-weight: 700; margin: 0; color: #fff !important; }

body.light-mode .works-card { background: transparent !important; box-shadow: none !important; }
body.light-mode .works-card-thumb { background: #f0f0f0; }
body.light-mode .works-card-info h3 { color: #1a1a1a !important; }
body.light-mode .works-badge { color: #fff !important; }
body.light-mode .works-badge-working { background: #fcfcfc !important; color: #ff6e2e !important; }
body.light-mode .works-load-more-btn {
    border-color: rgba(11, 11, 11, 0.72);
    color: #0b0b0b;
}
body.light-mode .works-load-more-btn:hover,
body.light-mode .works-load-more-btn:focus-visible {
    background: #0b0b0b;
    color: #fff;
    border-color: #0b0b0b;
}

@supports (content-visibility: auto) {
    .works-card {
        content-visibility: auto;
        contain-intrinsic-size: 360px 300px;
    }
}

@media (max-width: 1024px) {
    .works-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 24px;
        padding-bottom: 0;
        gap: 30px 28px;
    }
}

@media (min-width: 769px) {
    #project-web-section {
        padding-top: 140px !important;
    }
}

/* ================================================================
   [수정] 모바일 반응형 배열 및 여백 교정 (PC 버전 영향 없음)
   ================================================================ */
@media (max-width: 768px) {
    #page-project-web {
        --works-mobile-edge: 20px;
    }

    /* 1. Works 텍스트 위치: 이전(75px)보다 더 줄여서(60px) 헤더 바로 밑까지 최대한 끌어올림 */
    #project-web-section {
        padding-top: 60px !important; 
    }

    /* 타이틀과 필터 버튼 사이의 여백 (버튼 크기 유지) */
    #project-web-section .sub-header {
        padding-bottom: 0 !important;
        margin-bottom: 20px !important; 
    }
    #project-web-section .sub-header h1,
    #project-web-section .sub-header h2 {
        margin-bottom: 0 !important; 
    }

    .works-filter-wrapper {
        margin-top: 0 !important;
        margin-bottom: 42px !important; 
        padding: 0 var(--works-mobile-edge) !important; 
    }
    .works-grid-wrapper {
        padding-top: 6px;
    }

    /* 2. 아웃라인(빨간 테두리) 형태 유지하며 비례 확대 (이전과 동일) */
    .works-filter {
        padding: 4px !important;
        display: inline-flex !important; 
        justify-content: center !important;
        width: min(100%, calc(100vw - (var(--works-mobile-edge) * 2))) !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 3. 버튼 크기 및 텍스트를 동일한 비율로 동시 확대 (이전과 동일) */
    .works-filter-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 1 0 !important;
        min-width: 0 !important;
        min-height: 38px !important;
        padding: 0 clamp(3px, 1.3vw, 8px) !important; 
        font-size: clamp(10px, 2.65vw, 13px) !important; 
        text-align: center !important;
        letter-spacing: 0 !important; 
        line-height: 1.15 !important;
        word-break: keep-all !important;
        white-space: nowrap !important;
    }

    /* 그리드 및 카드 설정 */
    .works-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px; 
        width: min(100%, calc(100vw - (var(--works-mobile-edge) * 2)));
        padding: 0;
        padding-bottom: 0;
    }
    .works-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    .works-card-thumb {
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
    }
    .works-card-thumb img {
        object-fit: contain;
        background: #0b0b0b;
    }
    .works-card-thumb img,
    .works-card-thumb img.works-thumb-zoom-sm,
    .works-card:hover .works-card-thumb img,
    .works-card:hover .works-card-thumb img.works-thumb-zoom-sm {
        transform: none !important;
    }
    .works-card-info {
        padding: 12px 4px 0;
    }
    .works-card-info h3 {
        font-size: 18px;
    }
    .works-load-more-wrapper {
        margin-top: 6px;
    }
    .works-load-more-btn {
        min-width: 132px;
        height: 44px;
        padding: 0 22px;
        font-size: 14px;
    }
}

@media (max-width: 420px) {
    #page-project-web {
        --works-mobile-edge: 20px;
    }
    .works-filter-wrapper {
        padding: 0 var(--works-mobile-edge) !important;
    }
    .works-filter {
        width: calc(100vw - (var(--works-mobile-edge) * 2)) !important;
        border-width: 2px !important;
    }
    .works-filter-btn {
        padding: 0 2px !important;
        font-size: 10px !important;
    }
    .works-grid {
        width: calc(100vw - (var(--works-mobile-edge) * 2));
        padding: 0;
        gap: 22px;
    }
    .works-badge-group {
        top: 10px;
        left: 10px;
        right: 10px;
        gap: 5px;
    }
    .works-badge {
        padding: 6px 11px;
        font-size: 12px;
    }
}

/* Preview portfolio: independent pills matching the expertise navigation. */
html body #page-project-web .works-filter {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 10px;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    width: auto !important;
    max-width: 100% !important;
}
html body #page-project-web .works-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px !important;
    max-width: none !important;
    height: auto !important;
    padding: 11px 25px !important;
    border: 0 !important;
    border-radius: 999px;
    background: #1f1f1f !important;
    color: #fcfcfc !important;
    -webkit-text-fill-color: currentColor !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    white-space: nowrap;
    letter-spacing: normal !important;
    cursor: pointer;
    box-shadow: none !important;
    transition: background-color .32s ease, color .32s ease !important;
}
html body.light-mode #page-project-web .works-filter-btn { background: #f5f5f5 !important; color: #0b0b0b !important; }
html body #page-project-web .works-filter-btn:hover:not(.active) { background: #292929 !important; }
html body.light-mode #page-project-web .works-filter-btn:hover:not(.active) { background: #ebebeb !important; }
html body #page-project-web .works-filter-btn.active { background: #ff6e2e !important; color: #fff !important; }
html body #page-project-web .works-filter-btn:focus-visible { outline: 2px solid #ff6e2e; outline-offset: 4px; }
html body #page-project-web .works-card { filter: none !important; }

/* A stationary full-width shade keeps the floating cue legible over thumbnails. */
html body:has(#page-project-web.active) #scroll-hint-overlay {
    display: flex !important;
    z-index: 120;
    color: #fcfcfc !important;
    -webkit-text-fill-color: currentColor !important;
}
html body.light-mode:has(#page-project-web.active) #scroll-hint-overlay { color: #0b0b0b !important; }
html body:has(#page-project-web.active)::after {
    content: '';
    position: fixed;
    inset: auto 0 0;
    height: calc(170px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to bottom, transparent, #0b0b0b 76%);
    pointer-events: none;
    z-index: 119;
    opacity: 0;
    transition: opacity .25s ease;
}
html body.light-mode:has(#page-project-web.active)::after { background: linear-gradient(to bottom, rgba(252,252,252,0), #fcfcfc 76%); }
html body:has(#page-project-web.active):has(#scroll-hint-overlay.visible)::after { opacity: 1; }
@media (max-width: 600px) {
    html body #page-project-web .works-filter { gap: 8px; }
    html body #page-project-web .works-filter-btn { padding: 10px 16px !important; font-size: 14px !important; }
}
html body #page-project-web .works-filter-row { display: contents; }
@media (max-width: 768px) {
    html body #page-project-web .works-filter { flex-direction: column; }
    html body #page-project-web .works-filter-row {
        display: flex;
        justify-content: center;
        gap: 10px;
    }
}
@media (max-width: 600px) {
    html body #page-project-web .works-filter-row { gap: 8px; }
}

/* Keep only the image zoom on portfolio thumbnail hover. */
html body #page-project-web .works-card:is(:hover, :focus-within),
html body #page-project-web .works-card:is(:hover, :focus-within) .works-card-thumb {
    box-shadow: none !important;
    filter: none !important;
}
html body #page-project-web .works-card.visible:hover { transform: none !important; }
html body #page-project-web .works-load-more-btn { font-size: 17px; border-radius: 8px; }

/* Wider previews, gently rounded edges, image-only hover treatment. */
html body #page-project-web .works-card-thumb { border-radius: 22px; aspect-ratio: 16 / 10; }
html body #page-project-web .works-card-thumb img { object-fit: cover; transition: transform .6s ease; }
@media (min-width: 1025px) {
    html body #page-project-web .works-grid {
        padding-inline: calc(var(--site-edge-inset) + 3.5vw);
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 34px;
    }
}
@media (max-width: 768px) {
    html body #page-project-web .works-grid { width: calc(100% - 56px); }
}

/* Mobile portfolio list: softer rectangles and a more readable project title. */
@media (max-width: 768px) {
    html body #page-project-web .works-filter-btn {
        border-radius: 999px;
        min-height: 38px !important;
        padding: 9px 21px !important;
    }
    html body #page-project-web .works-load-more-btn { border-radius: 6px; }
    html body #page-project-web .works-card-thumb { border-radius: 12px; }
    html body #page-project-web .works-card-info h3 { font-size: 20px; }
}

/* Keep the image as a fallback while a visible WebM loads its first frame. */
html body #page-project-web .works-card-thumb .works-thumbnail-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0;
    transition: transform .6s ease, opacity .2s ease;
}
html body #page-project-web .works-card-thumb .works-thumbnail-video.is-ready { opacity: 1; }
html body #page-project-web .works-card:hover .works-thumbnail-video { transform: scale(1.08); }
html body #page-project-web .works-card-thumb .works-thumbnail-video.works-thumb-zoom-sm { transform: scale(1.18); }
html body #page-project-web .works-card:hover .works-thumbnail-video.works-thumb-zoom-sm { transform: scale(1.275); }
@media (max-width: 768px) {
    html body #page-project-web .works-card .works-card-thumb .works-thumbnail-video { transform: none; }
}

/* Compact pagination with centered labels and orange interaction states. */
html body #page-project-web .works-pagination {
    --pagination-ink: #fcfcfc;
    --pagination-border: rgba(252, 252, 252, .24);
    --pagination-hover-bg: rgba(255, 110, 46, .18);
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 0;
}
html body.light-mode #page-project-web .works-pagination {
    --pagination-ink: #0b0b0b;
    --pagination-border: rgba(11, 11, 11, .2);
    --pagination-hover-bg: rgba(255, 110, 46, .1);
}
html body #page-project-web .works-pagination .works-load-more-btn {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    text-indent: 0;
    letter-spacing: 0;
    font-variant-numeric: lining-nums tabular-nums;
    color: var(--pagination-ink);
    -webkit-text-fill-color: currentColor;
    border-color: var(--pagination-border);
    background: transparent;
    transition: background-color .25s ease, color .25s ease;
    box-sizing: border-box;
}
html body #page-project-web .works-pagination .works-load-more-btn:is(:hover, :focus-visible):not(:disabled) {
    background: var(--pagination-hover-bg);
    color: var(--pagination-ink);
    border-color: var(--pagination-border);
}
html body #page-project-web .works-pagination .works-load-more-btn[aria-current="page"]:not(:disabled) {
    background: #ff6e2e;
    color: #fff;
    border-color: #ff6e2e;
}
html body #page-project-web .works-pagination .works-page-numbers { display: flex; gap: inherit; }
html body #page-project-web .works-pagination-status {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
html body #page-project-web .works-pagination .works-load-more-btn:disabled {
    opacity: .3;
    cursor: default;
    background: transparent;
    color: var(--pagination-ink);
    border-color: var(--pagination-border);
}
html body #page-project-web .works-pagination :focus-visible {
    outline: 2px solid #ff6e2e;
    outline-offset: 4px;
}
@media (max-width: 768px) {
    html body #page-project-web .works-pagination .works-load-more-btn {
        min-width: 36px;
        height: 36px;
        padding-inline: 9px;
    }
}

@media (max-width: 600px) {
    html body #page-project-web .works-filter-btn { padding: 8px 13px !important; }
}

/* The shared footer spacer handles fixed-footer clearance; avoid reserving it twice. */
html body #page-project-web #project-web-section { padding-bottom: 88px !important; }
@media (max-width: 768px) {
    html body #page-project-web #project-web-section { padding-bottom: 64px !important; }
}

/* Always-visible project labels inside the image; only the image scales on hover. */
html body #page-project-web .works-grid {--works-card-gap:34px;gap:var(--works-card-gap)}
html body #page-project-web .works-card-thumb::after {
 content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
 background:linear-gradient(to bottom,rgba(0,0,0,0) 28%,rgba(0,0,0,.02) 40%,rgba(0,0,0,.10) 53%,rgba(0,0,0,.25) 66%,rgba(0,0,0,.46) 79%,rgba(0,0,0,.65) 90%,rgba(0,0,0,.80) 100%);
}
html body #page-project-web .works-card-info {
 position:absolute;left:20px;right:20px;bottom:20px;z-index:2;padding:0;text-align:left;
}
html body #page-project-web .works-badge-group {
 position:static;display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;
 gap:7px;margin:0 0 10px;
}
html body #page-project-web .works-badge {
 background:transparent!important;border:1px solid rgba(255,255,255,.9);color:#fff!important;
 -webkit-text-fill-color:#fff!important;font-size:13px;font-weight:400;line-height:1.2;padding:6px 11px;border-radius:5px;
}
html body #page-project-web .works-card-info h3 {
 color:#fff!important;-webkit-text-fill-color:#fff!important;
 font-size:clamp(22px,1.6vw,28px);font-weight:600;line-height:1.35;margin:0;word-break:keep-all;overflow-wrap:anywhere;
}
@media(max-width:1024px) {
 html body #page-project-web .works-grid {--works-card-gap:24px;padding-inline:52px}
}
@media(max-width:768px) {
 html body #page-project-web .works-grid {--works-card-gap:20px;padding-inline:0}
 html body #page-project-web .works-card-info {left:18px;right:18px;bottom:18px}
 html body #page-project-web .works-card-info h3 {font-size:22px}
}
@media(max-width:420px) {
 html body #page-project-web .works-grid {--works-card-gap:18px}
 html body #page-project-web .works-card-info {left:16px;right:16px;bottom:16px}
 html body #page-project-web .works-badge-group {gap:6px;margin-bottom:8px}
}

/* A single card-width reference keeps the image and labels in proportion at every breakpoint. */
html body #page-project-web .works-card { container-type: inline-size; }
html body #page-project-web .works-card-thumb { border-radius: 2.4cqw; }
html body #page-project-web .works-card-info {
    left: 5.3cqw;
    right: 5.3cqw;
    bottom: 5.3cqw;
}
html body #page-project-web .works-card-info h3 { font-size: 4.4cqw; }
html body #page-project-web .works-badge-group {
    gap: 2.2cqw;
    margin-bottom: 1.9cqw;
}
html body #page-project-web .works-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-indent: 0;
    line-height: 1.2;
    font-size: 2.25cqw;
    padding: 1cqw 1.9cqw;
    border-width: calc(.25cqw * 2 / 3);
    border-radius: calc(1.25cqw * 2 / 3);
}

/* Match the single-column mobile list with slightly larger project labels. */
@media (max-width: 768px) {
    html body #page-project-web .works-card-info h3 { font-size: 5.5cqw; }
    html body #page-project-web .works-badge {
        font-size: 2.85cqw;
        padding: 1.25cqw 2.4cqw;
    }
}
