:root {
  /* Map to Global Theme Variables (from index.css) */
  --bg: var(--bg-color);
  --text: var(--text-main);
  --text-muted: var(--text-muted);
  --border: var(--border-color);
  
  /* Library Specifics via Global Vars or Fallbacks */
  --surface: var(--card-bg);
  --surface-highlight: var(--border-color);
  --accent: var(--accent-color); 
  
  --status-to_read: #666;
  --status-reading: #d97706;
  --status-completed: #059669;
  --status-abandoned: #dc2626;

  /* Type */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Newsreader', serif;
  
  /* Spacing */
  --container-width: 1200px;
  --gap: 2rem;
  
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 24px;
}

/* 
   Dark Mode is now handled by index.css setting the global variables 
   (--bg-color, etc.) which are mapped above. 
   No extra media query needed here.
*/

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

/* 
   Removed global body reset to avoid overriding index.css.
   If specific library font is needed, scope it to a wrapper.
*/
.library-wrapper {
    font-family: var(--font-body);
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.1;
    margin: 0 0 1rem 0;
    color: var(--text);
}

a { color: inherit; text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

img { max-width: 100%; height: auto; display: block; }

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--gap);
    width: 100%;
}

.site-header {
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.site-main {
    flex: 1;
    padding-bottom: 4rem;
}

.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: var(--font-heading);
    text-align: center;
}

/* Home / Grid */
.page-header {
    margin-bottom: 4rem;
    text-align: center;
}

.page-header h1 {
    font-size: 4rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.intro {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 3rem 2rem;
}

/* Book Card */
.book-card {
    position: relative;
}

.book-cover-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1rem;
}

.book-card:hover .book-cover-wrapper {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

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

.placeholder-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    border: 1px dashed var(--border);
}

.book-info {
    text-align: center;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.book-author {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    font-style: italic;
}

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.status-to_read { color: #fff; border: 1px solid var(--status-to_read); }
.status-reading { color: var(--status-reading); border: 1px solid var(--status-reading); }
.status-completed { color: var(--status-completed); border: 1px solid var(--status-completed); }

/* Single Publication */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-muted);
}
.back-link:hover { color: var(--accent); }

.publication-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 768px) {
    .publication-layout {
        grid-template-columns: 350px 1fr;
        gap: 4rem;
    }
}

.publication-cover {
    position: sticky;
    top: 2rem;
}

.publication-cover img {
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.publication-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.publication-title {
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.publication-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 1rem;
}

.publication-author {
    font-size: 1.25rem;
    font-style: italic;
}

.publication-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-md);
}

@media (min-width: 600px) {
    .publication-meta-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-item .label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.meta-item .value {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-badge.status-reading { background: rgba(255, 170, 0, 0.1); color: var(--status-reading); }
.status-badge.status-completed { background: rgba(0, 255, 128, 0.1); color: var(--status-completed); }
.status-badge.status-to_read { background: rgba(255, 255, 255, 0.1); }

.section-label {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.text-content {
    font-size: 1.2rem;
    max-width: 65ch;
}
.text-content p {
    margin-bottom: 1.5rem;
}

.publication-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    transition: all 0.2s;
}

.tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.library-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.filter-tag {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 99px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-tag:hover,
.filter-tag.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255,255,255,0.02);
}

.filter-tag .count {
    font-size: 0.75rem;
    opacity: 0.6;
    background: var(--surface);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
