/* Scroll hint */
.scroll-hint {
    position: fixed;
    bottom: 40px;
    right: 80px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.scroll-hint.visible {
    opacity: 0.9;
}

.scroll-hint svg {
    width: 28px;
    height: 28px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(6px);
    }
}

@media (min-width: 981px) {
    .scroll-hint {
        display: flex;
    }
}

:root {
    --bg: #ffffff;
    --surface: #fafafa;
    --line: #e5e7eb;
    --line-strong: #d4d8de;
    --text: #111827;
    --muted: #4b5563;
    --soft: #6b7280;
    --container: 1160px;
    --reading: 1000px;
    /* Texture Variables */
    --texture-opacity: 0.04;
    --noise-opacity: 0.015;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Google Sans Flex", Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.72;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.01em;
    position: relative;
    min-height: 100vh;
}

/* Layered Premium Texture */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
    /* High-frequency Noise Texture for premium grain */
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.3'/%3E%3C/svg%3E"),
        /* Modern Dotted Grid instead of solid lines */
        radial-gradient(circle, rgba(17, 24, 39, 0.06) 1.5px, transparent 1.6px),
        /* Ambient Light Meshes for depth (Subtle tech blue/slate glows) */
        radial-gradient(
                ellipse at 15% 0%,
                rgba(219, 234, 254, 0.45) 0%,
                transparent 65%
            ),
        radial-gradient(
            ellipse at 85% 100%,
            rgba(228, 233, 255, 0.45) 0%,
            transparent 65%
        );
    background-size:
        180px 180px,
        34px 34px,
        100% 100%,
        100% 100%;
    background-position:
        0 0,
        17px 17px,
        0 0,
        0 0;
}

@font-face {
    font-family: "Google Sans Flex";
    src: url("GoogleSansFlex-VariableFont.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
}

@font-face {
    font-family: "Google Sans Flex";
    src: url("GoogleSansFlex-VariableFont.woff2") format("woff2");
    font-style: italic;
    font-weight: 100 1000;
    font-display: swap;
}

@font-face {
    font-family: "Playfair Display";
    src: url("PlayfairDisplay-VariableFont_wght.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
}

@font-face {
    font-family: "Playfair Display";
    src: url("PlayfairDisplay-VariableFont_wght.woff2") format("woff2");
    font-style: italic;
    font-weight: 100 1000;
    font-display: swap;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

img {
    max-width: 100%;
    display: block;
}

button {
    font: inherit;
}

.container {
    width: min(calc(100% - 40px), var(--container));
    margin: 0 auto;
}

.reading {
    width: min(100%, var(--reading));
}

.site-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: transparent;
    border-bottom: none !important;
}

.topbar::before,
.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: -1;
}

/* Base Blur (12px) - Starts at the top, fades as it goes down */
.topbar::before {
    top: 0;
    height: 110px;
    /* Header (64px) + 46px buffer */
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.45);
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 0%,
        black 64px,
        rgba(0, 0, 0, 0.8) 79px,
        rgba(0, 0, 0, 0.4) 94px,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        black 0%,
        black 64px,
        rgba(0, 0, 0, 0.8) 79px,
        rgba(0, 0, 0, 0.4) 94px,
        transparent 100%
    );
}

/* Peak Blur (Additional 8px to reach 20px) - Concentrated in the header core */
.topbar::after {
    top: 0;
    height: 64px;
    /* Exact Header height */
    backdrop-filter: blur(8px);
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 50%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 50%,
        transparent 100%
    );
}

.topbar-inner {
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 28px;
    row-gap: 12px;
    border-bottom: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex: 0 0 auto;
    display: block;
}

.brand-text {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

#brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.nav-toggle svg {
    width: 22px;
    height: 22px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(14px, 1.8vw, 24px);
    flex-wrap: nowrap;
    min-width: 0;
}

.nav a {
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
    padding: 4px 0;
    position: relative;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -14px;
    height: 2.5px;
    background: transparent;
}

.nav a:hover,
.nav a.active {
    color: var(--text);
}

.nav a.active::after,
.nav a:hover::after {
    background: var(--text);
    opacity: 1 !important;
}

.page {
    padding: 56px 0 88px;
}

