/* =========================================================================
   Genesis RPG Shared Site Chrome (Header, Navigation, Search & Footer)
   Shared single-source-of-truth between Lore Portal and Engine App (/machina/)
   ========================================================================= */

/* Utility Bar Styling */
.site-utility-bar {
  background: #000000 !important;
  background-color: #000000 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-sizing: border-box;
  height: 35px;
  position: relative;
  z-index: 60;
}

html.theme-light .site-utility-bar,
html.light .site-utility-bar {
  background: #000000 !important;
  background-color: #000000 !important;
  border-bottom-color: rgba(255, 255, 255, 0.15) !important;
  color: #cbd5e1 !important;
}

.utility-login-btn {
  padding: 2px 10px;
  background: #000000;
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #67e8f9;
  border-radius: 8px;
  font-size: 11px;
  font-family: monospace;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.utility-login-btn:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: #22d3ee;
  color: #a5f3fc;
}

/* User Menu Dropdown in Top Utility Bar */
.user-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #0f172a;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 15px rgba(6, 182, 212, 0.15);
  padding: 6px;
  z-index: 1100;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

.user-menu-header {
  padding: 8px 10px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 4px;
}

.user-menu-name {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-email {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #38bdf8;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-item,
#masthead .user-menu-item,
body.palette-gold .user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border-radius: 6px;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0 !important;
  text-decoration: none !important;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-menu-item:hover,
.user-menu-item:focus,
body.palette-gold .user-menu-item:hover,
body.palette-gold .user-menu-item:focus {
  background: rgba(34, 211, 238, 0.12);
  color: #22d3ee !important;
  text-decoration: none !important;
}

.user-menu-signin {
  border-bottom: 1px solid #1e293b;
  margin-bottom: 4px;
  padding-bottom: 8px;
  font-weight: 700;
  color: #67e8f9 !important;
}

.user-menu-divider {
  height: 1px;
  background: #1e293b;
  margin: 4px 0;
}

.user-menu-logout,
body.palette-gold .user-menu-logout {
  color: #fda4af !important;
}

.user-menu-logout:hover,
.user-menu-logout:focus,
body.palette-gold .user-menu-logout:hover,
body.palette-gold .user-menu-logout:focus {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185 !important;
}


/* Header Structure */
.site-header {
  background: #000;
  padding-bottom: 0 !important;
  padding-top: 0 !important;
  position: relative;
  z-index: 40;
  border-bottom: 1px solid rgba(253, 199, 28, 0.2);
}

.site-header-inside {
  align-items: center;
  display: flex;
  position: relative;
  width: 100%;
  min-height: 70px;
}

.site-branding {
  flex: 0 0 auto;
  margin-right: 0.625em;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.site-logo {
  margin: 0;
  line-height: 1;
  height: 100%;
  display: flex;
  align-items: center;
}

.site-logo a {
  display: flex;
  align-items: center;
  height: 100%;
}

.site-logo img {
  height: 64px !important;
  max-height: 68px !important;
  width: auto;
  aspect-ratio: 670 / 170;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

@media only screen and (min-width: 641px) {
  .site-header-inside {
    min-height: 74px;
  }
  .site-logo img {
    height: 70px !important;
    max-height: 72px !important;
  }
}

@media only screen and (max-width: 640px) {
  .site-header-inside {
    min-height: 74px;
  }
  .site-logo img {
    height: 70px !important;
    max-height: 72px !important;
    max-width: calc(100vw - 75px);
  }
}

/* Navigation & Menus */
.menu,
.submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item {
  position: relative;
  color: #fff;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  font-size: 0.9375em;
}

.menu-item a:not(.button) {
  display: inline-block;
  line-height: 1.5;
  color: #f8f8fa;
  text-decoration: none;
  transition: color 0.2s ease;
}

@media only screen and (min-width: 801px) {
  #menu-close,
  #menu-open,
  .submenu-toggle,
  .menu-item .submenu-toggle {
    display: none !important;
  }

  .site-navigation {
    margin-left: auto;
  }

  .menu {
    align-items: center;
    display: flex;
  }

  .menu-item {
    display: inline-block;
    margin: 0 0 0 1.25em;
    padding-bottom: 0.1875em;
    padding-top: 0.1875em;
  }

  .menu-item a:not(.button) {
    padding-top: 0.5em;
    padding-bottom: 0.5em;
  }

  .menu-item a:not(.button):hover,
  .menu-item.current > a,
  .menu-item.current-parent > a {
    color: #fdc71c !important;
  }

  .menu-item.has-children > a {
    padding-right: 15px;
    position: relative;
  }

  .menu-item.has-children > a:after {
    background: 0;
    border-color: currentColor;
    border-style: solid;
    border-width: 1px 1px 0 0;
    box-sizing: border-box;
    content: "";
    height: 6px;
    position: absolute;
    right: 0;
    top: 50%;
    width: 6px;
    transform: translateY(-50%) rotate(135deg);
  }

  /* Dropdown Submenu (Desktop) */
  .submenu {
    background: #fff;
    border: 1px solid #dde0e7;
    border-radius: 3px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    left: 0;
    min-width: 190px;
    opacity: 0;
    padding: 0.5em 0;
    position: absolute;
    text-align: left;
    top: 100%;
    transition: opacity 0.2s, visibility 0s 0.2s;
    visibility: hidden;
    width: max-content;
    z-index: 99;
  }

  .menu-item.has-children:hover > .submenu,
  .menu-item.has-children:focus-within > .submenu {
    opacity: 1;
    transition: margin 0.3s, opacity 0.2s;
    visibility: visible;
  }

  .submenu .menu-item {
    display: block;
    margin: 0;
    padding: 0 1em;
    color: #000;
  }

  .submenu .menu-item.menu-group-start {
    margin-top: 0.35em;
    padding-top: 0.35em;
    border-top: 1px solid #e2e8f0;
  }

  .submenu a:not(.button-icon) {
    display: block;
    color: #283040 !important;
    font-size: 0.875rem;
    padding: 0.35em 0;
  }

  .submenu a:hover {
    color: #fdc71c !important;
    background: rgba(253, 199, 28, 0.05);
  }

  /* Dark mode overrides for desktop submenu */
  html.theme-dark .submenu,
  html.dark .submenu {
    background: #111827;
    border: 1px solid #1e293b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  }

  html.theme-dark .submenu .menu-item,
  html.dark .submenu .menu-item {
    color: #cbd5e1;
  }

  html.theme-dark .submenu .menu-item.menu-group-start,
  html.dark .submenu .menu-item.menu-group-start {
    border-top-color: #1e293b;
  }

  html.theme-dark .submenu a,
  html.dark .submenu a {
    color: #cbd5e1 !important;
  }

  html.theme-dark .submenu a:hover,
  html.dark .submenu a:hover {
    color: #fdc71c !important;
    background: rgba(253, 199, 28, 0.05);
  }
}

/* Mobile Menu Icons & Buttons */
#menu-close,
#menu-open,
.submenu-toggle {
  background: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  display: block;
  font-size: inherit;
  height: 30px;
  padding: 0;
  position: relative;
  width: 30px;
}

#menu-close:active,
#menu-close:focus,
#menu-close:hover,
#menu-open:active,
#menu-open:focus,
#menu-open:hover,
.submenu-toggle:active,
.submenu-toggle:focus,
.submenu-toggle:hover {
  outline: 0;
}

.icon-menu,
.icon-close {
  background: currentColor;
  border-radius: 1px;
  color: inherit;
  height: 2px;
  left: 50%;
  margin-top: -1px;
  margin-left: -12px;
  position: absolute;
  top: 50%;
  width: 24px;
}

.icon-menu:before,
.icon-menu:after,
.icon-close:before,
.icon-close:after {
  background: currentColor;
  border-radius: 1px;
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  width: 100%;
}

.icon-menu:before {
  top: -6px;
}

.icon-menu:after {
  bottom: -6px;
}

.icon-close {
  background: 0;
  margin-left: -14px;
  width: 28px;
}

.icon-close:before {
  top: 0;
  transform: rotate(45deg);
}

.icon-close:after {
  top: 0;
  transform: rotate(-45deg);
}

.icon-angle-right {
  background: 0;
  border-color: currentColor;
  border-style: solid;
  border-width: 1px 1px 0 0;
  box-sizing: border-box;
  height: 8px;
  left: 50%;
  margin-left: -4px;
  margin-top: -4px;
  position: absolute;
  top: 50%;
  width: 8px;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

/* Mobile Navigation Breakpoint (<= 800px) */
@media only screen and (max-width: 800px) {
  .site {
    overflow: hidden;
    position: relative;
  }

  .site-branding {
    margin-right: 0.625em;
  }

  .site-header:after {
    background: rgba(66, 75, 95, 0.6);
    content: "";
    height: 100vh;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    transition: opacity 0.15s ease-in-out, visibility 0s ease-in-out 0.15s;
    visibility: hidden;
    width: 100%;
    z-index: 998;
  }

  .site-navigation {
    background: #31394e;
    box-sizing: border-box;
    height: 100vh;
    margin: 0;
    max-width: 360px;
    position: absolute;
    right: -100%;
    top: 0;
    transition: right 0.3s ease-in-out, visibility 0s ease-in-out 0.3s;
    visibility: hidden;
    width: 100%;
    z-index: 999;
    -webkit-overflow-scrolling: touch;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  .site-nav-inside {
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  /* When drawer is open */
  body.menu--opened .site {
    height: 100%;
    left: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    transform: translateZ(0);
    width: 100%;
    z-index: 997;
  }

  body.menu--opened .site-navigation {
    right: 0;
    transition: right 0.3s ease-in-out;
    visibility: visible;
  }

  body.menu--opened .site-header:after {
    opacity: 1;
    transition-delay: 0s;
    visibility: visible;
    cursor: pointer;
  }

  .menu {
    display: block !important;
    padding: calc(3vw + 2.8125em) 3vw 3em;
  }

  .menu-item {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Lato', Helvetica, Arial, sans-serif;
  }

  .menu-item:not(.menu-button) {
    border-bottom: 1px solid #dde0e7;
  }

  .menu-item:not(.menu-button):first-child {
    border-top: 1px solid #dde0e7;
  }

  .menu-item a.button-icon,
  .menu-item a:not(.button) {
    padding: 0.75em 0;
  }

  .menu-item a:not(.button),
  #masthead .menu-item a:not(.button),
  .site-navigation .menu-item.current > a,
  .site-navigation .menu-item.current-parent > a,
  #masthead .menu-item.current > a,
  #masthead .menu-item.current-parent > a,
  body.palette-gold .site-navigation .menu-item.current > a,
  body.palette-gold #masthead .menu-item.current > a,
  html.theme-dark .site-navigation .menu-item.current > a,
  html.theme-dark .site-navigation .menu-item.current-parent > a {
    display: block !important;
    font-size: 0.9375em !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #f8f8fa !important;
    padding: 0.75em 0 !important;
  }

  .menu-item a:not(.button):hover,
  .menu-item a:not(.button):active,
  #masthead .menu-item a:not(.button):hover,
  #masthead .menu-item a:not(.button):active {
    color: #fdc71c !important;
  }

  .menu-item a.button:not(.button-icon) {
    width: 100%;
  }

  .menu-item.has-children > a {
    margin-right: 2em;
    padding-right: 0;
  }

  .menu-item.has-children > a:after {
    display: none !important;
    content: none !important;
  }

  .menu-item .menu-item:first-child {
    border-top: 0;
  }

  .menu-item .menu-item:last-child {
    border-bottom: 0;
  }

  .menu-item .submenu-toggle {
    color: #fff !important;
    height: 2.8125em;
    position: absolute;
    right: 0;
    top: 0;
    width: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .menu-item .submenu-toggle .icon-angle-right {
    border-width: 1px 1px 0 0;
    width: 8px;
    height: 8px;
    color: #fff;
  }

  .menu-item.active .submenu-toggle .icon-angle-right {
    transform: rotate(135deg);
    color: #fff;
  }

  .submenu {
    border-top: 1px solid #f8f8fa;
    display: none;
    padding-left: 1em;
    background: transparent !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  .menu-item.active .submenu {
    display: block;
  }

  .menu-button > .button:not(.button-icon) {
    margin-bottom: 1.25em;
    margin-top: 1.25em;
  }

  .menu-button + .menu-button > .button:not(.button-icon) {
    margin-top: 0;
  }

  #menu-open {
    margin-left: auto;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
  }

  #menu-close {
    color: #fff;
    display: block;
    position: absolute;
    right: 3vw;
    top: 3vw;
    width: 44px;
    height: 44px;
    z-index: 1001;
  }

  /* Dark & Light Theme Mobile Nav Drawer Parity */
  html.theme-dark .site-navigation,
  html.dark .site-navigation,
  html.theme-light .site-navigation,
  html.light .site-navigation {
    background: #0b0f19 !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.8) !important;
  }

  /* Search responsive layout matching portal */
  .site-header-inside {
    flex-wrap: wrap;
  }

  .search-wrapper {
    margin: 1em 0 0 0;
    width: 100%;
    order: 3;
  }

  #search-input {
    width: 100%;
  }

  #search-input:focus {
    width: 100%;
  }

  #search-results {
    width: 100%;
    left: 0;
  }
}

@media only screen and (min-width: 801px) {
  #menu-close,
  #menu-open {
    display: none;
  }
}

/* Header Search UI */
.search-wrapper {
  position: relative;
  margin-left: 1.5em;
  display: flex;
  align-items: center;
}

/* Keyboard Shortcut Hint Popup/Tooltip */
.search-shortcut-hint {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.15);
  color: #e2e8f0;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 1001;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: none;
}

.search-shortcut-hint.is-visible {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 1;
  transform: translateY(0);
}

.search-shortcut-hint kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  line-height: 1.2;
}

.search-shortcut-hint .hint-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0 0 4px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.search-shortcut-hint .hint-close:hover {
  color: #f8fafc;
}

/* Light Theme overrides for search shortcut hint */
html.theme-light .search-shortcut-hint,
html.light .search-shortcut-hint {
  background: #ffffff !important;
  border-color: #bae6fd !important;
  color: #1e293b !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 0 12px rgba(2, 132, 199, 0.1) !important;
}

html.theme-light .search-shortcut-hint kbd,
html.light .search-shortcut-hint kbd {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0369a1 !important;
}

html.theme-light .search-shortcut-hint .hint-close,
html.light .search-shortcut-hint .hint-close {
  color: #64748b !important;
}

html.theme-light .search-shortcut-hint .hint-close:hover,
html.light .search-shortcut-hint .hint-close:hover {
  color: #0f172a !important;
}

#search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(253, 199, 28, 0.3);
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 20px;
  font-size: 0.9em;
  width: 180px;
  transition: all 0.3s ease;
  font-family: 'Lato', Helvetica, Arial, sans-serif !important;
  line-height: 1.15;
}

