:root {
    --bg: #E5E5E0;
    --bg-alt: #F1F5F9;
    --card-bg: #ffffff;
    --text: #09090B;
    --text-muted: #52525B;
    --accent: #7c3aed;
    --accent-hover: #9f7aea;
    --border: #9e9efe;
    --border-alt: #E2E8F0;
    --font-main: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
    --bg: #0f0f0f;
    --bg-alt: #1a1a1a;
    --card-bg: #1e1e1e;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --accent: #9f7aea;
    --accent-hover: #c4b5fd;
    --border: #3f3f6e;
    --border-alt: #2e2e2e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-main); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px; transition: background 0.3s, color 0.3s; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; }
.bg-alt { background: var(--bg-alt); color: var(--text); border-top-color: var(--border-alt); }
.section-title { font-size: 1.6rem; font-weight: 600; margin-bottom: 40px; border-left: 2px solid var(--accent); padding-left: 15px; letter-spacing: -0.5px; }

/* Navbar */
.navbar { position: fixed; width: 100%; top: 0; background: rgba(229, 229, 224, 0.95); backdrop-filter: blur(10px); z-index: 1000; border-bottom: 1px solid var(--border); transition: background 0.3s; }
[data-theme="dark"] .navbar { background: rgba(15, 15, 15, 0.95); }
.nav-container { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; max-width: 1000px; margin: 0 auto; }
.logo { font-family: var(--font-code); font-weight: 700; color: var(--text); font-size: 1rem; letter-spacing: -0.5px; }
.nav-links { display: flex; gap: 30px; }
.nav-links a { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; position: relative; }
.nav-links a:hover { color: var(--accent); }
.nav-links a::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 1px; background: var(--accent); transition: 0.2s; }
.nav-links a:hover::after { width: 100%; }
.theme-switch { display: flex; background: var(--bg-alt); border-radius: 4px; padding: 3px; gap: 2px; border: 1px solid var(--border-alt); }
.theme-switch span { padding: 5px 12px; border-radius: 3px; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: 0.2s; font-family: var(--font-code); }
.theme-switch span.active { background: var(--card-bg); color: var(--text); border: 1px solid var(--border-alt); }

/* Hero */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding-top: 60px; }
.profile-wrapper { margin-bottom: 24px; position: relative; }
.profile-img { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); transition: 0.2s; cursor: pointer; }
.profile-img:hover { border-color: var(--accent); }
.subtitle { font-family: var(--font-code); color: var(--accent); margin-bottom: 8px; letter-spacing: 0.5px; font-size: 1.1rem; font-weight: 500; }
.hero h1 { font-size: 3.2rem; margin-bottom: 16px; line-height: 1.1; letter-spacing: -1px; font-weight: 600; }
.bio { color: var(--text); font-weight: 700; max-width: 650px; margin: 0 auto 24px; font-size: 1.2rem; line-height: 1.7; }

/* Buttons */
.buttons { display: flex; gap: 16px; justify-content: center; margin-bottom: 0; }
.btn { padding: 12px 24px; border-radius: 4px; font-weight: 500; cursor: pointer; display: inline-block; transition: 0.2s; border: 1px solid transparent; font-size: 0.95rem; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.secondary { border: 1px solid var(--border); color: var(--text); background: transparent; }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 20px; }
.card { background: var(--card-bg); border-radius: 6px; border: 1px solid var(--border-alt); overflow: hidden; transition: 0.2s; position: relative; }
.card:hover { border-color: var(--accent); }
.card-image { width: 100%; height: 180px; overflow: hidden; cursor: pointer; position: relative; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.card:hover .card-image img { transform: scale(1.05); }
.card-content { padding: 22px; }
.card h3 { font-size: 1.2rem; margin-bottom: 8px; font-weight: 600; letter-spacing: -0.3px; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 18px; line-height: 1.6; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; font-family: var(--font-code); font-size: 0.75rem; }
.tags span { background: rgba(124, 58, 237, 0.1); color: var(--accent); padding: 4px 10px; border-radius: 3px; border: 1px solid rgba(124, 58, 237, 0.2); }
.tags .skill-note { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); border-color: rgba(148, 163, 184, 0.2); }
.links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.links a { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.links a:hover { color: var(--accent); }
.links button { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; cursor: pointer; font-family: var(--font-main); }
.links button:hover { color: var(--accent); }
.links .download-link, .links .preview-link { color: var(--accent); font-weight: 500; }
.links .preview-link { border: 1px solid var(--accent); padding: 2px 8px; border-radius: 3px; }
.links .preview-link:hover { background: rgba(124, 58, 237, 0.1); }

/* Research */
.list-group { margin-top: 20px; }
.list-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 0; border-bottom: 1px solid var(--border); transition: 0.2s; }
.list-item:hover { background: rgba(124,58,237,0.05); padding-left: 10px; }
.list-item:last-child { border-bottom: none; }
.list-item.text-only { cursor: default; }
.list-item.text-only:hover { background: none; padding-left: 0; }
.list-info { flex: 1; }
.list-info h3 { font-size: 1.15rem; margin-bottom: 6px; font-weight: 600; letter-spacing: -0.3px; display: flex; align-items: center; gap: 10px; }
.page-label { font-family: var(--font-code); font-size: 0.75rem; color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.list-info p { color: var(--text); font-weight: 600; font-size: 1.05rem; line-height: 1.6; max-width: 700px; }
.list-links { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }
.list-links a { font-family: var(--font-code); font-size: 0.85rem; color: var(--accent); font-weight: 500; }
.list-links a:hover { text-decoration: underline; }

/* Skills */
.card h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 600; }
.card h3 i { font-size: 1.2em; }

