/* CSS Variables for Theming */
:root {
    --bg-color: #1c1e26;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.2);
    --secondary-color: #e0e5ec;
    --accent-color: #00a8ff;
    --text-color: #d1d9e6;
    --text-color-light: #a8b2c8;
    --border-radius: 15px;
}

/* ========================================= */
/* RESET / GLOBAL STYLES                    */
/* ========================================= */
/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background decorative blobs */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    filter: blur(150px);
    opacity: 0.5;
}

body::before {
    width: 400px;
    height: 400px;
    background: var(--accent-color);
    top: -10%;
    left: -10%;
}

body::after {
    width: 300px;
    height: 300px;
    background: #f0f;
    bottom: 5%;
    right: 0%;
    animation: moveBlob 15s infinite alternate;
}

@keyframes moveBlob {
    from {
        transform: translate(0, 0) rotate(0deg);
    }
    to {
        transform: translate(50px, -50px) rotate(90deg);
    }
}

h1, h2, h3 {
    font-weight: 600;
}

h2.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
}

/* ========================================= */
/* LAYOUT WRAPPERS                          */
/* ========================================= */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    min-height: 100vh;
}

main {
    padding-top: 0.5rem;
}

/* ========================================= */
/* HEADER SECTION                           */
/* ========================================= */

/* Header & Navigation */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 0;
    z-index: 1000;
    transition: background 0.3s ease;
}

.header.scrolled {
    background: rgba(28, 30, 38, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: auto;
}

.nav__logo {
    flex: 0 0 30%; 
    align-items: center;
}

.nav__logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: flex;
    align-items: center;
}

.nav__menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2.5rem;
    flex: 0 0 70%;
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    animation: none;
    right: auto;
}

.nav__list {
    display: flex;
    justify-content: space-around; /* This creates equal space around each item */
    align-items: center; /* This keeps the items vertically centered */
    list-style: none; /* Already in your code, but good to double-check */
    padding: 0;
    margin: 0;
    width: 100%; /* Ensure the list fills the entire 80% of its parent (.nav__menu) */
}

.nav__link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 10px 15px; 
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

.nav__link:hover {
    background-color: rgba(255, 255, 255, 0.1); 
    color: var(--accent-color);
    transform: translateY(-3px); 
}

.nav__link.active {
    color: var(--accent-color);
}

