/* Shared page geometry keeps the header and article on the same canvas. */
body {
  margin: 0;
  padding: clamp(12px, 2.5vw, 28px) 16px;
}

#head, #main {
  box-sizing: border-box;
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  float: none;
}

#head { margin-bottom: 24px; }
#banner-title { padding: 8px clamp(8px, 3vw, 20px); }
#head img { display: block; margin: auto; }

#main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 0;
  align-items: start;
}

#content {
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-wrap: anywhere;
}

#sidebar {
  box-sizing: border-box;
  float: none;
  width: auto;
  min-width: 0;
  padding: 0 0 0 20px;
  border-left: 1px solid #e3dfd5;
  overflow-wrap: anywhere;
}

div#listcontainer { box-sizing: border-box; width: 100%; }
label, input, select, button { box-sizing: border-box; max-width: 100%; }
#sidebar input { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.library-menu { font: 14px/1.5 Verdana, sans-serif; }
.library-menu [hidden] { display: none !important; }
.library-heading { margin: 0 0 20px; font: 24px/1.25 Georgia, serif; }
.library-search { display: flex; align-items: center; border: 1px solid #e3dfd5; margin-bottom: 20px; padding: 0 4px 0 12px; background: #fff; }
.library-search input { min-width: 0; width: 100%; padding: 12px 0; border: 0; background: transparent; color: #333; font: inherit; }
.library-search button { flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 44px; padding: 0; background: transparent; border: 0; color: #666; cursor: pointer; }
.library-tabs { display: flex; gap: 24px; border-bottom: 1px solid #e3dfd5; margin-bottom: 20px; }
.library-tabs button { min-height: 44px; padding: 8px 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #666; cursor: pointer; font: inherit; }
.library-tabs button[aria-selected="true"] { color: #900; border-bottom-color: #900; }
.library-main-links { display: flex; gap: 28px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid #e3dfd5; }
#sidebar.library-menu .library-main-links a { display: inline-flex; align-items: center; min-height: 44px; color: #333; border: 0; }
.library-menu h3 { font: 11px/1.5 Verdana, sans-serif; font-weight: normal; letter-spacing: 1.2px; text-transform: uppercase; color: #68675f; margin: 0 0 14px; }
.library-subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#sidebar.library-menu .library-subject-grid a { display: flex; align-items: center; min-height: 52px; box-sizing: border-box; padding: 10px; background: #f9f8f2; border: 0; color: #333; font-size: 12px; line-height: 1.4; }
.library-featured { margin-top: 26px; padding-top: 20px; border-top: 1px solid #e3dfd5; }
.library-menu ul { list-style: none; margin: 0; padding: 0; }
.library-menu li { margin: 0; padding: 0; }
#sidebar.library-menu .library-archive a, #sidebar.library-menu .library-all-articles a { display: block; padding: 13px 0; border-bottom: 1px solid #e3dfd5; color: #333; font: 17px/1.45 Georgia, serif; }
#sidebar.library-menu a[aria-current="page"] { color: #900; }
#sidebar.library-menu a:hover { color: #900; background: #f9f8f2; }
#sidebar.library-menu .library-subscribe { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: 20px; color: #900; border: 0; }
#sidebar .library-search-status { margin: 0 0 12px; font: 12px/1.5 Verdana, sans-serif; color: #68675f; }
.library-search-status:empty { display: none; }
.library-menu a:focus-visible, .library-menu button:focus-visible { outline: 2px solid #900; outline-offset: 3px; }
#footer { grid-column: 1 / -1; padding: 1em; }

img { max-width: 100%; height: auto; }
#content img {
  display: block;
  float: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: 100%;
}
#content .article-figure {
  display: block;
  float: none;
  clear: both;
  box-sizing: border-box;
  width: 100%;
  margin: 1.5em 0;
  padding: 0;
  text-align: center;
  border: 0;
}
#content .article-figure > a { display: inline-block; max-width: 100%; border: 0; }
#content .article-figure img { padding: 0; margin-top: 0; margin-bottom: 0; }
#content .article-figure figcaption {
  margin: .6em auto 0;
  font-size: .9em;
  line-height: 1.5;
  text-align: center;
  color: #666;
}

.mobile-menu-bar { display: flex; justify-content: flex-end; position: sticky; top: 0; z-index: 10; box-sizing: border-box; width: 100%; max-width: 800px; padding: 8px 0; margin: 0 auto 12px; background: #fff; }
#menu-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid #60605f; background: #f9f8f2; color: #333; cursor: pointer; font: inherit; }
#menu-toggle:focus-visible, .menu-close:focus-visible { outline: 2px solid #900; outline-offset: 3px; }
#main > #sidebar { display: none; }
.mobile-menu #sidebar { border: 0; padding: 0; }
.mobile-menu .library-heading { display: none; }
.mobile-menu .library-menu { font-size: 14px; }
.mobile-menu .library-search input { width: 100%; font-size: 16px; }
.mobile-menu #sidebar .library-subject-grid a { font-size: 14px; }
.mobile-menu {
  box-sizing: border-box;
  width: min(390px, calc(100% - 24px));
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  margin: 12px 12px 12px auto;
  padding: 24px;
  border: 1px solid #e3dfd5;
  background: #fff;
  color: #333;
  overflow: hidden;
}
.mobile-menu[open] { display: flex; flex-direction: column; }
.mobile-menu #sidebar { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.library-controls { flex: none; background: #fff; padding-bottom: 20px; border-bottom: 1px solid #e3dfd5; }
.library-controls .library-tabs { flex: 1; margin: 0; border: 0; }
.library-controls .library-search { margin-bottom: 0; }
.library-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; padding-top: 20px; }
.mobile-menu::backdrop { background: rgb(0 0 0 / 40%); }
.mobile-menu[open] { animation: menu-flyout .2s ease-out; }
@keyframes menu-flyout { from { transform: translateX(calc(100% + 12px)); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mobile-menu[open] { animation: none; } }
.mobile-menu-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; background: #fff; }
.menu-close { flex-shrink: 0; width: 44px; height: 44px; font-size: 28px; border: 0; border-radius: 50%; background: #f9f8f2; cursor: pointer; }
body.menu-open { overflow: hidden; }

/* Scale the whole flyout together on desktop, including type and spacing. */
@media (min-width: 1024px) {
  .mobile-menu { zoom: .75; }
}

@media (max-width: 640px) {
  #main { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #sidebar {
    border-left: 0;
    border-top: 1px solid #60605f;
    padding: 20px 0 0;
  }
  #sidebar .library-search input { width: 100%; font-size: 16px; }
  #head { margin-bottom: 20px; }
}
.candidate-indicator { position:fixed; bottom:0; left:0; right:0; z-index:100; background:#302a22; color:#fff; padding:8px 12px; text-align:center; font:12px/1.4 system-ui,sans-serif; pointer-events:none; }
