@font-face {
    font-family: 'Fizz';
    src: url('../fonts/FizzVF-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Fizz Italic';
    src: url('../fonts/FizzVF-Italic.woff2') format('woff2');
}

:root {
    /* Light theme (default) */
    --bg-colour: white;
    --text-colour: black;
    --nav-colour: #999;
    --button-hover: #f5f5f5;
    --accent-colour: #d90b5d;
    --footer-background: rgba(255, 255, 255, 0.3);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-colour: #1a1a1a;
    --text-colour: white;
    --nav-colour: #d0d0d0;
    --button-hover: #3d3d3d;
    --accent-colour: #d90b5d;
    --footer-background: rgba(0, 0, 0, 0.2);
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    margin-left: 5%;
    margin-right: 5%;
    padding: 0;
    transition: all 0.1s ease-in-out;
}

body {
    /*background-image: url('../img/bg_main.png');*/
    background-size: cover;
    background-repeat: repeat;
    background-attachment: fixed;
    background-position: center;
    background-color: var(--bg-colour);
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-family: 'Fizz', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, ul, h1, h2, h3, h4, h5, h6 {
    font-family: 'Fizz';
    overflow-wrap: break-word;
    color: var(--text-colour);
}

/* Typography */
p, ul {
    font-weight: normal;
    font-variation-settings: 'wght' 500;
    font-size: 22px;
    line-height: 1.4;
    margin-bottom: 1em;
}

h1 {
    font-family: 'Fizz Italic';
    font-weight: normal;
    font-variation-settings: 'wght' 500;
    font-size: 42px;
    line-height: 1;
}

h2 {
    font-weight: normal;
    font-variant: small-caps;
    font-size: 22px;
}

h3 {
    font-size: 28px;
}

i {
    font-family: 'Fizz Italic';
    font-style: normal;
}

ul {
    list-style-type: disc;
    padding-left: 1em;
}

/* Links */
a {
    transition: all 0.1s ease-in-out;
    color: var(--text-colour);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 0.1em;
    text-decoration-color: var(--accent-colour);
}

p a:hover {
    font-synthesis: none;
    font-variation-settings: 'wght' 700;
    transition: all 0.1s ease-in-out;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-colour);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: opacity 0.3s ease-in-out;
}

header.faded {
    opacity: 0;
    pointer-events: none;
}

#nav {
    width: 100%;
    overflow-x: hidden;
    transition: 0.5s;
    padding: 2rem;
}

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

.topnav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--nav-colour);
    font-size: 22px;
    font-variant: small-caps;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-variation-settings: 'wght' 500;
}

.nav-link:hover, .topnav a:hover {
    color: var(--accent-colour);
}

.nav-link.active {
    color: var(--text-colour);
    font-variation-settings: 'wght' 700;
}

[data-theme="dark"] #theme-toggle {
    filter: invert(1);
}

/* Spacers */
#spacer {
    height: 80px;
}

.spacer {
    height: 50%;
}

/* Main Content */
main {
    max-width: 600px;
    margin: 0 auto;
}

#content {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding-top: 100px;
    padding-bottom: 20px;
}

#content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Services List */
#services-list {
    margin: 1rem 0 2rem 1.5rem;
}

#services-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Gallery and Projects */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 135px);
    gap: 20px;
    justify-content: center;
}

.gallery-img {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    width: 135px;
    height: 135px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gallery-img:hover {
    transform: scale(1.05);
}

.gallery-img:hover .overlay {
    opacity: 1;
}

.gallery-img:hover .clientimg {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.clientimg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-colour);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-colour);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.overlaytext {
    font-family: 'Fizz Italic';
    font-variant: normal;
    font-variation-settings: 'wght' 500;
    color: var(--text-colour);
    font-size: 20px;
    text-align: center;
    padding: 0.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Projects */
/* Projects page layout */
.projects-layout {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    padding-top: 100px;
    margin: 0 auto;
}

/* Table of Contents (Left Sidebar) */
.projects-toc {
    position: fixed;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    padding: 1.5rem;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 100;
}

.toc-list {
    display: flex;
    flex-direction: column;
    color: var(--text-colour);
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 0.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.toc-item:hover {
    color: var(--accent-colour);
}

.toc-item.active {
    font-variation-settings: 'wght' 700;
    font-size: 20px;
}

.toc-item:hover, .toc-item.active {
    filter: grayscale(0%);
}

.toc-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Client Sections */
.client-section {
    scroll-margin-top: 2rem;
}

.client-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--accent);
    filter: grayscale(100%);
    transition: all 0.2s ease;
}

