:root {
    /* Use footer color as base for all backgrounds */
    --bg-base: #616161;
    
    /* Footer - use base color */
    --md-footer-bg-color: var(--bg-base);
    --md-footer-fg-color: rgb(222, 222, 209);
    --md-footer-bg-color--dark: var(--bg-base);
    --md-footer-fg-color--lighter: rgb(222, 222, 209);
    --md-footer-fg-color--light: rgb(222, 222, 209);
    
    /* Typography */
    --mdc-typography-headline6-font-family: 'Averia Serif Libre', serif;
    --mdc-typography-font-family: 'Averia Serif Libre', serif;
    
    /* Text color - rgb(222,222,209) */
    --md-default-fg-color: rgb(222, 222, 209);
    --md-typeset-color: rgb(222, 222, 209);
    
    /* Link color - rgb(222,222,209) normal, black on hover */
    --md-typeset-a-color: rgb(222, 222, 209);
    
    /* Background grey - use base color everywhere */
    --md-default-bg-color: var(--bg-base);
    --md-code-bg-color: #bdbdbd;
    
    /* Header - use base color */
    --md-primary-fg-color: var(--bg-base);
    --md-primary-bg-color: var(--bg-base);
    
    /* Header text color - match body font rgb(222,222,209) */
    --md-primary-fg-color--light: rgb(222, 222, 209);
    --md-primary-fg-color--dark: rgb(222, 222, 209);
}

/* Force all backgrounds to use base color */
[data-md-color-scheme] {
    --md-default-bg-color: var(--bg-base);
}

[data-md-color-primary="grey"] {
    --md-primary-fg-color: var(--bg-base);
    --md-primary-bg-color: var(--bg-base);
}

/* Font classes - moved outside :root */
.averia-serif-libre-light {
    font-family: "Averia Serif Libre", serif;
    font-weight: 300;
    font-style: normal;
}

.averia-serif-libre-regular {
    font-family: "Averia Serif Libre", serif;
    font-weight: 400;
    font-style: normal;
}

.averia-serif-libre-bold {
    font-family: "Averia Serif Libre", serif;
    font-weight: 700;
    font-style: normal;
}

.averia-serif-libre-light-italic {
    font-family: "Averia Serif Libre", serif;
    font-weight: 300;
    font-style: italic;
}

.averia-serif-libre-regular-italic {
    font-family: "Averia Serif Libre", serif;
    font-weight: 400;
    font-style: italic;
}

.averia-serif-libre-bold-italic {
    font-family: "Averia Serif Libre", serif;
    font-weight: 700;
    font-style: italic;
}

/* Header styling - match grey and text color */
.md-header {
    color: rgb(222, 222, 209);
}

.md-header__title {
    color: rgb(222, 222, 209);
}

.md-header__button {
    color: rgb(222, 222, 209);
}

.md-header__topic {
    color: rgb(222, 222, 209);
}

.md-nav__title {
    color: rgb(222, 222, 209);
}

/* Text color for all content - rgb(222,222,209) */
body {
    color: rgb(222, 222, 209);
}

.md-typeset {
    color: rgb(222, 222, 209);
}

.md-typeset p,
.md-typeset li,
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
    color: rgb(222, 222, 209);
}

/* Link styles - rgb(222,222,209) normal, black on hover */
.md-typeset a {
    color: rgb(222, 222, 209);
    transition: color 0.2s ease;
}

.md-typeset a:hover {
    color: rgb(30, 30, 30);
}

.md-nav__link {
    color: rgb(222, 222, 209);
}

.md-nav__link:hover {
    color: rgb(30, 30, 30);
}

/* Active navigation link - black when page is open */
.md-nav__link--active,
.md-nav__link[aria-current="page"],
.md-nav__link[aria-current] {
    color: rgb(30, 30, 30);
    font-weight: 600;
}

/* Active parent navigation items */
.md-nav__item--active > .md-nav__link,
.md-nav__item--active > .md-nav__link--active {
    color: rgb(30, 30, 30);
    font-weight: 600;
}

.md-footer__link {
    color: rgb(222, 222, 209);
}

.md-footer__link:hover {
    color: rgb(30, 30, 30);
}

/* Navigation menu text color */
.md-nav__item {
    color: rgb(222, 222, 209);
}

/* Footer text color */
.md-footer {
    color: rgb(222, 222, 209);
}

.md-footer__inner {
    color: rgb(222, 222, 209);
}

.md-main__inner {
    background-color: var(--bg-base);
}

.md-content {
    background-color: var(--bg-base);
}

/* Sidebar/navigation menu background - matching header grey */
.md-sidebar {
    background-color: var(--bg-base);
}

.md-nav {
    background-color: var(--bg-base);
}

.md-nav__primary {
    background-color: var(--bg-base);
}

/* Footer background - matching header grey */
.md-footer {
    background-color: var(--bg-base);
}

.md-footer__inner {
    background-color: var(--bg-base);
}


.hide-scroll-bar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .hide-scroll-bar::-webkit-scrollbar {
    display: none;
  }

.md-typeset .md-button--primary {
    border-width: 1px;
    border-color: rgb(219, 219, 219);
    border-radius: 4px;
}

.cardContent {
  padding: 16px;
  font-size: 16px;
  color: rgb(32, 32, 32);
}

.md-typeset h2 {
    font-weight: 500;
}

/* Hide h2 headings in about page body but keep them in TOC */
.md-typeset article h2 {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    overflow: hidden;
    position: absolute;
    width: 1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.mdc-typography--body2 {
    font-weight: 300;
    font-size: 14px;
}

/* Hide TOC on homepage and make content full width */
.md-content[data-md-component="content"] article:has(div > pre) ~ .md-sidebar--secondary,
.md-content[data-md-component="content"] article:has(div > pre) + .md-sidebar--secondary {
    display: none;
}

/* Make homepage content full width when TOC is hidden and prevent scroll */
.md-content article:has(div > pre) {
    max-width: 100%;
    margin-right: 0;
    overflow: hidden;
}

/* Ensure ASCII art container fits viewport without scroll */
.md-content article:has(div > pre) > div {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.md-content article:has(div > pre) pre {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 2vh 1vw;
    font-size: clamp(3px, 0.78vw, 7.5px);
    overflow: hidden;
    display: block;
}

/* Ensure all backgrounds match footer color using CSS cascade */
html {
    background-color: var(--bg-base);
}

body {
    background-color: var(--bg-base);
}

.md-container {
    background-color: var(--bg-base);
}

.md-main {
    background-color: var(--bg-base);
}

.md-header {
    background-color: var(--bg-base);
}

.md-sidebar--primary {
    background-color: var(--bg-base);
}

.md-sidebar--secondary {
    background-color: var(--bg-base);
}

/* JotForm styling to match site theme */
.jotform-container {
    background-color: var(--bg-base);
    padding: 2rem;
    border-radius: 4px;
}

/* Style the iframe container */
#JotFormIFrame-253086921950360 {
    background-color: var(--bg-base);
}

