/* css/styles.css */

/* ---------------------------
   Global reset and defaults
---------------------------- */

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family:
        "Google Sans",
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;

    color: #111;
    background: #fff;
}

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

/* ---------------------------
   Layout variables and container
---------------------------- */

:root {
    --container: 1100px;
    --gutter: 16px;

    --radius-lg: 16px;
    --radius-md: 14px;

    --border: rgba(0, 0, 0, 0.2);
    --divider: rgba(0, 0, 0, 0.2);

    --hover-bg: #f7f7f7;
    --shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.2);

    --link: #1a0dab;
}

/* Shared page-width container */
.nav-wrapper,
.page section {
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

/* ---------------------------
   Header
---------------------------- */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);

    transform: translateY(0);
    transition: transform 250ms ease;
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

.site-header.is-peek {
    transform: translateY(0);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding-top: 7px;
    padding-bottom: 7px;
}

/* Brand */
.brand {
    color: #fff;
    text-decoration: none;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    position: relative;
    padding-bottom: 2px;
}

.brand-name {
    font-family: "EB Garamond", serif;
    font-size: 26px;
    letter-spacing: 1px;
    color: #fff;
}

/* Brand underline on hover */
.brand::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;

    width: 97%;
    height: 1px;
    background: currentColor;

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.brand:hover::after {
    transform: scaleX(1);
}

/* Nav */
.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;

    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;

    position: relative;
    padding-bottom: 2px;
}

/* Nav underline on hover */
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;

    width: 100%;
    height: 1.5px;
    background: currentColor;

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-social-item {
    margin-left: -5px;
}

.nav-social-item + .nav-social-item {
    margin-left: -12px;
}

.nav-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    padding: 0;
}

.nav-social-link::after {
    display: none;
}

.nav-social-icon {
    width: 19px;
    height: 19px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.nav-social-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 820px) {
    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 14px;
    }

    .nav-social-link {
        width: 26px;
        height: 26px;
    }

    .nav-social-item + .nav-social-item {
        margin-left: -10px;
    }

    .nav-social-icon {
        width: 17px;
        height: 17px;
    }
}

.detail-nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 6px;
    column-gap: 14px;
}

.detail-nav-links a {
    font-size: 14px;
}

/* ---------------------------
   Hero
---------------------------- */

.hero {
    min-height: 100vh;
    background: #000;
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
}

.hero-content {
    width: min(1000px, 92vw);

    display: grid;
    grid-template-columns: 360px max-content;
    column-gap: 100px;

    align-items: center;
    justify-content: center;
}

.hero-visuals {
    display: grid;
    justify-items: end;
}

.hero-animation {
    width: min(360px, 90%);
    height: auto;
}

.hero-texts {
    display: grid;
    gap: 16px;

    justify-items: center;
    text-align: center;
}

.hero-tagline-1 {
    font-family: "EB Garamond", serif;
    font-weight: 400;
    font-size: clamp(20px, 3.4vw, 51px);
    line-height: 1.1;
    margin: 0;

    white-space: nowrap;
}

.hero-tagline-2 {
    font-family:
        "Google Sans",
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    font-weight: 400;
    font-size: clamp(20px, 1.7vw, 22px);
    line-height: 1.35;
    margin: 0;

    white-space: nowrap;
}

.hero-cc-logo {
    width: 210px;
    height: auto;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 24px;
        width: min(720px, 92vw);
    }

    .hero-visuals {
        justify-items: center;
    }

    .hero-animation {
        width: min(420px, 90%);
    }

    .hero-cc-logo {
        width: 220px;
    }

    .hero-tagline-1 {
        font-size: clamp(28px, 7vw, 42px);
    }
}

/* ---------------------------
   Main page background
---------------------------- */

.page {
    --main-bg: none;

    background-image: var(--main-bg);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center top;

    padding: 60px 18px;
}

/* ---------------------------
   Section cards
---------------------------- */

.page section {
    margin-bottom: 24px;

    background: #fff;
    border-radius: var(--radius-lg);
    padding-top: 16px;
    padding-bottom: 16px;
}