.client-header:hover {
    filter: grayscale(0%);
}

.client-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.client-name {
    margin: 0;
}

a.client-name-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;

}

a.client-name-link:hover {
    font-variation-settings: 'wght' 700;
    transition: all 0.2s ease;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.projects-grid a {
    text-decoration: none;
}

.project-card {
    background: var(--background-colour);
    backdrop-filter: blur(10px);
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .project-card {
    background: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

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

.project-title {
    font-size: 24px;
    margin: 0 0 1rem 0;
}

.project-description {
    font-size: 18px;
    line-height: 1.6;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1080px) {
    .projects-toc {
        display: none;
    }

    .projects-content {
        margin-left: 0;
    }

    .projects-layout {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-title {
        font-size: 20px;
    }

    .project-description {
        font-size: 16px;
    }
}

/* Custom scrollbar for TOC */
.projects-toc::-webkit-scrollbar {
    width: 6px;
}

.projects-toc::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.projects-toc::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.projects-toc::-webkit-scrollbar-thumb:hover {
    background: rgba(217, 11, 93, 0.8);
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(217, 11, 93, 0.2);
    font-size: 14px;
}

[data-theme="dark"] .project-meta {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.project-year {
    color: var(--text-colour);
    font-weight: bold;
}

.project-type {
    background: rgba(217, 11, 93, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-colour);
}

.project-type-chip {
    font-variation-settings: 'wght' 500;
    display: inline-flex;
    padding: 8px;
    margin: 4px;
    background-color: rgba(217, 11, 93, 0.8);
    border-radius: 6px;
    color: white;
}

[data-theme="dark"] .project-type {
    background: rgba(217, 11, 93, 0.2);
}

/* Download Section */
#download-container {
    background-color: var(--text-colour);
    font-family: 'Fizz';
    font-size: 22px;
    color: white;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
    padding: 40px;
}

#download-button {
    font-variation-settings: 'wght' 500;
    border: 2px solid var(--accent-colour);
    color: var(--bg-colour);
    padding: 10px 20px;
    text-decoration: none;
    margin-top: 20px;
    font-size: 22px;
    transition: all 0.2s ease-in-out;
}

#download-button:hover {
    color: white;
    background-color: var(--accent-colour);
}

#file-name {
    color: var(--bg-colour);
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 30px;
}

#error-message {
    font-variation-settings: 'wght' 500;
    color: var(--accent-colour);
    margin-top: 15px;
}

/* Icons and Social */
.fa {
    padding-right: 12px;
    color: var(--text-colour);
}

.fa:hover {
    color: var(--accent-colour);
    opacity: 0.7;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.social-links a {
    color: var(--text-colour);
    font-size: 20px;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--accent-colour);
}

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

/* Utilities */
br {
    display: block;
    content: '';
    margin: 0.7em;
    line-height: 1.6;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Email obfuscation */
.email-protected::after {
    content: "@gmail.com";
}

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

    .topnav {
        gap: 0rem;
    }

    #spacer {
        height: 120px;
    }

    #content {
        padding-top: 10px;
        padding-bottom: 10px
    }

    .project-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    footer {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        backdrop-filter: blur(2px);
        border-radius: 50px;
        padding: 10px 15px;
        background-color: var(--footer-background);
    }

    main {
        padding: 0 1rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 20px;
    }

}
