/* Import NanumSquare Font - ONLY font allowed */
@import url('https://cdn.rawgit.com/moonspam/NanumSquare/master/nanumsquare.css');

/* Apply NanumSquare Font to ALL elements (except icons) */
*:not(.fa-solid):not(.fa-regular):not(.fa-brands):not(.fas):not(.far):not(.fab):not([class*="fa-"]),
*::before,
*::after {
    font-family: 'NanumSquare' !important;
}

/* Restore Font Awesome icons */
.fa-solid,
.fa-regular,
.fa-brands,
.fas,
.far,
.fab,
[class*="fa-"]::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

html,
body,
button,
input,
textarea,
select,
h1,
h2,
h3,
h4,
h5,
h6,
span,
div,
a,
p,
li,
ul,
ol,
label,
table,
th,
td,
nav,
header,
footer,
section,
article,
aside,
main {
    font-family: 'NanumSquare' !important;
}

body {
    color: #333333;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    cursor: default;
    background-color: #fff;
}

.font-eng {
    font-family: 'NanumSquare' !important;
}

/* Hero Image Sketch Effect - Stronger Lines */
.sketch-filter {
    /* High contrast grayscale to simulate ink on paper */
    filter: grayscale(100%) contrast(150%) brightness(105%);
    mix-blend-mode: multiply;
    background-color: #F5F5F5;
}

/* Sketch Drawing Animation - Pencil Line Effect */
.sketch-draw-container {
    position: relative;
}

.sketch-draw-container svg.sketch-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Stroke animation for SVG paths */
.sketch-line {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    fill: none;
    stroke: #F5F5F5;
    stroke-width: 800;
}

.sketch-line.animate {
    animation: drawSketchLine 3s ease-out forwards;
}

@keyframes drawSketchLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Fallback CSS animation for image reveal */
.sketch-draw-img {
    opacity: 0;
}

.sketch-draw-img.drawing {
    animation: sketchDraw 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes sketchDraw {
    0% {
        opacity: 0;
        clip-path: polygon(0% 0%, 0% 0%, 0% 0%,
                0% 100%, 0% 100%, 0% 100%);
    }

    15% {
        opacity: 1;
        clip-path: polygon(0% 0%, 25% 0%, 20% 50%,
                0% 100%, 0% 100%, 0% 50%);
    }

    30% {
        clip-path: polygon(0% 0%, 45% 0%, 50% 30%,
                40% 100%, 0% 100%, 0% 50%);
    }

    50% {
        clip-path: polygon(0% 0%, 65% 0%, 70% 60%,
                60% 100%, 0% 100%, 0% 50%);
    }

    70% {
        clip-path: polygon(0% 0%, 85% 0%, 90% 40%,
                80% 100%, 0% 100%, 0% 50%);
    }

    100% {
        opacity: 1;
        clip-path: polygon(0% 0%, 100% 0%, 100% 0%,
                100% 100%, 0% 100%, 0% 100%);
    }
}

/* Alternative: Brush stroke reveal effect */
.sketch-brush-reveal {
    -webkit-mask-image: linear-gradient(-75deg,
            black 0%, black 30%,
            transparent 40%, transparent 100%);
    mask-image: linear-gradient(-75deg,
            black 0%, black 30%,
            transparent 40%, transparent 100%);
    -webkit-mask-size: 400% 100%;
    mask-size: 400% 100%;
    -webkit-mask-position: 150% 0;
    mask-position: 150% 0;
}

.sketch-brush-reveal.animate {
    animation: brushReveal 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes brushReveal {
    to {
        -webkit-mask-position: 0% 0;
        mask-position: 0% 0;
    }
}

/* List Item Hover Animation */
.list-row {
    transition: background-color 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.list-row:hover {
    background-color: #F5F5F5;
}

/* Hide scrollbar for clean look */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* --- Advanced Animation Classes --- */

/* Text Masking */
.text-mask-wrapper {
    overflow: visible;
    display: block;
    line-height: 1.2;
}

.text-mask-inner {
    display: block;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.2s ease;
}

/* Image Reveal Container */
.reveal-img-container {
    overflow: hidden;
    clip-path: inset(0 0 100% 0);
}

.reveal-img-inner {
    transform: scale(1.3);
}

/* Marquee images should be visible immediately */
.marquee-track .reveal-img-container {
    clip-path: inset(0 0 0% 0);
}

.marquee-track .reveal-img-inner {
    transform: scale(1);
}

/* Line Drawing */
.line-draw {
    width: 0%;
}

.line-draw-vertical {
    height: 0%;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

/* Smooth fade utils */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
}

/* Page Transition Overlay */
#page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9000;
    pointer-events: none;
    opacity: 0;
}

/* Search & Menu Overlays */
#search-overlay,
#menu-overlay {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.98);
}

/* Search Overlay Scroll Fix */
#search-overlay {
    height: 100vh;
    height: 100dvh;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
}

#search-overlay::-webkit-scrollbar {
    width: 8px;
}

#search-overlay::-webkit-scrollbar-track {
    background: transparent;
}

#search-overlay::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#search-overlay::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Detail Page Specifics */
.detail-label {
    color: #333333;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.detail-value {
    font-size: 0.85rem;
    color: #666666;
    font-weight: 500;
    text-transform: uppercase;
}

/* Marquee Slider Styles */
.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.marquee-wrapper::before,
.marquee-wrapper::after {
    display: none;
}

.marquee-track {
    display: flex;
    gap: 2rem;
    width: max-content;
    will-change: transform;
}

