/* Small visual touches that keep the original Home Layout 2 structure. */
:root {
    --site-accent: #4566ac;
    --site-accent-deep: #294b87;
    --site-border: rgba(62, 89, 136, 0.1);
}

html {
    scroll-padding-top: 5.5rem;
}

body.bg-light {
    position: relative;
    isolation: isolate;
    color: #273347;
    background-color: #f5f7fb !important;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    width: min(70vw, 850px);
    height: min(70vw, 850px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(105, 145, 217, 0.16), transparent 68%);
}

body::before {
    top: -25vw;
    left: -18vw;
    animation: ambient-drift 24s ease-in-out infinite alternate;
}

body::after {
    right: -22vw;
    bottom: -24vw;
    background: radial-gradient(circle, rgba(131, 120, 207, 0.12), transparent 68%);
    animation: ambient-drift 28s ease-in-out infinite alternate-reverse;
}

@keyframes ambient-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(3vw, 2vw, 0); }
}

.site-ambient-particles {
    position: fixed;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.site-ambient-particle {
    position: absolute;
    width: var(--particle-size, 3px);
    height: var(--particle-size, 3px);
    border-radius: 50%;
    background: rgba(88, 130, 196, 0.56);
    box-shadow: 0 0 9px 2px rgba(101, 146, 219, 0.14);
    animation: particle-drift var(--float-duration, 24s) ease-in-out infinite alternate,
        particle-twinkle var(--twinkle-duration, 8s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s), var(--twinkle-delay, 0s);
}

.site-ambient-particle:nth-child(3n) {
    background: rgba(136, 120, 191, 0.48);
    box-shadow: 0 0 10px 2px rgba(146, 127, 208, 0.14);
}

.site-ambient-particle.site-ambient-particle--glow {
    background: radial-gradient(circle, rgba(105, 148, 217, 0.65), rgba(105, 148, 217, 0.12) 55%, transparent 75%);
    box-shadow: 0 0 15px 4px rgba(112, 153, 217, 0.13);
}

.site-ambient-particle--sparkle::before,
.site-ambient-particle--sparkle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(105, 137, 198, 0.7), transparent);
    transform: translate(-50%, -50%);
}

.site-ambient-particle--sparkle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.site-ambient-particles.is-paused .site-ambient-particle {
    animation-play-state: paused;
}

@keyframes particle-drift {
    from {
        transform: translate3d(calc(-1 * var(--drift-x)), var(--drift-y), 0);
    }
    to {
        transform: translate3d(var(--drift-x), calc(-1 * var(--drift-y)), 0);
    }
}

@keyframes particle-twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.85; }
}

::selection {
    color: #203b6e;
    background: #dce7fa;
}

main {
    padding-bottom: 1.25rem;
}

main .card,
main .bg-white.rounded-xl {
    outline: 1px solid var(--site-border);
    outline-offset: -1px;
    box-shadow: 0 4px 18px rgba(37, 58, 94, 0.035), 0 1px 3px rgba(37, 58, 94, 0.035) !important;
    transition: transform 300ms ease, box-shadow 300ms ease, opacity 600ms ease;
}

