/* ============================================
   Abhijit Marar — Academic Personal Website
   Layout: portrait-left, content-right (Fernandes-inspired)
   Typography: classical serif (EB Garamond / Latin Modern feel)
   ============================================ */

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

:root {
    --color-text: #1f1b16;
    --color-muted: #5a5245;
    --color-faint: #736b5e;
    --color-link: #0c2340;
    --color-link-hover: #2b5680;
    --color-bg: #faf5ec;
    --color-border: #e0d7ca;
    --color-border-soft: #ece5d9;
    --color-highlight: #fcedbb;
    --color-highlight-border: #cbb057;
    --font-serif: 'EB Garamond', 'Latin Modern Roman', 'Computer Modern Serif', Georgia, 'Times New Roman', serif;
    --max-width: 960px;
    --measure: 820px;   /* readable line length for prose-heavy pages */
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: var(--font-serif);
    font-size: 19px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern", "liga", "onum";
}

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

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

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

/* --- Navigation --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 245, 236, 0.97);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* On the home page the logo is wrapped in an <h1> so the page has a heading;
   reset the default h1 sizing/margin so the nav bar is unaffected. */
.nav-logo-wrap {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.nav-logo:hover {
    color: var(--color-link);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--color-text);
    cursor: pointer;
    padding: 4px 8px;
}

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

.nav-links a {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--color-text);
    font-weight: 400;
}

.nav-links a:hover {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.nav-links a.is-active {
    color: var(--color-link);
    font-weight: 600;
    border-bottom: 2px solid var(--color-link);
    padding-bottom: 1px;
}

.nav-links a.is-active:hover {
    text-decoration: none;
}

/* --- Hero / About Section --- */
.hero {
    padding: 50px 0 30px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    column-gap: 44px;
    align-items: start;
}

/* Left column */
.hero-side {
    text-align: center;
}

.photo-wrapper {
    width: 260px;
    height: 400px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
    margin: 0 auto 16px;
    background: #f3ece1;
}

.photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    background: #efe7db;
    color: var(--color-muted);
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 600;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    position: absolute;
    inset: 0;
}

.hero-identity h1 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
    line-height: 1.25;
}

.hero-identity .role {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 4px;
}

.hero-identity .affiliation {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--color-muted);
    line-height: 1.4;
    margin-top: 4px;
}

.hero-identity .affiliation a {
    color: var(--color-muted);
    border-bottom: 1px dotted var(--color-muted);
}

.hero-identity .affiliation a:hover {
    color: var(--color-link);
    border-bottom-color: var(--color-link);
    text-decoration: none;
}

.hero-social {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.hero-social a {
    color: var(--color-muted);
    font-size: 1.35rem;
    transition: color 0.15s, transform 0.15s;
    display: inline-block;
}

.hero-social a:hover {
    color: var(--color-link);
    transform: translateY(-1px);
}

/* --- Upcoming Talks (home page, below Interests/Education) --- */
.talks-block {
    margin-top: 28px;
}

.talks-block h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

/* One row per talk: name + venue left, date right. Wraps to two lines
   only when the venue is long. */
.talks-block .talk-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 18px;
    padding: 7px 0;
    line-height: 1.45;
}

.talks-block .talk-item + .talk-item {
    border-top: 1px dotted var(--color-border);
}

.talks-block .talk-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}

.talks-block .talk-venue {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.talks-block .talk-venue::before {
    content: ", ";
    font-style: normal;
}

.talks-block .talk-date {
    color: var(--color-faint);
    font-size: 0.9rem;
    font-variant-numeric: oldstyle-nums;
    white-space: nowrap;
}

.talk-flag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid var(--color-highlight-border);
    background: var(--color-highlight);
    border-radius: 2px;
    color: var(--color-text);
    font-size: 0.74rem;
    font-style: normal;
    font-variant-numeric: normal;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 1px;
}

/* Right column */
.hero-main h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 16px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

.bio-section p {
    margin-bottom: 14px;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--color-text);
    text-align: justify;
    hyphens: auto;
}

.bio-section p:last-child {
    margin-bottom: 0;
}

.bio-section strong {
    font-weight: 600;
}

/* News callout (Craig-style highlight) — unused by default; ready when you need it */
.news-callout {
    background: var(--color-highlight);
    border-left: 3px solid var(--color-highlight-border);
    padding: 12px 16px;
    margin: 18px 0;
    font-size: 1rem;
    line-height: 1.55;
}

