html, body {
    min-height: 100%;
    margin: 0;
}

/* ============================================
    NAVIGATION
   ============================================ */

.navbar {
    background-color: transparent !important;
    backdrop-filter: blur(10px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 600;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 1);
}

/* ============================================
    SCROLL BEHAVIOR
   ============================================ */

:root {
    --nav-offset: 80px;
}

#name, section, .skill-item, .project-item {
    scroll-margin-top: var(--nav-offset, 80px);
}

/* ============================================
    CONTACT LINKS
   ============================================ */

.contact-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.contact-link:hover {
    opacity: 0.7;
}

.contact-icon {
    width: 2em;
    height: 2em;
    margin-right: 0.5em;
}

.platform-links li {
    display: flex;
    align-items: center;
    margin-bottom: 0.5em;
}

/* Project link items: icon + label + url in a row, wrapping gracefully */
.project-link-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-link-item .contact-icon {
    flex-shrink: 0;
}

.project-link-item .link {
    word-break: break-all;
    min-width: 0;
}

/* ============================================
    SKILLS SECTION
   ============================================ */

/* Skill Items */
.skill-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.skill-item {
    position: relative;
    width: 130px;
    height: 140px;
    flex-shrink: 0;
}

.skill-icon {
    width: 4em;
    height: 4em;
    object-fit: contain;
}

.skill-icon-header {
    height: 1.5em;
    width: auto;
    vertical-align: middle;
}

.skill-header-icon {
    height: 1.2em;
    width: auto;
    vertical-align: text-bottom;
    margin-right: 0.5rem;
    display: inline-block;
}

.skills-hint {
    color: rgba(255, 255, 255, 0.65);
    font-size: 1rem;
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
    font-style: italic;
}

.skills-hint-click {
    color: rgba(255, 255, 255, 0.548);
    font-size: 1rem;
    font-weight: 200;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    font-style: italic;
}

