:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171717;
  background: #f7f7f5;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f7f7f5;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.25rem;
  padding: 0.9rem max(1.25rem, calc((100vw - 76rem) / 2));
  border-bottom: 1px solid #e8e8e5;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand::before {
  width: 1.25rem;
  height: 1.55rem;
  border-radius: 0.15rem 0.35rem 0.35rem 0.15rem;
  background: #171717;
  box-shadow: inset 0.2rem 0 0 #6b6b68;
  content: "";
}

.site-header nav,
.site-header form {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
}

#current-user {
  color: #666663;
  font-size: 0.9rem;
}

main {
  width: min(76rem, calc(100% - 2.5rem));
  margin: 0 auto;
}

.hero {
  max-width: 56rem;
  padding: clamp(4rem, 10vw, 7rem) 0 3rem;
}

.hero h1,
.hero h2 {
  max-width: 52rem;
  margin: 0.4rem 0 1.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.lead {
  max-width: 40rem;
  margin: 0;
  color: #62625f;
  font-size: 1.2rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0;
  color: #747471;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.status {
  min-height: 1.4rem;
  margin: 1.5rem 0 0;
  color: #62625f;
}

body.authenticated .hero {
  max-width: none;
  padding: 2.5rem 0 1rem;
}

body.authenticated .hero .eyebrow,
body.authenticated .hero h1,
body.authenticated .hero h2,
body.authenticated .hero .lead {
  display: none;
}

body.authenticated .hero .status {
  margin: 0;
  font-size: 0.95rem;
}

.button,
button {
  display: inline-block;
  padding: 0.75rem 1rem;
  border: 1px solid #171717;
  border-radius: 0.55rem;
  background: #171717;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:hover:not(:disabled),
.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.1);
}

.link-button,
.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #51514e;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.link-button:hover:not(:disabled),
.text-button:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.button-secondary {
  border-color: #d7d7d3;
  background: #fff;
  color: #242422;
}

.card {
  margin: 0 auto 4rem;
  padding: 2rem;
  border: 1px solid #e4e4e0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1rem 3rem rgba(20, 20, 20, 0.05);
}

.narrow {
  max-width: 30rem;
}

.narrow h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.auth-description {
  margin: -0.25rem 0 1.25rem;
  color: #686864;
  font-size: 0.9rem;
  line-height: 1.55;
}

.auth-switch {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid #ecece8;
  color: #686864;
  font-size: 0.9rem;
}

.auth-switch .text-button {
  margin-left: 0.25rem;
}

.error {
  color: #a12b24;
}

form label {
  display: block;
  margin: 1rem 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 650;
}

form button[type="submit"] {
  margin-top: 1rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d5d5d0;
  border-radius: 0.55rem;
  background: #fff;
  color: inherit;
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
  color: #989894;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #777773;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
  outline: 0;
}

textarea {
  resize: vertical;
}

.library {
  padding: 0.5rem 0 5rem;
}

