@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Theme variables (dark default) ── */
:root {
    --bg: #0a0a0b;
    --text: #e0e0e0;
    --border: #1a1a1f;
    --header-h1: #ffffff;
    --heading: #ffffff;
    --muted: #555;
    --muted2: #888;
    --footer-color: #333;
    --card-bg: #111113;
    --card-border: #1a1a1f;
    --card-border-hover: #2a2a2f;
    --tag-border: #2a2a2f;
    --toggle-color: #555;
    --accent: #c9a84c;
    --accent-muted: #8a6e2a;
    --nav-hover: #aaa;
}

:root.light {
    --bg: #f9f9f9;
    --text: #1a1a1a;
    --border: #e0e0e0;
    --header-h1: #000;
    --heading: #000;
    --muted: #666;
    --muted2: #666;
    --footer-color: #aaa;
    --card-bg: #f0f0f0;
    --card-border: #e0e0e0;
    --card-border-hover: #ccc;
    --tag-border: #d0d0d0;
    --toggle-color: #888;
    --accent: #a07830;
    --accent-muted: #7a5c20;
    --nav-hover: #1a1a1a;
}

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

/* ── Body ── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

/* ── Page header ── */
header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-family: 'Crimson Text', serif;
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--header-h1);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.2;
}

header p {
    color: var(--muted2);
    font-size: 0.95rem;
}

/* ── Footer ── */
footer {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--footer-color);
    font-size: 0.75rem;
}

/* ── Theme toggle button ── */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--toggle-color);
    padding: 6px;
    z-index: 1000;
}
#theme-toggle:hover { color: var(--nav-hover); }

/* ── Sidebar nav ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 180px;
    padding: 48px 24px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    background: var(--bg);
}

.sidebar-name {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--header-h1);
    margin-bottom: 24px;
    text-decoration: none;
    display: block;
}

.sidebar a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.2s;
    padding: 2px 0;
    display: block;
}
.sidebar a:hover { color: var(--accent); }
.sidebar a.active { color: var(--accent); }

/* ── Main container ── */
.container {
    margin-left: 180px;
    max-width: 720px;
    padding: 60px 48px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 20px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        gap: 12px;
    }
    .sidebar-name { margin-bottom: 0; margin-right: 8px; }
    .container { margin-left: 0; padding: 32px 24px; }
}

@media (max-width: 600px) {
    header h1 { font-size: 1.8rem; }
}

/* ── Shared: Grid pages (films, music, podcasts, people, library) ── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
}

.grid-card {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.grid-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.grid-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    transition: opacity 0.2s, transform 0.3s ease;
}

.grid-card:hover img { opacity: 0.7; transform: scale(1.04); }

.grid-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 20px 10px 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-card:hover .overlay { opacity: 1; }

.overlay .title {
    font-size: 0.78rem;
    color: #fff;
    font-weight: 600;
    line-height: 1.3;
}

.overlay .subtitle {
    font-size: 0.7rem;
    color: #ccc;
    margin-top: 2px;
}

/* ── Shared: Search bar ── */
.search-bar { margin-bottom: 32px; }

.search-bar input {
    width: 100%;
    max-width: 400px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 16px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input::placeholder { color: var(--muted); }
.search-bar input:focus { border-color: var(--muted2); }

/* ── Shared: Empty / not-found states ── */
.empty, .not-found {
    text-align: center;
    color: var(--muted2);
    font-size: 0.95rem;
    padding: 60px 0;
}

/* ── Shared: Empty state (with heading) ── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
}

.empty-state h2 {
    font-family: 'Crimson Text', serif;
    font-size: 1.8rem;
    color: var(--muted2);
    margin-bottom: 8px;
}

/* ── Shared: Back link (detail pages) ── */
.back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--muted2);
    text-decoration: none;
    margin-bottom: 32px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--nav-hover); }

/* ── Shared: Detail page header ── */
.detail-header {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.detail-poster {
    flex-shrink: 0;
    width: 160px;
}

.detail-poster img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.detail-meta { flex: 1; }

.detail-meta h1 {
    font-family: 'Crimson Text', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--header-h1);
    letter-spacing: -0.3px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.detail-meta .info {
    font-size: 1rem;
    color: var(--muted2);
    margin-bottom: 4px;
}

.detail-meta .info-secondary {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.detail-meta .info-date {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Shared: Review text ── */
.review {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

/* ── Shared: Section label (Currently Watching/Reading) ── */
.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-muted);
    margin-bottom: 20px;
    font-weight: 500;
}

.current-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.current-card img {
    width: 80px;
    border-radius: 3px;
    flex-shrink: 0;
}

.current-card .cw-title {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--header-h1);
    margin-bottom: 4px;
}

.current-card .cw-subtitle {
    font-size: 0.82rem;
    color: var(--muted2);
    margin-bottom: 6px;
}

.current-card .cw-date {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Shared: Type badge (music) ── */
.type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: rgba(0,0,0,0.65);
    color: #ccc;
    padding: 3px 7px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

/* ── Shared: Detail page responsive ── */
@media (max-width: 600px) {
    .detail-header { flex-direction: column; }
    .detail-poster { width: 120px; }
    .detail-meta h1 { font-size: 1.6rem; }
}
