@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: #fdfdfd; /* Pure white/off-white */
    --text-color: #2c2c2c;
    --accent-color: #B94A32; /* 朱色 */
    --accent-hover: #9c3f2a;
    --border-color: #e0e0e0;
    --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;
}

body.view-body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* --- 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, #ffffff 0%, #f4f0e6 100%);
    z-index: -2;
}

#image-display {
    width: 75vmin;
    height: 75vmin;
    object-fit: cover;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.98);
    filter: brightness(1.1) blur(10px);
    border: 1px solid rgba(185, 74, 50, 0.15);
    /* Fade out transition - must be faster than JS 2000ms timeout */
    transition: opacity 1.5s ease-in, transform 1.5s ease-in, filter 1.5s ease-in;
}

#image-display.show {
    opacity: 1;
    transform: scale(1.05); /* Slow and calm zoom */
    filter: brightness(0.85) blur(0px); /* Slightly darkened to make text pop */
    /* Fade in transition */
    transition: opacity 2.5s ease-out, transform 40s linear, filter 2.5s ease-out;
}

/* --- Top Left Info Group --- */
#top-left-info-group {
    position: absolute;
    bottom: calc(50% + 37.5vmin + 15px); /* Grows upward from the image top edge */
    top: auto;
    left: calc(50% - 37.5vmin); /* Aligned with left edge of image */
    z-index: 60;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

#top-left-text-display {
    font-family: var(--font-japanese);
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--text-color);
    text-shadow: none;
}

#tl-badge-caption-group {
    display: flex;
    align-items: baseline;
    gap: 15px;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 4s ease-in-out 1s, transform 5s ease-out 1s;
}

#tl-badge-caption-group.show {
    opacity: 1;
    transform: translateX(0);
}

#tl-badge-display {
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.05);
    font-family: var(--font-japanese);
}

#tl-caption-display {
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--text-color);
    text-shadow: none;
}

#tl-sub-caption-display {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--text-color);
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 4s ease-in-out 1.2s, transform 5s ease-out 1.2s;
    text-shadow: none;
}

#tl-sub-caption-display.show {
    opacity: 1;
    transform: translateX(0);
}

/* Seasonal Text (Below Image) */
#seasonal-text-display {
    position: absolute;
    top: calc(50% + 37.5vmin + 85px); /* Move down slightly to make room for marquee */
    left: 50%;
    transform: translate(-50%, 15px);
    text-align: center;
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    opacity: 0;
    transition: opacity 2s ease-in-out, transform 2s ease-out;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.05);
    width: 90vw;
    z-index: 60;
}

#seasonal-text-display.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Goshuin Text */
#goshuin-text-display {
    position: absolute;
    top: calc(50% + 37.5vmin + 45px); /* 1 line space below the image */
    left: 50%;
    transform: translate(-50%, 0);
    text-align: center;
    width: 90vw;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    animation: fadeInText 4s ease-in forwards 1.5s;
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--text-color);
    text-shadow: none;
}

@keyframes fadeInText {
    to { opacity: 1; }
}

/* Horizontal Catchphrase (Center Overlay) */
#catchphrase-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-japanese);
    font-size: 3rem;
    color: rgba(253, 251, 247, 0.95);
    text-shadow: 0 0 20px rgba(0,0,0,0.9), 0 0 40px rgba(0,0,0,0.8), 2px 2px 10px rgba(0,0,0,0.9);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    letter-spacing: 0.15em;
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 700;
}

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


.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(0, 0, 0, 0.1);
    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: #24153b;
    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: #311d4f;
    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"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid var(--border-color);
    color: #fff;
    font-family: inherit;
    border-radius: 4px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

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

.form-group input:focus,
.form-group textarea: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: #311d4f;
    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(255,255,255,0.7);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

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

#insta-display:hover {
    background: rgba(185, 74, 50, 0.1);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(185, 74, 50, 0.2);
    color: var(--text-color);
    border-color: var(--text-color);
}

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

/* --- Site Logo --- */
#site-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    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: var(--text-color);
    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: none;
    cursor: default;
}

