/* Global Box-Sizing for consistent layout */
* {
    box-sizing: border-box;
}

/* --- THEME & LAYOUT VARIABLES --- */
:root {
    --clr-text: #FFFFFF;
    --clr-text-secondary: #ccc;
    --clr-accent: #00FFFF;
    --clr-dark: #000000;
    --clr-bg-gradient-start: #1B2735;
    --clr-bg-gradient-end: #090A0F;
    --clr-bg-header: #16161680; /* 50% transparent */
    --clr-bg-footer: #161616;
    --clr-animation: #5bc0eb;
    --font-primary: 'Inter', sans-serif;
}

/* --- BASE STYLES --- */
body {
    background: radial-gradient(ellipse at bottom, var(--clr-bg-gradient-start) 0%, var(--clr-bg-gradient-end) 100%);
    color: var(--clr-text);
    font-family: var(--font-primary);
    margin: 0;
    scroll-behavior: smooth; /* Added for smooth navigation scrolling */
    overflow-x: hidden; /* Prevents horizontal scroll from overlapping elements */
}

/* --- UTILITY CLASSES --- */
.accent-text {
    color: var(--clr-accent);
}

/* --- HERO CONTAINER --- */
.hero-section {
    /* Use padding for flexible spacing instead of a fixed height */
    padding: 10rem 5% 6rem;
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

.hero-container {
    width: 100%;
    max-width: 1200px;
    position: relative;
    height: 100%;
}

/* --- HEADER & NAVIGATION --- */
.header-wrapper {
    position: fixed; /* Changed to fixed */
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 20; /* Ensure wrapper is on top */
}

.header {
    width: 95%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px 30px;
    box-sizing: border-box;
    background-color: var(--clr-bg-header);
    border-top: 1px solid rgba(70, 70, 70, 0.6);
    border-bottom: 1px solid var(--clr-accent);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    color: var(--clr-text);
    border-radius: 40px;
}

.navigation a {
    color: var(--clr-text);
    text-decoration: none;
    margin-left: 30px;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 5px; /* Space for the underline */
}

.navigation a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%); /* Corrected typo: translateX instead of translatex */
    background-color: var(--clr-accent);
    transition: width 0.3s ease-in-out;
}

.navigation a:hover::after {
    width: 100%;
}

.navigation a:hover {
    color: var(--clr-accent);
}

/* --- MAIN CONTENT (BROKEN GRID ELEMENTS) --- */
.hero-content {
    position: relative; /* Changed to relative */
    top: 20%; /* Adjusted top position to center the text better with new font size */
    left: 0;
    width: 58%; /* Increased width to reduce gap */
    z-index: 10;
}

.hero-content .sliced-effect {
    font-family: var(--font-primary);
    font-size: 4.5rem; /* Reduced default font size for better fit on large screens */
    font-weight: 700; /* Bolder weight for impact */
    line-height: 1.1;
    margin: 0;
    letter-spacing: -2px; /* Negative spacing for a tighter, modern look */
    text-transform: uppercase;
    white-space: nowrap; /* Crucial: Prevents text from wrapping to multiple lines */
}

/* --- Sliced Text Effect --- */
.sliced-effect {
  display: grid;
}

.sliced-effect > div {
  grid-area: 1/1/-1/-1;
}

.sliced-effect .top {
  clip-path: polygon(0% 0%, 100% 0%, 100% 48%, 0% 58%);
}

.sliced-effect .bottom {
  clip-path: polygon(0% 60%, 100% 50%, 100% 100%, 0% 100%);
  color: transparent;
  background: -webkit-linear-gradient(177deg, var(--clr-dark) 53%, var(--clr-text) 65%);
  background: linear-gradient(177deg, var(--clr-dark) 53%, var(--clr-text) 65%);
  background-clip: text;
  -webkit-background-clip: text;
  transform: translateX(-0.02em);
}

