@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");

* {
    scroll-behavior: smooth;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

html {
    box-sizing: border-box;
    scroll-padding-top: 4rem; /* Account for fixed header height + buffer */
}

html,
body,
td,
th,
p,
li {
    font-family: Roboto, sans-serif;
    color: #000000;
    font-size: 1rem;
    line-height: 1.5rem;
}

h1,
h2,
h3,
.site-navigation li {
    font-family: "Bebas Neue", sans-serif;
    color: #02679a;
}

h4,
p {
    font-family: Roboto, sans-serif;
}

body {
    margin: 0 auto;
    padding-top: 3.5rem; /* Add space for fixed header */
    line-height: 1.25;
    color: #231f20;
}

body.homepage {
    min-height: calc(100vh - 3.5rem);
}

p {
    text-align: justify;
}

h1 {
    color: #02679a;
    font-weight: 400;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

/* Homepage: override h1 for main title */
.homepage h1 {
    font-size: 5rem;
    width: 6ch;
    margin: 0 auto;
}

h2,
h3,
.site-navigation li {
    font-weight: 400;
}

h4,
li.current-page {
    color: #003747;
    font-weight: 600;
}

h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    margin-left: 2rem;
}

h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    margin-left: 4rem;
}

.container-fluid {
    max-width: 1400px;
    width: calc(100% - 2rem);
    margin-left: auto;
    margin-right: auto;
}

/* Fixed header styles */
header.container-fluid {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    margin: 0;
    width: 100%;
}

header.container-fluid.header-content {
    display: flex;
    align-items: center;
}

.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    display: block;
    height: 48px;
    width: auto;
}

.site-navigation ul {
    display: flex;
    align-items: center;
    gap: 0;
}

.site-navigation li {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    margin-right: 0.5em;
}

li.breadcrumb-item {
    font-family: "Bebas Neue", sans-serif;
    display: inline;
    margin-right: 0.5rem;
}

li.breadcrumb-item::marker {
    content: "";
}

li.breadcrumb-item::after {
    content: ">";
    margin-left: 0.5rem;
}

li.breadcrumb-item:last-child::after {
    content: "";
}

main,
.section-navigation {
    margin: 0 auto;
}

.section-toc-inpage {
    margin-left: 3rem;
}

.toc-h2 {
    margin-left: 0;
}
.toc-h3 {
    margin-left: 2em;
}
.toc-h4 {
    margin-left: 4em;
}

img {
    max-width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

img.center {
    max-width: 50%;
}

img.left {
    max-width: 62%;
    margin-left: 0;
}

img.right {
    max-width: 62%;
    margin-right: 0;
}

img.gallery-item {
    margin-left: 0;
    margin-right: 0;
}

.site-navigation {
    text-decoration: none;
    width: 100%;
}

.site-navigation ul {
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0;
}

.site-navigation li {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    margin-right: 0.5em;
}

.site-navigation li::marker {
    content: none;
}

.site-navigation li::marker {
    content: " | ";
    color: #888;
}

.site-navigation li:first-child::marker {
    content: "";
}

.site-navigation li.search {
    margin-left: auto;
    margin-right: 0;
}

.site-navigation li.search::marker {
    content: "";
}

/* New anchor icon approach */
.heading-with-anchor {
    position: relative;
}

.heading-anchor {
    position: relative;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.anchor-icon {
    font-size: 0.9em;
    margin-right: 0.4em;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.multi-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    width: 100%;
}

img.gallery-item {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    margin-top: auto;
    margin-bottom: auto;
}
img.gallery-item:first-child {
    margin-left: auto;
}

img.gallery-item:last-child {
    margin-right: auto;
}

.image-caption {
    flex-basis: 100%; /* Forces caption to take full width and wrap to new line */
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    font-style: italic;
}

table {
    border-collapse: collapse;
}
table td,
table th {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
}
table tr:first-child th {
    border-top: 0;
}
table tr:last-child td {
    border-bottom: 0;
}
table tr td:first-child,
table tr th:first-child {
    border-left: 0;
}
table tr td:last-child,
table tr th:last-child {
    border-right: 0;
}

/* Centering for allauth sign-in page using only .sign-in-page */
.sign-in-page {
    align-items: center;
    justify-content: center;
}

.sign-in-page > div,
.sign-in-page > nav,
.sign-in-page > form,
.sign-in-page > section,
.sign-in-page > main,
main.sign-in-page {
    align-items: center;
    justify-content: center;
    max-width: 400px;
}

.sign-in-page h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sign-in-page nav {
    margin-left: auto;
    margin-right: auto;
}

.sign-in-page ul {
    width: fit-content;
    padding: 0;
    margin-left: auto;
    margin-right: auto;
    list-style-type: none;
}

.sign-in-page li {
    text-align: center;
    list-style: none;
}

.messages {
    margin-left: auto;
    margin-right: auto;
}

/* Responsive breakpoints */

@media (max-width: 400px) {
    .multi-image-gallery {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 401px) and (max-width: 768px) {
    .multi-image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .multi-image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Show icon on hover when supported */
@media (hover: hover) and (pointer: fine) {
    .heading-with-anchor:hover .anchor-icon {
        opacity: 1;
    }
}

/* Always show icon on devices that can't hover */
@media (hover: none), (pointer: coarse) {
    .anchor-icon {
        opacity: 1;
    }
}

@media (max-width: 996px) {
    .homepage body {
        max-width: 780px;
    }
}
@media (max-width: 767px) {
    .homepage .option {
        flex: 0 0 50%;
    }
}
@media (max-width: 599px) {
    .homepage .main {
        padding: 20px 0;
    }
    .homepage .figure-space {
        max-width: 200px;
    }
    .homepage .footer {
        display: block;
        width: 300px;
        margin: 0 auto;
    }
}
@media (max-width: 360px) {
    .homepage .header-link {
        max-width: 100px;
    }
}
