body, html {
  margin: 0;
  padding: 0;
}
body {
  font-family: sans-serif;
}

:root {
  --article-width: 50rem;
  --global-nav-height: 48px;
  --twisty-size: 1.1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #f2f2f2;
    --nav-top-bg: #242424;
    --widget-bg: #242424;
    --widget-border: #3a3a3a;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-color: white;
    --text-color: black;
    --nav-top-bg: #f2f2f2;
    --widget-bg: #f2f2f2;
    --widget-border: #ddd;
  }
}

body {
  background: var(--bg-color);
  color: var(--text-color);
}

/* Inactive/broken links */
a.inactive {
  filter: brightness(0.5);
  cursor: not-allowed;
  text-decoration: line-through;
}

h1 {
  max-width: var(--article-width);
  overflow: hidden ;
  text-overflow: ellipsis;
}

nav#nav-global {
  background-color: var(--nav-top-bg);
  height: var(--global-nav-height);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  display: grid;
  grid-template-columns: 1fr var(--article-width) 1fr;
  align-items: center;
  padding: 0 8px;
  box-sizing: border-box;
  z-index: 1001;

  button.menu-button {
    color: var(--text-color);
    font-size: calc(var(--global-nav-height) / 2);
    line-height: 1;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
  }
  button.menu-button:hover {
    opacity: 0.7;
  }

  /* Left controls: menu button + left-side widgets */
  .nav-left-controls {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 0;
  }

  /* Center container for search and top menu */
  .nav-center {
    width: calc(var(--article-width) + 38px);
    justify-self: center;
    position: relative;
  }

  .search-wrapper {
    position: relative;
    width: 100%;
  }
  
  input#global-search {
    width: 100%;
    height: calc(var(--global-nav-height) - 16px);
    border-radius: 5px;
    background: rgba(0,0,0,0.25);
    color: var(--text-color);
    border-width: 0px;
    padding: 0 2.5rem 0 1rem;
    box-sizing: border-box;
  }
  
  .search-clear-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
  }
  
  .search-clear-button:hover {
    opacity: 1;
  }
  
  .search-clear-button.hidden {
    display: none;
  }
}

/* ==========================================
   WIDGET SYSTEM STYLES
   Nav widgets (TOC, Search, Profile, Recent Activity)
   ========================================== */

/* Widget bar in the nav right column */
nav#nav-global .nav-right-controls {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0;
}

.widget-bar {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Ursa update indicator (loading spinner in nav bar) */
.ursa-update-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--global-nav-height);
  height: var(--global-nav-height);
  opacity: 0.7;
}
.ursa-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(128, 128, 128, 0.3);
  border-top-color: rgba(128, 128, 128, 0.8);
  border-radius: 50%;
  animation: ursa-spin 0.8s linear infinite;
}
.ursa-update-gray .ursa-spinner {
  border-color: rgba(128, 128, 128, 0.3);
  border-top-color: rgba(128, 128, 128, 0.8);
}
.ursa-update-green .ursa-spinner {
  border-color: rgba(76, 175, 80, 0.3);
  border-top-color: rgba(76, 175, 80, 0.9);
}
@keyframes ursa-spin {
  to { transform: rotate(360deg); }
}

.widget-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.1rem;
  width: var(--global-nav-height);
  height: var(--global-nav-height);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.widget-button:hover {
  opacity: 1;
  background-color: rgba(128, 128, 128, 0.15);
}

.widget-button.active {
  opacity: 1;
  background-color: var(--widget-bg);
}

.widget-icon {
  pointer-events: none;
}

/* Widget dropdown panel (right-side, default) */
.widget-dropdown {
  position: fixed;
  top: var(--global-nav-height);
  right: 0;
  width: min(420px, 100vw);
  max-height: calc(100vh - var(--global-nav-height));
  overflow-y: auto;
  background: var(--widget-bg);
  border-left: 1px solid var(--widget-border);
  border-bottom: 1px solid var(--widget-border);
  box-shadow: -2px 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  transition: opacity 0.15s ease;
}

/* Widget dropdown panel (left-side) */
.widget-dropdown.widget-dropdown-left {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--widget-border);
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.2);
}

.widget-dropdown.hidden {
  display: none;
}

/* Widget header with title and close button */
.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--widget-border);
}

