/* style.css */
:root {
    --background-colour: #CAD2C5;   /* Light background */
    --text-colour: #2f3e46;         /* Dark text */
    --button-hover-bg: rgba(47, 62, 70, 0.1);
    --contour-colour: #2f3e46;
    --content-box-colour: rgba(183, 191, 179, 0.5);
    --sub-box-colour: rgba(183, 191, 179, 0.3);
    --sub-box-colour-dark: rgba(183, 191, 179, 0.6);
    --timeline-pulse-colour: rgba(90, 119, 135, 0.7);

    /* Background variables */
    --background-width-left: 1000px;
    --background-width-right: 1500px;
    --background-left-svg: url('res/contour-1-dark.svg');
    --background-right-svg: url('res/contour-1-dark.svg');

}

html[data-theme="dark"] {
    --background-colour: #2f3e46;   /* Dark background */
    --text-colour: #CAD2C5;         /* Light text */
    --button-hover-bg: rgba(202, 210, 197, 0.2);
    --contour-colour: #CAD2C5;
    --content-box-colour: rgba(64, 85, 96, 0.5);
    --sub-box-colour: rgba(64, 85, 96, 0.3);
    --sub-box-colour-dark: rgba(64, 85, 96, 0.6);
    --timeline-pulse-colour: rgba(224, 216, 192, 0.7);

    /* Background variables */
    --background-left-svg: url('res/contour-1-light.svg');
    --background-right-svg: url('res/contour-1-light.svg');

}

html {
    scroll-behavior: smooth;
}

@keyframes pulse-effect {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--timeline-pulse-colour);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px color-mix(in srgb, var(--timeline-pulse-colour) 0%, transparent);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--timeline-pulse-colour) 0%, transparent);
    }
}

body {
    background-color: var(--background-colour);
    color: var(--text-colour);
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 100vh;
    min-width: 400px;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: "Outfit", sans-serif;
    overflow-y: scroll;
    cursor: default;
}

main {
    flex-grow: 1;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 5;
    margin-bottom: 15px;
    transition: transform 0.5s ease-out, background-color 0.3s ease, backdrop-filter 0.3s ease;
}

.header-initial {
    transform: translateY(-100%);
}

.header-animated {
    transform: translateY(0);
}

.logo {
    position: relative;
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 0 20px;
    box-sizing: border-box;
}

h1 {
    font-family: "Funnel Display", sans-serif;
    font-weight: 600;
    font-size: 4em;
    text-align: center;
    margin: 0;
}

#header-logo-container {
    display: none;
}

#header-logo {
    height: 50px;
    width: auto;
}

.nightmode-button {
    position: absolute;
    right: 20px;
    top: 42%;
    z-index: 2;
    margin-right: 15px;
}

.nightmode-button button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.nightmode-button button:hover {
    background-color: var(--button-hover-bg);
}

.nightmode-button img {
    height: 20px;
    width: auto;
    vertical-align: middle;
}

nav {
    display: flex;
    justify-content: center;
    margin-top: 5px;
    margin-bottom: 10px;
    width: 100%;
}

nav ul {
    list-style-type: none;
    display: flex;
    padding: 0;
    margin: 0;
    gap: 20px;
}

nav ul li a {
    color: var(--text-colour);
    text-decoration: none;
    font-family: "Outfit", sans-serif;
    font-weight: 350;
    font-size: 1em;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    display: block;
}

nav ul li a:hover {
    background-color: var(--button-hover-bg);
}

footer {
    width: 100%;
    text-align: center;
    padding-top: 8px;
    padding-bottom: 8px;
    margin-top: auto;
    box-sizing: border-box;
    font-size: 0.8em;
    position: relative;
    z-index: 1;
}

footer p {
    margin: 0;
    font-family: "Outfit", sans-serif;
    opacity: 0.6;
}

footer a {
    color: var(--text-colour);
    text-decoration: underline;
    opacity: 0.6;
}

footer a:hover {
    opacity: 1;
}

.social-links {
    text-align: center;
    z-index: 1;
}

.social-links a {
    display: inline-block;
}

.social-links img {
    width: 30px;
    height: 30px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.social-links img:hover {
    opacity: 1;
}

.background-svgs {
    position: fixed;
    bottom: 0;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: top;
    background-size: contain;
    transition: background-image 0.3s ease;
    opacity: 0.05;
}

.content-box {
    width: 90%;
    max-width: 1400px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: var(--content-box-colour);
    border-radius: 15px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    z-index: 1;
    color: var(--text-colour);
    opacity: 0;
    transition: opacity 1s ease-out;
}

.content-box.visible {
    opacity: 1;
}

.content-box h2 {
    font-family: "Funnel Display", sans-serif;
    font-weight: 400;
    font-size: 2em;
    margin: 0 0 15px 0;
    text-align: left;
    color: inherit;
}

.content-box p {
    font-family: "Outfit", sans-serif;
    font-size: 1em;
    line-height: 1.6;
    text-align: justify;
    margin: 0;
    padding: 0;
}

#background-left {
    left: -300px;
    top: -100px;
    rotate: -20deg;
    width: var(--background-width-left);
    background-image: var(--background-left-svg);
    background-position: top left;
}

