:root {
  --ink: #18333d;
  --muted: #697980;
  --paper: #fffdf8;
  --canvas: #f4f0e8;
  --navy: #173e4d;
  --teal: #1c706d;
  --line: #dbe1dc;
  --danger: #b43c3c;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
.site-shell {
  width: min(1160px, calc(100% - 2rem));
  margin: auto;
  padding: 1.25rem 0 4rem;
}
main {
  padding-top: 2.75rem;
}
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--navy);
}
h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin: 0.2rem 0;
}
h2 {
  margin: 0.25rem 0;
}
a {
  color: inherit;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: bold;
  text-decoration: none;
}
.brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  object-fit: contain;
}
.main-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}
.main-nav a {
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}
.main-nav a:hover {
  color: var(--teal);
}
.language-switcher {
  display: flex;
  gap: 0.35rem;
}
.language-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  font-size: 0.75rem;
  text-decoration: none;
}
.language-link.is-active {
  background: #e4f0ed;
  border-color: #b9d5d0;
  color: var(--navy);
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero {
  padding: 2.5rem;
  margin-bottom: 2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
}
.hero p:last-child {
  color: var(--muted);
}
.section-title {
  margin: 2.5rem 0 1rem;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}
.btn-primary {
  color: #fff;
  background: var(--teal);
}
.btn-primary:hover {
  background: #155b59;
}
.btn-secondary {
  color: var(--navy);
  background: #fff;
  border-color: #bdcac5;
}
.btn-danger {
  color: #fff;
  background: var(--danger);
}
.action-row,
.modal-actions,
.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.action-row form {
  margin: 0;
}
.filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(10rem, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
}
.filter-panel-books {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid #c6d0cb;
  border-radius: 0.45rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #cbe4df;
  border-color: var(--teal);
}
textarea {
  resize: vertical;
}
.result-count {
  color: var(--muted);
  font-size: 0.9rem;
}
.author-list {
  display: grid;
  gap: 0.65rem;
}
.author-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}
.author-row h2 {
  font-size: 1.2rem;
}
.empty-state {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
  background: var(--paper);
  border: 1px dashed #b6c5be;
  border-radius: 0.75rem;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.25rem;
}
.book-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px #18333d18;
}
.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #e8ece8;
}
.book-card div {
  padding: 0.8rem;
}
.book-card h2 {
  font-size: 1.05rem;
}
.book-card p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.modal {
  width: min(680px, calc(100% - 1.5rem));
  max-height: min(90vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 0.85rem;
  box-shadow: 0 20px 60px #10262f66;
}
.modal::backdrop {
  background: #10262f88;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.modal form {
  padding: 1.4rem;
}
.modal-book form,
.book-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  overflow: auto;
}
.full-width {
  grid-column: 1 / -1;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.5rem;
}
.icon-button:hover {
  background: #edf1ed;
}
.error-message,
.flash-message {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  color: #8b2525;
  background: #fdeaea;
  border: 1px solid #efc0c0;
}
.modal .error-message {
  margin: 1.2rem 1.4rem 0;
}
.form-page {
  max-width: 720px;
}
.edit-form {
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
}
.edit-form:not(.book-form) {
  display: grid;
  gap: 1rem;
}
.book-details {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: 2.25rem;
  align-items: start;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
}
.book-details dl {
  margin: 0;
  display: grid;
  gap: 1rem;
}
.book-details dl div {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
}
.book-details dt {
  color: var(--muted);
  font-weight: 700;
}
.book-details dd {
  margin: 0;
}
.book-details .description {
  grid-template-columns: 1fr;
}
@media (max-width: 760px) {
  .site-header {
    flex-wrap: wrap;
  }
  .main-nav {
    order: 3;
    width: 100%;
    margin: 0;
  }
  .language-switcher {
    margin-left: auto;
  }
  .page-heading,
  .author-row {
    align-items: start;
    flex-direction: column;
  }
  .filter-panel,
  .filter-panel-books,
  .modal-book form,
  .book-form,
  .book-details {
    grid-template-columns: 1fr;
  }
  .filter-actions {
    width: 100%;
  }
  .filter-actions .btn {
    flex: 1;
  }
  .book-details dl div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}