/* Two-column row: interests + education */
.info-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 36px;
    margin-top: 28px;
}

.info-row h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.ul-interests, .ul-edu {
    list-style: none;
    padding: 0;
}

.ul-interests li {
    padding: 3px 0;
    font-size: 1rem;
    line-height: 1.5;
}

/* Two lines per entry: degree and year share the top line, school beneath. */
.ul-edu li {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    padding: 5px 0;
    line-height: 1.4;
}

.ul-edu li + li {
    border-top: 1px dotted var(--color-border);
}

.ul-edu .degree {
    grid-column: 1;
    grid-row: 1;
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}

.ul-edu .year {
    grid-column: 2;
    grid-row: 1;
    align-self: baseline;
    color: var(--color-faint);
    font-size: 0.88rem;
    font-variant-numeric: oldstyle-nums;
    white-space: nowrap;
}

.ul-edu .school {
    grid-column: 1 / -1;
    color: var(--color-muted);
    font-size: 0.93rem;
    margin-top: 1px;
}

/* --- Contact block (home page, below info-row) --- */
.contact-block {
    margin-top: 28px;
}

.contact-block h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.contact-line {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--color-text);
    margin-bottom: 2px;
}

.contact-line:last-child {
    margin-bottom: 0;
}

/* --- Paper topic subsection (within research-group) --- */
.paper-topic {
    margin-bottom: 28px;
}

.paper-topic:last-child {
    margin-bottom: 0;
}

/* Matches .research-group h3 so topic headings read as the same kind of
   label; no bottom rule, which keeps the h3 above it dominant. */
.paper-topic h4 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 12px 0;
}

/* --- Sections (Research, etc.) --- */
.section {
    padding: 40px 0 24px;
    margin-top: 24px;
    border-top: 1px solid var(--color-border);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 24px;
}

.research-group {
    margin-bottom: 32px;
    /* The shell is wide for the home page's three-column hero; keep prose
       pages at a readable line length instead of letting titles run edge to edge. */
    max-width: var(--measure);
}

.research-group:last-child {
    margin-bottom: 0;
}

.research-group h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border-soft);
}

.paper-list {
    list-style: decimal;
    padding-left: 26px;
}

.paper {
    padding: 10px 0 12px;
    line-height: 1.5;
}

.paper + .paper {
    border-top: 1px dotted var(--color-border);
}

/* Avoid a stray divider above the first visible paper when a preceding
   paper in the same list is filtered out. */
.paper[hidden] + .paper {
    border-top: none;
}

.paper-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.45;
    margin-bottom: 2px;
}

.paper-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.paper-title a:hover {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.paper-authors {
    font-family: var(--font-serif);
    font-size: 0.97rem;
    font-weight: normal;
    color: var(--color-muted);
    margin-bottom: 2px;
}

.paper-venue {
    font-family: var(--font-serif);
    font-size: 0.97rem;
    color: var(--color-text);
}

.paper-venue em {
    font-style: italic;
}

.paper-status {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #7d5b00;
    background: #fbeabc;
    border: 1px solid #ddc37a;
}

/* --- Inner page header (Research, Teaching pages) — kept for backward compat --- */
.page-header {
    padding: 50px 0 20px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--color-border);
}

/* When no page-header, give the first content section breathing room below the nav */
main > .research-group:first-of-type {
    padding-top: 50px;
}

.page-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.2;
}

.page-subtitle {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--color-muted);
    margin-top: 6px;
}

.page-aside {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px dotted var(--color-border);
    font-size: 0.95rem;
    color: var(--color-muted);
}

.empty-note {
    color: var(--color-muted);
    padding: 8px 0 4px;
}

/* --- Research paper status filters --- */
.paper-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 28px;
    padding-top: 40px;
    margin-bottom: 22px;
}

/* Cancel the 50px top padding the first-of-type rule would otherwise add to
   the first section, so the gap under the filter bar stays constant no matter
   which section is the first one still visible after filtering. */
main > .paper-filters + .research-group {
    padding-top: 0;
}

