/* ===========================
   CSS VARIABLES
=========================== */
:root {
    /* Colors */
    --primary-bg: #0a192f;
    --secondary-bg: #112240;
    --tertiary-bg: #0d1117;
    --accent-color: #64ffda;
    --accent-hover: #fff;
    --text-primary: #e6f1ff;
    --text-secondary: #a8b2d1;
    --text-tertiary: #ccd6f6;
    
    /* Accent variations */
    --accent-rgb: 100, 255, 218;
    --accent-shadow: rgba(100, 255, 218, 0.2);
    --accent-shadow-strong: rgba(100, 255, 218, 0.3);
    --accent-shadow-light: rgba(100, 255, 218, 0.1);
    
    /* Glitch colors */
    --glitch-red: #ff6f61;
    --glitch-purple: #6a5acd;
    
    /* Rank colors */
    --rank-gold-1: #ffd700;
    --rank-gold-2: #ffed4e;
    --rank-silver-1: #c0c0c0;
    --rank-silver-2: #e8e8e8;
    --rank-bronze-1: #ff6b35;
    --rank-bronze-2: #f7931e;
    --rank-top-1: #64ffda;
    --rank-top-2: #4ecdc4;
    
    /* Effects */
    --border-radius: 10px;
    --border-radius-lg: 15px;
    --transition: all 0.3s ease;
}

/* ===========================
   RESET & BASE STYLES
=========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--primary-bg);
    color: var(--text-primary);
}

/* ===========================
   LAYOUT
=========================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
    text-align: center;
}

/* ===========================
   NAVIGATION
=========================== */
header {
    background-color: rgba(10, 25, 47, 0.9);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

header:hover {
    background-color: rgba(10, 25, 47, 1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.9);
}

nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 3rem;
    padding: 0;
    margin: 0;
}

nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1.2rem;
    position: relative;
    font-weight: 500;
    letter-spacing: 0.05rem;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent-hover);
}

nav a::before {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--accent-color);
    transition: width 0.3s ease, left 0.3s ease;
}

nav a:hover::before,
nav a.active::before {
    width: 100%;
    left: 0;
}

nav a.active {
    color: var(--accent-hover);
}

/* ===========================
   HERO SECTION
=========================== */
#hero {
    height: 100vh;
    display: flex;
    align-items: center; 
    text-align: center;
    padding: 0 20px;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

#hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    position: relative;
    display: inline-block;
}

/* Glitch effect using pseudo-elements */
.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.75;
}

.glitch-text::before {
    animation: glitch 1s infinite;
    color: var(--glitch-red);
    animation-delay: -0.2s;
    z-index: -1;
}

.glitch-text::after {
    animation: glitch 1s infinite;
    color: var(--glitch-purple);
    animation-delay: 0.2s;
    z-index: -2;
}

#hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-tertiary);
    animation: fadeIn 8s ease-in-out infinite;
}

.typing-text {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-top: 1rem;
    min-height: 2rem;  
    line-height: 1.5rem;  
    display: inline-block; 
    vertical-align: middle;  
    white-space: nowrap;  
}

.txt {
    border-right: 0.2rem solid var(--accent-color);
    padding-right: 0.5rem;
    animation: caretBlink 0.7s infinite;
}

/* Profile Photo */
.profile-photo {
    flex-shrink: 0;
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
    box-shadow: 0 0 20px var(--accent-shadow-strong);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.5);
}

.profile-photo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    background: linear-gradient(45deg, transparent, var(--accent-shadow-light));
    z-index: 1;
}

.profile-photo img.photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* ===========================
   PARTICLES BACKGROUND
=========================== */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ===========================
   ABOUT SECTION
=========================== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
    margin-top: 2rem;
}

