:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", serif;
  font-size: 1.125rem;
  color: #2d3748;
  background: #f7f2ea;
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Header */

.site-header {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f7f2ea;
  background-image: url("../assets/bg-pattern.svg"), linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.15) 100%);
  background-size: cover, auto;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.site-header__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 1rem;
  text-align: center;
}

.site-header__logo {
  height: 150px;
  width: auto;
}

.site-header__title {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 1rem 0 0.75rem;
}

.site-header__location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  margin: 0 0 2.5rem;
}

.site-header__location svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* Book page header */

.book-header {
  padding-bottom: 5rem;
}

.book-header__nav {
  position: relative;
  z-index: 1;
  margin: 3.5rem 0 0 1.5rem;
  align-self: flex-start;
}

.back-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.125rem;
}

.back-link svg {
  width: 1.25rem;
  height: 1.125rem;
  transition: transform 0.2s ease-in-out;
}

.back-link:hover svg {
  transform: translateX(-0.5rem);
}

.back-link__logo {
  height: 2.5rem;
  width: 2.5rem;
  margin-left: 0.75rem;
  margin-right: 0.75rem;
  object-fit: cover;
}

.book-header__title {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  font-weight: bold;
  text-align: center;
  margin: 1.5rem 1rem 0;
}

/* Book grid on home page */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.book-grid__item {
  position: relative;
  overflow: hidden;
  text-decoration: none;
  background: #e2e8f0;
}

.book-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-grid__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: 1.5rem;
  background: rgba(45, 55, 72, 0.85);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.book-grid__item:hover .book-grid__overlay,
.book-grid__item:focus-visible .book-grid__overlay {
  opacity: 1;
}

/* Book detail page */

.book-main {
  max-width: 64rem;
  margin: 1.5rem auto;
  padding: 1rem 1.5rem;
}

.book-main::after {
  content: "";
  display: table;
  clear: both;
}

.book-cover {
  float: left;
  max-width: 320px;
  width: 40%;
  margin: 0 2rem 1.5rem 0;
}

.book-isbn {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #4a5568;
  border-top: 1px solid #cbd5e0;
  padding-top: 0.75rem;
}

.prose p {
  margin: 0 0 1.25rem;
}

.prose blockquote {
  margin: 0 0 1.25rem;
  padding-left: 1rem;
  border-left: 3px solid #cbd5e0;
  color: #4a5568;
  font-style: italic;
}

.prose .attribution {
  margin: -0.75rem 0 1.25rem;
  text-align: right;
  font-size: 0.875rem;
  color: #718096;
}

.prose h3 {
  margin: 2rem 0 1rem;
}

.excerpt-button-row {
  display: flex;
  justify-content: center;
  clear: both;
  margin-top: 1.5rem;
}

.excerpt-button {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.excerpt-button:hover {
  background: #f7fafc;
}

.excerpt-button svg {
  height: 1rem;
}

/* Excerpt dialog */

dialog.excerpt-dialog {
  max-width: 42rem;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  border: none;
  border-radius: 0.5rem;
  padding: 2rem;
}

dialog.excerpt-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.excerpt-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.excerpt-dialog__subtitle {
  display: block;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #718096;
}

.excerpt-dialog__title {
  margin: 0.25rem 0 0;
  font-size: 1.5rem;
}

.excerpt-dialog__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #4a5568;
  padding: 0.25rem 0.5rem;
}

/* Footer */

.site-footer {
  padding: 5rem 1.5rem 2rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.08) 100%);
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer__inner::after {
  content: "";
  display: table;
  clear: both;
}

.site-footer h2 {
  font-weight: bold;
  font-size: 1.5rem;
}

.order-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid #cbd5e0;
}

.order-section p {
  margin: 0.5rem 0 0;
}

.order-form__note {
  font-size: 0.875rem;
  color: #718096;
}

.order-form {
  margin-top: 1.5rem;
  max-width: 32rem;
}

.order-form__books {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.order-form__book {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-form__book label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.order-form__qty {
  width: 3.5rem;
  padding: 0.25rem 0.4rem;
  font-family: inherit;
  border: 1px solid #cbd5e0;
  border-radius: 0.25rem;
  background: #fff;
}

.order-form__field {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
}

.order-form__field input[type="text"],
.order-form__field textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.25rem;
  background: #fff;
  resize: vertical;
}

.order-form__submit {
  padding: 0.6rem 1.25rem;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.order-form__submit:hover {
  background: #f7f2ea;
}

.order-form__fallback {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed #cbd5e0;
}

.order-form__fallback p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.order-form__fallback-text {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.25rem;
  background: #fff;
  resize: vertical;
}

.order-form__copy {
  margin-top: 0.5rem;
  padding: 0.4rem 1rem;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.order-form__copy:hover {
  background: #f7f2ea;
}

.order-form__copy-status {
  margin-left: 0.75rem;
  font-size: 0.875rem;
  color: #718096;
}

.site-footer__photo {
  float: right;
  height: 200px;
  width: auto;
  margin: 0 0 1.5rem 2rem;
}

@media (max-width: 640px) {
  .book-cover,
  .site-footer__photo {
    float: none;
    margin: 0 auto 1.5rem;
    width: 60%;
  }
}
