/* =====================================================
   TREASURE CHEST PROJECTS
   Wooden chests with gold accents on ocean floor
   ===================================================== */

.treasure-ocean-floor {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    padding: 50px 20px;
    min-height: 400px;
    background: rgba(50, 85, 100, 0.5);
    border-radius: 12px;
    margin: 0 20px;
}

/* Individual Chest Container */
.treasure-chest {
    position: relative;
    width: 180px;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
}

.treasure-chest * {
    cursor: pointer;
}

.treasure-chest:hover:not(.open) {
    transform: translateY(-8px);
}

/* Disable hover transform when open to prevent flickering */
.treasure-chest.open {
    transform: none !important;
}

.chest-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chest-canvas {
    image-rendering: auto;
    width: 140px;
    height: 110px;
}

/* =====================================================
   CHEST LABELS - Clean, readable styling
   ===================================================== */

.chest-label {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 0.7rem !important;
    line-height: 1.6 !important;
    color: #FFF8DC;
    text-align: center;
    background: rgba(93, 46, 12, 0.85);
    border-radius: 6px;
    border: 2px solid #DAA520;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: 150px;
}

/* =====================================================
   TREASURE SCROLL - Project Details Card
   ===================================================== */

/* Stone Tablet Popup - Fixed Centered Modal */
.treasure-scroll {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 360px;
    background: linear-gradient(145deg,
        #6B6B5B 0%,
        #7A7A6A 15%,
        #5A5A4A 30%,
        #6A6A5A 50%,
        #5A5A4A 70%,
        #6B6B5B 85%,
        #4A4A3A 100%
    ) !important;
    border: none;
    border-radius: 4px;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Chiseled edge effect */
.treasure-scroll::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 4px solid transparent;
    border-image: linear-gradient(135deg,
        #9A9A8A 0%,
        #6A6A5A 25%,
        #5A5A4A 50%,
        #7A7A6A 75%,
        #8A8A7A 100%
    ) 1;
    pointer-events: none;
}

/* Stone texture overlay */
.treasure-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0,0,0,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(0,0,0,0.08) 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 20px 20px, 30px 30px, 25px 25px;
    pointer-events: none;
}

.treasure-chest.open .treasure-scroll {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Backdrop overlay for treasure scroll */
.treasure-scroll-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.treasure-chest.open .treasure-scroll-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Stone Tablet Content - Carved text effect */
.scroll-content {
    padding: 24px 28px 28px;
    position: relative;
    z-index: 1;
}

.scroll-content h3 {
    font-size: 1rem !important;
    color: #E8E8D8 !important;
    margin-bottom: 16px;
    line-height: 1.6 !important;
    padding-bottom: 14px;
    border-bottom: 2px solid #8A8A7A;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Tags - small carved stones */
.scroll-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.scroll-tags span {
    background: linear-gradient(145deg, #4A4A3A, #3A3A2A) !important;
    color: #D4C4A0 !important;
    padding: 6px 12px;
    font-size: 0.6rem !important;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
    box-shadow:
        inset 1px 1px 2px rgba(255,255,255,0.1),
        inset -1px -1px 2px rgba(0,0,0,0.4),
        2px 2px 4px rgba(0,0,0,0.4);
}

/* Description - carved into stone */
.scroll-content p {
    font-size: 0.8rem !important;
    color: #D8D8C8 !important;
    line-height: 2.1 !important;
    margin-bottom: 20px;
    font-weight: normal;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}

/* Links - polished stone buttons */
.scroll-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.scroll-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(145deg, #3A3A2A, #2A2A1A) !important;
    color: #D4A84C !important;
    padding: 10px 18px;
    font-size: 0.65rem !important;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid #5A5A4A;
    font-weight: bold;
    box-shadow:
        inset 1px 1px 2px rgba(255,255,255,0.08),
        2px 3px 6px rgba(0,0,0,0.5);
}

.scroll-links a:hover {
    background: linear-gradient(145deg, #4A4A3A, #3A3A2A) !important;
    transform: translateY(-2px);
    box-shadow:
        inset 1px 1px 2px rgba(255,255,255,0.12),
        3px 5px 10px rgba(0,0,0,0.6);
    color: #FFD700 !important;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    .treasure-ocean-floor {
        gap: 25px;
        padding: 30px 15px;
    }

    .treasure-chest {
        width: 160px;
    }

    .chest-canvas {
        width: 120px;
        height: 95px;
    }

    .chest-label {
        font-size: 0.6rem !important;
        padding: 6px 10px;
        max-width: 130px;
    }

    .treasure-scroll {
        width: 280px;
    }
}

@media (max-width: 480px) {
    .treasure-ocean-floor {
        gap: 20px;
        padding: 20px 10px;
    }

    .treasure-chest {
        width: 140px;
    }

    .chest-canvas {
        width: 100px;
        height: 80px;
    }

    .chest-label {
        font-size: 0.55rem !important;
        padding: 5px 8px;
        max-width: 120px;
    }

    .treasure-scroll {
        width: 90vw;
        max-width: 300px;
    }

    .scroll-content {
        padding: 20px 16px 16px;
    }

    .scroll-content h3 {
        font-size: 0.85rem !important;
    }

    .scroll-content p {
        font-size: 0.7rem !important;
    }
}