.filter-btn {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 0;
    padding: 7px 18px;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.filter-btn:hover {
    color: var(--color-link);
    border-color: var(--color-highlight-border);
}

.filter-btn:focus-visible {
    outline: 2px solid var(--color-highlight-border);
    outline-offset: 2px;
}

.filter-btn.is-active {
    color: var(--color-bg);
    background: var(--color-link);
    border-color: var(--color-link);
}

@media (prefers-reduced-motion: reduce) {
    .filter-btn { transition: none; }
}

/* --- Teaching & Talks lists --- */
.teaching-list,
.talk-list {
    list-style: none;
    padding: 0;
}

.teaching-item,
.talk-item {
    padding: 10px 0;
    line-height: 1.5;
}

.teaching-item + .teaching-item,
.talk-item + .talk-item {
    border-top: 1px dotted var(--color-border);
}

.teaching-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: baseline;
}

/* --- Teaching page: courses grouped by institution and level --- */
/* Sits inside the h3 so it stays above the heading's bottom rule; echoes the
   italic school styling used in the Education list on the home page. */
.research-group h3 .school-sub {
    display: block;
    margin-top: 3px;
    font-size: 0.95rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-faint);
}

.course-list {
    list-style: none;
    padding: 0;
}

.course {
    padding: 10px 0 12px;
}

.course + .course {
    border-top: 1px dotted var(--color-border);
}

.course-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.45;
    margin-bottom: 3px;
}

/* Same treatment as .paper-title a: inherits the heading colour rather than
   turning link-blue, and reveals itself on hover. */
.course-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.course-title a:hover {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.course-terms {
    list-style: disc;
    padding-left: 20px;
    margin: 2px 0 0;
}

.course-terms li {
    color: var(--color-muted);
    font-size: 0.97rem;
    line-height: 1.5;
    padding: 1px 0;
}

.course-terms li::marker {
    color: var(--color-faint);
}

.instructor {
    color: var(--color-text);
}

.term {
    color: var(--color-faint);
    font-variant-numeric: oldstyle-nums;
}

.teaching-role {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.teaching-year,
.talk-date {
    color: var(--color-faint);
    font-size: 0.9rem;
    font-variant-numeric: oldstyle-nums;
    white-space: nowrap;
}

.talk-venue {
    color: var(--color-muted);
}

/* --- Footer --- */
.site-footer {
    padding: 28px 0;
    margin-top: 40px;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.site-footer p {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--color-faint);
}

/* --- Right side of nav (links + theme toggle + hamburger) --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 4px 6px;
    line-height: 1;
    transition: color 0.15s, transform 0.25s;
}

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

/* --- Dark Mode (Notre Dame palette: navy + gold) --- */
[data-theme="dark"] {
    --color-text: #e8e1cf;          /* warm cream */
    --color-muted: #a0afc4;          /* muted blue-gray */
    --color-faint: #6e7d92;          /* faint blue-gray */
    --color-link: #d4a83a;           /* ND gold */
    --color-link-hover: #f3c84e;     /* brighter gold */
    --color-bg: #010818;             /* very dark navy */
    --color-border: #0a1d38;         /* mid navy for definition */
    --color-border-soft: #051124;    /* subtle navy */
    --color-highlight: #091a30;      /* callout / surface */
    --color-highlight-border: #d4a83a;
}

[data-theme="dark"] .site-header {
    background: rgba(1, 8, 24, 0.96);
}

[data-theme="dark"] .photo-wrapper {
    background: #091a30;
}

[data-theme="dark"] .photo-fallback {
    background: #091a30;
    color: var(--color-link);
}

[data-theme="dark"] .paper-status {
    background: #091a30;
    color: var(--color-link);
    border-color: #142d4f;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-bg);
        padding: 12px 24px;
        gap: 0;
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 4px 8px rgba(92, 72, 44, 0.07);
    }

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

    .nav-links li {
        padding: 10px 0;
        border-bottom: 1px solid var(--color-border-soft);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .hero {
        padding: 30px 0 20px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    .hero-side {
        text-align: center;
    }

    .photo-wrapper {
        width: 220px;
        height: 320px;
    }

    .hero-talks {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .info-row {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .bio-section p {
        text-align: left;
    }

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

@media (max-width: 480px) {
    body {
        font-size: 18px;
    }

    .container {
        padding: 0 18px;
    }

    .nav-container {
        padding: 12px 18px;
    }

    .hero-identity h1 {
        font-size: 1.3rem;
    }

    .paper-list {
        padding-left: 22px;
    }
}
