:root,
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: system-ui, sans-serif;
}

:root {
  --hover: #0005;
  --elevated: #0003;
  --app-background: #fff;
}

:root {
  --default-hover: #0002;
  --default-active: #0004;
  --default-border: #0004;
  --default-background: #f0f0f0;
  --default-color: #000;
  --default-greyed-color: #0008;
  --default-elevated: #0001;
  --default-app-background: #eee;
  color: var(--color, var(--default-color));
  background: #8f908f;
}

body {
  display: flex;
  flex-flow: column nowrap;
  background: var(--app-background, var(--default-app-background));
}

pywb-webview {
  flex: 1 1 auto;
  --background: #9e131e;
  --color: #fff;
}

body#search,
body#home {
  margin: 0 auto;
  height: auto;
  max-width: 1680px;
  box-sizing: border-box;
  word-break: break-word;
  min-height: 100%;
}

header,
main {
  padding: 1rem;
  max-width: 68em;
  margin: 0 auto;
  width: 90%;
}

main {
  flex: 1 1 auto;
}

#search_bar {
  margin: 2em 0;
}

#tabs,
#facets {
  display: flex;
  flex-flow: row nowrap;
  gap: 0.5rem;
  padding: 0.25rem;
  margin: 0.5rem -0.25rem;
  overflow: auto;
  white-space: nowrap;
}

#tabs a {
  flex: 0 0 auto;
  background: var(--background, var(--default-background));
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

#tabs a:hover,
#tabs a:focus {
  background: var(--hover, var(--default-hover));
}

#tabs a.current {
  background: var(--active, var(--default-active));
}

label {
  display: flex;
  flex-flow: column nowrap;
  flex: 0 0 auto;
  border-radius: 0.5rem;
  padding: 0.25rem;
  margin: 0.25rem;
  position: relative;
  background: var(--background, var(--default-background));
  min-width: 7rem;
}

label:hover {
  background: var(--active, var(--default-active));
}

label:focus-within {
  outline: auto;
  background: var(--active, var(--default-active));
}

label span {
  font-size: 0.75rem;
  padding: 0 0.25rem;
  opacity: 0.75;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: calc(100% - 1rem);
  font-weight: 600;
}

label select,
label input {
  flex: 1 1 auto;
  font: inherit;
  background: none;
  margin: 0;
  border: none;
  outline: none;
  color: inherit;
}

label select input {
  padding: 0 0.5rem;
}

h2 {
  margin: 0;
  font-size: 1em;
}

em {
  background: #ff0;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
}

a {
  color: inherit;
  text-decoration: none;
}

body#search main {
  display: flex;
  flex-flow: row wrap;
  gap: 0.5rem;
}

#performance {
  padding: 0 0.75rem;
}

section.container {
  display: flex;
  flex-flow: row nowrap;
  gap: inherit;
  overflow: auto;
}

section.container article {
  flex: 0 0 96%;
  overflow: auto;
}

section.container.image_container {
    display: contents;
}

section.container.image_container article{
    display: none;
    flex: 1 1 auto;
}

section.container.image_container article:first-child {
    display: block;
}

article {
  /* background: var(--background, var(--default-background)); */
  border: 1px solid var(--border, var(--default-border));
  border-radius: 0.5rem;
  display: block;
  flex: 1 1 100%;
  margin: 0;
  padding: 1rem;
  max-width: 100%;
  box-sizing: border-box;
}

article a:hover,
article a:focus {
  text-decoration: underline;
}

article h2::before {
  color: #888;
  content: "web_asset";
  display: inline-block;
  font-family: "Material Symbols Outlined";
  font-size: 1.5em;
  font-variation-settings: "FILL" 1;
  font-weight: normal;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  vertical-align: -0.25em;
  width: 1em;
}

article .date {
  float: right;
  font-size: 0.8rem;
}

article[data-type="text"] h2::before {
  content: "description";
}

article[data-type="font"] h2::before {
  content: "brand_family";
  color: #ff0000;
}

article[data-type="html"] h2::before {
  content: "web";
  color: #e34f26;
}

article[data-type="css"] h2::before {
  content: "css";
  color: #1b73ba;
}

article[data-type="js"] h2::before {
  content: "javascript";
  color: #e9ca32;
}

article[data-type="json"] h2::before {
  content: "data_object";
  color: #e9ca32;
}

article[data-type="xml"] h2::before {
  content: "code";
}

article[data-type="rss"] h2::before {
  content: "rss_feed";
  color: #f80;
}