#search-input::placeholder {
  font-family: 'Lato', Helvetica, Arial, sans-serif !important;
  color: #94a3b8;
}

#search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: #fdc71c;
  width: 240px;
  box-shadow: 0 0 10px rgba(253, 199, 28, 0.2);
}

html.theme-dark #search-input,
html.dark #search-input {
  background: rgba(17, 24, 39, 0.8);
  border-color: rgba(253, 199, 28, 0.3);
  color: #f8fafc;
}

html.theme-dark #search-input:focus,
html.dark #search-input:focus {
  background: #111827;
  border-color: #fdc71c;
}

#search-results {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 350px;
  background: #1a1a1a;
  border: 1px solid #fdc71c;
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

html.theme-dark #search-results,
html.dark #search-results {
  background: #0f172a;
  border-color: #1e293b;
}

.search-result-item {
  display: block;
  padding: 1em;
  border-bottom: 1px solid rgba(253, 199, 28, 0.1);
  text-decoration: none;
  transition: background 0.2s;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(253, 199, 28, 0.1);
}

.search-result-title {
  color: #fdc71c;
  font-weight: bold;
  margin-bottom: 0.2em;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

.search-result-snippet {
  color: #ccc;
  font-size: 0.85em;
  line-height: 1.4;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

.search-no-results {
  padding: 1em;
  color: #888;
  text-align: center;
  font-style: italic;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

html.theme-dark .search-result-item,
html.dark .search-result-item {
  border-bottom-color: #1e293b;
  color: #cbd5e1;
}

html.theme-dark .search-result-item:hover,
html.dark .search-result-item:hover {
  background: rgba(253, 199, 28, 0.1);
  color: #fdc71c;
}

html.theme-dark .search-result-title,
html.dark .search-result-title {
  color: #fdc71c;
}

@media (max-width: 800px) {
  .site-header-inside {
    flex-wrap: wrap;
  }
  .search-wrapper {
    margin: 1em 0 0 0;
    width: 100%;
    order: 3;
  }
  #search-input {
    width: 100%;
  }
  #search-input:focus {
    width: 100%;
  }
  #search-results {
    width: 100%;
    left: 0;
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(253, 199, 28, 0.3);
  color: #fdc71c;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 1em;
  padding: 0;
  transition: all 0.25s ease;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  user-select: none;
  outline: none;
}

.theme-toggle-btn:hover {
  background: rgba(253, 199, 28, 0.15);
  border-color: #fdc71c;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(253, 199, 28, 0.25);
}

.theme-icon-light {
  display: none;
}

.theme-icon-dark {
  display: block;
}

html.theme-dark .theme-icon-light,
html.dark .theme-icon-light {
  display: block;
}

html.theme-dark .theme-icon-dark,
html.dark .theme-icon-dark {
  display: none;
}

/* Footer Contrast & Hierarchy (matching Genesis Engine) */
#colophon.site-footer {
  background-color: #000000 !important;
  border-top: 1px solid #1e293b;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: max(1.5rem, 3vw) !important;
  padding-right: max(1.5rem, 3vw) !important;
  color: #94a3b8;
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

#colophon button,
#colophon input,
#colophon select,
#colophon textarea,
#colophon a,
#colophon p,
#colophon span,
#colophon h3,
#colophon li {
  font-family: 'Lato', Helvetica, Arial, sans-serif;
}

