:root {
  color-scheme: light;
  --paper: #fbf8ef;
  --sheet: #fffdf8;
  --ink: #151515;
  --muted: #62605b;
  --line: #151515;
  --blue: #2776bd;
  --red: #df4f45;
  --yellow: #f3c542;
  --green: #2f9868;
  --shadow: 7px 7px 0 #151515;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 21, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 30px 30px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="search"] {
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  color: var(--ink);
}

button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--yellow);
  cursor: pointer;
  font-weight: 800;
}

button:hover,
button:focus-visible {
  background: #ffe27a;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(300px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 3px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brandFace {
  position: relative;
  width: 54px;
  height: 54px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
}

.brandFace::before,
.brandFace::after,
.brandFace span {
  position: absolute;
  content: "";
  background: var(--line);
}

.brandFace::before {
  left: 13px;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.brandFace::after {
  right: 13px;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.brandFace span:first-child {
  left: 17px;
  top: 34px;
  width: 20px;
  height: 3px;
  transform: rotate(-8deg);
}

.brandFace span:last-child {
  right: -7px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-left: 0;
  border-bottom: 0;
  background: var(--red);
}

.brandName {
  display: block;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.meta,
#resultCount,
.resultDate,
.resultSnippet {
  color: var(--muted);
}

.meta {
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
}

.search {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}

.search label,
.fieldToggles legend,
.selectControl span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.searchBox {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
}

input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: white;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 0 2px;
}

.fieldToggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldToggles legend {
  float: left;
  height: 42px;
  margin-right: 2px;
  padding-top: 12px;
}

.fieldToggles label,
.selectControl {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
}

.fieldToggles label {
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  font-weight: 800;
}

.fieldToggles input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.selectControl select {
  min-height: 42px;
  padding: 0 32px 0 10px;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 0 2px;
}

#resultCount {
  font-size: 0.95rem;
  font-weight: 800;
}

.pagination {
  display: none;
  gap: 5px;
  align-items: center;
}

.pagination.visible {
  display: inline-flex;
}

.paginationBottom {
  justify-content: center;
  padding: 0 0 32px;
}

.pageButton {
  min-width: 34px;
  min-height: 34px;
  padding: 0 9px;
  background: var(--sheet);
  font-weight: 900;
}

.pageButton:hover,
.pageButton:focus-visible {
  background: #f4f8ff;
}

.pageButton[aria-current="page"] {
  background: var(--blue);
  color: white;
}

.pageButton:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.5;
}

.pageGap {
  min-width: 22px;
  color: var(--muted);
  text-align: center;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: stretch;
  padding-bottom: 32px;
}

.result {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border: 3px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
  box-shadow: 4px 4px 0 var(--line);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.result:hover,
.result:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--line);
}

.result figure {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
  background:
    linear-gradient(135deg, rgba(39, 118, 189, 0.16), rgba(243, 197, 66, 0.18)),
    #fff;
}

.result figure::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  background: var(--red);
  content: "";
  transform: rotate(10deg);
}

.result img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
}

.resultBody {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  min-width: 0;
  padding: 12px;
}

.resultKicker {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resultDate {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resultTitle {
  display: -webkit-box;
  min-height: 2.4em;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.2;
}

.resultSnippet {
  display: -webkit-box;
  min-height: 4.35em;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 0.92rem;
  line-height: 1.45;
}

.badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: end;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
}

.badge.titleText {
  background: var(--blue);
}

.badge.comicText {
  background: var(--green);
}

.badge.metadataText {
  background: var(--red);
}

.empty {
  grid-column: 1 / -1;
  padding: 44px 16px;
  border: 3px dashed var(--line);
  background: var(--sheet);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

@media (max-width: 900px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 14px;
    box-shadow: 5px 5px 0 var(--line);
  }

  .search {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .searchBox {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .statusbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .pagination {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    position: static;
  }

  .brand {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .brandFace {
    width: 46px;
    height: 46px;
  }

  .brandName {
    font-size: 1.22rem;
  }

  .searchBox {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .fieldToggles {
    display: grid;
    grid-template-columns: 1fr;
  }

  .fieldToggles legend {
    float: none;
    height: auto;
    margin: 0;
    padding: 0;
  }

  .selectControl {
    justify-content: space-between;
  }

  .selectControl select {
    min-width: 150px;
  }

  .results {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 12px;
  }

  .resultBody {
    padding: 10px;
  }

  .resultKicker {
    align-items: flex-start;
    flex-direction: column;
  }

  .badges {
    justify-content: start;
  }
}