article[data-type="pdf"] h2::before {
  content: "file_present";
  color: #b30b00;
}

article[data-type="audio"] h2::before {
  content: "audio_file";
  color: #2ebd59;
}

article[data-type="video"] h2::before {
  content: "video_file";
  color: #f00;
}

article[data-type="image"] {
  flex: 1 1 auto;
  display: grid;
  grid-template-areas: "size date" "image image" "url url";
  grid-template-rows: auto 1fr auto;
  grid-template-columns: auto 1fr;
  row-gap: 0.25rem;
  column-gap: 0;
  overflow: hidden;
  padding: 0.25rem;
  position: relative;
}

article[data-type="image"] .img {
  grid-area: image;
  width: auto;
}

article[data-type="image"] img {
  height: 200px;
  object-fit: contain;
  width: 100%;
  min-width: 100px;
  background: var(--background, var(--default-background));
}

article[data-type="image"] .url {
  font-size: 0.8rem;
  grid-area: url;
  text-overflow: ellipsis;
}

article[data-type="image"] .url .fragment {
  display: none;
}

article[data-type="image"] .size {
  padding-right: 0.5rem;
  font-size: 0.8rem;
  grid-area: size;
  text-overflow: ellipsis;
}

article[data-type="image"] .date {
  grid-area: date;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s;
  text-align: right;
}

article p {
  margin: 0;
  padding: 0;
}

article p.highlight {
  border-top: 1px solid;
  margin-top: 0.25em;
  padding-top: 0.25em;
}

article p.highlight.expandable {
  position: relative;
  padding-bottom: 1.5lh;
}

article p.highlight.expandable.collapsed {
  max-height: 3lh;
  overflow: hidden;
}

article p.highlight.expandable::after {
  content: "Weniger zeigen";
  padding-top: 2lh;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: block;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}

article p.highlight.expandable.collapsed::after {
  content: "Mehr zeigen";
  background: linear-gradient(0deg, var(--app-background) 1lh, #0000);
}

footer {
  display: flex;
  flex-flow: column nowrap;
  padding: 1rem 0 0 0;
  justify-content: center;
  align-items: space-around;
}

footer .row-0,
footer .row-1,
footer .row-2 {
  padding: 2rem;
  display: flex;
  flex-flow: row wrap;
  justify-content: space-around;
  gap: 1em;
}

footer .row-1 {
  background: #0001;
  padding: 4rem;
}

footer .row-2 {
  padding: 1rem;
  background: #000c;
  color: #fff;
  font-size: 0.8em;
  justify-content: center;
  width: auto;
  max-width: none;
  margin: 0;
}

footer .row-2 a {
  text-decoration: underline;
}

footer .row-2 span {
  flex: 1 1 auto;
  text-align: right;
}

@media (max-width: 900px) {
  footer .row-2 span {
    text-align: center;
  }
}

.button {
  border: 1px solid var(--border, var(--default-border));
  border-radius: 2rem;
  box-sizing: border-box;
  padding: 0.5rem 1rem;
  text-align: center;
  width: fit-content;
}

.button:hover,
.button:focus {
  background: var(--hover, var(--default-hover));
}

.button:active {
  background: var(--active, var(--default-active));
}

#detailed_search {
  background: #0c02;
}

#detailed_search:hover,
#detailed_search:focus {
  background: #0c04;
}

.button.disabled {
  background: var(--hover, var(--default-hover));
  opacity: 0.5;
  user-select: none;
}

#popular_domains li {
  margin: 0.5em;
  color: #888;
  font-style: italic;
}

#popular_domains a {
  display: inline;
  font-style: normal;
}
#popular_domains a::after {
  content: " ";
}

.url {
  display: block;
  color: var(--color, var(--default-color));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.url[data-hits]::after {
  content: " (" attr(data-hits) ")";
  font-style: italic;
  color: var(--color, var(--default-color));
  opacity: 0.5;
}

.fragment {
  color: var(--color, var(--default-color));
  opacity: 0.5;
}

.header-fields {
  display: flex;
  flex-flow: row wrap;
  font-size: 0.75rem;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --default-hover: #fff4;
    --default-active: #fff8;
    --default-border: #0008;
    --default-background: #333;
    --default-color: #fff;
    --default-elevated: #0008;
    --default-app-background: #222;
    --app-background: #222;
  }

  footer .row-1 {
    background: #888;
    color: #000;
  }

  em {
    background: #660;
  }
}
