/* --- Global Variables --- */
:root {
    --bg-color: #0a0a0a;
    --primary-text-color: #f0f0f0;
    --secondary-text-color: #a0a0a0;
    --card-bg-color: #1a1a1a;
    --border-color: #2a2a2a;
    --accent-color: #007bff;
    --accent-hover-color: #0056b3;
    --glow-color: rgba(0, 123, 255, 0.75);
    --font-main: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --nav-height: 70px;
}

.light-mode {
    --bg-color: #f5f5f5;
    --primary-text-color: #1a1a1a;
    --secondary-text-color: #555;
    --card-bg-color: #ffffff;
    --border-color: #e0e0e0;
}

/* --- Base Styles --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overflow-x: hidden;
}
html { 
    scroll-behavior: smooth; 
}
body {
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    font-family: var(--font-body);
    transition: background-color 0.3s, color 0.3s;
}
.container { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 5rem 2rem; 
}
h1, h2, h3, h4 { 
    font-family: var(--font-main); 
    font-weight: 700; 
}
h2 { 
    text-align: center; 
    font-size: 2.8rem; 
    margin-bottom: 3rem; 
    position: relative; 
}
h2::after { 
    content: ''; 
    display: block; 
    width: 60px; 
    height: 4px; 
    background: var(--accent-color); 
    margin: 1rem auto 0; 
    border-radius: 2px; 
}
p { 
    color: var(--secondary-text-color); 
    line-height: 1.7; 
    margin-bottom: 1rem; 
}

/* --- Animations --- */
.reveal { 
    opacity: 0; 
    transform: translateY(40px); 
    transition: opacity 0.8s ease-out, transform 0.8s ease-out; 
}
.reveal.visible { 
    opacity: 1; 
    transform: translateY(0); 
}
@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px var(--glow-color), 0 0 10px var(--glow-color); }
    50% { box-shadow: 0 0 20px var(--glow-color), 0 0 30px var(--glow-color); }
    100% { box-shadow: 0 0 5px var(--glow-color), 0 0 10px var(--glow-color); }
}

/* --- Navigation Bar --- */
.navbar {
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    padding: 0 2rem; 
    height: var(--nav-height);
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    z-index: 1000; 
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px); 
    transition: background-color 0.3s;
}
.navbar.scrolled { 
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); 
}
.nav-logo { 
    font-family: var(--font-main); 
    font-size: 1.5rem; 
    font-weight: 700; 
    text-decoration: none; 
    color: var(--primary-text-color); 
}
.nav-links { 
    display: flex; 
    list-style: none; 
}
.nav-links li { 
    margin: 0 1rem; 
}
.nav-links a { 
    text-decoration: none; 
    color: var(--primary-text-color); 
    font-weight: 500; 
    transition: color 0.3s; 
}
.nav-links a:hover { 
    color: var(--accent-color); 
}
.nav-actions { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
}
#theme-toggle { 
    background: none; 
    border: none; 
    color: var(--primary-text-color); 
    font-size: 1.2rem; 
    cursor: pointer; 
}
.hamburger { 
    display: none; 
    font-size: 1.8rem; 
    background: none; 
    border: none; 
    color: var(--primary-text-color); 
    cursor: pointer; 
    z-index: 1001;
}

/* --- Hero Section --- */
.hero { 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    text-align: center; 
    position: relative; 
    overflow: hidden; 
    padding: 0 1rem;
}
#matrix-canvas { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 0; 
}
.hero-content { 
    position: relative; 
    z-index: 1; 
    background: rgba(10, 10, 10, 0.5); 
    padding: 2rem; 
    border-radius: 12px; 
}
.hero-content h1 { 
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    margin-bottom: 1rem; 
}
.tagline { 
    font-family: var(--font-main); 
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    color: var(--accent-color); 
    margin-bottom: 2rem; 
    min-height: 2.2rem; 
}
.tagline .cursor { 
    display: inline-block; 
    background-color: var(--accent-color); 
    width: 10px; 
    animation: blink 1s step-end infinite; 
}
@keyframes blink { 
    from, to { background-color: transparent } 
    50% { background-color: var(--accent-color); } 
}

/* --- Buttons --- */
.btn { 
    text-decoration: none; 
    padding: 10px 24px;
    border-radius: 8px; 
    font-weight: 500; 
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.3s ease, color 0.2s ease; 
    display: inline-block; 
    border: 2px solid transparent;
}
.btn-primary { 
    background-color: var(--accent-color); 
    border-color: var(--accent-color);
    color: #fff; 
}
.btn-primary:hover { 
    background-color: var(--accent-hover-color); 
    border-color: var(--accent-hover-color);
    transform: translateY(-3px); 
    animation: pulse-glow 1.5s infinite; 
}
.btn-secondary {
    background-color: transparent;
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.btn-secondary:hover {
    background-color: var(--accent-color);
    color: #fff;
    transform: translateY(-3px);
}
.light-mode .btn-secondary:hover {
    color: #fff;
}

/* --- General Card & Grid Styles --- */
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem; 
}
.card { 
    background: var(--card-bg-color); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    overflow: hidden; 
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s; 
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}
.card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 0 25px rgba(0, 123, 255, 0.2); 
    border-color: var(--accent-color); 
}
.card h3 { 
    color: var(--accent-color); 
    margin-bottom: 0.5rem; 
}
.card h4 { 
    color: var(--primary-text-color); 
    margin-bottom: 0.5rem; 
}
.card .date { 
    font-size: 0.9rem; 
    color: var(--secondary-text-color); 
    margin-bottom: 1rem; 
}
.card ul { 
    list-style-position: inside; 
    padding-left: 5px; 
}
.card ul li { 
    margin-bottom: 0.5rem; 
}