/* Books */
.subsection-title { margin-top: 60px; margin-bottom: 20px; font-family: var(--font-code); color: var(--text-muted); font-size: 0.9rem; letter-spacing: 0.5px; font-weight: 500; }
.book-card { display: flex; gap: 30px; background: var(--card-bg); padding: 28px; border-radius: 6px; border: 1px solid var(--border-alt); align-items: flex-start; transition: 0.2s; }
.book-card.published-book { border-color: var(--accent); }
.book-card:hover { border-color: var(--accent); }
.book-card.placeholder { opacity: 0.95; }
.book-card.no-cover { flex-direction: column; align-items: flex-start; padding: 24px; }
.book-cover { flex-shrink: 0; position: relative; }
.book-cover img { width: 180px; height: 270px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border-alt); cursor: pointer; transition: 0.2s; }
.book-cover img:hover { border-color: var(--accent); }
.book-cover.empty { width: 180px; height: 270px; background: var(--bg); border: 1px dashed var(--border-alt); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.9rem; font-family: var(--font-code); }
.book-info { flex: 1; }
.book-info.no-cover-info { width: 100%; }
.book-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.status { padding: 2px 8px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; font-family: var(--font-code); }
.status.published { background: var(--accent); color: white; }
.status:not(.published) { background: rgba(124, 58, 237, 0.1); color: var(--accent); border: 1px solid rgba(124, 58, 237, 0.2); }
.book-subtitle { font-style: italic; color: var(--text-muted); margin-bottom: 12px; font-size: 0.95rem; }
.book-desc { color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 12px; }
.small-text { font-size: 0.9rem; color: var(--text-muted); }
.book-card .links a { color: var(--accent); font-weight: 500; font-size: 0.9rem; }

/* Footer */
footer { padding: 80px 0; border-top: 1px solid var(--border); background: var(--bg); text-align: center; }
footer .section-title { color: var(--text); }
.socials { margin: 30px 0; display: flex; justify-content: center; gap: 30px; }
.socials a { font-size: 0.95rem; color: var(--text-muted); }
.socials a:hover { color: var(--accent); }
.copyright { color: var(--text-muted); font-size: 0.85rem; }

/* Modals */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; }
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; width: 100%; height: 100%; background: rgba(229, 229, 224, 0.9); backdrop-filter: blur(5px); }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.85); }
.modal-content { position: relative; background: var(--card-bg); border: 1px solid var(--border-alt); border-radius: 8px; max-width: 650px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 35px; z-index: 2001; color: var(--text); }
.modal-close { position: absolute; top: 18px; right: 22px; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--text-muted); transition: 0.2s; }
.modal-close:hover { color: var(--text); }
.modal-body h2 { font-size: 1.6rem; margin-bottom: 14px; font-weight: 600; letter-spacing: -0.5px; }
.modal-body p { color: var(--text-muted); font-size: 1rem; margin-bottom: 22px; line-height: 1.7; }
.modal-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; font-family: var(--font-code); font-size: 0.8rem; }
.modal-tags span { background: rgba(124, 58, 237, 0.1); color: var(--accent); padding: 4px 10px; border-radius: 3px; border: 1px solid rgba(124, 58, 237, 0.2); }
.modal-details { margin-bottom: 22px; background: var(--bg-alt); padding: 18px; border-radius: 6px; border: 1px solid var(--border-alt); }
.modal-details h4 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.modal-details ul { list-style: disc; padding-left: 20px; color: var(--text-muted); font-size: 0.9rem; }
.modal-details li { margin-bottom: 6px; }
.modal-links { display: flex; gap: 14px; }
.modal-links a { color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.modal-links a:hover { text-decoration: underline; }

/* Lightbox */
.lightbox { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(229, 229, 224, 0.98); align-items: center; justify-content: center; flex-direction: column; padding: 20px; }
[data-theme="dark"] .lightbox { background: rgba(0, 0, 0, 0.98); }
.lightbox.active { display: flex; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: var(--text); font-size: 35px; cursor: pointer; transition: 0.2s; }
.lightbox-close:hover { color: var(--accent); }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); color: var(--text); font-size: 35px; cursor: pointer; transition: 0.2s; user-select: none; }
.lightbox-prev { left: 30px; }
.lightbox-next { right: 30px; }
.lightbox-prev:hover, .lightbox-next:hover { color: var(--accent); }
.lightbox-content { max-width: 90%; max-height: 80vh; object-fit: contain; border-radius: 4px; border: 1px solid var(--border); }
#lightbox-caption { color: var(--text-muted); margin-top: 15px; font-size: 0.95rem; text-align: center; font-family: var(--font-code); }

/* Animations */
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* Mobile */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.4rem; }
    .profile-img { width: 140px; height: 140px; }
    .nav-links { display: none; }
    .theme-switch { margin-left: auto; }
    .list-item { flex-direction: column; gap: 12px; }
    .list-links { margin-left: 0; }
    .book-card { flex-direction: column; align-items: center; text-align: center; }
    .book-header { flex-direction: column; gap: 8px; }
    .lightbox-prev { left: 15px; font-size: 28px; }
    .lightbox-next { right: 15px; font-size: 28px; }
    .buttons { flex-direction: column; gap: 12px; }
    .btn { width: 100%; text-align: center; }
    .subtitle { font-size: 1rem; }
    .bio { font-size: 1.1rem; }
}