.winner-card {
    flex: 0 0 380px;
    width: 380px;
    transition: transform 0.4s ease;
}

.winner-card:hover {
    transform: translateY(-10px);
}

@media (max-width: 768px) {

    /* iOS/Android safe area padding */
    body {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
    }

    /* 메인 컨테이너 모바일 패딩 */
    main.max-w-\[1200px\] {
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-bottom: 40px !important;
    }

    /* 헤더 모바일 */
    header.max-w-\[1200px\] {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 푸터 모바일 패딩 */
    .max-w-\[1200px\].mx-auto.px-6 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 상단 Winner 슬라이드 - 터치 스와이프 가능하게 */
    .marquee-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .marquee-wrapper::-webkit-scrollbar {
        display: none;
    }

    .marquee-track {
        display: flex;
        gap: 1rem;
        width: max-content;
    }

    .winner-card {
        flex: 0 0 280px;
        width: 280px;
    }

    .winner-card .rounded-[20px] {
        height: 376px;
    }

    .marquee-wrapper::before,
    .marquee-wrapper::after {
        display: none;
    }

    /* Archive 필터 모바일 2열 그리드 */
    #archive-filters {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    /* 하단 Archive 아코디언 카드 (모바일) */
    .accordion-content .archive-acc-card>div:first-child {
        background-color: inherit !important;
    }

    /* 뉴스 제목 한 줄로 표시 (모바일) */
    .news-list-item h1 br {
        display: none;
    }

    /* 메인 Archive 카드 글자 크기 (모바일) */
    #archive-grid .archive-card .text-lg {
        font-size: 14px !important;
    }

    #archive-grid .archive-card .text-base {
        font-size: 12px !important;
    }

    #archive-grid .archive-card .text-xs {
        font-size: 10px !important;
    }

    /* 메인 Archive 카드 이미지 하단 정렬 (모바일) */
    .archive-card img {
        object-position: bottom !important;
        -o-object-position: bottom !important;
    }

    /* Archive 카드 이미지 컨테이너 - iOS/Android 통일 (모바일) */
    .archive-card>div:first-child {
        padding-top: 0 !important;
        display: -webkit-flex !important;
        display: flex !important;
        -webkit-align-items: flex-end !important;
        align-items: flex-end !important;
        -webkit-justify-content: center !important;
        justify-content: center !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
    }

    /* Archive 카드 전체 배경 흰색 (모바일) */
    .archive-card {
        background-color: #ffffff !important;
        background: #ffffff !important;
    }

    /* Archive 카드 내부 이미지 래퍼 (모바일) */
    .archive-card .rounded-t-\[20px\],
    .archive-card [class*="rounded-t-"] {
        background-color: transparent !important;
        background: transparent !important;
    }

    /* 뉴스 카드 이미지 높이 통일 (모바일) */
    #news-grid .news-card .rounded-\[12px\] {
        height: 200px !important;
    }

    /* 뉴스 카드 간격 (모바일) */
    #news-grid {
        gap: 24px !important;
    }

    /* Info 섹션 br 태그 처리 (모바일) */
    .info-section p br {
        display: none;
    }

    /* Hero 이미지 섹션 배경색 - iOS/Android 통일 (모바일) */
    .hero-sketch-wrapper,
    section.bg-\[\#F5F5F5\] {
        background-color: #F5F5F5 !important;
        background: #F5F5F5 !important;
        -webkit-background-color: #F5F5F5 !important;
    }

    /* ===== 커뮤니티 페이지 모바일 ===== */

    /* 커뮤니티 탭 스크롤바 숨김 */
    .community-tab {
        flex-shrink: 0;
    }

    /* 게시물 카드 내 텍스트 줄바꿈 */
    .post-card .break-words {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* 게시물 카드 이미지 - 모바일 높이 제한 */
    .post-card img[alt="Post image"] {
        max-height: 250px !important;
    }

    /* 게시물 작성 textarea 모바일 최적화 */
    #post-content {
        font-size: 14px !important;
        min-height: 70px;
    }

    /* 커뮤니티 사이드바 모바일 - 가로 스크롤 방지 */
    #online-members .flex {
        overflow: hidden;
    }
}

/* Accordion Styles */
.accordion-item {
    border-top: 1px solid #e5e5e5;
}

.accordion-item:first-child {
    border-top: 2px solid #333333;
}

.accordion-item:last-child {
    border-bottom: 1px solid #e5e5e5;
}

.accordion-header {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.accordion-header:hover {
    background-color: #F5F5F5;
}

.accordion-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active .accordion-content {
    max-height: 3000px;
}

/* Community Styles */
.community-tab.active {
    border-color: #333333 !important;
    color: #333333 !important;
}

.post-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#chat-sidebar {
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

#community-view {
    min-height: calc(100vh - 100px);
}

/* Archive card in accordion - ensure everything shows */
.accordion-content .archive-card {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.accordion-content .archive-card img {
    opacity: 1 !important;
    visibility: visible !important;
}

.accordion-content .archive-card>div {
    opacity: 1 !important;
    visibility: visible !important;
    clip-path: none !important;
}

.accordion-content .archive-card .rounded-[20px] {
    opacity: 1 !important;
    visibility: visible !important;
}

.accordion-content .archive-card .rounded-t-[20px] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Archive card text sizes - 2pt larger */
.archive-card .text-xs {
    font-size: 14px !important;
}

.archive-card .text-lg {
    font-size: 20px !important;
}

.archive-card .text-base {
    font-size: 18px !important;
}

/* Chip animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease-out forwards;
}

