/* --- 1. Global Variables & Reset --- */
@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

:root {
    /* DARK THEME (Default) */
    --bg-color: #0b0d15;
    --text-color: #ffffff;
    --text-secondary: #a2a5b3;
    --card-bg: #1c1f2b;
    --glass-bg: rgba(80, 80, 80, 0.25);
    --glass-border: rgba(255, 255, 255, 0.15);
    --nav-track: rgba(0, 0, 0, 0.2);
    --dot-inactive: rgba(255, 255, 255, 0.2);
    --dot-active-bg: #ffffff;
    --dot-text: #000000;
    --hero-gradient: radial-gradient(circle at 50% 50%, #2a2a2a 0%, #0b0d15 60%);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    /* LIGHT THEME OVERRIDES */
    --bg-color: #f2f2f7; 
    --text-color: #1c1c1e;
    --text-secondary: #636366;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --nav-track: rgba(0, 0, 0, 0.05);
    --dot-inactive: rgba(0, 0, 0, 0.2);
    --dot-active-bg: #000000;
    --dot-text: #ffffff;
    --hero-gradient: radial-gradient(circle at 50% 50%, #ffffff 0%, #e5e5ea 80%);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Poppins', -apple-system, sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* --- 2. Theme Toggle --- */
.theme-toggle {
    position: fixed;
    top: 25px; 
    right: 25px; 
    z-index: 1100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.3s;
}
.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle .icon { width: 24px; height: 24px; position: absolute; transition: all 0.5s; }
.theme-toggle .sun { opacity: 1; transform: rotate(0deg) scale(1); color: #fff; }
.theme-toggle .moon { opacity: 0; transform: rotate(90deg) scale(0); color: #000; }
[data-theme="light"] .theme-toggle .sun { opacity: 0; transform: rotate(-90deg) scale(0); }
[data-theme="light"] .theme-toggle .moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* --- 3. Navbar --- */
.navbar-container {
    position: fixed;
    top: 25px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}
.ios-glass-island {
    pointer-events: auto;
    padding: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid var(--glass-border);
    border-radius: 60px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
.nav-track {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 25px; /* Reduced padding for more dots */
    gap: 10px; /* Reduced gap for more dots */
    background: var(--nav-track);
    border-radius: 40px;
}
.dot {
    height: 36px;
    border: none;
    border-radius: 20px;
    background-color: var(--dot-inactive);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s;
    width: 12px; /* Slightly smaller resting width */
}
.dot:hover { background-color: rgba(128, 128, 128, 0.3); }
.dot.active {
    width: 90px; /* Slightly smaller active width */
    background-color: var(--dot-active-bg);
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}
.dot .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dot-text);
    opacity: 0;
    white-space: nowrap;
    transform: translateY(5px);
    transition: all 0.2s ease;
}
.dot.active .label { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }

/* --- 4. Sections --- */
section {
    min-height: 100vh;
    padding: 120px 20px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- Hero Section (Redesigned Split Layout) --- */
.hero-section-split {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    text-align: left;
    background: var(--hero-gradient);
    padding: 140px 5% 60px;
    gap: 40px;
}

.hero-content-left {
    max-width: 500px;
}

.hero-content-left .greeting h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-color);
    margin: 0;
}

.hero-content-left h2 {
    font-size: 2rem;
    margin-top: 20px;
    background: linear-gradient(to right, var(--text-color), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content-left .sub-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.edu-btn {
    margin-top: 30px;
    padding: 12px 30px;
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px var(--shadow-color);
}
.edu-btn:hover { transform: translateY(-3px); }

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.social-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-size: 1.3rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px var(--shadow-color);
}

.social-icon:hover {
    transform: translateY(-5px);
    background: var(--text-color);
    color: var(--bg-color);
}

/* Profile Photo */
.profile-photo-container {
    position: relative;
    width: 350px;
    height: 400px;
}
.profile-photo {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    box-shadow: 15px 15px 30px var(--shadow-color);
    /* Add a subtle border/frame */
    border: 5px solid var(--card-bg);
}




/* --- 5. THE RGB CARDS (Merged Logic) --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px; /* Increased gap for glow space */
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
    padding: 20px;
}

/* The RGB Card Style */
.card {
    /* Use flexible width instead of fixed 300px to fit grid */
    width: 100%; 
    min-height: 250px;
    
    background: var(--card-bg); /* Using variable for theme support */
    padding: 2em;
    text-align: center;
    border-radius: 10px;
    position: relative;
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* The Rotating Border Logic */
.card::after, .card::before {
    content: '';
    position: absolute;
    height: 100%;
    width: 100%;
    background-image: conic-gradient(from var(--angle), #ff4545, #00ff99, #006aff, #ff0095, #ff4545);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    z-index: -1; /* Behind the card content */
    padding: 3px; /* Thickness of border */
    border-radius: 10px;
    animation: 7s spin linear infinite;
}

.card::before {
    filter: blur(1.5rem);
    opacity: 0.5;
}

@keyframes spin {
    from { --angle: 0deg; }
    to { --angle: 360deg; }
}

.card h3 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}
.card p {
    color: var(--text-secondary);
    line-height: 1.6;
}








/* --- 6. Education Timeline --- */
.timeline-container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
}
.timeline-item {
    margin-bottom: 30px;
}
.timeline-content {
    align-items: flex-start;
    text-align: left;
    padding: 25px;
}
.timeline-content .date {
    display: inline-block;
    padding: 5px 10px;
    background: var(--glass-bg);
    color: var(--text-color);
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-weight: 600;
}
.timeline-content h3 { font-size: 1.5rem; margin-bottom: 5px; }
.timeline-content p:nth-of-type(1) { font-weight: 600; color: var(--text-color); margin-bottom: 10px; }

/* --- 7. About Text & Footer --- */
/* (Same as before) */
.about-section { overflow: hidden; padding: 0; }
.giant-text {
    font-size: 15vw;
    line-height: 0.85;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -5px;
    text-transform: uppercase;
    opacity: 0.95;
    margin: 60px 0;
    text-align: center;
}
.about-content { max-width: 600px; text-align: center; padding: 0 20px 60px; }
.about-content p { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 40px; }
.stats-row { display: flex; justify-content: space-around; width: 100%; }
.stat h3 { font-size: 2.5rem; color: var(--text-color); }
.stat span { color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.footer-modern {
    background-color: var(--bg-color);
    padding: 80px 5vw 40px;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 60vh;
}
.footer-top { display: flex; justify-content: space-between; width: 100%; flex-wrap: wrap; gap: 40px; }
.footer-headline h3 { font-size: 2rem; color: var(--text-color); }
.footer-columns { display: flex; gap: 80px; }
.f-col { display: flex; flex-direction: column; gap: 16px; }
.f-col h4 { color: var(--text-color); margin-bottom: 8px; }
.f-col a { color: var(--text-secondary); text-decoration: none; }
.f-col a:hover { color: var(--text-color); }
.footer-bottom { width: 100%; display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 30px; margin-top: 60px;}
.footer-logo h2 { color: var(--text-secondary); }
.footer-legal { display: flex; gap: 24px; }
.footer-legal a { color: var(--text-secondary); text-decoration: none; }

/* --- 8. SCROLL ANIMATION --- */
@keyframes appear {
    from { opacity: 0; transform: translateY(100px); }
    to { opacity: 1; transform: translateY(0px); }
}
.block {
    animation: appear linear;
    animation-timeline: view();
    animation-range: entry 0% cover 40%;
}

/* --- Mobile Response --- */
@media (max-width: 900px) {
    .hero-section-split { flex-direction: column-reverse; text-align: center; padding-top: 120px; }
    .hero-content-left { align-items: center; display: flex; flex-direction: column; }
    .profile-photo-container { width: 280px; height: 320px; }
    .hero-content-left .greeting h1 { font-size: 3rem; }
    .nav-track { padding: 0 15px; gap: 6px; }
    .dot { width: 10px; }
    .dot.active { width: 70px; }
    .dot .label { font-size: 11px; }
}
@media (max-width: 768px) {
    .giant-text { font-size: 19vw; }
    .footer-top, .footer-bottom { flex-direction: column; gap: 30px; }
}







/* --- 3D SLIDER (FULLY COMMENTED) --- */

.slider-container {
    position: relative;
    width: 100%;
    
    /* HEIGHT: The invisible box holding the slider. 
       - If you INCREASE this (e.g., 600px), there is more vertical empty space on the page.
       - If you DECREASE this (e.g., 200px), the 3D cards might overlap with content above/below. */
    height: 400px; 
    
    /* PERSPECTIVE: How "3D" the scene looks. 
       - LOWER (e.g., 500px) = Fish-eye lens effect. Objects distort heavily when rotating.
       - HIGHER (e.g., 2000px) = Telephoto lens. Looks flatter/further away. 
       - 1000px is the "sweet spot" for web 3D. */
    perspective: 1000px;
    
    margin: 50px auto; /* Centers the container on the page */
    
    /* PRESERVE-3D: Crucial. Tells the browser children are 3D objects, not flat 2D layers. */
    transform-style: preserve-3d;
    
    /* NOTE: We removed 'overflow: hidden' so the cards don't disappear when they spin close to the screen */
}

.slider {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d; /* Passes the 3D effect down to the images */
}

.slide {
    position: absolute;
    
    /* --- SIZE SETTINGS (DESKTOP) --- */
    /* WIDTH/HEIGHT: The actual size of the card.
       - If you INCREASE width (e.g., 500px), they get wider but might hit each other (tangle) when spinning.
       - If you DECREASE width (e.g., 100px), they become tiny thumbnails. */
    width: 200px;   
    height: 200px;  
    
    /* --- CENTERING MATH --- */
    /* LEFT/TOP 50%: Moves the top-left corner of the card to the exact center of the container. */
    left: 50%;
    top: 50%;
    
    /* MARGINS: We shift the card BACK by half its size to truly center it.
       - If width is 300px, margin-left MUST be -150px.
       - If height is 200px, margin-top MUST be -100px.
       - If you get these wrong, the slider will spin off-center (wobbly). */
    margin-left: -100px; 
    margin-top: -100px;  
    
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    
    /* REFLECTION: Adds the cool mirror effect below the card.
       - The '10px' is the gap between card and reflection.
       - The 'linear-gradient' controls the fade. */
    -webkit-box-reflect: below 10px linear-gradient(transparent, transparent, rgba(0, 0, 0, 0.4));
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures the logo fits inside without stretching/distortion */
    mix-blend-mode: multiply; /* Helps white backgrounds blend better (optional) */
    pointer-events: none; /* Prevents dragging the image itself instead of the slider */
}

/* --- POSITIONING (THE DISTANCE FROM CENTER) --- */
/* TRANSLATE Z: This pushes the cards OUTWARD from the center point.
   - If you INCREASE Z (e.g., 600px): The circle gets bigger. Cards are further apart.
   - If you DECREASE Z (e.g., 200px): The circle gets tighter. Cards might crash into each other.
   
   RULE OF THUMB: TranslateZ should be slightly larger than the card width (Width 300px -> Z 400px is safe). */

.slide:nth-child(1) { transform: rotateY(0deg) translateZ(400px); }
.slide:nth-child(2) { transform: rotateY(90deg) translateZ(400px); }
.slide:nth-child(3) { transform: rotateY(180deg) translateZ(400px); }
.slide:nth-child(4) { transform: rotateY(270deg) translateZ(400px); }

/* --- MOBILE RESPONSE --- */
@media (max-width: 768px) {
    .slider-container {
        /* Decrease container height on phones to save space */
        height: 300px; 
    }
    
    .slide {
        /* Make cards smaller for mobile screens */
        width: 180px; 
        height: 140px;
        
        /* UPDATE CENTERING MATH for new size:
           - Half of 180 is 90.
           - Half of 140 is 70. */
        margin-left: -90px; 
        margin-top: -70px;  
    }

    /* MOBILE Z-DISTANCE:
       - Since cards are smaller (180px), we can bring them closer (250px).
       - If you keep this at 400px on mobile, they will look very tiny and far away. */
    .slide:nth-child(1) { transform: rotateY(0deg) translateZ(250px); }
    .slide:nth-child(2) { transform: rotateY(90deg) translateZ(250px); }
    .slide:nth-child(3) { transform: rotateY(180deg) translateZ(250px); }
    .slide:nth-child(4) { transform: rotateY(270deg) translateZ(250px); }
}









/* --- INFINITE CAROUSEL CONTAINER --- */
.carousel-container {
    width: 100%;
    max-width: 1200px; /* Adjust width as needed */
    display: flex;
    flex-direction: column;
    gap: 30px; /* Space between the rows */
    padding: 20px 0;
    margin: 0 auto; /* Center the container */
    
    /* Fade effect on left and right edges */
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.carousel-row {
    display: flex;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    width: max-content;
    gap: 50px; /* Space between individual logos */
    animation: scroll 35s linear infinite;
}

/* --- LOGO COLOR LOGIC (THEME AWARE) --- */
.carousel-track img {
    height: 65px; 
    width: auto; 
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    
    /* DEFAULT (DARK MODE): Turn logos into White Silhouettes */
    /* 1. brightness(0) makes it black. 2. invert(1) makes it white. */
    filter: brightness(0) invert(1); 
    opacity: 0.6; 
}

/* LIGHT MODE OVERRIDE */
/* When body has data-theme="light", turn logos into Black Silhouettes */
[data-theme="light"] .carousel-track img {
    filter: brightness(0); /* Just pure black */
    opacity: 0.6;
}

/* HOVER EFFECT (Works for both modes) */
.carousel-track img:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* --- ANIMATIONS --- */
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes scroll-reverse {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

/* Row Directions & Speeds */
.carousel-row:nth-child(1) .carousel-track {
    animation-name: scroll;
    animation-duration: 45s;
}
.carousel-row:nth-child(2) .carousel-track {
    animation-name: scroll-reverse;
    animation-duration: 35s;
}
.carousel-row:nth-child(3) .carousel-track {
    animation-name: scroll;
    animation-duration: 25s;
}

/* Pause animation on hover */
.carousel-track:hover {
    animation-play-state: paused;
}





/* --- Social Icons Image Logic --- */

/* DEFAULT (Dark Mode): 
   The LeetCode SVG is natively black. 
   We invert it to WHITE so it shows up on the dark background. */
.social-img {
    filter: invert(1);
    transition: filter 0.3s ease;
}

/* LIGHT MODE OVERRIDE: 
   When the body has data-theme="light", we turn the filter OFF (invert(0)).
   This lets the logo go back to its original BLACK color. */
[data-theme="light"] .social-img {
    filter: invert(0);
}

/* HOVER EFFECT (Optional): 
   If your social icons have a white hover background in dark mode, 
   you might need to invert it back to black on hover. */
.social-icon:hover .social-img {
    filter: invert(0); 
}

/* In Light mode, hover usually turns dark, so we invert to white */
[data-theme="light"] .social-icon:hover .social-img {
    filter: invert(1);
}




/* --- ZIGZAG TIMELINE CONTAINER --- */
.zigzag-timeline {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 80px; 
}

/* CENTER LINE */
.zigzag-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--glass-border);
    transform: translateX(-50%);
    z-index: 0;
    border-radius: 2px;
}

/* --- ITEM STRUCTURE --- */
.zigzag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* TEXT CONTENT BOX */
.zigzag-content {
    width: 45%; 
    padding: 30px;
    background: var(--card-bg); 
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: left;
    
    /* Animation Start State */
    opacity: 0;
    transition: all 1s ease-out;
}

.zigzag-content h3 {
    color: var(--text-color);
    margin: 10px 0 5px;
    font-size: 1.4rem;
}

.zigzag-content h4 {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.zigzag-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.zigzag-date {
    display: inline-block;
    padding: 6px 14px;
    background: var(--glass-bg);
    color: var(--text-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 5px;
}

/* IMAGE BOX */
.zigzag-image {
    width: 45%;
    height: 250px; 
    border-radius: 20px;
    overflow: hidden;
    border: 5px solid var(--card-bg);
    box-shadow: 0 10px 30px var(--shadow-color);
    
    /* Animation Start State */
    opacity: 0;
    transition: all 1s ease-out;
}

.zigzag-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.zigzag-image:hover img {
    transform: scale(1.1);
}

/* --- ODD vs EVEN Logic --- */

/* ODD: Text Left, Image Right */
.zigzag-item:nth-child(odd) {
    flex-direction: row;
}
.zigzag-item:nth-child(odd) .zigzag-content {
    transform: translateX(-100px); 
}
.zigzag-item:nth-child(odd) .zigzag-image {
    transform: translateX(100px); 
}

/* EVEN: Text Right, Image Left */
.zigzag-item:nth-child(even) {
    flex-direction: row-reverse;
}
.zigzag-item:nth-child(even) .zigzag-content {
    transform: translateX(100px); 
}
.zigzag-item:nth-child(even) .zigzag-image {
    transform: translateX(-100px); 
}

/* CENTRAL DOT */
.zigzag-item::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    background: var(--text-color);
    border: 4px solid var(--bg-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-shadow: 0 0 10px var(--shadow-color);
}

/* --- ANIMATION ACTIVE STATE --- */
.zigzag-item.visible .zigzag-content,
.zigzag-item.visible .zigzag-image {
    opacity: 1;
    transform: translateX(0); 
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .zigzag-timeline::before { left: 20px; } 
    
    .zigzag-item {
        flex-direction: column !important; 
        align-items: flex-start;
        padding-left: 50px; 
    }
    
    .zigzag-content, .zigzag-image {
        width: 100%; 
        transform: translateY(50px); 
    }
    
    .zigzag-image {
        height: 200px;
        margin-top: 20px;
        order: -1; 
    }
    
    .zigzag-item::after {
        left: 20px; 
    }
    
    /* Reset horizontal animations for vertical mobile view */
    .zigzag-item:nth-child(odd) .zigzag-content,
    .zigzag-item:nth-child(even) .zigzag-content,
    .zigzag-item:nth-child(odd) .zigzag-image,
    .zigzag-item:nth-child(even) .zigzag-image {
        transform: translateY(50px);
    }
    
    .zigzag-item.visible .zigzag-content,
    .zigzag-item.visible .zigzag-image {
        transform: translateY(0);
    }
}





/* --- GLOBAL SCROLL ANIMATION --- */

/* 1. Define the Animation */
@keyframes universal-appear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px); /* Slightly smaller & lower */
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0); /* Normal size & position */
    }
}

/* 2. Apply to ALL Major Elements */
/* Add any other class names here separated by commas */
section,                /* Animates whole sections */
.rgb-card .card             /* Your RGB cards */
.timeline-item,         /* Your old timeline */
.zigzag-item,           /* The new education zig-zag */
.section-header,        /* Headers like "Education", "Projects" */
.edu-btn,               /* Buttons */
.social-icon,           /* Social links */
.project-card           /* If you have project cards */
{
    animation-name: universal-appear;
    animation-fill-mode: both;
    
    /* Triggers animation based on scroll position */
    animation-timeline: view();
    
    /* Starts when top of element enters 10% of viewport */
    /* Finishes when it covers 40% of the viewport */
    animation-range: entry 10% cover 40%;
}



/* --- certificates --- */

/* --- CERTIFICATE GRID CONTAINER --- */
.certificate-grid {
    display: grid;
    /* 'auto-fit' helps force them into columns better than auto-fill */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 25px;
    padding: 20px 0;
    width: 100%; /* Ensure container is full width */
}

/* --- THE CARD STYLE (Specific Overrides) --- */
/* We target .certificate-grid .cert-card to override any global .card settings */
.certificate-grid .cert-card {
    width: auto !important;  /* CRITICAL: Stops card from being 100% width (List view) */
    max-width: 100%;         /* Ensures it doesn't overflow */
    margin: 0;               /* Removes centering margins */
    
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden; 
    text-decoration: none; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%; /* Makes all cards in a row the same height */
}

/* HOVER EFFECT */
.cert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--shadow-color);
    border-color: var(--text-color);
}