.nav__toggle {
    display: none; /* Hidden on desktop */
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav__toggle:hover {
    transform: scale(1.1);
    color: var(--accent-color);
}

.nav__toggle:active {
    transform: scale(0.95);
}

.nav__close {
    display: none; /* Hidden on desktop */
    transition: all 0.3s ease;
}

.nav__close:hover {
    transform: scale(1.1) rotate(90deg);
    color: var(--accent-color);
}

.nav__close:active {
    transform: scale(0.95) rotate(90deg);
}

/* Item animations for when the menu opens on mobile */
.nav__item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.nav__item:nth-child(1) { animation-delay: 0.1s; }
.nav__item:nth-child(2) { animation-delay: 0.2s; }
.nav__item:nth-child(3) { animation-delay: 0.3s; }
.nav__item:nth-child(4) { animation-delay: 0.4s; }

/* Mobile menu animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile/Tablet Styles 
  (This is the missing media query that makes the menu responsive)
*/
@media screen and (max-width: 768px) {
    .nav__menu {
        position: fixed;
        top: 0;
        right: -100%; /* Off-canvas positioning */
        width: 70%;
        height: 100vh;
        background: rgba(28, 30, 38, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
    }

    .nav__menu.show-menu {
        right: 0; /* JS will add this class to show the menu */
    }

    .nav__list {
        flex-direction: column; /* Stacks items vertically on mobile */
        gap: 2rem;
    }

    .nav__toggle {
        display: block; /* Shows the hamburger icon */
    }

    .nav__close {
        display: block; /* Shows the close icon */
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        font-size: 2rem;
        cursor: pointer;
    }
}

/* ========================================= */
/* MAIN SECTION                             */
/* ========================================= */

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 4rem;
}

.hero__content {
    width: 100%;
    max-width: 500px;
}

.hero__content h1::before {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: clamp(2.2rem, 5.5vw, 3.5rem); 
    content: '';
}


.hero__content h3 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.hero__content p {
    margin-bottom: 2rem;
    max-width: 500px;
}

/* Hero Social Links */
.hero__social-links {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.hero__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    text-decoration: none;
    color: var(--text-color);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero__social-link i {
    font-size: 1.5rem;
}

/* Specific icon colors */
.hero__social-link i.bxs-envelope {
    color: #ea4335; /* Gmail red */
}

.hero__social-link i.bxl-linkedin-square {
    color: #0077b5; /* LinkedIn blue */
}

.hero__social-link i.bxl-facebook-square {
    color: #1877f2; /* Facebook blue */
}

.hero__social-link:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.hero__social-link:active {
    transform: translateY(0) scale(1);
}

/* Remove hover effects on mobile for touch-friendly interface */
.hero__social-link:hover {
    transform: none;
    background: var(--glass-bg);
    border-color: var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero__social-link:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

/* Floating Image Frame */
.hero__image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero__image-frame {
    padding: 1.5rem;
    position: relative;
}

.hero__img {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: var(--border-radius);
    display: block;
}

/* --- Skills Section --- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 2rem;
}

.skill__card-container {
  perspective: 1000px;
  width: 100%;
  height: 210px;
}

.skill__card {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
}

/* --- FIX: Simplified flip logic --- */
/* This class will be added by JavaScript on touch devices */
.skill__card.is-flipped {
    transform: rotateY(180deg);
}

/* This media query targets devices with a mouse for hover effects */
@media (hover: hover) and (pointer: fine) {
    .skill__card:hover {
        transform: rotateY(180deg);
    }
}


.skill__card-front, 
.skill__card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.25rem 1rem;
  border-radius: var(--border-radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 6px 24px -6px rgba(0,0,0,.45);
}

.skill__card-back {
  transform: rotateY(180deg);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.22);
  text-align: center;
}

.skill__card-front img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
  transition: transform .45s ease;
  pointer-events: none;
}

.skill__card:hover .skill__card-front img {
  transform: scale(1.12);
}

.skill__card-back h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .55rem;
  color: var(--secondary-color);
  letter-spacing: .4px;
}

.skill__card-back p {
  font-size: .78rem;
  line-height: 1.35;
  color: var(--text-color-light);
  max-width: 95%;
  margin: 0 auto;
  opacity: .95;
}

/* --- End Skills Section --- */

/* Experience & Education Section */
.experience__grid,
.education__grid {
    display: grid;
    gap: 2rem;
}

.experience__card,
.education__card {
    padding: 2rem;
}

.experience__card h3, .education__card h3 {
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.experience__card .date, .education__card .date {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin: 0.5rem 0 1rem;
}

.experience__card ul {
    list-style-position: inside;
    padding-left: 0;
}

.experience__card ul li {
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .experience__grid,
    .education__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Slideshow Section --- */
.slideshow__container {
    position: relative;
    max-width: 1400px;
    height: 600px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.slideshow__slide {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.slideshow__slide.active {
    opacity: 1;
    pointer-events: auto;
}

.slideshow__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.slideshow__controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
}

.slideshow__btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    pointer-events: auto;
}

.slideshow__btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    opacity: 1;
    transform: scale(1.1);
}

.slideshow__btn:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    opacity: 0.8;
    transform: none;
}

.slideshow__btn:active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    opacity: 1;
    transform: scale(0.95);
}

/* ========================================= */
/* FOOTER SECTION                           */
/* ========================================= */

/* Footer Section */
.footer {
    background-color: transparent;
    border-top: 1px solid var(--glass-border);
    padding: 3rem 0;
    text-align: center;
}

.footer__socials {
    margin-bottom: 1.5rem;
}

