:root {
  color-scheme: light;
  --ink: #2C1F0E;
  --amber: #B87D2A;
  --paper: #F5EDD8;
  --dust: #8C7B65;
  --linen: #F0E8D4;
  --white: #fffaf0;
  --line: rgba(44, 31, 14, .18);
  --shadow: 0 18px 50px rgba(44, 31, 14, .10);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --page-max: 1280px;
  --wide-page-max: 1480px;
}

* { box-sizing: border-box; }
html, body, #app {
  min-height: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

button, input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--amber);
  border-radius: 4px;
  background: var(--amber);
  color: #fffaf0;
  padding: 0 18px;
  font-weight: 500;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
}

button.link {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}

button:disabled {
  opacity: .48;
  cursor: wait;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  padding: 9px 11px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--dust);
  font-size: 14px;
  line-height: 1.35;
}

.shell {
  min-height: 100vh;
}

.site-header {
  width: min(var(--wide-page-max), calc(100% - clamp(36px, 8vw, 140px)));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin: 0 auto;
  padding: 26px 0 18px;
}

.brand {
  display: inline-grid;
  gap: 7px;
  justify-items: start;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}

.brand strong {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  line-height: .9;
}

.brand span {
  width: 100%;
  height: 1.5px;
  background: var(--amber);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--dust);
  font-size: 15px;
}

.nav button {
  color: inherit;
}

.nav button.active {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-underline-offset: 5px;
}

.language-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.flag-filter {
  min-width: 42px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  font-size: 18px;
}

.flag-filter:first-child {
  min-width: auto;
  color: var(--dust);
  font-size: 13px;
}

.flag-filter.active {
  border-color: var(--amber);
  background: var(--linen);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: min(var(--page-max), calc(100% - clamp(32px, 6vw, 96px)));
  margin: 0 auto;
  padding: 30px 0 70px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
  padding: clamp(42px, 7vw, 88px) 0 clamp(34px, 5vw, 64px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(44px, 6.2vw, 92px);
  line-height: 1;
  overflow-wrap: normal;
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
}

h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.intro p {
  margin: 0;
  color: var(--dust);
  font-size: 18px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 30px;
}

.tab {
  min-height: 38px;
  background: transparent;
  color: var(--ink);
}

.tab.active {
  background: var(--amber);
  color: #fffaf0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.book-card,
.author-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--linen);
  box-shadow: var(--shadow);
}

.book-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  align-items: start;
}

.book-card img {
  width: 112px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px;
  background: var(--white);
}

.book-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.meta,
.muted {
  color: var(--dust);
}

.rating {
  color: var(--amber);
  font-weight: 700;
}

.language-label {
  color: var(--dust);
  font-size: 14px;
  font-weight: 500;
}

.language-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  color: var(--dust);
  font-size: 14px;
}

.language-switch button {
  min-height: 34px;
  padding: 0 12px;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.book-actions a,
.book-actions .unavailable {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--amber);
  border-radius: 4px;
  color: var(--ink);
  padding: 0 16px;
  text-decoration: none;
  font-weight: 500;
}

.book-actions a:hover {
  background: var(--amber);
  color: #fffaf0;
}

.book-actions .unavailable {
  border-color: var(--line);
  color: var(--dust);
}

.author-card {
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 22px;
  padding: 22px;
  text-align: left;
  color: var(--ink);
}

.author-card p {
  margin: 12px 0 0;
  color: var(--dust);
}

.detail {
  display: grid;
  grid-template-columns: minmax(240px, 380px) minmax(0, 760px);
  gap: clamp(28px, 6vw, 80px);
  align-items: start;
  justify-content: center;
}

.detail-cover {
  position: sticky;
  top: 24px;
}

.detail-cover img {
  width: 100%;
  max-height: calc(100vh - 48px);
  display: block;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.detail article {
  min-width: 0;
}

.subtitle {
  margin: 6px 0 4px;
  color: var(--dust);
}

.verdict {
  margin: 26px 0;
  padding: 18px 22px;
  border-left: 2px solid var(--amber);
  background: var(--linen);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.45;
}

.section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.section h3 {
  margin-bottom: 12px;
}

.section p {
  margin: 0 0 15px;
}

.admin {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 22px;
}

.form {
  display: grid;
  gap: 15px;
}

.notice {
  min-height: 24px;
  color: var(--amber);
}

.error {
  min-height: 24px;
  color: #8f2d16;
}

.empty {
  padding: 42px;
  border: 1px dashed var(--line);
  color: var(--dust);
  text-align: center;
}

.style-list {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--dust);
}

@media (min-width: 1500px) {
  :root {
    --page-max: 1420px;
    --wide-page-max: 1620px;
  }

  .intro {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 420px);
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
  }

  .detail {
    grid-template-columns: minmax(300px, 430px) minmax(0, 820px);
    gap: clamp(54px, 5vw, 92px);
  }
}

@media (max-width: 820px) {
  .site-header {
    width: min(100% - 32px, var(--page-max));
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 16px;
  }

  .nav {
    justify-content: flex-start;
  }

  .language-nav {
    align-self: stretch;
    flex-wrap: wrap;
  }

  .intro,
  .detail,
  .admin {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    position: static;
    width: min(290px, 100%);
    margin: 0 auto;
  }

  .book-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .book-card img {
    width: 96px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .page {
    width: calc(100% - 28px);
    padding-top: 18px;
  }

  .brand strong {
    font-size: 32px;
  }

  .nav {
    gap: 12px;
  }

  .intro {
    padding: 30px 0 28px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(36px, 12vw, 46px);
    line-height: 1.03;
  }

  h2 {
    font-size: 34px;
  }

  h3 {
    font-size: 25px;
  }

  .tabs {
    margin: 20px 0 22px;
  }

  .tab,
  .tabs button {
    flex: 1 1 auto;
  }

  .book-card {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 13px;
    padding: 12px;
  }

  .book-card img {
    width: 86px;
  }

  .book-card strong {
    font-size: 22px;
  }

  .book-actions a,
  .book-actions .unavailable {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 8px 14px;
  }

  .verdict {
    margin: 22px 0;
    padding: 15px 17px;
    font-size: 22px;
  }

  .section {
    padding: 23px 0;
  }

  .empty {
    padding: 30px 18px;
  }
}
