@font-face {
  font-family: Inter;
  src: url("assets/inter-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --background: #f8f8f8;
  --surface: #ffffff;
  --stage: #e3e3e3;
  --ink: #181818;
  --muted: #626262;
  --line: #d0d0d0;
  --brand: #551f0c;
  --accent: #fbb305;
  --orange: #e34c00;
  --brand-hover: #713318;
  --selected: #fff0c9;
  --focus: #e34c00;
  --reading-size: 18px;
  --pw: 340px;
  --ph: 481px;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, sans-serif;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button,
input {
  font: inherit;
  color: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.3;
}
button:hover,
.button:hover {
  background: var(--stage);
}
button:disabled,
input:disabled {
  cursor: default;
  opacity: 0.45;
}
button:disabled:hover {
  background: transparent;
}
.primary {
  background: var(--brand);
  color: var(--surface);
}
.primary:hover {
  background: var(--brand-hover);
}
button[aria-pressed="true"].icon-button {
  color: var(--brand);
  background: var(--selected);
}
button[aria-pressed="true"] #i-bookmark {
  fill: currentColor;
}
a {
  color: var(--brand);
  text-underline-offset: 4px;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::selection {
  background: var(--accent);
  color: var(--brand);
}
input {
  caret-color: var(--brand);
  accent-color: var(--brand);
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-definitions {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 10px;
}
.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;
}
.skip-link {
  position: fixed;
  inset: 12px auto auto 12px;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--surface);
  padding: 12px;
}
.skip-link:focus {
  transform: none;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 20px max(24px, calc((100vw - 1320px) / 2));
  min-height: 88px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  line-height: 1.2;
  color: var(--brand);
  font-size: 15px;
}
.brand strong {
  font-weight: 800;
  font-size: 18px;
}
.brand img {
  object-fit: contain;
}
.header-actions,
.toolbar-group,
.zoom-controls,
.pagination,
.mode-switch {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-actions {
  gap: 16px;
  font-size: 14px;
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 28px 24px 12px;
}
.edition-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
h1 {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  text-wrap: balance;
  color: var(--brand);
}
.edition-heading p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}
.text-button {
  font-size: 14px;
  color: var(--brand);
}
.reader {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.mode-switch {
  background: var(--background);
  border-radius: 8px;
  padding: 3px;
}
.mode-switch button {
  padding: 8px 18px;
}
.mode-switch .active {
  background: var(--brand);
  color: var(--surface);
}
.workspace {
  height: clamp(420px, 62vh, 760px);
  position: relative;
  background: var(--stage);
  overflow: hidden;
}
.book-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.book {
  display: flex;
  flex-shrink: 0;
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  perspective: 2000px;
  transform-style: preserve-3d;
}
.paper {
  width: var(--pw);
  height: var(--ph);
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: 0 12px 24px rgb(53 43 34 / 16%);
  position: relative;
}
.paper img,
.turning-sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.book.cover-front {
  transform: translateX(calc(var(--pw) * -0.5));
}
.book.cover-front #leftPage,
.book.cover-back #rightPage {
  visibility: hidden;
  box-shadow: none;
}
.book.cover-back {
  transform: translateX(calc(var(--pw) * 0.5));
}
.single-page .book {
  width: var(--pw);
  transform: none;
}
.single-page #leftPage {
  display: none;
}
.single-page .book #rightPage {
  visibility: visible;
}
.turning-sheet {
  display: none;
  position: absolute;
  inset: 0 0 auto auto;
  width: var(--pw);
  height: var(--ph);
  transform-origin: left center;
  transform-style: preserve-3d;
  z-index: 3;
}
.turning-sheet.active {
  display: block;
}
.turning-sheet.backward {
  inset: 0 auto auto 0;
  transform-origin: right center;
}
.sheet-front,
.sheet-back {
  position: absolute;
  inset: 0;
  background: var(--surface);
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 8px 20px rgb(53 43 34 / 18%);
}
.sheet-back {
  transform: rotateY(180deg);
}
.side {
  position: absolute;
  top: calc(50% - 22px);
  background: var(--surface);
  z-index: 4;
}
.side.previous {
  left: 14px;
}
.side.next {
  right: 14px;
}
.open-book {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  z-index: 5;
  box-shadow: 0 4px 12px rgb(53 43 34 / 20%);
}
.workspace.opened .open-book,
.workspace.reading .open-book,
.workspace.zoomed .open-book,
.workspace.reading .side {
  display: none;
}
.workspace.zoomed .book-viewport {
  display: block;
  padding: 30px 60px;
  touch-action: auto;
}
.workspace.zoomed .book {
  margin: auto;
  transform: none;
}
.workspace.zoomed .book.cover-front {
  width: var(--pw);
}
.workspace.zoomed .cover-front #leftPage {
  display: none;
}
.reader-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  font-size: 14px;
}
.page-position {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
#pageInput {
  width: 44px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
  font-size: 16px;
  appearance: textfield;
  background: var(--surface);
}
#pageInput::-webkit-inner-spin-button,
#pageInput::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.page-total {
  color: var(--muted);
  margin-left: 4px;
}
.page-caption {
  color: var(--muted);
  text-align: center;
  margin: 0;
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: anywhere;
}
#zoomLabel {
  min-width: 64px;
  font-variant-numeric: tabular-nums;
}
.progress {
  position: relative;
  height: 18px;
  background: var(--background);
}
.progress-fill {
  height: 3px;
  background: var(--orange);
  width: 5%;
}
#pageRange {
  position: absolute;
  inset: -10px 0 0;
  width: 100%;
  height: 28px;
  margin: 0;
  cursor: pointer;
  background: transparent;
  opacity: 0;
}
.progress:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}
.below-reader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
}
.below-reader p {
  margin: 0;
}
.below-reader button {
  font-size: 14px;
  font-weight: 500;
}
.loading-state,
.error-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100%;
  padding: 28px;
  text-align: center;
  line-height: 1.6;
}
.error-state h2 {
  font-size: 24px;
  margin: 0;
  color: var(--brand);
}
.error-state p {
  margin: 12px 0 24px;
}
.error-state > div {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.error .side,
.error .open-book,
.loading .side,
.loading .open-book {
  display: none;
}
.reading-view {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  padding: 36px max(32px, calc((100% - 780px) / 2));
  font-size: var(--reading-size);
  line-height: 1.75;
}
.reading-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.reading-heading p {
  margin: 0;
}
.text-size {
  display: flex;
  gap: 4px;
}
.text-size button {
  font-size: 16px;
}
.reading-view h2 {
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.2;
  color: var(--brand);
  letter-spacing: -0.03em;
  margin: 20px 0 24px;
  text-wrap: balance;
}
.reading-view p {
  margin: 0 0 1.25em;
  overflow-wrap: anywhere;
}
.reading-sources {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.reading-sources h3 {
  font-size: 18px;
}
.reading-sources a {
  display: block;
  margin: 8px 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}
dialog {
  max-width: 740px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 48px);
  padding: 28px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(53 43 34 / 26%);
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: rgb(35 26 18 / 48%);
}
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.dialog-header h2 {
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.03em;
  color: var(--brand);
  margin: 6px 0 0;
  text-wrap: balance;
  line-height: 1.2;
}
dialog p {
  line-height: 1.65;
}
.content-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.content-tabs .active {
  background: var(--brand);
  color: var(--surface);
}
#savedCount {
  font-size: 12px;
  min-width: 18px;
  text-align: center;
}
.section-row {
  display: flex;
  width: 100%;
  text-align: left;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 4px;
  gap: 20px;
}
.section-number {
  font-size: 18px;
  min-width: 28px;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}
