/* ==========================================================================
   WCAG 2.2 AA fixes for the virginiaslostat.org archive.
   ==========================================================================

   Loaded LAST in every <head>, immediately after the theme's app.css, so it
   beats both foundation.css and app.css without any rule here needing
   !important -- except where it has to override an !important the theme itself
   set, which is called out at each site.

   The companion changes are in the markup itself; this file holds only what
   cannot be expressed there. Every declaration below exists to fix a
   specific success criterion, named in its comment. Contrast figures are
   measured against the colour actually painted behind the text, not against
   an assumed white.

   Theme note: the Appalachian-Trail-Histories theme is Foundation 6 with a
   ~4 KB app.css on top. Between them they use three Google Fonts families --
   Ubuntu (app.css), and Enriqueta and Oswald (foundation.css, via an @import
   rather than a <link>, which is why no HTML file mentions them). All three are
   self-hosted now; see
   themes/Appalachian-Trail-Histories-Theme-master/css/fonts.css. Text metrics
   shift slightly now that the intended faces actually load on a network that
   blocks Google -- the theme was designed for them.
   ========================================================================== */

/* ==========================================================================
   2.4.7 Focus Visible / 1.4.11 Non-text Contrast

   Foundation removes focus outlines only under [data-whatinput='mouse'], so
   keyboard focus was never suppressed -- but the default indicator is a 1px
   dotted ButtonText ring, which on a background photo is close to invisible.
   A yellow ring inside a near-black ring is perceivable on every surface this
   archive paints: white #primary, the #decd63 body band, the #114511 title
   bar, and the pale sepia header photo.

   :focus-visible, so mouse users see no change.
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ffe000;
  outline-offset: 0;
  box-shadow: 0 0 0 6px #1c1c1c;
  position: relative;
  z-index: 2;
}

/* app.css sets `a:hover { color: #7a6d6d !important }`; without this the ring
   disappears the moment the pointer happens to be over a focused link. */
a:hover:focus-visible,
a:active:focus-visible {
  outline: 3px solid #ffe000;
}

/* <main id="primary"> carries tabindex="-1" purely as the skip-link target;
   focusing it programmatically must not ring the whole page. */
main#primary:focus,
main#primary:focus-visible {
  outline: 0;
  box-shadow: none;
}

/* ==========================================================================
   2.4.1 Bypass Blocks

   No page had a skip link. Every page opens with the site title and a
   seven-item nav, so keyboard users hit eight stops before the content. The
   link is the first child of <body>.
   ========================================================================== */

#skipnav {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
}

#skipnav:focus {
  left: 0;
  width: auto;
  height: auto;
  padding: .5em 1em;
  background-color: #ffffff;
  color: #1b1715;                 /* 17.80:1 */
  text-decoration: underline;
  outline: 3px solid #ffe000;
  box-shadow: 0 0 0 6px #1c1c1c;
}

/* Used by the skip link's own text and by the map page's heading. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   1.4.3 Contrast -- the header over the background photograph

   #home and body carry themes/.../images/FoggyWoods_sepia.jpg, and the site
   title and the whole navigation sit directly on it: `.tinted-image`, the
   class the theme puts on the title's column, has no CSS anywhere in the
   archive, so nothing was ever tinted.

   Measured in a browser at 1280px, sampling the actual pixels behind the text
   with the text hidden, the darkest tree trunk under the nav strip is
   rgb(193,179,166):

     resting nav link   #a10010   4.07:1  FAIL (19.2px, so normal text)
     nav link hover     #7a6d6d   2.42:1  FAIL
     site title         #484c66   4.10:1  passes only as large text (72px)

   A colour tweak cannot fix the hover case -- #7a6d6d does not reach 4.5:1
   against that photo even under an 80%-white scrim -- so two things happen
   here. app.css's own `.top-bar li a:hover { color: #49030B }` is restored
   (the theme's blanket `a:hover ... !important` was overriding it), which
   takes hover to 6.65:1 or better on any pixel of the photo; and a white
   scrim goes behind the header block, which takes the resting link to 6.40:1
   and the title to 6.46:1 and, unlike a colour tweak, keeps holding if the
   photo is ever re-cropped or replaced.

   0.6 alpha is the lightest scrim that clears 4.5:1 for the resting link with
   margin; the commented-out `rgba(64,79,60,.5)` at the top of app.css shows
   the theme's author had considered the same idea.
   ========================================================================== */