.page-main {
    max-width: 1000px;
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 56px;
    align-items: start;
    padding: 0 0 20px;
}

.hero--home {
    position: relative;
    overflow: hidden;
    padding: 0px 0 60px;
    margin-top: -30px;
    min-height: calc(100vh - 64px);
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.hero--home .hero-copy {
    position: relative;
    z-index: 10;
    max-width: 900px;
    text-align: left;
}

.hero--home .hero-title {
    max-width: 20ch;
}

.hero-image-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-image-full img {
    width: 100%;
    height: auto;
    display: block;
}

.hero-copy {
    min-width: 0;
}

.eyebrow {
    display: inline-block;
    color: var(--soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-title,
.markdown-body h1,
.markdown-body h2 {
    font-family: "Playfair Display", Georgia, serif;
}

.hero-title {
    margin: 16px 0 20px;
    font-size: 64px;
    line-height: 1.1;
    max-width: 100%;
}

.hero-lead {
    margin: 0;
    max-width: 58ch;
    font-size: 20px;
    color: var(--muted);
}

/* Premium fading divider for text-only heroes */
body[data-page="research"] .hero-lead::after,
body[data-page="members"] .hero-lead::after,
body[data-page="publications"] .hero-lead::after,
body[data-page="news"] .hero-lead::after {
    content: "";
    display: block;
    width: min(100%, 720px);
    height: 2px;
    margin-top: 56px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        rgba(17, 24, 39, 0.25) 0%,
        rgba(17, 24, 39, 0.05) 75%,
        transparent 100%
    );
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-top: 26px;
}

.hero-chip {
    display: none;
}

.hero-visual {
    min-height: 340px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
}

.hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* PI Page Specific Photo Styles */
body[data-page="pi"] .hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    align-items: center;
}

body[data-page="pi"] .hero-visual {
    max-width: 280px;
    margin: 0 auto;
    border: none;
    background: transparent;
    backdrop-filter: none;
    aspect-ratio: 3/4;
    min-height: auto;
}

body[data-page="pi"] .hero-visual img {
    border-radius: 16px;
    box-shadow:
        0 24px 48px -12px rgba(17, 24, 39, 0.15),
        0 8px 24px -8px rgba(17, 24, 39, 0.08);
    object-fit: cover;
    object-position: center 15%;
}

/* Member page: text left, photo right on desktop */
body[data-page="member"] .hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.75fr);
    align-items: center;
    column-gap: 42px;
}

body[data-page="member"] .hero-visual {
    max-width: 280px;
    margin: 0 auto;
    border: none;
    background: transparent;
    backdrop-filter: none;
    aspect-ratio: 3/4;
    min-height: auto;
}
body[data-page="member"] .hero-visual img {
    border-radius: 16px;
    box-shadow:
        0 24px 48px -12px rgba(17, 24, 39, 0.15),
        0 8px 24px -8px rgba(17, 24, 39, 0.08);
    object-fit: cover;
    object-position: center 15%;
}

.hero-email {
    display: inline-block;
    margin-top: 10px;
    font-size: 14px;
    color: var(--soft);
    text-decoration: none;
    transition: color .15s;
}
.hero-email:hover { color: var(--text); }

.markdown-wrap {
    padding-top: 20px;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.markdown-body {
    width: min(100%, var(--reading));
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    letter-spacing: 0.02em;
    line-height: 1.18;
    margin: 1.75em 0 0.7em;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
    margin-top: 0;
}

.markdown-body h1 {
    font-size: 46px;
}

.markdown-body h2 {
    font-size: 40px;
    padding-top: 26px;
}

body[data-page="publications"] .markdown-body h2 {
    font-size: 52px;
}
body[data-page="news"] .markdown-body h2 {
    font-size: 52px;
}

.markdown-body h3 {
    font-size: 24px;
    font-weight: 700;
}

.markdown-body h4 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--soft);
}

.markdown-body p {
    margin: 0 0 1em;
    color: #1f2937;
    font-size: 20px;
    overflow-wrap: anywhere;
    letter-spacing: 0.01em;
    text-align: justify;
    text-justify: inter-word;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0 0 1.2em 1.8em;
    padding: 0;
    color: #1f2937;
}

