/* =======================
   Color Variables
   ======================= */
:root {
    --bg: #ffffff;
    --text: #222222;
    --text-2: #333333;
    --muted: #666666;
    --muted-2: #999999;

    --border: #e6e6e6;
    --card: #ffffff;
    --code-bg: #f8f8f8;

    --pill-bg: #fafafa;
    --pill-text: #333333;
    --pill-border: #d8d8d8;

    --shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f10;
        --text: #e8e8e8;
        --text-2: #d0d0d0;
        --muted: #a9a9a9;
        --muted-2: #9a9a9a;

        --border: #3a3a3a;
        --card: #1a1a1a;
        --code-bg: #2a2a2a;

        --pill-bg: #2a2a2a;
        --pill-text: #d0d0d0;
        --pill-border: #444444;

        --shadow: 0 2px 8px rgba(0, 0, 0, 0.30);
    }
}

html {
    color-scheme: light dark;
    background: var(--bg);
}

body {
    background: var(--bg);
    color: var(--text);
}

/* =======================
   Publications Section
   ======================= */
.pub-item {
    display: grid;
    grid-template-columns: 160px 1fr;
    column-gap: 16px;
    align-items: start;
    margin: 16px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

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

.pub-item>img.pub-thumb {
    width: 160px;
    height: auto;
    max-width: none;
    border-radius: 8px;
    display: block;
    transition: transform .2s ease;
}

.pub-item>img.pub-thumb:hover {
    transform: scale(1.05);
}

.pub-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.35;
    margin-bottom: 3px;
    color: var(--text);
}

.pub-authors {
    font-size: 13.5px;
    line-height: 1.35;
    color: var(--text-2);
    margin-bottom: 2px;
}

.pub-venue {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.3;
}

/* ---- ACTION BUTTONS: pill style (matches members) ---- */
.pub-links {
    /* used on the action button container */
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Style anchors inside .pub-links and .pub-actions .pub-btn (belt & suspenders) */
.pub-links a,
.pub-actions .pub-btn {
    appearance: none !important;
    display: inline-block !important;
    padding: 6px 12px !important;
    margin: 3px 6px 0 0 !important;
    border: 1px solid var(--pill-border) !important;
    border-radius: 999px !important;
    /* pill */
    background: var(--pill-bg) !important;
    color: var(--pill-text) !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    line-height: 1.2 !important;
    transition: background .2s ease, border-color .2s ease, color .2s ease !important;
}

.pub-links a:hover,
.pub-actions .pub-btn:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: var(--muted) !important;
    color: var(--text) !important;
}

@media (prefers-color-scheme: dark) {

    .pub-links a,
    .pub-actions .pub-btn {
        background: #222 !important;
        border-color: var(--border) !important;
        color: var(--text-2) !important;
    }

    .pub-links a:hover,
    .pub-actions .pub-btn:hover {
        background: #2a2a2a !important;
        border-color: #5a5a5a !important;
        color: var(--text) !important;
    }
}

/* Title link should stay normal text (not pill) */
.pub-title a {
    color: inherit !important;
    text-decoration: none;
}

/* ---- Drawers (BibTeX / Press / Links) ---- */
.pub-bibtex[aria-hidden="true"],
.pub-highlights[aria-hidden="true"],
.pub-press[aria-hidden="true"],
.pub-links-drawer[aria-hidden="true"] {
    display: none !important;
}

.pub-bibtex,
.pub-highlights,
.pub-press,
.pub-links-drawer {
    background: var(--code-bg);
    border: 1px solid var(--pill-border);
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
    color: var(--text-2);
    font-size: 12.5px;
    line-height: 1.45;
}

.pub-bibtex {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
}

.pub-highlights {
    font-family: inherit;
    font-size: 13px;
}

.pub-press ul,
.pub-links-drawer ul {
    margin: 0;
    padding-left: 18px;
}

.pub-press li,
.pub-links-drawer li {
    margin: 4px 0;
}

/* Tablet */
@media (max-width: 768px) and (min-width: 561px) {
    .pub-item {
        grid-template-columns: 140px 1fr;
        column-gap: 12px;
    }

    .pub-item>img.pub-thumb {
        max-width: 140px;
    }

    .pub-title {
        font-size: 14.5px;
    }

    .pub-authors {
        font-size: 13px;
    }
}

/* Mobile */
@media (max-width: 560px) {
    .pub-item {
        grid-template-columns: 1fr;
        row-gap: 10px;
        padding: 14px 0 16px;
    }

    .pub-item>img.pub-thumb {
        max-width: 180px;
        margin: 0 auto 6px;
    }

    .pub-title,
    .pub-authors,
    .pub-venue,
    .pub-links {
        text-align: center;
    }

    .pub-title {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .pub-authors {
        font-size: 12.5px;
    }

    .pub-venue {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .pub-links a,
    .pub-actions .pub-btn {
        font-size: 12px;
        padding: 3px 8px;
        margin: 2px 3px;
    }

    .pub-bibtex,
    .pub-highlights,
    .pub-press,
    .pub-links-drawer {
        font-size: 11.5px;
        padding: 8px;
    }
}

/* =======================
   Members Section
   ======================= */
.member-card {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    align-items: start;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.member-photo img,
.member-placeholder {
    width: 140px;
    height: 140px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
    background: var(--pill-bg);
}

.member-info {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-2);
}

.member-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text);
}