.widget-header-title {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.widget-close-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.5;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 3px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.widget-close-btn:hover {
  opacity: 1;
  background-color: rgba(128, 128, 128, 0.2);
}

/* Widget content panels — only the active one is visible */
.widget-content {
  display: none;
}

.widget-content.active {
  display: block;
}

/* --- TOC Widget --- */
#widget-content-toc {
  padding: 0.5rem 0;

  ul {
    list-style: none;
    margin: 0;
    padding: 0;

    li {
      margin-bottom: 0.15rem;
      padding: 0;

      > a {
        text-decoration: none;
        color: var(--text-color);
        opacity: 0.75;
        display: block;
        padding: 0.3rem 1rem;
        border-left: 2px solid transparent;
        transition: all 0.2s ease;
        font-size: 0.9rem;
      }

      > a:hover {
        opacity: 1;
        border-left-color: var(--text-color);
        background-color: rgba(128, 128, 128, 0.1);
      }

      > a.active {
        opacity: 1;
        border-left-color: aqua;
        background-color: rgba(0, 255, 255, 0.1);
      }

      /* Indent nested headings */
      &.toc-h1 > a {
        padding-left: 1rem;
        font-weight: 600;
      }
      
      &.toc-h2 > a {
        padding-left: 1.5rem;
        font-size: 0.85rem;
      }
      
      &.toc-h3 > a {
        padding-left: 2rem;
        font-size: 0.8rem;
      }
    }
  }
}

/* --- Search Widget --- */
.widget-search-wrapper {
  padding: 0.5rem;
}

.widget-search-input {
  width: 100%;
  height: 40px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-color);
  border: 1px solid var(--widget-border);
  padding: 0 1rem;
  box-sizing: border-box;
  font-size: 1rem;
}

.widget-search-input:focus {
  outline: none;
  border-color: aqua;
  box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.widget-search-results {
  max-height: calc(100vh - var(--global-nav-height) - 80px);
  overflow-y: auto;
}

.widget-search-results .search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--widget-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.widget-search-results .search-result-item:last-child {
  border-bottom: none;
}

.widget-search-results .search-result-item:hover,
.widget-search-results .search-result-item.selected {
  background-color: rgba(128, 128, 128, 0.15);
}

.widget-search-results .search-result-title {
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-color);
  font-size: 0.9rem;
}

.widget-search-results .search-result-path {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.6;
}

.widget-search-results .search-result-message {
  padding: 12px;
  text-align: center;
  color: var(--text-color);
  opacity: 0.6;
  font-style: italic;
  font-size: 0.85rem;
}

.widget-search-results .search-section-header {
  padding: 6px 12px;
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-color);
  opacity: 0.5;
  background-color: rgba(128, 128, 128, 0.1);
  border-bottom: 1px solid var(--widget-border);
}

/* --- Profile Widget --- */
.widget-profile-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-color);
  opacity: 0.7;
}

.widget-profile-avatar {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.widget-profile-placeholder p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.widget-profile-signin {
  margin-top: 0.5rem;
  padding: 8px 24px;
  background: var(--nav-top-bg);
  border: 1px solid var(--widget-border);
  color: var(--text-color);
  border-radius: 4px;
  cursor: not-allowed;
  opacity: 0.5;
}

.widget-profile-note {
  font-size: 0.75rem;
  opacity: 0.5;
  font-style: italic;
}

/* --- Recent Activity Widget --- */
.recent-activity-list {
  padding: 0;
}

.recent-activity-loading,
.recent-activity-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-color);
  opacity: 0.6;
  font-style: italic;
  font-size: 0.85rem;
}

.recent-activity-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-activity-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--widget-border);
  transition: background-color 0.15s ease;
}

.recent-activity-item:last-child {
  border-bottom: none;
}

.recent-activity-item:hover {
  background-color: rgba(128, 128, 128, 0.1);
}

.recent-activity-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-activity-link:hover {
  text-decoration: underline;
}

.recent-activity-time {
  font-size: 0.75rem;
  color: var(--text-color);
  opacity: 0.5;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search functionality styles */
.search-results {
  position: fixed;
  top: calc(var(--global-nav-height) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--article-width), calc(100vw - 100px));
  background: var(--bg-color);
  border: 1px solid var(--nav-top-bg);
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1002;
}

