/* Theme library structure traits (v1.19.0). Each trait is a body class set by includes/theme_library.php.
   Colours always come from the site's CSS variables, so every trait works in light and dark mode. */

/* ---- page width ------------------------------------------------------------------------------------------ */
.tl-width-boxed .container-x { max-width: 1180px; }
.tl-width-wide .container-x { max-width: 1480px; }
.tl-width-narrow .container-x { max-width: 1020px; }
.tl-width-full .container-x { max-width: none; }

/* ---- cards (editions, widgets) ---------------------------------------------------------------------------- */
.tl-card-flat .widget, .tl-card-flat .ed-card, .tl-card-flat .edition-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.tl-card-outline .widget, .tl-card-outline .ed-card, .tl-card-outline .edition-card { border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent); border-radius: 2px; box-shadow: none; }
.tl-card-shadow .widget, .tl-card-shadow .ed-card, .tl-card-shadow .edition-card { border: 0; border-radius: 14px; box-shadow: 0 6px 22px -6px rgba(15, 23, 42, .22); }
.tl-card-topbar .widget, .tl-card-topbar .ed-card, .tl-card-topbar .edition-card { border-radius: 0; border-top: 4px solid var(--primary); box-shadow: var(--shadow-1); }
.tl-card-leftbar .widget, .tl-card-leftbar .ed-card, .tl-card-leftbar .edition-card { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; border-left: 5px solid var(--accent); }
.tl-card-solid .widget, .tl-card-solid .ed-card, .tl-card-solid .edition-card { background: var(--surface-low); border-color: transparent; border-radius: 10px; box-shadow: none; }
.tl-card-sharp .widget, .tl-card-sharp .ed-card, .tl-card-sharp .edition-card { border: 2px solid var(--ink); border-radius: 0; box-shadow: 4px 4px 0 var(--ink); }
.tl-card-pill .widget, .tl-card-pill .ed-card, .tl-card-pill .edition-card { border-radius: 24px; box-shadow: 0 4px 16px -6px rgba(15, 23, 42, .18); }
.tl-card-sharp .ed-card:hover, .tl-card-sharp .ed-card { overflow: visible; }