.section-heading,
.form-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.section-heading {
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.form-heading h3 {
  margin: 0.35rem 0 0.6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.form-heading h3 {
  font-size: 2rem;
}

.section-copy {
  max-width: 42rem;
  margin: 0;
  color: #686864;
  line-height: 1.6;
}

.loan-overview {
  margin: 0;
  padding: 2rem 0 0;
}

.loan-overview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.loan-overview-heading h3 {
  margin: 0.25rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.loan-overview-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.loan-overview-counts span {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: #f1f1ee;
  color: #62625f;
  font-size: 0.78rem;
}

.loan-overview-counts .stale-count {
  background: #fbefed;
  color: #9a3d32;
}

.loan-overview-status {
  margin: 0.8rem 0 0;
  color: #777773;
  font-size: 0.86rem;
}

.active-loan-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.active-loan-list:empty {
  display: none;
}

.active-loan-card {
  display: flex;
  min-width: 0;
  padding: 1rem;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  border-color: #e5e5e1;
  background: #fafaf8;
  color: #242422;
  font-weight: 400;
  text-align: left;
}

.active-loan-card-stale {
  border-color: #efd6d0;
  background: #fffafa;
}

.active-loan-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.active-loan-card-heading strong {
  display: -webkit-box;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.active-loan-borrower {
  margin-top: 0.25rem;
  font-weight: 650;
}

.active-loan-meta,
.active-loan-contact {
  overflow: hidden;
  color: #747471;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.9rem;
  margin: 1.75rem 0 0;
}

.filters label,
.book-form label {
  margin: 0;
}

.filters label span,
.book-form label span {
  display: block;
  margin-bottom: 0.4rem;
}

.filter-button {
  margin: 0 !important;
}

.isbn-lookup-field label {
  margin: 0;
}

.input-action {
  display: flex;
  gap: 0.55rem;
}

.input-action input {
  min-width: 0;
}

.input-action button {
  flex: 0 0 auto;
  margin: 0;
}

.scan-isbn-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.scan-isbn-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.isbn-scanner-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #dededa;
  border-radius: 0.8rem;
  background: #f7f7f5;
}

.isbn-scanner-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.isbn-scanner-heading strong {
  font-size: 0.95rem;
}

.isbn-scanner-heading p,
.isbn-scanner-status {
  margin: 0.25rem 0 0;
  color: #6c6c68;
  font-size: 0.82rem;
  line-height: 1.45;
}

.isbn-scanner-reader {
  min-height: 12rem;
  overflow: hidden;
  border-radius: 0.65rem;
  background: #171717;
}

.isbn-scanner-reader video {
  object-fit: cover;
}

.isbn-camera-controls {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.isbn-ocr-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.isbn-ocr-actions button {
  flex: 0 0 auto;
  margin: 0;
}

.isbn-ocr-actions span {
  color: #6c6c68;
  font-size: 0.78rem;
  line-height: 1.35;
}

.isbn-zoom-control {
  min-width: 0;
  flex: 1;
  margin: 0;
}

.isbn-zoom-control > span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.3rem;
  color: #5f5f5b;
  font-size: 0.78rem;
}

.isbn-zoom-control input {
  min-height: 2rem;
  padding: 0;
}

.isbn-refocus-button {
  margin: 0;
  white-space: nowrap;
}

.isbn-scanner-status {
  min-height: 1.2rem;
  margin-top: 0.65rem;
}

.add-book-cover-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0.8rem;
  border: 1px solid #e7e7e3;
  border-radius: 0.7rem;
  background: #fafaf8;
}

.add-book-cover-preview img {
  width: 3.8rem;
  height: 5.2rem;
  border-radius: 0.25rem;
  object-fit: cover;
  box-shadow: 0 0.35rem 0.9rem rgba(20, 20, 18, 0.14);
}

.add-book-cover-preview figcaption {
  color: #60605c;
  font-size: 0.85rem;
  font-weight: 650;
}

.isbn-lookup-field small {
  min-height: 1.1rem;
}

.book-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.book-form-fields {
  display: contents;
}

.book-form small {
  display: block;
  margin-top: 0.35rem;
  color: #777773;
  font-weight: 400;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

.form-actions button {
  margin-top: 0 !important;
}

.catalog-status {
  min-height: 1.5rem;
  margin: 0 0 1rem;
  color: #777773;
  font-size: 0.9rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.5rem;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 24rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e4e4e0;
  border-radius: 1rem;
  background: #fff;
  color: #171717;
  font-weight: 400;
  text-align: left;
  box-shadow: 0 0.65rem 1.8rem rgba(18, 18, 18, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.book-card:hover {
  box-shadow: 0 0.9rem 2.2rem rgba(18, 18, 18, 0.11);
  transform: translateY(-2px);
}

.book-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 14rem;
  padding: 1.45rem;
}

.book-card-cover {
  display: grid;
  height: 16rem;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  place-items: center;
  border-bottom: 1px solid #ecece8;
  background: #f1f1ee;
}

.book-card-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.book-card-title {
  display: block;
  margin: 0.55rem 0 0.7rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.book-authors {
  margin: 0;
  color: #6e6e69;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.book-subtitle,
.book-meta,
.book-description {
  margin: 0 0 0.8rem;
  color: #6c6c68;
  line-height: 1.5;
}

.book-subtitle {
  font-size: 0.95rem;
}

.book-genres {
  margin: -0.25rem 0 0.8rem;
  color: #777773;
  font-size: 0.76rem;
}

.book-meta {
  padding-top: 0.2rem;
  border-top: 1px solid #efefec;
  font-size: 0.82rem;
}

.book-description {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.9rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.copy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

.copy-badge {
  padding: 0.35rem 0.55rem;
  border: 1px solid #e4e4e0;
  border-radius: 999px;
  background: #f4f4f1;
  color: #555551;
  font-size: 0.72rem;
  font-weight: 650;
}

.copy-available {
  border-color: #dce9de;
  background: #f0f7f1;
  color: #2f6840;
}

.reading-read {
  border-color: #cfe2d3;
  background: #eaf5ec;
  color: #27613a;
}

.reading-unread {
  border-color: #e3e3df;
  background: #f3f3f0;
  color: #666663;
}

.copy-on_loan {
  border-color: #eee0c8;
  background: #fbf6eb;
  color: #855e20;
}

.copy-stale {
  border-color: #efd6d0;
  background: #fbefed;
  color: #9a3d32;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 4rem 2rem;
  border: 1px dashed #d3d3ce;
  border-radius: 0.9rem;
  background: #fff;
  text-align: center;
}

.empty-state h3 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.book-dialog,
.utility-dialog {
  width: min(40rem, calc(100% - 2rem));
  max-height: min(86dvh, 46rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid #dededa;
  border-radius: 1rem;
  background: #fff;
  color: #171717;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.2);
}

.book-dialog::backdrop,
.utility-dialog::backdrop {
  background: rgba(20, 20, 18, 0.42);
  backdrop-filter: blur(3px);
}

.utility-dialog {
  width: min(34rem, calc(100% - 2rem));
}

.loans-dialog {
  width: min(52rem, calc(100% - 2rem));
}

.add-book-dialog {
  width: min(42rem, calc(100% - 2rem));
}

.floating-catalog-actions {
  position: fixed;
  z-index: 8;
  right: max(1rem, calc((100vw - 82rem) / 2));
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.floating-action {
  position: relative;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  place-items: center;
  border: 1px solid #deded9;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: #20201e;
  box-shadow: 0 0.75rem 2rem rgba(20, 20, 18, 0.13);
  backdrop-filter: blur(12px);
}

.floating-action svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.floating-action::after {
  position: absolute;
  right: calc(100% + 0.6rem);
  padding: 0.35rem 0.55rem;
  border-radius: 0.35rem;
  background: #20201e;
  color: #fff;
  content: attr(data-label);
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translateX(0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.floating-action:hover::after,
.floating-action:focus-visible::after {
  opacity: 1;
  transform: translateX(0);
}

.floating-action-primary {
  border-color: #171717;
  background: #171717;
  color: #fff;
}

.floating-action-primary:hover {
  background: #2c2c29;
}

.floating-count,
.floating-indicator {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.25rem;
  border: 2px solid #f7f7f5;
  border-radius: 999px;
  background: #a6473c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 750;
  line-height: 1rem;
  text-align: center;
}

.floating-indicator {
  min-width: 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  padding: 0;
  background: #36704a;
}

.dialog-shell {
  max-height: min(86dvh, 46rem);
  padding: 0 1.5rem 1.5rem;
  overflow-y: auto;
}

.dialog-topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -1.5rem;
  padding: 0.75rem 1rem 0.65rem 1.5rem;
  border-bottom: 1px solid #ecece8;
  background: rgba(255, 255, 255, 0.96);
  color: #777773;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.dialog-close {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  place-items: center;
  border-color: #e1e1dd;
  border-radius: 50%;
  background: #f5f5f2;
  color: #292927;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
}

.dialog-loading {
  padding: 4rem 0;
  color: #777773;
  text-align: center;
}

.notice {
  margin: 1.25rem 0 0;
  padding: 0.8rem 1rem;
  border: 1px solid #dce9de;
  border-radius: 0.65rem;
  background: #f0f7f1;
  color: #2f6840;
  font-size: 0.9rem;
}

.book-detail-header {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.1rem, 3vw, 1.75rem);
  padding: 1.5rem 0 1.1rem;
  border-bottom: 1px solid #ecece8;
}

.book-detail-cover {
  margin: 0;
}

.book-detail-cover img {
  display: block;
  width: 100%;
  max-height: 14rem;
  border-radius: 0.35rem;
  object-fit: contain;
  box-shadow: 0 0.8rem 2rem rgba(20, 20, 18, 0.16);
}

.book-detail-cover[hidden] + .book-detail-heading {
  grid-column: 1 / -1;
}

.book-detail-header h2 {
  max-width: 38rem;
  margin: 0.55rem 0 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.book-detail-subtitle,
.book-detail-meta,
.book-detail-genres,
.book-detail-description {
  color: #666663;
  line-height: 1.6;
}

.book-detail-subtitle {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.book-detail-meta {
  margin: 0;
  font-size: 0.86rem;
}

.book-detail-genres {
  margin: 0.45rem 0 0;
  color: #4f6c58;
  font-size: 0.78rem;
  font-weight: 650;
}

.book-detail-description {
  margin: 1.5rem 0;
  white-space: pre-line;
}

.book-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.1rem 0 1.6rem;
}

.reading-toggle[aria-pressed="true"] {
  border-color: #cfe2d3;
  background: #eaf5ec;
  color: #27613a;
}

.copies-section {
  padding-top: 0.25rem;
}

.subsection-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.subsection-heading h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.subsection-heading > span {
  display: grid;
  min-width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 999px;
  background: #f0f0ed;
  color: #666663;
  font-size: 0.8rem;
}

.detail-copy-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.detail-copy {
  padding: 1rem;
  border: 1px solid #e6e6e2;
  border-radius: 0.7rem;
  background: #fafaf8;
}

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

.detail-copy p {
  margin: 0.55rem 0 0;
  color: #6e6e69;
  font-size: 0.86rem;
  line-height: 1.5;
}

.detail-copy .active-loan-summary {
  color: #855e20;
  font-weight: 650;
}

.small-button {
  margin-top: 0.8rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
}

.loan-history-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ecece8;
}

.loan-history-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.loan-history-item {
  padding: 1rem;
  border-left: 0.2rem solid #deded9;
  background: #fafaf8;
}

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

.loan-history-item p {
  margin: 0.55rem 0 0;
  color: #6e6e69;
  font-size: 0.84rem;
  line-height: 1.55;
}

.loan-state {
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.loan-active {
  background: #fbf1df;
  color: #855e20;
}

.loan-returned {
  background: #efefec;
  color: #656561;
}

.loan-stale {
  background: #fbefed;
  color: #9a3d32;
}

.muted {
  color: #777773;
}

.dialog-form-panel {
  padding-top: 2rem;
}

.compact-form {
  margin-top: 1.5rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

:focus-visible {
  outline: 3px solid #91918c;
  outline-offset: 3px;
}

@media (max-width: 58rem) {
  .floating-catalog-actions {
    right: 1rem;
  }
}

@media (max-width: 36rem) {
  .site-header {
    align-items: flex-start;
  }

  .site-header nav {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }

  main {
    width: min(100% - 1.5rem, 76rem);
  }

  .hero {
    padding-top: 3.5rem;
  }

  .hero h1,
  .hero h2 {
    font-size: clamp(2.7rem, 14vw, 4.2rem);
  }

  body.authenticated .hero {
    padding-top: 1.5rem;
  }

  .section-heading,
  .form-heading,
  .loan-overview-heading {
    flex-direction: column;
    gap: 1rem;
  }

  .loan-overview-counts {
    justify-content: flex-start;
  }

  .filters,
  .book-form {
    grid-template-columns: 1fr;
  }

  .isbn-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .isbn-actions input {
    grid-column: 1 / -1;
  }

  .isbn-actions button {
    width: 100%;
  }

  .book-detail-header {
    grid-template-columns: minmax(5.5rem, 7rem) minmax(0, 1fr);
    align-items: start;
    gap: 0.9rem;
  }

  .book-detail-header h2 {
    font-size: clamp(1.9rem, 9vw, 2.5rem);
  }

  .input-action {
    align-items: stretch;
    flex-direction: column;
  }

  .field-wide {
    grid-column: auto;
  }

  .form-actions {
    flex-direction: column;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .active-loan-list {
    grid-template-columns: 1fr;
  }

  .book-dialog {
    width: calc(100% - 1.5rem);
    max-height: 88dvh;
    border-radius: 0.8rem;
  }

  .utility-dialog {
    width: calc(100% - 1.5rem);
    max-height: 88dvh;
    border-radius: 0.8rem;
  }

  .floating-catalog-actions {
    right: 0.8rem;
    bottom: 0.8rem;
  }

  .floating-action {
    width: 3rem;
    height: 3rem;
  }

  .dialog-shell {
    max-height: 88dvh;
    padding: 0 1rem 1rem;
  }

  .dialog-topbar {
    margin: 0 -1rem;
    padding-left: 1rem;
  }

  .book-detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  #edit-book-button {
    grid-column: 1 / -1;
  }

  .isbn-ocr-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
