/* Shelf and reading purchases */
.shelf-page { padding: clamp(28px, 4.3vw, 58px) 0 clamp(42px, 6vw, 76px); }
.shelf-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-bottom: clamp(1rem, 2.7vw, 2.2rem);
  border-bottom: 1px solid #d9cfd9; color: #382b41;
}
.shelf-header h1 { margin: 0; color: inherit; font: 575 clamp(2.35rem,4.5vw,4.2rem)/1.25 var(--font-ui); letter-spacing: -.045em; }
.shelf-title a.secondary-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: .25rem; color: #65536a; text-decoration-color: #9e8a9f; }
.shelf-counts { display: flex; align-items: center; gap: clamp(1rem, 2vw, 1.95rem); margin: 0; padding: .8rem clamp(1.05rem,2.5vw,2rem); border-radius: 1.1rem; background: #eee6ef; }
.shelf-counts > div { display: grid; gap: .1rem; }
.shelf-counts > div + div { padding-left: clamp(1rem,2vw,1.95rem); border-left: 1px solid #cec0d0; }
.shelf-counts dt { color: #6c596f; font-size: .83rem; }
.shelf-counts dd { margin: 0; color: #493750; font: 550 clamp(1.6rem,2.9vw,2.6rem)/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
.shelf-counts small { margin-left: .28em; font: 500 .8rem var(--font-ui); }
.shelf-page > section:not(.shelf-membership) { margin-top: clamp(30px, 4vw, 48px); }
.shelf-page > section:not(.shelf-membership) > h2 {
  margin: 0 0 14px; color: var(--ink); font: 600 clamp(1.4rem, 2vw, 1.8rem)/1.45 var(--font-ui); letter-spacing: -.05em;
}
.shelf-message, .payment-success {
  margin: .9rem 0; padding: 12px 16px; border-radius: .7rem;
  background: #ede4ec; color: #503954; font-size: .93rem; line-height: 1.65;
}
.shelf-message:empty, .commerce-error:empty { display: none; }
.shelf-message:focus-visible { outline: 2px solid #9d601f; outline-offset: 3px; }
.shelf-membership {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: clamp(18px, 3vw, 30px); border-block: 1px solid var(--line); background: #eeeadf;
}
.membership-copy { min-width: 0; }
.membership-copy .eyebrow { color: #804536; margin: 0 0 4px; }
.membership-copy h2 {
  margin: 0; color: var(--ink); font: 550 clamp(1.45rem, 2.3vw, 2rem)/1.4 var(--font-ui);
  letter-spacing: -.045em;
}
.membership-period { margin: 6px 0 0; color: var(--muted); font-size: .93rem; }
.membership-actions { flex: none; }
.shelf-page button, #checkout button, .purchase-action { font: inherit; font-weight: 650; }
.secondary-button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 42px;
  padding: 7px 14px; border: 1px solid #b7a9b7; border-radius: 2rem;
  color: var(--ink); background: transparent; font-size: .9rem; line-height: 1.5;
}
.secondary-button:hover { background: #f2eaf0; border-color: #8f7c91; }
.membership-actions :is(.action-link, .secondary-button) { min-height: 43px; padding: 8px 17px; font-size: .91rem; }
.shelf-page button:disabled, #checkout button:disabled { opacity: .6; cursor: wait; }
.letter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.shelf-book {
  display: block; min-width: 0; color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
.shelf-book strong { display: block; color: var(--ink); font: 600 1.15rem/1.5 var(--font-ui); letter-spacing: -.045em; }
.shelf-book span { display: block; margin-top: 5px; color: var(--muted); font-size: .87rem; line-height: 1.6; }
.letter-grid .shelf-book {
  position: relative; padding: 15px 15px 16px; border-block: 1px solid var(--line); background: #f9f6ee;
}
.letter-grid .shelf-book::before {
  content: ""; display: block; width: 19px; height: 12px; margin-bottom: 12px;
  border: 1px solid #837767; border-radius: 1px; background:
    linear-gradient(33deg, transparent 46%, #837767 48% 52%, transparent 54%) top left / 51% 65% no-repeat,
    linear-gradient(-33deg, transparent 46%, #837767 48% 52%, transparent 54%) top right / 51% 65% no-repeat;
}
.letter-grid .shelf-book:hover, .notes-list .shelf-book:hover { border-color: #938a79; background: #f3eee2; }
.shelf-book:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.job-list { display: grid; gap: 1rem; }
.shelf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 0; padding: 19px 0; border-bottom: 1px solid var(--line);
}
.shelf-row > .shelf-book { flex: 1; padding-left: 14px; border-left: 3px double #946d5b; }
.shelf-row > .secondary-button { flex: none; font-size: .84rem; }
.shelf-empty { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(7rem,1fr); min-height: 12rem; align-items: stretch; overflow: hidden; border-radius: 1.4rem; background: #ece2e9; }
.shelf-empty-copy { align-self: center; padding: clamp(1.25rem, 3.3vw, 2.7rem); }
.shelf-empty h3 { margin: 0; color: #423048; font: 600 clamp(1.23rem, 2.25vw, 1.7rem)/1.55 var(--font-ui); letter-spacing: -.055em; }
.shelf-empty p { margin: .4rem 0 .8rem; max-width: 25em; color: #635366; font-size: .92rem; line-height: 1.75; }
.shelf-empty .secondary-link { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 1rem; border-radius: 2rem; background: #4a3452; color: #fff6ef; text-decoration: none; }
.shelf-empty .secondary-link:hover { background: #33223a; }
.owned-volume { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .65rem 1.2rem; align-items: start; padding: clamp(1rem,2vw,1.55rem); border: 1px solid #e1d6df; border-radius: 1.25rem; background: #fffdfb; }
.owned-volume .catalog-character { font-size: .7rem; }
.owned-volume .shelf-row { grid-column: 2; padding: 0; border: 0; }
.owned-volume .shelf-row > .shelf-book { padding: 0; border: 0; }
.shelf-answers-title, .owned-volume .shelf-answers { grid-column: 2; margin: 0; }
.shelf-answers-title { padding-top: .85rem; margin-top: .3rem; border-top: 1px solid #e4dbe2; color: #705c70; font-size: .88rem; }
.hidden-jobs { margin-top: 4px; border-block: 1px solid var(--line); }
.hidden-jobs summary {
  display: list-item; padding: 10px 1px; color: var(--muted); cursor: pointer; font-size: .9rem; font-weight: 600;
}
.hidden-jobs summary::marker { color: #698268; }
.hidden-jobs .shelf-row { flex-wrap: wrap; color: var(--muted); font-size: .91rem; }
.hidden-jobs .shelf-row > span { flex: 1 1 15rem; min-width: 0; overflow-wrap: anywhere; }
.shelf-item-actions, .shelf-delete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.shelf-item-actions button, .shelf-delete button { min-height: 42px; font-size: .86rem; }
.shelf-item-actions button:last-child { color: #7d4736; border-color: #c6aa99; }
.shelf-delete { flex-basis: 100%; padding-top: 13px; border-top: 1px solid #d6c8b6; }
.shelf-delete p { flex-basis: 100%; margin: 0 0 2px; color: #694735; line-height: 1.65; }
.shelf-delete button:last-child { color: #fff9ef; border-color: #874733; background: #874733; }
.shelf-delete button:last-child:hover { background: #733c2b; }
.notes-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 10px; }
.notes-list .shelf-book {
  padding: 15px 17px; border-block: 1px solid var(--line); background: #f9f6ee;
}
.shelf-answers { margin: .5rem 0 1rem; }
.notes-list .shelf-book span {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  white-space: pre-line;
}
.shelf-reading-link { display: block; color: inherit; text-decoration: none; }
.shelf-inquiry .shelf-reading-link span { display: block; white-space: pre-line; }
.shelf-inquiry .shelf-situation { color: var(--ink); }
.shelf-full-situation { margin-top: 5px; }
.shelf-full-situation summary { width: fit-content; color: var(--green); cursor: pointer; font-size: .87rem; }
.shelf-full-situation p { margin: 5px 0 0; font-size: .9rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.full-chapter:not(.reading-gate) { padding-top: 22px; border-top: 1px solid var(--line); }
.reading-main .reading-gate {
  padding: 18px 21px; border: 1px solid #cdd5c2; border-radius: 7px; background: #eff2e7;
}
.career-page .reading-gate { border-color: #dcd2be; background: #f4efe3; }
.reading-gate h2 { margin-bottom: 6px; font-size: 1.17rem; }
.reading-gate > p { margin: 3px 0; font-size: .94rem; }
.reading-terms > strong { display: block; font-size: 1.12rem; }
.reading-terms > .action-link {
  width: 100%; margin-top: 13px; min-height: 44px; padding: 8px 11px; text-align: center;
  text-decoration: none; font-size: .91rem; line-height: 1.55;
}
.reading-gate .purchase-action { display: none; }
.reading-terms .action-link:hover, .reading-gate .action-link:hover, #checkout .action-link:hover { background: #285543; }

#checkout {
  width: min(455px, calc(100% - 24px)); max-width: none; max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px); padding: 0; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid #dfd6dc; border-radius: 1.4rem; color: #403046; background: #fffcfa;
  box-shadow: 0 22px 70px #27132840;
}
#checkout::backdrop { background: #2f213b80; }
.checkout-body { --receipt-pad: clamp(18px, 4vw, 30px); padding: 0 var(--receipt-pad) var(--receipt-pad); }
.checkout-body > .eyebrow { margin: 0 0 .75rem; padding-top: var(--receipt-pad); color: #715a75; }
#checkout-title {
  margin: 0; color: var(--ink); font: 600 clamp(1.55rem, 4.5vw, 2rem)/1.4 var(--font-ui); letter-spacing: -.045em;
}
#checkout-description, #checkout-data { margin: 6px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.order-summary {
  margin: 1.1rem 0 .9rem; padding: .65rem .95rem; border-radius: .85rem; background: #f3edf2;
}
.order-summary div {
  display: grid; grid-template-columns: minmax(5.85rem, .8fr) minmax(0, 1.3fr);
  align-items: baseline; gap: 8px; padding: 7px 0;
}
.order-summary dt { color: var(--muted); font-size: .88rem; }
.order-summary dd { margin: 0; text-align: right; color: var(--ink); font-size: .94rem; font-weight: 600; }
.order-summary #checkout-amount { color: var(--ink); font: 600 1.48rem/1.4 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
#checkout-test {
  margin: 0 0 10px; padding: 10px 13px; border-radius: .7rem;
  background: #f7e5da; color: #53384a; font-size: .94rem; line-height: 1.65; font-weight: 600;
}
#checkout-data { font-size: .84rem; }
.commerce-error { margin: 10px 0 0; color: #8e3f2f; font-size: .91rem; font-weight: 600; }
.checkout-actions { display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1.4fr); gap: 8px; margin-top: 21px; }
#checkout .checkout-actions button { min-height: 46px; padding: 8px 10px; font-size: .94rem; line-height: 1.5; }
:root:has(#checkout[open]) { overflow: hidden; }

@media (max-width: 960px) {
  .letter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 670px) {
  .shelf-membership { flex-wrap: wrap; gap: 15px; padding: 23px; }
  .letter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-page { padding-top: 22px; }
  .shelf-page > section:not(.shelf-membership) { margin-top: 28px; }
  .shelf-row { padding: 15px 0; }
  .shelf-row > .shelf-book { padding-left: 10px; }
  .reading-gate .purchase-action { display: flex; width: 100%; min-height: 44px; margin-top: 13px; }
  .reading-terms .purchase-action { display: none; }
}
@media (max-width: 465px) {
  .shelf-row { flex-wrap: wrap; }
  .shelf-row > .shelf-book, .hidden-jobs .shelf-row > span { flex-basis: 100%; }
  .shelf-row > .secondary-button { margin-left: auto; }
  .shelf-header { display: grid; gap: .65rem; }
  .shelf-counts { padding-block: .7rem; gap: 1.25rem; }
  .shelf-counts > div { display: flex; align-items: baseline; gap: .4rem; }
  .shelf-counts > div + div { padding-left: 0; border: 0; }
  .shelf-counts dd { font-size: 1.35rem; }
  .shelf-empty { grid-template-columns: minmax(0,1fr) minmax(3.3rem,.35fr); min-height: 0; }
  .shelf-empty-copy { padding-right: 0; }
  .shelf-empty .catalog-display { overflow: hidden; }
  .owned-volume { grid-template-columns: 2.8rem minmax(0, 1fr); gap: .5rem .7rem; }
  .owned-volume .shelf-answers, .shelf-answers-title { grid-column: 1 / -1; }
  .letter-grid { gap: 7px; }
  .letter-grid .shelf-book { padding: 12px 10px; }
  .letter-grid .shelf-book strong { font-size: 1rem; }
  .letter-grid .shelf-book span { font-size: .8rem; }
  #checkout { inset: auto 0 0; width: 100%; max-height: 91dvh; margin: 0; border-radius: 1.35rem 1.35rem 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.other-letters { margin-top: .9rem; }
.other-letters summary { width: fit-content; cursor: pointer; padding-block: .45rem; color: var(--green); }
.other-letters[open] .letter-grid { margin-top: .45rem; }
[data-my-letter] { grid-template-columns: 1fr; }
@media (prefers-contrast: more) {
  .letter-grid .shelf-book, .notes-list .shelf-book, .shelf-row, .shelf-empty { border-color: var(--muted); }
}
