/*
 * The academy's library (template-parts/atlas/library.php): the portal's list pages in their
 * measure: the header card (look/PageHeader.js, `.lt-page-head`), the card of filters on the left and
 * the card of results with its tabs (`.lt-tabstrip`). Sizes in px, because Herald sets the root's
 * font to 10 px and a rem here would be the portal's size times 0.625.
 */

.aka-lib {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto 24px;
  padding: 0 16px;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--ui-text);
}
@media (min-width: 1540px) {
  .aka-lib {
    max-width: 1480px;
  }
  html[data-ui-width='narrow'] .aka-lib {
    max-width: var(--ui-page-narrow);
  }
}
html[data-ui-width='full'] .aka-lib {
  max-width: none;
}
.aka-lib *,
.aka-lib *::before,
.aka-lib *::after {
  box-sizing: border-box;
}

/* A card of the set, as the portal's `.card`. */
.aka-card {
  position: relative;
  border: 1px solid var(--ui-card-rim);
  border-radius: var(--ui-r-card);
  background-color: var(--ui-card-fill);
  box-shadow: var(--ui-card-shadow);
}
.aka-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: var(--ui-r-card);
  pointer-events: none;
  -webkit-backdrop-filter: var(--ui-card-blur);
  backdrop-filter: var(--ui-card-blur);
}

/* ── Header ──────────────────────────────────────────────────────────────────────────────── */
.aka-lib-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  padding: 16px 24px;
}
.aka-lib-tile {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--ui-r-inset);
  background: var(--ui-track);
  color: var(--ui-accent-ink);
  font-size: 32px;
}
.aka-lib-tile svg {
  width: 1em;
  height: 1em;
}
.aka-lib-head-text {
  flex: 1 1 0;
  min-width: 0;
}
.aka-lib-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--ui-muted);
  font: 600 13px/1.4 Poppins, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
html[data-ui] .aka-lib-title {
  margin: 0;
  color: var(--ui-ink);
  font: 600 28px/1.25 Poppins, sans-serif;
}

html[data-ui] .aka-lib .aka-lib-title-link {
  color: inherit !important;
  text-decoration: none !important;
}
html[data-ui] .aka-lib .aka-lib-title-link:hover {
  color: var(--ui-accent-ink) !important;
}

/* ── Body: filters on the left, results on the right ─────────────────────────────────────── */
.aka-lib-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (min-width: 992px) {
  .aka-lib-body {
    grid-template-columns: 264px minmax(0, 1fr);
  }
  /* Under the bar, which sticks to the top too (navbar.css): 58 px of it below 1200 px, 84 px from there. */
  .aka-lib-aside {
    position: sticky;
    top: 74px;
  }
}
@media (min-width: 1200px) {
  .aka-lib-aside {
    top: 100px;
  }
}
.aka-lib-side {
  padding: 20px;
}
.aka-lib-side-head {
  margin: 0 0 14px;
  color: var(--ui-muted);
  font: 600 11px/1.4 Poppins, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.aka-lib-search {
  position: relative;
  display: block;
  margin: 0 0 18px;
}
.aka-lib-search-glass {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 15px;
  height: 15px;
  color: var(--ui-muted);
  transform: translateY(-50%);
  pointer-events: none;
}
html[data-ui] .aka-lib .aka-lib-search-input {
  /* Herald's normalize gives a search field the content box, which outweighs `.aka-lib *`. */
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100%;
  min-width: 0 !important;
  height: 40px;
  margin: 0;
  padding: 0 14px 0 40px;
  border: 0 !important;
  border-radius: var(--ui-r-pill);
  background: var(--ui-track) !important;
  color: var(--ui-ink) !important;
  font: 500 14px/40px Poppins, sans-serif;
  box-shadow: none;
}
.aka-lib-search-input:focus {
  outline: 0;
  box-shadow: var(--ui-focus-ring) !important;
}
.aka-lib-side-label {
  margin: 0 0 6px;
  color: var(--ui-accent-ink);
  font: 600 14px/1.4 Poppins, sans-serif;
}
.aka-lib-cats {
  margin: 0;
  padding: 0;
  list-style: none;
}
.aka-lib-cats li {
  margin: 0;
  padding: 0;
}
.aka-lib-cats li::before {
  display: none;
}
.aka-lib-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--ui-r-tile);
  color: var(--ui-text) !important;
  font: 500 14px/1.4 Poppins, sans-serif;
  text-decoration: none !important;
}
.aka-lib-cat:hover {
  background: var(--ui-track);
  color: var(--ui-ink) !important;
}
.aka-lib-cat.is-active .aka-lib-count {
  /* On the thumb the count takes the text's colour: the muted grey read 2.6 to 1 there in Espresso. */
  color: var(--ui-text);
}
.aka-lib-cat.is-active {
  background: var(--ui-thumb);
  box-shadow: var(--ui-thumb-shadow);
  color: var(--ui-ink) !important;
  font-weight: 600;
}
/* The strip's arrows (look/strip.js) show only where the row scrolls, below 992 px. */
.aka-strip-arrow {
  display: none;
}
.aka-lib-count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: var(--ui-r-pill);
  background: var(--ui-track);
  color: var(--ui-muted);
  font-size: 12px;
  text-align: center;
}