/* --- IMAGE AREA --- */
.cert-img-box {
    width: 100%;
    height: 180px; 
    background: #000;
    overflow: hidden;
    position: relative;
}

.cert-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.5s ease;
    opacity: 0.9;
}

.cert-card:hover .cert-img-box img {
    transform: scale(1.1);
    opacity: 1;
}

/* --- TEXT CONTENT AREA --- */
.cert-content {
    padding: 20px;
    text-align: center;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cert-content h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
}

.cert-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* "VIEW" ICON INDICATOR */
.cert-card::after {
    content: '↗'; 
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.cert-card:hover::after {
    opacity: 1;
}

/* --- MOBILE ADJUSTMENTS FOR CERTIFICATES --- */
@media (max-width: 768px) {
    
    /* 1. Force Single Column */
    .certificate-grid {
        grid-template-columns: 1fr; /* One card per row */
        padding: 10px; /* Less padding on edges */
    }

    /* 2. Fix the Image Cropping */
    .cert-img-box {
        /* Increase height slightly so the certificate is bigger */
        height: 220px; 
        background: #000; /* Black background looks like a frame */
    }

    .cert-img-box img {
        /* 'contain' ensures the WHOLE image is visible. 
           No more cropping edges. */
        object-fit: contain; 
    }

    /* 3. Adjust Text for Mobile */
    .cert-content {
        padding: 15px;
        text-align: left; /* Easier to read on mobile */
    }
    
    .cert-content h3 {
        font-size: 1.2rem; /* Make title slightly larger */
    }
}




/* Specific style for Dedo App image */
.dedo-img {
    width: 100%;         /* Forces image to fit the card's width */
    height: 200px;       /* Sets a fixed height (adjust as needed) */
    object-fit: cover;   /* Crops the image neatly if it's too tall/wide */
    border-radius: 10px; /* Optional: adds rounded corners */
    display: block;      /* Removes tiny gap below image */
    margin: 10px 0;      /* Adds space above and below */
}



.gradient-text {
    /* 1. Define the direction and colors (Blue -> Purple -> Pink) */
    background: linear-gradient(90deg, #2563eb, #9333ea, #db2777);
    
    /* 2. Clip the background to the text shape */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* 3. Make the actual text transparent so the background shows through */
    -webkit-text-fill-color: transparent;
    color: transparent;
    
    /* 4. Bold text makes the gradient much easier to see */
    font-weight: 700; 
}