@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Lato:wght@300;400&display=swap');

:root {
    --paper-colour: #fdfaf3;
    --leather-colour: #2c1e16;
    --gold-accent: #c5a059;
    --text-colour: #333333;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--leather-colour);
    color: var(--paper-colour);
    min-height: 100vh;
}

h1, h2, h3, .book-title {
    font-family: 'Playfair Display', serif;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(to bottom, #1a110c, var(--leather-colour));
    border-bottom: 2px solid var(--gold-accent);
}

header h1 { font-size: 2.5rem; color: var(--gold-accent); letter-spacing: 2px; }
header p { font-style: italic; opacity: 0.8; margin-top: 0.5rem; }

/* Library Gallery (Preview Mode) */
.library-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 3D Book CSS */
.book-wrapper {
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.book-wrapper:hover { transform: translateY(-10px); }

.book {
    width: 200px;
    height: 300px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-20deg);
    transition: transform 0.5s ease;
    box-shadow: inset 4px 0 10px rgba(0,0,0,0.1), 5px 5px 15px rgba(0,0,0,0.5);
    background-color: var(--gold-accent);
    border-radius: 2px 6px 6px 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.book::before {
    content: '';
    position: absolute;
    left: 0;
    width: 15px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.2), rgba(0,0,0,0.2));
    border-radius: 2px 0 0 2px;
}

.book-title {
    color: var(--leather-colour);
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 2;
}

/* Full-Screen Reader Overlay */
#reader-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    flex-direction: column;
}

.reader-toolbar {
    background-color: #111;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.reader-toolbar button {
    background: transparent;
    border: 1px solid var(--gold-accent);
    color: var(--gold-accent);
    padding: 0.5rem 1.5rem;
    font-family: 'Playfair Display', serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reader-toolbar button:hover { background: var(--gold-accent); color: var(--leather-colour); }

#pdf-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    background-color: #222; /* Desk colour */
}

/* The actual high-res page */
canvas {
    background-color: var(--paper-colour);
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    max-width: 100%;
    height: auto !important;
}

/* Admin Panel */
.admin-form {
    max-width: 500px;
    margin: 4rem auto;
    background: var(--paper-colour);
    color: var(--text-colour);
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.admin-form input, .admin-form button {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid #ccc;
    font-family: 'Lato', sans-serif;
}

.admin-form button {
    background-color: var(--leather-colour);
    color: var(--gold-accent);
    border: none;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
}