/* ===========================
   Photo Library - CSS
   Design matched to Wedding Invitation site
   =========================== */

:root {
    /* Colors - Champagne Gold & Ivory (inherited from main site) */
    --color-primary: #F9F7F2;
    --color-secondary: #e6d370;
    --color-accent: #d8c360;
    --color-text: #2C2C2C;
    --color-text-light: #6E685E;
    --color-bg: #F9F7F2;
    --color-dark: #1A1A1A;
    --color-border: rgba(230, 211, 112, 0.3);
    --color-glass: rgba(255, 255, 255, 0.7);

    --shadow-soft: 0 10px 30px rgba(44, 44, 44, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);

    /* Fonts */
    --font-serif: 'Cormorant Garamond', serif;
    --font-heading: 'Cormorant Garamond', serif;
    --font-sans: 'Noto Sans JP', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2.5rem;
    --spacing-lg: 5rem;
    --spacing-xl: 8rem;

    /* Transitions */
    --transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    color: var(--color-text);
    line-height: 2;
    background-color: var(--color-bg);
    overflow-x: hidden;
    position: relative;
}

/* ===========================
   Visual Effects Layers
   =========================== */

.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.light-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8000;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 60%, rgba(212, 175, 55, 0.05) 100%);
    mix-blend-mode: overlay;
}

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ===========================
   Page Fade-In Animation
   =========================== */

.page-wrapper {
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-wrapper.visible {
    opacity: 1;
}

/* ===========================
   Password Page (indexphoto)
   =========================== */

.password-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Decorative background circles */
.password-page::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(230, 211, 112, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.password-page::after {
    content: '';
    position: absolute;
    bottom: -15%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(230, 211, 112, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.password-container {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 20;
    max-width: 500px;
    width: 100%;
}

.password-title {
    font-family: var(--font-heading);
    font-size: 5rem;
    font-weight: 300;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--color-text);
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

.password-subtitle {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    letter-spacing: 0.4em;
    color: var(--color-secondary);
    text-transform: uppercase;
    margin-bottom: var(--spacing-lg);
    display: inline-block;
    position: relative;
    padding: 0 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.5s cubic-bezier(0.22, 1, 0.36, 1) 0.8s forwards;
}

.password-subtitle::before,
.password-subtitle::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25px;
    height: 1px;
    background-color: var(--color-secondary);
}

.password-subtitle::before {
    left: -25px;
}

.password-subtitle::after {
    right: -25px;
}

.password-form {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.5s cubic-bezier(0.22, 1, 0.36, 1) 1.2s forwards;
}

.password-input-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.password-input {
    width: 100%;
    max-width: 350px;
    padding: 1.2rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    letter-spacing: 0.1em;
    border: 1px solid #ddd;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 0;
    transition: var(--transition);
    text-align: center;
    color: var(--color-text);
}

.password-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    background-color: #fff;
    box-shadow: 0 0 20px rgba(230, 211, 112, 0.15);
}

.password-input::placeholder {
    color: #bbb;
    letter-spacing: 0.05em;
}

.password-submit {
    display: inline-block;
    padding: 1rem 3.5rem;
    background-color: var(--color-secondary);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.25em;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.password-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.password-submit:hover {
    background-color: var(--color-accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(230, 211, 112, 0.4);
}

.password-submit:hover::before {
    left: 100%;
}

.password-error {
    margin-top: 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: #c9847a;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateY(-5px);
    transition: var(--transition);
}

.password-error.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Shake animation for error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.password-input.shake {
    animation: shake 0.6s ease;
    border-color: #c9847a;
}

/* ===========================
   Gallery Page Layout
   =========================== */

.gallery-page {
    min-height: 100vh;
    position: relative;
}

/* Gallery Header */
.gallery-header {
    padding: 6rem 0 3rem;
    text-align: center;
    position: relative;
    z-index: 20;
}

.gallery-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.gallery-subtitle {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    letter-spacing: 0.4em;
    color: var(--color-secondary);
    text-transform: uppercase;
    display: inline-block;
    position: relative;
    padding: 0 1.5rem;
}

.gallery-subtitle::before,
.gallery-subtitle::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25px;
    height: 1px;
    background-color: var(--color-secondary);
}

.gallery-subtitle::before {
    left: -25px;
}

.gallery-subtitle::after {
    right: -25px;
}

.gallery-count {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.8rem;
    letter-spacing: 0.1em;
}

/* ===========================
   Photo Grid
   =========================== */

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem var(--spacing-xl);
    position: relative;
    z-index: 20;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    background: #f0ede8;
    border-radius: 2px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item.is-video {
    cursor: pointer;
}

/* Aspect ratio container */
.gallery-item::before {
    content: '';
    display: block;
    padding-top: 100%; /* Square aspect ratio */
}

.gallery-item img,
.gallery-item video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Video play indicator */
.gallery-item .video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: var(--transition);
    pointer-events: none;
}

.gallery-item .video-indicator::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.gallery-item:hover .video-indicator {
    background: rgba(230, 211, 112, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Hover overlay */
.gallery-item .item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 3;
    pointer-events: none;
}

.gallery-item:hover .item-overlay {
    opacity: 1;
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.08);
}

/* ===========================
   Lightbox
   =========================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 2px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.lightbox.active .lightbox-content img,
.lightbox.active .lightbox-content video {
    opacity: 1;
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 20001;
    background: none;
    border: none;
    padding: 0;
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.8);
    transition: background-color 0.3s;
}

.lightbox-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.lightbox-close:hover::before,
.lightbox-close:hover::after {
    background-color: var(--color-secondary);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 20001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-prev {
    left: 15px;
}

.lightbox-next {
    right: 15px;
}

.lightbox-nav::before {
    content: '';
    display: block;
    width: 15px;
    height: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.8);
    transition: border-color 0.3s;
}

.lightbox-prev::before {
    transform: rotate(-135deg);
    margin-left: 5px;
}

.lightbox-next::before {
    transform: rotate(45deg);
    margin-right: 5px;
}

.lightbox-nav:hover::before {
    border-color: var(--color-secondary);
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.2em;
}

/* ===========================
   Back Button
   =========================== */

.back-button {
    position: fixed;
    top: 25px;
    left: 25px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text-light);
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 0.15em;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    background: rgba(249, 247, 242, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 2px;
}

.back-button::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--color-text-light);
    border-left: 1px solid var(--color-text-light);
    transform: rotate(-45deg);
    transition: var(--transition);
}