.markdown-body li {
    margin: 0.5em 0;
    padding-left: 0.2em;
    letter-spacing: 0.01em;
    font-size: 20px;
}

.markdown-body blockquote {
    margin: 1.5em 0;
    padding: 0 0 0 20px;
    border-left: 2px solid var(--line-strong);
    color: var(--muted);
    font-style: italic;
}

.markdown-body hr {
    border: none;
    margin: 0;
    height: 0;
    visibility: hidden;
}

.markdown-body a {
    text-decoration: none;
    text-underline-offset: 4px;
}

.markdown-body strong {
    color: var(--text);
}

.markdown-body code {
    background: #f3f4f6;
    padding: 0.18em 0.42em;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

.markdown-body pre {
    margin: 1.2em 0;
    padding: 18px;
    overflow: auto;
    border-radius: 10px;
    background: #111827;
    color: #f9fafb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.markdown-body img {
    margin: 28px 0 8px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
}

/* Universal Skeleton Screen for Unloaded Images */
img:not(.loaded) {
    background-color: transparent;
    background-image: linear-gradient(
        90deg,
        rgba(16, 24, 39, 0.04) 25%,
        rgba(16, 24, 39, 0.08) 50%,
        rgba(16, 24, 39, 0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    color: transparent; /* Hide alt text */
    min-height: 240px; /* Prevent layout shift */
    width: 100%;
    object-fit: cover;
}

/* Remove min-height for small/fixed-size images that shouldn't stretch */
.brand-logo:not(.loaded),
.hero-image-full img:not(.loaded) {
    min-height: 0;
    width: auto;
}

/* Specific styling for fixed ratio avatars */
.member-card__avatar img:not(.loaded) {
    width: 100%;
    min-height: 100%;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.markdown-body table thead,
.markdown-body table tbody,
.markdown-body table tr {
    width: 100%;
}

.markdown-body th,
.markdown-body td {
    padding: 16px 8px;
    text-align: left;
    border-bottom: 1.5px solid var(--line-strong);
    vertical-align: top;
}

.markdown-body th {
    color: var(--soft);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid var(--line-strong);
    letter-spacing: 0.12em;
}

.footer {
    padding: 0 0 48px;
}

.footer-inner {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    font-size: 16px;
    flex-wrap: wrap;
    letter-spacing: 0.01em;
}

.copyright-icon {
    display: inline-block;
    vertical-align: middle;
    font-size: 1.1em;
    line-height: 1;
}

/* Member cards grid */
.member-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 48px 24px;
    margin: 3em 0 4em;
}

.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 8px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity .15s;
}
.member-card:hover { opacity: 0.85; }

.member-card__avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.member-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border: none;
    border-radius: 0;
}

.member-card__initials {
    font-family: "Playfair Display", serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--soft);
    letter-spacing: 0.02em;
}

.member-card__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px !important;
    min-height: 0;
}

.member-card .member-card__name {
    font-family: "Google Sans Flex", sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--text);
}

.member-card .member-card__year {
    font-size: 18px;
    color: var(--muted);
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .member-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 28px 16px;
    }

    .member-card__avatar {
        width: 150px;
        height: 150px;
    }

    .member-card .member-card__name {
        font-size: 20px !important;
    }
}

/* Publication cards */
.pub-card {
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    gap: 10px;
}

.pub-card__title {
    font-family: "Google Sans Flex", sans-serif;
    font-weight: 700;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.4;
    color: var(--text);
}

.pub-card__title a {
    color: inherit;
    text-decoration: none;
}

.pub-card__title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pub-card__author {
    font-size: 18px !important;
    color: #7a8899 !important;
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.01em;
    line-height: 1.26;
}

.pub-card__author strong {
    color: #7a8899 !important;
}

.pub-card__cite {
    font-size: 18px;
    color: var(--text);
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.01em;
    line-height: 1.26;
}