#site-logo:hover {
    transform: scale(1.02);
    color: var(--text-color);
    text-shadow: 0 0 15px rgba(185, 74, 50, 0.3);
}

.main-logo-img {
    height: 2.5em;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    filter: invert(1);
    mix-blend-mode: multiply;
    display: block;
    margin: 0 auto;
}

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

/* --- Contact Info --- */
#contact-info {
    position: absolute;
    top: 45px;
    right: 55px;
    text-align: right;
    z-index: 100;
    opacity: 0;
    animation: fadeInSiteLogo 3.5s ease-out forwards 1.4s;
    transition: all 0.6s ease;
    text-shadow: none;
}

.contact-addr {
    font-size: 0.8rem;
    font-weight: 300;
    margin-bottom: 6px;
    line-height: 1.7;
    letter-spacing: 0.15em;
    color: var(--text-color);
    opacity: 0.8;
}

.contact-tel {
    display: inline-block;
    margin-top: 8px;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 500;
    font-family: 'Cinzel', serif;
    color: var(--accent-color);
    letter-spacing: 0.15em;
    transition: all 0.3s ease;
        line-height: 1.6;
    text-shadow: none;
}

.contact-tel:hover {
    opacity: 1;
    transform: scale(1.05); /* Gentle zoom to indicate clickability */
    text-shadow: 0 0 20px rgba(185, 74, 50, 0.5);
}

.nav-gyouji-wrapper {
    margin-top: 15px;
}

.nav-gyouji {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(5px);
}

.nav-gyouji:hover {
    background: rgba(185, 74, 50, 0.1);
    color: var(--text-color);
    border-color: var(--text-color);
    box-shadow: 0 0 15px rgba(185, 74, 50, 0.2);
}

.contact-tel span {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    opacity: 0.8;
    margin-right: 8px;
    color: var(--text-color);
}

/* --- 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: var(--text-color);
    z-index: 100;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.5s;
    pointer-events: none;
    text-shadow: none;
}

#copyright-display {
    position: absolute;
    bottom: 20px;
    left: 50px;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-color);
    z-index: 100;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.5s;
    pointer-events: none;
    text-shadow: none;
}

#business-hours-display {
    position: absolute;
    bottom: 75px;
    left: 50px;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: var(--text-color);
    text-shadow: none;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    z-index: 100;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.4s;
    transition: all 0.6s ease;
    border-left: 2px solid var(--accent-color);
    padding-left: 12px;
}

/* --- Date Display --- */
#date-display {
    position: absolute;
    top: calc(50% + 39.375vmin + 5px);
    left: calc(50% + 39.375vmin);
    transform: translateX(-100%);
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 0.85rem;
    color: var(--text-color);
    letter-spacing: 0.1em;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    text-shadow: none;
}

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

@keyframes fadeInLogo {
    to { opacity: 0.95; }
}

.sp-br {
    display: none;
}