/* ---- section headings -------------------------------------------------------------------------------------- */
.tl-hl-rule .sec-head, .tl-hl-rule .widget-title { border-bottom: 2px solid var(--ink); padding-bottom: .35rem; }
.tl-hl-rule .sec-head h1::before, .tl-hl-rule .sec-head h2::before { display: none; }
.tl-hl-band .sec-head h1, .tl-hl-band .sec-head h2, .tl-hl-band .widget-title { background: var(--primary); color: #fff; padding: .4rem .8rem; border-radius: 2px; }
.tl-hl-band .widget-title i, .tl-hl-band .widget-title .wt-aside { color: #fff; }
.tl-hl-band .sec-head h1::before, .tl-hl-band .sec-head h2::before { display: none; }
.tl-hl-caps .sec-head h1, .tl-hl-caps .sec-head h2, .tl-hl-caps .widget-title { text-transform: uppercase; letter-spacing: .08em; font-size: .95rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.tl-hl-caps .sec-head h1::before, .tl-hl-caps .sec-head h2::before { width: 4px; }
.tl-hl-boxed .sec-head h1, .tl-hl-boxed .sec-head h2, .tl-hl-boxed .widget-title { border: 3px solid var(--ink); padding: .3rem .7rem; display: inline-flex; text-transform: uppercase; letter-spacing: .04em; }
.tl-hl-boxed .sec-head h1::before, .tl-hl-boxed .sec-head h2::before { display: none; }

/* ---- masthead ----------------------------------------------------------------------------------------------- */
.tl-hd-stacked .masthead .container-x { flex-wrap: wrap; justify-content: center; padding-block: 1.3rem; border-top: 4px double var(--ink); }
.tl-hd-stacked .masthead .brand { flex-basis: 100%; justify-content: center; text-align: center; }
.tl-hd-stacked .masthead .brand-name { font-size: clamp(1.8rem, 4.2vw, 3rem); letter-spacing: .02em; }
.tl-hd-stacked .site-header { border-bottom: 1px solid var(--ink); }
.tl-hd-band .masthead { background: var(--primary); }
.tl-hd-band .masthead .brand-name, .tl-hd-band .masthead .brand-sub { color: #fff; }
.tl-hd-dark .masthead { background: #111827; }
.tl-hd-dark .masthead .brand-name, .tl-hd-dark .masthead .brand-sub { color: #fff; }
.tl-hd-dark .masthead .search-box { background: #1f2937; }
@media (min-width: 992px) {
  .tl-hd-split .masthead .container-x { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; column-gap: 1.5rem; }
  .tl-hd-split .masthead .search-box { grid-column: 1; grid-row: 1; display: block !important; width: 100%; max-width: 380px; justify-self: start; margin: 0; }
  .tl-hd-split .masthead .search-box input { text-overflow: ellipsis; padding-right: .6rem; }
  .tl-hd-split .masthead .brand { grid-column: 2; grid-row: 1; justify-self: center; justify-content: center; text-align: center; margin: 0; }
  .tl-hd-split .masthead .mast-actions { grid-column: 3; grid-row: 1; justify-self: end; flex-wrap: nowrap; white-space: nowrap; }
  .tl-hd-split .brand img { max-height: 58px; max-width: 260px; }
}

/* ---- menu --------------------------------------------------------------------------------------------------- */
.tl-nv-caps .main-nav .nav-link { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; }
@media (min-width: 992px) {
  .tl-nv-tabs .main-nav .nav-link { border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; margin: .35rem .1rem 0; background: var(--surface); }
  .tl-nv-tabs .main-nav .nav-link.active { background: var(--primary); border-color: var(--primary); }
  .tl-nv-tabs .main-nav { border-bottom: 3px solid var(--primary); }
}

/* ---- paper viewer: page thumbnails and reading stage ---------------------------------------------------------- */
@media (min-width: 768px) {
  .tl-rail-right .viewer-wrap .row > aside:not(.viewer-sidebar) { order: 2; }
  .tl-rail-right .viewer-wrap .row > .viewer-content { order: 1; }
  .tl-rail-right .viewer-wrap .row > .viewer-sidebar { order: 3; }
  .tl-rail-hidden .viewer-wrap .row > aside:not(.viewer-sidebar) { display: none !important; }
  .tl-rail-hidden .viewer-wrap .viewer-content { flex: 0 0 100%; max-width: 100%; }
  .tl-rail-strip .viewer-wrap .row > aside:not(.viewer-sidebar) { display: block !important; flex: 0 0 100%; max-width: 100%; order: -1; }
  .tl-rail-strip .thumb-rail { display: flex; gap: .5rem; overflow-x: auto; position: static; max-height: none; }
  .tl-rail-strip .thumb-rail .thumb-item { flex: 0 0 110px; }
  .tl-rail-strip .thumb-rail .rail-head { display: none; }
}
@media (min-width: 1200px) {
  .tl-rail-hidden .viewer-wrap .viewer-content { flex: 0 0 75%; max-width: 75%; }
  .tl-rail-hidden .viewer-layout-full .viewer-content { flex: 0 0 100%; max-width: 100%; }
}
.tl-stage-dark .page-stage { background: #0b1220; border-color: #0b1220; }
.tl-stage-white .page-stage { background: #fff; border: 0; box-shadow: none; }
.tl-stage-paper .page-stage { background: #efe4cc; border-color: #d9c8a3; }

/* ---- density ------------------------------------------------------------------------------------------------- */
.tl-dense { font-size: .94rem; }
.tl-dense .widget { padding: .75rem; margin-bottom: .75rem; }
.tl-dense .sec-head { margin-bottom: .55rem; padding-bottom: .3rem; }
.tl-dense .masthead .container-x { min-height: 56px; }
.tl-dense .main-nav .nav-link { padding: .25rem .6rem !important; font-size: .84rem; }
.tl-dense .site-main .row { --bs-gutter-x: .9rem; --bs-gutter-y: .9rem; }
.tl-dense .site-footer .container-x { padding-top: 1.6rem; }

/* ---- tweaks that keep themes readable on phones --------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .tl-card-sharp .widget, .tl-card-sharp .ed-card, .tl-card-sharp .edition-card { box-shadow: 2px 2px 0 var(--ink); }
  .tl-hd-stacked .masthead .brand-name { font-size: 1.6rem; }
}
