/* READING MODE */
.reading-mode-active {
    overflow-x: hidden;
}

/* Hide secondary elements when reading mode is active */
.reading-mode-active .navbar,
.reading-mode-active .site-footer,
.reading-mode-active .site-breadcrumbs,
.reading-mode-active .article-sharing,
.reading-mode-active .author-question,
.reading-mode-active .about-author,
.reading-mode-active .back-link,
.reading-mode-active .progress-q-container,
.reading-mode-active [data-reading-secondary] {
    display: none !important;
}

/* For books, we want the cover image to stay, but in a standard layout */
.reading-mode-active .book-review-header {
    display: block !important;
    padding-top: 80px !important;
}
.reading-mode-active .book-review-cover {
    position: static !important;
    max-width: 250px;
    margin: 0 auto 40px auto;
}
.reading-mode-active .book-review-cover img {
    box-shadow: none;
    border-radius: 4px;
}

/* Center and constrain main content */
.reading-mode-active [data-reading-content] {
    width: min(100% - 40px, 720px) !important;
    margin-inline: auto !important;
    padding-bottom: 100px;
}

.reading-mode-active .book-review-content {
    width: min(100% - 40px, 720px) !important;
    margin-inline: auto !important;
}

/* Typography refinements for reading */
.reading-mode-active [data-reading-content] p {
    font-size: clamp(18px, 2vw, 20px) !important;
    line-height: 1.8 !important;
    margin-bottom: 1.8em !important;
}

.reading-mode-active [data-reading-content] h2 {
    margin-top: 2.5em !important;
    margin-bottom: 1em !important;
}

.reading-mode-active [data-reading-content] h3 {
    margin-top: 2em !important;
    margin-bottom: 1em !important;
}

/* Trigger Button */
.reading-entry-wrapper {
    margin: 30px 0 40px 0;
}

.reading-mode-trigger {
    background: transparent;
    border: 1px solid var(--accent-oro, #d4af37);
    color: var(--accent-oro, #d4af37);
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.3s ease, color 0.3s ease;
    display: inline-block;
    margin-bottom: 10px;
}

.reading-mode-trigger:hover,
.reading-mode-trigger:focus {
    background: var(--accent-oro, #d4af37);
    color: #000;
    outline: none;
}

.reading-mode-note {
    display: block;
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Hide trigger in reading mode */
.reading-mode-active .reading-entry-wrapper {
    display: none !important;
}

/* Toolbar and Progress */
.reading-mode-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.reading-mode-active .reading-mode-toolbar {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.reading-toolbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.reading-toolbar-title {
    color: #888;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.reading-mode-exit {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reading-mode-exit:hover,
.reading-mode-exit:focus {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.reading-progress {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.05);
    pointer-events: none;
}

.reading-progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--accent-oro, #d4af37);
    transition: width 0.1s linear;
}

/* Resume Prompt */
.reading-resume-prompt {
    background: rgba(212, 175, 55, 0.05);
    border-left: 3px solid var(--accent-oro, #d4af37);
    padding: 15px 20px;
    border-radius: 0 4px 4px 0;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reading-resume-prompt span {
    color: #ddd;
    font-size: 0.95rem;
}

.reading-resume-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.reading-resume-btn {
    background: var(--accent-oro, #d4af37);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.reading-resume-btn:hover {
    opacity: 0.9;
}

.reading-restart-btn {
    background: transparent;
    color: #888;
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reading-restart-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #ccc;
}

/* Hide Segui il Filo until end of article */
.reading-mode-active .thread-container,
.reading-mode-active .thread-inline-fallback,
.reading-mode-active .main-footer {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.reading-mode-active.reading-completed .thread-container,
.reading-mode-active.reading-completed .thread-inline-fallback,
.reading-mode-active.reading-completed .main-footer {
    opacity: 1;
    visibility: visible;
}

/* Disable animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reading-mode-toolbar,
    .reading-mode-active .thread-container {
        transition: none !important;
    }
    .reading-progress-bar {
        transition: none !important;
    }
}