#colophon .inner {
  max-width: 80rem; /* max-w-7xl */
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#colophon .site-footer-nav {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

#colophon .footer-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 2rem;
}

@media only screen and (min-width: 768px) {
  #colophon .footer-nav-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem;
  }
}

#colophon .footer-nav-col {
  display: flex;
  flex-direction: column;
}

#colophon .footer-nav-col:nth-child(5) .footer-nav-heading a:hover,
#colophon .footer-nav-col:nth-child(5) .footer-nav-heading a:focus,
body.palette-gold #colophon .footer-nav-col:nth-child(5) .footer-nav-heading a:hover,
body.palette-gold #colophon .footer-nav-col:nth-child(5) .footer-nav-heading a:focus {
  color: #22d3ee !important; /* hover:text-cyan-400 */
}

#colophon .footer-nav-col:nth-child(5) .footer-nav-list a:hover,
#colophon .footer-nav-col:nth-child(5) .footer-nav-list a:focus,
body.palette-gold #colophon .footer-nav-col:nth-child(5) .footer-nav-list a:hover,
body.palette-gold #colophon .footer-nav-col:nth-child(5) .footer-nav-list a:focus {
  color: #22d3ee !important; /* hover:text-cyan-400 */
}

#colophon .footer-nav-heading {
  font-size: 0.75rem; /* text-xs */
  font-weight: 600;
  letter-spacing: 0.05em; /* tracking-wider */
  text-transform: uppercase;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #1e293b; /* border-slate-800 */
}

#colophon .footer-nav-heading a,
body.palette-gold #colophon .footer-nav-heading a {
  color: #ffffff !important;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

#colophon .footer-nav-heading a:hover,
#colophon .footer-nav-heading a:focus,
body.palette-gold #colophon .footer-nav-heading a:hover,
body.palette-gold #colophon .footer-nav-heading a:focus {
  color: #fbbf24 !important; /* hover:text-amber-400 */
}

#colophon .footer-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#colophon .footer-nav-list li {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0.75rem;
  line-height: 1.2;
}

#colophon .footer-nav-list li.menu-group-start {
  margin-top: 0.45rem !important;
  padding-top: 0.35rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#colophon .footer-nav-list a,
body.palette-gold #colophon .footer-nav-list a {
  color: #94a3b8 !important; /* text-slate-400 */
  font-size: 0.75rem; /* text-xs */
  text-decoration: none !important;
  transition: color 0.2s ease;
  line-height: 1.2;
  display: block;
  padding: 0;
}

#colophon .footer-nav-list a:hover,
#colophon .footer-nav-list a:focus,
body.palette-gold #colophon .footer-nav-list a:hover,
body.palette-gold #colophon .footer-nav-list a:focus {
  color: #fbbf24 !important; /* hover:text-amber-400 */
  text-decoration: none !important;
}

/* Lower Sub-Footer */
#colophon .sub-footer {
  border-top: 1px solid #0f172a; /* border-slate-900 */
  background-color: #000000;
  padding: 1rem 0; /* py-4 */
  position: relative;
  z-index: 10;
}

#colophon .sub-footer .site-footer-inside {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 0.5rem;
}

@media only screen and (min-width: 640px) {
  #colophon .sub-footer .site-footer-inside {
    flex-direction: row;
    text-align: left;
  }
}

#colophon .sub-footer .site-info {
  margin: 0;
  color: #94a3b8 !important;
  font-size: 0.75rem; /* text-xs */
  line-height: 1.5;
}

#colophon .sub-footer .site-info .copyright {
  display: block;
  margin-bottom: 0.25rem;
}

#colophon .sub-footer .site-info .made-with {
  display: block;
}

@media only screen and (min-width: 640px) {
  #colophon .sub-footer .site-info .copyright {
    display: inline;
    margin-right: 0.75rem;
    margin-bottom: 0;
  }
  #colophon .sub-footer .site-info .made-with {
    display: inline;
  }
}

#colophon .sub-footer .site-info a,
body.palette-gold #colophon .sub-footer .site-info a {
  color: #94a3b8 !important;
  text-decoration: underline !important;
  transition: color 0.2s ease;
}