/* ── Our own promotion under the card (template-parts/atlas/side.php): a card of the set ─────────────────────── */
.aka-promo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding: 20px;
  text-decoration: none !important;
}
.aka-promo:hover .aka-promo-button {
  background: var(--ui-accent);
}
.aka-promo-kicker {
  color: var(--ui-accent-ink);
  font: 600 11px/1.4 Poppins, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.aka-promo-title {
  color: var(--ui-ink);
  font: 600 17px/1.35 Poppins, sans-serif;
}
.aka-promo-text {
  color: var(--ui-text);
  font-size: 14px;
  line-height: 1.5;
}
.aka-promo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  padding: 9px 14px;
  border-radius: var(--ui-r-pill);
  background: var(--ui-accent-fill);
  color: #fff;
  font: 600 14px/1.3 Poppins, sans-serif;
  text-align: center;
  transition: background-color 0.15s ease;
}
.aka-promo-button svg {
  width: 13px;
  height: 13px;
}
.aka-promo-note {
  color: var(--ui-muted);
  font: 500 12px/1.4 Poppins, sans-serif;
}

/* ── An article beside the column (single.php) ───────────────────────────────────────────── */
.aka-art-layout .aka-art-main {
  min-width: 0;
}
html[data-ui] .aka-art-layout .herald-site-content,
html[data-ui] .aka-art-layout .herald-single {
  margin: 0 !important;
}
html[data-ui] .aka-art-layout .herald-single {
  padding: 28px 32px 20px;
}
/* Herald's article columns (a 9 of 12, and inside it the meta, the offset text column and the extras) fill the
   card here. Only those: the extras hold a grid of their own ("Zobacz też"), which keeps its columns. */
.aka-art-layout .herald-single > .row,
.aka-art-layout .col-mod-single > .row {
  margin-left: 0;
  margin-right: 0;
}
.aka-art-layout .herald-single > .row > .col-mod-single,
.aka-art-layout .col-mod-single > .row > [class*='col-'] {
  float: none;
  width: 100% !important;
  max-width: 100%;
  margin-left: 0 !important;
  padding-left: 0;
  padding-right: 0;
}
/* "Zobacz też" (template-parts/single/related.php): three tiles across the article, the picture on top and the
   category, the title and the date under it on the tile's surface, as a row of the library says them. */
