:root {
    --bg-color: #090b0b;
    --card-bg-val: 29, 29, 29;
    --card-bg-alpha: 0.85;
    --text-primary: #cdd6f4;
    --text-secondary: #a6adc8;
    --accent-primary: #2bb68c;
    --accent-secondary: #21B564;
    --accent-tertiary: #329a7b;
    --project-tag-bg: #121a18;
    --project-tag-hover: #1a2e27;
    --skill-tag-bg: #182521;
    --skill-tag-hover: #1b372f;
    --btn-bg: #1E2623;
    --btn-hover-bg: #2bb68c;
    --btn-hover-text: #090b0b;
    --card-border-color: rgba(43, 182, 140, 0.25);
    --card-shadow-color: rgba(0, 0, 0, 0.35);

    --font-primary: 'JetBrains Mono', monospace;
    --font-secondary: 'JetBrains Mono', monospace; /* Kept same as primary, can be differentiated if needed */

    /* Animation Durations */
    --animation-collapse-duration: 0.35s;
    --animation-expand-duration: 0.35s;
    --animation-content-fade-duration: 0.3s;
    --animation-content-fade-delay: 0.05s;
}

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

body {
    color: var(--text-primary);
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    /* overflow-x: hidden;  Consider if card causes horizontal scroll on small screens */
    min-height: 100vh;
    padding: 20px;
    position: relative; /* For z-indexing context if needed */
}

.card {
    margin-top: 5vh;
    background-color: rgba(var(--card-bg-val), var(--card-bg-alpha));
    border-radius: 16px;
    box-shadow: 0 10px 35px var(--card-shadow-color);
    border: 1px solid var(--card-border-color);
    backdrop-filter: blur(10px); /* Slightly reduced blur for minor perf gain, test visuals */
    width: 100%;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important for child animations and rounded corners */
    position: relative;
    z-index: 1; /* Ensures card is above the matrix canvas */
    animation: fadeInCard var(--animation-expand-duration) ease-out;
    will-change: transform, opacity; /* Hint for initial fadeInCard animation */
    opacity:0.96;
}

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

.profile {
    display: flex;
    align-items: center;
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* subtle separator */
    flex-shrink: 0; /* Prevents profile section from shrinking */
    position: relative; /* For stacking context if children use absolute positioning */
    z-index: 10; /* Ensures profile elements are above content during transitions if necessary */
    background-color: rgba(var(--card-bg-val), var(--card-bg-alpha)); /* Consistent background */
}

.profile-picture img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    object-fit: cover;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    margin-right: 20px;
}
.profile-picture img:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(var(--accent-primary), 0.4);
}

.profile-header h1 {
    font-family: var(--font-secondary);
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 4px 0;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent; /* Makes the gradient visible through text */
}
.pronouns, .aka {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.85;
    margin-top: 2px;
}
.aka { font-style: italic; }
.aka-name {
    color: var(--accent-tertiary);
    font-weight: 500;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}
.aka-name:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 5px var(--accent-primary);
}

.content {
    padding: 15px 30px 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allows content to fill available space */
    overflow: hidden; /* Manages content overflow */
    min-height: 0; /* Fix for flexbox overflow issues in some browsers */
}


.navigation {
    display: flex;
    gap: 10px; /* This is the gap between buttons */
    margin-bottom: 20px;
    flex-shrink: 0;
}

.nav-button {
    background-color: var(--btn-bg);
    color: var(--accent-primary);
    padding: 8px 6px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.15s ease-out, box-shadow 0.25s ease;
    border: 1px solid var(--accent-primary);
    
    /* --- Key change: Default to 1/5th width considering 5 potential buttons --- */
    flex-grow: 1; /* Allow growing to fill space if fewer than 5 are visible and intended */
    flex-shrink: 1;
    /* Base this on 5 buttons, but with grow:1, it will expand if fewer are visible */
    flex-basis: calc(20% - 8px); /* (100% / 5 buttons) - (4/5 * 10px gap) approx */
                                  /* When 4 are visible, flex-grow:1 will make them expand to fill like calc(25% - X) */

    text-align: center;
    font-weight: 500;
    font-size: 0.80rem; 
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1.4;
}

