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

body {
  margin: 0 auto;
}

p {
  margin: 0;
}

a:link {
  color:hotpink;
  text-decoration: none;
}
a:visited {
  color: color-mix(in oklch, hotpink, purple 40%);
}
a:hover,
a:focus {
  text-decoration: underline;
  color: color-mix(in oklch, hotpink, red 40%);
}
a:active {
  color: color-mix(in oklch, hotpink, red 66%);
}

.HeaderContainer,
main {
  padding: 1rem 3rem;
  margin: 0 auto;
}

@media screen and (min-width: 60rem) {
  .HeaderContainer,
  main {
    padding: 1rem 1.5rem;
    max-width: 50rem;
  } 
}

header {
  background-color: ghostwhite;
  border-bottom: 1px solid gainsboro;
}

.HeaderContainer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.Brand {
  font-size: 1.5rem;
  font-weight: bold;
}

.Brand__logo {
  display: none;
}

.HeaderSearch {
  display: flex;
  gap: .25rem;
}

.HeaderSearch input[type="search"] {
  width: 16rem;
  max-width: 100%;
}

@media screen and (max-width: 40rem) {
  .Brand__name {
    display: none;
  }

  .Brand__logo {
    display: inline;
  }

  .HeaderSearch {
    flex: 1;
  }

  .HeaderSearch input[type="search"] {
    width: 100%;
  }
}

fieldset {
  --inner-padding: 1.5rem;

  border: 1px solid gainsboro;
  background-color: ghostwhite;
  padding: var(--inner-padding);
  margin-bottom: 1rem;
  border-radius: .5rem;
  margin: 0 calc(-1 * var(--inner-padding));
}

.InputGroup {
  display: flex;
  flex-direction: row;
  gap: .5rem;
}

legend {
  font-weight: bold;
  padding: 0 .5rem;
  margin: 0 -.5rem;
}

label {
  display: block;
  margin-bottom: .5rem;
  font-size: .85rem;
  font-weight: bold;
}

input {
  width: 100%;
  padding: .5rem;
  border: 1px solid gainsboro;
  border-radius: .25rem;
  font-size: 1rem;
}

.button,
button {
  padding: .5rem 1rem;
  background-color: dodgerblue;
  color: white;
  border: none;
  border-radius: .25rem;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  min-height: 2.5rem;
}

.Book {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  align-items: start;
  gap: 1.5rem;
  margin: 1rem 0 2.5rem;
}

.Book img {
  width: 3rem;
  height: auto;
  object-fit: contain;
}

.Book h3 {
  margin: 0 0 .25rem;
}

.BookDetails__author {
  font-size: 1rem;
}
.BookDetails__isbn {
  margin-top: .25rem;
  font-size: .65rem;
  color: gray;
}
/* Suggestions float over the page instead of stretching their container.
   Fallback: absolute positioning inside the form. */
form[data-autocomplete] {
  position: relative;
}

.Autocomplete {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid gainsboro;
  border-radius: 0 0 .25rem .25rem;
  background-color: white;
  box-shadow: 0 .25rem .75rem rgb(0 0 0 / 10%);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
}

/* Modern path: anchored to the input itself (anchor names are set per-instance in JS) */
@supports (anchor-name: --a) {
  .Autocomplete {
    top: anchor(bottom);
    left: anchor(left);
    right: auto;
    min-width: anchor-size(width);
    max-width: min(28rem, calc(100vw - 2rem));
  }
}

.Autocomplete li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  color: inherit;
}

.Autocomplete li a:hover,
.Autocomplete li[aria-selected="true"] a {
  background-color: ghostwhite;
  text-decoration: none;
}

.Autocomplete img {
  width: 2rem;
  flex-shrink: 0;
}

.Autocomplete span {
  display: flex;
  flex-direction: column;
}

.Autocomplete small {
  color: dimgray;
}

.CityForm {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}

.CityForm input[type="text"] {
  max-width: 12rem;
}

.PinForm {
  float: right;
}

.PinButton {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: hotpink;
}

.store-card--pinned {
  border-color: hotpink;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.Home {
  min-height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.Home__brand {
  margin: 0;
  font-size: 2.5rem;
  color: hotpink;
}

.Home form {
  width: min(36rem, 100%);
}

.Home fieldset {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.Home legend {
  text-align: center;
  width: 100%;
  margin-bottom: 1rem;
  color: dimgray;
}

.Home .InputGroup input[type="search"] {
  flex: 1;
  font-size: 1.15rem;
  padding: .65rem .9rem;
}

.Home .InputGroup button {
  font-size: 1.05rem;
}
