/* Keep the document in normal flow. Older versions positioned the BODY at 80vh,
   which caused large cross-engine differences between Chromium and Firefox. */
html {
    scroll-behavior: smooth;
    background: #202020;
}
html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}
body {
    min-height: 100vh;
    height: auto;
    font-size: 1rem;
    line-height: 1.5;
    background: #202020;
}
body.bg_slider {
    position: relative;
    top: auto;
    /* Keep all background/content layers inside the same painting context. */
    isolation: isolate;
}
/* The banner appears above the solid page canvas and below site content.
   It scrolls with the document; it must not follow the viewport. */
body.bg_slider > main,
body.bg_slider > header,
body.bg_slider > footer,
body.bg_slider > #buttonConatiner,
body.bg_slider > h1,
body.bg_slider > p,
body.bg_slider > img {
    position: relative;
    z-index: 1;
}

/* Full-width at the top; floating and compact after scrolling on desktop. */
#navBar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    padding: 0.65rem clamp(0.75rem, 2vw, 1.4rem);
    background-color: rgba(0, 0, 0, 0.32);
    border-radius: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: width 550ms ease, top 550ms ease, padding 550ms ease,
        background-color 550ms ease, border-radius 550ms ease,
        box-shadow 550ms ease;
    z-index: 999;
}

#navBar.scrolled {
    top: clamp(8px, 2vh, 18px);
    width: min(92%, 1180px);
    padding-block: 0.3rem;
    background-color: rgba(0, 0, 0, 0.82);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

#navContainer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
}

#navHomeLink {
    display: inline-flex;
    align-items: center;
    justify-self: start;
}

#navHomeLink img {
    display: block;
    width: auto;
    height: clamp(38px, 3.2vw, 48px);
    transition: height 550ms ease;
}

#navBar.scrolled #navHomeLink img {
    height: clamp(34px, 2.8vw, 42px);
}

#navTitle {
    justify-self: center;
    color: white;
    font-family: Decorative_Cursive;
    font-size: clamp(2.25rem, 4vw, 3.5rem);
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: font-size 550ms ease;
}

#navBar.scrolled #navTitle {
    font-size: clamp(2.1rem, 3.4vw, 3rem);
}

a {
    color: rgb(0, 50, 255);
}

button {
    background: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: white;
    font-family: Arial, Helvetica, sans-serif;
}

hr {
    width: 90%;
    border-radius: 15px;
    border: 5px double white;
}

p {
    padding-left: 5%;
    padding-right: 5%;
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
}

ul,
li {
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
}

footer {
    width: 100%;
    height: fit-content;
    margin-bottom: 0px;
    margin-top: 0.1vh;
    padding-bottom: 1px;
    border-bottom: 1px solid black;
    background-image: linear-gradient(to bottom, #202020, #000000);
}

footer .footer_content {
    position: relative;
    bottom: 0;
    margin: 0px;
    height: fit-content;
    width: 100%;
}

@font-face {
    font-family: Decorative_Cursive;
    src: url("../Fonts/Allura-Regular.ttf");
    font-display: swap;
}

@font-face {
    font-family: Robotic;
    src: url("../Fonts/ROBOTIC.ttf");
    font-display: swap;
}

@font-face {
    font-family: futuristic;
    src: url('../Fonts/Stacker.ttf');
    font-display: swap;
}

/* Pin the slideshow to the VIEWPORT while content scrolls over it.
   The scroll handler fades it out as the visitor moves into the page;
   it fades back in when they return to the top. */
#bgSliderContainer {
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    width: 100%;
    height: 80vh;
    background-color: #202020;
    overflow: hidden;
}

/* A continuous shaded layer behind the hero and overlapping content,
   fading into the solid #202020 canvas at the bottom of the viewport. */
body[data-slider-page] #bgSliderContainer::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, .53) 0%,
        rgba(0, 0, 0, .58) 40%,
        rgba(0, 0, 0, .75) 65%,
        rgba(32, 32, 32, .93) 88%,
        #202020 100%);
}

/* Flex slides avoid the inline-image baseline gap and 100vw scrollbar-width
   discrepancies. Translate by a percentage of the viewport-sized track. */
#bgSlider {
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    transition: transform 4s ease;
    will-change: transform;
}
.slider-image {
    display: block;
    flex: 0 0 100%;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: cover;
    object-position: center;
}

