/* ============================================
   Index Page — Specific Styles
   ============================================ */

/* ── Feature Stats Section (Dynamic Quantitative Data) ── */
.feature-stats {
    position: relative;
    z-index: 20;
    padding: 0 15px;
    max-width: 700px; /* Narrower width to pull circles closer together */
    margin: 0 auto;
    margin-top: -95px; /* Exactly half of 190px card height */
}

.stat-card {
    width: 190px;
    height: 190px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1.5px solid rgba(107, 11, 34, 0.12); /* Defined wine red border for higher contrast */
    box-shadow: 0 15px 35px rgba(107, 11, 34, 0.05), 0 5px 15px rgba(0, 0, 0, 0.02);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    padding: 20px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(107, 11, 34, 0.14), 0 10px 25px rgba(0, 0, 0, 0.04);
    border-color: rgba(107, 11, 34, 0.3);
}

.stat-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.stat-number-wrapper {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    color: rgb(107, 11, 34); /* Elegant deep wine red */
    font-family: 'Noto Serif TC', serif;
    font-weight: 700;
}

.stat-number {
    font-size: 2.6rem;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-plus {
    font-size: 1.6rem;
    margin-left: 2px;
    color: rgb(107, 11, 34);
    font-weight: 700;
    position: relative;
    top: -4px;
}



/* 3D Rolling Digit styles */
.digit-container {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    height: 1.15em;
    line-height: 1.15em;
}

.digit-strip {
    display: inline-flex;
    flex-direction: column;
    will-change: transform, filter;
}

.digit-strip span {
    display: block;
    height: 1.15em;
    line-height: 1.15em;
}

.spinning {
    filter: blur(1px);
    opacity: 0.85;
}

@media (max-width: 991px) {
    .feature-stats {
        margin-top: -80px; /* Exactly half of 160px card height */
    }
    .stat-card {
        width: 160px;
        height: 160px;
        padding: 15px;
    }
    .stat-number {
        font-size: 1.9rem;
    }
    .stat-label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    .stat-plus {
        font-size: 1.2rem;
        top: -3px;
    }
}

@media (max-width: 768px) {
    .feature-stats {
        margin-top: -57px; /* Exactly half of 115px card height */
    }
    .stat-card {
        width: 115px;
        height: 115px;
        padding: 10px;
        border-width: 1px;
    }
    .stat-label {
        font-size: 0.65rem;
        margin-bottom: 3px;
        letter-spacing: 0px;
    }
    .stat-number {
        font-size: 1.2rem;
    }
    .stat-plus {
        font-size: 0.8rem;
        top: -2px;
    }
}

/* ── Floating Sidebar ── */
.floating-sidebar {
    position: fixed;
    right: 20px;
    bottom: 10%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.float-btn {
    width: 50px;
    height: 50px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-md);
    color: var(--primary-orange);
    text-decoration: none;
    transition: var(--transition-base);
}

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



/* ── USR Introduction Section ── */
#usr-intro {
    background: #fdfdfd;
    position: relative;
    padding: 80px 0;
}

.intro-content-card {
    background: var(--white);
    border-radius: 20px;
    padding: 3.5rem;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.04);
    transition: var(--transition-base);
    border: none;
}

.intro-image-wrapper {
    position: relative;
    transition: var(--transition-base);
    overflow: hidden;
    border-radius: 20px;
}

/* Remove the pseudo-border for a cleaner look */
.intro-image-wrapper::before {
    display: none;
}

.intro-image-wrapper:hover {
    transform: translateY(-5px);
}

.intro-image-wrapper img {
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 640px;
    aspect-ratio: 640 / 420;
    object-fit: cover;
}

.intro-content-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.description-text {
    font-size: 1.15rem;
    color: var(--text-main);
    text-align: justify;
    text-justify: inter-ideograph;
    line-height: 1.8;
}

.description-text:last-of-type {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .intro-content-card {
        padding: 1.5rem 2rem;
    }

    .description-text {
        font-size: 1rem;
    }
}

/* ── Project Card Image Box (USR計畫總覽) ── */
.achiev-img-box {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.achiev-project-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(80, 46, 129, 0.85);
    color: white;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 15;
    border-left: 3px solid var(--primary-orange);
}

/* ── Event Section ── */
#fields {
    padding-top: 80px;
}