.search-results.hidden {
  display: none;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--nav-top-bg);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: var(--nav-top-bg);
}

.search-result-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-color);
}

.search-result-path {
  font-size: 0.85em;
  color: var(--text-color);
  opacity: 0.7;
}

.search-result-message {
  padding: 16px;
  text-align: center;
  color: var(--text-color);
  opacity: 0.7;
  font-style: italic;
}

/* Search section styling (for combined path/full-text results) */
.search-section {
  border-bottom: 1px solid var(--nav-top-bg);
}

.search-section:last-child {
  border-bottom: none;
}

.search-section-header {
  padding: 8px 16px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-color);
  opacity: 0.6;
  background-color: color-mix(in srgb, var(--nav-top-bg) 50%, transparent);
  border-bottom: 1px solid var(--nav-top-bg);
}

.search-show-more {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--link-color);
  font-size: 0.85em;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s ease;
}

.search-show-more:hover {
  background-color: var(--nav-top-bg);
  text-decoration: underline;
}

/* ==========================================
   TOP NAVIGATION MENU STYLES
   When body[data-menu-position="top"] is set
   ========================================== */

/* Top menu container - positioning handled by parent .nav-center */
nav#nav-main-top {
  display: none;
  width: 100%;
}

/* Show top menu when position is top */
body[data-menu-position="top"] nav#nav-main-top {
  display: flex;
  align-items: center;
}

/* Hide inline search when top menu is present — widget handles search */
body[data-menu-position="top"] nav#nav-global .search-wrapper-inline {
  display: none;
}

/* Hide side nav when top menu is active */
body[data-menu-position="top"] nav#nav-main {
  display: none;
}

/* Full-width article when side nav is hidden */
body[data-menu-position="top"] article#main-content {
  margin-left: auto;
  margin-right: auto;
}

/* Update nav-global grid to accommodate top menu - keep search+avatar together on right */
body[data-menu-position="top"] nav#nav-global {
  grid-template-columns: 1fr var(--article-width) 1fr;
}

/* Top-level menu list */
nav#nav-main-top .top-menu-level {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

/* Top-level menu items */
nav#nav-main-top .top-menu-item {
  position: relative;
  padding: 0;
  margin: 0;
}

nav#nav-main-top .top-menu-label {
  display: block;
  padding: 0px 16px;
  line-height: var(--global-nav-height);
  color: var(--text-color);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

nav#nav-main-top .top-menu-label:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

nav#nav-main-top a.top-menu-label:hover {
  text-decoration: none;
}

/* Dropdown indicator for items with children */
nav#nav-main-top .top-menu-item.has-dropdown > .top-menu-label::after {
  content: '▼';
  font-size: 0.4em;
  margin-left: 6px;
  opacity: 0.6;
  vertical-align: bottom;
}

/* Use widget-bg for dropdown/flyout backgrounds (shared CSS var) */
nav#nav-main-top .top-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-height: calc(100vh - var(--global-nav-height) - 20px);
  overflow-y: auto;
  background-color: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 1005;
}

/* Show dropdown on hover */
nav#nav-main-top .top-menu-item.has-dropdown:hover > .top-menu-dropdown {
  display: block;
}

/* Dropdown items */
nav#nav-main-top .dropdown-item {
  position: relative;
}

nav#nav-main-top .dropdown-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  color: var(--text-color);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

nav#nav-main-top .dropdown-label:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

nav#nav-main-top a.dropdown-label:hover {
  text-decoration: none;
}

/* Flyout indicator */
nav#nav-main-top .flyout-indicator {
  font-size: 0.7em;
  opacity: 0.6;
  margin-left: 8px;
}

/* Flyout menu (nested children) - uses fixed positioning to avoid clipping by parent overflow */
nav#nav-main-top .top-menu-flyout {
  display: none;
  position: fixed;
  min-width: 200px;
  max-height: calc(100vh - var(--global-nav-height) - 40px);
  overflow-y: auto;
  background-color: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 1006;
  /* JS will set top/left via inline styles */
}

/* Show flyout on hover - JS handles positioning */
nav#nav-main-top .dropdown-item.has-flyout:hover > .top-menu-flyout {
  display: block;
}

nav#nav-main {
  position: fixed;
  top: calc(var(--global-nav-height));
  left: 0;
  width: 260px;
  max-height: calc(100vh - var(--global-nav-height));
  overflow: hidden;
  padding: 0;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

