/* 
 * Kamishibai Premium Aesthetics for SakeLog
 * Theme: Deep Navy, Cream, Gold
 */

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

.ksb-wrapper {
    max-width: 1100px;
    margin: 60px auto;
    font-family: 'Noto Sans JP', sans-serif;
    perspective: 1500px;
    background: #0B1F3A;
    border: 2px solid #C8A04D;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
}

.ksb-header {
    padding: 30px;
    background: linear-gradient(135deg, #102C57 0%, #0B1F3A 100%);
    text-align: center;
    border-bottom: 2px solid #C8A04D;
}

.ksb-main-title {
    margin: 0;
    color: #C8A04D;
    font-family: 'Noto Serif JP', serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.15em;
}

/* Removing old summary styles as they are replaced by ksb-header */

/* Stage Layout */
.ksb-stage-container {
    position: relative;
    width: 100%;
    /* Changing aspect-ratio to allow more vertical space for bottom text */
    aspect-ratio: 12 / 9; 
    background: #000;
    overflow: hidden;
}

.ksb-stage {
    width: 100%;
    height: 100%;
    background: #F6F1E5; /* Paper Cream */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Doors */
.ksb-door {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: #102C57;
    z-index: 20;
    transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #C8A04D;
}

/* Motion Reduction Support */
@media (prefers-reduced-motion: reduce) {
    .ksb-door,
    .ksb-slide,
    .ksb-btn {
        transition: none !important;
        animation: none !important;
    }
}

.ksb-door-left { left: 0; border-right-width: 2px; }
.ksb-door-right { right: 0; border-left-width: 2px; }

.ksb-wrapper.is-open .ksb-door-left { transform: translateX(-100%); }
.ksb-wrapper.is-open .ksb-door-right { transform: translateX(100%); }

.ksb-door-label {
    writing-mode: vertical-rl;
    color: #C8A04D;
    font-family: 'Noto Serif JP', serif;
    font-size: 2rem;
    letter-spacing: 0.5em;
    opacity: 0.8;
}

/* Slide Content */
.ksb-slide {
    display: none;
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    flex-direction: column;
    animation: ksb-fade-in 1.2s ease forwards;
}

.ksb-slide.is-active { display: flex; }

@keyframes ksb-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ksb-slide-header {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 15;
    pointer-events: none;
}

.ksb-slide-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 2.2rem;
    color: #F6F1E5;
    margin: 0;
    background: rgba(11, 31, 58, 0.6);
    padding: 8px 24px;
    border-left: 6px solid #C8A04D;
    display: inline-block;
}

.ksb-slide-body {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ksb-slide-image-wrapper {
    position: relative;
    width: 100%;
    height: 60%; /* Image area */
    z-index: 1;
    overflow: hidden;
    background: #000;
}

.ksb-slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ksb-slide-content {
    position: relative;
    width: 100%;
    height: 40%; /* Text area increases */
    z-index: 10;
    background: #0B1F3A;
    padding: 20px 40px 110px; /* Room for controls at the very bottom */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align text to top of its area */
    border-top: 2px solid #C8A04D;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.ksb-slide-narration {
    font-size: 1.3rem;
    line-height: 1.5;
    color: #F6F1E5;
    font-weight: 500;
}

.ksb-slide-content.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.ksb-slide-content {
    transition: all 0.4s ease;
}

.ksb-slide-meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 1rem;
}

/* Utils and States */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ksb-loading,
.ksb-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #0B1F3A;
    font-weight: bold;
}

.ksb-error p { margin-bottom: 1rem; color: #b91c1c; }

/* Controls */
.ksb-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(11, 31, 58, 0.8);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 40px;
    border: 1px solid rgba(200, 160, 77, 0.3);
}

.ksb-btn {
    background: transparent;
    border: 2px solid #C8A04D;
    color: #C8A04D;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.ksb-btn:hover:not(:disabled) {
    background: #C8A04D;
    color: #0B1F3A;
}

.ksb-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ksb-progress {
    color: #F6F1E5;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.2em;
}

/* Responsive */
@media (max-width: 768px) {
    .ksb-slide-body { grid-template-columns: 1fr; gap: 20px; }
    .ksb-slide-title { font-size: 1.5rem; }
    .ksb-slide-narration { font-size: 1rem; }
    .ksb-stage-container { aspect-ratio: auto; min-height: 500px; }
}