/* Skills Container Layout */
.skills-container {
    padding: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.skills-container .card {
    width: fit-content;
    max-width: 100%;
}

/* Flexbox layout for 3-column row */
@media (min-width: 992px) {
    .skills-row-3 {
        display: flex;
        justify-content: center;
        gap: 1rem;
    }
    
    .skills-row-3 > .col-lg-4 {
        display: flex;
        justify-content: center;
    }
}

/* Mobile - center all cards */
@media (max-width: 991px) {
    .skills-container > [class*="col-"] {
        display: flex;
        justify-content: center;
    }
}

/* Flip Card */
.flip-card {
    position: absolute;
    top: 0;
    left: 0;
    background-color: transparent;
    width: 130px;
    height: 140px;
    perspective: 1000px;
    z-index: 1;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip-card.flipped {
    position: fixed;
    z-index: 1000;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.closing .flip-card-inner {
    transition: transform 0.5s;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.flip-card-front, 
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0.5rem;
    overflow: hidden;
}

.flip-card-front {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.flip-card:hover .flip-card-front {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

/* Highlight animation for navigateToCard — mirrors hover effect */
@keyframes highlight-pulse {
    0%   { transform: scale(1);    box-shadow: 0 0 0 transparent; }
    20%  { transform: scale(1.08); box-shadow: 0 0 20px rgba(255, 255, 255, 0.25); }
    80%  { transform: scale(1.08); box-shadow: 0 0 20px rgba(255, 255, 255, 0.25); }
    100% { transform: scale(1);    box-shadow: 0 0 0 transparent; }
}

.flip-card-front.highlight-card {
    animation: highlight-pulse 2s ease-in-out;
}

.flip-card-back.card {
    transform: rotateY(180deg);
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap;
}

.flip-card-back .card-header {
    display: flex;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.flip-card-back .card-body {
    display: block !important;
    text-align: left;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.flip-card.closing .flip-card-back .card-header,
.flip-card.closing .flip-card-back .card-body {
    opacity: 0;
}

.flip-card-back .badge {
    opacity: 0;
    transition: opacity 0s;
}

.flip-card.flipped .flip-card-back .badge {
    opacity: 1;
    transition: opacity 0.3s ease 0.4s;
}

/* Backdrop Overlay */
.skills-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px) saturate(1.2);
}

/* ============================================
    PROJECTS
   ============================================ */

.project-header-icon {
    height: 1.5em;
    width: auto;
    vertical-align: middle;
}

.subheading {
    color: rgba(255, 255, 255, 0.473);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* Project Flip Cards */
.project-item {
    position: relative;
}

.project-item .flip-card {
    position: relative;
    width: 100%;
    height: auto;
}

.project-item .flip-card-inner {
    height: auto;
}

.project-item .flip-card-front {
    position: relative;
    height: auto;
}

/* Hide project back face when not flipped to prevent it adding to page height */
.project-item .flip-card:not(.flipped):not(.closing) .flip-card-back {
    display: none !important;
}

.project-card-front {
    justify-content: flex-start;
    align-items: stretch;
}

.project-front-img-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    overflow: hidden;
}

.project-front-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-front-icon {
    width: 2em;
    height: 2em;
    object-fit: contain;
    flex-shrink: 0;
}

.project-front-tag {
    width: 1.3em;
    object-fit: contain;
    opacity: 0.7;
}

.project-front-divider {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    user-select: none;
}

.project-back-icon {
    height: 1.8em;
    width: auto;
    vertical-align: text-bottom;
    margin-right: 0.5rem;
    display: inline-block;
}

/* Close Card Button */
.close-card-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.25rem;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    padding: 0;
    opacity: 0;
    flex-shrink: 0;
}

.flip-card.flipped .close-card-btn {
    opacity: 1;
    transition: opacity 0.3s ease 0.4s, background 0.2s, border-color 0.2s, color 0.2s;
}

.close-card-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

@media (max-width: 576px) {
    .close-card-btn {
        width: 3rem;
        height: 3rem;
        min-width: 3rem;
        min-height: 3rem;
        font-size: 1.1rem;
    }
}

/* Flipped state: override position to fixed (beats .project-item .flip-card specificity) */
.project-item .flip-card.flipped {
    position: fixed;
    z-index: 1000;
}

/* When flipped, inner must fill the card's JS-set height */
.project-item .flip-card.flipped .flip-card-inner {
    height: 100%;
}

/* When flipped, front goes absolute so it doesn't dictate inner height */
.project-item .flip-card.flipped .flip-card-front {
    position: absolute;
    height: 100%;
}

/* Allow scrolling on the back when content overflows */
.project-item .flip-card.flipped .flip-card-back {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.project-item .flip-card.flipped .flip-card-back::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Project card back layout */
.project-back-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-back-title {
    white-space: nowrap;
}

.project-back-platforms {
    flex-wrap: nowrap;
    margin-left: auto;
}

/* Mobile: 2 rows — title+close, then platforms */
@media (max-width: 576px) {
    .project-back-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .project-back-title {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1.1rem;
        order: 1;
    }

    .project-back-header > .close-card-btn {
        order: 2;
    }

    .project-back-platforms {
        order: 3;
        flex-basis: 100%;
        justify-content: center;
        margin-left: 0;
    }
}

.project-carousel-wrapper {
    display: flex;
    flex-direction: column;
}

/* Make carousel expand to fill available height on desktop */
@media (min-width: 992px) {
    .project-carousel-wrapper {
        height: 100%;
    }
    
    .project-carousel-wrapper .carousel {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .project-carousel-wrapper .carousel-inner {
        flex: 1;
        padding-bottom: 0 !important; /* Override the 16:9 ratio padding */
        height: auto;
        background-color: rgba(0, 0, 0, 0.2); /* Subtle background for letterboxing */
    }
    
    .project-carousel-wrapper .carousel-item {
        height: 100%;
    }
    
    .project-carousel-wrapper .carousel-item img {
        object-fit: contain !important; /* Don't stretch, contain within space */
        background-color: transparent;
    }
}

.project-details-wrapper {
    overflow-y: auto;
    /* Hide scrollbar when content fits */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.project-details-wrapper::-webkit-scrollbar {
    width: 8px;
}

.project-details-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.project-details-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.project-details-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Hide scrollbar completely when not needed */
.project-details-wrapper.no-scroll {
    overflow-y: hidden;
}

.project-details-wrapper .card-body {
    padding: 1.5rem;
}

.project-details-wrapper p,
.project-details-wrapper li {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Desktop: add border between carousel and details */
@media (min-width: 992px) {
    .project-details-wrapper {
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Mobile: add border between carousel and details */
@media (max-width: 991px) {
    .project-carousel-wrapper {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* ============================================
    CAROUSEL
   ============================================ */

.carousel {
    position: relative;
}

/* Force 16:9 aspect ratio */
.carousel-inner {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 ratio (9/16 = 0.5625) */
    overflow: hidden;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Controls */
.carousel-control-prev,
.carousel-control-next {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 1;
    transition: all 0.2s ease;
    top: 50%;
    transform: translateY(-50%);
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev {
    left: 10px;
}

.carousel-control-next {
    right: 10px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
    background-size: 100%;
}

/* Carousel indicators */
.carousel-indicators {
    bottom: 15px;
    margin-bottom: 0;
    gap: 5px;
}

.carousel-indicators [data-bs-target] {
    width: 30px;
    height: 3px;
    border-radius: 2px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.9);
    opacity: 1;
    transition: all 0.2s ease;
}

.carousel-indicators [data-bs-target].active {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 1);
    width: 40px;
}

.carousel-indicators [data-bs-target]:hover {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 1);
}

/* ============================================
    BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.1em;
    border-radius: 1em;
    min-width: 2em;
    min-height: 2em;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.08);
    transition: background 0.2s, box-shadow 0.2s;
}

.badge-icon {
    width: 2em;
    height: 2em;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.3em;
}

.badge span {
    display: inline-block;
    vertical-align: middle;
    font-size: 1em;
    line-height: 1;
}

/* Skill Badge Colors */
.badge-c {
    background-color: #3e678a;
}

.badge-python {
    background-color: #214766;
}

.badge-cpp {
    background-color: #0876cf;
}

.badge-cSharp {
    background-color: #65368b;
}

.badge-sql {
    background-color: rgb(12, 94, 172);
}

.badge-php {
    background-color: #474A8A;
}

.badge-html {
    background-color: orange;
}

.badge-js {
    background-color: yellow;
    color: black;
}

.badge-css {
    background-color: #4d15a8;
}

.badge-bootstrap {
    background-color: #653da5;
}

.badge-git {
    background-color: rgb(122, 43, 14);
}

.badge-firebase {
    background-color: #FF9100;
}

.badge-android {
    background-color: #a4c639;
}

.badge-ios {
    background-color: rgb(83, 143, 163);
}

.badge-web {
    background-color: #0a9db8;
}

.badge-unity, .badge-unreal {
    background-color: #000000;
}

.badge-Github {
    background-color: #101411;
}

.badge-windows {
    background-color: #357EC7;
}

.badge-flutter, .badge-dart {
    background-color: #207bc5;
}

.badge-discord {
    background-color: #5865F2;
}

/* Project Badge Colors */
.badge-saveTheSun {
    background-color: #1462a1;
}

.badge-lostTracks {
    background-color: #aa660e;
}

.badge-classic {
    background-color: #c93c11;
}

.badge-namerApp {
    background-color: brown;
}

.badge-Buxicution {
    background-color: #0a4b70;
}

.badge-toGetHer {
    background-color: #c5b248cb;
}

.badge-offThePath {
    background-color: rgba(41, 137, 167, 0.796);
}

.badge-courseWork {
    background-color: rgb(0, 0, 0);
}

.badge-BEROChat {
    background-color: rgb(35, 150, 165);
}

.badge-imgProcess {
    background-color: rgb(91, 194, 23);
}

.badge-TTTBot {
    background-color: #5865F2;
}

.badge-FriendlyReminder {
    background-color: rgb(255, 232, 191);
    color: #36240b;
}

/* ============================================
    RESPONSIVE
   ============================================ */

@media (max-width: 576px) {
    .skill-item {
        width: 110px;
        height: 130px;
    }
    
    .flip-card {
        width: 110px;
        height: 130px;
    }
}

/* ============================================
    HERO SECTION
   ============================================ */

.hero-section {
    min-height: 50vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-title-wrapper {
    text-align: left;
    padding: 2rem 0;
    position: relative;
}

.hero-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, #94a9c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    position: relative;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.85;
}

/* About Content - No Card */
.hero-about-content {
    position: relative;
    padding: 2rem 2.5rem 2rem 3rem;
    border-left: 3px solid rgba(255, 255, 255, 0.15);
}

.hero-about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
}

.hero-decorative-dots {
    display: flex;
    gap: 8px;
    margin-top: 2rem;
}

.hero-decorative-dots span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: block;
}

.hero-decorative-dots span:nth-child(2) {
    opacity: 0.7;
}

.hero-decorative-dots span:nth-child(3) {
    opacity: 0.5;
}

/* Mobile adjustments */
@media (max-width: 991px) {
    .hero-section {
        min-height: auto;
    }

    .hero-title-wrapper {
        text-align: center;
        padding: 1.5rem 0 0.5rem 0;
    }

    .hero-label {
        margin: 0 auto;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .hero-subtitle {
        font-size: 1.35rem;
        margin-bottom: 1rem !important;
    }

    .hero-about-content {
        border-left: none;
        border-top: 3px solid rgba(255, 255, 255, 0.15);
        padding: 2rem 1rem 1rem 1rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1.15rem;
    }

    .hero-about-text {
        font-size: 1rem;
    }
}