:root {
  --color-page: #232d3a;
  --color-text: #e3e9ee;
  --color-text-strong: #fff;
  --color-text-muted: #b9c3cc;
  --color-error: rgb(235 14 98);
  --color-page-hover: #273643;
  --color-border: #43515d;
  --color-border-hover: #66717f;
}

* {
  margin: 0;
  border: 0 solid var(--color-border);
  box-sizing: border-box;
  transition-property: color, background-color, border-color, opacity, transform;
  scrollbar-width: thin;
}

html {
  font-family: system-ui;
  color: var(--color-text);
  background: var(--color-page);
  overflow: auto;
}

html {
  -ms-overflow-style: auto;
}

::-webkit-scrollbar {
  max-width: 0.25rem;
  max-height: 0.25rem;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 0.125rem;
  transition: background 300ms;
}

:hover::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
}

body {
  min-height: 100svh;
  margin: 0;
  padding: 5%;
  display: flex;
  flex-flow: column;
  gap: 1.5rem;
  line-height: 1.25;
}

header p {
  max-width: 50rem;
}

h1,
h2,
h3,
h4,
button {
  font: inherit;
}

h1 {
  font-weight: 700;
  margin-block-end: 0.5rem;
}

a,
button {
  color: inherit;
  text-decoration: none;
  background: none;
}

a,
button {
  transition-duration: 300ms;
}

:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

#error,
#menu,
#pages,
#result {
  display: none;
}

.has-error #result,
.has-pages #result,
.has-error #error,
.has-pages #menu,
.has-pages #pages {
  display: flex;
}

#drop {
  border-width: 1px;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#drop:hover,
#drop.dragover {
  background: var(--color-page-hover);
  border-color: var(--color-border-hover);
}

#result {
  outline: none;
  border-block-width: 1px;
  margin-block: 1rem;
  padding-block: 1rem;
  gap: 3rem;
}

.has-pages #result {
  flex-grow: 1000;
}

#menu {
  gap: 0.25rem;
  margin: 0;
  padding: 2rem 1rem 2.5rem 0;
  flex-flow: column;
  text-align: center;
  position: sticky;
  top: 0.5rem;
  height: fit-content;
  max-height: calc(100vh - 1rem);
  overflow: auto;
  flex: 0 0 min-content;
}

#menu a {
  padding: 0.25rem;
  border-radius: 0.25rem;
  background: var(--color-page-hover);
  min-width: 1.75rem;
  min-height: 1.75rem;
}

#menu a:hover {
  background: var(--color-border);
}

#menu a:not([href]) {
  background: center url("./loading.svg") no-repeat;
}

#menu a.has-diff {
  order: -1;
  background: var(--color-error);
}

#pages {
  flex-direction: column;
  gap: 5rem;
  list-style: none;
  padding: 0.5rem 0;
  width: 0;
  flex-grow: 1;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 2rem 0.5rem;
  padding: 0.5rem 0;
  border-radius: 0.5rem;
  min-height: calc(100vh - 2rem);
  scroll-margin-block: 1rem;
}

.page header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 1.5rem;
  padding: 1rem 0.125rem;
  z-index: 1;
}

.page.has-diff {
  border-color: rgb(from var(--color-error) r g b / 0.5);
}

.page header::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-border);
  z-index: -1;
  position: relative;
}

.page.has-diff header::before {
  background: var(--color-error);
}

.page a {
  background: rgb(from var(--color-page) r g b / 0.5);
  padding: 0.25rem;
  margin: -0.25rem;
  border-radius: 0.25rem;
  width: fit-content;
  backdrop-filter: blur(4px);
}

.page a:focus {
  outline: none;
  background: rgb(from var(--color-page-hover) r g b / 0.5);
}

.page .score {
  margin-inline-start: auto;
  color: var(--color-text-muted);
}

.page.has-diff .score {
  color: var(--color-text-strong);
}

.page .list {
  display: flex;
  gap: 2rem;
  width: 100%;
  margin-block: auto;
  position: sticky;
  top: 5rem;
}

.page img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: scale-down;
  object-position: left top;
  background: var(--color-page-hover);
}

.page h3 {
  color: var(--color-text-muted);
  margin-block-end: 1rem;
  font-size: 0.875em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page h3 strong {
  color: var(--color-text);
}

#error {
  text-align: center;
  margin: auto;
  padding: 2rem;
  align-items: center;
  gap: 0.5rem;
}

#error::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-error);
}

footer {
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
}

footer a:hover {
  color: var(--color-text-strong);
}

footer a[href*="s-ings.com"]::before {
  content: "";
  display: inline-block;
  width: 0.67rem;
  height: 0.67rem;
  background: currentColor;
  transform: rotate(45deg);
  margin-inline-end: 0.75rem;
  vertical-align: middle;
}

@media (max-width: 60rem) {
  body {
    padding: 1rem;
    gap: 1rem;
  }

  #result {
    gap: 0;
  }

  .page {
    padding-inline: 0;
  }

  .page .list {
    flex-wrap: wrap;
    padding: 4rem 0 0;
    gap: 1rem;
  }

  .page .list > div {
    width: 40%;
  }

  .page .list > div:last-child {
    width: auto;
  }

  .page img {
    max-height: 50vh;
    width: auto;
  }
}
