/******************* Form layout styling *******************/
/*search bar at the top*/
#form-search-bar input, 
#form-search-bar select,
#form-search-bar .custom-select {
  width: 100%;
  margin: 0;
  margin-bottom: 0.5em;
}
#search-bar-cont {
  position: relative;
}
#form-search-bar input {
  padding-right: 1.5em;
}
#search-bar-clear { /*styling search bar clear button*/
  position: absolute;
  top: 50%;
  right: 0.5em;
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  user-select: none;
  display: none;
  transition: var(--trans) ease;
}
.has-js input ~ #search-bar-clear { /*only show with js*/
  display: block;
  visibility: visible;
  opacity: 1;
  transform: translate(0, -50%) scale(1);
}
.has-js input:placeholder-shown ~ #search-bar-clear { /*hide when there's no input*/
  visibility: hidden;
  opacity: 0;
  transform: translate(0, -50%) scale(0);
}
#search-bar-clear::before,
#search-bar-clear::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 0.75em;
  background: var(--light-text);
  transform-origin: center center;
  transform: translate(-50%, -50%) rotate(45deg);
  transition: inherit;
}
#search-bar-clear::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
#search-bar-clear:hover {
  background: var(--light-bg);
  cursor: pointer;
}
#search-bar-clear:hover::before,
#search-bar-clear:hover::after {
  background: var(--med-text);
}
/*side-by-side styling of search bar on larger screens*/
@media (min-width: 25em) {
  #form-search-dropdowns {
    display: flex;
  }
  #form-search-dropdowns select,
  #form-search-dropdowns .custom-select {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 11em;
    width: 11em;
  }
  #form-search-dropdowns select:first-child,
  #form-search-dropdowns select:first-child + .custom-select {
    margin-right: 0.5em;
  }
}
@media (min-width: 37.5em){
  #form-search-bar {
    display: flex;
  }
  #form-search-dropdowns {
    flex-basis: auto;
    flex-grow: 0;
    flex-shrink: 0;
    margin-right: 0.5em;
  }
  #form-search-bar #search-bar-cont {
    flex-grow: 1;
    flex-basis: 0;
  }
  #form-search-dropdowns select,
  #form-search-dropdowns .custom-select,
  #form-search-bar input {
    margin-bottom: 0;
  }
}

/*character filter styline*/
#filter-len-cont input {
  margin-top: 0;
  width: 100%;
  max-width: 6em;
  display: inline-block;
}
#filter-len-cont input:first-of-type {
  margin-right: 1em;
}
/*side-by-side styling of category + plural/singular nouns,
and also the character filters*/
@media (min-width: 20em){
  #filter-nc-cont {
    display: flex;
    align-items: stretch;
  }
  #filter-nc-cont > * {
    flex: 1 1 0;
  }
  #filter-nc-cont > *:first-child {
    margin-right: 1em;
  }
}
@media (min-width: 35em){
  #filter-dropdowns-cont,
  #filter-character-cont {
    display: flex;
  }
  #filter-dropdowns-cont > *:first-child,
  #filter-character-cont > *:first-child {
    margin-right: 1em;
    flex: 1 1 0;
  }
  #filter-dropdowns-cont #filter-nc-cont,
  #filter-character-cont #filter-len-cont {
    flex: 1.5 1.5 0;
  }
}

/*side-by-side styling of adjusting results*/
@media (min-width: 40em){
  #adjust-cont {
    display: flex;
  }
  #adjust-cont > *:first-child {
    margin-right: 3em;
    flex: 1 1 0;
  }
  #adjust-cont > *:nth-child(2){
    flex: 1 1 0;
  }
}

/*remove margin on bottom of fieldset for information to return*/
#adjust-info {
  margin-bottom: 0;
}

/*styling for the reset and submit buttons on the form*/
button.reset.secondary {
  margin-bottom: 0;
}
#form-end-buttons {
  margin-top: 1.5em;
}
#submit-button, #reset-button {
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 30em){ /*side-by-side styling of buttons*/
  #form-end-buttons {
    display: flex;
  }
  #submit-button, #reset-button { 
    margin: 0;
  }
  #submit-button {
    margin-right: 1em;
  }
}