/* Normal horizontal links on laptop and desktop. */
.dropdown {
    position: relative;
    justify-self: end;
}

.dropbtn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background-color: rgba(70, 70, 70, 0.65);
    cursor: pointer;
}

.dropbtn img {
    display: block;
    pointer-events: none;
    width: 100%;
    height: auto;
}

.dropdown-content {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 0.9rem;
    color: whitesmoke;
    font-family: monospace;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 12px;
    transition: background-color 200ms ease;
}

.dropdown-content a:hover {
    background-color: #646464;
    border-radius: 180px;
}

#navBar a:focus-visible,
.dropbtn:focus-visible {
    outline: 2px solid #8cb4ff;
    outline-offset: 3px;
}

/* Keep five desktop links readable while retaining the original 860px mobile menu cutoff. */
@media (min-width: 861px) and (max-width: 1180px) {
    #navContainer {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    #navTitle {
        margin-inline: .5rem;
    }

    .dropdown-content a {
        font-size: 14px;
        padding: .75rem .65rem;
    }
}

/* Mobile / narrow screens: retain the existing dropdown icon. */
@media (max-width: 860px) {

    /* Keep the mobile navbar compact and stable: no width/height jump on scroll. */
    #navBar,
    #navBar.scrolled {
        top: 8px;
        width: calc(100% - 16px);
        padding: 0.35rem 0.8rem;
        border-radius: 15px;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.55);
    }

    #navBar.scrolled {
        background-color: rgba(0, 0, 0, 0.82);
    }

    #navBar.scrolled #navHomeLink img {
        height: 40px;
    }

    #navBar.scrolled #navTitle {
        font-size: clamp(1.85rem, 7vw, 2.5rem);
    }

    /* Mobile long-press works without selecting the decorative brand title. */
    #navTitle {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    #navContainer {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 0.5rem;
        min-height: 52px;
    }

    #navHomeLink img {
        height: 40px;
    }

    #navTitle {
        font-size: clamp(1.85rem, 7vw, 2.5rem);
    }

    .dropbtn {
        display: flex;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        top: calc(100% + 0.7rem);
        right: -0.3rem;
        box-sizing: border-box;
        width: min(240px, calc(100vw - 3rem));
        padding: 0.35rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        background-color: #464646;
        border-radius: 12px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.9);
        z-index: 1;
    }

    .dropdown-content.is-open {
        display: flex;
    }

    .dropdown-content a {
        padding: 0.9rem 1rem;
    }
}

#welcomeTitle {
    font-family: Decorative_Cursive;
    font-size: clamp(2.65rem, 7vw, 5rem);
    line-height: 1.15;
    text-wrap: balance;
    margin: 1%;
}

#ProjectsWelcomeTitle {
    font-family: Robotic;
    font-size: clamp(2.65rem, 7vw, 5rem);
    line-height: 1.15;
    text-wrap: balance;
    margin: 1%;
}

#projectContainer {
    table-layout: fixed;
    width: 80%;
    text-align: center;
}

#projectContainer tr td div {
    height: 20vh;
    overflow-y: auto;
    margin: 1%;
    padding: 1%;
}

#projectIcon {
    width: 15%;
}

#search {
    width: 100%;
}

#searchBar {
    background-image: url("../Images/SearchIcon.png");
    background-position: 1% 50%;
    background-size: auto 90%;
    background-repeat: no-repeat;
    width: 90%;
    font-size: clamp(1rem, 1.35vw, 1.2rem);
    font-family: monospace;
    color: white;
    padding: 12px;
    padding-left: 5%;
    margin-top: 12px;
    margin-bottom: 12px;
    border: 1px solid #6e6e6e;
    border-radius: 15px;
    background-color: #2f2f2f;
}

#List {
    list-style-type: none;
    padding: 0;
    margin: 0;
    margin-left: 10%;
    margin-right: 10%;
    width: 100%;
    opacity: 0;
    max-height: 20vh;
    overflow-y: auto;
}

#List li a {
    transition: border-color 900ms ease, background-color 900ms ease, border-radius 500ms ease, color 900ms ease;
    border: 2px solid darkgrey;
    background-color: #404040;
    border-radius: 30px;
    margin-top: -1px;
    padding: 12px;
    text-decoration: none;
    font-size: 18px;
    color: white;
    font-family: monospace;
    opacity: 0;
    display: none;
}

#List li a:hover:not(.header) {
    border-radius: 10px;
    background-color: darkgrey;
}

