*,
*::after,
*::before {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  interpolate-size: allow-keywords;

  --font-size-sm: clamp(0.8rem, 0.17vw + 0.76rem, 0.89rem);
  --font-size-base: clamp(1rem, 0.34vw + 0.91rem, 1.19rem);
  --font-size-md: clamp(1.25rem, 0.61vw + 1.1rem, 1.58rem);
  --font-size-lg: clamp(1.56rem, 1vw + 1.31rem, 2.11rem);
  --font-size-xl: clamp(1.95rem, 1.56vw + 1.56rem, 2.81rem);
  --font-size-xxl: clamp(2.44rem, 2.38vw + 1.85rem, 3.75rem);
  --font-size-xxxl: clamp(3.05rem, 3.54vw + 2.17rem, 5rem);

  --font-family: system-ui, -apple-system, blinkmacsystemfont, "segoe ui",
    roboto, oxygen, ubuntu, cantarell, "open sans", "helvetica neue", sans-serif;

  --primary-color: #930000;
}

html {
  hanging-punctuation: first last;
  color-scheme: dark light;
  ;
}

body {
  font-family: var(--font-family);
  font-size: 1.125rem;
  padding: 1em;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100lvh;

  section {
    flex-grow: 1;
  }
}

body> :is(header, footer),
section,
main,
article {
  container-type: inline-size;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

h1 {
  --_font-size: var(--font-size-xxl);
  margin-bottom: 0.5em;
  font-size: var(--_font-size);
  font-weight: 900;
  line-height: calc(var(--_font-size) * 1.1);
  letter-spacing: -2px;
}

h2 {
  --_font-size: var(--font-size-xl);
  place-self: start;
  font-size: var(--_font-size);
  font-weight: 600;
  line-height: calc(var(--_font-size) * 1.1);
  letter-spacing: -2px;
  margin-bottom: 0.5em;
}

h3 {
  --_font-size: var(--font-size-lg);
  font-size: var(--_font-size);
  font-weight: 400;
  line-height: calc(var(--_font-size) * 1.1);
  letter-spacing: -2px;
  margin-bottom: 0.5em;
}

p,
li,
figcaption {
  text-wrap: pretty;
  max-width: 65ch;
}

p {
  --_font-size: var(--font-size-base);
  font-size: var(--_font-size);
  line-height: calc(var(--_font-size) * 1.3);
  margin-bottom: 0.5em;
}

a {
  text-decoration: none;
  cursor: pointer;
}

small {
  font-size: var(--font-size-sm);
}

button,
select,
input,
textarea {
  font-size: inherit;
}



img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

input {
  accent-color: var(--primary-color);
  caret-color: var(--primary-color);
  width: 100%;
}

input[type="range"] {
  background: #00f0;
}

input[type="text"] {
  padding: .5rem .9rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid #848484;

  &:focus-visible {

    border: 1px solid var(--primary-color);
    outline: none;
  }
}

button {
  cursor: pointer;
  min-width: 10ch;
  padding: 0.5rem 0.8rem;
  border-radius: 5px;
  border: 0px;
  outline: 0px;

  --bg: #fff;
  background: var(--primary-color);

  color: lch(from var(--primary-color) calc((49.44 - l) * infinity) 0 0);
  font-weight: bold;
}

.title {
  display: block;

  small {
    color: var(--primary-color)
  }
}

section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;

  .images {
    flex-grow: 1;
  }
}

.images {
  display: grid;
  place-items: center;
  align-items: start;
  gap: 0.5rem;
  min-height: max(20rem, 100%);
  overflow: auto;

  .loading {
    display: none;
  }
}

.menu {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  width: min(300px, 100%);

  select {
    border: none;
    padding: .6em 0.8em;
    font-size: 1.2rem;
    border-radius: 5px;

    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: #fff;
  }
}

.menu-item {
  display: grid;
  gap: 0.3rem;
  position: relative;

  label {
    font-weight: 600;
  }

  &:after,
  &:before {
    position: absolute;
    bottom: 0;
  }

  &:after {
    right: 0;
    content: attr(data-max);
  }

  &:before {
    left: 0;
    content: attr(data-min);
  }
}

#input-rate-range-div {
  padding-bottom: 20px;

}

.menu-item-checkbox {
  display: flex;
  gap: 0.3rem;

  label {
    font-weight: 600;
  }

  input {
    width: 2rem;
  }
}

.file-input {
  display: inline-block;
  position: relative;
  cursor: pointer;

  --font-size: 18px;
  --padding: 5px 10px;

  input[type="file"] {
    width: 100%;

    &::file-selector-button {
      display: block;
      opacity: 0;
      margin-bottom: 5px;
      font-size: var(--font-size);
      padding: var(--padding);
    }
  }

  &::before {
    font-size: var(--font-size);
    padding: var(--padding);
    content: "Choose a image";
    border-radius: 5px;
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: #fff;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
    position: absolute;
  }
}

#ascii-art {
  font-size: 12px;
  line-height: 9px;
  font-family: "Courier New", Courier, monospace;
  white-space: pre;
}

footer {
  margin-top: 3rem;
  display: grid;
  place-items: center;
  gap: .8rem;

  .links {
    a {
      svg {
        width: 2rem;
        height: 2rem;
      }

      &:hover {
        svg path {
          fill: var(--primary-color)
        }
      }
    }
  }
}

@media (prefers-reduced-motion: no-preference) {
  :has(:target) {
    scroll-behavior: smooth;
    scroll-padding-top: 4rem;
  }
}

[data-visible="false"] {
  display: none;
}