#colophon .sub-footer .site-info a:hover,
#colophon .sub-footer .site-info a:focus,
body.palette-gold #colophon .sub-footer .site-info a:hover,
body.palette-gold #colophon .sub-footer .site-info a:focus {
  color: #ffffff !important;
}

/* Discreet Admin Menu link in Sub-Footer */
#colophon .sub-footer .site-info .admin-footer-link-wrap {
  display: block;
  margin-top: 0.25rem;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

#colophon .sub-footer .site-info .admin-footer-link-wrap:hover,
#colophon .sub-footer .site-info .admin-footer-link-wrap:focus-within {
  opacity: 1;
}

#colophon .sub-footer .site-info .admin-footer-sep {
  display: none;
}

@media only screen and (min-width: 640px) {
  #colophon .sub-footer .site-info .admin-footer-link-wrap {
    display: inline;
    margin-top: 0;
    margin-left: 0.5rem;
  }
  #colophon .sub-footer .site-info .admin-footer-sep {
    display: inline;
    margin-right: 0.5rem;
    color: #475569;
  }
}

#colophon .sub-footer .site-info a.admin-footer-link,
body.palette-gold #colophon .sub-footer .site-info a.admin-footer-link {
  display: inline-block;
  padding: 2px 4px;
  color: #64748b !important;
  text-decoration: none !important;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

#colophon .sub-footer .site-info a.admin-footer-link:hover,
#colophon .sub-footer .site-info a.admin-footer-link:focus,
body.palette-gold #colophon .sub-footer .site-info a.admin-footer-link:hover,
body.palette-gold #colophon .sub-footer .site-info a.admin-footer-link:focus {
  color: #22d3ee !important;
  text-decoration: underline !important;
}

/* =========================================================================
   Caudex Machina (theEngine) Contextual Wizard & Tool Callouts
   Accessible across Light Mode, Dark Mode, Forced Colors, and Print
   ========================================================================= */
.machina-callout {
  margin: 1.5rem 0;
  padding: 1.15rem 1.25rem;
  background-color: #f0f9ff;
  border: 1.5px solid #0891b2;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

html.theme-dark .machina-callout,
html.dark .machina-callout {
  background-color: rgba(8, 145, 178, 0.11);
  border-color: #06b6d4;
}

.machina-callout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.machina-callout-title {
  color: #0e7490;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-case {
  text-transform: none !important;
}

html.theme-dark .machina-callout-title,
html.dark .machina-callout-title {
  color: #22d3ee;
}

.machina-callout-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: currentColor;
}

.machina-callout p,
.post-content .machina-callout p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: #1e293b;
}

html.theme-dark .machina-callout p,
html.dark .machina-callout p,
html.theme-dark .post-content .machina-callout p,
html.dark .post-content .machina-callout p {
  color: #cbd5e1;
}

.machina-callout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.machina-callout a.machina-callout-btn,
body.palette-gold .machina-callout a.machina-callout-btn {
  padding: 0.45rem 0.95rem;
  min-block-size: 34px;
  box-sizing: border-box;
  background-color: #0e7490;
  border: 1.5px solid #0e7490;
  color: #ffffff !important;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.machina-callout a.machina-callout-btn:hover,
.machina-callout a.machina-callout-btn:focus-visible,
body.palette-gold .machina-callout a.machina-callout-btn:hover,
body.palette-gold .machina-callout a.machina-callout-btn:focus-visible {
  background-color: #155e75;
  border-color: #155e75;
  color: #ffffff !important;
}

html.theme-dark .machina-callout a.machina-callout-btn,
html.dark .machina-callout a.machina-callout-btn,
html.theme-dark body.palette-gold .machina-callout a.machina-callout-btn {
  background-color: #06b6d4;
  border-color: #06b6d4;
  color: #020617 !important;
}

html.theme-dark .machina-callout a.machina-callout-btn:hover,
html.dark .machina-callout a.machina-callout-btn:hover,
html.theme-dark .machina-callout a.machina-callout-btn:focus-visible,
html.dark .machina-callout a.machina-callout-btn:focus-visible,
html.theme-dark body.palette-gold .machina-callout a.machina-callout-btn:hover {
  background-color: #22d3ee;
  border-color: #22d3ee;
  color: #020617 !important;
}

.machina-callout a.machina-callout-btn-secondary,
body.palette-gold .machina-callout a.machina-callout-btn-secondary {
  background-color: #ffffff;
  border: 1.5px solid #0e7490;
  color: #0e7490 !important;
}

.machina-callout a.machina-callout-btn-secondary:hover,
.machina-callout a.machina-callout-btn-secondary:focus-visible,
body.palette-gold .machina-callout a.machina-callout-btn-secondary:hover {
  background-color: #e0f2fe;
  color: #155e75 !important;
}

html.theme-dark .machina-callout a.machina-callout-btn-secondary,
html.dark .machina-callout a.machina-callout-btn-secondary,
html.theme-dark body.palette-gold .machina-callout a.machina-callout-btn-secondary {
  background-color: rgba(15, 23, 42, 0.85);
  border-color: rgba(34, 211, 238, 0.6);
  color: #67e8f9 !important;
}

html.theme-dark .machina-callout a.machina-callout-btn-secondary:hover,
html.dark .machina-callout a.machina-callout-btn-secondary:hover,
html.theme-dark body.palette-gold .machina-callout a.machina-callout-btn-secondary:hover {
  background-color: rgba(8, 145, 178, 0.22);
  border-color: #22d3ee;
  color: #a5f3fc !important;
}

.machina-callout a.machina-callout-btn:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: 2px;
}

html.theme-dark .machina-callout a.machina-callout-btn:focus-visible {
  outline-color: #22d3ee;
}

@media (pointer: coarse) {
  .machina-callout a.machina-callout-btn {
    min-block-size: 40px;
    padding-block: 0.55rem;
  }
}

.epilogue-divider {
  margin: 2.25rem 0 1.75rem;
  border: 0;
  border-top: 1px solid rgba(14, 116, 144, 0.35);
}

html.theme-dark .epilogue-divider,
html.dark .epilogue-divider {
  border-top-color: rgba(34, 211, 238, 0.3);
}

.canon-epilogue {
  margin: 0 0 1.75rem;
  padding-left: 1rem;
  border-left: 3px solid #0e7490;
}

html.theme-dark .canon-epilogue,
html.dark .canon-epilogue {
  border-left-color: #22d3ee;
}

.canon-epilogue h2 {
  margin-top: 0;
}

.machina-scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.85rem;
  margin-top: 0.35rem;
}

.machina-scene-card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(14, 116, 144, 0.25);
  background-color: rgba(255, 255, 255, 0.82);
}

html.theme-dark .machina-scene-card,
html.dark .machina-scene-card {
  border-color: rgba(34, 211, 238, 0.24);
  background-color: rgba(15, 23, 42, 0.72);
}

.machina-scene-card > h3,
.post-content .machina-scene-card > h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  color: #0f172a;
}

html.theme-dark .machina-scene-card > h3,
html.dark .machina-scene-card > h3,
html.theme-dark .post-content .machina-scene-card > h3,
html.dark .post-content .machina-scene-card > h3 {
  color: #f8fafc;
}

.machina-scene-card > p,
.post-content .machina-scene-card > p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #334155;
}

html.theme-dark .machina-scene-card > p,
html.dark .machina-scene-card > p,
html.theme-dark .post-content .machina-scene-card > p,
html.dark .post-content .machina-scene-card > p {
  color: #cbd5e1;
}