/* Collapsed state for desktop - slide off screen */
nav#nav-main.collapsed {
  transform: translateX(-100%);
}

/* When nav is collapsed, article can use full width */
body:has(nav#nav-main.collapsed) article#main-content {
  margin-left: auto;
  margin-right: auto;
}

nav#nav-main {
  /* Column-based menu styles */
  
  .menu-loading {
    padding: 1rem;
    opacity: 0.6;
    text-align: center;
  }
  
  /* Container that clips the columns */
  .menu-columns-container {
    width: 100%;
    height: calc(100vh - var(--global-nav-height) - 40px);
    overflow: hidden;
    position: relative;
  }
  
  /* Wrapper that holds all columns and transforms for scrolling */
  .menu-columns-wrapper {
    display: flex;
    height: 100%;
    min-height: 0; /* Allow flex children to shrink */
    transition: transform 0.25s ease-out;
  }
  
  /* Individual column */
  .menu-column {
    width: 130px;
    min-width: 130px;
    flex-shrink: 0;
    height: 100%;
    min-height: 0; /* Allow flex child to shrink and enable scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(128, 128, 128, 0.15);
    
    /* Scrollbar styling */
    &::-webkit-scrollbar {
      width: 4px;
    }
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    &::-webkit-scrollbar-thumb {
      background: rgba(128, 128, 128, 0.2);
      border-radius: 2px;
    }
    &::-webkit-scrollbar-thumb:hover {
      background: rgba(128, 128, 128, 0.4);
    }
  }
  
  .menu-column:last-child {
    border-right: none;
  }
  
  /* Column list */
  .menu-column-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
  }
  
  /* Column item */
  .menu-column-item {
    margin: 0;
    padding: 0;
  }
  
  .menu-column-item-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 1px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 4px;
  }
  
  .menu-column-item-row:hover {
    background-color: rgba(128, 128, 128, 0.15);
  }
  
  /* Label styling */
  .menu-column-label {
    flex: 1;
    text-decoration: none;
    color: var(--text-color);
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    line-height: 1.3;
    text-transform: capitalize;
    font-size: 0.8rem;
  }
  
  .menu-column-item-row:hover .menu-column-label {
    opacity: 1;
  }
  
  /* Arrow for folders */
  .menu-column-arrow {
    opacity: 0.4;
    font-size: 12px;
    flex-shrink: 0;
  }
  
  .menu-column-item.has-children .menu-column-item-row:hover .menu-column-arrow {
    opacity: 0.8;
  }
  
  /* Selected item (on path to current doc) */
  .menu-column-item.selected > .menu-column-item-row {
    background-color: rgba(128, 128, 128, 0.2);
  }
  
  .menu-column-item.selected > .menu-column-item-row .menu-column-label {
    font-weight: 500;
    opacity: 1;
  }
  
  /* Current page item */
  .menu-column-item.current-page > .menu-column-item-row {
    background-color: rgba(0, 255, 255, 0.2);
  }
  
  .menu-column-item.current-page > .menu-column-item-row .menu-column-label {
    font-weight: 600;
    opacity: 1;
  }
  
  /* Index file styling - appears at top of menu with subtle emphasis */
  .menu-column-item.is-index > .menu-column-item-row {
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    margin-bottom: 4px;
    padding-bottom: 8px;
  }
  
  .menu-column-item.is-index > .menu-column-item-row .menu-column-label {
    font-weight: 500;
    opacity: 0.95;
  }
  
  /* Scroll buttons */
  .menu-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    color: var(--text-color);
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .menu-scroll-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.6);
  }
  
  .menu-scroll-btn:disabled {
    cursor: default;
  }
  
  .menu-scroll-btn.scroll-left {
    left: 2px;
  }
  
  .menu-scroll-btn.scroll-right {
    right: 2px;
  }
  
  /* Scroll indicator for current doc */
  .menu-scroll-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }
  
  .menu-scroll-indicator .scroll-to-current {
    background: rgba(0, 255, 255, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: var(--text-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
  }
  
  .menu-scroll-indicator .scroll-to-current:hover {
    background: rgba(0, 255, 255, 0.5);
  }
}

article#main-content {
  width: var(--article-width);
  margin: calc(var(--global-nav-height) + 16px) auto 0 auto;

  img {
    max-width: 100%;
  }
}