.event-grid {
    margin-top: 40px;
}

.event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
}

.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.event-img-box {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.event-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.event-card:hover .event-img-box img {
    transform: scale(1.08);
}

.project-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--dark-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 10;
}

.event-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.event-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.event-date i {
    color: var(--primary-orange);
}

.event-report-text {
    font-size: 1.15rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: justify;
    transition: max-height 0.3s ease;
}

.event-footer-links {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.event-toggle-link {
    color: var(--primary-orange);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    background: #FFF5E6;
    padding: 8px 22px;
    border-radius: 50px;
    border: 1px solid rgba(252, 207, 34, 0.2);
}

.event-toggle-link:hover {
    background: var(--primary-orange);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(252, 207, 34, 0.2);
}

.event-gallery-link {
    color: var(--text-muted);
    font-weight: 400;
    text-decoration: none;
    font-size: 1.1rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
}

.event-gallery-link:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

/* ── Gallery Modal ── */
.event-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 110px);
    gap: 2px;
    background: #eee;
}

.gallery-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-item:first-child {
    grid-column: span 3;
    grid-row: span 2;
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 5;
    position: relative;
    filter: brightness(0.9);
}

/* ── Related Links ── */
.related-link-item {
    text-decoration: none !important;
    text-align: center;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 15px 40px;
    border: 2px solid #eeeeee;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.related-link-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-orange);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

.related-link-item:hover p {
    color: var(--primary-orange) !important;
}

/* ── News Card V2 (Used in Activity Section) ── */
.news-card-v2 {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid #f0f0f0;
}

.news-card-v2:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.card-img-wrapper {
    position: relative;
    height: 250px;
    overflow: hidden;
}

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

.card-tag-v2 {
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(74, 101, 126, 0.95);
    color: #fff;
    padding: 10px 20px;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-content-v2 {
    padding: 24px;
}

.card-date-v2 {
    font-size: 1.05rem;
    color: #999;
    margin-bottom: 15px;
    font-family: inherit;
}

.card-title-v2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Result Category Filter Buttons ── */
.btn-outline-custom {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid #ddd;
    padding: 10px 30px;
    border-radius: 50px;
    font-weight: 500;
    transition: var(--transition-base);
}

.btn-outline-custom:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    background-color: rgba(252, 207, 34, 0.05);
}

/* ── North Area Partners Section Styles ── */

/* Coordinator Ring Pulse Effect */
/* Coordinator Ring Pulse Effect (Amber) */
@keyframes pulse-ring-amber {
    0% { transform: scale(0.3); opacity: 1; }
    80%, 100% { opacity: 0; }
}

/* Partner Ring Pulse Effect (Blue) */
@keyframes pulse-ring-blue {
    0% { transform: scale(0.3); opacity: 1; }
    80%, 100% { opacity: 0; }
}

.pulse-marker-amber, .pulse-marker-blue {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-marker-amber::before {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-orange);
    animation: pulse-ring-amber 1.8s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

.pulse-marker-blue::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #3b82f6; /* Bright Blue glow */
    animation: pulse-ring-blue 1.8s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

.coordinator-dot {
    width: 14px;
    height: 14px;
    background-color: var(--primary-orange);
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 2;
}

.partner-dot {
    width: 10px;
    height: 10px;
    background-color: var(--dark-blue);
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    transition: var(--transition-base);
}

.partner-dot:hover {
    background-color: var(--primary-orange);
    transform: scale(1.2);
}

/* Custom Leaflet Popup Overrides */
.custom-leaflet-popup .leaflet-popup-content-wrapper {
    background: #ffffff;
    color: var(--text-main);
    border-radius: var(--border-radius);
    padding: 2px;
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--primary-orange);
}

.custom-leaflet-popup .leaflet-popup-tip {
    background: #ffffff;
}

.custom-popup-content .hover-underline:hover {
    text-decoration: underline !important;
}

/* Custom Map Tooltip Style */
.custom-map-tooltip {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid var(--dark-blue) !important;
    border-radius: 4px !important;
    padding: 3px 8px !important;
    font-size: 0.8rem !important;
    font-weight: bold !important;
    color: var(--dark-blue) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    font-family: 'Noto Sans TC', sans-serif !important;
}

@media (max-width: 991px) {
    #map {
        height: 380px !important;
    }
}