:root {
    --text-color: #333;
    --link-color: #0071bc;
    --bg-color: #ffffff;
    --section-margin: 40px;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
    max-width: 850px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ====== NAVIGATION ====== */

.nav-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: #fff;
    border: 1px solid #eee;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-color);
}
.nav-menu {
    position: fixed;
    top: 0;
    right: -250px;
    width: 250px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    z-index: 999;
    transition: right 0.3s ease;
    padding-top: 80px;
}
.nav-menu.active {
    right: 0;
}
.nav-menu ul {
    list-style: none;
    padding: 0;
}
.nav-menu li {
    padding: 12px 30px;
}
.nav-menu a {
    font-size: 1.05rem;
    color: var(--text-color);
    text-decoration: none;
    display: block;
}
.nav-menu a:hover {
    color: var(--link-color);
}

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

header {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-text h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 500;
}

.header-text h1 a {
    color: inherit;
    text-decoration: none;
}

.header-text p {
    margin: 4px 0 0;
    color: #555;
}

.profile-pic {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 20px;
}

/* ====== SECTIONS ====== */

section {
    margin-bottom: var(--section-margin);
}

h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-top: 30px;
    color: #222;
}

h3 {
    font-size: 1.1rem;
    color: #333;
    margin-top: 20px;
    margin-bottom: 8px;
}

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

a:hover {
    text-decoration: underline;
}

/* ====== CV STYLES (index / curriculum) ====== */

.cv-item {
    margin-bottom: 8px;
}

.cv-date {
    font-weight: bold;
    color: #555;
    min-width: 160px;
    display: inline-block;
}

/* ====== CV TIMELINE (curriculum.html) ====== */

.cv-section {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-bottom: 10px;
}