.machina-scene-card > footer {
  display: flex;
  align-items: flex-end;
  padding-top: 0.2rem;
}

@media (forced-colors: active) {
  .machina-callout,
  .machina-scene-card,
  .mcp-demo-hero,
  .mcp-snippet-figure {
    border: 1px solid CanvasText;
  }
  .canon-epilogue {
    border-left: 3px solid CanvasText;
  }
  .machina-callout a.machina-callout-btn,
  .copy-button {
    border: 1px solid ButtonText;
    background-color: ButtonFace;
    color: ButtonText !important;
  }
}

/* =========================================================================
   Public MCP Demo Hero & Accessible Copy Snippets (Invoker Commands)
   ========================================================================= */
.mcp-demo-hero {
  margin: 1.25rem 0 2rem;
  padding: 1.35rem 1.4rem;
  border-radius: 14px;
  border: 1.5px solid #0891b2;
  background: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

html.theme-dark .mcp-demo-hero,
html.dark .mcp-demo-hero {
  background: linear-gradient(145deg, rgba(8, 145, 178, 0.14) 0%, rgba(15, 23, 42, 0.92) 100%);
  border-color: #06b6d4;
}

.mcp-demo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mcp-demo-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: rgba(14, 116, 144, 0.12);
  color: #0e7490;
  border: 1px solid rgba(14, 116, 144, 0.3);
}

html.theme-dark .mcp-demo-badge,
html.dark .mcp-demo-badge {
  background-color: rgba(6, 182, 212, 0.16);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.35);
}

.mcp-endpoint-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  overflow-x: auto;
}

.mcp-endpoint-pill code {
  color: #67e8f9;
  background: transparent;
  padding: 0;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .mcp-endpoint-pill code {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
  }
}

.mcp-snippet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.mcp-snippet-figure {
  margin: 0;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: #0f172a;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

html.theme-dark .mcp-snippet-figure,
html.dark .mcp-snippet-figure {
  border-color: #334155;
}

.mcp-snippet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
}

.mcp-snippet-bar figcaption {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mcp-snippet-figure pre {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: #0f172a !important;
  color: #f8fafc !important;
  padding: 0.85rem 0.95rem !important;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  flex: 1;
}

.copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}