/******************* Handling modal styling of form (when there's search results) + modification modals *****************/
.no-js #modal-form .modal-title,
.no-js #show-modal,
.modification-modal { /*hiding modal styling without js + modification modals on default*/
  display: none;
}
.has-js .modal-overlay { /*overlay (container)*/
  position: fixed;
  display: flex; /*for vertical/horizontal centering of modal*/
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  padding: 1.5em 0;
  background: rgba(0, 0, 0, 0.75);
  overflow-y: scroll;
  z-index: 99999;
  visibility: hidden;
  opacity: 0;
}
@supports (scrollbar-gutter: stable){
  .has-js .modal-overlay {
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
}
.has-js .modal-overlay.active {
  visibility: visible;
  opacity: 1;
}
.has-js .modal-overlay .modal-content { /*content styling*/
  position: relative;
  width: 95%;
  max-width: 50em;
  margin: auto;
  padding: 2em 1em;
  background: white;
  border-radius: var(--radius);
}
@media (min-width: 30em){
  .has-js .modal-overlay .modal-content {
    width: 90%;
    padding: 2em 2em;
    padding: 2em min(5vw, 5em);
  }
}
.has-js .modal-overlay .modal-title {
  font-weight: var(--bold-weight);
  font-size: 1.5em;
  color: var(--dark-text);
  text-align: center;
}
.has-js .modal-overlay .modal-close { /*close button*/
  position: absolute;
  top: 0.75em;
  right: 0.75em;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  transition: var(--trans) ease;
}
.has-js .modal-overlay .modal-close:hover {
  cursor: pointer;
  background: var(--light-bg);
}
.has-js .modal-overlay .modal-close::before,
.has-js .modal-overlay .modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.1em;
  height: 2px;
  transform-origin: center center;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--med-text);
  transition: inherit;
}
.has-js .modal-overlay .modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.has-js .modal-overlay .modal-close:hover::before,
.has-js .modal-overlay .modal-close:hover::after {
  background: var(--dark-text);
}
.has-js .modification-modal { /*modification modal specific styling*/
  transform: scale(0.25);
  transition-duration: inherit;
  transition-timing-function: ease-out;
}
.has-js .modal-overlay.active .modification-modal {
  transform: scale(1);
}
.has-js .modification-modal .record-info {
  margin-bottom: 1.5em;
}
.has-js .modification-modal .record-info p {
  margin: 0.25em 0;
}
.has-js .modification-modal .modal-subtitle {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
.has-js .modification-modal .modal-subtitle + * {
  margin-top: 0.5em;
}


/********************************* Styling results *********************************/
/*general*/
#results-cont, #table-results-cont { /*to make sure that table isn't larger than necessary*/
  width: fit-content;
  max-width: 100%;
  position: relative;
}
#result-title {
  margin: 1em 0 0.25em 0;
}
#table-results-cont {
  z-index: 0;
  overflow-x: auto;
}

/*empty results*/
#empty-results {
  text-align: center;
}
#empty-results img {
  width: 100%;
  max-width: 30em;
  display: block;
  margin: 2.5em auto;
}
#empty-results #show-modal {
  margin: 0 auto;
  margin-top: 1.25em;
}