/* --- Mobile Device Optimizations --- */
@media (max-width: 768px) {
    /* Main Display */
    #site-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        top: 20px;
        left: 15px;
        max-width: 140px;
        font-size: 0.9rem; /* Restore smaller font size for mobile */
    }

    .main-logo-img {
        height: auto;
        width: 100%;
        max-width: 140px;
    }

    #contact-info {
        top: 20px;
        right: 15px;
        max-width: calc(100vw - 170px);
        word-break: auto-phrase;
    }

    .contact-addr {
        font-size: 0.55rem;
        letter-spacing: 0.05em;
        margin-bottom: 2px;
        line-height: 1.4;
    }

    .contact-tel {
        font-size: 1rem;
        letter-spacing: 0.05em;
        margin-top: 4px;
        display: inline-block;
    }

    .contact-tel span {
        font-size: 0.7rem;
        margin-right: 5px;
    }

    .nav-gyouji-wrapper {
        margin-top: 8px;
    }

    .nav-gyouji {
        font-size: 0.6rem !important;
        padding: 5px 8px !important;
        letter-spacing: 0.05em !important;
    }

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

    #copyright-display {
        bottom: 12px;
        left: 20px;
        font-size: 0.55rem;
    }

    #business-hours-display {
        bottom: 48px;
        left: 20px;
        font-size: 0.65rem;
        padding-left: 10px;
        max-width: calc(100vw - 40px);
        line-height: 1.5;
    }

    #date-display {
        top: calc(50% + 39.375vw + 4px);
        left: calc(50% + 39.375vw);
        font-size: 0.75rem;
        white-space: nowrap;
    }

    #image-display {
        width: 75vw;
        height: 75vw;
    }
    #top-left-info-group {
        bottom: calc(50% + 37.5vw + 10px);
        top: auto;
        left: calc(50% - 37.5vw);
    }

    #top-left-text-display {
        font-size: 1rem;
    }

    #tl-badge-caption-group {
        gap: 10px;
    }

    #tl-badge-display {
        font-size: 1.1rem;
    }

    #tl-caption-display {
        font-size: 0.95rem;
        font-weight: 400;
        letter-spacing: 0.1em;
        line-height: 1.5;
        color: var(--text-color);
        text-shadow: none;
    }
    
    #tl-sub-caption-display {
        font-size: 0.9rem;
        font-weight: 400;
        line-height: 1.4;
        color: var(--text-color);
        text-shadow: none;
    }
    
    #seasonal-text-display {
        font-size: 1.05rem;
        font-weight: 400;
        line-height: 1.5;
        top: calc(50% + 37.5vw + 75px); /* Move down to make room for marquee */
        transform: translate(-50%, 10px);
    }
    
    #seasonal-text-display.show {
        transform: translate(-50%, 0);
    }

    #goshuin-text-display {
        top: calc(50% + 37.5vw + 35px);
        font-size: 0.8rem;
        line-height: 1.5;
        width: 75vw;
        text-align: left;
    }

    .sp-br {
        display: block;
    }

    #catchphrase-display {
        font-size: 1.3rem;
        white-space: normal;
        width: 90vw;
        letter-spacing: 0.1em;
    }



    #insta-display {
        bottom: 95px;
        right: 20px;
        font-size: 0.8rem;
        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 */
    #tl-badge-display {
        font-size: 0.9rem;
    }
    #tl-caption-display {
        font-size: 0.8rem;
        line-height: 1.6;
    }
    
    .admin-header h1 {
        font-size: 1.3rem;
    }
    
    .list-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}

/* --- Subpage Styles --- */
.subpage-body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 0;
    margin: 0;
    font-family: var(--font-japanese);
}

.subpage-header {
    text-align: center;
    padding: 60px 20px 30px;
}

.subpage-header img.logo {
    height: 50px;
    width: auto;
    max-width: 300px;
    margin-bottom: 20px;
    filter: invert(1);
    mix-blend-mode: multiply;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.subpage-header h1 {
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    font-weight: 300;
    color: var(--accent-color);
}

.subpage-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.8;
}

.subpage-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 40px;
}

.subpage-section h2 {
    font-size: 1.4rem;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 10px;
    margin-bottom: 25px;
    color: var(--accent-color);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.subpage-section p {
    color: var(--text-color);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.prayer-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.prayer-list li {
    background: rgba(0, 0, 0, 0.03);
    padding: 15px 20px;
    border-radius: 4px;
    border-left: 2px solid var(--accent-color);
    color: var(--text-color);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.event-list {
    list-style: none;
    padding: 0;
}

.event-list li {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
}

.event-list li:last-child {
    border-bottom: none;
}

.event-date {
    font-weight: bold;
    color: var(--accent-color);
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.event-desc {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.95rem;
}

.subpage-footer {
    text-align: center;
    padding: 50px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.6;
    background: rgba(0,0,0,0.02);
}

.subpage-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.back-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 30px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 4px;
    transition: 0.3s;
    letter-spacing: 0.1em;
}

.back-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

@media (max-width: 480px) {
    .subpage-section {
        padding: 25px 15px;
    }
}