.hero-tagline {
    font-size: 1.2rem;
    color: var(--clr-text-secondary);
    margin-top: -1.5rem; /* Pull it closer to the h1 */
    margin-bottom: 2rem;
    font-weight: 600;
}

.hero-content p {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 30px 0;
}

.cta-button {    
    background-color: var(--clr-accent);
    color: var(--clr-dark);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    padding: 15px 35px;    
    display: inline-block;
    border-radius: 25px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.cta-button:hover {
    background-color: var(--clr-text);
}

/* --- Radio Tuning Animation --- */
.animation-container {
    --animation-text-color: var(--clr-accent);
    --animation-border-color: rgba(255, 255, 255, 0.2);
    --animation-font: 'Courier New', Courier, monospace;

    position: absolute;
    top: 50%;
    right: 8%; /* Moved closer to the center to reduce gap */
    transform: translateY(-50%);
    width: 300px;
    height: 200px;
    overflow: hidden;
    border: 2px solid var(--animation-border-color);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), inset 0 0 15px #000;
    background-color: rgba(13, 13, 13, 0.5);
    z-index: 0;
}

.animation-container::before,
.animation-container::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 10px;
    border: 2px solid var(--animation-text-color);
    animation: sound-wave 2s infinite linear;
    opacity: 0;
    z-index: 1;
}

.animation-container::after {
    animation-delay: 1s;
}

.scanline-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.4) 3px);
    animation: scanline 0.4s linear infinite;
    pointer-events: none;
    opacity: 0.4;
    z-index: 2;
}

.word {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--animation-font);
    font-weight: bold;
    color: var(--animation-text-color);
    text-shadow: 0 0 3px var(--animation-text-color), 0 0 8px var(--animation-text-color);
    font-size: 28px;
    white-space: nowrap;
    letter-spacing: 2px;
    text-align: center;
    z-index: 3;
}

.word.tuned-in {
    animation: flicker-in 0.5s ease-in-out;
}

@keyframes sound-wave {
    0% { transform: scale(1); opacity: 0.7; }
    80% { opacity: 0.2; }
    100% { transform: scale(1.3); opacity: 0; }
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(6px); }
}

