/* Card narrative container - allow overflow for drawer */
.card-narrative {
    overflow: visible;
    position: relative;
}

/* Ensure all parent containers accommodate drawer expansion */
.card-details {
    overflow: visible;
}

.card-content-wrapper {
    overflow: visible;
}

.card-upper {
    overflow: visible;
}

/* Narrative Drawer Styles */
.narrative-drawer {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 200px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    overflow: visible; /* Allow content to extend beyond bounds */
    margin-top: 20px; /* Double the space from buttons to drawer */
}

/* Default state - collapsed drawer */
.narrative-drawer.collapsed {
    background-color: #e8e8e8;
    border: none; /* Remove darker frame */
    border-radius: 4px;
    padding: 15px;
}

.narrative-drawer.collapsed:hover {
    background-color: #ebebeb;
    border: none; /* Remove border on hover too */
}

.narrative-drawer.collapsed .narrative-text {
    color: #999;
    font-size: 0.95em;
    line-height: 1.4;
    opacity: 0.85;
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Expanded state - drawer slides left only */
.narrative-drawer.expanded {
    position: relative;
    width: calc(100% + 200px); /* Extend to accommodate left slide */
    background-color: white; /* Clean white background for text readability */
    border: 1px solid #333; /* More visible dark border when expanded */
    border-radius: 4px;
    padding: 30px;
    z-index: 1000;
    transform: translateX(-200px); /* Slide left by 200px */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    cursor: default;
    box-sizing: border-box;
    /* Ensure right border is visible */
    margin-right: 0;
    /* Limit height to align with bottom of card image */
    max-height: 500px;
}

.narrative-drawer.expanded .narrative-text {
    color: #333;
    font-size: 1.25em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    opacity: 1;
    transition: all 0.3s ease;
    background: none; /* Remove any background from inner text */
    border: none; /* Remove any border from inner text */
    padding: 0; /* Remove padding from inner text that might create double-frame */
    margin: 0; /* Remove margin from inner text */
}

/* Animation states */
.narrative-drawer.animating {
    pointer-events: none;
}

/* Ensure narrative text maintains readability */
.narrative-text {
    margin: 0;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .narrative-drawer.expanded {
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 15px;
    }
    
    .narrative-drawer.expanded .narrative-text {
        font-size: 1em;
    }
}
