/* Reset & Basic Setup */
:root {
    --bg-main: #FCF0E8;
    --bg-card: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(0, 0, 0, 0.1);
    --text-main: #2b2b2b;
    --text-muted: rgba(0, 0, 0, 0.6);
    --primary: #CA3C66;
    --primary-hover: #b3355b;
    --secondary: #2A5A9E;
    --secondary-alt: #2F8255;
    --accent: #EE683E;
    --accent-alt: #F7B32B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 60px 5% 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, rgba(202, 60, 102, 0.15) 0%, rgba(238, 104, 62, 0.05) 40%, transparent 70%);
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
}

@media (min-width: 768px) {
    .hero-content {
        max-width: 1200px;
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.hero-title .highlight {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 4rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.hero-buttons {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Filter Navigation */
.filter-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(252, 240, 232, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 0;
    margin-bottom: 40px;
}

.category-filter {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0 20px;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.category-filter::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.desktop-inline {
    display: inline;
}
.mobile-only {
    display: none;
}

@media (min-width: 768px) {
    .category-filter {
        justify-content: center;
        flex-wrap: wrap;
        overflow-x: visible;
    }
    
    .hero-toc {
        display: none !important;
    }
}

.hero-toc {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.toc-btn {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toc-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(0.98);
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .filter-btn:hover {
        color: var(--text-main);
        border-color: rgba(0, 0, 0, 0.3);
    }
}

.filter-btn:active {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(0.96);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Teams Container */
.teams-container {
    padding-bottom: 100px;
}

.category-section {
    margin-bottom: 60px;
    animation: fadeIn 0.5s ease;
}

.category-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
}

.category-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.category-desc {
    font-size: 1rem;
    color: var(--text-muted);
}

.category-video-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 56px auto;
    aspect-ratio: 16/9;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.category-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-videos-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 30px auto 0;
    max-width: 500px;
    width: 100%;
}

.hero-videos-container .category-video-wrapper {
    margin: 0;
    max-width: none;
}

@media (min-width: 768px) {
    .hero-videos-container {
        flex-direction: row;
        max-width: 1200px;
        gap: 24px;
    }
    .hero-videos-container .category-video-wrapper {
        flex: 1;
    }
}

/* Grid Layout */
.team-grid {
    display: grid;
    /* Use 320px minimum to ensure a maximum of 3 columns within 1200px max-width */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.team-grid-header-wrapper {
    grid-column: 1 / -1;
    margin-top: 40px;
    margin-bottom: 12px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    border-left: 5px solid var(--primary);
}

.team-grid-header-wrapper:first-child {
    margin-top: 0;
}

.team-grid-header {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.team-grid-header-desc {
    font-size: 1.05rem;
    color: var(--text-main);
    line-height: 1.5;
    opacity: 0.9;
}

/* Card Styling */
.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

@media (hover: hover) {
    .team-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
        border-color: rgba(202, 60, 102, 0.5);
    }
}

/* Image & Carousel */
.card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-img-wrapper img,
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
}

.carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: background 0.3s ease;
}

@media (hover: hover) {
    .carousel-btn:hover {
        background: var(--primary);
    }
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease;
    cursor: pointer;
}

.indicator.active {
    background: var(--primary);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-grow: 1;
}

.card-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.btn {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: var(--primary-hover);
        box-shadow: 0 0 15px rgba(202, 60, 102, 0.4);
    }
}

.btn-primary:active {
    background: var(--primary-hover);
    transform: scale(0.96);
}

.btn-accent {
    background: var(--secondary);
    color: white;
}

@media (hover: hover) {
    .btn-accent:hover {
        background: #1c457d;
        box-shadow: 0 0 15px rgba(42, 90, 158, 0.4);
    }
}

.btn-accent:active {
    background: #1c457d;
    transform: scale(0.96);
}

/* Color Themes */
.theme-yellow .team-grid-header { color: #C69A1C !important; }
.team-grid-header-wrapper.theme-yellow { 
    border-left-color: #C69A1C !important; 
    background: rgba(198, 154, 28, 0.08) !important;
}
.theme-yellow.btn-accent { background: #C69A1C !important; }
@media (hover: hover) {
    .theme-yellow.btn-accent:hover {
        background: #a37f17 !important;
        box-shadow: 0 0 15px rgba(198, 154, 28, 0.4) !important;
    }
}
.theme-yellow.btn-accent:active {
    background: #a37f17 !important;
    transform: scale(0.96) !important;
}
.theme-yellow.team-card:hover { border-color: rgba(198, 154, 28, 0.5) !important; }

.theme-blue .team-grid-header { color: #2A5A9E !important; }
.team-grid-header-wrapper.theme-blue { 
    border-left-color: #2A5A9E !important; 
    background: rgba(42, 90, 158, 0.08) !important;
}
.theme-blue.btn-accent { background: #2A5A9E !important; }
@media (hover: hover) {
    .theme-blue.btn-accent:hover {
        background: #1c457d !important;
        box-shadow: 0 0 15px rgba(42, 90, 158, 0.4) !important;
    }
}
.theme-blue.btn-accent:active {
    background: #1c457d !important;
    transform: scale(0.96) !important;
}
.theme-blue.team-card:hover { border-color: rgba(42, 90, 158, 0.5) !important; }

.theme-green .team-grid-header { color: #407A52 !important; }
.team-grid-header-wrapper.theme-green { 
    border-left-color: #407A52 !important; 
    background: rgba(64, 122, 82, 0.08) !important;
}
.theme-green.btn-accent { background: #407A52 !important; }
@media (hover: hover) {
    .theme-green.btn-accent:hover {
        background: #2f5a3b !important;
        box-shadow: 0 0 15px rgba(64, 122, 82, 0.4) !important;
    }
}
.theme-green.btn-accent:active {
    background: #2f5a3b !important;
    transform: scale(0.96) !important;
}
.theme-green.team-card:hover { border-color: rgba(64, 122, 82, 0.5) !important; }

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--text-main);
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.3);
    }
}

.btn-secondary:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.96);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-glass);
}



/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translate(-50%, 0);
    }

    40% {
        transform: translate(-50%, -15px);
    }

    60% {
        transform: translate(-50%, -7px);
    }
}

