/* ==========================================================================
   Milind Nakul - academic homepage
   Layout and type follow https://himadrispandey.github.io/, with a dark
   palette added (the original is light-only) and Google-hosted Lato standing
   in for the template's self-hosted Aileron.
   ========================================================================== */

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

/* --- Light palette (default) ------------------------------------------- */
:root {
    --primary-color: #a38f61;
    --primary-hover: #8c7a51;
    --text-dark: #2c3e50;
    --text-muted: #5a6c7d;
    --bg-light: #f8f9fa;
    --bg-section: #ffffff;
    --border-color: #e9ecef;
    --nav-bg: rgba(255, 255, 255, 0.97);
    --on-primary: #ffffff;
    --mark-bg: #fff3cd;
    --gold: #d4af37;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.10);
}

/* --- Dark palette -------------------------------------------------------
   Three states. With no explicit choice the OS decides, so the media query
   below applies - but it is guarded against [data-theme="light"] so picking
   light on a dark-set machine actually sticks. The [data-theme="dark"] block
   then wins in the other direction, on a light-set machine.

   The two blocks are intentional duplicates: plain CSS has no way to reuse a
   declaration list. Edit a colour in one, edit it in the other.
   ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #c9b078;
        --primary-hover: #dcc490;
        --text-dark: #e6e9ec;
        --text-muted: #a3adb8;
        --bg-light: #14171a;
        --bg-section: #1c2024;
        --border-color: #2c3238;
        --nav-bg: rgba(20, 23, 26, 0.97);
        --on-primary: #14171a;
        --mark-bg: #4a3f1c;
        --gold: #e0c458;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
        --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
    }
}

:root[data-theme="dark"] {
    --primary-color: #c9b078;
    --primary-hover: #dcc490;
    --text-dark: #e6e9ec;
    --text-muted: #a3adb8;
    --bg-light: #14171a;
    --bg-section: #1c2024;
    --border-color: #2c3238;
    --nav-bg: rgba(20, 23, 26, 0.97);
    --on-primary: #14171a;
    --mark-bg: #4a3f1c;
    --gold: #e0c458;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--text-dark);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

/* Keyboard focus stays visible - the template drops it on selects only. */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 2px;
}

/* --- Navigation --------------------------------------------------------- */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    padding: 0 2rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    gap: 1rem;
}

.nav-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    white-space: nowrap;
}

.nav-brand:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.6rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding: 0.5rem 0;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Theme toggle */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
}

/* Show the moon in light mode, the sun in dark mode - never both. */
.theme-toggle .fa-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .fa-sun {
    display: inline-block;
}

:root[data-theme="dark"] .theme-toggle .fa-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .fa-sun {
        display: inline-block;
    }

    :root:not([data-theme="light"]) .theme-toggle .fa-moon {
        display: none;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    margin: 5px 0;
    transition: 0.3s;
}

/* --- Hero / About ------------------------------------------------------- */
.hero {
    padding: 120px 1rem 60px;
    background: var(--bg-section);
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 4rem;
    align-items: start;
}

.profile-card {
    text-align: center;
}

.profile-image {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.5rem;
    border: 4px solid var(--bg-light);
    box-shadow: var(--shadow-md);
}