/*overflow arrows*/
.overflow-arrows {
  position: sticky;
  top: 0;
  width: 0;
  height: 100vh;
  z-index: 1; /*must be larger than z-index of #table-results-cont to constrain header element*/
  visibility: hidden;
  opacity: 0; /*hide on default until made visible with js*/
  transition: var(--trans) ease;
}
.overflow-arrows.visible {
  visibility: visible;
  opacity: 1;
}
#overflow-left { /*remove from flow*/
  float: left;
}
#overflow-right {
  float: right;
}
.overflow-arrows:hover {
  cursor: pointer;
}
.overflow-arrows::before { /*clickable area*/
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: var(--body-padding);
  background: white; /*white to constrain header element*/
  height: 100%;
  z-index: 1;
}
#overflow-left::before {
  transform: translateX(-100%);
}
.overflow-arrows .inner-arrow { /*actual arrow element*/
  content: "";
  position: absolute;
  top: 50%;
  width: var(--body-padding);
  height: var(--body-padding);
  z-index: 2;
}
#overflow-left .inner-arrow {
  right: 0;
}
#overflow-right .inner-arrow {
  left: 0;
}
.overflow-arrows .inner-arrow::before { /*circle behind everything*/
  width: 100%;
  height: 100%;
  max-width: 2.25em;
  max-height: 2.25em;
}
.overflow-arrows:hover .inner-arrow::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.1;
}
.overflow-arrows .inner-arrow::after { /*arrow*/
  width: 40%;
  height: 40%;
  max-width: 0.75em;
  max-height: 0.75em;
}
#overflow-left .inner-arrow::after {
  transform: translate(-40%, -50%) rotate(-225deg);
}
#overflow-right .inner-arrow::after {
  transform: translate(-60%, -50%) rotate(-45deg);
}
/*disabled styling*/
.overflow-arrows.disabled {
  pointer-events: none;
}
.overflow-arrows.disabled .inner-arrow::before {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}
.overflow-arrows.disabled .inner-arrow::after {
  border-right-color: var(--light-text);
  border-bottom-color: var(--light-text);
  opacity: 0.5;
}
/*gradient indication on smaller screens*/
@media (max-width: 30em){
  .overflow-arrows::after {
    content: "";
    position: absolute;
    width: var(--body-padding);
    height: 100%;
    top: 0;
    z-index: 2;
    transition: var(--trans) ease;
  }
  #overflow-left::after {
    right: 0;
    background: linear-gradient(white, transparent 15%, transparent 85%, white),
                linear-gradient(90deg, rgba(var(--main-col-rgb), 0.1), transparent);
  }
  #overflow-right::after {
    left: 0;
    background: linear-gradient(white, transparent 15%, transparent 85%, white),
                linear-gradient(90deg, transparent, rgba(var(--main-col-rgb), 0.1));
  }
  .overflow-arrows.disabled::after {
    opacity: 0;
  }
}
/*top part styling*/
#result-top-cont {
  position: relative;
  z-index: 5; /*to prevent hover outline from being cut off by the arrows on smaller screens*/
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 0.5em;
}
#result-top-cont button {
  margin: 0;
  flex-grow: 1;
}
#result-top-cont > div {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5em 0;
}
#result-top-cont > div:first-child {
  flex-wrap: wrap;
  gap: 0.5em;
}
#result-top-cont > div > p {
  margin: 0 0.5em;
}
@media (max-width: 25em){
  #result-top-cont > * {
    flex-grow: 1;
  }
}
.no-js #download-csv { /*hide csv download button without js*/
  display: none;
}

/*table overall styling*/
#results-table {
  border-collapse: collapse;
  transition: var(--long-trans) ease-out;
}
#results-table thead {
  position: relative;
  /*position: sticky; /*won't work with #table-results-cont overflow x being auto :/ due to nearest scrollable container...*/
  top: 0;
  background: var(--main-col);
  color: white;
  z-index: 1;
}
#results-table th {
  position: relative;
  padding: 0;
  font-weight: var(--bold-weight);
  text-align: left;
  border-bottom: none;
}
#results-table th:not(.sortable), #results-table th.sortable a { /*padding is either on th or a for sortable headers*/
  padding: 1em 0.75em;
}
#results-table th.sortable a {
  position: relative;
  padding-right: 1.5em; /*extra padding to make it less cramped*/
  color: white;
  border-bottom: none;
  display: block;
  background: none;
  z-index: 1;
}
#results-table th.sortable .sort-icons { /*sortable icon styling*/
  position: absolute;
  top: 50%;
  right: 0.75em;
  width: 0.5em;
  display: flex;
  flex-direction: column;
  transform: translate(50%, -50%);
}
#results-table th.sortable .sort-arrow {
  width: 0;
  height: 0;
  border: 0.25em solid transparent; 
  border-bottom-color: white;
  opacity: 0.4;
  transition: var(--trans) ease;
}
#results-table th.sortable .sort-arrow.active,
#results-table th.sortable a:hover ~ .sort-icons .sort-arrow.active {
  opacity: 1;
}
#results-table th.sortable .sort-arrow.inactive,
#results-table th.sortable a:hover ~ .sort-icons .sort-arrow.inactive {
  opacity: 0;
}
#results-table th.sortable .sort-desc {
  margin-top: 0.25em;
  transform: scaleY(-1);
}
#results-table th.sortable a:hover ~ .sort-icons .sort-arrow {
  opacity: 0.75;
}
#results-table tbody tr { /*table body styling*/
  border-bottom: 2px solid var(--light-bg);
  transition: var(--trans) ease;
}
#results-table tbody tr:hover,
#results-table tbody tr:focus {
  background: var(--light-bg);
}
#results-table td {
  position: relative;
  padding: 0.5em 0.75em;
}
#results-table td:first-child,
#results-table th:first-child:not(.sortable),
#results-table th:first-child.sortable a {
  padding-left: 1.25em;
}
#results-table td:last-child,
#results-table th:last-child:not(.sortable) {
  padding-right: 1.25em;
}

