/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loading-bg, #0a0a0a); /* Default dark background */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Increased delay to 2 seconds before fade starts, 1s duration */
    animation: fadeOut 1s forwards 2s;
}

/* Ball Animation Styles for Loading Screen */
.loading-screen .container { /* Renamed from .loading-container to avoid conflict if any */
    width: 200px;
    height: 100px; /* Adjusted height, padding-top removed as align-items handles centering */
    margin: 0 auto;
    display: flex; /* Use flex to align balls */
    justify-content: center; /* Center balls horizontally */
    align-items: center; /* Center balls vertically */
}

.loading-screen .ball {
    width: 10px;
    height: 10px;
    margin: 0 5px; /* Adjusted margin for horizontal layout */
    border-radius: 50%;
    background: var(--loading-ball-color, #ffffff); /* Default white ball for dark bg */
}

.loading-screen .ball:nth-child(1) { animation: right 1s infinite ease-in-out; }
.loading-screen .ball:nth-child(2) { animation: left 1.1s infinite ease-in-out; }
.loading-screen .ball:nth-child(3) { animation: right 1.05s infinite ease-in-out; }
.loading-screen .ball:nth-child(4) { animation: left 1.15s infinite ease-in-out; }
.loading-screen .ball:nth-child(5) { animation: right 1.1s infinite ease-in-out; }
.loading-screen .ball:nth-child(6) { animation: left 1.05s infinite ease-in-out; }
.loading-screen .ball:nth-child(7) { animation: right 1s infinite ease-in-out; }

@keyframes right {
    0% { transform: translateX(-15px); }
    50% { transform: translateX(15px); }
    100% { transform: translateX(-15px); }
}

@keyframes left {
    0% { transform: translateX(15px); }
    50% { transform: translateX(-15px); }
    100% { transform: translateX(15px); }
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* Base Styles */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #e31b23;
    --nav-bg: rgba(255, 255, 255, 0.9);
    --secondary-text: #555;
    --success-color: #10b981;
    --error-color: #ef4444;
    --loading-bg: #ffffff; /* Light mode loading screen background */
    --loading-ball-color: #000000; /* Light mode loading ball color */
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --nav-bg: rgba(10, 10, 10, 0.9);
    --secondary-text: #aaa;
    --success-color: #34d399;
    --error-color: #f87171;
    --loading-bg: #0a0a0a; /* Dark mode loading screen background */
    --loading-ball-color: #ffffff; /* Dark mode loading ball color */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-transition: background-color 0.3s, color 0.3s;
    transition: background-color 0.3s, color 0.3s;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, .nav-links a, button, .skill-item h4, footer p, #contactForm p a {
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    letter-spacing: -0.03em;
}
p {
     font-family: 'Arial', sans-serif;
     color: var(--secondary-text);
}
#about p, #contactForm p {
     font-family: 'Arial', sans-serif;
}
#contactForm p a {
    font-family: 'Roboto Slab', serif;
    color: var(--accent-color);
    text-decoration: none;
}
#contactForm p a:hover {
    text-decoration: underline;
}


/* Header */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 5%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}

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

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

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

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
}

.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
    font-size: 24px;
    color: var(--text-color);
    transition: color 0.3s;
}
.theme-toggle:hover .material-symbols-outlined {
    color: var(--accent-color);
}


/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 5%;
    opacity: 0;
    -webkit-transform: translateY(20px);
    transform: translateY(20px);
    -webkit-animation: slideUp 1s forwards 2.5s; /* Delay animation start after loading */
    animation: slideUp 1s forwards 2.5s; /* Delay to allow loading screen + fadeOut */
}

