/* 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;
}

/* ===== 성공담 상세페이지 통일 스타일 (왼쪽정렬) ===== */
#story-content {
    text-align: left !important;
}

/* 이미지 통일: 100% 너비, 왼쪽정렬, 동일 크기 */
#story-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 24px 0 !important;
    border-radius: 8px;
    object-fit: cover;
}

/* 제목 (h2, h3) 통일 */
#story-content h2,
#story-content h3 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #333333 !important;
    margin-top: 36px !important;
    margin-bottom: 14px !important;
    text-align: left !important;
    line-height: 1.4;
}

/* 큰 제목 (h1) */
#story-content h1 {
    font-size: 1.7rem !important;
    font-weight: 800 !important;
    color: #333333 !important;
    margin-top: 24px !important;
    margin-bottom: 18px !important;
    text-align: left !important;
    line-height: 1.3;
}

/* 본문 텍스트 통일 */
#story-content p {
    font-size: 1rem !important;
    line-height: 1.9 !important;
    color: #555555 !important;
    margin-bottom: 18px !important;
    text-align: left !important;
    word-break: keep-all;
}

/* 강조 텍스트 */
#story-content strong,
#story-content b {
    color: #333333 !important;
    font-weight: 700;
}

/* span 내 폰트 크기 통일 (외부 콘텐츠의 인라인 스타일 오버라이드) */
#story-content span {
    font-size: inherit !important;
}

/* 리스트 통일 */
#story-content ul,
#story-content ol {
    text-align: left !important;
    margin: 16px 0 !important;
    padding-left: 24px;
}

#story-content li {
    font-size: 1rem !important;
    line-height: 1.8 !important;
    color: #555555 !important;
    margin-bottom: 6px;
}

/* 링크 스타일 */
#story-content a {
    color: #2563eb;
    text-decoration: underline;
}

/* 동영상 iframe 통일 */
#story-content iframe {
    display: block !important;
    margin: 24px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px;
    aspect-ratio: 16/9;
}

#story-content video {
    display: block !important;
    margin: 24px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px;
}

/* 구분선 */
#story-content hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 32px 0;
}

/* 이미지 캡션 */
#story-content figcaption,
#story-content .caption {
    font-size: 0.85rem !important;
    color: #999999 !important;
    margin-top: -16px;
    margin-bottom: 24px;
    text-align: left !important;
}

/* 외부 콘텐츠 초기화 */
#story-content div {
    max-width: 100%;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    #story-content h1 { font-size: 1.3rem !important; }
    #story-content h2,
    #story-content h3 { font-size: 1.15rem !important; }
    #story-content p { font-size: 0.95rem !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);
}

/* Story cards: 즉시 표시 (reveal 애니메이션 없이 바로 보이게) */
.story-card .reveal-img-container {
    clip-path: inset(0 0 0% 0);
}

.story-card .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;
}

/* Detail 페이지 콘텐츠 텍스트 통일 - API 인라인 스타일 오버라이드 */
#detail-content span,
#detail-content li span {
    font-size: inherit !important;
    font-family: 'NanumSquare' !important;
    color: inherit !important;
    line-height: inherit !important;
}

#detail-awards li span,
#detail-other-awards li span,
#detail-education li span,
#detail-education-sidebar-list li span,
#detail-experience li span {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    color: #555555 !important;
}

#detail-quote {
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* 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: hidden;
    }

    .marquee-track {
        display: flex;
        gap: 12px;
        width: max-content;
    }

    .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 .home-news-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid #eee;
    }
    #news-grid .home-news-thumb {
        width: 80px !important;
        height: 80px !important;
        min-width: 80px !important;
        border-radius: 10px !important;
        overflow: hidden !important;
        flex-shrink: 0;
    }
    #news-grid .home-news-thumb img {
        width: 80px !important;
        height: 80px !important;
        object-fit: cover !important;
    }
    #news-grid .home-news-text {
        flex: 1 !important;
        min-width: 0;
    }
    #news-grid .home-news-person { font-size: 11px; color: #6b7280; margin-bottom: 2px; }
    #news-grid .home-news-title { font-size: 13px !important; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    #news-grid .home-news-date { font-size: 11px; color: #9ca3af; margin-top: 3px; }
    #news-grid .home-news-badge { display: none !important; }
    #news-grid .home-news-play-pc { display: none !important; }
    #news-grid {
        gap: 0 !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;
    }

    /* ===== Footer 모바일 최적화 ===== */
    .footer-section {
        padding-top: 20px !important;
        padding-bottom: 24px !important;
    }
    .footer-section > div:first-child {
        grid-template-columns: 1fr 1fr !important;
        gap: 16px !important;
        margin-bottom: 20px !important;
    }
    .footer-section > div:first-child > div:first-child img {
        height: 45px !important;
    }
    .footer-section > div:first-child > div:last-child {
        border-left: none !important;
        padding-left: 0 !important;
        gap: 6px !important;
    }
    .footer-section > div:first-child > div:last-child h4 {
        font-size: 13px !important;
        margin-bottom: 0 !important;
    }
    .footer-section > div:first-child > div:last-child a {
        font-size: 10px !important;
    }
    .footer-section > div:first-child > div:last-child a:last-child {
        font-size: 11px !important;
        padding: 6px 14px !important;
        margin-top: 4px !important;
    }
    .footer-section > div:last-child {
        flex-direction: column !important;
        gap: 10px !important;
        padding-top: 12px !important;
    }
    .footer-section > div:last-child > div:first-child span {
        font-size: 9px !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: 1px solid #e5e5e5;
}

.accordion-item:last-child {
    border-bottom: none;
}

.archive-accordion {
    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;
}

/* Archive 아코디언 카드 - 모바일/PC 비율 */
.acc-card-outer {
    border-radius: 16px !important;
    height: 220px !important;
    overflow: hidden !important;
}
.acc-card-inner {
    border-radius: 12px 12px 0 0 !important;
    width: 85% !important;
    height: 180px !important;
    overflow: hidden !important;
}
.acc-card-inner img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top !important;
}
@media (min-width: 768px) {
    .acc-card-outer {
        border-radius: 20px !important;
        height: 460px !important;
    }
    .acc-card-inner {
        border-radius: 20px 20px 0 0 !important;
        width: 80% !important;
        height: 380px !important;
    }
}