.profile-card h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.profile-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.profile-affiliation {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

.profile-affiliation a {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    /* Separates the icon row from the location line above it. Do not move this
       to .profile-affiliation:last-of-type - p.profile-email is the last <p>
       sibling, so that selector never matches. */
    margin-top: 2.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    color: var(--on-primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.profile-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.bio {
    padding-top: 0.5rem;
}

.bio p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-dark);
}

.bio h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.bio ul {
    margin: 0 0 1rem 1.2rem;
}

.bio li {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.bio mark,
.bio .highlight {
    background-color: var(--mark-bg);
    color: var(--text-dark);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 500;
}

.bio-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* --- News --------------------------------------------------------------- */
.news-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.news-section h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

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

.news-list li {
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.news-list li:last-child {
    border-bottom: none;
}

.news-date {
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 0.5rem;
    white-space: nowrap;
}

/* --- Sections ----------------------------------------------------------- */
section {
    padding: 4rem 1rem;
    /* Clear the 70px fixed nav when an #anchor is opened directly. */
    scroll-margin-top: 80px;
}

section:nth-of-type(even) {
    background: var(--bg-section);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

/* --- Publications ------------------------------------------------------- */
.pub-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.pub-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.pub-item:last-child {
    border-bottom: none;
}

.pub-content-wrapper {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.pub-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.pub-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pub-content {
    flex: 1;
    min-width: 0;
}

.pub-title {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
}

.pub-title a {
    color: inherit;
}

.pub-title a:hover {
    color: var(--primary-color);
}

.pub-year {
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

.pub-authors {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.pub-authors strong {
    color: var(--text-dark);
}

.pub-venue {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pub-note-inline {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    font-style: italic;
    color: #e74d3c;
}

.pub-links {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pub-link {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--primary-color);
    transition: all 0.2s ease;
}

.pub-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
    text-decoration: none;
}

/* --- Awards ------------------------------------------------------------- */
.award-year-group {
    margin-bottom: 1.5rem;
}

.award-year-header {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.awards-list {
    list-style: none;
}

.award-item-wrapper {
    padding: 0.25rem 0;
}

.award-item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 1.05rem;
    color: var(--text-dark);
}

.award-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    color: var(--gold);
}

.award-comment-wrapper {
    margin-top: 0.15rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Service ------------------------------------------------------------ */
.service-category {
    margin-bottom: 1.5rem;
}

.service-category h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

/* Service and teaching tables hug their content; the talks table fills the row. */
.service-items-table,
.teaching-items-table {
    border-collapse: collapse;
    margin-top: 0.25rem;
    font-size: 1.05rem;
}

.talks-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 1100px;
    font-size: 1.05rem;
}

.service-item-row td,
.teaching-item-row td {
    padding: 0.2rem 0;
    color: var(--text-muted);
    vertical-align: top;
}

.service-item-row .service-col1,
.teaching-item-row .teaching-col1 {
    white-space: nowrap;
    color: var(--text-muted);
}

/* Specificity has to beat `.service-item-row td` above, or the side padding is lost. */
.service-item-row .service-separator,
.teaching-item-row .teaching-separator {
    color: var(--border-color);
    padding: 0.2rem 0.75rem;
    width: 1px;
}

.service-item-comment,
.teaching-item-comment {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-left: 1rem;
    padding-bottom: 0.4rem;
}

.service-comment-bullet,
.teaching-comment-bullet {
    color: var(--text-muted);
    margin-right: 0.3rem;
}

/* --- Talks -------------------------------------------------------------- */
.talk-row td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.talk-row:last-child td {
    border-bottom: none;
}

.talk-date {
    color: var(--text-muted);
    white-space: nowrap;
    vertical-align: top;
    padding-right: 2rem;
}

.talk-content {
    color: var(--text-muted);
    vertical-align: top;
}

.talk-title {
    color: var(--text-dark);
}

.talk-kind {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-color);
    margin-left: 0.4rem;
}

/* --- Teaching ----------------------------------------------------------- */
.teaching-school-group {
    margin-bottom: 1.75rem;
}

.teaching-school-name {
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 700;
}

.teaching-school-location {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.teaching-experience {
    margin-bottom: 0.75rem;
}

.teaching-title {
    color: var(--text-dark);
    font-size: 1.05rem;
    font-weight: 700;
}

/* --- Footer ------------------------------------------------------------- */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--bg-section);
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* --- Scroll reveal ------------------------------------------------------ */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1100px) {
    .nav-links {
        gap: 1.1rem;
    }

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

@media (max-width: 900px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .profile-card {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-section);
        flex-direction: column;
        padding: 1rem 2rem;
        gap: 0;
        box-shadow: var(--shadow-md);
    }

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

    .nav-links a {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-menu-btn {
        display: block;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .profile-image {
        width: 220px;
        height: 220px;
    }

    .pub-content-wrapper {
        flex-direction: column;
    }

    .talk-date {
        padding-right: 1rem;
    }


}

/* Wide content must scroll inside its own box, never the page body. */
.table-scroll {
    overflow-x: auto;
}