@-webkit-keyframes slideUp {
    to { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}

@keyframes slideUp {
    to { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 0.5rem;
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.05em;
    color: var(--text-color);
}
.hero p {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    margin-bottom: 1.5rem;
    font-family: 'Arial', sans-serif;
    color: var(--secondary-text);
}
.hero p:last-of-type {
     margin-top: 2rem;
     font-size: 0.9rem;
     color: var(--secondary-text);
}


/* Sections */
.section {
    padding: clamp(4rem, 10vh, 8rem) 5%;
    min-height: 100vh;
    opacity: 0;
    -webkit-transform: translateY(30px);
    transform: translateY(30px);
    -webkit-transition: opacity 1s ease-out, -webkit-transform 1s ease-out;
    transition: opacity 1s ease-out, transform 1s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.section h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 3rem;
    font-weight: 700;
    color: var(--text-color);
}

.section > div:not(.skills-grid):not(.projects-grid):not(.social-icons):not(.showreel-content-wrapper) {
    max-width: 800px;
    width: 100%;
}


.section.visible {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    width: 100%;
    max-width: 1200px;
}

.project-card {
    background: var(--nav-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.project-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: rotate(45deg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.project-card:hover::after {
     opacity: 1;
     animation: shine 1.5s infinite linear;
}


@keyframes shine {
    0% { transform: translateX(-75%) rotate(45deg); }
    100% { transform: translateX(75%) rotate(45deg); }
}
.project-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    color: var(--text-color);
}
.project-card h3 i {
    font-size: 1rem;
    margin-left: 0.5rem;
    color: var(--accent-color);
}
.project-card p {
    font-size: 0.9rem;
    margin-top: 1rem;
    color: var(--secondary-text);
    flex-grow: 1;
}


/* Contact Form */
#contactForm {
    max-width: 600px;
    margin: 2rem auto 0 auto;
    width: 100%;
}
#formResult {
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.5em;
}
.form-success { color: var(--success-color); }
.form-error { color: var(--error-color); }


input[type="email"],
textarea {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc; /* Will be overridden by theme in focus */
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Arial', sans-serif;
    font-size: 1rem;
}
input[type="text"] {
     width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc; /* Will be overridden by theme in focus */
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Arial', sans-serif;
    font-size: 1rem;
}
[data-theme="dark"] input, [data-theme="dark"] textarea {
    border-color: #555; /* Darker border for dark theme inputs */
}
[data-theme="light"] input, [data-theme="light"] textarea {
    border-color: #ccc; /* Lighter border for light theme inputs */
}


input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(227, 27, 35, 0.3);
}


button[type="submit"] {
    background: var(--accent-color);
    color: white;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    -webkit-transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.3s ease;
    transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.3s ease;
    display: block;
    width: 100%;
    margin-top: 1rem;
}
 button[type="submit"]:disabled {
     opacity: 0.6;
     cursor: not-allowed;
 }

button[type="submit"]:hover:not(:disabled) {
    -webkit-transform: translateY(-3px);
    transform: translateY(-3px);
    background-color: #c0161d;
}


/* Social Icons */
.social-icons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 3rem;
}

.social-icons a {
    font-size: 2rem;
    color: var(--text-color);
    -webkit-transition: transform 0.3s ease, color 0.3s ease;
    transition: transform 0.3s ease, color 0.3s ease;
}

.social-icons a:hover {
    -webkit-transform: translateY(-5px) scale(1.1);
    transform: translateY(-5px) scale(1.1);
    color: var(--accent-color);
}

/* Footer */
footer {
    padding: 2rem 5%;
    text-align: center;
    background: var(--nav-bg);
    margin-top: 4rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}
[data-theme="dark"] footer {
     border-top: 1px solid rgba(255,255,255,0.1);
}
footer p {
    color: var(--secondary-text);
    font-size: 0.9rem;
}


/* Skills Grid Styles */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    width: 100%;
    max-width: 1000px;
}

.skill-item {
    background: var(--nav-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-item:hover {
    -webkit-transform: translateY(-6px);
    transform: translateY(-6px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.skill-item i {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    display: block;
}

.skill-item h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-family: 'Roboto Slab', serif;
    color: var(--text-color);
}

.skill-item p {
    font-size: 0.85rem;
    color: var(--secondary-text);
    font-family: 'Arial', sans-serif;
}

/* Showreel Section Styles */
.showreel-content-wrapper {
    width: 100%;
    max-width: 960px;
    margin-top: 1rem;
}

.vimeo-embed-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    width: 100%;
    background-color: #000;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .vimeo-embed-container {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.vimeo-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/* Responsive Styles */
@media (max-width: 768px) {
    .header {
        padding: 1rem 3%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 1rem;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }
    .theme-toggle {
        margin-left: auto;
        order: 2;
    }

    .hero h1 { font-size: clamp(2rem, 8vw, 2.5rem); }
    .hero p { font-size: clamp(0.8rem, 3vw, 1rem); }
    .section { padding: clamp(3rem, 8vh, 6rem) 3%; }
    .section h2 { font-size: clamp(1.8rem, 6vw, 2.5rem); margin-bottom: 2rem; }
    .projects-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .skills-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
    .skill-item { padding: 1rem; }
    .skill-item i { font-size: 1.8rem; }
    .skill-item h4 { font-size: 1rem; }
    .skill-item p { font-size: 0.8rem; }
    .social-icons { gap: 1.5rem; }
    .social-icons a { font-size: 1.8rem; }
    #contactForm { max-width: 90%; }
    button[type="submit"] { padding: 0.8rem 2rem; }
    .showreel-content-wrapper { max-width: 100%; }
}


/* Project Card Image Styling */
.project-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: block;
}

/* WordPress specific styles */
.hidden {
    display: none;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important; /* Many screen reader and browser combinations announce broken words as they would appear visually. */
}