#background-right {
    right: -700px;
    bottom: -490px;
    rotate: 170deg;
    width: var(--background-width-right);
    background-image: var(--background-right-svg);
    background-position: bottom right;
}

#scroll-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding-bottom: 5px;
    background-color: var(--text-colour);
    color: var(--background-colour);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 5;
    visibility: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.sub-box-container {
    display: flex;
    flex-direction: row;
    gap: 40px;
    text-align: center;
}

.sub-box {
    flex: 1;
    min-width: 200px;
    box-sizing: border-box;
}

.sub-box a {
    color: var(--text-colour);
    text-decoration: underline;
    opacity: 0.8;
}

.sub-box a:hover {
    opacity: 1;
}

#portrait {
    position: absolute;
    width: 22vw;
    max-width: 423px;
    height: auto;
    bottom: 0px;
    right: 35px;
    opacity: 0.85;
}

#skills {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: center;
}

.skills-box {
    position: relative;
    width: auto;
    background-color: var(--sub-box-colour);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

h4 {
    font-family: "Funnel Display", sans-serif;
    font-weight: 500;
    font-size: 1.4em;
    text-align: center;
    margin: 0;
    margin-bottom: 10px;
}

.skill {
    background-color: var(--button-hover-bg);
    padding: 5px;
    border-radius: 5px;
}

.education-timeline {
    position: relative;
    margin-bottom: 40px;
    padding: 0 20px;
}

.timeline-line-container {
    position: absolute;
    left: 0;
    right: 0;
    top: 97%;
    height: 4px;
    z-index: 1;
}

.timeline-line {
    height: 100%;
    width: 100%;
    background-color: var(--text-colour);
    opacity: 0.5;
    border-radius: 2px;
}

.timeline-events {
    display: flex;
    justify-content: space-around;
    position: relative;
    z-index: 2;
    padding-top: 100px;
}

.timeline-event {
    position: relative;
    cursor: pointer;
}

.timeline-event-contents {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    position: relative;
    width: auto;
}

.timeline-event-visuals {
    position: relative;
    width: 200px;
    min-height: 230px;
    flex-shrink: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.timeline-event-details {
    position: absolute;
    display: block;
    max-width: 0;
    margin-left: 0;
    opacity: 0;
    max-height: 0;
    min-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-out, max-height 0.4s ease-out;
}

.timeline-event-details p {
    text-align: left;
    font-size: 0.9em;
}

.timeline-point {
    width: 20px;
    height: 20px;
    background-color: var(--text-colour);
    border: 4px solid var(--content-box-colour);
    border-radius: 50%;
    position: absolute;
    bottom: -5px;
    left: 30px;
    animation: pulse-effect 2s infinite ease-out;
    z-index: 3;
}

.timeline-label {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform-origin: 0% 100%;
    transform: translateX(-10px) translateY(-5px) rotate(-45deg);
    white-space: nowrap;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 09.em;
    color: var(--text-colour);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-label span {
    display: block;
    line-height: 1.3;
}

.timeline-label .title {
    font-weight: 700;
    font-size: 1.4em;
}

.timeline-label .degree {
    font-weight: 600;
    font-size: 1.05em;
}

.timeline-label .institution {
    font-size: 0.9em;
    opacity: 0.8;
}

.timeline-label .dates {
    font-size: 0.8em;
    opacity: 0.7;
}

.timeline-event.active .timeline-event-visuals {
    transform: translateX(-60px);
}

.timeline-event.active .timeline-label {
    left: 60%;
    bottom: 35px;
    transform: rotate(-90deg);
}

.timeline-event.active .timeline-event-details {
    opacity: 1;
    left: 80px;
    bottom: 42px;
    max-width: 300px;
    width: 160px;
    max-height: 300px;
}

.experience-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    min-height: 450px;
}

#experience-globe {
    flex: 2;
    border-radius: 10px;
    height: 550px;
}

.experience-list {
    flex: 1;
}

.news-item {
    flex: 1;
    min-width: 200px;
    min-height: 290px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.news-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.news-bg img {
    object-fit: cover;
    object-position: center;
    height: 100%;
    width: 100%;
    transition: transform 0.4s ease-out;
}

.news-overlay {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%; 
   height: 100%;
   z-index: 2;
   transition: background-color 0.5s ease, backdrop-filter 0.5s ease;
   overflow: hidden;
   padding: 10px;
   box-sizing: border-box;
   display: flex;
   flex-direction: column;
   justify-content: flex-end;
}

.news-overlay h4 {
    box-sizing: border-box;
    text-align: left;
    padding: 10px;
    margin: 0;
    font-weight: 600;
    font-size: 1.4em;
    color: var(--text-colour);
    transition: padding-top 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 4;
    background-color: var(--sub-box-colour-dark);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px;
}

.news-details {
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    transform: translateY(10px);
    transition: opacity 0.3s 0.1s ease-out, visibility 0s 0.4s linear, transform 0.3s 0.1s ease-out, max-height 0.4s 0.1s ease-out;
    z-index: 3;
    box-sizing: border-box;
    color: var(--text-colour);
    text-align: left;
    overflow: hidden;
    width: 100%;
    padding: 0px 10px;
}

.news-details p {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    line-height: 1.5;
    text-align: left;
}

.news-button {
    display: inline-block;
    padding: 7px 14px;
    background-color: var(--text-colour);
    color: var(--background-colour);
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: 1px solid transparent;
}

.news-button:hover {
    background-color: transparent;
    color: var(--text-colour);
    border-color: var(--text-colour);
    transform: translateY(-2px);
}

.news-overlay:hover {
    background-color: var(--sub-box-colour-dark);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.news-item:hover .news-bg img {
    transform: scale(1.1);
}

.news-item:hover .news-overlay {
    background-color: var(--sub-box-colour-dark);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    justify-content: flex-start;
}

.news-item:hover .news-overlay h4 {
    background-color: transparent;
    backdrop-filter: unset;
}

.news-item:hover .news-details {
    opacity: 1;
    visibility: visible;
    max-height: 300px;
    transform: translateY(0);
    transition-delay: 0.15s;
}

.mapboxgl-popup-content {
    background-color: var(--background-colour);
    color: var(--text-colour);
    font-family: "Outfit", sans-serif;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.mapboxgl-popup-content h3 {
    margin-block: 0.2em;
}

.mapboxgl-popup-close-button {
    color: var(--text-colour);
    font-size: 1.5em;
    padding: 0 5px;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-left .mapbox-popup-tip,
.mapboxgl-popup-anchor-right .mapbox-popup-tip {
    border-color: transparent; 
}

.mapboxgl-popup-content a {
    color: var(--text-colour);
    text-decoration: underline;
    opacity: 0.7;
}

@media screen and (min-width: 769px) {
    header {
        position: sticky;
        top: 0;
    }

    header.sticky {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    #scroll-top {
        display: none;
    }
}

@media screen and (max-width: 1000px) {
    .education-timeline {
        margin: 0;
        padding: 0;
        padding-left: 20px;
    }

    .timeline-line-container {
        left: 20px;
        top: 0;
        bottom: 0;
        height: auto;
        width: 4px;
    }

    .timeline-line {
        width: 100%;
        height: 100%;
    }

    .timeline-events {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 30px;
        padding-left: 0;
        gap: 30px;
    }

    .timeline-event {
        width: 100%;
        align-items: flex-start;
        padding-left: 0px;
        display: flex;
        flex-direction: column;
        cursor: default;
    }

    .timeline-event-contents {
        flex-direction: column;
    }

    .timeline-event-visuals {
        position: relative;
        min-height: auto;
        width: 100%;
    }

    .timeline-point {
        top: 7px;
        left: -12px;
        animation: none;
    }

    .timeline-label {
        position: relative;
        transform: none;
        bottom: auto;
        left: 20px;
        white-space: normal;
        margin-bottom: 10px;
    }

    .timeline-event-details {
        position: relative;
        display: block;
        opacity: 0.6;
        max-height: none;
        max-width: none;
        overflow: visible;
        margin-left: 28px;
        padding-right: 10px;
    }

    .timeline-label span {
        line-height: 1.4;
    }

    .news-item {
        min-height: 310px;
    }

}

@media screen and (max-width: 900px) {
    .sub-box-container {
        flex-direction: column;
    }

    #portrait {
        position: relative;
        bottom: -25px;
        width: 50vw;
        right: 0;
    }

    .experience-container {
        flex-direction: column;
    }

    #experience-globe {
        height: 400px;
        width: 100%;
    }

}

@media screen and (max-width: 768px) {
    #header-title {
        display: none;
    }

    #header-logo-container {
        display: block;
    }

    .logo {
        align-items: center;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
    }

    #background-right {
        right: -1000px;
    }

    header {
        position: relative;
        top: auto;
        background-color: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
    }

    .news-overlay {
        backdrop-filter: blur(7px);
        -webkit-backdrop-filter: blur(7px); 
        background-color: var(--sub-box-colour-dark);
    }

    .news-overlay h4 {
        background-color: transparent;
        backdrop-filter: unset;
        -webkit-backdrop-filter: unset;
        top: -10px;
    }

    .news-details {
        visibility: visible;
        max-height: 600px;
        opacity: 1;
        padding-bottom: 15px;
    }

}

