/* ============================================
   Resource Reader Styles
   Protected content viewing experience
   ============================================ */

/* ============================================
   Unlock Page
   ============================================ */
.resource-unlock {
    min-height: 100vh;
    padding: calc(var(--nav-height) + 60px) 24px 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--color-bg) 0%, #0a0a0a 100%);
}

.unlock-container {
    max-width: 560px;
    width: 100%;
}

.unlock-header {
    text-align: center;
    margin-bottom: 40px;
}

.unlock-image {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 32px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.unlock-image img {
    width: 100%;
    height: auto;
}

.unlock-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(230, 92, 0, 0.1);
    border: 1px solid rgba(230, 92, 0, 0.3);
    border-radius: 100px;
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.unlock-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--color-text);
}

.unlock-description {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.unlock-form-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 40px;
}

.unlock-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.unlock-form-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.unlock-form-header p {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

.unlock-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.9375rem;
    margin-bottom: 24px;
}

.unlock-error svg {
    flex-shrink: 0;
}

.unlock-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.key-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.key-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.key-input-group input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    color: var(--color-text);
    text-align: center;
    text-transform: uppercase;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.key-input-group input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.5;
}

.key-input-group input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(230, 92, 0, 0.2);
}

.key-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
}

.unlock-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--color-accent);
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.unlock-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
}

.unlock-button:active {
    transform: translateY(0);
}

.unlock-help {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.unlock-help p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.unlock-help a {
    color: var(--color-accent);
    font-weight: 500;
}

.unlock-help a:hover {
    text-decoration: underline;
}

/* ============================================
   Preview Banner
   ============================================ */
:root {
    --preview-banner-height: 0px;
}

.preview-banner {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    height: 44px;
    background: linear-gradient(90deg, #e65c00, #ff8c00);
    color: white;
    padding: 10px 20px;
    text-align: center;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
}

.preview-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 20px;
    font-size: 14px;
    transition: background 0.2s ease;
}

.preview-back-link:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* ============================================
   TOC Sidebar
   ============================================ */
.toc-sidebar {
    position: fixed;
    top: var(--nav-height);
    left: -320px;
    width: 320px;
    height: calc(100vh - var(--nav-height));
    background: rgba(10, 10, 10, 0.98);
    border-right: 1px solid var(--color-border);
    z-index: 2000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.toc-sidebar.open {
    left: 0;
}

.toc-overlay {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    z-index: 1999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toc-overlay.open {
    opacity: 1;
    visibility: visible;
}

.toc-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.toc-sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text);
    margin: 0;
}

.toc-close-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toc-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}

.toc-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.toc-resource-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.toc-resource-desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.toc-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.toc-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toc-sidebar-item.active {
    background: rgba(230, 92, 0, 0.15);
    border: 1px solid rgba(230, 92, 0, 0.3);
}

.toc-sidebar-number {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.toc-sidebar-item.active .toc-sidebar-number {
    background: var(--color-accent);
    color: white;
}

.toc-sidebar-title {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.toc-current-badge {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    background: rgba(230, 92, 0, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ============================================
   Reader Layout
   ============================================ */
.resource-reader {
    min-height: calc(100vh - var(--nav-height) - 80px);
    padding-top: calc(var(--nav-height) + var(--preview-banner-height));
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
}

/* Progress Bar */
.reader-progress {
    position: fixed;
    top: calc(var(--nav-height) + var(--preview-banner-height));
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--color-border);
    z-index: 998;
}

.progress-bar {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

/* Reader Sub-Header (below main nav) */
.reader-subheader {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
}

.reader-subheader-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.reader-toc-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reader-toc-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border-color: var(--color-accent);
}

/* Removed - title now in article header */

.reader-section-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.reader-section-indicator .current {
    color: var(--color-accent);
    font-weight: 600;
}

.reader-section-indicator .separator {
    color: var(--color-text-muted);
}

.reader-section-indicator .total {
    color: var(--color-text-muted);
}

/* Reader Content */
.reader-content {
    flex: 1;
    padding: 60px 24px 120px;
}

.reader-article {
    max-width: 720px;
    margin: 0 auto;
}

.article-header {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 3px double var(--color-border);
}

.article-resource-title {
    font-family: var(--font-body);
    font-size: 2rem;
    font-weight: 500;
    color: var(--color-accent);
    margin-bottom: 8px;
    line-height: 1.3;
}

.article-section-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.article-section-number {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* Prose Styling */
.article-body.prose {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--color-text);
}

.prose h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 48px 0 24px;
    color: var(--color-text);
}

.prose h3 {
    font-family: var(--font-heading);
    font-size: 1.375rem;
    font-weight: 600;
    margin: 36px 0 16px;
    color: var(--color-text);
}

.prose h4 {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--color-text);
}

.prose p {
    margin-bottom: 24px;
}

.prose strong {
    font-weight: 600;
    color: var(--color-text);
}

.prose em {
    font-style: italic;
}

.prose a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: var(--color-accent-hover);
}

