:root {
    --background-color: #141414;
    --surface-color: #1f1f1f;
    --surface-hover: #2a2a2a;
    --primary-color: #e50914;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --spacing-unit: 8px;
    --border-radius: 4px;
    --transition-speed: 0.3s;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

/* Header */
.header {
    padding: 20px 4%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    position: fixed;
    width: 100%;
    z-index: 100;
    top: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    height: 70px;
}

.logo {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Main Layout */
.container {
    padding: 100px 4% 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.breadcrumbs {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumbs a:hover {
    color: var(--text-primary);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 40px 20px;
    /* Row gap, Column gap */
}

/* Card */
.card {
    background-color: transparent;
    border-radius: var(--border-radius);
    transition: transform var(--transition-speed);
    position: relative;
    cursor: pointer;
}

.card:hover {
    z-index: 10;
}

.card-media {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card:hover .card-media {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding-top: 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-badge {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Details Page Layout */
.details-layout {
    min-height: 100vh;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
}

.details-header {
    padding: 20px 4%;
    display: flex;
    align-items: center;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.back-icon {
    font-size: 1.2rem;
}

.details-container {
    flex-grow: 1;
    padding: 20px 4% 60px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    /* Center vertically if content is short */
}

.hero-section {
    display: flex;
    gap: 60px;
    width: 100%;
    align-items: flex-start;
}

.hero-cover {
    flex-shrink: 0;
    width: 300px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    aspect-ratio: 2/3;
}

.hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 15px 0;
    line-height: 1.1;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.meta-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.hero-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.btn-primary-lg,
.btn-secondary-lg {
    padding: 15px 40px;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary-lg {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary-lg:hover {
    background-color: #ff0a16;
    transform: scale(1.05);
}

.btn-secondary-lg {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary-lg:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.hero-description h3 {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-description p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ddd;
    max-width: 800px;
}

/* PDF Overlay */
.pdf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pdf-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-toolbar {
    height: 60px;
    background-color: #111;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #333;
    justify-content: space-between;
    flex-wrap: nowrap;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px;
}

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

.overlay-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30%;
    font-size: 0.9rem;
}

.overlay-content {
    flex-grow: 1;
    position: relative;
    overflow: auto;
    background-color: #0c0c0c;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.reader-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background-color: #000;
    /* Enable touch scrolling */
    -webkit-overflow-scrolling: touch;
}

#pdf-wrapper {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    /* Ensure canvas doesn't overflow horizontally without scroll */
    max-width: 100%;
}

#pdf-render {
    display: block;
    max-width: 100%;
    height: auto;
}

.reader-controls {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 900px) {
    .hero-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }

    .hero-cover {
        width: 200px;
    }

    .hero-info {
        align-items: center;
    }

    .hero-meta {
        justify-content: center;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .btn-primary-lg,
    .btn-secondary-lg {
        width: 100%;
    }

    .hero-title {
        font-size: 2rem;
    }

    .overlay-toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
        gap: 10px;
        justify-content: center;
    }

    .overlay-title {
        display: none;
        /* Hide title on mobile reader to save space */
    }

    .reader-controls {
        width: 100%;
        justify-content: center;
    }
}
/* Specific Mobile Viewer Optimizations */
@media (max-width: 768px) {
    .overlay-toolbar {
        padding: 0 5px;
        height: 50px;
    }
    
    .overlay-title {
        display: none !important; 
    }
    
    .reader-container {
        padding: 10px 0; 
    }
    
    .control-btn {
        width: 40px; 
        height: 40px;
        font-size: 1.2rem;
    }
    
    .reader-controls {
        gap: 15px;
    }
}
