/* Agenda Loader Overlay */
#agenda-loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-page);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#agenda-loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* The Open Agenda Book */
.agenda-book-wrapper {
    transform: scale(1.4);
}
.agenda-book {
    position: relative;
    width: 280px;
    height: 190px;
    perspective: 1500px;
}

/* Dark leather-like cover extending slightly beyond pages */
.book-cover {
    position: absolute;
    top: -6px; bottom: -6px; left: -8px; right: -8px;
    background-color: #333333; /* Dark gray */
    background-image: radial-gradient(circle, #4a4a4a 0%, #1a1a1a 100%);
    border: 1px solid #000;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6), inset 0 0 15px rgba(0,0,0,0.8);
}

/* Realistic Spine */
.book-spine {
    position: absolute;
    top: -6px; bottom: -6px;
    left: calc(50% - 16px);
    width: 32px;
    background: linear-gradient(to right, #111111 0%, #333333 50%, #111111 100%);
    border-radius: 4px;
    z-index: 1;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Red bookmark ribbon */
.book-ribbon {
    position: absolute;
    top: -10px;
    left: calc(50% - 2px);
    width: 14px;
    height: 60px;
    background-color: #a82e2e;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
}

.book-page {
    position: absolute;
    top: 5px; bottom: 5px;
    width: calc(50% - 6px);
    background-color: #f4ecd8; /* nice aged paper */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 3;
}

.left-page {
    left: 6px;
    border-radius: 4px 0 0 4px;
    border-right: 1px solid rgba(0,0,0,0.2);
    background: linear-gradient(to left, #e6dec9 0%, #f4ecd8 15%);
}

.right-page {
    right: 6px;
    border-radius: 0 4px 4px 0;
    border-left: 1px solid rgba(0,0,0,0.2);
    background: linear-gradient(to right, #e6dec9 0%, #f4ecd8 15%);
}

/* The Writing Quote Animation */
.writing-quote-container {
    position: relative;
    display: inline-block;
    margin-top: 40px;
    margin-left: 10px;
}

.writing-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.75rem;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    animation: type-quote 3s infinite linear;
    border-right: 1px solid transparent;
}

.writing-hand-quote {
    position: absolute;
    top: -10px;
    left: 0;
    font-size: 1.2rem;
    z-index: 20;
    animation: move-hand-quote 3s infinite linear;
    margin-left: -5px;
}

@keyframes type-quote {
    0% { max-width: 0; opacity: 1; }
    70% { max-width: 100%; opacity: 1; }
    85% { opacity: 1; }
    90% { opacity: 0; }
    100% { max-width: 100%; opacity: 0; }
}

@keyframes move-hand-quote {
    0% { left: 0%; opacity: 1; transform: translateY(0); }
    10% { left: 10%; transform: translateY(-2px); }
    20% { left: 20%; transform: translateY(1px); }
    30% { left: 30%; transform: translateY(-1px); }
    40% { left: 40%; transform: translateY(2px); }
    50% { left: 50%; transform: translateY(-2px); }
    60% { left: 60%; transform: translateY(1px); }
    70% { left: 100%; opacity: 1; transform: translateY(0); }
    85% { opacity: 1; left: 100%; }
    90% { opacity: 0; }
    100% { left: 100%; opacity: 0; }
}

/* Text styles inside the agenda */
.agenda-content {
    padding: 15px 20px;
    font-family: 'Playfair Display', serif;
    height: 100%;
    position: relative;
}

.agenda-header {
    font-size: 0.8rem;
    color: #8b7355;
    border-bottom: 1px solid #d4c5ab;
    padding-bottom: 5px;
    margin-bottom: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.agenda-text {
    font-size: 0.65rem;
    color: #4a4a4a;
    line-height: 1.5;
    margin: 0;
    text-align: left;
}

/* Logo watermark */
.page-logo-watermark {
    width: 60px;
    opacity: 0.08;
    position: absolute;
    bottom: 20px;
    right: 20px;
}

/* Custom View Transitions for Page Turn */
@view-transition {
    navigation: auto;
}

/* Base animation setup for view transitions */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.4s;
}

/* We remove the 'flying' 3D page flip from the root, 
   falling back to a simple, elegant cross-fade (browser default behavior) */
::view-transition-old(root) {
    animation-name: fade-out;
}
::view-transition-new(root) {
    animation-name: fade-in;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    .agenda-book-wrapper {
        transform: scale(1.0);
    }
}

@media (max-width: 400px) {
    .agenda-book-wrapper {
        transform: scale(0.85);
    }
}