/* Breadcrumb navigation */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-color);
  opacity: 0.55;
}

.breadcrumb-link {
  color: var(--text-color);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.breadcrumb-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.breadcrumb-sep {
  margin: 0 0.4em;
  opacity: 0.4;
  font-size: 0.85em;
}

.breadcrumb-current {
  font-weight: 500;
}

/* Footer styles */
footer#site-footer {
  width: var(--article-width);
  margin: 3rem auto 2rem auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(128, 128, 128, 0.3);
  text-align: center;
  
  .footer-content {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    opacity: 0.85;
  }
  
  .footer-meta {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-bottom: 0.5rem;
    
    a {
      color: inherit;
    }
  }
  
  .footer-copyright {
    font-size: 0.8rem;
    opacity: 0.6;
  }
}

@media (max-width: 800px) {
  footer#site-footer {
    width: calc(100vw - 2rem);
    margin: 3rem 1rem 2rem 1rem;
  }
}

@media (max-width: 800px) {
  nav#nav-global {
    display: flex;
    
    .search-wrapper {
      flex: 1;
      width: auto;
      max-width: none;
      margin: 0 8px;
    }
    
    input#global-search {
      width: 100%;
    }
  }
  article#main-content {
    width: calc(100vw - 2rem);
    margin: calc(var(--global-nav-height) + 16px) 1rem 0 1rem;
  }
  h1 {
    font-size: 1.5rem;
  }
  
  /* On mobile, hide the top menu and show search inline instead */
  body[data-menu-position="top"] nav#nav-main-top {
    display: none !important;
  }
  body[data-menu-position="top"] nav#nav-global .search-wrapper-inline {
    display: block !important;
  }
  
  /* Hide widget buttons on mobile — they're accessible via the inline search and mobile menu */
  .widget-bar {
    display: none !important;
  }
  
  /* Hide widget dropdown on mobile */
  .widget-dropdown {
    display: none !important;
  }
  
  nav#nav-main {
    display: none !important;
    position: fixed;
    top: var(--global-nav-height);
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--global-nav-height));
    max-width: none;
    background: var(--bg-color);
    z-index: 1000;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    transform: none; /* Reset desktop transform */
  }
  nav#nav-main.active {
    display: block !important;
  }
  nav#nav-main.collapsed {
    display: none !important;
    transform: none;
  }
  
  /* Mobile menu list styles */
  nav#nav-main .mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  nav#nav-main .mobile-menu-item {
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  }
  
  nav#nav-main .mobile-menu-label {
    display: block;
    padding: 14px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
  }
  
  nav#nav-main a.mobile-menu-label:hover {
    background-color: rgba(128, 128, 128, 0.1);
  }
  
  nav#nav-main span.mobile-menu-label {
    opacity: 0.5;
  }
  
  /* Indent deeper levels */
  nav#nav-main .mobile-menu-depth-1 .mobile-menu-label { padding-left: 40px; font-size: 0.95rem; }
  nav#nav-main .mobile-menu-depth-2 .mobile-menu-label { padding-left: 56px; font-size: 0.9rem; }
  nav#nav-main .mobile-menu-depth-3 .mobile-menu-label { padding-left: 72px; font-size: 0.85rem; }
  nav#nav-main .mobile-menu-depth-4 .mobile-menu-label { padding-left: 88px; font-size: 0.85rem; }
  
  /* Current page highlight in mobile menu */
  nav#nav-main .mobile-menu-current .mobile-menu-label {
    font-weight: 600;
    background-color: rgba(0, 255, 255, 0.1);
  }
  
  /* Home item styling */
  nav#nav-main .mobile-menu-home .mobile-menu-label {
    font-weight: 600;
    border-bottom: 2px solid rgba(128, 128, 128, 0.25);
  }

  /* Override desktop indentation for mobile */
  nav#nav-main > ul > li > ul > li > .menu-item-row,
  nav#nav-main > ul > li > ul > li > ul > li > .menu-item-row,
  nav#nav-main > ul > li > ul > li > ul > li > ul > li > .menu-item-row {
    padding-left: 8px;
  }
  html {
    font-size: 18px;
    /* Prevents zoomed out appearance on mobile */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}