/* Main portfolio paging controls; shared by Home, Projects, Research, and About. */
#buttonConatiner.site-page-navigation {
    box-sizing: border-box;
    width: min(95vw, 1600px);
    margin: clamp(1rem, 2.5vw, 2rem) auto clamp(1.5rem, 3vw, 2.5rem);
    padding-inline: clamp(.25rem, 1.3vw, 1rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(.75rem, 2vw, 1.5rem);
}

#backButton,
#nextButton {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: min(8.5rem, 39vw);
    min-height: 3.25rem;
    margin: 0;
    padding: .4rem clamp(.9rem, 2vw, 1.65rem);
    color: white;
    background-color: #303030;
    border: 1px solid white;
    border-radius: 15px;
    font-family: Decorative_Cursive;
    font-size: clamp(1.4rem, 2.1vw, 2rem);
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 170ms ease, transform 170ms ease;
}

#backButton:hover,
#nextButton:hover {
    background-color: #424242;
    transform: translateY(-2px);
}

#backButton:focus-visible,
#nextButton:focus-visible {
    outline: 2px solid #b4ceff;
    outline-offset: 4px;
}

@media (max-width: 480px) {
    #backButton, #nextButton {
        min-height: 3rem;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #backButton, #nextButton { transition: none; }
    #backButton:hover, #nextButton:hover { transform: none; }
}

/************************************
*         GitHub Contributions      *
*************************************/

.github-widget {
    width: 86%;
    margin: 3vh auto;
    padding: 2rem;
    background: rgba(32, 32, 32, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
}

.github-widget-featured .hero {
    text-align: center;
}

.gh-featured-note {
    margin: 0.5rem auto 1rem auto;
    max-width: 850px;
    text-align: center;
    color: #d8d8d8;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    padding-left: 0;
    padding-right: 0;
}

.hero {
    margin-bottom: 1.75rem;
}

.hero h2 {
    margin-bottom: 0.75rem;
    font-family: monospace;
    font-size: 2rem;
    letter-spacing: 0.04em;
    text-align: center;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.form-row input[type="text"] {
    flex: 1 1 320px;
    max-width: 560px;
    min-width: 220px;
    font-size: 1rem;
    font-family: monospace;
    color: white;
    background-color: rgba(47, 47, 47, 0.92);
    border: 1px solid #6e6e6e;
    border-radius: 15px;
    padding: 12px 14px;
    outline: none;
    transition: border-color 250ms ease, box-shadow 250ms ease, background-color 250ms ease;
}

.form-row input[type="text"]:focus {
    border-color: #8cb4ff;
    box-shadow: 0 0 0 3px rgba(0, 80, 255, 0.18);
    background-color: rgba(58, 58, 58, 0.96);
}

.gh-load-btn,
.ghost-btn {
    color: white;
    background-color: #303030;
    border: 1px solid white;
    border-radius: 15px;
    padding: 12px 18px;
    font-family: monospace;
    font-size: 1rem;
    transition: background-color 250ms ease, transform 180ms ease, border-radius 250ms ease;
}

.gh-load-btn:hover,
.ghost-btn:hover {
    cursor: pointer;
    background-color: #404040;
    border-radius: 10px;
}

.gh-load-btn:active,
.ghost-btn:active {
    transform: translateY(1px);
}

.toggle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.checkbox-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: white;
    font-family: monospace;
    font-size: 0.95rem;
}

.checkbox-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: rgb(0, 50, 255);
}

