/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Enhanced focus styles for better accessibility */
*:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #1e4d7b; /* Darkened from #2574a9 for WCAG AA contrast with white text on gradient (5.5:1 ratio) */
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Dark mode color scheme */
body.dark-mode {
    --primary-color: #4a90e2;
    --secondary-color: #64b5f6;
    --accent-color: #ff6b6b;
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --bg-color: #1a1a1a;
    --bg-light: #2d2d2d;
    --border-color: #444;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.5);
}

html {
    scroll-behavior: smooth;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--secondary-color);
    outline-offset: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Header and Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 0.5rem;
    display: inline-block;
    position: relative;
}

.nav-links a:hover {
    color: var(--secondary-color);
    transform: translateY(-2px);
}

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

.nav-links a:hover:after,
.nav-links a.active:after {
    width: 100%;
    left: 0;
}

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark-mode-toggle:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.dark-mode-toggle:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.dark-mode-toggle-icon {
    width: 20px;
    height: 20px;
}

/* Hero Section */
.hero {
    margin-top: 80px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero:before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: hero-shine 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hero-shine {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0;
    }

    50% {
        transform: translate(-25%, -25%);
        opacity: 1;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-content h2 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    animation: fade-in-up 0.8s ease-out;
}

.tagline {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    font-weight: 400;
    opacity: 0.95;
    animation: fade-in-up 0.8s ease-out 0.2s both;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: white;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    border-radius: 50px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.cta-button:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(30, 77, 123, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.cta-button:hover:before {
    width: 300px;
    height: 300px;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.cta-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Sections */
.section {
    padding: 6rem 2rem;
}

.bg-light {
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    border-radius: 2px;
}

/* About Section */
.about-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.profile-picture {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--border-color) 100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-picture:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.profile-picture.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.about-text {
    flex: 1;
}

.about-content p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.about-content a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.about-content a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Business Links */
.business-links {
    margin-top: 2rem;
    text-align: center;
}

.business-links .cta-button {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.business-links .cta-button:hover {
    background-color: var(--secondary-color);
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.skill-category {
    background-color: var(--bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-left-color 0.3s ease;
    border-left: 4px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.skill-category:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30, 77, 123, 0.05) 0%, rgba(231, 76, 60, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.skill-category:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border-left-color: var(--accent-color);
}

.skill-category:hover:before {
    opacity: 1;
}

.skill-category h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--secondary-color);
    font-weight: 600;
}

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

.skill-category li {
    padding: 0.6rem 0;
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.6;
}

.skill-category li:before {
    content: "▹ ";
    color: var(--secondary-color);
    font-weight: bold;
}

.skill-category a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.skill-category a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Experience Section */
.experience-timeline {
    max-width: 800px;
    margin: 0 auto;
}

.experience-item {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 4px solid var(--secondary-color);
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.experience-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.experience-date {
    color: var(--text-light);
    font-weight: 500;
}

.experience-company {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.experience-company a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.experience-company a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.experience-description {
    list-style: none;
    padding-left: 0;
}

.experience-description li {
    padding: 0.3rem 0;
    color: var(--text-light);
}

.experience-description li:before {
    content: "• ";
    color: var(--secondary-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.project-card {
    background-color: var(--bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-top-color 0.3s ease;
    border-top: 4px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.project-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30, 77, 123, 0.03) 0%, rgba(231, 76, 60, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border-top-color: var(--accent-color);
}

.project-card:hover:before {
    opacity: 1;
}

.project-card h3 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.project-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: var(--bg-light);
    color: var(--secondary-color);
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    cursor: default;
}

.tech-tag:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

/* Certification Badge */
.certification-badge {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    display: block;
}

/* Blog Section */
.blog-meta {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    font-style: italic;
}

.blog-meta time {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Contact Section */
.contact-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.contact-content p {
    font-size: 1.15rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.05rem;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.contact-link:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.contact-link:hover:before {
    width: 300px;
    height: 300px;
}

.contact-link:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.contact-link:active {
    transform: translateY(-1px) scale(1);
}

.contact-link svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.contact-link:hover svg {
    transform: scale(1.1) rotate(5deg);
}

/* Sponsor Section */
.sponsor-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.sponsor-section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.sponsor-section > p {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.sponsor-button {
    margin-bottom: 1.5rem;
}

.sponsor-button iframe {
    border: 0;
    border-radius: 6px;
}

.sponsor-card {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.sponsor-card iframe {
    max-width: 100%;
    border: 0;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem;
    text-align: center;
}

footer p {
    opacity: 0.8;
}

.footer-license {
    margin-top: 0.5rem;
}

footer a {
    color: white;
    text-decoration: underline;
}

/* Contact Info */
.contact-info {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.contact-info-item {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.contact-info strong {
    color: var(--primary-color);
    font-weight: 600;
}

.contact-info a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .about-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-picture {
        margin-bottom: 1rem;
    }

    .skills-grid,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .experience-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .contact-links {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-link {
        justify-content: center;
    }

    .sponsor-card iframe {
        width: 100%;
        max-width: 100%;
    }

    .sponsor-button iframe {
        width: 100%;
        max-width: 114px;
    }
    
    footer {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-content h2 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .section {
        padding: 3rem 1rem;
    }

    .nav-container {
        padding: 1rem;
    }
    
    footer {
        padding: 2rem;
    }
}

/* Animation Classes for CSP-compliant JavaScript */
.nav-links a.active {
    color: var(--secondary-color);
}

.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* PWA Install Button */
.pwa-install-button {
    margin-top: 1rem;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-button.pwa-hidden {
    display: none;
}

.pwa-install-button:hover {
    background-color: white;
}

.pwa-install-button:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.pwa-install-icon {
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Reading Progress Indicator */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    z-index: 10001;
    transition: width 0.1s ease-out;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.scroll-to-top:hover {
    background-color: var(--secondary-color);
    transform: scale(1.1);
}

.scroll-to-top:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0s !important;
        scroll-behavior: auto !important;
    }

    .fade-in-element {
        opacity: 1;
        transform: none;
    }

    .hero:before {
        animation: none;
        opacity: 0;
    }
}