.copy-button {
  min-inline-size: 32px;
  min-block-size: 32px;
  padding: 0.3rem 0.5rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 6px;
  border: 1px solid #475569;
  background-color: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.copy-button:hover,
.copy-button:focus-visible {
  background-color: #0e7490;
  border-color: #22d3ee;
  color: #ffffff;
}

.copy-button:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

.copy-button[data-copied] {
  border-color: #10b981;
  color: #34d399;
}

.copy-button[data-failed] {
  border-color: #f43f5e;
  color: #fda4af;
}

.copy-button .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.copy-button .icon-copy-done {
  display: none;
}

.copy-button[data-copied] .icon-copy-idle {
  display: none;
}

.copy-button[data-copied] .icon-copy-done {
  display: inline-flex;
}

.copy .tip {
  position: absolute;
  inset-inline-end: calc(100% + 0.45rem);
  inset-block-start: 50%;
  transform: translateY(-50%);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  background-color: #020617;
  border: 1px solid #334155;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.copy-button[data-copied] + .tip,
.copy-button[data-failed] + .tip {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .copy-button,
  .copy .tip {
    transition: opacity 0.1s linear;
  }
}

/* =========================================================================
   Original Canon Print-Ready Bar & Old-School Paper Print Stylesheet (#182)
   ========================================================================= */
.post-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.post-header-row .post-title {
  margin-bottom: 0;
  min-width: 0;
  flex: 1 1 11rem;
  overflow-wrap: break-word;
}

.canon-print-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.canon-print-bar-end {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.5rem 0;
}

.canon-print-btn,
.canon-pdf-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(148, 163, 184, 0.7);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.canon-print-btn:hover,
.canon-print-btn:focus-visible,
.canon-pdf-link:hover,
.canon-pdf-link:focus-visible {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
  text-decoration: none;
}

.canon-print-btn:focus-visible,
.canon-pdf-link:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

html.theme-light .canon-print-btn,
html.light .canon-print-btn,
html.theme-light .canon-pdf-link,
html.light .canon-pdf-link {
  color: rgba(71, 85, 105, 0.65);
}

html.theme-light .canon-print-btn:hover,
html.light .canon-print-btn:hover,
html.theme-light .canon-pdf-link:hover,
html.light .canon-pdf-link:hover {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(100, 116, 139, 0.3);
  color: #0f172a;
}

.canon-download-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  background: rgba(180, 83, 9, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.canon-download-cta:hover,
.canon-download-cta:focus-visible {
  background: rgba(217, 119, 6, 0.35);
  border-color: #fbbf24;
  color: #ffffff;
  text-decoration: none;
}

html.theme-light .canon-download-cta,
html.light .canon-download-cta {
  background: #fffbeb;
  border-color: #d97706;
  color: #92400e;
}

@page {
  size: letter portrait;
  margin: 0.75in 0.7in;
}

@media print {
  /* Strip all web chrome, /machina/ widgets, and interactive overlays */
  #masthead,
  .site-header,
  .site-utility-bar,
  #colophon,
  .site-footer,
  .docs-nav,
  #docs-nav,
  #page-nav,
  .page-nav,
  .skip-link,
  .canon-print-bar,
  .machina-callout,
  .dramatis-personae,
  .universe-dossier-section,
  .universe-dossier-grid,
  .psf-subbranch-strip,
  .psf-heraldry-grid,
  .mcp-demo-hero,
  .mcp-snippet-bar,
  .binder-pager,
  .binder-pager-outer,
  .genesis-dice-tray-dialog,
  .genesis-dice-minimized-pill,
  .utility-dice-btn,
  .utility-admin-btn,
  #page-header-bg,
  .page-header .bg-img {
    display: none !important;
  }

  /* Old-school paper tabletop RPG rulebook styling */
  html,
  body,
  #page,
  .site-content,
  .inner,
  .outer,
  .docs-content,
  .post,
  .post-inside,
  .post-content {
    background: #ffffff !important;
    color: #111111 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: static !important;
  }

  body {
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: 10.5pt !important;
    line-height: 1.48 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page-header {
    background: none !important;
    color: #111111 !important;
    padding: 0 0 0.75rem 0 !important;
    margin: 0 0 1rem 0 !important;
    border-bottom: 2px solid #111111 !important;
  }

  h1, h2, h3, h4, h5, h6,
  .post-title,
  .page-title {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    color: #000000 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  h1, .post-title, .page-title {
    font-size: 20pt !important;
    border-bottom: 2px solid #111111 !important;
    padding-bottom: 0.25rem !important;
    margin-bottom: 0.75rem !important;
  }

  h2 {
    font-size: 14pt !important;
    margin-top: 1.2rem !important;
    border-bottom: 1px solid #666666 !important;
    padding-bottom: 0.15rem !important;
  }

  h3 {
    font-size: 11.5pt !important;
    margin-top: 0.9rem !important;
  }

  a {
    color: #111111 !important;
    text-decoration: none !important;
  }

  p, li, blockquote {
    color: #111111 !important;
    orphans: 3;
    widows: 3;
  }

  img {
    max-width: 100% !important;
    max-height: 7.5in !important;
    height: auto !important;
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
    margin: 0.75rem 0 !important;
    background: #ffffff !important;
    color: #111111 !important;
  }

  thead {
    display: table-header-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th, td {
    border: 1px solid #333333 !important;
    padding: 4px 6px !important;
    color: #111111 !important;
    background: #ffffff !important;
  }

  th {
    background: #ececec !important;
    font-weight: 700 !important;
  }

  .psf-branch-emblem-block {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem !important;
    align-items: flex-start !important;
  }

  .psf-branch-emblem-img {
    width: 84px !important;
    height: 84px !important;
    filter: none !important;
  }
}

/* =========================================================================
   Site-Wide Draggable Floating Dice Roll Tray & Utility Bar Trigger (#150)
   Shared across static Eleventy rulebook pages and theEngine React SPA
   ========================================================================= */
.utility-dice-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(8, 145, 178, 0.14);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.utility-dice-btn:hover,
.utility-dice-btn:focus-visible {
  background: rgba(8, 145, 178, 0.3);
  border-color: #22d3ee;
  color: #ffffff;
}

.utility-dice-btn:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

.utility-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(180, 83, 9, 0.22);
  color: #fde68a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.utility-admin-btn:hover,
.utility-admin-btn:focus-visible,
.utility-admin-btn[aria-expanded="true"] {
  background: rgba(217, 119, 6, 0.35);
  border-color: #fbbf24;
  color: #ffffff;
}

.utility-admin-btn:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.admin-menu-dropdown {
  min-width: 225px;
}

/* Native modal <dialog> scroll containment (modern-web-guidance dialog Rule 1) */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(2, 6, 23, 0.78);
}

/* Non-modal <dialog>: Set margin: 0 for clamped viewport coordinates and
   NEVER set display unconditionally on dialog (scope strictly to [open]). */
dialog.genesis-dice-tray-dialog {
  margin: 0;
  padding: 0;
  position: fixed;
  z-index: 950;
  width: min(396px, calc(100vw - 16px));
  max-height: calc(100vh - 64px);
  border-radius: 16px;
  border: 1.5px solid rgba(6, 182, 212, 0.48);
  background-color: #0d1322;
  color: #f8fafc;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.68);
  box-sizing: border-box;
}

dialog.genesis-dice-tray-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.theme-light dialog.genesis-dice-tray-dialog,
html.light dialog.genesis-dice-tray-dialog {
  background-color: #ffffff;
  color: #0f172a;
  border-color: #0891b2;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
}

.genesis-dice-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: linear-gradient(90deg, #090e1a 0%, #111c30 100%);
  border-bottom: 1px solid rgba(51, 65, 85, 0.85);
  flex-shrink: 0;
}

html.theme-light .genesis-dice-tray-header,
html.light .genesis-dice-tray-header {
  background: linear-gradient(90deg, #f0f9ff 0%, #e0f2fe 100%);
  border-bottom-color: #bae6fd;
}

.genesis-dice-tray-title {
  margin: 0 !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f8fafc !important;
  font-family: 'Orbitron', ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.theme-light .genesis-dice-tray-title,
html.light .genesis-dice-tray-title {
  color: #0f172a !important;
}

/* Dedicated drag handle button: user-select & touch-action scoped ONLY to handle */
.genesis-dice-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(71, 85, 105, 0.7);
  background-color: rgba(15, 23, 42, 0.85);
  color: #94a3b8;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}

.genesis-dice-drag-handle.dragging {
  cursor: grabbing;
  border-color: #22d3ee;
  color: #22d3ee;
}

.genesis-dice-drag-handle:hover,
.genesis-dice-drag-handle:focus-visible {
  border-color: #22d3ee;
  color: #22d3ee;
  outline: 2px solid #22d3ee;
  outline-offset: 1px;
}

html.theme-light .genesis-dice-drag-handle,
html.light .genesis-dice-drag-handle {
  background-color: #ffffff;
  border-color: #94a3b8;
  color: #334155;
}

.genesis-dice-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.genesis-dice-icon-btn:hover,
.genesis-dice-icon-btn:focus-visible {
  background-color: rgba(30, 41, 59, 0.9);
  border-color: rgba(56, 189, 248, 0.45);
  color: #f8fafc;
}

.genesis-dice-close-btn:hover,
.genesis-dice-close-btn:focus-visible {
  background-color: rgba(225, 29, 72, 0.2);
  border-color: rgba(244, 63, 94, 0.55);
  color: #fda4af;
}

html.theme-light .genesis-dice-icon-btn,
html.light .genesis-dice-icon-btn {
  color: #334155;
}

html.theme-light .genesis-dice-icon-btn:hover,
html.light .genesis-dice-icon-btn:hover {
  background-color: #e0f2fe;
  border-color: #0284c7;
  color: #0c4a6e;
}

.genesis-dice-tray-body {
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
}

/* Minimized Floating Corner Pill */
.genesis-dice-minimized-pill {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 950;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1.5px solid rgba(6, 182, 212, 0.55);
  background-color: #0b1120;
  color: #f8fafc;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

html.theme-light .genesis-dice-minimized-pill,
html.light .genesis-dice-minimized-pill {
  background-color: #ffffff;
  color: #0f172a;
  border-color: #0891b2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.genesis-dice-pill-expand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.genesis-dice-pill-expand:hover {
  background-color: rgba(6, 182, 212, 0.12);
}

.genesis-dice-pill-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 32px;
  border: 0;
  border-left: 1px solid rgba(51, 65, 85, 0.7);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.genesis-dice-pill-close:hover {
  background-color: rgba(225, 29, 72, 0.18);
  color: #fb7185;
}

/* Vanilla Portal Tray Inner Controls (Static Eleventy Pages) */
.portal-dice-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.portal-dice-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.portal-dice-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.portal-dice-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 3px;
}

html.theme-light .portal-dice-field label,
html.light .portal-dice-field label {
  color: #475569;
}

.portal-dice-input,
.portal-dice-select {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px !important;
  border-radius: 7px !important;
  border: 1px solid #334155 !important;
  background-color: #090d16 !important;
  color: #f8fafc !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.portal-dice-input:focus,
.portal-dice-select:focus {
  border-color: #22d3ee !important;
  outline: none !important;
}

html.theme-light .portal-dice-input,
html.light .portal-dice-input,
html.theme-light .portal-dice-select,
html.light .portal-dice-select {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

.portal-dice-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-dice-preset-btn {
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid #334155;
  background-color: #090d16;
  color: #67e8f9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.portal-dice-preset-btn:hover,
.portal-dice-preset-btn:focus-visible {
  border-color: #06b6d4;
  background-color: rgba(8, 145, 178, 0.2);
}

html.theme-light .portal-dice-preset-btn,
html.light .portal-dice-preset-btn {
  background-color: #f0f9ff;
  border-color: #7dd3fc;
  color: #0e7490;
}

.portal-dice-exec-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #0891b2;
  background-color: #0891b2;
  color: #020617;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.portal-dice-exec-btn:hover,
.portal-dice-exec-btn:focus-visible {
  background-color: #22d3ee;
  border-color: #22d3ee;
}

html.theme-light .portal-dice-exec-btn,
html.light .portal-dice-exec-btn {
  background-color: #0e7490;
  border-color: #0e7490;
  color: #ffffff;
}

.portal-dice-spotlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  background-color: #090d16;
}

html.theme-light .portal-dice-spotlight,
html.light .portal-dice-spotlight {
  background-color: #f0f9ff;
  border-color: #7dd3fc;
}

.portal-dice-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.portal-dice-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid #1e293b;
  background-color: #090d16;
}

html.theme-light .portal-dice-log-row,
html.light .portal-dice-log-row {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.portal-dice-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.portal-dice-badge-pass {
  background-color: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

html.theme-light .portal-dice-badge-pass,
html.light .portal-dice-badge-pass {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.portal-dice-badge-fail {
  background-color: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

html.theme-light .portal-dice-badge-fail,
html.light .portal-dice-badge-fail {
  background-color: #ffe4e6;
  border-color: #f43f5e;
  color: #9f1239;
}

.portal-dice-help {
  padding: 7px 11px;
  background-color: rgba(8, 145, 178, 0.18);
  border-bottom: 1px solid rgba(6, 182, 212, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #a5f3fc;
}

html.theme-light .portal-dice-help,
html.light .portal-dice-help {
  background-color: #e0f2fe;
  border-bottom-color: #7dd3fc;
  color: #0c4a6e;
}

@media (forced-colors: active) {
  dialog.genesis-dice-tray-dialog,
  .genesis-dice-minimized-pill,
  .utility-dice-btn {
    border: 1px solid CanvasText;
  }
}

/* =========================================================================
   Universe Dramatis Personae & Story Dossier Cards (#168–#171)
   ========================================================================= */
.universe-dossiers-section {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(56, 189, 248, 0.25);
}

.universe-dossiers-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.universe-dossiers-header h2 {
  margin: 0 !important;
  font-size: 1.25rem !important;
}

.universe-dossiers-all {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  text-decoration: none;
}

.universe-dossiers-all:hover {
  text-decoration: underline;
}

.universe-dossiers-subhead {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fbbf24;
  margin: 1.25rem 0 0.65rem 0 !important;
}

html.theme-light .universe-dossiers-subhead,
html.light .universe-dossiers-subhead {
  color: #b45309;
}

.universe-dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

article.universe-dossier-card {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

@container (min-width: 300px) {
  article.universe-dossier-card:has(> img) {
    flex-direction: row;
    align-items: flex-start;
  }
}

html.theme-light article.universe-dossier-card,
html.light article.universe-dossier-card {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

article.universe-dossier-card > img {
  width: 68px;
  height: 68px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  flex-shrink: 0;
  margin: 0 !important;
}

article.universe-dossier-card .universe-dossier-meta {
  min-width: 0;
  flex: 1;
}

article.universe-dossier-card h3,
article.universe-dossier-card h4 {
  margin: 0 0 0.2rem 0 !important;
  font-size: 1rem !important;
  line-height: 1.3 !important;
}

article.universe-dossier-card a.card-link {
  color: #f8fafc;
  text-decoration: none;
}

html.theme-light article.universe-dossier-card a.card-link,
html.light article.universe-dossier-card a.card-link {
  color: #0f172a;
}

article.universe-dossier-card a.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

article.universe-dossier-card a.card-link:focus-visible {
  outline: none;
}

article.universe-dossier-card:has(a.card-link:hover) {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.75);
}

article.universe-dossier-card:has(a.card-link:hover) a.card-link {
  color: #38bdf8;
}

html.theme-light article.universe-dossier-card:has(a.card-link:hover) a.card-link,
html.light article.universe-dossier-card:has(a.card-link:hover) a.card-link {
  color: #0284c7;
}

article.universe-dossier-card:has(a.card-link:focus-visible) {
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

article.universe-dossier-card a:not(.card-link),
article.universe-dossier-card button {
  position: relative;
  z-index: 1;
}

.universe-dossier-role {
  margin: 0 0 0.35rem 0 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  color: #fbbf24;
}

html.theme-light .universe-dossier-role,
html.light .universe-dossier-role {
  color: #0369a1;
}

.universe-dossier-bio {
  margin: 0 !important;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #cbd5e1;
}

html.theme-light .universe-dossier-bio,
html.light .universe-dossier-bio {
  color: #334155;
}

/* =========================================================================
   PolySolar Foundation (PSF) Branch Heraldry & Tactical Patches (#176)
   ========================================================================= */
.psf-branch-emblem-block {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  align-items: flex-start;
  margin: 0.75rem 0 1.5rem 0;
}

@media (min-width: 640px) {
  .psf-branch-emblem-block {
    flex-direction: row;
  }
}

.psf-branch-emblem-img {
  width: 118px;
  height: 118px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  flex-shrink: 0;
  margin: 0 !important;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.38));
}

.psf-subbranch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.psf-subbranch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.85rem;
  line-height: 1.35;
}

html.theme-light .psf-subbranch-pill,
html.light .psf-subbranch-pill {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.psf-subbranch-pill img {
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  flex-shrink: 0;
  margin: 0 !important;
}

.psf-heraldry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem 0;
}

article.psf-patch-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.1rem 0.9rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(251, 191, 36, 0.28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

article.psf-patch-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.65);
}

html.theme-light article.psf-patch-card,
html.light article.psf-patch-card {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

article.psf-patch-card > img {
  width: 112px;
  height: 112px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 0 0 0.65rem 0 !important;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

article.psf-patch-card h3 {
  margin: 0 0 0.25rem 0 !important;
  font-size: 0.98rem !important;
}

article.psf-patch-card p {
  margin: 0 0 0.65rem 0 !important;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
  flex: 1;
}

html.theme-light article.psf-patch-card p,
html.light article.psf-patch-card p {
  color: #475569;
}

article.psf-patch-card footer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  color: #64748b;
}

article.psf-patch-card footer a {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: none;
}

html.theme-light article.psf-patch-card footer a,
html.light article.psf-patch-card footer a {
  color: #0284c7;
}

article.psf-patch-card footer a:hover {
  text-decoration: underline;
}

/* =========================================================================
   Homepage Secondary Link & MCP Page Live Sandbox / Accessible Tabs
   ========================================================================= */
.hero-secondary-link {
  margin: 0.9rem 0 0;
  font-size: 0.92rem;
  color: rgba(248, 250, 252, 0.92);
}

.hero-secondary-link a {
  color: #fde68a !important;
  font-weight: 700;
  text-underline-offset: 3px;
}

.hero-secondary-link a:hover {
  color: #ffffff !important;
}

.mcp-live-sandbox {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  contain: layout style;
}

.mcp-live-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.mcp-live-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 9px;
  border: 1.5px solid #0284c7;
  background-color: #0369a1;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.mcp-live-btn code {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  padding: 0.1em 0.35em;
}

.mcp-live-btn:hover,
.mcp-live-btn:focus-visible {
  background-color: #0284c7;
}

.mcp-live-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mcp-live-btn-secondary {
  background-color: #0f172a;
  border-color: #38bdf8;
  color: #e0f2fe;
}

.mcp-live-btn-secondary:hover,
.mcp-live-btn-secondary:focus-visible {
  background-color: #1e293b;
}

.mcp-live-proc-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

html.theme-dark .mcp-live-proc-label,
html.dark .mcp-live-proc-label {
  color: #cbd5e1;
}

.mcp-live-proc-select {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 0.84rem;
}

html.theme-dark .mcp-live-proc-select,
html.dark .mcp-live-proc-select {
  background-color: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}

.mcp-live-output {
  padding: 0.95rem 1rem;
  border-radius: 10px;
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.9rem;
  contain: layout style;
}

.mcp-live-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.mcp-live-status {
  font-weight: 700;
  color: #67e8f9;
}

.mcp-live-status[data-state="ok"] {
  color: #4ade80;
}

.mcp-live-status[data-state="error"] {
  color: #fda4af;
}

.mcp-live-token {
  color: #94a3b8;
}

.mcp-live-summary {
  margin: 0 0 0.45rem !important;
  color: #f8fafc;
}

.mcp-live-math {
  margin: 0 0 0.6rem !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: #7dd3fc;
}

.mcp-live-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.mcp-live-details pre {
  margin: 0.6rem 0 0 !important;
  padding: 0.75rem !important;
  max-height: 260px;
  overflow: auto;
  font-size: 0.76rem;
  background-color: #020617 !important;
  border: 1px solid #1e293b;
  border-radius: 8px;
}

.mcp-mobile-escape {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(14, 116, 144, 0.2);
}

.mcp-mobile-escape-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0e7490;
}

html.theme-dark .mcp-mobile-escape-label,
html.dark .mcp-mobile-escape-label {
  color: #67e8f9;
}

.mcp-mobile-only {
  display: none;
}

@media (max-width: 800px) {
  .mcp-live-sandbox,
  .mcp-desktop-only {
    display: none !important;
  }

  .mcp-mobile-only {
    display: inline;
  }

  .mcp-mobile-escape {
    border-top: 0;
    padding-top: 0;
  }
}

.mcp-transcript-preview {
  margin: 0 0 2rem;
  contain: layout style;
}

.mcp-transcript-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
}

.mcp-transcript-card {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
}

html.theme-dark .mcp-transcript-card,
html.dark .mcp-transcript-card {
  background-color: #0f172a;
  border-color: #334155;
}

.mcp-transcript-card-code {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.mcp-transcript-kicker {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #0e7490;
  margin-bottom: 0.45rem;
}

html.theme-dark .mcp-transcript-kicker,
html.dark .mcp-transcript-kicker,
.mcp-transcript-card-code .mcp-transcript-kicker {
  color: #67e8f9;
}

.mcp-transcript-card p {
  margin: 0;
  font-size: 0.92rem;
}

.mcp-transcript-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mcp-transcript-card-code code {
  background-color: #1e293b;
  color: #7dd3fc;
}

.mcp-setup-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.75rem;
  align-items: start;
  contain: layout style;
}

.mcp-tabs {
  min-width: 0;
}

.mcp-tablist {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: inline proximity;
  gap: 0.25rem;
  border-bottom: 1px solid #cbd5e1;
  margin-bottom: 0.75rem;
}

html.theme-dark .mcp-tablist,
html.dark .mcp-tablist {
  border-bottom-color: #334155;
}

.mcp-tab {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  padding: 0.6rem 0.85rem;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

html.theme-dark .mcp-tab,
html.dark .mcp-tab {
  color: #94a3b8;
}

.mcp-tab:hover,
.mcp-tab:focus-visible {
  color: #0284c7;
}

html.theme-dark .mcp-tab:hover,
html.dark .mcp-tab:hover,
html.theme-dark .mcp-tab:focus-visible,
html.dark .mcp-tab:focus-visible {
  color: #67e8f9;
}

.mcp-tab[aria-selected="true"] {
  color: #0369a1;
}

html.theme-dark .mcp-tab[aria-selected="true"],
html.dark .mcp-tab[aria-selected="true"] {
  color: #38bdf8;
}

.mcp-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid #0284c7;
}

html.theme-dark .mcp-tab[aria-selected="true"]::after,
html.dark .mcp-tab[aria-selected="true"]::after {
  border-block-end-color: #38bdf8;
}

/* Keep panel wrapper style-free for hidden="until-found" compatibility */
.mcp-tabpanels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.mcp-tabpanel {
  grid-area: 1 / 1;
  min-width: 0;
}

.mcp-starter-prompt-card pre {
  white-space: pre-wrap;
}

/* =========================================================================
   3-Ring Binder Sequential Pager (Previous / Next Page across all 3 Caudex)
   ========================================================================= */
.binder-pager {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dde0e7;
}

html.theme-dark .binder-pager,
html.dark .binder-pager {
  border-top-color: #293548;
}

.post.type-docs .post-inside .binder-pager {
  padding-inline: 1.875em;
}

@media only screen and (min-width: 641px) {
  .post.type-docs .post-inside .binder-pager {
    padding-inline: 7%;
  }
}

.binder-pager-outer {
  padding-bottom: 3rem;
}

.binder-pager-outer .binder-pager {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem;
  background-color: #ffffff;
  border: 1px solid #dde0e7;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html.theme-dark .binder-pager-outer .binder-pager,
html.dark .binder-pager-outer .binder-pager {
  background-color: #0b1120;
  border-color: #1e293b;
  box-shadow: none;
}

.binder-pager-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

html.theme-dark .binder-pager-meta,
html.dark .binder-pager-meta {
  color: #94a3b8;
}

.binder-pager-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 600px) {
  .binder-pager-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .binder-pager-spacer {
    display: none;
  }
}

.binder-pager a.binder-pager-link,
body.palette-gold .binder-pager a.binder-pager-link {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-block-size: 56px;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: #0f172a;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.binder-pager a.binder-pager-link.binder-pager-next {
  text-align: right;
  align-items: flex-end;
}

.binder-pager a.binder-pager-link:hover,
.binder-pager a.binder-pager-link:focus-visible,
body.palette-gold .binder-pager a.binder-pager-link:hover,
body.palette-gold .binder-pager a.binder-pager-link:focus-visible {
  background-color: #e0f2fe;
  border-color: #0891b2;
  color: #0f172a;
  text-decoration: none;
}

.binder-pager a.binder-pager-link:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: 2px;
}

html.theme-dark .binder-pager a.binder-pager-link,
html.dark .binder-pager a.binder-pager-link,
html.theme-dark body.palette-gold .binder-pager a.binder-pager-link {
  background-color: rgba(15, 23, 42, 0.72);
  border-color: #334155;
  color: #f8fafc;
}

html.theme-dark .binder-pager a.binder-pager-link:hover,
html.dark .binder-pager a.binder-pager-link:hover,
html.theme-dark .binder-pager a.binder-pager-link:focus-visible,
html.dark .binder-pager a.binder-pager-link:focus-visible,
html.theme-dark body.palette-gold .binder-pager a.binder-pager-link:hover {
  background-color: rgba(8, 145, 178, 0.16);
  border-color: #06b6d4;
  color: #ffffff;
}

html.theme-dark .binder-pager a.binder-pager-link:focus-visible,
html.dark .binder-pager a.binder-pager-link:focus-visible {
  outline-color: #38bdf8;
}

.binder-pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #0e7490;
}

html.theme-dark .binder-pager-dir,
html.dark .binder-pager-dir {
  color: #38bdf8;
}

.binder-pager-arrow {
  flex-shrink: 0;
}

.binder-pager-title {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .binder-pager a.binder-pager-link {
    transition: none;
  }
}

@media (forced-colors: active) {
  .binder-pager a.binder-pager-link {
    border: 2px solid ButtonText;
    forced-color-adjust: none;
    background-color: Canvas;
    color: LinkText;
  }

  .binder-pager a.binder-pager-link:focus-visible,
  .binder-pager a.binder-pager-link:hover {
    outline: 2px solid Highlight;
    border-color: Highlight;
  }
}

/* Mobile-safe wrapping for long identifiers, tokens, and headings */
:not(pre) > code {
  overflow-wrap: anywhere;
}

.post-content p,
.post-content li,
.post-content a,
.post-title {
  overflow-wrap: break-word;
}
