/* Genesis Chronicle - Custom Styles */

/* Smooth Scrolling - 由 JavaScript 處理，避免重複定義 */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1612;
}

::-webkit-scrollbar-thumb {
    background: #d4a574;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c17d5a;
}

/* Text Selection */
::selection {
    background: #d4a574;
    color: #1a1612;
}

/* Animations */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

@keyframes floatText {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px);
        opacity: 0.6;
    }
}

/* Apply animations */
[data-animate="fade-in-left"] {
    animation: fadeInLeft 0.8s ease-out forwards;
}

[data-animate="fade-in-right"] {
    animation: fadeInRight 1.2s ease-out forwards;
}

[data-animate="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

[data-animate="float"] {
    animation: float 3s ease-in-out infinite;
}

[data-animate="float-delayed"] {
    animation: float 3s ease-in-out infinite 0.5s;
}

[data-animate="float-slow"] {
    animation: floatSlow 4s ease-in-out infinite;
}

[data-animate="float-text"] {
    animation: floatText 5s ease-in-out infinite;
}

[data-animate="float-text-delayed"] {
    animation: floatText 5s ease-in-out infinite 1s;
}

[data-animate="float-text-slow"] {
    animation: floatText 6s ease-in-out infinite 2s;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #d4a574 0%, #c17d5a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Paper Texture Overlay */
.paper-texture {
    position: relative;
}

.paper-texture::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* Card Hover Effect */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(212, 165, 116, 0.2);
}

/* Section Spacing */
section {
    position: relative;
}

/* Backdrop Blur Support */
@supports (backdrop-filter: blur(10px)) {
    .backdrop-blur-sm {
        backdrop-filter: blur(10px);
    }
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.5;
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2rem;
    }
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid #d4a574;
    outline-offset: 2px;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 22, 18, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: zoom-out;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(212, 165, 116, 0.3);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(212, 165, 116, 0.2);
    border: 2px solid #d4a574;
    color: #d4a574;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    line-height: 1;
}

.lightbox-close:hover {
    background: #d4a574;
    color: #1a1612;
    transform: rotate(90deg);
}

/* Image Zoom Cursor */
.image-zoomable {
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.image-zoomable:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #d4a574 0%, #c17d5a 100%);
    color: #1a1612;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: all 0.4s ease;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(212, 165, 116, 0.6);
}

.back-to-top:active {
    transform: translateY(-2px);
}

/* Responsive - 手機版調整位置 */
@media (max-width: 640px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}
