:root {
  font:
    15px/1.45 "Helvetica Neue",
    Arial,
    sans-serif;
  color: #242620;
  background: #f8f7f3;
  --line: #d8d8ce;
  --muted: #686b61;
  --red: #9c432d;
  --paper: #fffefa;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
.upload {
  cursor: pointer;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #af712f;
  outline-offset: 3px;
}
button,
.upload {
  border-radius: 5px;
}
button:enabled:hover,
.upload:hover {
  filter: brightness(0.94);
}
.top {
  height: 72px;
  background: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 65px);
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font:
    700 33px/0.9 Georgia,
    serif;
  letter-spacing: -2.2px;
  color: #20241f;
  text-decoration: none;
}
.wordmark span {
  color: var(--red);
}
.product {
  font-size: 13px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
}
.top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.outline,
.dark {
  padding: 8px 13px;
  border: 1px solid #c9cbc0;
  background: var(--paper);
  font-size: 13px;
  font-weight: 560;
}
.dark {
  background: #273a36;
  border-color: #273a36;
  color: white;
}
.dark span {
  margin-left: 8px;
}
main,
footer {
  max-width: 1540px;
  margin: auto;
  padding: 0 clamp(16px, 4vw, 65px);
}
.issue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 24px 0 21px;
  gap: 12px;
}
.kicker,
.desk-head {
  font-size: 10px;
  letter-spacing: 0.17em;
  font-weight: 700;
  color: var(--red);
}
.kicker {
  margin: 0 0 5px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 input {
  background: none;
  border: 0;
  font:
    normal clamp(30px, 3.3vw, 47px) / 1.1 Georgia,
    serif;
  letter-spacing: -0.045em;
  padding: 0;
  width: min(485px, 49vw);
  text-overflow: ellipsis;
}
h1 input:hover {
  box-shadow: 0 1px #babbb2;
}
.issue-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  display: grid;
  gap: 2px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(295px, 2.45fr) minmax(
      225px,
      1fr
    );
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--paper);
}
.rail,
.inspector {
  padding: 19px 16px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h2 {
  font:
    600 16px/1.15 "Helvetica Neue",
    Arial,
    sans-serif;
}
.section-title span {
  font-size: 12px;
  color: var(--muted);
}
.page-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin: 4px 0;
  border: 1px solid transparent;
  background: none;
  padding: 7px;
  text-align: left;
}
.page-row[aria-current="page"] {
  background: #f1f0e8;
  border-color: #c4c7b7;
}
.page-row img {
  width: 36px;
  height: 48px;
  object-fit: cover;
  border: 1px solid #ccc;
}
.page-row strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
}
.page-row small,
.hint,
.small {
  font-size: 12px;
  color: var(--muted);
}
.wide {
  width: 100%;
  text-align: left;
  margin-top: 9px;
  display: flex;
  justify-content: space-between;
}
.order {
  border-top: 1px solid var(--line);
  margin-top: 17px;
  padding-top: 10px;
  display: flex;
  gap: 4px;
}
.order button,
.pager button,
.close {
  background: transparent;
  border: 1px solid var(--line);
  padding: 3px 8px;
}
.order button {
  font-size: 12px;
}
.desk {
  background: #e5e6df;
  border-inline: 1px solid var(--line);
  padding: 12px clamp(10px, 2vw, 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.desk-head {
  color: #656d61;
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}
.paper-wrap {
  position: relative;
  width: min(100%, 365px);
  margin: auto;
  aspect-ratio: 3/4;
  box-shadow: 0 8px 26px #20302428;
}
.paper-wrap canvas,
.reading canvas {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 3/4;
  background: white;
}
.paper-wrap canvas {
  touch-action: none;
}
.paper-wrap #selection {
  position: absolute;
  border: 1.5px solid #edb757;
  pointer-events: none;
  box-shadow: 0 0 0 1px #0002;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 13px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.pager button {
  width: 30px;
  height: 28px;
  line-height: 16px;
  background: var(--paper);
  font-size: 20px;
}
.field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 12px;
}
.field :is(input, textarea, select),
#search {
  border: 1px solid #c7cac1;
  padding: 7px 8px;
  border-radius: 4px;
  width: 100%;
  font-size: 13px;
  font-weight: 400;
  background: #fff;
}
.field textarea {
  resize: vertical;
}
.field input[type="color"] {
  width: 40px;
  height: 29px;
  padding: 2px;
}
.field input[type="range"] {
  padding: 0;
}
.toolrow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}
.toolrow button {
  font-size: 12px;
  padding: 5px 9px;
}
.hint {
  margin: 8px 0 12px;
}
.inspector .hint {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.small {
  overflow-wrap: anywhere;
}
dialog {
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 23px;
  width: min(730px, 95vw);
  max-height: 92dvh;
  overflow: auto;
  box-shadow: 0 18px 75px #17202150;
}
dialog::backdrop {
  background: #16242199;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 16px;
}
.dialog-head h2 {
  font:
    normal 29px Georgia,
    serif;
  letter-spacing: -0.04em;
}
.close {
  font-size: 22px;
  line-height: 25px;
}
.library-bar {
  display: flex;
  gap: 10px;
}
.library-bar #search {
  flex: 1;
}
.upload input {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.upload:focus-within {
  outline: 3px solid #af712f;
}
#catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 15px;
}
.card {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 5px;
}
.card img {
  width: 100%;
  height: 155px;
  object-fit: contain;
  background: #e8e7df;
}
.card h3 {
  font:
    normal 17px Georgia,
    serif;
  margin: 6px 0;
}
.card small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
#lib-status {
  font-size: 13px;
  color: var(--red);
  margin: 8px 0;
}
.reading {
  display: grid;
  place-items: center;
  background: #e4e5dd;
  padding: 10px;
}
.reading canvas {
  width: min(100%, 43vh);
  box-shadow: 2px 4px 14px #0002;
}
.turn {
  animation: turn 0.28s ease-out;
  transform-origin: left center;
}
@keyframes turn {
  from {
    transform: perspective(1200px) rotateY(-14deg);
    opacity: 0.65;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding-block: 13px 20px;
}
.danger {
  color: #953e2c;
}
#status[data-error="true"] {
  color: #a43320;
}
@media (max-width: 870px) {
  .workspace {
    grid-template-columns: 145px minmax(220px, 1fr) 195px;
  }
  .rail,
  .inspector {
    padding: 14px 10px;
  }
  .desk {
    padding-inline: 10px;
  }
  main,
  footer {
    padding-inline: 12px;
  }
  .top {
    padding-inline: 14px;
  }
}
@media (max-width: 650px) {
  .top {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    gap: 7px;
    padding-block: 8px;
  }
  .product {
    display: none;
  }
  .wordmark {
    font-size: 27px;
  }
  .top-actions button {
    font-size: 12px;
    padding: 7px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .desk {
    order: 1;
    border: 0;
  }
  .rail {
    order: 2;
  }
  .inspector {
    order: 3;
    border-top: 1px solid var(--line);
  }
  .paper-wrap {
    width: min(83%, 300px);
  }
  #pages {
    display: flex;
    overflow: auto;
  }
  .page-row {
    flex: 0 0 125px;
  }
  .rail .wide {
    display: inline-flex;
    width: auto;
    margin-right: 6px;
  }
  .rail .order {
    display: inline-flex;
    margin: 7px 0;
  }
  .issue-head {
    padding-block: 14px;
  }
  .issue-meta {
    font-size: 10px;
  }
  .library-bar {
    flex-wrap: wrap;
  }
  dialog {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .turn {
    animation: none;
  }
}