.scroll-nudge {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
    cursor: pointer;
    animation: bounce 2s infinite;
    z-index: 10;
    opacity: 0.9;
}

.scroll-nudge:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 40px 5% 100px;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-title .highlight {
        font-size: 2.8rem;
    }

    .desktop-inline {
        display: none;
    }
    
    .mobile-only {
        display: inline;
    }

    .team-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        max-width: 340px;
        margin: 30px auto 0;
    }
    
    .hero-buttons .btn {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Image Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    width: 600px;
    max-height: calc(100vh - 40px); /* Fallback */
    max-height: calc(100dvh - 40px);
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.modal-body-scroll {
    overflow-y: auto;
    flex: 1;
    border-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    /* Hide scrollbar for clean look */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.modal-body-scroll::-webkit-scrollbar {
    display: none;
}

.modal-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #1a1a1a;
    overflow: hidden;
}

.modal-content img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: transparent;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.modal-content img.fade-out {
    opacity: 0;
    transform: scale(0.98);
}

.modal-details {
    padding: 24px;
    background: white;
    color: var(--text-main);
    text-align: left;
}

.detail-row {
    margin-bottom: 20px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    display: block;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.detail-value {
    display: block;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1020;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 15px;
    cursor: pointer;
    z-index: 1010;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

@media (max-width: 768px) {
    .modal-nav {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    .modal-nav.prev {
        left: 10px;
    }

    .modal-nav.next {
        right: 10px;
    }
}

.modal-footer {
    padding: 15px 24px;
    background: white;
    border-top: 1px solid var(--border-glass);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .modal-content {
        max-height: 85vh; /* To leave room for the bottom bar on mobile if dvh is unsupported */
        max-height: 85dvh;
    }
    .modal-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

/* Scroll to top button */
.scroll-top-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-top-btn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (hover: hover) {
    .scroll-top-btn:hover {
        background: var(--primary-hover);
        transform: translateY(-3px);
    }
}

.scroll-top-btn:active {
    transform: translateY(0);
}