:root {
    --calico-white: #ffffff;
    --calico-cream: #f7f5f2;
    --calico-orange: #e09e4a;
    --calico-dark-orange: #c7863d;
    --calico-black: #181818;
    --calico-darker-black: #111111;
    --calico-accent-blue: #2366a2;
    --calico-light-grey: #e0e0e0;
    --body-animation-duration: 10s;
    --body-animation-direction: normal;
    --header-animation-duration: 10s;
    --header-animation-direction: reverse;
}

html.darkmode-preload body,
body.darkmode {
    /* background-image handled by a persistent background layer (#bg-global) to avoid resets on PJAX swaps */
    background-color: #181818 !important;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #181818;
    scroll-behavior: smooth;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* body background image replaced by a persistent background layer (#bg-global) */
    background-image: none !important;
    position: relative;
    z-index: 0;
    transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1), background-color 0.3s ease, color 0.3s ease;
    opacity: 1;
}

body:not(.js-ready) {
    opacity: 0;
}

body.fade-out {
    opacity: 0;
    pointer-events: none;
}

body.fade-init {
    opacity: 0;
}

@keyframes diagonalScroll {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

h1, h2, h3 {
    color: #111111;
    margin-bottom: 1rem;
}

h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem;
    margin-top: 0.5rem;
}

h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--calico-light-grey);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: #174e87;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #c7863d;
    text-decoration: underline;
}