.tinted-image,
#ap_trail_navigation {
  background-color: rgba(255, 255, 255, 0.6);
}

/* Beats app.css's `a:hover { color: #7a6d6d !important }` for nav links only;
   body copy on white keeps the theme's hover colour, which passes there
   (4.96:1). :focus is included so the keyboard sees what the mouse sees. */
.top-bar li a:hover,
.top-bar li a:focus {
  color: #49030B !important;      /* >= 6.65:1 on any pixel of the photo */
}

/* app.css sets `#secondary-nav { color: #ffffff }`. Every child is a link with
   its own colour today, so nothing visible fails -- but white on the white
   #primary panel is a trap for any text added later. */
#secondary-nav {
  color: inherit;
}

/* ==========================================================================
   1.4.3 Contrast -- <small> inside headings

   foundation.css:1312-1317 sets `h1 small ... { color: #cacaca }`, which is
   1.63:1 on the white content panel. It is the item count every browse page
   prints -- `<h1>Browse Items <small>(76 items total)</small></h1>` -- so this
   failed on all 74 of them. At 38.4px it is large text and needs 3:1; #58443f
   is the colour app.css already uses for h4/h5.
   ========================================================================== */

h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small {
  color: #58443f;                 /* 9.08:1 */
}

/* ==========================================================================
   1.4.1 Use of Color -- links inside prose

   Foundation removes link underlines, and app.css colours links #9c4d23. That
   is 6.00:1 against the white panel, so 1.4.3 passes -- but only 2.96:1 against
   the #1b1715 body text around them, under the 3:1 that 1.4.1 requires when
   colour is the only thing distinguishing a link. With no underline either,
   every in-text link on the About page, the exhibits and the breadcrumbs failed.

   Underlining is restored where links sit in running text. Lists of links --
   the nav, the pagination, the tag cloud -- are exempt: nothing surrounds them
   to be confused with, and underlining them would change the design for no
   accessibility gain. The exemptions come last and carry a class so they out-
   specify the rules above.
   ========================================================================== */

#primary p a,
#primary li a,
#primary td a,
#primary dd a,
#primary blockquote a,
#primary .tags a,
#primary .element-text a,
#primary #simple-pages-breadcrumbs a {
  text-decoration: underline;
}

#primary nav a,
#primary .hTagcloud a,
#primary .pagination a,
#primary .item-thumbnail,
#primary .download-file,
#primary .exhibit-page-nav a,
#primary .exhibit-nav-level-1 a,
#primary .exhibit-nav-level-2 a {
  text-decoration: none;
}

/* ==========================================================================
   2.5.8 Target Size (Minimum)

   Pagination numbers, the item prev/next links and the tag cloud were plain
   inline text: 19-22px tall with no padding and, in the tag cloud, wrapping
   lines that touch. 24x24 CSS pixels is the AA minimum.
   ========================================================================== */

.pagination a,
.pagination button,
.pagination .current span {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  padding: 4px 8px;
  line-height: 1.4;
}

.item-pagination a {
  display: inline-block;
  min-height: 24px;
  padding: 4px 8px;
}

.hTagcloud ul.popularity li {
  display: inline-block;
  margin: 0 6px 6px 0;
}

.hTagcloud ul.popularity li a {
  display: inline-block;
  min-height: 24px;
  padding: 4px 6px;
}

/* ==========================================================================
   1.4.10 Reflow

   No page may scroll horizontally at 320px.

   Three sources. The interactive map was embedded as a fixed
   <iframe width="1000">; the width/height attributes are gone and .map-embed
   sizes it fluidly with a 16:10 box. Item and exhibit images are
   served at their full width from the bucket (fullsize derivatives run past
   1000px). And the citation block carries an unbroken URL.
   ========================================================================== */

.map-embed {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  aspect-ratio: 16 / 10;
}

.map-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* aspect-ratio is well supported, but a fallback keeps the map from
   collapsing to zero height in anything that lacks it. */
@supports not (aspect-ratio: 1 / 1) {
  .map-embed { height: 625px; }
}

#primary img,
.map-popup img {
  max-width: 100%;
  height: auto;
}

#primary {
  overflow-wrap: break-word;
}