@keyframes flicker-in {
    0% { opacity: 0; filter: blur(3px); transform: translate(-50%, -50%) scale(1.1); }
    20% { opacity: 1; filter: blur(0); }
    40% { opacity: 0.3; }
    60% { opacity: 1; }
    80% { opacity: 0.7; }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --- RESPONSIVE DESIGN --- */

/* Medium screens (e.g., tablets) */
@media (max-width: 992px) {
    .hero-content .sliced-effect { /* Adjusted for medium screens */
        font-size: 3.5rem;
    }

    .hero-content p {
        font-size: 0.9rem;
        max-width: 350px;
    }

    .cta-button {
        font-size: 0.9rem;
        padding: 12px 30px;
    }
    
    .navigation a {
        font-size: 0.85rem;
        margin-left: 20px;
    }

    .animation-container {
        width: 250px;
        height: 150px;
    }
    .word { font-size: 24px; }
}

/* Small screens (e.g., mobile phones) */
/* THIS SECTION HAS BEEN CORRECTED */
@media (max-width: 768px) {
    .hero-section {
        /* Adjust padding for mobile, removing the large fixed gap */
        padding: 8rem 5% 4rem;
    }

    .hero-container {
        height: auto;
        display: flex;
        flex-direction: column;
        /* align-items: center; */
        text-align: center;

    }

    /* Make the wrapper flow in the document instead of being absolute */
    .header-wrapper {
        position: -webkit-sticky; /* For Safari compatibility */
        position: sticky;
        top: 0;
        z-index: 20; /* Ensure it stays on top of other content */
        background: transparent; /* Allow content to scroll underneath */
        width: 100%; /* Ensure wrapper takes full width */
        padding: 10px 0; /* Add vertical padding */
    }

    /* Adjust the header inside the wrapper for mobile */
    .header {
        flex-direction: column; /* Stack logo and nav */
        width: 95%;
        margin: 0 auto; /* Center the header */
        padding: 20px 30px; /* Adjust padding for vertical layout */
        background-color: var(--clr-bg-header); /* 50% transparent, from desktop */
        -webkit-backdrop-filter: blur(10px); /* Frosted glass effect for Safari */
        backdrop-filter: blur(10px); /* Frosted glass effect */
        border-top: 1px solid rgba(70, 70, 70, 0.6); /* from desktop */
        border-bottom: 1px solid var(--clr-accent); /* from desktop */
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55); /* from desktop */
        border-radius: 40px; /* from desktop */
    }

    .navigation a {
        margin: 8px 0; /* Adjust margin for vertical stack */
        font-size: 1rem;
        padding: 10px;
    }

    .hero-content {
        position: static;
        width: 100%;
        order: 2; /* Display text after the image */
        margin-top: 0; /* Replaced with gap on parent */
    }

    .hero-content .sliced-effect {
        font-size: 2.8rem;
    }

    .hero-content p {
        max-width: 100%;
        margin: 20px 0;
    }

    .animation-container {
        position: static; /* Let it flow in the document */
        order: 1; /* Display animation before the text */
        width: 80vw;
        max-width: 300px;
        height: 150px;
        margin: 0 auto 2rem auto; /* Center it and add space below */
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .navigation a {
        font-size: 0.9rem; /* Make font smaller */
        padding: 8px; /* Reduce padding for a more compact header */
    }

    .hero-content .sliced-effect {
        font-size: 2.2rem;
    }
}

@media (max-width: 426px) {
    .navigation a {
        font-size: 0.7rem; /* Make font smaller */
        padding: 6.2px; /* Reduce padding for a more compact header */
    }
}

/* --- ABOUT SECTION --- */
.about-section {
    position: relative; /* Use positioning similar to hero section */
    padding: 6rem 5%;
    max-width: 1100px;
    margin: 0 auto; /* Center the section */
    overflow: hidden;
    min-height: 500px; /* Ensure there's space for positioned elements */
}

.about-content {
    width: 55%;
    max-width: 600px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.about-content h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--clr-text);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.about-content p {
    color: var(--clr-text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-image {
    width: 30%;
    max-width: 400px;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.about-image img {
    width: 100%;
    border-radius: 50%; /* Makes the image circular */
    border: 3px solid var(--clr-accent);
    box-shadow: 0 0 25px var(--clr-accent)4d; /* 30% opacity */
}

/* Responsive adjustments for About Section */
@media (max-width: 768px) {
    .about-section {
        position: static; /* Revert to static positioning */
        display: flex;
        flex-direction: column-reverse; /* Stack image on top of text */
        padding: 4rem 5%;
        text-align: center;
        min-height: 0;
        gap: 3rem;
    }

    .about-content {
        position: static;
        width: 100%;
        transform: none;
    }

    .about-image {
        position: static;
        width: 100%;
        transform: none;
        margin: 0 auto; /* Center the image container */
        max-width: 250px; /* Smaller image for mobile */
    }

    .contact-details {
        gap: 1.5rem; /* Reduce gap between stacked items */
    }

    .contact-item {
        min-width: 100%; /* Allow item to take full width */
        padding: 1.5rem; /* Reduce padding on mobile */
    }
}

/* --- SKILLS SECTION --- */
.skills-section {
    padding: 4rem 5%;
    text-align: center;
    max-width: 1100px;
    margin: 0 auto;
}

.skills-section h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--clr-text);
    font-weight: 600;
    margin-bottom: 3rem;
}

.skills-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.skill-badge {
    background: rgba(22, 22, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 4px solid var(--clr-accent);
    color: var(--clr-text);
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: default;
}

.skill-badge:hover {
    transform: translateY(-5px);
    border-color: var(--clr-accent);
    box-shadow: 0 8px 20px rgba(0, 255, 255, 0.15);
}

/* --- PROJECTS SECTION & CAROUSEL --- */
.projects-section {
    padding: 4rem 0; /* Add vertical padding, horizontal is handled by wrapper */
    text-align: center;
}

.projects-section h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--clr-text);
    font-weight: 600;
    margin: 0 0 3rem 0;
}

.carousel-wrapper {
    position: relative;
    max-width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel {
    display: flex;
    gap: 24px;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    padding: 24px;
    width: 100%;
    max-width: 900px; /* Adjust as needed */
}

.carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

.carousel article {
    scroll-snap-align: center;
    flex: 0 0 280px;
    background: rgba(22, 22, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; /* For the clickable area */
}

/* The active (center) item in the carousel */
.carousel article.is-active {
    transform: scale(1.05);
    box-shadow: 0 8px 25px #00ffff1a;
    border-color: var(--clr-accent);
}

.carousel article img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.carousel article h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}

/* This is the main link for the card */
.carousel article h3 a {
    color: var(--clr-text);
    text-decoration: none;
    transition: color 0.3s ease;
}

/* The "stretched link" pseudo-element */
.carousel article h3 a::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1; /* Place it above other content in the card */
}

/* Hover/focus styles for the entire card */
.carousel article:hover h3 a,
.carousel article h3 a:focus-visible {
    color: var(--clr-accent);
    outline: none;
}

.carousel article:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px #00ffff2a;
}

