:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #5b5b5b;
  --line: #d4d4d4;
  color: var(--ink);
  background: #fff;
  font: 16px/1.5 "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main { width: min(1200px, calc(100% - 32px)); margin-inline: auto; }
.search-section {
  max-width: 560px;
  padding-block: clamp(5rem, 25vh, 16rem) 2rem;
  margin-inline: auto;
}
h1 {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1.15;
  letter-spacing: -.04em;
}
.email-confirm { text-align: center; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.search-box:focus-within { border-color: var(--ink); }
.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  padding-block: 8px;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.search-box input::placeholder { color: var(--muted); }
.primary, .more { cursor: pointer; border-radius: 5px; }
.primary {
  min-height: 44px;
  padding-inline: 16px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.primary:hover { background: #373737; }
.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: .875rem;
}
.kinds { display: flex; gap: 12px; margin: 0; padding: 0; border: 0; }
.kinds label { position: relative; cursor: pointer; }
.kinds input { position: absolute; opacity: 0; }
.kinds span { display: block; padding: 8px; }
.kinds input:checked + span { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 5px; }
.kinds input:focus-visible + span { outline: 2px solid var(--ink); }
.rating { display: flex; gap: 8px; align-items: center; min-height: 36px; cursor: pointer; }
.rating input { margin: 0; width: 15px; height: 15px; accent-color: var(--ink); }

.has-query .search-section { max-width: none; padding-block: 1.5rem; }
.has-query h1 { font-size: 1.6rem; text-align: start; margin-bottom: .8rem; }
.has-query #search { width: min(100%, 560px); }
#search-results { padding-bottom: 3rem; }
#status { margin: 0; color: var(--muted); }
.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.result-link, .model-link { display: block; min-width: 0; }
.art {
  display: grid;
  place-items: center;
  aspect-ratio: 4/5;
  overflow: hidden;
  border-radius: 6px;
  background: #f4f4f4;
  color: var(--muted);
  font-size: .8rem;
}
.art img { width: 100%; height: 100%; object-fit: cover; }
.credit, .model-meta { display: block; color: var(--muted); font-size: .8rem; }
.credit { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-block: 6px; }
.results.models { grid-template-columns: 1fr; gap: 0 24px; }
.model-link { border-bottom: 1px solid var(--line); padding-block: 12px; }
.model-name { display: block; overflow-wrap: anywhere; font-weight: 600; }
.result-link:hover .credit, .model-link:hover .model-name { text-decoration: underline; }
.more {
  display: block;
  margin: 1.5rem auto 0;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.more:hover { border-color: var(--ink); }
.more:disabled { cursor: wait; opacity: .6; }

@media (min-width: 640px) {
  .has-query .search-section { display: flex; align-items: baseline; gap: 24px; }
  .results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .results.models { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