/*specific content styling*/
/*modification asterisk*/
#results-table .modification-icon {
  position: absolute;
  top: 50%;
  left: 0.5em;
  padding: 0 0.25em;
  font-size: 1.25em;
  transform: translate(-50%, -50%);
  transition: var(--trans) ease;
}
#results-table .modification-icon::before {
  width: 80%;
  height: 80%;
  z-index: 0;
}
#results-table .modification-icon span {
  position: relative;
  display: block;
  line-height: 0.5em;
  padding: 0.25em 0;
  z-index: 1;
}
#results-table .modification-icon:hover {
  color: var(--main-col);
}

/*alternate spellings*/
.alternate-spelling {
  display: block;
  color: var(--light-text);
  font-style: italic;
}

/*pages container*/
#pages-cont {
  text-align: center;
  margin-top: 1em;
}
#page-links {
  margin: 0.5em 0;
}

/*page buttons - general layout*/
#page-links {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#page-links > * {
  margin-right: 0.5em;
}
#page-links > *:last-child {
  margin-right: 0;
}
#prev-page-cont, #next-page-cont {
  padding: 0.5em 0;
}
#prev-page-cont {
  text-align: right;
}
#next-page-cont {
  text-align: left;
}
#page-links-middle {
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/*page buttons - dots (when there's too many links)*/
#page-links-middle .page-link-dots {
  position: relative;
  margin-left: 0.75em;
  margin-right: 0.75em;
}
#page-links-middle .page-link-dots,
#page-links-middle .page-link-dots::before,
#page-links-middle .page-link-dots::after {
  content: "";
  width: 2px;
  height: 2px;
  background: var(--med-text);
  border-radius: 50%;
}
#page-links-middle .page-link-dots::before {
  position: absolute;
  top: 0;
  left: -3px;
  transform: translateX(-100%);
}
#page-links-middle .page-link-dots::after {
  position: absolute;
  top: 0;
  right: -3px;
  transform: translateX(100%);
}

/*page buttons - numbers */
.page-link {
  flex: 0 0 1.75em;
  width: 1.75em;
  position: relative;
  color: var(--link);
  padding: 0.5em 0em;
  margin: 0em 0.25em;
}
.page-link.active {
  color: white;
  pointer-events: none;
}
.page-link::before,
.page-link::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--link);
  opacity: 0.25;
  transform: translate(-50%, -50%);
  z-index: -1;
  transition: var(--trans) ease;
}
.page-link::after {
  border: none;
  background: var(--link);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}
.page-link.active::before {
  background: var(--link);
  border-color: transparent;
  opacity: 1;
}
.page-link:hover::before {
  opacity: 0.1;
}
.page-link:hover::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.1;
}

/*previous and next page buttons*/
.prev-page-link, .next-page-link {
  width: 1.75em;
  height: 1.75em;
}
.prev-page-link::after, .next-page-link::after {
  width: 0.55em;
  height: 0.55em;
}