/* ========== HEINLEIN TRIBUTE CSS ========== */
/* Dark/light theme with CSS variables. Dark is default for Le's eyes. */
/* Version: 1.0 */

:root {
    --bg: #0d1117;
    --bg-elevated: #161b22;
    --bg-card: #1c2330;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --text-faint: #6e7681;
    --border: #30363d;
    --accent: #e67e22;
    --accent-hover: #f39c12;
    --accent-dim: rgba(230, 126, 34, 0.15);
    --link: #58a6ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
    --max-width: 1200px;
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.25s ease;
}

[data-theme="light"] {
    --bg: #f6f8fa;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --text: #1f2328;
    --text-dim: #59636e;
    --text-faint: #818b98;
    --border: #d1d9e0;
    --accent: #c2410c;
    --accent-hover: #ea580c;
    --accent-dim: rgba(194, 65, 12, 0.1);
    --link: #0969da;
    --success: #1a7f37;
    --warning: #9a6700;
    --danger: #d1242f;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* ========== TYPOGRAPHY ========== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }

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

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

/* ========== LAYOUT ========== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 3rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-dim);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ========== HEADER / NAV ========== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-brand:hover { color: var(--accent-hover); }

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: var(--accent-dim);
}

.nav-links a i { font-size: 0.85rem; }

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(15deg);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
}

/* ========== HERO ========== */

.hero {
    text-align: center;
    padding: 5rem 0 4rem;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse at center, var(--accent-dim) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

.hero .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0.4rem 1.2rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.hero .hero-badge i { color: var(--accent); }

.hero h1 {
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-dim);
    max-width: 650px;
    margin: 0 auto 2rem;
}

.hero .hero-meta {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}

.hero .meta-item {
    text-align: center;
}

.hero .meta-item .meta-number {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.hero .meta-item .meta-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.hero .hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #fff;
    padding: 0.85rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition);
    box-shadow: 0 4px 20px var(--accent-dim);
}

.hero .hero-cta:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-dim);
    color: #fff;
}

/* ========== CARDS ========== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.card:hover::before { transform: scaleX(1); }

/* Book card */
.book-card .book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    background: var(--bg-elevated);
}

.book-card .book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: transform var(--transition);
}

.book-card:hover .book-cover img {
    transform: scale(1.03);
}

.book-card .book-cover.no-cover {
    background: linear-gradient(160deg, var(--cover-color, #4a90d9) 0%, var(--cover-color-dark, #2c5aa0) 100%);
}

.book-card .book-cover.no-cover .book-title-on-cover {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-align: center;
    padding: 1rem;
    line-height: 1.3;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.book-card .book-cover.no-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 40%, rgba(0,0,0,0.2) 100%);
}

.book-card .book-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.book-card .book-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
}

.book-card .book-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    background: var(--accent-dim);
    color: var(--accent);
}

.book-card .book-tag.adult { background: rgba(88, 166, 255, 0.15); color: var(--link); }

.book-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.book-card .book-synopsis {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.book-card .book-star {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--accent);
    font-size: 1rem;
}

/* Quote card */
.quote-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.5rem 1.25rem;
    position: relative;
    transition: all var(--transition);
}

.quote-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.quote-card .quote-icon {
    color: var(--accent);
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.quote-card .quote-text {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--text);
}

.quote-card .quote-source {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-style: italic;
}

.quote-card .quote-theme {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    background: var(--accent-dim);
    color: var(--accent);
    margin-top: 0.5rem;
}

/* ========== QUOTE WALL (masonry-ish) ========== */

.quote-wall {
    columns: 3;
    column-gap: 1.5rem;
}

.quote-wall .quote-card {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
}

@media (max-width: 900px) { .quote-wall { columns: 2; } }
@media (max-width: 600px) { .quote-wall { columns: 1; } }

/* ========== TIMELINE ========== */

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 3px solid var(--accent);
    z-index: 1;
}

.timeline-item .timeline-year {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.timeline-item .timeline-event {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ========== THEMES ========== */

.theme-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all var(--transition);
}

.theme-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.theme-card .theme-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.theme-card h3 {
    margin-bottom: 0.5rem;
}

.theme-card .theme-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.theme-card .theme-books {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.theme-card .theme-book-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-dim);
}

/* ========== FILTERS ========== */

.filter-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0.45rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ========== FOOTER ========== */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0 2rem;
    margin-top: 3rem;
    text-align: center;
}

.site-footer .footer-text {
    color: var(--text-faint);
    font-size: 0.85rem;
}

.site-footer .footer-quote {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.site-footer .footer-quote .fq-source {
    display: block;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--text-faint);
    margin-top: 0.3rem;
}

/* ========== MISC ========== */

.badge-famous {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .nav-toggle { display: flex; align-items: center; justify-content: center; }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0; right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0.25rem;
        align-items: stretch;
    }

    .nav-links.open { display: flex; }

    .nav-links a { padding: 0.7rem 1rem; }

    .hero { padding: 3rem 0 2.5rem; }
    .hero .hero-meta { gap: 1.25rem; }
    .hero .meta-item .meta-number { font-size: 1.5rem; }

    .section { padding: 2rem 0; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
    .theme-card { padding: 1.5rem; }
}