.footer__social-link {
    font-size: 1.8rem;
    color: var(--text-color);
    margin: 0 1rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer__social-link:hover {
    color: var(--accent-color);
}

/* Remove hover effects on mobile for touch-friendly interface */
.footer__social-link:hover {
    color: var(--text-color);
}

.footer__social-link:active {
    color: var(--accent-color);
    transform: scale(0.95);
}

/* ========================================= */
/* UTILITY CLASSES                          */
/* ========================================= */

/* Glassmorphism Style */
.glassmorphic {
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    margin-top: 1rem;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 1.2rem;
    color: #ff4757; /* PDF red color */
}

.btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Remove hover effects on mobile for touch-friendly interface */
.btn:hover {
    transform: none;
    background: var(--glass-bg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: all 0.3s ease;
}

.scroll-top.show-scroll {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Remove hover effects on mobile for touch-friendly interface */
.scroll-top:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    color: var(--text-color);
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.scroll-top:active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(0) scale(0.95);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}


/* ========================================= */
/* MOBILE / RESPONSIVE OPTIMIZATIONS        */
/* ========================================= */

/* --- TABLET VIEW (992px and below) --- */
@media (max-width: 992px) {
    /* Hero Section Tablet Adjustments */
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        min-height: auto;
        gap: 3rem;
        padding-top: 0;      /* rely on main offset */
        padding-bottom: 3rem;
    }

    .header {
        padding: 1.2rem 0; /* unified tablet header padding */
    }

    main {
        padding-top: 7rem; /* slightly smaller on tablet */
    }

    /* Skills Grid Tablet */
    .skills__grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1.5rem;
    }

    .skill__card-container {
        height: 190px;
    }
}

/* --- MOBILE VIEW (768px and below) --- */
@media (max-width: 768px) {

    .header {
        padding: 0.75rem 0;
    }
    main {
        padding-top: 6.25rem; /* mobile offset */
    }

    /* Container Mobile */
    .container {
        padding: 0 1.5rem;
    }

    /* Section Spacing Mobile */
    section {
        padding: 2rem 0;
    }

    h2.section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    /* Header Mobile */
    .header {
        padding: 0.8rem 0;
    }

    /* Navigation Mobile */
    .nav__toggle {
        display: block;
        z-index: 1002;
    }

    .nav__toggle:hover {
        transform: none;
        color: var(--text-color);
    }

    .nav__toggle:active {
        transform: scale(0.95);
        color: var(--accent-color);
    }
    
    .nav__menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100%;
        background: rgba(28, 30, 38, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: right 0.4s ease-in-out;
        z-index: 1001;
        padding-top: 6rem;
        animation: slideOutRight 0.4s ease-in-out;
        display: block; /* override desktop flex layout */
    }
    
    .nav__menu.show-menu {
        right: 0;
        animation: slideInRight 0.4s ease-in-out;
    }

    /* Hide hamburger only when menu open (mobile) */
    .nav__menu.show-menu ~ .nav__toggle {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    .nav__menu .nav__list {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
    }
}

/* Restore enhanced hover effects for pointer devices; simplify mobile overrides */
/* Consolidated touch overrides */
@media (hover: none) {
    .hero__social-link:hover { 
        transform: none; 
        background: var(--glass-bg); 
        border-color: var(--glass-border); 
        box-shadow: 0 4px 15px rgba(0,0,0,.1);
    }
    .btn:hover {
        transform: none;
        background: var(--glass-bg);
        box-shadow: 0 4px 15px rgba(0,0,0,.1);
    }
    .footer__social-link:hover { color: var(--text-color); }
    .scroll-top:hover {
        background: var(--glass-bg);
        border-color: var(--glass-border);
        color: var(--text-color);
        transform: translateY(0);
        box-shadow: 0 4px 15px rgba(0,0,0,.1);
    }
    .slideshow__btn:hover {
        background: var(--glass-bg);
        border-color: var(--glass-border);
        opacity: 0.8;
        transform: none;
    }
}

/* Ensure nav visibility on desktop when header is scrolled */
.header.scrolled .nav__menu { background: transparent; }

/* Optional: keep items fully visible on desktop without entry animation */
@media (min-width: 769px) {
    .nav__item { opacity: 1; transform: none; animation: none; }
}