.section-row div {
  flex: 1;
  min-width: 0;
}
.section-row b,
.section-row small {
  display: block;
}
.section-row small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 6px;
  line-height: 1.5;
}
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 14px;
  padding-top: 12px;
}
.thumbnail {
  padding: 4px;
  display: block;
  text-align: left;
  border-radius: 4px;
  width: 100%;
  min-width: 0;
}
.thumbnail img {
  display: block;
  width: 100%;
  aspect-ratio: 210/297;
  object-fit: contain;
  background: var(--stage);
}
.thumbnail small {
  font-size: 12px;
  line-height: 1.5;
  display: block;
  margin-top: 10px;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.thumbnail b {
  color: var(--brand);
  margin-right: 6px;
}
.thumbnail.active {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.empty-state {
  grid-column: 1/-1;
  color: var(--muted);
  padding: 24px 0;
}
#searchDialog label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
#searchInput {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--background);
  font-size: 16px;
}
#searchStatus {
  font-size: 14px;
  color: var(--muted);
  margin: 16px 0;
}
.search-result {
  width: 100%;
  display: flex;
  align-items: flex-start;
  text-align: left;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.search-result img {
  width: 60px;
  height: 85px;
  object-fit: contain;
}
.search-result div {
  min-width: 0;
  flex: 1;
}
.result-page {
  display: block;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 8px;
}
.search-result b {
  display: block;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.search-result p {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.download-link {
  margin: 12px 0 20px;
}
.text-link {
  display: block;
  margin-bottom: 8px;
}
.dialog-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.shortcuts {
  margin: 24px 0;
}
.shortcuts > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.shortcuts dd {
  margin: 0;
  white-space: nowrap;
}
kbd {
  display: inline-block;
  padding: 4px 8px;
  background: var(--background);
  border: 1px solid var(--line);
  border-radius: 4px;
  font:
    14px Inter,
    sans-serif;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  padding: 14px 20px;
  border-radius: 8px;
  max-width: calc(100% - 32px);
  background: var(--brand);
  color: var(--surface);
  font-size: 14px;
  box-shadow: 0 8px 24px rgb(53 43 34 / 24%);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition:
    opacity 0.15s,
    transform 0.15s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.focus-mode .site-header,
.focus-mode .edition-heading,
.focus-mode .below-reader {
  display: none;
}
.partnership {
  max-width: 1272px;
  margin: 12px auto 40px;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.partnership h2 {
  color: var(--brand);
  font-size: 18px;
  line-height: 1.4;
  margin: 0 0 10px;
}
.partnership p {
  max-width: 72ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}
.partner-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}
.partner-links a {
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.partner-links a:hover {
  text-decoration: underline;
}
.partner-links span {
  color: var(--orange);
  font-size: 22px;
}
.about-partners {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.focus-mode .partnership {
  display: none;
}
@media (max-width: 1320px) {
  .partnership {
    margin-inline: 24px;
  }
}
@media (max-width: 620px) {
  .partnership {
    margin: 12px 16px 28px;
    display: block;
    padding-top: 24px;
  }
  .partner-links {
    margin-top: 16px;
  }
}
.focus-mode main {
  max-width: none;
  padding: 12px;
}
.focus-mode .workspace {
  height: calc(100dvh - 168px);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--background);
}
@media (max-width: 900px) {
  .page-caption {
    display: none;
  }
  .reader-toolbar {
    padding-inline: 10px;
  }
  .workspace {
    height: clamp(400px, 62vh, 650px);
  }
}
@media (max-width: 620px) {
  .site-header {
    padding: 14px 16px;
    gap: 12px;
    min-height: 76px;
  }
  .brand {
    gap: 8px;
    font-size: 12px;
  }
  .brand strong {
    font-size: 15px;
  }
  .brand img {
    width: 44px;
    height: 32px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions > button:first-child {
    display: none;
  }
  .header-actions button {
    font-size: 12px;
    padding: 10px;
  }
  .header-actions svg {
    width: 18px;
  }
  main {
    padding: 20px 12px 6px;
  }
  .edition-heading {
    display: block;
    margin-bottom: 16px;
  }
  .edition-heading p {
    font-size: 12px;
  }
  .edition-heading .text-button {
    padding: 10px 0;
  }
  h1 {
    font-size: 24px;
  }
  .reader-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }
  .toolbar-group {
    gap: 0;
  }
  .toolbar-group > button {
    padding-inline: 10px;
    font-size: 12px;
  }
  .tools .icon-button {
    width: 44px;
    padding: 10px;
  }
  .mode-switch {
    margin-inline-start: auto;
  }
  .mode-switch button {
    font-size: 12px;
    padding: 8px 12px;
  }
  .tools {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 4px;
  }
  .workspace {
    height: clamp(380px, 58vh, 620px);
  }
  .side.previous {
    left: 5px;
  }
  .side.next {
    right: 5px;
  }
  .side {
    display: none;
  }
  .reader-footer {
    padding: 8px;
    gap: 4px;
  }
  .pagination {
    gap: 0;
  }
  .zoom-controls {
    gap: 0;
  }
  #zoomLabel {
    min-width: 50px;
    padding: 8px 4px;
  }
  .zoom-controls .icon-button {
    width: 44px;
    min-width: 44px;
  }
  .reading-view {
    padding: 24px 20px;
  }
  .reading-heading {
    font-size: 10px;
  }
  .text-size button {
    padding: 10px;
    min-width: 44px;
  }
  .reading-view h2 {
    font-size: 28px;
  }
  .below-reader {
    font-size: 12px;
  }
  .below-reader button {
    font-size: 12px;
  }
  dialog {
    padding: 20px;
    max-height: calc(100dvh - 32px);
  }
  .thumbnail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 12px;
  }
  .section-row {
    gap: 12px;
  }
  .section-row small {
    font-size: 12px;
  }
  .toast {
    bottom: 12px;
  }
  .focus-mode main {
    padding: 6px;
  }
  .focus-mode .workspace {
    height: calc(100dvh - 216px);
  }
}
@media (max-width: 380px) {
  .reader-footer {
    flex-wrap: wrap;
  }
  .pagination {
    flex: 1;
    justify-content: center;
  }
  .zoom-controls {
    width: 100%;
    justify-content: center;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }
}
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}
@media (forced-colors: active) {
  button,
  .button,
  .mode-switch .active,
  .content-tabs .active {
    border: 1px solid ButtonText;
  }
  .progress-fill {
    background: Highlight;
  }
  .thumbnail.active {
    outline-color: Highlight;
  }
}
