html,
body {
  padding: 0;
  margin: 0;
  width: 100vw;
  min-height: 100vh;
  font-size: 16px;
}

body {
  --color-primary: #9d174d;
  --color-secondary: #ec4899;
  --color-secondary-accent: #db2777;
  --color-text: #201533;

  --max-width: 640px;

  font-family: "Nunito", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "wdth" 100;
  background-color: #fbf7ff;
  color: var(--color-text);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem 1rem 0;
  box-sizing: border-box;
}

header {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: var(--max-width);

  img {
    max-width: 128px;
  }
}

h1 {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  color: var(--color-primary);
  margin: 1em 0 0;
}

.form {
  width: 100%;
  max-width: var(--max-width);
  flex-grow: 1;
}

.form form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.form-input {
  display: flex;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px var(--color-primary);
  overflow: hidden;
}

.form-input input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.85rem 1.25rem;
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  color: var(--color-text);
}

.form-input input::placeholder {
  color: #b3a6cc;
}
.form-options input[type="checkbox"] {
  accent-color: var(--color-secondary);
  width: 16px;
  height: 16px;
}

.form-input button {
  border: none;
  background: var(--color-secondary);
  color: #ffffff;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.5rem 1.4rem;
  margin: 0.6rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-radius: 999px;
}

.form-input button:hover {
  background: var(--color-secondary-accent);
}

.form-input button:disabled {
  background: color-mix(in srgb, var(--color-secondary) 35%, white);
  color: color-mix(in srgb, var(--color-text) 40%, white);
  cursor: not-allowed;
}

.form-input:focus-within {
  outline: 1px solid var(--color-text);
  outline-offset: 0px;
}

.form-options {
  padding: 0 16px;
}
.form-options label {
  display: flex;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  color: var(--color-secondary);

  & ~ label {
    margin-top: 16px;
  }

  .helper {
    display: block;
    font-size: 80%;
  }
}

.results {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-secondary);
  text-align: center;
}

.results .response {
  width: 100%;
  text-align: left;
}

.results section {
  border-radius: 8px;
  display: grid;
  grid-template-columns: 64px 1fr 96px;
  grid-template-rows: 1fr 1fr;
  height: 96px;
  box-shadow: 0 1px 4px rgb(from var(--color-primary) R G B / 0.6);

  & ~ section {
    margin-top: 24px;
  }
}

.results .best-candidate {
  background: repeating-linear-gradient(
    45deg,
    rgb(from var(--color-secondary) R G B / 0.1),
    rgb(from var(--color-secondary) R G B / 0.1) 16px,
    #ffffff 16px,
    #ffffff 32px,
    rgb(from var(--color-secondary-accent) R G B / 0.1) 32px,
    rgb(from var(--color-secondary-accent) R G B / 0.1) 48px,
    #ffffff 48px,
    #ffffff 64px
  );
}

.results .copy-icon-wrapper {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  align-self: center;
}

.results .copy-icon {
  max-width: 32px;
  margin: 16px;
  cursor: pointer;
}

.results .url {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  align-self: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.results .metadata {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  align-self: center;
  display: flex;
  gap: 8px;
}

.metadata .pill {
  color: #ffffff;
  font-size: 80%;
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
}

.metadata .pill.format {
  background: var(--color-primary);
}

.metadata .pill.source {
  background: var(--color-secondary);
}

.metadata .pill.vector {
  background: var(--color-text);
}

.results .image-wrapper {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
  justify-self: center;
  align-self: center;
}

.results .image-wrapper img {
  margin-right: 16px;
  max-width: 64px;
}

.results img {
  vertical-align: top;
  transition: 0.3s transform;

  &:hover {
    transform: translate(1px, -1px);
  }
}

footer {
  height: 48px;
  width: 100vw;
  margin: 0 calc(50% - 50vw);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;

  a {
    color: #ffffff;
    font-size: 80%;
  }
}

@keyframes loader {
  0% {
    height: 4px;
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
    height: 16px;
  }
  100% {
    transform: translateY(0);
    height: 4px;
  }
}

.loader {
  border: 1px solid var(--color-primary);
  background: white;
  padding: 49px;
  position: relative;
  border-radius: 8px;
  &:after,
  &:before {
    position: absolute;
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    border-radius: 8px;
    content: "";
    height: 4px;
    width: 4px;
    top: 46px;
    animation: loader 1s ease-in-out infinite;
  }

  &:after {
    left: calc(50% - 4px);
  }

  &:before {
    left: calc(50% + 4px);
    animation-delay: 0.3s;
  }
}
