/* Library additions on top of the WP theme's Sass (which stays unchanged in src/_sass/):
   essay-page details (presented date, link to the original PDF) and the Pagefind search UI.
   Colours are the theme's: black-chocolate #130900, floral-white #fef9ef, gold-metallic #d4af37. */

/* ---- Essay pages ---- */
.essay-presented {
  margin: 0.35em 0 0;
  font-style: italic;
  opacity: 0.85;
}

.essay-no-text {
  font-style: italic;
}

.essay-original {
  margin: 2.5em 0 0;
  padding-top: 1.5em;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
}

.essay-original--only {
  margin-top: 1em;
  padding-top: 0;
  border-top: 0;
}

.essay-original {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em 3em;
}

.essay-original__link {
  display: inline-flex;
  align-items: center;
  gap: 1.25em;
  text-decoration: none;
}

.essay-original__thumb {
  display: block;
  width: 120px;
  height: auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: transform 200ms ease-in-out;
}

.essay-original--only .essay-original__thumb {
  width: 200px;
}

.essay-original__link:hover .essay-original__thumb {
  transform: translateY(-2px);
}

.essay-original__text {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.essay-original__text strong {
  font-weight: 400;
  border-bottom: 2px solid rgba(212, 175, 55, 0.4);
  align-self: flex-start;
}

.essay-original__link:hover .essay-original__text strong {
  border-color: rgba(212, 175, 55, 0.8);
}

.essay-original__meta {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  opacity: 0.75;
}

@media (max-width: 480px) {
  .essay-original__link {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Library search (Pagefind UI) ---- */
.library-search {
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: #d4af37;
  --pagefind-ui-text: #fef9ef;
  --pagefind-ui-background: #1d1206;
  --pagefind-ui-border: rgba(212, 175, 55, 0.35);
  --pagefind-ui-tag: rgba(212, 175, 55, 0.2);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 4px;
  --pagefind-ui-image-border-radius: 2px;
  --pagefind-ui-image-box-ratio: 3 / 4;
  --pagefind-ui-font: system-ui, -apple-system, sans-serif;
  margin-bottom: 96px;
}

.library-search .pagefind-ui__result-link {
  color: #fef9ef;
  font-family: 'Lora', Georgia, serif;
  text-decoration: none;
  border-bottom: 2px solid rgba(212, 175, 55, 0.4);
}

.library-search .pagefind-ui__result-link:hover {
  border-color: rgba(212, 175, 55, 0.8);
  text-decoration: none;
}

.library-search .pagefind-ui__result-thumb:not(:has(img)) {
  display: none; /* title-only entries have no image */
}

.library-search .pagefind-ui__result-image {
  background: #fff;
}

.library-search .pagefind-ui__result-excerpt mark {
  background: rgba(212, 175, 55, 0.35);
  color: inherit;
}

/* Dark search bar, in the theme's colours: gold hairline, gold on focus */
.library-search .pagefind-ui__search-input {
  color: #fef9ef;
  background: #1d1206;
  border-color: rgba(212, 175, 55, 0.4);
  font-family: 'Lora', Georgia, serif;
  font-weight: 400;
  transition: border-color 200ms ease-in-out;
}

.library-search .pagefind-ui__search-input:focus {
  outline: none;
  border-color: #d4af37;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.5);
}

.library-search .pagefind-ui__search-input::placeholder {
  color: rgba(254, 249, 239, 0.45);
  font-style: italic;
  opacity: 1;
}

.library-search .pagefind-ui__search-clear {
  color: rgba(254, 249, 239, 0.7);
  background: transparent;
}

.library-search .pagefind-ui__search-clear:hover {
  color: #d4af37;
}

/* Filter headings (Author, Decade…) in the theme's serif. #search outranks Pagefind's
   doubled .svelte-… class selectors. */
.library-search #search .pagefind-ui__filter-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}

.library-search .pagefind-ui__filter-name,
.library-search .pagefind-ui__filter-label,
.library-search .pagefind-ui__message,
.library-search .pagefind-ui__button {
  color: #fef9ef;
}

.library-search .pagefind-ui__button {
  background: transparent;
}

.library-search .pagefind-ui__button:hover {
  border-color: #d4af37;
}

.library-search__noscript {
  text-align: center;
}

/* resetStyles is off (so the theme's fonts apply), so undo the browser defaults Pagefind's reset would have */
.library-search fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* The magnifier, in gold to match the bar's border */
.library-search .pagefind-ui__form::before {
  background-color: #d4af37;
  opacity: 0.8;
}

.library-search .pagefind-ui__search-clear {
  border: 0;
  font-family: system-ui, sans-serif;
  cursor: pointer;
}

/* Wider than the theme's text column, so the filters can sit beside the results */
@media (min-width: 1024px) {
  .library-form-wrapper.library-search {
    width: auto;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 40px;
  }
}

/* ---- Footnotes in transcribed essays (markdown-it-footnote) ---- */
.footnotes-sep {
  border: 0;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  margin: 3em 0 1.5em;
}

.footnotes {
  font-size: 0.85em;
  overflow-wrap: anywhere; /* long URLs in notes */
}

.footnote-ref a,
.footnote-backref {
  text-decoration: none;
}

/* ---- Standard copyright notice (club policy: essays are copyrighted by their authors) ---- */
/* .type-essay prefix: the theme zeroes paragraph top margins in essays */
.type-essay .entry-content .essay-copyright {
  margin: 2.5em 0 0;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  opacity: 0.7;
}

/* ---- Pictures in transcribed essays (<figure> blocks from scripts/import-transcript.mjs) ---- */
.entry-content figure {
  margin: 2em 0;
  text-align: center;
}

.entry-content figure img {
  max-width: 100%;
  height: auto;
  background: #fff;
}

.entry-content figcaption {
  margin-top: 0.6em;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.85;
}

/* Filter options with no matches are marked hidden by library-search.js */
.library-search #search .pagefind-ui__filter-value[hidden] {
  display: none;
}

/* Long URLs in bibliographies and notes wrap instead of running out of the column */
.type-essay .entry-content {
  overflow-wrap: break-word;
}

/* ---- Tables in transcribed essays ---- */
.entry-content table {
  display: block; /* lets a wide table scroll on its own instead of widening the page */
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1em 0 2em;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

.entry-content th,
.entry-content td {
  padding: 0.5em 0.75em;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  vertical-align: top;
}

.entry-content th {
  font-weight: 600;
  border-bottom-color: rgba(212, 175, 55, 0.55);
  vertical-align: bottom;
}

/* ---- Block quotes in essays: a thin gold rule instead of the browser's bare indent ---- */
.type-essay .entry-content blockquote {
  margin: 1.5em 0;
  padding-left: 1.25em;
  border-left: 2px solid rgba(212, 175, 55, 0.4);
}

/* ---- Essay titles: long ones get a readable measure instead of spanning the window ---- */
.essay-page-title {
  max-width: 20em;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
  text-wrap: balance;
}