.nav-button::before { content: "["; color: var(--accent-primary); margin-right: 2px;}
.nav-button::after { content: "]"; color: var(--accent-primary); margin-left: 2px;}

.nav-button:hover {
    background-color: var(--btn-bg);
    border-color: var(--btn-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 3px 7px rgba(0,0,0,0.2);
}
.nav-button:active {
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Responsive adjustments for navigation buttons */
@media (max-width: 520px) { 
    .navigation {
        flex-wrap: wrap; 
        gap: 8px;
        /* For 2x2 or 3x2 layout: */
        /* If 5 buttons total, and one is hidden, we have 4.
           If 5 buttons total, and we want 3 on first row, 2 on second:
           button flex-basis might be calc(33.33% - X) for first 3,
           or just rely on flex-wrap and let them flow.
           For a consistent 2x2 (when 4 are visible):
        */
        justify-content: space-between; 
    }
    .nav-button {
        /* When 4 buttons are visible, they should form a 2x2 grid */
        /* When 5 buttons are visible (if you ever don't hide one), this would make a 2 then 3 layout */
        flex-grow: 0; /* Don't let them grow excessively in wrapped layout */
        flex-basis: calc(50% - 5px); /* Aim for 2 buttons per row (gap is 8px, so 8px/2 = 4px per item approx) */
        font-size: 0.76rem; 
        padding: 7px 4px;
    }
}

@media (max-width: 420px) {
    /* Profile adjustments for very small screens */
    .profile {
        flex-direction: column;
        text-align: center;
    }
    .profile-picture img {
        margin-right: 0;
        margin-bottom: 12px;
    }
    .content {
        padding: 12px 20px 18px;
    }

    /* Navigation for very small screens, maintains 2x2 if 4 are visible */
    .nav-button {
        font-size: 0.72rem; 
        padding: 6px 3px;
        /* flex-basis from 520px breakpoint (calc(50% - 5px)) still applies for 2x2 when 4 visible */
    }
}

.page-content-wrapper {
    flex-grow: 1; /* Takes up remaining vertical space */
    overflow: hidden; /* Crucial for height animation clipping */
    position: relative; /* For absolute positioning of page-content if needed */
    min-height: 50px; /* Ensures wrapper has some height visually during transitions */
    will-change: height, opacity; /* Hints browser about upcoming animations */
}
/* Hide scrollbars for the wrapper */
.page-content-wrapper::-webkit-scrollbar { display: none; }
.page-content-wrapper { scrollbar-width: none; -ms-overflow-style: none; }

.page-content {
    display: none; /* Pages are hidden by default */
    padding-bottom: 10px; /* Space at the bottom of content */
}
.page-content.active {
    display: block; /* Active page is visible */
    opacity: 0; /* Start transparent for fade-in animation */
    animation: pageContentFadeIn var(--animation-content-fade-duration) ease-out var(--animation-content-fade-delay) forwards;
}
@keyframes pageContentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animations for page wrapper height transitions */
.page-wrapper-is-collapsing {
    animation: wrapperCollapse var(--animation-collapse-duration) ease-in-out forwards;
}
.page-wrapper-is-expanding {
    animation: wrapperExpand var(--animation-expand-duration) ease-in-out forwards;
}

@keyframes wrapperCollapse { /* Animates wrapper height from current to 0 */
    0%   { height: var(--content-wrapper-height); opacity: 1; }
    100% { height: 0px; opacity: 0; }
}
@keyframes wrapperExpand { /* Animates wrapper height from 0 to new content height */
    0%   { height: 0px; opacity: 0; }
    100% { height: var(--content-wrapper-height); opacity: 1; }
}

/* General Content Styling */
.intro {
    margin-bottom: 22px;
    font-size: 0.95rem;
    line-height: 1.75;
    font-family: var(--font-secondary);
}
.highlight {
    color: var(--accent-primary);
    font-weight: 600;
}
.section { margin-bottom: 25px; }
.section h2 {
    font-family: var(--font-secondary);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent-secondary);
    position: relative; /* For the underline pseudo-element */
    display: inline-block; /* Allows underline to fit content width */
    padding-bottom: 5px;
}
.section h2::after { /* Decorative underline for section titles */
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 65%;
    height: 2.5px;
    background: var(--accent-primary);
    border-radius: 1px;
}
.section h4 { /* Project titles within sections */
    font-family: var(--font-secondary);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.section p, .content-list li, .additional-info, .project-entry p {
    font-family: var(--font-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.content-list {
    list-style: none;
    padding-left: 0;
    margin-top: 8px;
}
.content-list li {
    margin-bottom: 7px;
    padding-left: 18px; /* Space for the custom bullet */
    position: relative;
}
.content-list li::before { /* Custom bullet for list items */
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 700;
}
.external-link::after { /* Indicator for links opening in a new tab */
    content: ' ↗';
    font-size: 0.8em;
    color: var(--accent-tertiary);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.tag {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s ease-out;
    display: inline-block;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid transparent; /* Base border for consistent sizing */
}
.tag.project {
    background-color: var(--project-tag-bg);
    color: var(--accent-primary);
    border-color: rgba(var(--accent-primary), 0.25);
}
.tag.project:hover {
    background-color: var(--project-tag-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}
.tag.skill {
    background-color: var(--skill-tag-bg);
    color: var(--accent-tertiary);
    border-color: rgba(var(--accent-tertiary), 0.25);
}
.tag.skill:hover {
    background-color: var(--skill-tag-hover);
    border-color: var(--accent-tertiary);
    transform: translateY(-1px);
}
.tag-placeholder { /* For "...and more to come" text */
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.8rem;
    padding: 5px 0; /* Align with tag padding */
    align-self: center;
}
.project-link-standalone { /* For project links that stand alone, not in a .tags group */
    margin-top: 8px !important; /* Ensure spacing */
    display: inline-block;
}

.footer {
    margin-top: auto; /* Pushes footer to the bottom of the .content flex container */
    padding-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0; /* Prevents footer from shrinking */
}
.github-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}
.github-link:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 4px var(--accent-secondary);
    text-decoration: underline;
}

/* Further responsive adjustments for smaller screens */
@media (max-width: 560px) { /* General card content padding and font sizes */
    .profile { padding: 20px 25px 15px; }
    .profile-header h1 { font-size: 1.55rem; }
    .content { padding: 15px 25px 20px; }
    /* Navigation buttons are handled by the 520px and 420px breakpoints above */
}
@media (max-width: 480px) { /* Fine-tuning font sizes for content on smaller screens */
    .profile-header h1 { font-size: 1.5rem; }
    .section h2 { font-size: 1.1rem; }
    .intro, .section p, .content-list li, .additional-info { font-size: 0.88rem; }
    .tag, .tag-placeholder { font-size: 0.75rem; padding: 4px 8px; }
}


/* --- Fun Feature Styles --- */

/* 1. Glitch Effect on Hover */
.glitch-text-base {
    position: relative; /* Establishes a positioning context for pseudo-elements */
}
.glitch-text-base.glitching-active { /* Class applied when glitch effect is active */
    color: var(--accent-primary); /* Base color during glitch */
    animation: glitch-main 0.3s linear infinite alternate-reverse; /* Main text movement */
}
/* Pseudo-elements create the layered, offset text effect for glitching */
.glitch-text-base.glitching-active::before,
.glitch-text-base.glitching-active::after {
    content: attr(data-text); /* Uses text from data-text attribute */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(var(--card-bg-val), var(--card-bg-alpha)); /* Matches card background to hide original text under layers */
}
.glitch-text-base.glitching-active::before { /* First glitch layer */
    left: 2px;
    text-shadow: -1.5px 0 var(--accent-secondary);
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%); /* Clips this layer */
    animation: glitch-before 0.5s cubic-bezier(.25,.46,.45,.94) both infinite; /* Animates the clip-path */
}
.glitch-text-base.glitching-active::after { /* Second glitch layer */
    left: -2px;
    text-shadow: -1.5px 0 var(--accent-tertiary), 1.5px 1.5px var(--accent-secondary);
    clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%); /* Clips this layer */
    animation: glitch-after 0.4s cubic-bezier(.25,.46,.45,.94) reverse both infinite; /* Animates the clip-path differently */
}
/* Keyframes for the glitch animations */
@keyframes glitch-main { /* Animates the main text element's skew and opacity */
    0% { transform: skewX(0deg); opacity: 1;} 10% { transform: skewX(-3deg); opacity: 0.8;}
    20% { transform: skewX(3deg); opacity: 1;} 30% { transform: skewX(-2deg); opacity: 0.9;}
    40% { transform: skewX(2deg); opacity: 1;} 50% { transform: skewX(0deg); opacity: 0.95;}
    100% { transform: skewX(0deg); opacity: 1;}
}
@keyframes glitch-before { /* Animates the clip-path of the ::before pseudo-element */
    0% { clip-path: inset(80% -6px 11% 0); } 10% { clip-path: inset(43% -6px 20% 0); }
    20% { clip-path: inset(10% -6px 80% 0); } 30% { clip-path: inset(60% -6px 30% 0); }
    40% { clip-path: inset(20% -6px 70% 0); } 50% { clip-path: inset(90% -6px 5% 0); }
    60% { clip-path: inset(30% -6px 62% 0); } 70% { clip-path: inset(5% -6px 80% 0); }
    80% { clip-path: inset(50% -6px 40% 0); } 90% { clip-path: inset(25% -6px 65% 0); }
    100% { clip-path: inset(70% -6px 13% 0); }
}
@keyframes glitch-after { /* Animates the clip-path of the ::after pseudo-element */
    0% { clip-path: inset(82% 0 1% -2px); } 10% { clip-path: inset(2% 0 66% -2px); }
    20% { clip-path: inset(90% 0 8% -2px); } 30% { clip-path: inset(40% 0 45% -2px); }
    40% { clip-path: inset(70% 0 20% -2px); } 50% { clip-path: inset(10% 0 85% -2px); }
    60% { clip-path: inset(65% 0 10% -2px); } 70% { clip-path: inset(30% 0 50% -2px); }
    80% { clip-path: inset(88% 0 5% -2px); } 90% { clip-path: inset(55% 0 33% -2px); }
    100% { clip-path: inset(13% 0 77% -2px); }
}

/* 2. System Message Tooltips */
.system-tooltip {
    position: absolute; /* Positioned relative to the nearest positioned ancestor or body */
    background-color: #0c0f0e; /* Dark background for contrast */
    color: var(--accent-primary);
    border: 1px solid var(--accent-secondary);
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-family: var(--font-primary);
    z-index: 1000; /* Ensures tooltip is on top of other elements */
    white-space: normal; /* Allows text to wrap */
    width: auto; /* Sizes to content, up to max-width */
    max-width: 280px;
    line-height: 1.4;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0; /* Hidden by default, controlled by JS */
    visibility: hidden; /* Hidden by default, controlled by JS */
    pointer-events: none; /* Tooltip doesn't interfere with mouse events on elements below */
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out;
    transform: translateY(5px); /* Initial offset for entry animation */
}
/* JavaScript will manage visibility and opacity to show/hide tooltips */

/* 3. Animated Caret (Blinking Slash) */
.aka .blinking-slash { /* Targets spans with this class within the .aka container */
    display: inline-block; /* Allows animation and proper spacing */
    animation: blink-animation 1s step-end infinite; /* Blinking animation */
    font-weight: normal; /* Standard font weight */
    color: var(--accent-secondary);
    margin: 0 1px 0 3px; /* Spacing around the slash */
    padding: 0;
    line-height: inherit; /* Inherits line height from parent */
}
@keyframes blink-animation { /* Simple opacity blink */
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Ensure H2s within page-content (like for Socials, Info etc.) also get underline */
.page-content > h2 { /* Selects direct h2 children of .page-content */
    font-family: var(--font-secondary); font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent-secondary); position: relative;
    display: inline-block; padding-bottom: 5px;
}
.page-content > h2::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 65%;
    height: 2.5px; background: var(--accent-primary); border-radius: 1px;
}

hr {
    border: none; /* Remove default border */
    height: 3px!important; /* Set height */
    background-color: #222; /* Set background color */
   margin:5px 0 0 0 ;
  }