/* ============================================================
   Journal Page Styles — Dumont & Goldworthy
   ============================================================ */

/* Particles canvas */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ── Journal section ── */
.journal-section {
    padding: 3rem 0 5rem;
    position: relative;
    z-index: 1;
}

.journal-stage {
    perspective: 1500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 560px;
}

/* ── Open Book ── */
.journal-book {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 900px;
    min-height: 560px;
    box-shadow: 0 12px 48px rgba(45, 40, 69, 0.2);
    border-radius: 2px 12px 12px 2px;
}

/* ── Pages ── */
.page {
    flex: 1;
    background: var(--paper);
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Lined paper texture */
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(1.7rem * 1.7 - 1px),
        rgba(160, 144, 80, 0.1) calc(1.7rem * 1.7 - 1px),
        rgba(160, 144, 80, 0.1) calc(1.7rem * 1.7)
    );
    background-size: 100% calc(1.7rem * 1.7);
}

.page-left {
    border-radius: 2px 0 0 2px;
    box-shadow: inset -4px 0 12px rgba(45, 40, 69, 0.06);
    border-right: none;
}

.page-right {
    border-radius: 0 12px 12px 0;
    transform-style: preserve-3d;
    transform-origin: left center;
    transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}

.page-right.turning {
    transform: rotateY(-12deg);
}

/* ── Page header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(160, 144, 80, 0.3);
}

.page-header-text {
    font-family: 'Homemade Apple', cursive;
    font-size: 1.1rem;
    color: var(--gold-muted);
}

.page-date {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.95rem;
    font-style: italic;
    color: var(--text-light);
}

.page-new-btn {
    background: none;
    border: 1px solid var(--gold-muted);
    color: var(--gold-muted);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.85rem;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.page-new-btn:hover {
    background: var(--gold-muted);
    color: var(--paper);
}

/* ── Entry list (left page) ── */
.entry-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entry-list-empty {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.95rem;
    margin-top: 1rem;
}

.entry-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(160, 144, 80, 0.1);
}

.entry-item:hover {
    background: rgba(160, 144, 80, 0.08);
}

.entry-item.active {
    background: rgba(160, 144, 80, 0.15);
}

.entry-item::before {
    content: '✦';
    color: var(--gold-muted);
    font-size: 0.6rem;
    margin-top: 0.35rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.entry-item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.entry-item-date {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

.entry-item-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.page-footer-note {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-light);
    opacity: 0.7;
    text-align: center;
}

/* ── Textarea (right page) ── */
.journal-textarea {
    flex: 1;
    width: 100%;
    min-height: 340px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
    caret-color: var(--gold-muted);
    padding: 0;
    /* Align text to lined texture */
    background: transparent;
}

.journal-textarea::placeholder {
    color: var(--text-light);
    opacity: 0.6;
    font-style: italic;
}

/* Ink fade-in animation */
@keyframes inkFadeIn {
    from {
        opacity: 0;
        filter: blur(2px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.journal-textarea.ink-fade {
    animation: inkFadeIn 0.8s ease forwards;
}

/* ── Page actions ── */
.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.journal-save-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

.journal-download-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

.journal-delete-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    background: none;
    border: 1px solid rgba(160, 80, 80, 0.4);
    color: rgba(160, 80, 80, 0.8);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    margin-left: auto;
}

.journal-delete-btn:hover {
    background: rgba(160, 80, 80, 0.1);
    color: rgb(160, 80, 80);
}

.save-feedback {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--gold-muted);
    min-height: 1.2em;
    margin-top: 0.4rem;
    transition: opacity 0.3s ease;
}

/* ── Spine ── */
.journal-spine {
    width: 20px;
    flex-shrink: 0;
    background: linear-gradient(to right,
        var(--neutral-dark) 0%,
        var(--purple-dark) 40%,
        var(--neutral-dark) 100%
    );
    position: relative;
    box-shadow: inset -2px 0 6px rgba(0,0,0,0.2), inset 2px 0 6px rgba(0,0,0,0.2);
}

.journal-spine::after {
    content: '';
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--gold-muted), transparent);
    opacity: 0.5;
}

/* ── Mobile: single page ── */
@media (max-width: 768px) {
    .journal-cover {
        width: 300px;
        min-height: 420px;
    }

    .cover-title {
        font-size: 1.1rem;
    }

    .cover-subtitle {
        font-size: 1.5rem;
    }

    .journal-book {
        flex-direction: column;
        border-radius: 8px;
    }

    .page-left {
        display: none;
    }

    .journal-spine {
        display: none;
    }

    .page-right {
        border-radius: 8px;
        min-height: 480px;
    }

    .journal-textarea {
        min-height: 260px;
    }
}

@media (max-width: 480px) {
    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .journal-delete-btn {
        margin-left: 0;
    }
}