.member-role,
.member-affiliation,
.member-office,
.member-phone,
.member-email,
.member-fax {
    font-size: inherit;
    margin-top: 2px;
}

.member-info .label {
    font-weight: 600;
    margin-right: 6px;
}

.member-links {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-links a,
.member-links a.ml-btn,
.member-links .btn {
    appearance: none;
    display: inline-block;
    padding: 6px 12px !important;
    border: 1px solid var(--pill-border) !important;
    border-radius: 999px !important;
    background: var(--pill-bg) !important;
    color: var(--pill-text) !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    line-height: 1.2;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.member-links a:hover,
.member-links a.ml-btn:hover,
.member-links .btn:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: var(--muted) !important;
    color: var(--text) !important;
}

.member-links a.ml-btn-ghost {
    background: transparent !important;
    border-color: var(--pill-border) !important;
    font-weight: 500;
}

.member-links a.ml-btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: var(--muted) !important;
}

@media (prefers-color-scheme: dark) {
    .member-info {
        color: var(--text-2);
    }

    .member-links a,
    .member-links a.ml-btn,
    .member-links .btn {
        background: #222 !important;
        border-color: var(--border) !important;
        color: var(--text-2) !important;
    }

    .member-links a:hover,
    .member-links a.ml-btn:hover,
    .member-links .btn:hover {
        background: #2a2a2a !important;
        border-color: #5a5a5a !important;
        color: var(--text) !important;
    }

    .member-links a.ml-btn-ghost {
        background: transparent !important;
        border-color: #6a6a6a !important;
    }

    .member-links a.ml-btn-ghost:hover {
        background: #1f1f1f !important;
        border-color: #8a8a8a !important;
    }
}

/* Mobile (members) */
@media (max-width: 640px) {
    .member-card {
        grid-template-columns: 96px 1fr;
        padding: 12px;
    }

    .member-photo img,
    .member-placeholder {
        width: 96px;
        height: 96px;
        border-radius: 8px;
    }

    .member-name {
        font-size: 1.05rem;
    }
}

/* ===== Members: grid containers ===== */
.member-grid {
    display: grid;
    gap: 16px;
}

.member-grid--grads {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1100px) {
    .member-grid--grads {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 820px) {
    .member-grid--grads {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .member-grid--grads {
        grid-template-columns: 1fr;
    }
}

/* Compact card layout for grads: stack image over text */
.member-card--compact {
    grid-template-columns: 1fr;
    padding: 12px;
    text-align: center;
}

.member-card--compact .member-photo img {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.member-card--compact .member-name {
    font-size: 1rem;
    margin-top: 6px;
}

.member-card--compact .member-name a {
    color: var(--text) !important;
    text-decoration: none;
}

.member-card--compact .member-name a:hover {
    text-decoration: underline;
}

.member-card--compact .member-links {
    justify-content: center;
}

.member-card--compact .member-links a.btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--pill-border);
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--pill-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease;
}

.member-card--compact .member-links a.btn:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--muted);
    color: var(--text);
}

/* =======================
   Projects Section
   ======================= */
.project-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 24px 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.project-img {
    flex: 0 0 220px;
    width: 220px;
    height: auto;
    border-radius: 10px;
    margin-right: 20px;
}

.project-text {
    flex: 1;
    min-width: 250px;
}

.project-card h3 {
    margin-top: 0;
}

.project-card .btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: #007ACC;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background .2s;
}

.project-card .btn:hover {
    background: #005a99;
}

/* ---- Press toggle (like BibTeX/Links) ---- */
.pub-press .press-date {
    color: var(--muted);
    font-size: 12px;
}

.pub-bibtex {
    max-width: 500px;
    /* adjust to your liking: 400px, 500px, etc. */
    margin: 8px auto;
    /* auto left/right centers it */
    font-size: 12.5px;
    line-height: 1.45;
}

/* On small devices (phones) */
@media (max-width: 600px) {
    .pub-bibtex {
        max-width: 90vw;
        /* shrink to fit small screen */
        font-size: 11.5px;
        /* optional: make text a bit smaller */
    }
}

/* Fix BibTeX text color on iPhone (and anywhere) */
.pub-bibtex,
.pub-bibtex pre,
.pub-bibtex code {
    color: var(--text-2) !important;
    background: transparent;
    /* keep the container's bg only */
}

/* Optional: make links readable inside the BibTeX box */
.pub-bibtex a {
    color: var(--pill-text);
}

/* Dark mode: ensure good contrast in the BibTeX drawer */
@media (prefers-color-scheme: dark) {
    .pub-bibtex {
        background: var(--code-bg);
        border-color: var(--border);
        color: var(--text) !important;
        /* a bit brighter in dark mode */
    }

    .pub-bibtex pre,
    .pub-bibtex code {
        color: inherit !important;
        background: transparent !important;
    }

    .pub-bibtex a {
        color: #a7caff;
    }

    /* readable link color on dark bg */
}