/* ==========================================================================
   1.3.1 Info and Relationships -- heading levels

   Item pages ran h1 (title) -> h4 (Description, Date, Creator, ...), skipping
   two levels; the metadata labels are now h2. Foundation sizes h2 at 2.5rem
   against h4's 1.5625rem, so .element-label restores exactly what an h4
   looked like -- both breakpoints, plus app.css's `h4,h5 { color: #58443f }`
   and `h3,h4,h5,h6 { font-weight: 300 }` and `h4 > i { color: #58443f }`.
   The rendered page is unchanged; only the outline is.
   ========================================================================== */

.element-label {
  font-size: 1.125rem;
  line-height: 1.4;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 300;
  color: #58443f;
}

.element-label > i {
  color: #58443f;
}

@media print, screen and (min-width: 40em) {
  .element-label {
    font-size: 1.5625rem;
  }
}

/* index.html's lead paragraph was an <h4> inside a <p>, which made the
   homepage outline h1 -> h4 and put a heading inside a paragraph. It is a
   <p class="lead"> now; keep the size it had. */
p.lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: #1b1715;
}

@media print, screen and (min-width: 40em) {
  p.lead {
    font-size: 1.5625rem;
    line-height: 1.5;
  }
}

/* The site title is a <p id="site-title"> rather than an <h1> on the 189 pages
   that have a real content heading, so each page has exactly one h1.
   app.css styles #site-title and #site-title a by id, so most of the look
   survives; these restore what came from the ELEMENT selectors.

   `font-family: Ubuntu` and not Foundation's Oswald: app.css's
   `h1,h2,h3,h4,h5,h6 { font-family: Ubuntu }` overrides foundation.css for
   headings, so the <h1> version renders in Ubuntu. Matching it matters --
   Oswald is far narrower, and getting this wrong made the title 243px on 189
   pages against 331px on the homepage. Written bare, exactly as app.css writes
   it, rather than with a fallback stack the rest of the theme does not have. */
p#site-title {
  font-family: Ubuntu;
  color: #484c66;
  line-height: 1.4;
  margin: 0 0 0.5rem;
}

/* 1.4.10 Reflow: at 72px the word "Virginia's" alone is 331px, so the title
   overflowed a 320px viewport. min() scales it below 655px and is exactly the
   theme's 72px above; a browser that does not understand min() ignores this and
   keeps app.css's fixed 72px. */
#site-title {
  font-size: min(72px, 11vw);
}

/* ==========================================================================
   1.3.1 -- the footer

   Two sibling <div id="footer"> made the id a duplicate on all 191 pages. They
   are wrapped in a <footer> landmark now, with the styling hook moved to a
   class; this is app.css's #footer rule, unchanged.
   ========================================================================== */

.footer-block {
  margin-top: 25px;
  padding: 0 50px 15px 50px;
}

.footer-logos img,
.footer-credit img {
  max-width: 100%;
  height: auto;
}

/* The GMU History and Art History logo that replaces the Omeka credit. The
   sizing is a rule rather than the inline `max-width: 300px` the sibling
   archives use, because inline styles win over `max-width: 100%` -- at 320px
   that 300px logo plus the footer's 50px gutters was 350px wide, the archive's
   only 1.4.10 Reflow failure at that width. `width: 100%` with a max caps it at
   300px on a desktop and lets it shrink below that on a phone. */
.footer-credit .histarthist-logo {
  margin: 0;
}

.histarthist-logo img {
  width: 100%;
  max-width: 300px;
  height: auto;
}

/* ==========================================================================
   Search

   Two surfaces: the form in the header of all 190 content pages, and the two
   search pages, which render Pagefind results through its core API and so bring
   no stylesheet of their own.
   ========================================================================== */

/* --- the header form ---------------------------------------------------- */

.site-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 8px;
}

.site-search input[type="search"] {
  height: 32px;
  margin: 0;
  padding: 0 8px;
  width: 9rem;
  border: 1px solid #58443f;
  border-radius: 3px;
  background: #ffffff;
  color: #1b1715;                 /* 17.80:1 */
  font-family: "Ubuntu", Helvetica, Roboto, Arial, sans-serif;
  font-size: 14px;
  box-shadow: none;
}

/* 1.4.3: Foundation's default placeholder is #cacaca -- 1.6:1 on white. */
.site-search input::placeholder {
  color: #6b5d57;                 /* 5.32:1 on #ffffff */
  opacity: 1;
}

