/* Thư viện EPUB — page layer on top of the Classical design system.
   Every value here comes from the design; tokens come from styles.css. */

a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }
::selection { background: var(--color-accent-100); }

/* — shell — */
.page {
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  padding-bottom: 80px;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 28px);
}

/* — masthead — */
.ebk-head {
  padding: 56px 0 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  border-bottom: 1px solid var(--color-divider);
}
.ebk-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}
.ebk-title {
  font-size: clamp(34px, 7vw, 54px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 10px 0 0;
}
.ebk-lede {
  margin: 10px 0 0;
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}
.ebk-count { text-align: right; font-variant-numeric: tabular-nums; }
.ebk-count-num { font-family: var(--font-heading); font-size: 40px; line-height: 1; }
.ebk-count-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  margin-top: 4px;
}

/* — sticky toolbar — */
.ebk-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-bg);
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--color-divider);
}
.ebk-searchrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ebk-search { position: relative; flex: 1; min-width: 220px; }
.ebk-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent);
  pointer-events: none;
  display: flex;
}
.ebk-input {
  padding: 13px 16px 13px 42px;
  font-size: 16px;
  font-family: var(--font-body);
  border-radius: var(--radius-md);
}
.ebk-result {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  white-space: nowrap;
}

/* — genre chips — */
.ebk-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; align-items: center; }
.ebk-chips-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
  margin-right: 4px;
}
.ebk-chip {
  cursor: pointer;
  font-family: var(--font-body);
  background: transparent;
  border: 1px solid var(--color-divider);
  color: inherit;
  padding: 4px 11px;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 3px;
}
.ebk-chip:hover { border-color: var(--color-accent); }
.ebk-chip.is-active {
  background: var(--color-accent-100);
  border-color: var(--color-accent);
  color: var(--color-accent-800);
}

/* — author filter banner — */
.ebk-authorfilter { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.ebk-authorfilter[hidden] { display: none; }
.ebk-authorfilter-label { color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.ebk-authorfilter-name { font-family: var(--font-heading); font-size: 17px; font-style: normal; }
.ebk-authorfilter-clear { font-size: 12px; }

/* — table — */
.ebk-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  table-layout: fixed;
}
.ebk-table th.col-n { width: 4%; text-align: right; padding-right: 14px; }
.ebk-table th.col-title { width: 42%; }
.ebk-table th.col-author { width: 17%; }
.ebk-table th.col-genre { width: 15%; }
.ebk-table th.col-date { width: 10%; text-align: right; }
.ebk-table th.col-dl { width: 12%; text-align: right; }

.ebk-sort {
  all: unset;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.ebk-sort.is-active { color: var(--color-accent); }

.row-hit { vertical-align: top; }
.row-hit:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

.ebk-table td.col-n {
  text-align: right;
  padding-right: 14px;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
  font-size: 13px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.ebk-table td.col-title {
  padding-top: 12px;
  padding-bottom: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ebk-table td.col-author {
  padding-top: 16px;
  padding-bottom: 14px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.ebk-table td.col-genre { padding-top: 14px; padding-bottom: 14px; }
.ebk-table td.col-date {
  text-align: right;
  padding-top: 16px;
  padding-bottom: 14px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
}
.ebk-table td.col-dl { text-align: right; padding-top: 12px; padding-bottom: 12px; }

/* — row content — */
.lnk {
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 19px;
  line-height: 1.25;
  display: inline-block;
}
.lnk:hover { color: var(--color-accent-700); text-decoration: underline; }

.ebk-altsrow { display: flex; gap: 10px; align-items: center; margin-top: 5px; }
.ebk-altstoggle {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 4px;
  white-space: nowrap;
  font-family: var(--font-body);
}
.ebk-alts {
  margin-top: 8px;
  border-left: 1px solid var(--color-accent-300);
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ebk-alt {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 12.5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.ebk-alt-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ebk-alt-folder { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ebk-alt a { white-space: nowrap; }

.ebk-authorbtn {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: var(--color-text);
  text-decoration-color: transparent;
}
.ebk-authorbtn:hover { color: var(--color-accent-700); text-decoration: underline; }

.ebk-genres { display: flex; flex-wrap: wrap; gap: 5px; }
.ebk-genre { font-size: 10.5px; padding: 2px 8px; }

.ebk-dl { font-size: 12.5px; padding: 6px 12px; gap: 7px; }

/* — states — */
.ebk-empty { padding: 80px 0; text-align: center; }
.ebk-empty[hidden] { display: none; }
.ebk-empty-title { font-family: var(--font-heading); font-size: 26px; }
.ebk-empty-hint {
  margin-top: 8px;
  font-size: 14px;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
}
.ebk-more { display: flex; justify-content: center; margin-top: 32px; }
.ebk-more[hidden] { display: none; }
.ebk-more-btn { padding: 11px 28px; font-size: 14px; }
.ebk-foot {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--color-divider);
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* — responsive — */
@media (max-width: 1024px) {
  .col-n, .col-genre { display: none !important; }
}

@media (max-width: 760px) {
  .ebk-head { grid-template-columns: 1fr !important; padding-top: 34px !important; }
  .ebk-head .ebk-count { text-align: left !important; display: flex; align-items: baseline; gap: 8px; }
  .ebk-table thead { display: none; }
  .ebk-table, .ebk-table tbody, .ebk-table tr, .ebk-table td { display: block; width: 100%; }
  .ebk-table tr { padding: 16px 0; border-bottom: 1px solid var(--color-divider); }
  .ebk-table td { border: 0 !important; padding: 0 !important; }
  .col-author { margin-top: 6px !important; }
  .col-date { text-align: left !important; margin-top: 4px !important; }
  .col-dl { text-align: left !important; margin-top: 12px !important; }
  .col-dl .btn { min-height: 44px; padding: 10px 20px !important; font-size: 14px !important; }
  .input { min-height: 46px; }
}
