/* Iosevka Slab Font */
@font-face {
    font-family: 'Iosevka Slab';
    src: url('../fonts/IosevkaSlab-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: optional;
}

@font-face {
    font-family: 'Iosevka Slab';
    src: url('../fonts/IosevkaSlab-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: optional;
}

@font-face {
    font-family: 'Iosevka Slab';
    src: url('../fonts/IosevkaSlab-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: optional;
}

@font-face {
    font-family: 'Iosevka Slab';
    src: url('../fonts/IosevkaSlab-BoldItalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: optional;
}

/* Nord Colour Palette */
:root {
    /* Polar Night - dark backgrounds */
    --nord0: #2E3440;
    --nord1: #3B4252;
    --nord2: #434C5E;
    --nord3: #4C566A;

    /* Snow Storm - light backgrounds/text */
    --nord4: #D8DEE9;
    --nord5: #E5E9F0;
    --nord6: #ECEFF4;

    /* Frost - accent blues */
    --nord7: #8FBCBB;
    --nord8: #88C0D0;
    --nord9: #81A1C1;
    --nord10: #5E81AC;

    /* Aurora - highlights */
    --nord11: #BF616A;
    --nord12: #D08770;
    --nord13: #EBCB8B;
    --nord14: #A3BE8C;
    --nord15: #B48EAD;
}

/* Dark theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: var(--nord0);
    --bg-secondary: var(--nord1);
    --bg-tertiary: var(--nord2);
    --border-color: var(--nord3);
    --text-primary: var(--nord4);
    --text-heading: var(--nord6);
    --text-muted: var(--nord3);
    --text-venue: var(--nord4);
    --link-color: var(--nord8);
    --link-hover: var(--nord7);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: var(--nord6);
    --bg-secondary: var(--nord5);
    --bg-tertiary: var(--nord4);
    --border-color: var(--nord4);
    --text-primary: var(--nord1);
    --text-heading: var(--nord0);
    --text-muted: var(--nord3);
    --text-venue: var(--nord2);
    --link-color: var(--nord10);
    --link-hover: var(--nord9);
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Iosevka Slab', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.3s, color 0.3s;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Header and Navigation */
.header-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.site-title-group {
    flex: 1;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-heading);
}

.site-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Theme toggle button - base styles */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--link-color);
    color: var(--link-color);
}

.theme-icon {
    display: inline-block;
    width: 1.25em;
    text-align: center;
}

/* Header toggle - invisible placeholder for layout */
#theme-toggle {
    visibility: hidden;
}

/* Floating toggle - position calculated by JavaScript */
#theme-toggle-sticky {
    position: fixed;
    z-index: 200;
    visibility: visible;
}

/* Sticky navigation bar */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    margin: 0 -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
    margin-bottom: 1.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 0;
}

nav a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Main content */
main {
    min-height: 60vh;
}

h1, h2, h3 {
    color: var(--text-heading);
    font-weight: 600;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Profile section */
.profile {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.profile-image-container {
    display: flex;
    flex-direction: column;
}

.profile-image {
    width: 180px;
    height: auto;
    border: 2px solid var(--border-color);
}

.profile-icons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.profile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.profile-icon:hover {
    color: var(--link-color);
}

.profile-icon svg {
    width: 20px;
    height: 20px;
}

.profile-image-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 4px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.profile-content {
    flex: 1;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Research fields */
.fields {
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Links section */
.links-list {
    list-style: none;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem 2rem;
}

.links-list li {
    margin-bottom: 0;
}

.links-list li::before {
    content: "→ ";
    color: var(--text-muted);
}

/* Publications */
.publication {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.publication:last-child {
    border-bottom: none;
}

.publication-title {
    color: var(--text-heading);
    font-weight: 600;
}

.publication-authors {
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.publication-venue {
    color: var(--text-venue);
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Grants */
.grant {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.grant:last-child {
    border-bottom: none;
}

.grant-title {
    color: var(--text-heading);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.grant-funder {
    color: var(--text-venue);
    font-size: 0.875rem;
    font-style: italic;
    margin-bottom: 0.25rem;
}

.grant-details {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Comment entries */
.comment-entry {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.comment-entry:last-child {
    border-bottom: none;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Code/Repositories */
.repo {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

.repo-name {
    color: var(--link-color);
    font-weight: 600;
}

.repo-description {
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.repo-language {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.footer-icon:hover {
    color: var(--link-color);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

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

    nav ul {
        justify-content: center;
        gap: 1rem;
    }

    .sticky-nav {
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .site-title {
        font-size: 1.25rem;
    }
}