.pub-card__photo {
    margin-top: 16px;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.pub-card__photo img {
    width: 100%;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
    display: block;
    transition: opacity 0.15s ease;
}

.pub-card__photo a:hover img {
    opacity: 0.85;
}

@media (max-width: 640px) {
    .pub-card {
        padding: 20px 0;
    }

    .pub-card__author {
        font-size: 16px !important;
        line-height: 1.34;
    }

    .pub-card__cite {
        font-size: 16px;
        line-height: 1.34;
    }

    .pub-card__photo {
        max-width: 100%;
    }
}

/* News cards */
.news-card {
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    gap: 10px;
}

.news-card__title {
    font-family: "Google Sans Flex", sans-serif;
    font-weight: 700;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.4;
    color: var(--text);
}

.news-card__date {
    font-size: 16px !important;
    color: var(--soft) !important;
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.01em;
    line-height: 1.26;
}

.news-card__detail {
    font-size: 18px !important;
    color: #1f2937 !important;
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.news-card__photo {
    margin-top: 16px;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
}

.news-card__photo img {
    width: auto;
    max-width: 100%;
    max-height: 460px;
    height: auto;
    object-fit: contain;
    object-position: center;
    margin: 0;
    border: none;
    border-radius: 0;
    display: block;
    transition: opacity 0.15s ease;
    background: linear-gradient(
        90deg,
        var(--surface) 25%,
        var(--line) 50%,
        var(--surface) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}
.news-card__photo img.loaded {
    background: none;
    animation: none;
}

.news-card__photo a:hover img {
    opacity: 0.85;
}

@media (max-width: 640px) {
    .news-card {
        padding: 20px 0;
    }

    .news-card__photo {
        max-width: 100%;
    }

    .news-card__photo img {
        max-height: 300px;
    }
}

/* Latest News section (homepage) */
.latest-news {
    display: flex;
    flex-direction: column;
    margin: 1.75em 0;
}

.latest-news .latest-news__item {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 28px 0;
    border-bottom: 1.5px solid var(--line-strong);
}

.latest-news .latest-news__item:first-child {
    padding-top: 0;
}

.latest-news .latest-news__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.latest-news .latest-news__title {
    font-family: "Google Sans Flex", sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.latest-news .latest-news__date {
    font-size: 16px;
    color: var(--soft);
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.latest-news .latest-news__detail {
    font-size: 18px;
    color: #1f2937;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.latest-news .latest-news__photo {
    flex: 0 0 280px;
    width: 280px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.latest-news .latest-news__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border: none;
    border-radius: 0;
    display: block;
}

@media (max-width: 640px) {
    .latest-news .latest-news__item {
        flex-direction: column;
        gap: 16px;
    }

    .latest-news .latest-news__photo {
        flex: none;
        width: 100%;
    }

    .latest-news .latest-news__title {
        font-size: 22px;
    }
}

/* Photo cards grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin: 2em 0;
}

@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

.photo-card {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: var(--surface);
    border: 1px solid var(--line);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border: none;
    border-radius: 0;
    display: block;
    transition:
        transform 0.4s ease,
        filter 0.4s ease;
    background: linear-gradient(
        90deg,
        var(--surface) 25%,
        var(--line) 50%,
        var(--surface) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}
.photo-card img.loaded {
    background: none;
    animation: none;
}

.photo-card__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
    text-align: center;
    pointer-events: none;
}
.photo-card__overlay p {
    color: #fff;
}

.photo-card:hover img {
    transform: scale(1.06);
    filter: blur(4px);
}

.photo-card:hover .photo-card__overlay {
    opacity: 1;
}

.photo-card:hover .photo-card__date {
    color: #fff;
}

/* Disable hover effects on touch devices — tap opens lightbox directly */
@media (hover: none) {
    .photo-card__overlay {
        display: none;
    }
}

.photo-card__title {
    color: #fff !important;
    font-size: 24px !important;
    font-weight: 700;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.photo-card__date {
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 18px !important;
    margin: 0 !important;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

/* Lightbox */
#photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#photo-lightbox.open {
    display: flex;
}

#photo-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    margin: 0;
    border: none;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

/* Photos page hero divider */
body[data-page="photos"] .hero-lead::after {
    content: "";
    display: block;
    width: min(100%, 720px);
    height: 2px;
    margin-top: 56px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        rgba(17, 24, 39, 0.25) 0%,
        rgba(17, 24, 39, 0.05) 75%,
        transparent 100%
    );
}

.nav-backdrop {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

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

    .topbar-inner {
        column-gap: 18px;
    }

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

    .hero--home {
        min-height: calc(100vh - 64px);
        min-height: calc(100svh - 64px);
        padding: 30px 0 80px;
        align-items: flex-start;
        text-align: left;
        display: flex !important;
    }

    .hero-visual {
        min-height: 240px;
        max-width: 720px;
    }

    body[data-page="pi"] .hero {
        grid-template-columns: 1fr;
    }

    body[data-page="pi"] .hero-visual {
        margin: 0 auto;
        max-width: 240px;
    }

    body[data-page="member"] .hero {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    body[data-page="member"] .hero-visual {
        margin: 0 auto;
        max-width: 240px;
    }
}

@media (max-width: 820px) {
    .container {
        width: min(calc(100% - 28px), var(--container));
    }

    .topbar-inner {
        min-height: auto;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 12px 0;
    }

    .topbar {
        position: sticky;
    }

    /* Floating nav toggle */
    .nav-toggle {
        display: inline-flex;
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.08),
            0 0 0 1px rgba(0, 0, 0, 0.06);
        transition:
            box-shadow 0.15s ease,
            transform 0.15s ease;
    }

    .nav-toggle:hover {
        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.12),
            0 0 0 1px rgba(0, 0, 0, 0.08);
        transform: translateY(-1px);
    }

    /* Floating menu panel */
    .nav {
        display: none;
        position: fixed;
        top: 72px;
        right: 14px;
        background: #fff;
        border-radius: 16px;
        box-shadow:
            0 8px 30px rgba(0, 0, 0, 0.1),
            0 2px 8px rgba(0, 0, 0, 0.06),
            0 0 0 1px rgba(0, 0, 0, 0.06);
        padding: 8px;
        flex-direction: column;
        gap: 2px;
        min-width: 220px;
        width: 50vw;
        z-index: 200;
        pointer-events: none;
        animation: navIn 0.18s cubic-bezier(0.34, 1.4, 0.64, 1);
    }

    @keyframes navIn {
        from {
            opacity: 0;
            transform: translateY(-8px) scale(0.96);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    /* Backdrop overlay */
    .nav-backdrop {
        position: fixed;
        inset: 0;
        background: transparent;
        backdrop-filter: none;
        z-index: 190;
        pointer-events: none;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
    }

    body.nav-open .nav {
        display: flex;
        pointer-events: auto;
    }

    .nav a {
        pointer-events: auto;
        width: 100%;
        padding: 12px 16px;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
        color: var(--muted);
        border: none;
        text-align: left;
        transition:
            background 0.12s ease,
            color 0.12s ease;
    }

    .nav a::after {
        display: none;
    }

    .nav a:hover,
    .nav a.active {
        background: rgba(0, 0, 0, 0.05);
        color: var(--text);
    }

    .nav a.active {
        background: rgba(0, 0, 0, 0.04);
        color: var(--text);
    }

    .page {
        padding: 40px 0 72px;
    }

    .hero {
        padding-bottom: 30px;
    }

    .hero-title {
        font-size: 52px;
        line-height: 1.1;
    }

    .hero-lead {
        font-size: 20px;
    }

    .markdown-wrap {
        padding-top: 26px;
    }
}

@media (max-width: 640px) {
    .brand {
        gap: 12px;
    }

    .hero-meta {
        gap: 8px;
    }

    .hero-chip {
        font-size: 12px;
        padding: 6px 10px;
    }

    .hero-visual {
        opacity: 0.1;
    }

    body[data-page="pi"] .hero-visual {
        opacity: 1;
    }

    body[data-page="member"] .hero-visual {
        opacity: 1;
    }

    .hero-title {
        font-size: 40px;
    }

    .markdown-body {
        width: 100%;
    }

    .markdown-body h1 {
        font-size: 38px;
    }

    .markdown-body h2 {
        font-size: 32px;
        padding-top: 20px;
    }

    body[data-page="publications"] .markdown-body h2 {
        font-size: 42px;
    }

    body[data-page="news"] .markdown-body h2 {
        font-size: 42px;
    }

    .markdown-body h3 {
        font-size: 22px;
    }

    .markdown-body p,
    .markdown-body li {
        font-size: 18px;
    }

    .markdown-body ul,
    .markdown-body ol {
        margin-left: 1.5em;
    }

    .footer-inner {
        font-size: 13px;
    }
}
