/* variables */

:root {
  --theme-bg-color: #fff;
  --theme-fg-color: #383838;
  --theme-primary-color: #3273dc;
  --theme-border-color: #eee;
  --theme-focus-ring-color: #ccc;
  --theme-ribbon-bg-color: #3273dc;
  --theme-ribbon-fg-color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --theme-bg-color: #000;
    --theme-fg-color: #7d7d7d;
    --theme-primary-color: #133771;
    --theme-border-color: #1b1b1b;
    --theme-focus-ring-color: #2e2e2e;
    --theme-ribbon-bg-color: #2e2e2e;
    --theme-ribbon-fg-color: #7d7d7d;
  }
}

/* css reset from https://github.com/vladocar/CSS-Mini-Reset */

html,body,div,form,fieldset,legend,label{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}th,td{text-align:left;vertical-align:top;}h1,h2,h3,h4,h5,h6,th,td,caption{font-weight:normal;}img{border:0;}

/* structure */

html {
  font-size: 62.5%;
}

body {
  background-color: var(--theme-bg-color);
  color: var(--theme-fg-color);
  font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.6rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-transform: uppercase;
}

a {
  color: var(--theme-primary-color);
  text-decoration: none;
}

.container {
  margin: auto;
  max-width: 1440px;
}

.header {
  margin: 0 20px;
}

.header h1 {
  display: none;
  font-size: 8.5rem;
  font-weight: 400;
  line-height: 8.5rem;
  margin: 20px 0;
  text-align: center;
  text-transform: uppercase;
}

.separator {
  background-color: var(--theme-border-color);
  border: 0;
  height: 1px;
  margin: 20px 0;
  width: 100%;
}

.body {
  margin: 0 20px;
}

.footer {
  margin: 20px 0;
  text-align: center;
}

/* progress */

.progress {
  animation-direction: alternate;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-name: progress;
  animation-timing-function: ease;
  background-color: var(--theme-primary-color);
  display: none;
  height: 5px;
  width: 0;
}

@keyframes progress {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

body.is-loading .progress {
  display: block;
}

/* stats */

.stats {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  height: 60px;
  justify-content: space-evenly;
  margin-top: 20px;
  overflow: hidden;
  width: 100%;
}

.stats .item {
  margin: 0 10px;
  text-align: center;
}

.stats .item .heading {
  font-size: 1.2rem;
  letter-spacing: 0.1rem;
  margin: 0 0 5px 0;
  text-transform: uppercase;
}

.stats .item .value {
  font-size: 3.5rem;
  font-weight: 500;
  margin: 0;
}

.stats .separator {
  background-color: var(--theme-border-color);
  border: 0;
  height: 30px;
  margin: 0;
  padding: 0;
  width: 1px;
}

@media only screen and (max-width: 768px) {
  .stats :nth-child(n+4) {
    display: none;
  }
}

@media only screen and (max-width: 1080px) {
  .stats :nth-child(n+7) {
    display: none;
  }
}

/* search */

.search input {
  background-color: var(--theme-bg-color);
  border: 1px solid var(--theme-border-color);
  box-sizing: border-box;
  color: var(--theme-fg-color);
  font-size: 1.6rem;
  padding: 10px;
  width: 100%;
}

.search input:focus {
  border: 1px solid var(--theme-focus-ring-color);
  outline: none;
}

/* cards */

.cards {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin: -10px;
}

.cards .card {
  border: 1px solid var(--theme-border-color);
  display: flex;
  flex-direction: column;
  height: 160px;
  justify-content: space-between;
  margin: 10px;
  padding: 10px;
  text-align: center;
  width: 100%;
}

@media (hover: hover) {
  .cards .card {
    transition: transform 300ms ease-in-out;
  }

  .cards .card:hover {
    transform: translateY(-5px);
  }
}

.cards .card.has-ribbon {
  position: relative;
  overflow: hidden;
}

.cards .card.has-ribbon .ribbon {
  background-color: var(--theme-ribbon-bg-color);
  color: var(--theme-ribbon-fg-color);
  display: block;
  font-size: 1.2rem;
  height: 20px;
  left: -10px;
  letter-spacing: 0.1rem;
  line-height: 20px;
  position: absolute;
  text-transform: uppercase;
  top: 50px;
  transform-origin: left;
  transform: rotate(-45deg);
  width: 100px;
}

.cards .card .ribbon {
  display: none;
}

.cards .card .number {
  font-size: 1rem;
  margin-bottom: 5px;
}

.cards .card .date {
  font-size: 1.2rem;
}

.cards .card .title {
  box-orient: vertical;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  word-break: break-word;
}

.cards .card .publisher-and-format {
  box-orient: vertical;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  font-size: 1.2rem;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.cards .card .length {
  font-size: 1.2rem;
}

@media only screen and (min-width: 768px) {
  .cards .card {
    width: calc(50% - 42px);
  }
}

@media only screen and (min-width: 1024px) {
  .cards .card {
    width: calc(25% - 42px);
  }
}

@media only screen and (min-width: 1440px) {
  .cards .card {
    width: calc(20% - 42px);
  }
}

/* history */

.history {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}

.history ul {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.history li:first-child {
  margin-left: 5px;
}

.history li + li {
  margin-left: 5px;
}

.history li+li::before {
  color: var(--theme-fg-color);
  content: " • ";
  font-size: 1.2rem;
}

/* offline */

.is-offline {
  .search {
    display: none;
  }

  .history {
    display: none;
  }
}