.page h2 {
    margin: 0 0 10px 0;
    font-family: "EB Garamond", serif;
    font-size: 28px;
}

.rich-text p {
    margin: 0 0 12px 0;
}

.rich-text p:last-child {
    margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
    margin: 0 0 12px 20px;
    padding: 0;
}

.rich-text code {
    padding: 1px 5px;
    border-radius: 6px;
    background: #f3f3f3;
    font-size: 0.92em;
}

/* ---------------------------
   Research
---------------------------- */

#research-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.research-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    column-gap: 28px;

    padding: 20px 0;
    border-bottom: 1px solid var(--divider);

    align-items: start;
}

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

.research-image {
    width: 160px;
    height: auto;
    margin: 10px auto;
    display: block;
}

.research-text {
    display: grid;
    row-gap: 8px;
}

.research-name {
    margin: 0;
    font-weight: 600;
}

.research-description {
    margin: 0;
}

/* ---------------------------
   People
---------------------------- */

.people-group {
    padding: 18px 0;
}

.people-group + .people-group {
    position: relative;
    margin-top: 36px;
}

.people-group + .people-group::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 18px;
    right: 18px;
    height: 1px;
    background: var(--divider);
}

.people-group-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.people-cards {
    list-style: none;
    margin: 16px 0 0 0;
    padding: 0;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 980px) {
    .people-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .people-cards {
        grid-template-columns: 1fr;
    }
}

.person-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 15px;
    border: 1px solid var(--border);

    transition:
        background-color 200ms ease,
        box-shadow 200ms ease,
        transform 200ms ease;
}

.person-card:hover {
    background-color: var(--hover-bg);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.person-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.person-name {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.person-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.person-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
}

.person-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;

    width: 100%;
    height: 2px;
    background: #000;

    transform: scaleX(0);
    transform-origin: center;
    transition: transform 200ms ease;
}

.person-link:hover::after {
    transform: scaleX(1);
}

.person-link-icon {
    width: 22px;
    height: 22px;
}

.person-photo {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 8px 0px 20px 0px;
}

/* --- Photo flip ------------------------------------------ */
.person-photo-flipper {
    margin: 8px 0 20px 0;
    perspective: 900px;
}

.person-photo-inner {
    position: relative;
    width: 100%;
    height: 300px;
    transform-style: preserve-3d;
    transition: transform 0.55s ease;
}

.person-card:hover .person-photo-inner {
    transform: rotateY(180deg);
}

.person-photo-front,
.person-photo-back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.person-photo-back {
    transform: rotateY(180deg);
}

.person-role {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0px;
}

.person-email {
    margin: 0 0 10px 0;
}

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

.person-email a:hover {
    text-decoration: underline;
}

.person-affiliation {
    color: var(--color-muted, #444);
    font-style: italic;
    margin: 0 0 0.25rem 0;
}

.person-description {
    margin: 0;
}

.person-description p {
    margin: 0;
}

/* ---------------------------
   Publications
---------------------------- */

.pub-year {
    padding: 8px 0;
}

.pub-year + .pub-year {
    position: relative;
    margin-top: 16px;
}

.pub-year + .pub-year::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(0, 0, 0, 0.12);
}

.pub-list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.4;
}

.pub-list li + li {
    margin-top: 4px;
}

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

.pub-link:hover {
    text-decoration: underline;
}

.pub-more {
    margin-top: 16px;
    padding-left: 18px;
}

.pub-more-link {
    color: var(--link);
    font-weight: 700;
    text-decoration: none;
}

.pub-more-link:hover {
    text-decoration: underline;
}

/* ---------------------------
   Carousel (Photos)
---------------------------- */

