/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Variables */
/* Variables */
:root {
    /* JMW Turner Inspired Palette */
    /* Deep Storm Blue - reminiscent of his stormy seas */
    --primary-color: #1c2331;

    /* Slate/Storm Grey */
    --secondary-color: #4a5568;

    /* Turner Gold - reminiscent of his sunsets and light studies */
    --accent-color: #D4AF37;

    /* Deep Grey - for text readability */
    --text-color: #2d3748;

    /* Deep Storm Blue */
    --heading-color: #1c2331;

    /* Mist White - atmospheric background */
    --background-color: #FAFAF9;

    /* Pure White */
    --secondary-background: #ffffff;

    /* Light Mist Grey */
    --border-color: #e2e8f0;

    /* Deep Slate */
    --hover-color: #2d3748;

    --transition-speed: 0.3s;
    /* Slightly slower for more "atmospheric" feel */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --heading-font: 'Inter', sans-serif;
    --body-font: 'Inter', sans-serif;
}

/* Page Transitions */
.page-transition {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Base Styles */
body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font);
    font-weight: 600;
    line-height: 1.3;
}

/* Navigation */
.navbar {
    background-color: var(--background-color);
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.9);
}

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

.nav-logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-direction: row-reverse;
}

.nav-profile-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: none;
    /* Hidden by default, shown via JS on non-main pages */
}

.logo {
    font-family: var(--heading-font);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: transform var(--transition-speed);
}

.logo:hover {
    transform: scale(1.05);
}

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

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-speed);
    position: relative;
    font-size: 1.1rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--accent-color);
    transition: width var(--transition-speed);
}

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

.nav-links a:hover {
    color: var(--text-color);
}

.nav-links a.active {
    color: var(--primary-color);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
    width: 100%;
}

/* About Page */
.about-section {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-areas: "content image";
    gap: 4rem;
    align-items: center;
    position: relative;
    isolation: isolate;
}

.profile-image {
    width: 100%;
    max-width: 400px;
    border-radius: 4px;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed);
    border: 2px solid var(--border-color);
    transform-origin: center;
    grid-area: image;
    justify-self: center;
}

.profile-image:hover {
    transform: translateY(-2px) scale(1.015);
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 58ch;
    grid-area: content;
}

.about-content h1 {
    font-size: 3rem;
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

.about-content h1 .accent {
    color: var(--primary-color);
}

.cta-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed), background-color var(--transition-speed), color var(--transition-speed);
    box-shadow: var(--card-shadow);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

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

/* Traditional background pattern removed or replaced with solid */
.about-section::before {
    display: none;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    font-weight: 300;
}

/* Skills Page */
.skills-section {
    animation: fadeIn 0.5s ease-in-out;
}

.profile-header {
    text-align: center;
    margin-bottom: 3rem;
}

.profile-header h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-top: 1rem;
    font-weight: 700;
}

.skills-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--secondary-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--card-shadow);
}

.skills-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.skills-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.expand-all-btn {
    background: var(--secondary-background);
    color: var(--text-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.expand-all-btn:hover {
    background: #e9eef3;
    transform: translateY(-1px);
}

.skill-category {
    margin-bottom: 1rem;
}

.skill-button {
    width: 100%;
    padding: 1.25rem;
    background-color: var(--secondary-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: left;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    color: var(--text-color);
}

.skill-button i {
    font-size: 1.25rem;
    color: #6b7280;
    /* neutral icon */
    width: 1.5rem;
    text-align: center;
}

.skill-button span {
    flex: 1;
}

.experience-badge {
    background: var(--secondary-background);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.skill-button:hover {
    background-color: var(--secondary-background);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.skill-button.active {
    background-color: var(--secondary-background);
    color: var(--text-color);
    border-color: var(--primary-color);
}

.skill-button.active i {
    color: white;
}

.skill-button.active .experience-badge {
    background-color: white;
    color: var(--primary-color);
}

.skill-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    background-color: var(--secondary-background);
    border-radius: 0 0 4px 4px;
    margin-top: -0.5rem;
    padding: 0 1.25rem;
}

.skill-content.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.skill-content ul {
    list-style: none;
    padding: 1rem 0;
}

.skill-content li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

.skill-content li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* Subcategory styling */
.skill-content li.subcategory {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    padding-left: 0;
    font-size: 1.1rem;
}

.skill-content li.subcategory:before {
    content: none;
}

/* Indent items under subcategories */
.skill-content li:not(.subcategory) {
    padding-left: 2rem;
}

@media (max-width: 768px) {
    .skills-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .skills-header h1 {
        font-size: 2rem;
    }

    .skill-button {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .skill-button i {
        font-size: 1.25rem;
    }

    .experience-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}

/* CV Page */
.cv-section {
    width: 85%;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--secondary-background);
    border-radius: 4px;
    box-shadow: var(--card-shadow);
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}

.cv-section h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-weight: 700;
}

.download-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.download-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all var(--transition-speed);
    box-shadow: var(--card-shadow);
    font-size: 1.1rem;
}

.download-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.cv-preview {
    width: 100%;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.cv-preview iframe {
    width: 100%;
    max-width: 100%;
    border: none;
    box-shadow: var(--card-shadow);
    border-radius: 4px;
}

.cv-section .profile-image {
    max-width: 220px;
}

.cv-section .cv-preview {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

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

    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .about-section {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .profile-image {
        margin: 0 auto;
    }

    .about-content h1,
    .profile-header h1,
    .cv-section h1 {
        font-size: 2.5rem;
    }

    .download-options {
        flex-direction: column;
    }

    .cv-preview iframe {
        height: 600px;
    }
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Manual dark mode */
/* Manual dark mode */
html.dark-mode {
    --text-color: #e2e8f0;
    /* Light Grey for readability */
    --background-color: #0f1219;
    /* Very deep, almost black blue */
    --secondary-background: #1a202c;
    /* Dark Slate */
    --border-color: #2d3748;
    --primary-color: #e2e8f0;
    /* Light text for headings in dark mode */
    --heading-color: #f7fafc;
    --accent-color: #dab852;
    /* Slightly brighter gold for dark mode */
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Dark mode button and pill adjustments for readability */
html.dark-mode .btn-primary {
    background-color: var(--accent-color);
    color: #000000;
}

html.dark-mode .btn-primary:hover {
    background-color: #f3d472;
    color: #000000;
}

html.dark-mode .btn-secondary {
    background-color: #f5f5f5;
    color: #000000;
}

html.dark-mode .btn-secondary:hover {
    background-color: #e2e8f0;
    color: #000000;
}

html.dark-mode .skill-button.active .experience-badge {
    background-color: #f5f5f5;
    color: #000000;
}

html.dark-mode .expand-all-btn {
    background: var(--secondary-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

html.dark-mode .expand-all-btn:hover {
    background: #2d3748;
    color: #e2e8f0;
}

html.dark-mode .navbar,
html.dark-mode .footer {
    background-color: rgba(11, 15, 23, 0.9);
}

html.dark-mode .skill-button {
    background-color: var(--secondary-background);
}

html.dark-mode .download-button {
    box-shadow: none;
}

.footer {
    background-color: var(--secondary-background);
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-link {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-speed);
    font-weight: 500;
}

.footer-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.footer-link i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}