/* ==========================================================================
   1. RESET & GLOBAL STYLES
   ========================================================================== */
/* Reset margin and padding for all elements */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding-top: 60px;
}

/* ==========================================================================
   2. TYPOGRAPHY & GENERAL ELEMENT STYLES
   ========================================================================== */
/* Styling the title */
.title h1 {
    font-size: 48px;
    font-family: 'Raleway', sans-serif;
    color: white;
    background: none;
    text-shadow: 4px 4px 10px rgba(0, 0, 0, 0.8);
    z-index: 3;
    position: relative;
    text-align: center;
    font-weight: lighter;
}

/* Button styling */
button {
    background-color: #f22718;
    color: white;
    padding: 10px 20px;
    border: none;
    font-size: 20px;
    margin-top: 25px;
    font-weight: normal;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 3;
}

button:hover {
    background-color: white;
    color: #f22718;
    transform: scale(1.03);
}

/* Label styling */
label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

/* ==========================================================================
   3. ANIMATIONS & BACKGROUND ELEMENTS
   ========================================================================== */
/* Keyframes for moving background of twinkling stars */
@keyframes move-twink-back {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -10000px 5000px;
    }
}

/* Twinkling background styling */
.twinkling {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Keyframes for the gradient animation */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ==========================================================================
   4. CONTAINER & LAYOUT CLASSES
   ========================================================================== */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.c2 {
    width: 60%;
    text-align: center;
    position: relative;
}

/* ==========================================================================
   5. HEADER STYLING
   ========================================================================== */
header {
    font-family: 'Raleway', sans-serif;
    font-weight: normal;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    background-color: rgba(20, 20, 30, 0.2);
    padding: 10px 0;
    z-index: 10;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

header ul {
    list-style-type: none;
    display: flex;
    gap: 20px;
}

header li {
    font-size: 18px;
    color: #f1f1f1;
    font-weight: bold;
}

header a {
    text-decoration: none;
    color: inherit;
    padding: 5px 10px;
    transition: color 0.3s ease, background-color 0.3s ease;
    font-weight: normal;
}

header a:hover {
    color: #ffffff;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.2);
}

.header-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
}

/* Adjust for smaller screens */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
}

#switch-en, #switch-es {
    font-size: 24px;
    color: #fff;
    margin-left: 10px;
}

#switch-en:hover, #switch-es:hover {
    color: #f8d210;
}

.fi {
    font-size: 1.5em;
}

@media (max-width: 768px) {
    .fi {
        font-size: 2em;
    }
}

header li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* Make flags smaller on small screens */
@media (max-width: 600px) {
    .flag-container img {
        width: 40px;
        height: auto;
    }
}

/* Adjust the flag styles */
#switch-en, #switch-es {
    font-size: 24px;
    color: #fff;
    margin-left: 10px;
    display: flex;
    align-items: center;
}

/* Adjust for smaller screens */
@media (max-width: 768px) {
    #switch-en, #switch-es {
        font-size: 20px;
        margin-left: 0;
        margin-top: 5px;
    }
}

.hide-menu {
    transform: translateY(-100%);
    opacity: 0;
}

.show-menu {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   6. FOOTER STYLING
   ========================================================================== */
footer {
    font-family: 'Raleway', sans-serif;
    font-weight: normal;
    background-color: #363030;
    padding: 20px 0;
    bottom: 0;
    width: 100%;
}

footer ul {
    list-style-type: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

footer li {
    font-size: 18px;
    color: white;
}

footer a {
    text-decoration: none;
    color: inherit;
    font-weight: bold;
    padding: 5px 10px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

footer img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

footer img:hover {
    transform: scale(1.1);
}

.copyright {
    margin-top: 15px;
    text-align: center;
    color: white;
    font-weight: normal;
}

/* ==========================================================================
   7. PROJECTS SECTION & CARD STYLING
   ========================================================================== */
#projects {
    position: relative;
    padding-bottom: 50px;
    z-index: 2;
}

#projects h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

#projects .row {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Card container */
.card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1 calc(33.333% - 20px);
    width: 300px;
    height: 400px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    position: relative;
}

/* Card image (project image) */
.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
}

/* Tech icon styling: Ensure same size for all icons, center horizontally and vertically */
.tech-icon {
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    height: 150px;
    width: 100%;
    border-radius: 10px 10px 0 0;
    margin-bottom: 15px;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Card body styling */
.card-body {
    padding: 15px;
    flex-grow: 1;
}

.card-body h5 {
    margin-bottom: 10px;
}

.card-body .project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

#projects .row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 7768px) {
    .card {
        width: 90%;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ==========================================================================
   8. BADGE STYLING
   ========================================================================== */
.badge-img {
    display: block;
    margin: 10px auto;
    max-width: 80%;
}

.badge-img {
    height: 10px;
    max-width: 100px;
}

.badge img {
    height: 20px;
    vertical-align: middle;
}

/* ==========================================================================
   9. CONTACT FORM STYLING
   ========================================================================== */
#contact {
    padding: 50px 0;
}

#contact h2 {
    text-align: center;
    margin-bottom: 30px;
}

form {
    max-width: 600px;
    margin: 0 auto;
}

.form-control {
    margin-bottom: 15px;
    border-radius: 5px;
}

input[type="submit"] {
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

input[type="submit"]:hover {
    transform: scale(1.05);
    transition: 0.3s ease;
}

/* ==========================================================================
   10. MEDIA QUERIES
   ========================================================================== */

@media (max-width: 768px) {
    .card {
        flex: 1 1 calc(50% - 20px);
    }
}

@media (max-width: 480px) {
    .card {
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   11. ALERT STYLING
   ========================================================================== */

.alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 90%;
    text-align: center;
    padding: 15px 20px;
    font-size: 16px;
    border-radius: 5px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   12. ABOUT STYLING
   ========================================================================== */

#about {
    text-align: center;
}

#about h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #333;
    font-family: 'Raleway', sans-serif;
}

.about-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.about-text {
    width: 80%;
    margin-bottom: 30px;
}

.about-text p {
    font-size: 1.2rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tech-icons {
    margin-bottom: 20px;
}

.tech-icons img {
    transition: transform 0.3s ease;
    margin: 0 10px;
}

.tech-icons img:hover {
    transform: scale(1.1);
}

#about .tech-icon {
    position: relative;
    display: inline-block;
}

 #about .tech-icon::after {
    content: attr(data-tech);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px;
    background-color: #333;
    color: white;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-size: 12px;
}

#about .tech-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   13. ANIMATIONS FOR THE TEXT IN TWINKLING
   ========================================================================== */

/* Fade In Down for the text */
.fadeInDown {
    animation: fadeInDown 1s ease-out forwards;
    opacity: 0; /* Start hidden */
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Up for the button */
.fadeInUp {
    animation: fadeInUp 1s ease-out forwards;
    animation-delay: 0.5s; /* Button appears 0.5s after page load */
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