/* --- Portfolio --- */
.project-card img { 
    width: calc(100% + 3rem); 
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; 
    height: 200px; 
    object-fit: cover; 
}
.project-buttons {
    display: flex;
    gap: 1rem;
    margin-top: auto; /* Pushes buttons to the bottom of the card */
}

/* --- Skills --- */
.skills-card ul { 
    list-style: none; 
    padding: 0; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.5rem; 
}
.skills-card li { 
    background-color: #2a2a2a; 
    color: var(--primary-text-color); 
    padding: 5px 12px; 
    border-radius: 15px; 
    font-size: 0.9rem; 
}

/* --- Certification Slider --- */
.slider-container { 
    position: relative; 
    width: 100%; 
    max-width: 420px; 
    margin: 0 auto; 
}
.slider-wrapper { 
    display: flex; 
    transition: transform 0.5s ease-in-out; 
    cursor: grab; 
}
.slider-wrapper:active { 
    cursor: grabbing; 
}
.cert-slide { 
    flex: 0 0 100%;
    padding: 0 10px; 
    box-sizing: border-box;
}
.cert-slide a { 
    text-decoration: none; 
}
.cert-block { 
    background: var(--card-bg-color); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 1.5rem; 
    text-align: center; 
    transition: transform 0.3s ease;
    height: 320px;
    position: relative; /* This is the key: makes it a positioning parent */
}
.cert-block:hover { 
    transform: translateY(-5px); 
}
.cert-block .cert-full-image,
.cert-block .cert-logo {
    position: absolute; /* Position the items relative to the block */
    top: 50%;           /* Move the top edge to the halfway point */
    left: 50%;          /* Move the left edge to the halfway point */
    transform: translate(-50%, -50%); /* Shift the item back by half its own size */
    transition: opacity 0.4s ease-in-out;
    max-width: calc(100% - 3rem); /* Respect the block's padding */
    max-height: calc(100% - 6rem); /* Respect padding and leave room for the title */
    object-fit: contain;
    border-radius: 8px;
}
.cert-block .cert-full-image {
    opacity: 0;
}
.cert-block:hover .cert-full-image {
    opacity: 1;
}
.cert-block:hover .cert-logo {
    opacity: 0;
}
.cert-block .cert-logo {
    fill: var(--primary-text-color);
}
.cert-block .cert-logo text {
    font-size: 24px;
    font-family: var(--font-main);
}
.cert-block .cert-logo .cert-subtitle {
    font-size: 16px;
    fill: var(--accent-color);
}
.cert-block h4 { 
    position: absolute; /* Position the title at the bottom of the block */
    bottom: 1.5rem;     /* Set its position from the bottom */
    left: 1.5rem;       /* Align it within the padding */
    right: 1.5rem;
    margin: 0;
    color: var(--primary-text-color);
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
}
.cert-block:hover h4 {
    opacity: 0;
}
.slider-btn { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    background: rgba(42, 42, 42, 0.7); 
    border: 1px solid var(--border-color); 
    color: var(--primary-text-color); 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    font-size: 1.5rem; 
    cursor: pointer; 
    z-index: 10; 
}
.slider-btn.prev { 
    left: -50px; 
}
.slider-btn.next { 
    right: -50px; 
}

/* --- Contact & Footer --- */
.contact-form { max-width: 700px; margin: 0 auto; background-color: var(--card-bg-color); padding: 2.5rem; border: 1px solid var(--border-color); border-radius: 12px; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea { width: 100%; padding: 12px; border-radius: 6px; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--primary-text-color); font-family: var(--font-body); }
.footer { text-align: center; padding: 3rem 1rem; border-top: 1px solid var(--border-color); }
.social-icons a { color: var(--secondary-text-color); font-size: 1.5rem; margin: 0 1rem; transition: color 0.3s ease; }

/* --- Light Mode Fixes --- */
.light-mode .skills-card li { background-color: #e0e0e0; }
.light-mode .card h3 { color: #0056b3; }
.light-mode .card p { color: #333; }
.light-mode .hero-content h1 { color: #f0f0f0; }
.light-mode .nav-logo,
.light-mode .nav-links a,
.light-mode #theme-toggle,
.light-mode .hamburger {
    color: #f0f0f0;
}
.light-mode .cert-block .cert-logo {
    fill: #1a1a1a;
}
.light-mode .cert-block h4 {
    color: #1a1a1a;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .container { padding: 4rem 1rem; }
    h2 { font-size: 2.2rem; }
    .navbar { padding: 0 1rem; }
    .nav-logo { margin-right: 0; }
    .nav-links { position: fixed; top: 0; right: -100%; width: 100%; height: 100vh; background: var(--bg-color); flex-direction: column; align-items: center; justify-content: center; transition: right 0.4s ease-in-out; }
    .nav-links.active { right: 0; }
    .nav-links li { margin: 1.5rem 0; }
    .hamburger { display: block; margin-left: auto; }
    .nav-actions { margin-left: 1rem; }
    .slider-btn.prev { left: 0px; }
    .slider-btn.next { right: 0px; }
}