.site-search button {
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: #114511;
  color: #fefefe;                 /* 11.06:1 */
  font-family: "Ubuntu", Helvetica, Roboto, Arial, sans-serif;
  font-size: 14px;
  cursor: pointer;
}

.site-search button:hover {
  background: #0d370d;            /* 13.38:1 against #fefefe */
}

/* Below 40em the whole nav, this form included, is inside the collapsed
   menu, so let it use the full width there rather than staying 9rem. */
@media screen and (max-width: 40em) {
  .site-search {
    padding: 8px;
  }
  .site-search input[type="search"] {
    width: 100%;
    flex: 1 1 auto;
  }
}

/* --- the search pages --------------------------------------------------- */

.archive-search {
  margin: 0 0 1.5rem;
}

.archive-search label {
  display: block;
  font-weight: 500;
  margin-bottom: .25rem;
}

.archive-search input[type="search"] {
  height: 40px;
  max-width: 28rem;
  margin: 0 0 .5rem;
  padding: 0 10px;
  border: 1px solid #58443f;
  border-radius: 3px;
  color: #1b1715;
  font-family: "Ubuntu", Helvetica, Roboto, Arial, sans-serif;
  box-shadow: none;
}

.archive-search > button {
  height: 40px;
  margin: 0 0 .5rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 3px;
  background: #114511;
  color: #fefefe;
  font-family: "Ubuntu", Helvetica, Roboto, Arial, sans-serif;
  cursor: pointer;
}

.archive-search > button:hover {
  background: #0d370d;
}

.search-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.search-facets fieldset {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid #cacaca;
  padding: .5rem .75rem 1rem;
  margin: 0;
}

.search-facets legend {
  padding: 0 .4rem;
  font-weight: 500;
  color: #58443f;                 /* 9.08:1 */
}

.search-facets label {
  display: block;
  min-height: 24px;               /* 2.5.8 Target Size */
  padding: 2px 0;
  line-height: 1.4;
  cursor: pointer;
}

.facet-count {
  color: #58443f;                 /* 9.08:1 -- not #cacaca */
}

/* A facet value that would currently return nothing. Dimmed but still 4.6:1,
   because 1.4.3 has no exemption for "looks disabled". */
.search-facets label.facet-empty {
  color: #6b5d57;                 /* 5.32:1 */
}

.search-status {
  margin: 1rem 0;
  font-weight: 500;
}

.search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result {
  padding: .75rem 0;
  border-top: 1px solid #e4e0da;
}

.search-result h2 {
  font-size: 1.1875rem;
  margin: 0 0 .25rem;
}

.search-excerpt {
  margin: 0 0 .25rem;
}

.search-excerpt mark {
  background: #ffe9a8;
  color: #1b1715;                 /* 15.3:1 */
}

.search-meta {
  margin: 0;
  font-size: .875rem;
  color: #58443f;                 /* 9.08:1 */
}

.search-more-button {
  margin: 1rem 0;
  padding: .5rem 1rem;
  min-height: 24px;
  border: 0;
  border-radius: 3px;
  background: #114511;
  color: #fefefe;
  font-family: "Ubuntu", Helvetica, Roboto, Arial, sans-serif;
  cursor: pointer;
}

.search-more-button:hover {
  background: #0d370d;
}

/* ==========================================================================
   Notes for content that markup cannot fix

   .missing-embed / .missing-image are used where something the crawl could not
   recover is replaced by a note rather than left as a broken box.
   ========================================================================== */

.missing-embed,
.missing-image {
  padding: .75rem 1rem;
  border-left: 4px solid #9c4d23;
  background: #f6f2ee;
  color: #1b1715;                 /* 15.9:1 */
}

/* ==========================================================================
   1.4.10 Reflow -- small screens

   Last in the file on purpose: `.footer-block` and `#primary` both set padding
   with a shorthand, so an override has to come after them to win. The theme's
   50px gutters leave 220px of content at 320px; Foundation's own gutter is
   15px.
   ========================================================================== */

@media screen and (max-width: 40em) {
  #primary {
    padding-left: 15px;
    padding-right: 15px;
  }

  .footer-block {
    padding-left: 15px;
    padding-right: 15px;
  }
}