.about-text {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.about-intro h3 {
    color: var(--accent-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.about-intro h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
}

.about-intro p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.about-highlights {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.highlight-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.highlight-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.highlight-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.about-visual {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Terminal Window */
.terminal-window {
    background: var(--tertiary-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.terminal-window:hover {
    border-color: var(--accent-color);
    box-shadow: 0 15px 40px var(--accent-shadow);
}

.terminal-header {
    background: #161b22;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.terminal-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.btn.red { background: #ff5f56; }
.btn.yellow { background: #ffbd2e; }
.btn.green { background: #27ca3f; }

.terminal-title {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.terminal-body {
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.terminal-line {
    margin-bottom: 0.5rem;
}

.prompt {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.output {
    color: var(--text-secondary);
}

.cursor {
    color: var(--accent-color);
    animation: cursorBlink 1s infinite;
}

/* ===========================
   SKILLS SECTION
=========================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.skill-card {
    background-color: var(--secondary-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition);
}

.skill-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-header i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.skill-card h3 {
    color: var(--accent-color);
    margin: 0;
}

.skill-card ul {
    list-style: none;
}

.skill-card li {
    margin-bottom: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-card li i {
    color: var(--accent-color);
    width: 20px;
}

/* ===========================
   PROJECTS SECTION
=========================== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--secondary-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-card h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.project-card p {
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.project-links {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(var(--accent-rgb), 0.1);
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;

    display: flex;
    gap: 0.75rem;

    border: none;
    padding: 0;
    margin: 0;
}

.project-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 50%;
    transition: var(--transition);
    font-size: 1rem;
}

.project-links a:hover {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--accent-shadow);
}

/* ===========================
   ACHIEVEMENTS SECTION
=========================== */
.achievement-image {
    width: 100%;
    height: 160px;
    margin-bottom: 1.2rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--primary-bg);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
}

.achievement-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.95) contrast(1.05);
    transition: transform 0.4s ease, filter 0.4s ease;
}

.project-card:hover .achievement-image img {
    transform: scale(1.05);
    filter: brightness(1);
}

/* ===========================
   CONTACT SECTION
=========================== */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.contact-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 50%;
    transition: var(--transition);
}

.contact-button:hover {
    animation: pulse 1s infinite;
    background-color: var(--accent-shadow-light);
}

.contact-button i {
    font-size: 1.5rem;
}

/* ===========================
   FOOTER
=========================== */
footer {
    text-align: center;
    padding: 0.5rem 0;
    background-color: var(--secondary-bg);
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

.binary-footer {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    margin-top: 0.3rem;
}

/* ===========================
   ANIMATIONS & KEYFRAMES
=========================== */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
    100% { transform: translate(0); }
}

/* @keyframes glitch {
    0% { transform: translate(0); }
    10% { transform: translate(-5px, 5px); }
    20% { transform: translate(5px, -5px); }
    30% { transform: translate(-5px, -5px); }
    40% { transform: translate(5px, 5px); }
    50% { transform: translate(-8px, 2px); }
    60% { transform: translate(8px, -2px); }
    70% { transform: translate(-3px, -8px); }
    80% { transform: translate(3px, 8px); }
    90% { transform: translate(-2px, 2px); }
    100% { transform: translate(0); }
} */

@keyframes fadeIn {
    0% { opacity: 0; }
    25% { opacity: 1;}
    50% { opacity: 0;}
    75% { opacity: 1;}
    100% { opacity: 0;}
}

@keyframes caretBlink {
    0% { border-right-color: transparent }
    50% { border-right-color: var(--accent-color) }
    100% { border-right-color: transparent }
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===========================
   RESPONSIVE DESIGN
=========================== */

/* Tablet & Mobile (768px and below) */
@media (max-width: 768px) {
    /* Container */
    .container {
        padding: 0 15px;
    }

    /* Navigation */
    header {
        padding: 0.5rem 0;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1rem 0;
    }

    nav a {
        font-size: 1rem;
    }

    /* Hero Section */
    #hero {
        padding: 80px 20px 40px;
        min-height: 100vh;
    }

    .hero-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    #hero h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    #hero h2 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .typing-text {
        font-size: 1.2rem;
        margin-top: 0.5rem;
    }

    .profile-photo {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    /* Sections */
    section {
        padding: 60px 0;
    }

    h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-highlights {
        flex-direction: column;
        gap: 1rem;
    }
    
    .highlight-number {
        font-size: 1.5rem;
    }
    
    .terminal-window {
        max-width: 100%;
    }
    
    .terminal-body {
        padding: 1rem;
        font-size: 0.8rem;
    }

    .about-card {
        padding: 1.5rem;
        text-align: center;
    }

    /* Skills Grid */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .skill-card {
        padding: 1.5rem;
    }

    /* Projects Grid */
    .project-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-card {
        padding: 1.5rem;
    }

    /* CTF Section */
    .dashboard-stats {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .stat-box {
        min-width: 200px;
        justify-content: center;
    }

    .ctf-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ctf-card {
        padding: 1.5rem;
    }

    .ctf-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .ctf-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .ctf-rank {
        align-self: flex-start;
    }

    .ctf-badge {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 0.9rem;
        padding: 0.2rem 0.6rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Achievements */
    .achievement-image {
        height: 140px;
    }

    /* Contact Links */
    .contact-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
        justify-content: center;
    }

    .contact-button {
        width: 45px;
        height: 45px;
    }

    .contact-button i {
        font-size: 1.2rem;
    }

    /* Footer */
    footer {
        padding: 1rem 0;
        text-align: center;
    }

    footer p {
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    #hero {
        padding: 70px 15px 30px;
    }

    #hero h1 {
        font-size: 1.8rem;
    }

    .typing-text {
        font-size: 1rem;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    h2 {
        font-size: 1.8rem;
    }

    .skill-card,
    .project-card {
        padding: 1rem;
    }

    .contact-links {
        gap: 1rem;
    }

    .contact-button {
        width: 40px;
        height: 40px;
    }

    .contact-button i {
        font-size: 1rem;
    }
}