.profile-card {
    background: linear-gradient(130deg, #fff 50%, #f6f8fe 100%) !important;
}

.profile-card .figure-img {
    border-color: rgba(62, 89, 136, 0.12);
    box-shadow: 0 6px 20px rgba(37, 58, 94, 0.07);
}

.text-profile-bio {
    line-height: 1.7;
}

.text-profile-bio p:last-child {
    margin-bottom: 0.5rem;
}

.phd-callout {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    clear: both;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid #3d6094;
    border-radius: 0.6rem;
    color: #294b7a;
    background: linear-gradient(110deg, #e9f1ff, #f5f8ff);
    box-shadow: 0 3px 10px rgba(40, 79, 148, 0.05);
    font-size: 0.95rem;
    line-height: 1.5;
}

.phd-callout > .fas {
    flex-shrink: 0;
    opacity: 0.9;
}

.publication-cover-mobile {
    width: 100%;
    max-width: 20rem;
    max-height: 9rem;
    object-fit: contain;
    object-position: left center;
}

main .h1,
main h1,
main h2 {
    letter-spacing: -0.025em;
}

main .border-bottom,
main .border-top {
    border-color: var(--site-border) !important;
}

main h6 > .fas {
    color: var(--site-accent);
    margin-right: 0.25rem;
}

main a:not(.btn):not(.badge):not(.nav-link) {
    color: var(--site-accent);
    text-decoration-color: rgba(69, 102, 172, 0.4);
    text-underline-offset: 0.18em;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

main a:not(.btn):not(.badge):not(.nav-link):hover {
    color: var(--site-accent-deep);
    text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 4px;
    border-radius: 3px;
}

.navbar {
    background-color: rgba(255, 255, 255, 0.78) !important;
    border-bottom: 1px solid rgba(62, 89, 136, 0.07);
    transition: background-color 220ms ease, box-shadow 220ms ease;
}

.navbar.is-scrolled {
    background-color: rgba(255, 255, 255, 0.93) !important;
    box-shadow: 0 4px 16px rgba(37, 58, 94, 0.06) !important;
}

.navbar-brand {
    color: #273347 !important;
    letter-spacing: -0.02em;
}

.navbar .nav-link {
    position: relative;
    color: #606e83 !important;
    transition: color 180ms ease;
}

.navbar .nav-link::after {
    content: "";
    position: absolute;
    right: 0.5rem;
    bottom: 0.25rem;
    left: 0.5rem;
    height: 2px;
    border-radius: 2px;
    background: var(--site-accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 220ms ease;
}

.navbar .nav-item.active .nav-link,
.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
    color: var(--site-accent-deep) !important;
}

.navbar .nav-item.active .nav-link::after,
.navbar .nav-link:hover::after,
.navbar .nav-link:focus-visible::after {
    transform: scaleX(1);
}

#navbar-year .nav-link.active {
    background-color: var(--site-accent);
}

.site-reading-progress {
    position: fixed;
    z-index: 1040;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, #547dc0, #8275ba);
    transform: scaleX(var(--reading-progress, 0));
    transform-origin: left center;
}

.site-reading-progress.is-scrollable {
    opacity: 0.85;
}

/* These classes are added only after an observer is available. No JS stays visible. */
.reveal-ready {
    transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.65, 0.3, 1), box-shadow 300ms ease !important;
    transition-delay: var(--reveal-delay, 0ms) !important;
}

.reveal-ready.reveal-pending {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
}

@media (hover: hover) and (pointer: fine) {
    main .card:not(.reveal-pending):hover,
    main .bg-white.rounded-xl:not(.reveal-pending):hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(37, 58, 94, 0.075), 0 2px 5px rgba(37, 58, 94, 0.04), 0 0 35px rgba(105, 145, 217, 0.08) !important;
    }

    .profile-card .no-break .fab,
    .profile-card .no-break .fas {
        transition: transform 200ms ease;
    }

    .profile-card .no-break:hover .fab,
    .profile-card .no-break:hover .fas {
        transform: translateY(-2px);
    }
}

@media (max-width: 767.98px) {
    .site-ambient-particle:nth-child(n+17) {
        display: none;
    }

    .profile-card .card-body.p-5 {
        padding: 1.5rem !important;
    }

    .profile-card .h1 {
        font-size: 2rem;
    }

    .profile-card .email-text {
        overflow-wrap: anywhere;
    }

    .profile-card > .card-body > .row:last-child a {
        display: inline-block;
        margin-top: 0.35rem;
        margin-bottom: 0.35rem;
    }

    .news-card .media {
        align-items: flex-start;
    }

    .news-card .media-body > .d-flex {
        gap: 0.35rem;
    }

    body::before,
    body::after {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .navbar .nav-link::after {
        right: auto;
        left: 0;
        width: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-ambient-particles {
        display: none;
    }

    .site-ambient-particle {
        animation: none;
    }

    body::before,
    body::after {
        animation: none;
    }

    .reveal-ready,
    .reveal-ready.reveal-pending {
        opacity: 1;
        transform: none;
    }

    main .card,
    main .bg-white.rounded-xl,
    .reveal-ready,
    .navbar,
    .navbar .nav-link,
    .navbar .nav-link::after,
    main a,
    .profile-card .no-break .fab,
    .profile-card .no-break .fas {
        transition: none !important;
    }

    main .card:hover,
    main .bg-white.rounded-xl:hover {
        transform: none !important;
    }
}

@media print {
    .site-ambient-particles,
    body::before,
    body::after {
        display: none;
    }
}
