@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500&display=swap');

:root {
    --bg-color: #080808;
    --text-color: #FDFBF7;
    --accent-color: #D4AF37; /* Gold */
    --accent-hover: #b8962b;
    --border-color: #333333;
    --font-japanese: 'Noto Serif JP', 'Yu Mincho', 'Shippori Mincho', serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-japanese);
    line-height: 1.6;
    overflow-x: hidden;
}

body.view-body {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none; /* Prevent iOS rubber-banding bounce */
    touch-action: none;
}

/* --- Index (View) Page Styles --- */
.view-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Background subtly animated pattern / gradient */
.view-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    z-index: -2;
}

#image-display {
    max-width: 80%;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 2s ease-in-out, transform 20s ease-out;
    border: 1px solid rgba(212, 175, 55, 0.2);
    object-fit: contain;
}

#image-display.show {
    opacity: 1;
    transform: scale(1.05); /* Slow Ken Burns effect */
    transition: opacity 4s ease-in-out, transform 20s ease-out;
}

/* Vertical Text for Caption */
#caption-display {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    color: var(--text-color);
    opacity: 0;
    transition: opacity 2s ease-in-out, right 2s ease-out;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.9), -1px -1px 8px rgba(0,0,0,0.8), 0px 0px 15px rgba(0,0,0,1);
    border-left: 1px solid var(--accent-color);
    padding-left: 20px;
    height: 70vh;
}

#caption-display.show {
    opacity: 1;
    right: 8%;
}

.no-data {
    font-size: 1.2rem;
    color: #666;
    letter-spacing: 0.1em;
}

/* Admin Link slightly visible */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
    font-size: 0.8rem;
    transition: 0.3s;
    font-family: sans-serif;
}
.admin-link:hover {
    color: var(--accent-color);
}

/* --- Admin Page Styles --- */
.admin-body {
    background-color: #121212;
    padding: 40px 20px;
}

.admin-header {
    text-align: center;
    margin-bottom: 40px;
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--accent-color);
    letter-spacing: 0.1em;
    font-weight: 400;
}

.admin-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: #1a1a1a;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.9rem;
}

.form-group input[type="file"],
.form-group input[type="text"],
.form-group input[type="url"] {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid var(--border-color);
    color: #fff;
    font-family: inherit;
    border-radius: 4px;
}

.form-group input[type="file"] {
    padding: 8px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn {
    display: inline-block;
    background: var(--accent-color);
    color: #000;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.3s;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: #8b0000;
    color: #fff;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: normal;
}
.btn-danger:hover {
    background: #660000;
}

.message {
    margin-top: 15px;
    padding: 10px;
    display: none;
    border-radius: 4px;
}
.message.success {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
    display: block;
}
.message.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
    display: block;
}

/* List of uploaded items */
.item-list {
    margin-top: 50px;
}

.item-list h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    font-weight: 300;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.list-item {
    background: #222;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.list-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.list-item p {
    font-size: 0.9rem;
    margin-bottom: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ddd;
}

#insta-display {
    position: absolute;
    bottom: 50px;
    right: 50px;
    z-index: 100;
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid var(--accent-color);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: var(--font-japanese);
    letter-spacing: 0.1em;
    opacity: 0;
    transition: all 0.4s ease, opacity 2s ease-in-out;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

#insta-display svg {
    width: 20px;
    height: 20px;
}

#insta-display:hover {
    background: rgba(212, 175, 55, 0.15);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
    color: #fff;
    border-color: rgba(255,255,255,0.8);
}

#insta-display.show {
    opacity: 1;
}

/* --- Site Logo --- */
#site-logo {
    position: absolute;
    top: 45px;
    left: 55px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: rgba(253, 251, 247, 0.7);
    z-index: 100;
    opacity: 0;
    animation: fadeInSiteLogo 3.5s ease-out forwards 1.2s;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    text-shadow: 2px 2px 10px rgba(0,0,0,0.9);
    cursor: default;
}

#site-logo:hover {
    transform: scale(1.02);
    color: rgba(253, 251, 247, 0.95);
    text-shadow: 0 0 15px rgba(212,175,55,0.6);
}

@keyframes fadeInSiteLogo {
    to { opacity: 0.8; }
}

/* --- English Text Logo --- */
#en-logo {
    position: absolute;
    bottom: 40px;
    left: 50px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.4em;
    color: rgba(253, 251, 247, 0.4);
    z-index: 100;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.5s;
    pointer-events: none;
    text-shadow: 1px 1px 10px rgba(0,0,0,0.8);
}

/* --- Date Display --- */
#date-display {
    position: absolute;
    top: 40px;
    right: 50px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    color: rgba(253, 251, 247, 0.7);
    z-index: 100;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    pointer-events: none;
    text-shadow: 1px 1px 10px rgba(0,0,0,0.8);
}

#date-display.show {
    opacity: 1;
}

@keyframes fadeInLogo {
    to { opacity: 0.95; }
}
/* --- Mobile Device Optimizations --- */
@media (max-width: 768px) {
    /* Main Display */
    #site-logo {
        top: 25px;
        left: 20px;
        font-size: 1rem;
    }

    #en-logo {
        bottom: 25px;
        left: 20px;
        font-size: 0.8rem;
        letter-spacing: 0.3em;
    }

    #date-display {
        top: 25px;
        right: 20px;
        font-size: 0.8rem;
        letter-spacing: 0.2em;
    }

    #image-display {
        max-width: 95%;
        max-height: 70vh;
        max-height: 70dvh;
    }
    
    #caption-display {
        font-size: 1.1rem;
        letter-spacing: 0.15em;
        line-height: 2;
        right: 2%;
        height: 65vh;
        height: 65dvh;
        padding-left: 10px;
        text-shadow: 2px 2px 12px rgba(0,0,0,1), -2px -2px 12px rgba(0,0,0,1), 0 0 20px rgba(0,0,0,0.9);
    }

    #caption-display.show {
        right: 4%;
    }

    #insta-display {
        bottom: 8%;
        right: 5%;
        font-size: 0.85rem;
        padding: 8px 16px;
    }

    #insta-display svg {
        width: 16px;
        height: 16px;
    }

    /* Admin Panel */
    .admin-wrapper {
        padding: 20px 15px;
        margin: 10px;
    }

    .admin-header h1 {
        font-size: 1.6rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    .list-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .list-item {
        padding: 10px;
    }
    
    .list-item img {
        height: 120px;
    }
}

@media (max-width: 480px) {
    /* Smaller iPhones, etc */
    #caption-display {
        font-size: 1rem;
        letter-spacing: 0.1em;
        line-height: 1.8;
        padding-left: 8px;
    }
    
    .admin-header h1 {
        font-size: 1.3rem;
    }
    
    .list-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}