.carousel {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.carousel-viewport {
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    width: 100%;
    position: relative;
}

.carousel-track {
    display: flex;
    transition: transform 500ms ease-in-out;
    width: 100%; /* Relative to viewport */
}

.carousel-slide {
    flex: 0 0 100%; /* Each slide takes exactly 100% of the track/viewport width */
    width: 100%;
    height: 500px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed to contain to ensure full photo visibility */
}

/* Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 200ms ease;
}

.carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-arrow.prev { left: 16px; }
.carousel-arrow.next { right: 16px; }

/* Thumbnails */
.carousel-thumbs {
    display: flex;
    justify-content: center; /* Center-align thumbnails */
    flex-wrap: wrap; /* Allow wrapping if there are many photos */
    gap: 8px;
    padding: 8px 0;
}

/* ---------------------------
   News detail pages
---------------------------- */

.detail-page {
    background: #fff;
}

.news-detail-main {
    --main-bg: url("../assets/backgrounds/main-page-bg.png");
    padding-top: 86px;
    padding-bottom: 48px;
}

.news-detail-article {
    max-width: var(--container);
    margin: 0 auto;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
}

.news-detail-kicker {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

.news-detail-article h1 {
    margin: 0 0 12px;
    font-family: "EB Garamond", serif;
    font-size: clamp(32px, 4vw, 44px);
    line-height: 1.12;
    font-weight: 600;
}

.news-detail-lede {
    max-width: 860px;
    margin: 0 0 20px;
    font-size: 18px;
    line-height: 1.5;
}

.news-detail-hero {
    display: grid;
    grid-template-columns: minmax(260px, 420px) 1fr;
    gap: 22px;
    align-items: end;
    margin: 22px 0 26px;
}

.news-detail-figure {
    margin: 18px 0;
    display: grid;
    justify-items: center;
}

.news-detail-hero img,
.news-detail-figure img {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.news-detail-hero img {
    max-width: 420px;
    max-height: 520px;
    object-fit: cover;
    object-position: center 32%;
}

.news-detail-figure img {
    max-width: 760px;
    max-height: 460px;
    object-fit: contain;
    background: #f6f6f6;
}

.news-detail-hero figcaption,
.news-detail-figure figcaption {
    margin-top: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.45;
}

.news-detail-figure figcaption {
    margin-top: 8px;
    width: min(760px, 100%);
}

.news-detail-section {
    padding: 22px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.14);
}

.news-detail-section h2 {
    margin: 0 0 10px;
    font-family: "EB Garamond", serif;
    font-size: 28px;
}

.news-detail-section p {
    margin: 0 0 12px;
}

.news-detail-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 0;
}

.news-detail-facts div {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.news-detail-facts dt {
    font-weight: 700;
    margin-bottom: 4px;
}

.news-detail-facts dd {
    margin: 0;
}

.detail-download-link {
    color: var(--link);
    font-weight: 700;
    text-decoration: none;
}

.detail-download-link:hover {
    text-decoration: underline;
}

.detail-highlight {
    background: #fff2a8;
    border-radius: 4px;
    padding: 0 4px;
    color: inherit;
}

@media (max-width: 760px) {
    .news-detail-article {
        padding: 20px;
    }

    .news-detail-lede {
        font-size: 16px;
    }

    .news-detail-facts {
        grid-template-columns: 1fr;
    }

    .news-detail-hero {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .news-detail-hero figcaption {
        width: 100%;
    }
}

.carousel-thumb {
    flex: 0 0 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 200ms ease;
}

.carousel-thumb:hover {
    opacity: 1;
}

.carousel-thumb.is-active {
    opacity: 1;
    border-color: var(--link);
}

@media (max-width: 640px) {
    .carousel-slide {
        height: 350px;
    }
    .carousel-thumb {
        flex-basis: 60px;
        height: 45px;
    }
}

/* ---------------------------
   News
---------------------------- */

.news-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-item {
    position: relative;
    padding: 18px 18px 18px 24px;
    border-bottom: 1px solid var(--divider);
}

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

.news-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 2px 2px 0;
    background: var(--news-accent, #888);
}

.news-item[data-category="paper"]::before  { --news-accent: #1a73e8; }
.news-item[data-category="talk"]::before   { --news-accent: #7c3aed; }
.news-item[data-category="award"]::before  { --news-accent: #d97706; }
.news-item[data-category="grant"]::before  { --news-accent: #16a34a; }
.news-item[data-category="achievement"]::before { --news-accent: hsl(321, 71%, 45%); }
.news-item[data-category="conference"]::before { --news-accent: #0d9488; }
.news-item[data-category="news"]::before   { --news-accent: #64748b; }

.news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.news-badge {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background: var(--news-accent, #888);
}

.news-item[data-category="paper"]  .news-badge { background: #1a73e8; }
.news-item[data-category="talk"]   .news-badge { background: #7c3aed; }
.news-item[data-category="award"]  .news-badge { background: #d97706; }
.news-item[data-category="grant"]  .news-badge { background: #16a34a; }
.news-item[data-category="achievement"] .news-badge { background: hsl(321, 71%, 45%); }
.news-item[data-category="conference"] .news-badge { background: #0d9488; }
.news-item[data-category="news"]   .news-badge { background: #64748b; }

.news-date {
    font-size: 13px;
    color: #777;
}

.news-headline {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #111;
}

a.news-headline-link {
    display: block;
    text-decoration: none;
    color: #111;
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    transition: color 150ms ease;
}

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

.news-description {
    font-size: 14px;
    color: #444;
    margin: 0;
}

.news-description p {
    margin: 0;
}

/* ---------------------------
   Contact
---------------------------- */

.contact-email {
    color: var(--link);
    text-decoration: none;
}

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

.contact-email-row {
    margin: 0;
}

.contact-email:hover {
    text-decoration: underline;
}

/* ---------------------------
   Footer
---------------------------- */

.site-footer {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 18px;
    background: #0a0a0a;
    color: #fff;
}

.site-footer p {
    margin: 6px 0;
    font-size: 13px;
    opacity: 0.9;
}

.site-footer a {
    color: #fff;
    text-decoration: underline;
}

.footer-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    align-items: center;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
}

.footer-social-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.footer-social-icon {
    width: 21px;
    height: 21px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.footer-right {
    margin-left: auto;
    text-align: right;
}

@media (max-width: 720px) {
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-right {
        margin-left: 0;
        text-align: left;
    }

    .footer-center {
        position: static;
        transform: none;
    }
}

/* ---------------------------
   Mobile responsive
---------------------------- */

/* Hero: allow taglines to wrap once the layout is single-column */
@media (max-width: 900px) {
    .hero-tagline-1,
    .hero-tagline-2 {
        white-space: normal;
    }
}

/* Hamburger button — hidden on desktop */
.nav-toggle {
    display: none;
}

/* Nav: hamburger menu on small screens */
@media (max-width: 600px) {
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 26px;
        height: 18px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }

    .nav-toggle-bar {
        display: block;
        width: 100%;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: transform 250ms ease, opacity 250ms ease;
    }

    /* Animate to X when open */
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Nav links hidden by default; shown as dropdown when open */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links > li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

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

    .nav-links > li > a {
        display: block;
        padding: 12px 20px;
        font-size: 16px;
    }

    .nav-social-item {
        margin-left: 0 !important;
    }

    .nav-social-link {
        width: auto;
        height: auto;
        border-radius: 0;
        padding: 10px 20px;
        justify-content: flex-start;
        gap: 10px;
    }

    .nav-social-link::after {
        display: none;
    }

    .nav-social-icon {
        width: 20px;
        height: 20px;
    }
}

/* Research: stack image above text */
@media (max-width: 640px) {
    .research-item {
        grid-template-columns: 1fr;
    }

    .research-image {
        width: 70%;
        max-width: 220px;
        margin: 0 auto 8px;
    }
}

@media (max-width: 600px) {
    .detail-page .detail-nav-links {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        background: transparent;
        padding: 0;
    }

    .detail-page .detail-nav-links > li {
        border-bottom: none;
    }

    .detail-page .detail-nav-links > li > a {
        padding: 2px 0;
        font-size: 12px;
    }
}