.status {
    display: none;
    width: 90%;
    margin: 1rem auto 0 auto;
    padding: 0.9rem 1rem;
    border-radius: 15px;
    font-family: monospace;
    font-size: 0.95rem;
    color: white;
    background-color: rgba(60, 60, 60, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.status.show {
    display: block;
}

.status.error {
    background-color: rgba(120, 35, 35, 0.94);
    border-color: rgba(255, 130, 130, 0.35);
}

.meta-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.meta-card {
    background: rgba(45, 45, 45, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 18px;
    padding: 1rem;
    text-align: center;
}

.meta-label {
    color: #cfcfcf;
    font-family: monospace;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.45rem;
}

.meta-value {
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    word-break: break-word;
}

.section {
    margin-top: 1.8rem;
}

.section h3 {
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.45rem;
    margin-bottom: 1rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-head h3 {
    margin: 0;
    text-align: left;
}

.highlight-card,
.repo-card,
.empty {
    background: rgba(42, 42, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.highlight-card {
    padding: 1.25rem;
    border-color: rgba(100, 160, 255, 0.22);
    background:
        linear-gradient(to bottom, rgba(55, 55, 55, 0.94), rgba(36, 36, 36, 0.96));
}

.repo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 1rem;
}

.repo-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 200ms ease, border-color 250ms ease, background-color 250ms ease;
}

.repo-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(55, 55, 55, 0.96);
}

.repo-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.repo-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1.35;
}

.repo-title a {
    color: white;
    text-decoration: none;
    transition: color 200ms ease;
}

.repo-title a:hover,
.inline-link:hover {
    color: #8cb4ff;
}

.desc {
    color: #d8d8d8;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.96rem;
    line-height: 1.55;
    margin: 0;
    min-height: 3em;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.stats span {
    display: inline-block;
    color: white;
    background-color: #383838;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-family: monospace;
    font-size: 0.84rem;
}

.pill {
    display: inline-block;
    white-space: nowrap;
    color: white;
    background: linear-gradient(to right, #2d5dcb, #19388c);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: bold;
}

.rank-pill {
    background: linear-gradient(to right, #4d4d4d, #2f2f2f);
}

.ghost-btn {
    font-size: 0.92rem;
    padding: 10px 16px;
}

.empty {
    padding: 1.4rem;
    text-align: center;
    color: #d5d5d5;
    font-family: monospace;
    font-size: 0.95rem;
}

.inline-link {
    color: rgb(120, 170, 255);
    text-decoration: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: ghSpin 0.8s linear infinite;
}

@keyframes ghSpin {
    to {
        transform: rotate(360deg);
    }
}

/************************************
*            Responsive             *
*************************************/

@media (max-width: 1100px) {
    .repo-grid {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }

    .meta-bar {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

@media (max-width: 700px) {
    .github-widget {
        width: 92%;
        padding: 1.25rem;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row input[type="text"],
    .gh-load-btn,
    .ghost-btn {
        width: 100%;
        max-width: none;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .section-head h3 {
        text-align: center;
    }

    .repo-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .repo-grid,
    .meta-bar {
        grid-template-columns: 1fr;
    }
}

/************************************
*               Utility             *
*************************************/

.center {
    margin: 0 auto;
    text-align: center;
    align-content: center;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Accessibility: browser text zoom remains authoritative; reduce animated layout. */
@media (prefers-reduced-motion: reduce) {

    #navBar,
    #navTitle,
    #navHomeLink img {
        transition: none;
    }
}


/* Shared footer layout. */
.site-footer-inner {
    box-sizing: border-box;
    width: 100%;
    padding: clamp(1.25rem, 4vw, 2.5rem) max(1rem, calc((100vw - 1120px) / 2));
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    color: #fff;
}

.site-footer-brand {
    max-width: 360px;
}

.site-footer-brand h2 {
    font: 2.3rem/1 Decorative_Cursive, cursive;
    margin: 0 0 .5rem;
}

.site-footer-brand p {
    margin: 0;
    padding: 0;
    color: #c7c7c7;
    line-height: 1.5;
}

.site-footer-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(2rem, 6vw, 6rem);
}

.site-footer-group {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.site-footer-heading {
    font: .78rem monospace;
    color: #b5b5b5;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: .3rem;
}

.site-footer-group a {
    color: #ededed;
    font: .95rem/1.55 monospace;
    text-decoration: none;
}

.site-footer-group a:hover,
.site-footer-group a:focus-visible {
    color: #a8c5ff;
    text-decoration: underline;
}

@media (max-width: 700px) {
    .site-footer-navigation {
        width: 100%;
        justify-content: space-between;
    }
}
/* Consistent visual fallback if backdrop blur is disabled or unsupported. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #navBar { background-color: rgba(22,22,22,.94); }
    .github-widget { background-color: rgba(32,32,32,.97); }
}
@media (prefers-reduced-motion: reduce) {
    #bgSlider { transition: none; will-change: auto; }
}

/* Firefox-specific painting fallback for large translucent content panels.
   Firefox may claim backdrop-filter support even when WebRender does not
   correctly composite the filtered surface.  Using an almost opaque color
   preserves the charcoal appearance without depending on that effect. */
@supports (-moz-appearance: none) {
    .github-widget {
        background-color: rgba(32, 32, 32, .97);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