.prose ul,
.prose ol {
    margin: 24px 0;
    padding-left: 24px;
}

.prose li {
    margin-bottom: 12px;
    list-style: disc;
}

.prose ol li {
    list-style: decimal;
}

.prose blockquote {
    margin: 32px 0;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.prose blockquote p:last-child {
    margin-bottom: 0;
}

.prose hr {
    margin: 48px 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

.prose code {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.875em;
}

.prose pre {
    margin: 24px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow-x: auto;
}

.prose pre code {
    padding: 0;
    background: none;
}

/* Reader Navigation */
.reader-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--color-border);
    z-index: 1000;
}

.reader-nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
    min-width: 200px;
}

.nav-button:hover:not(.disabled):not(.nav-complete) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
}

.nav-button.disabled {
    opacity: 0;
    pointer-events: none;
}

.nav-button.nav-complete {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.nav-button.nav-complete svg {
    color: #22c55e;
}

.nav-prev {
    justify-content: flex-start;
}

.nav-next {
    justify-content: flex-end;
}

.nav-button svg {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.nav-button:hover:not(.disabled):not(.nav-complete) svg {
    color: var(--color-accent);
}

.nav-button-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-prev .nav-button-text {
    text-align: left;
}

.nav-next .nav-button-text {
    text-align: right;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.nav-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.nav-dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    background: var(--color-border);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.nav-dot:hover {
    background: var(--color-text-muted);
    transform: scale(1.2);
}

.nav-dot.active {
    background: var(--color-accent);
    transform: scale(1.2);
}

/* ============================================
   Table of Contents
   ============================================ */
.resource-toc {
    min-height: 100vh;
    padding: calc(var(--nav-height) + 60px) 24px 60px;
    background: var(--color-bg);
}

.toc-container {
    max-width: 720px;
    margin: 0 auto;
}

.toc-header {
    margin-bottom: 48px;
}

.toc-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    transition: color var(--transition-fast);
}

.toc-back:hover {
    color: var(--color-accent);
}

.toc-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 16px;
}

.toc-description {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.toc-meta {
    display: flex;
    align-items: center;
    gap: 24px;
}

.toc-sections-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.toc-nav {
    margin-bottom: 48px;
}

.toc-nav-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    counter-reset: toc-counter;
    list-style: none;
    padding: 0;
}

.toc-item {
    counter-increment: toc-counter;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.toc-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-accent);
    transform: translateX(4px);
}

.toc-number {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-accent);
    min-width: 28px;
}

.toc-section-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
}

.toc-arrow {
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.toc-link:hover .toc-arrow {
    opacity: 1;
    color: var(--color-accent);
}

.toc-actions {
    text-align: center;
}

.toc-start-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--color-accent);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    transition: all var(--transition-fast);
}

.toc-start-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
}

/* ============================================
   Not Found Page
   ============================================ */
.resource-not-found {
    min-height: 100vh;
    padding: calc(var(--nav-height) + 60px) 24px 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.not-found-container {
    text-align: center;
    max-width: 400px;
}

.not-found-icon {
    margin-bottom: 32px;
    color: var(--color-text-muted);
}

.not-found-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.not-found-message {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.not-found-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.not-found-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
}

/* Footer spacing for resource reader pages (account for fixed bottom nav) */
body:has(.resource-reader) .footer {
    margin-bottom: 80px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .unlock-title {
        font-size: 1.75rem;
    }

    .unlock-form-wrapper {
        padding: 24px;
    }

    .key-input-group input {
        font-size: 1rem;
        padding: 14px 16px;
    }

    .reader-subheader-content {
        padding: 0 16px;
    }

    .reader-content {
        padding: 40px 16px 140px;
    }

    .article-section-title {
        font-size: 1.75rem;
    }

    .toc-sidebar {
        width: 280px;
        left: -280px;
    }

    .reader-toc-btn span {
        display: none;
    }

    .reader-toc-btn {
        padding: 8px;
    }

    .article-body.prose {
        font-size: 1rem;
    }

    .prose h2 {
        font-size: 1.5rem;
    }

    .prose h3 {
        font-size: 1.25rem;
    }

    .reader-nav-content {
        padding: 12px 16px;
    }

    .nav-button {
        min-width: auto;
        padding: 10px 14px;
    }

    .nav-title {
        display: none;
    }

    .nav-dots {
        display: none;
    }

    .toc-title {
        font-size: 1.75rem;
    }

    .toc-link {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .unlock-container {
        padding: 0;
    }

    .unlock-badge {
        font-size: 0.6875rem;
    }

    .reader-toc-link span {
        display: none;
    }

    .reader-toc-link {
        padding: 8px;
    }
}