.carousel article p {
    color: var(--clr-text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* The "Launch Tool" text */
.project-cta-text {
    color: var(--clr-accent);
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    z-index: 2; /* Ensure it's above the stretched link */
}

/* Styles for disabled project cards */
.disabled-link {
    pointer-events: none; /* Make the link unclickable */
    cursor: default;
}

.carousel article:has(.disabled-link) {
    opacity: 0.6;
    filter: grayscale(50%);
}

.carousel article:has(.disabled-link):hover {
    transform: none; /* Disable hover effect */
    box-shadow: none;
}


/* --- CONTACT SECTION --- */
.contact-section {
    padding: 4rem 5%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.contact-section h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--clr-text);
    font-weight: 600;
    margin: 0;
}

.contact-intro {
    color: var(--clr-text-secondary);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.contact-details {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap; /* For responsiveness */
}

.contact-item {
    background: rgba(22, 22, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 10px;
    min-width: 280px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--clr-accent)1a; /* 10% opacity */
}

.contact-item h3 {
    color: var(--clr-text);
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.contact-item a {
    color: var(--clr-accent);
    text-decoration: none;
    font-size: 1rem;
    word-break: break-all; /* Prevents long text like emails from overflowing */
    transition: text-shadow 0.3s ease;
}

.contact-item a:hover,
.contact-item a:focus-visible {
    text-shadow: 0 0 8px var(--clr-accent)b3; /* 70% opacity */
    outline: none; /* Remove default outline in favor of our custom shadow */
}

/* --- FOOTER STYLES --- */
footer {
    background-color: var(--clr-bg-footer);
    color: var(--clr-text);
    text-align: center;
    padding: 25px 0; /* Vertical padding */
    font-size: 0.9rem;
    font-family: var(--font-primary);
    border-top: 1px solid rgba(70, 70, 70, 0.6); /* Subtle top border */
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.55); /* Subtle top shadow, matching header style */
    margin-top: 60px; /* Provide some space from the content above */
    position: relative; /* For pseudo-element positioning */
    overflow: hidden; /* To clip the pseudo-element if it extends beyond bounds */
}

footer p {
    margin: 0; /* Remove default paragraph margin */
    transition: color 0.3s ease, text-shadow 0.3s ease; /* Smooth transition for hover effects */
    position: relative; /* Ensure text is above ::before */
    z-index: 1; /* Ensure text is above ::before */
}

footer:hover p {
    color: var(--clr-accent); /* Change text color to accent on hover */
    text-shadow: 0 0 10px var(--clr-accent)cc; /* 80% opacity */
}

/* Subtle animated background element for the footer */
footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--clr-accent)14, transparent 50%, var(--clr-accent)14); /* 8% opacity */
    background-size: 200% 100%; /* Make gradient wider than element */
    background-position: 100% 0; /* Start off-screen to the right */
    opacity: 0;
    transition: background-position 0.8s ease-out, opacity 0.5s ease;
    z-index: 0; /* Behind the text */
}