.cv-entry {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.cv-entry-date {
    min-width: 140px;
    color: #666;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.cv-entry-logo {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
}

.cv-entry-logo img {
    max-width: 80px;
    max-height: 45px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
}

.cv-entry-info h3 {
    margin: 0 0 2px;
    font-size: 0.97rem;
    font-weight: 600;
}

.cv-entry-info h4 {
    margin: 0 0 4px;
    font-size: 0.9rem;
    color: #555;
    font-weight: normal;
}

.cv-entry-info p {
    margin: 2px 0;
    font-size: 0.88rem;
    color: #666;
}

.cv-highlight {
    color: var(--link-color);
    font-style: italic;
}

/* ====== PUBLICATIONS ====== */

.pub-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pub-item {
    margin-bottom: 14px;
    padding-left: 35px;
    position: relative;
    padding-top: 2px;
    padding-bottom: 2px;
}

.pub-number {
    position: absolute;
    left: 0;
    color: #888;
    font-size: 0.9rem;
}

.pub-title {
    color: var(--link-color);
    text-decoration: underline;
    font-weight: 500;
}

.me {
    font-weight: bold;
}

.impact-factor {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

/* Publication type badges */
.pub-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-right: 5px;
}

.badge-journal    { background: #d4edda; color: #155724; }
.badge-conference { background: #cce5ff; color: #004085; }
.badge-workshop   { background: #fff3cd; color: #856404; }
.badge-chapter    { background: #e2d9f3; color: #492992; }
.badge-preprint   { background: #f8d7da; color: #721c24; }
.badge-q1 { background: #155724; color: #fff; font-size: 0.65rem; }
.badge-q2 { background: #1a4f8a; color: #fff; font-size: 0.65rem; }
.badge-q3 { background: #7a5c00; color: #fff; font-size: 0.65rem; }

.year-heading {
    font-size: 1.1rem;
    font-weight: bold;
    color: #aaa;
    margin-top: 28px;
    margin-bottom: 14px;
    border-bottom: none;
    padding-bottom: 0;
    letter-spacing: 0.05em;
}

/* Small link buttons */
.pub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.pub-link {
    font-size: 0.75rem;
    padding: 2px 9px;
    border: 1px solid var(--link-color);
    border-radius: 3px;
    color: var(--link-color);
    text-decoration: none;
}

.pub-link:hover {
    background: var(--link-color);
    color: #fff;
    text-decoration: none;
}

/* ====== LOGO GRID ====== */

.logo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 20px 0;
}

.logo-grid img {
    height: 60px;
    max-width: 114px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.logo-grid img:hover {
    filter: grayscale(0%);
    opacity: 1;
}

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

.blog-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.blog-card {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
}

.blog-card img {
    width: 140px;
    height: 95px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 3px;
}

.blog-card-text h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.blog-card-text .meta {
    color: #888;
    font-size: 0.82rem;
    margin-bottom: 6px;
    display: block;
}

.blog-card-text p {
    margin: 0;
    font-size: 0.88rem;
    color: #555;
}

/* ====== TALKS / IFRAMES ====== */

.talk-entry {
    margin-bottom: 32px;
}

.talk-entry iframe {
    max-width: 100%;
    display: block;
    border: none;
}

.talk-entry h3 {
    margin: 10px 0 2px;
    font-size: 1rem;
}

.talk-entry .meta {
    color: #888;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}

/* ====== CONTACT ====== */

.contact-info {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.contact-info li {
    margin-bottom: 6px;
    color: #555;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 520px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    color: var(--text-color);
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form button {
    align-self: flex-start;
    padding: 10px 24px;
    background: var(--link-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
}

.contact-form button:hover {
    background: #005a96;
}

/* ====== VISITOR MAP ====== */

.visitor-map {
    margin: 30px auto;
    text-align: center;
    max-width: 400px;
    overflow: hidden;
}

.visitor-map img, .visitor-map canvas, .visitor-map a {
    max-width: 100% !important;
    height: auto !important;
}

/* ====== DARK MODE ====== */

.dark-btn {
    position: fixed;
    top: 27px;
    right: 77px;
    z-index: 1001;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    filter: grayscale(1) opacity(0.55);
}

html[data-theme="dark"] {
    --text-color: #d0d0d0;
    --link-color: #6fb3ff;
    --bg-color: #1e1e1e;
}
html[data-theme="dark"] body {
    background-color: #1e1e1e;
}
html[data-theme="dark"] h2 {
    color: #c0c0c0;
    border-bottom-color: #444;
}
html[data-theme="dark"] h3 {
    color: #c8c8c8;
}
html[data-theme="dark"] header {
    border-bottom-color: #444;
}
html[data-theme="dark"] .header-text p {
    color: #aaa;
}
html[data-theme="dark"] .nav-toggle {
    background: #2a2a2a;
    border-color: #444;
}
html[data-theme="dark"] .nav-toggle span {
    background: #d0d0d0;
}
html[data-theme="dark"] .nav-menu {
    background: #2a2a2a;
}
html[data-theme="dark"] .nav-menu a {
    color: #d0d0d0;
}
html[data-theme="dark"] .dark-btn {
    background: none;
    border: none;
    filter: none;
    color: #fff;
}
html[data-theme="dark"] .blog-card {
    border-bottom-color: #444;
}
html[data-theme="dark"] .blog-card-text p,
html[data-theme="dark"] .blog-card-text .meta {
    color: #aaa;
}
html[data-theme="dark"] .cv-date,
html[data-theme="dark"] .cv-entry-date,
html[data-theme="dark"] .cv-entry-info h4,
html[data-theme="dark"] .cv-entry-info p {
    color: #aaa;
}
html[data-theme="dark"] .contact-info li {
    color: #aaa;
}
html[data-theme="dark"] .contact-form input,
html[data-theme="dark"] .contact-form textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #d0d0d0;
}
html[data-theme="dark"] .year-heading {
    color: #666;
}
html[data-theme="dark"] .impact-factor {
    color: #999;
}
html[data-theme="dark"] .pub-link {
    border-color: #6fb3ff;
    color: #6fb3ff;
}
html[data-theme="dark"] .pub-link:hover {
    background: #6fb3ff;
    color: #1e1e1e;
}

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

@media (max-width: 600px) {
    header { flex-direction: column-reverse; text-align: center; }
    .profile-pic { margin-left: 0; margin-bottom: 20px; }
    .cv-date { display: block; margin-bottom: 2px; }
    .cv-entry { flex-direction: column; gap: 6px; }
    .cv-entry-date { min-width: auto; }
    .cv-entry-logo { display: none; }
    .blog-card { flex-direction: column; }
    .blog-card img { width: 100%; height: 180px; }
    .talk-entry iframe { height: 200px; }
    .pub-links { gap: 4px; }
}