.aka-related {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--ui-rim);
}
.aka-related-head {
  margin: 0 0 14px;
  color: var(--ui-muted);
  font: 600 12px/1.4 Poppins, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.aka-related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.aka-related-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ui-rim);
  border-radius: var(--ui-r-tile);
  background: var(--ui-track);
  text-decoration: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.aka-related-card:hover {
  border-color: var(--ui-accent);
  box-shadow: var(--ui-shadow-raised);
  transform: translateY(-2px);
}
.aka-related-card:focus-visible {
  outline: none;
  box-shadow: var(--ui-focus-ring);
}
.aka-related-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ui-track-strong);
}
.aka-related-thumb img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.aka-related-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}
.aka-related-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ui-ink);
  font: 600 15px/1.4 Poppins, sans-serif;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.aka-related-card:hover .aka-related-title {
  color: var(--ui-accent-ink);
}
.aka-related-text .aka-lib-row-meta {
  margin-top: auto;
}
@media (prefers-reduced-motion: reduce) {
  .aka-related-card {
    transition: none;
  }
  .aka-related-card:hover {
    transform: none;
  }
}
/* The covers carry their own words, so a tile keeps the whole picture on top at every width: two tiles across on a
   small tablet, one on a phone. */
@media (max-width: 767.98px) {
  .aka-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
@media (max-width: 575.98px) {
  .aka-related-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Below 992 px the column's two cards become items of the page's one column, so each takes its own place: in the
   library the search and the categories first, then the list, then the newsletter; in an article the article first,
   then the categories, then the newsletter. The newsletter card stood between the categories and the list and kept
   the first article off a phone's first screen. */
@media (max-width: 991.98px) {
  .aka-lib-aside {
    display: contents;
  }
  .aka-lib-side {
    order: 1;
  }
  .aka-lib-main {
    order: 2;
  }
  .aka-promo {
    order: 3;
    margin-top: 0;
  }
  .aka-art-layout .aka-art-main {
    order: 0;
  }
  html[data-ui] .aka-art-layout .herald-single {
    padding: 20px 16px 12px;
  }
}

/* ── Results ─────────────────────────────────────────────────────────────────────────────── */
.aka-lib-main {
  padding: 16px 20px 20px;
}
.aka-lib-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 8px;
}
/* The order as the portal's tabs: pills on the track, the chosen one the thumb. */
.aka-lib-tabs {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px;
  border-radius: var(--ui-r-pill);
  background: var(--ui-track);
  scrollbar-width: none;
}
.aka-lib-tab {
  flex: none;
  margin: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--ui-r-pill);
  background: transparent;
  color: var(--ui-text);
  font: 500 14px/1.4 Poppins, sans-serif;
  cursor: pointer;
}
.aka-lib-tab:hover {
  color: var(--ui-ink);
}
.aka-lib-tab.is-active {
  background: var(--ui-thumb);
  box-shadow: var(--ui-thumb-shadow);
  color: var(--ui-ink);
}
.aka-lib-tab:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
}
.aka-lib-found {
  margin: 0;
  color: var(--ui-muted);
  font: 500 13px/1.4 Poppins, sans-serif;
}
.aka-lib-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.aka-lib-list > li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--ui-rim);
}
.aka-lib-list > li::before {
  display: none;
}
.aka-lib-list > li:last-child {
  border-bottom: 0;
}
.aka-lib-row {
  display: flex;
  gap: 18px;
  padding: 14px 8px;
  border-radius: var(--ui-r-tile);
  text-decoration: none !important;
}
.aka-lib-row:hover {
  background: var(--ui-track);
}
.aka-lib-thumb {
  flex: none;
  width: 176px;
  height: 99px;
  overflow: hidden;
  border-radius: var(--ui-r-tile);
  background: var(--ui-track);
}
.aka-lib-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.aka-lib-row-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.aka-lib-row-kicker {
  color: var(--ui-accent-ink);
  font: 600 11px/1.4 Poppins, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.aka-lib-row-title {
  color: var(--ui-ink);
  font: 600 17px/1.35 Poppins, sans-serif;
}
.aka-lib-row:hover .aka-lib-row-title {
  color: var(--ui-accent-ink);
}
.aka-lib-row-title mark,
.aka-lib-row-lead mark {
  padding: 0;
  border-radius: 2px;
  background: rgba(44, 123, 229, 0.16);
  color: inherit;
}
.aka-lib-row-lead {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ui-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.aka-lib-row-meta {
  color: var(--ui-muted);
  font: 500 12px/1.4 Poppins, sans-serif;
}
.aka-lib-empty {
  margin: 24px 0;
  color: var(--ui-muted);
  text-align: center;
}
.aka-lib-more {
  display: block;
  margin: 16px auto 0;
  padding: 8px 22px;
  border: 0;
  border-radius: var(--ui-r-pill);
  background: var(--ui-track);
  color: var(--ui-ink);
  font: 600 14px/1.4 Poppins, sans-serif;
  cursor: pointer;
}
.aka-lib-more:hover {
  background: var(--ui-track-strong);
}
.aka-lib [hidden] {
  display: none !important;
}

/* Below 992 px the categories are one row of pills that scrolls sideways, as the portal's tab strips, so the
   first article is on the first screen. */
@media (max-width: 991.98px) {
  .aka-lib-side-label {
    display: none;
  }
  .aka-lib-search {
    margin-bottom: 12px;
  }
  .aka-lib-cats {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 2px;
    border-radius: var(--ui-r-pill);
    background: var(--ui-track);
    scrollbar-width: none;
  }
  .aka-lib-cats::-webkit-scrollbar {
    display: none;
  }
  /* A row that goes on past the edge fades there and shows an arrow, so a phone reader sees there is more. */
  .aka-strip {
    position: relative;
  }
  .aka-strip.has-next .aka-lib-cats {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent);
  }
  .aka-strip.has-prev .aka-lib-cats {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 56px);
    mask-image: linear-gradient(to right, transparent, #000 56px);
  }
  .aka-strip.has-prev.has-next .aka-lib-cats {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent);
  }
  .aka-strip.has-prev .aka-strip-arrow.is-prev,
  .aka-strip.has-next .aka-strip-arrow.is-next {
    display: flex;
  }
  .aka-strip-arrow {
    position: absolute;
    top: 50%;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--ui-rim);
    border-radius: 50%;
    background: var(--ui-thumb);
    box-shadow: var(--ui-thumb-shadow);
    color: var(--ui-ink);
    cursor: pointer;
    transform: translateY(-50%);
  }
  .aka-strip-arrow.is-prev {
    left: 4px;
  }
  .aka-strip-arrow.is-next {
    right: 4px;
  }
  .aka-lib-cats li {
    flex: none;
  }
  .aka-lib-cat {
    padding: 6px 12px;
    border-radius: var(--ui-r-pill);
    white-space: nowrap;
  }
  .aka-lib-cat:hover {
    background: transparent;
  }
  .aka-lib-count {
    min-width: 0;
    padding: 0 6px;
    background: transparent;
  }
}

/* On a phone the picture stands smaller beside the text and the lead goes, as the portal's lists keep a row short. */
@media (max-width: 575.98px) {
  .aka-lib {
    padding: 0 12px;
  }
  .aka-lib-head {
    padding: 16px;
  }
  .aka-lib-tile {
    width: 56px;
    height: 56px;
    font-size: 26px;
  }
  html[data-ui] .aka-lib-title {
    font-size: 22px;
  }
  .aka-lib-main,
  .aka-lib-side {
    padding: 14px;
  }
  .aka-lib-row {
    gap: 12px;
    padding: 12px 4px;
  }
  .aka-lib-thumb {
    width: 104px;
    height: 58px;
  }
  .aka-lib-row-title {
    font-size: 15px;
  }
  .aka-lib-row-lead {
    display: none;
  }
}