footer:hover::before {
    opacity: 1;
    background-position: 0 0; /* Slide gradient into view */
}

/* Carousel Controls */
.carousel-control {
    background: rgba(22, 22, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--clr-text);
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}

.carousel-control:hover {
    background-color: var(--clr-accent);
    color: var(--clr-dark);
}

.carousel-control.prev {
    left: 2%;
}

.carousel-control.next {
    right: 2%;
}

/* Specific style for links within project page footers */
footer a.footer-link {
    color: var(--clr-accent);
    text-decoration: none;
}

/* --- Parallax Star Background --- */
/* The star divs (#stars, #stars2, #stars3) must be added to the HTML body for this to work */

#stars, #stars2, #stars3 {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
}

#stars {
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow: 1774px 1788px #FFF, 1502px 175px #FFF, 1285px 353px #FFF, 1374px 1936px #FFF, 1532px 1199px #FFF, 621px 1993px #FFF, 1383px 1491px #FFF, 1243px 1970px #FFF, 735px 128px #FFF, 1265px 1349px #FFF;
  animation: animStar 50s linear infinite;
}

#stars:after {
  content: " ";
  position: absolute;
  top: 2000px;
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow: 1774px 1788px #FFF, 1502px 175px #FFF, 1285px 353px #FFF, 1374px 1936px #FFF, 1532px 1199px #FFF, 621px 1993px #FFF, 1383px 1491px #FFF, 1243px 1970px #FFF, 735px 128px #FFF, 1265px 1349px #FFF;
}

#stars2 {
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow: 111px 1148px #FFF, 1928px 1291px #FFF, 954px 112px #FFF, 1925px 569px #FFF, 124px 1124px #FFF, 1872px 1739px #FFF, 1406px 1485px #FFF, 55px 1135px #FFF, 1368px 1544px #FFF, 1008px 1845px #FFF;
  animation: animStar 100s linear infinite;
}

#stars2:after {
  content: " ";
  position: absolute;
  top: 2000px;
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow: 111px 1148px #FFF, 1928px 1291px #FFF, 954px 112px #FFF, 1925px 569px #FFF, 124px 1124px #FFF, 1872px 1739px #FFF, 1406px 1485px #FFF, 55px 1135px #FFF, 1368px 1544px #FFF, 1008px 1845px #FFF;
}

#stars3 {
  width: 3px;
  height: 3px;
  background: transparent;
  box-shadow: 285px 128px #FFF, 38px 1396px #FFF, 1389px 383px #FFF, 1422px 1721px #FFF, 128px 1845px #FFF, 1297px 117px #FFF, 1146px 129px #FFF, 747px 1515px #FFF, 193px 461px #FFF, 1553px 1332px #FFF;
  animation: animStar 150s linear infinite;
}

#stars3:after {
  content: " ";
  position: absolute;
  top: 2000px;
  width: 3px;
  height: 3px;
  background: transparent;
  box-shadow: 285px 128px #FFF, 38px 1396px #FFF, 1389px 383px #FFF, 1422px 1721px #FFF, 128px 1845px #FFF, 1297px 117px #FFF, 1146px 129px #FFF, 747px 1515px #FFF, 193px 461px #FFF, 1553px 1332px #FFF;
}

@keyframes animStar {
  from {
    transform: translateY(0px);
  }
  to {
    transform: translateY(-2000px);
  }
}

@media (max-width: 1100px) {
    .carousel-control {
        display: none; /* Hide controls on smaller screens, rely on swipe */
    }
    .carousel {
        max-width: 100%;
    }
}