.back-button:hover {
    color: var(--color-secondary);
}

.back-button:hover::before {
    border-color: var(--color-secondary);
    transform: rotate(-45deg) translateX(-3px) translateY(-3px);
}

/* ===========================
   Footer
   =========================== */

.photo-footer {
    padding: var(--spacing-md) 0;
    text-align: center;
    color: var(--color-text-light);
    position: relative;
    z-index: 20;
}

.photo-footer p {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ===========================
   Animations
   =========================== */

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

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

/* Gold shimmer for title */
.text-shimmer {
    background: linear-gradient(45deg, var(--color-text) 0%, var(--color-secondary) 30%, var(--color-text) 60%, var(--color-secondary) 100%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 300% center;
    }
}

/* ===========================
   Responsive Design
   =========================== */

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
}

@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 767px) {
    .password-title {
        font-size: 3rem;
        letter-spacing: 0.2em;
    }

    .gallery-title {
        font-size: 2.2rem;
        letter-spacing: 0.15em;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .gallery-header {
        padding: 5rem 0 2rem;
    }

    .back-button {
        top: 15px;
        left: 15px;
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }
}

@media (max-width: 480px) {
    .password-title {
        font-size: 2.5rem;
    }

    .gallery-title {
        font-size: 1.8rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
}

/* ===========================
   Loading Spinner
   =========================== */

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(230, 211, 112, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-secondary);
    animation: spin 1s ease-in-out infinite;
    margin: 50px auto;
    grid-column: 1 / -1;
    justify-self: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #c9847a;
    font-family: var(--font-sans);
    padding: 2rem;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* ===========================
   Upload UI
   =========================== */

.upload-container {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-btn {
    display: inline-block;
    padding: 0.8rem 2.5rem;
    background-color: transparent;
    border: 1px solid var(--color-secondary);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    border-radius: 2px;
}

.upload-btn:hover {
    background-color: var(--color-secondary);
    color: #fff;
    box-shadow: 0 5px 15px rgba(230, 211, 112, 0.3);
}

.upload-status {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    opacity: 0;
    height: 0;
    transition: var(--transition);
}

.upload-status.visible {
    opacity: 1;
    height: auto;
    margin-top: 0.5rem;
}

.upload-status.uploading {
    color: var(--color-secondary);
}

.upload-status.success {
    color: #7ac998;
}

.upload-status.error {
    color: #c9847a;
}