/* Accessible focus styles */
a:focus, button:focus {
    outline: 3px solid #e09e4a;
    outline-offset: 2px;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.button {
    display: inline-block;
    background-color: var(--calico-orange);
    color: #181818;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 1rem;
    font-weight: bold;
}

.button:hover {
    background-color: var(--calico-dark-orange);
    transform: translateY(-2px);
    text-decoration: none;
}

header {
    background-color: transparent;
    color: var(--calico-cream);
    padding: 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.header-content {
    max-width: 900px;
    margin: 20px auto 0;
    padding: 20px;
    /* header background image handled by persistent header layer (#bg-header) */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    overflow: hidden;
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes diagonalScrollReverse {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: -100% -100%;
    }
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--calico-cream);
    margin-bottom: 1.5rem;
    display: block;
}

.header-text-box {
    background-color: rgba(238, 235, 232, 0.8);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 2rem;
    max-width: 600px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    color: #181818;
}

.tagline {
    font-size: 1.3rem;
    color: #e09e4a;
    margin-bottom: 0;
    margin-top: 0.5rem;
}

nav {
    position: relative;
    z-index: 6;
    margin-top: 0;
    padding-top: 1rem;
    padding-bottom: 1rem;
    width: 100%;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

nav ul li a {
    color: var(--calico-cream);
    font-weight: bold;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    background-color: rgba(112, 146, 156, 0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: inline-block;
}

nav ul li a:hover {
    background-color: rgba(42, 37, 34, 0.9);
    color: var(--calico-white);
    transform: translateY(-2px);
    text-decoration: none;
}

.nav-link-animated {
    display: inline-block;
}

@keyframes pulseEffect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
        color: var(--calico-white);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.is-animating {
    animation: pulseEffect 0.3s ease-out;
}

main {
    max-width: 900px;
    margin: 2.5rem auto;
    padding: 20px;
    background-color: rgba(245, 245, 245, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    position: relative;
    z-index: 5;
}

section {
    margin-bottom: 3rem;
    padding-top: 1rem;
}

.intro-paragraph {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.8;
    margin-bottom: 2rem;
    color: #181818;
}

blockquote {
    background-color: rgba(238, 235, 232, 0.8);
    border-left: 5px solid var(--calico-orange);
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    font-style: italic;
    color: #181818;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

blockquote p {
    margin: 0;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.skill-category {
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    background-color: rgba(238, 235, 232, 0.8);
}

.skill-category ul {
    list-style: none;
    padding: 0;
}

.skill-category ul li {
    background-color: var(--calico-light-grey);
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #181818;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.project-item {
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: rgba(238, 235, 232, 0.8);
}

.project-item h3 {
    color: var(--calico-accent-blue);
    margin-top: 0;
}

.project-item p {
    flex-grow: 1;
    margin-bottom: 1.5rem;
    color: #181818;
}

.social-links {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.social-links li {
    display: flex;
    align-items: center;
}

.social-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: var(--calico-black);
    font-weight: 500;
}

.social-links li a:hover {
    color: var(--calico-orange);
    text-decoration: none;
}

.social-icon {
    width: 32px;
    height: 32px;
    vertical-align: middle;
}

.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #181818;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid var(--calico-light-grey);
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: rgba(245, 245, 245, 0.8);
    color: #181818;
}

.contact-form textarea {
    resize: vertical;
}

.contact-form button {
    width: auto;
    padding: 12px 30px;
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    background-color: var(--calico-orange);
    color: #181818;
}

.contact-form button:hover {
    background-color: var(--calico-dark-orange);
    color: #fff;
}

.form-note {
    font-size: 0.9rem;
    color: #181818;
    margin-top: 1rem;
    text-align: center;
}

footer {
    text-align: center;
    padding: 1.5rem 0;
    background-color: #e0e0e0;
    color: #181818;
    font-size: 0.9rem;
    margin-top: 3rem;
}

.page-content {
    padding: 20px;
}

.essay-article {
    background-color: rgba(238, 235, 232, 0.8);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 2.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.essay-article h3 {
    color: #111111;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--calico-light-grey);
    padding-bottom: 0.5rem;
}

.essay-article p {
    margin-bottom: 1rem;
    color: #181818;
}

.essay-article .read-more-link {
    display: inline-block;
    margin-top: 1rem;
    font-weight: bold;
}

.pc-build-item {
    background-color: rgba(238, 235, 232, 0.8);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 2.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pc-build-item img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 2px solid var(--calico-light-grey);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pc-build-item h3 {
    color: #111111;
    margin-top: 0;
    margin-bottom: 1rem;
}

.pc-build-item ul {
    list-style: none;
    padding: 0;
    text-align: left;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.pc-build-item ul li {
    background-color: var(--calico-light-grey);
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #181818;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #181818;
    background-color: rgba(238, 235, 232, 0.8);
    border-radius: 8px;
    overflow: hidden;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--calico-light-grey);
}

table th {
    background-color: var(--calico-orange);
    color: #181818;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tbody tr:nth-child(odd) {
    background-color: rgba(238, 235, 232, 0.7);
}

table tbody tr:nth-child(even) {
    background-color: rgba(238, 235, 232, 0.9);
}

table tbody tr:hover {
    background-color: var(--calico-dark-orange);
    color: #fff;
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.7rem; }
    .tagline { font-size: 1.1rem; }
    nav ul { flex-direction: column; gap: 10px; margin-top: 1rem; }
    nav ul li a { padding: 0.8rem 1.5rem; display: block; }
    main { margin: 1.5rem auto; padding: 15px; }
    .skills-grid, .project-grid { grid-template-columns: 1fr; }
    .social-links { flex-direction: column; gap: 15px; }
    .contact-form input[type="text"],
    .contact-form input[type="email"],
    .contact-form textarea { width: 100%; }

    .page-content {
        padding: 15px;
    }

    .essay-article, .pc-build-item {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .tagline { font-size: 1rem; }
    .profile-pic { width: 120px; height: 120px; }
    main { margin: 1rem auto; padding: 10px; }
    header { padding: 1rem 0; }
    .button { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
}

/* DARK MODE THEME */
body.darkmode {
    --calico-white: #232323;
    --calico-cream: #2c2c2c;
    --calico-orange: #e09e4a;
    --calico-dark-orange: #c7863d;
    --calico-black: #ffffff;
    --calico-darker-black: #ffffff;
    --calico-accent-blue: #7ec3e6;
    --calico-light-grey: #444;
    background-color: #181818;
    color: #fff;
    /* dark background image moved to #bg-global */
}

body.darkmode header {
    color: #fff;
    background-color: transparent;
}

body.darkmode .header-content {
    background-color: rgba(44, 44, 44, 0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    color: #fff;
    /* header background image moved to #bg-header */
}

body.darkmode .header-text-box {
    background-color: rgba(44, 44, 44, 0.96);
    color: #fff;
}

body.darkmode main {
    background-color: rgba(35, 35, 35, 0.98);
    color: #fff;
}

body.darkmode h1, 
body.darkmode h2, 
body.darkmode h3 {
    color: #fff;
}

body.darkmode .tagline {
    color: #ffe082;
}

body.darkmode a {
    color: #7ec3e6;
}

body.darkmode a:hover {
    color: #e09e4a;
}

body.darkmode .button {
    background-color: var(--calico-orange);
    color: #181818;
}

body.darkmode .button:hover {
    background-color: var(--calico-dark-orange);
    color: #fff;
}

body.darkmode nav ul li a {
    background-color: rgba(126, 195, 230, 0.18);
    color: #fff;
}

body.darkmode nav ul li a:hover {
    background-color: rgba(112, 146, 156, 0.4);
    color: #ffe082;
}

body.darkmode .skills-grid,
body.darkmode .project-grid,
body.darkmode .skill-category,
body.darkmode .project-item,
body.darkmode .essay-article,
body.darkmode .pc-build-item {
    background-color: rgba(44, 44, 44, 0.98);
    color: #fff;
}

body.darkmode .skill-category ul li,
body.darkmode .pc-build-item ul li,
body.darkmode table th,
body.darkmode table td {
    background-color: #232323;
    color: #fff;
}

body.darkmode blockquote {
    background-color: rgba(44, 44, 44, 0.96);
    border-left: 5px solid var(--calico-orange);
    color: #fff;
}

body.darkmode table {
    background-color: rgba(44, 44, 44, 0.98);
    color: #fff;
}

body.darkmode table th {
    background-color: var(--calico-orange);
    color: #181818;
}

body.darkmode table tbody tr:nth-child(odd) {
    background-color: rgba(44, 44, 44, 0.93);
}

body.darkmode table tbody tr:nth-child(even) {
    background-color: rgba(44, 44, 44, 0.99);
}

body.darkmode table tbody tr:hover {
    background-color: var(--calico-dark-orange);
    color: #fff;
}

body.darkmode footer {
    background-color: #181818;
    color: #fff;
}

body.darkmode .form-note {
    color: #ffe082;
}

body.darkmode .contact-form input[type="text"],
body.darkmode .contact-form input[type="email"],
body.darkmode .contact-form textarea {
    background-color: #232323;
    color: #fff;
    border: 1px solid #444;
}

body.darkmode .contact-form label {
    color: #fff;
}

body.darkmode .social-links li a {
    color: #fff;
}

body.darkmode .social-links li a:hover {
    color: #e09e4a;
}

body.darkmode .project-item p,
body.darkmode .essay-article p,
body.darkmode .pc-build-item p,
body.darkmode .page-content,
body.darkmode section,
body.darkmode .intro-paragraph {
    color: #fff;
}

.theme-toggle {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 100;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 2px solid #e09e4a;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border 0.2s, transform 0.35s cubic-bezier(.2,.9,.2,1);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body.darkmode .theme-toggle {
    background: #232323;
    border: 2px solid #ffe082;
}

.theme-toggle:focus {
    outline: 2px solid #e09e4a;
}

body.darkmode .theme-toggle:focus {
    outline: 2px solid #ffe082;
}

.theme-toggle .icon {
    width: 28px;
    height: 28px;
    display: block;
    transition: transform 0.45s cubic-bezier(.2,.9,.2,1), color 0.3s, opacity 0.25s;
    color: #e09e4a;
    filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 1px #e09e4a);
}

body.darkmode .theme-toggle .icon {
    color: #ffe082;
    filter: drop-shadow(0 0 2px #232323) drop-shadow(0 0 1px #ffe082);
}

.theme-toggle .icon.sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    transition: opacity 0.25s, transform 0.45s cubic-bezier(.2,.9,.2,1);
}

.theme-toggle .icon.moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
    transition: opacity 0.25s, transform 0.45s cubic-bezier(.2,.9,.2,1);
}

body.darkmode .theme-toggle .icon.sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

body.darkmode .theme-toggle .icon.moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* small animated press/rotate for the toggle */
.theme-toggle.is-toggling {
    transform: rotate(18deg) scale(1.05);
    transition: transform 0.28s cubic-bezier(.2,.9,.2,1);
}

.theme-toggle.is-toggling-strong {
    transform: rotate(28deg) scale(1.12);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    transition: transform 0.32s cubic-bezier(.2,.9,.2,1), box-shadow 0.32s;
}

/* overlay used to mask background-image swap */
.theme-switch-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.28s ease, background-color 0.28s ease, clip-path 0.36s cubic-bezier(.2,.9,.2,1);
    /* clip-path uses CSS variables set by script to center on toggle */
    --clip-x: 50vw;
    --clip-y: 50vh;
    clip-path: circle(0px at var(--clip-x) var(--clip-y));
}
.theme-switch-overlay[data-mode="dark"] {
    background-color: rgba(24,24,24,0.98);
}
.theme-switch-overlay[data-mode="light"] {
    background-color: rgba(255,255,255,0.99);
}
.theme-switch-overlay.reveal {
    opacity: 1;
    clip-path: circle(150vmax at var(--clip-x) var(--clip-y));
}

/* make the background-image transitions smoother when body class toggles */
body, body.darkmode {
    transition: background-image 0.35s ease-in-out, background-color 0.35s ease-in-out, color 0.3s ease;
}

/* PJAX overlay used during content swaps to mask background and reduce perceived jank */
.pjax-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.0);
    z-index: 9998;
    pointer-events: none;
    transition: background 260ms ease, opacity 260ms ease;
}
.pjax-overlay.active {
    background: rgba(0,0,0,0.06);
    opacity: 1;
}

/* Smooth main area transitions */
main {
    will-change: opacity, transform;
    transition: opacity 320ms ease, transform 320ms cubic-bezier(.2,.9,.2,1);
}

/* class-driven enter/exit for smoother control */
.main-enter {
    opacity: 0;
    transform: translateY(12px);
}

.main-exit {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
}

/* Blog page basics */
.blog-container {
    max-width: 900px;
    margin: 2.5rem auto;
    padding: 24px;
}
.blog-list {
    display: grid;
    gap: 20px;
}
.blog-list .blog-card {
    will-change: transform, opacity;
}
.blog-card {
    padding: 18px;
    border-radius: 12px;
    background-color: rgba(245,245,245,0.92);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.blog-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
.blog-card h3 { margin-top: 0; }
.blog-meta { color: #666; font-size: 0.9rem; margin-bottom: 8px; }
.blog-excerpt { color: #333; }

body.darkmode .blog-card {
    background-color: rgba(40,40,40,0.98);
    color: #fff;
}

.blog-tags {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tag {
    background: rgba(224,158,74,0.12);
    border: 1px solid rgba(224,158,74,0.2);
    color: #c36b1a;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
}
.tag:hover { transform: translateY(-2px); }

.tag-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 8px 0 18px 0;
    flex-wrap: wrap;
}
.tag-bar-label { color: #444; font-weight: 600; margin-right: 8px; }
.tag-bar-item, .tag-clear {
    background: transparent;
    border: 1px solid rgba(34,34,34,0.08);
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.tag-bar-item.active, .tag-bar-item:hover { background: #e09e4a; color: #111; border-color: #e09e4a; }
.tag-clear { color: #666; }

body.darkmode .tag { background: rgba(255,224,130,0.08); border-color: rgba(255,224,130,0.12); color: #ffe082; }
body.darkmode .tag-bar-item.active, body.darkmode .tag-bar-item:hover { background: #ffe082; color: #111; }

.theme-toggle:hover {
    background: #ffe082;
    border-color: #e09e4a;
}

body.darkmode .theme-toggle:hover {
    background: #e09e4a;
    border-color: #ffe082;
}

body.wingdings-mode, 
body.wingdings-mode * {
    font-family: 'Wingdings', 'Wingdings 2', 'Wingdings 3', 'Symbola', 'Segoe UI Symbol', 'Arial Unicode MS', cursive !important;
}

body.wingdings-mode, 
body.wingdings-mode * {
    font-family: 'Wingdings', 'Wingdings 2', 'Wingdings 3', 'Symbola', 'Segoe UI Symbol', 'Arial Unicode MS', cursive !important;
}

/* Persistent background layers to avoid resetting animations/positions on PJAX swaps */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -9999;
    background-repeat: repeat;
    background-size: auto;
    background-attachment: fixed;
    pointer-events: none;
    transition: background-image 0.45s ease-in-out, opacity 0.35s ease;
}



.bg-header {
    /* header background is visually only under the header area; we'll size it via JS to exactly match the header */
    inset: auto; /* override .bg-layer inset:0 */
    left: 0;
    top: 0;
    width: 100%;
    height: 220px; /* fallback height; JS will correct on init/resize */
    z-index: -9998;
    overflow: hidden;
    border-radius: 20px; /* fallback radius matching .header-content */
}

/* mode-specific backgrounds use classes so JS toggles class instead of mutating animation properties */
.bg-global.light {
    background-image: url('/media/images/calico-pattern.png');
}
.bg-global.dark {
    background-image: url('/media/images/darkmode_calico-pattern.jpg');
}
.bg-header.light {
    background-image: url('/media/images/calico2.png');
}
.bg-header.dark {
    background-image: url('/media/images/darkmode_calico2.jpg');
}

/* ensure body and header-content are transparent so layers show through */
header, .header-content {
    background: transparent !important;
}

/* keep animations on the element via CSS so toggling images doesn't overwrite animations */
.bg-global {
    animation: diagonalScroll var(--body-animation-duration) linear infinite var(--body-animation-direction);
}
.bg-header {
    animation: diagonalScrollReverse var(--header-animation-duration) linear infinite var(--header-animation-direction);
}
