/* Hallmark · reference: Zen Browser · Bookslop fonts, themes and live reader
 * Pre-emit critique: P5 H5 E5 S5 R5 V4 */
:root {
  --color-landing-untyped: var(--color-muted);
  --color-landing-focus: var(--color-accent);
  --text-landing-display: 34px;
  --text-landing-heading: 24px;
  --text-landing-reader: 26px;
  --space-landing-section: 32px;
}

html:has(.landing), body:has(.landing) { overflow-x: clip; }
body:has(.landing) { margin: 0; background: var(--color-paper); color: var(--color-body); }
.landing {
  --landing-soft: color-mix(in srgb, var(--color-accent-soft) 40%, var(--color-paper));
  --landing-display: clamp(44px, 8.1vw, 104px);
  --landing-section-title: clamp(36px, 4.7vw, 60px);
  --landing-section-space: clamp(36px, 5vw, 64px);
  font: 400 15px/1.65 var(--font-body);
}
.landing *, .landing *::before, .landing *::after { box-sizing: border-box; }
.landing a { color: inherit; text-decoration: none; }
.landing :is(a, button, summary) { cursor: pointer; }
.landing :is(a, button, input, summary):focus,
.landing :is(a, button, input, summary):focus-visible { outline: none; box-shadow: none; }
.landing :is(h1, h2) { margin: 0; font-family: var(--font-display); font-weight: 400; font-style: normal; color: var(--color-ink); line-height: 1.05; min-width: 0; overflow-wrap: anywhere; }
.landing p { margin: 0; }
.landing-wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.landing-nav { padding: var(--bookslop-brand-top) var(--bookslop-brand-left) 12px; display: flex; align-items: center; background: var(--color-paper); }
.landing .landing-brand { display: inline-flex; align-items: center; padding: 0; font: 400 29px/1 var(--font-display); letter-spacing: -1px; color: var(--color-ink); cursor: default; white-space: nowrap; }
.landing-brand .brand-icon { display: flex; align-items: center; margin-right: 9px; }
.landing-brand svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.landing-brand .brand-dot { color: var(--color-accent); }
.landing .button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: fit-content; padding: 14px 24px; border: 0; border-radius: 12px; background: var(--color-accent-soft); color: var(--color-ink); font: 500 14px/1.6 var(--font-body); white-space: nowrap; transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.landing .button.primary { background: var(--color-accent); color: var(--color-on-accent); }
.landing .button svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.landing-heading { display: flex; flex-direction: column; align-items: center; margin: 0; padding: 38px 0 32px; text-align: center; }
.landing-heading h1 { font-size: var(--landing-display); line-height: .98; letter-spacing: -.045em; text-wrap: balance; }
.landing-heading h1 > span { display: block; color: var(--color-accent); }
.landing-heading > p { max-width: 43ch; margin-top: 22px; color: var(--color-body); font-size: 16px; text-wrap: balance; }
.landing-hero-action { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }
.landing-typing-prompt { display: flex; justify-content: center; align-items: center; gap: 8px; font: 400 11px/1.6 var(--font-body); color: var(--color-muted); }
.landing-typing-prompt svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.landing-demo { position: relative; padding: 20px 40px 16px; border: 0; border-radius: 24px; background: var(--landing-soft); }
.landing-reader { display: flex; flex-direction: column; min-height: 180px; border: 0; background: var(--color-clear); color: var(--color-body); }
.landing-reader-copy { flex: 1; display: flex; align-items: center; min-height: 140px; padding: 20px 0; cursor: text; }
.landing .landing-passage { width: 100%; margin: 0; font: 400 var(--landing-reader-size, 25px)/var(--landing-reader-leading, 1.5) var(--font-display); color: var(--reader-upcoming-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.landing-reader[data-alignment="center"] .landing-passage { text-align: center; }
.landing-passage > span { position: relative; }
.landing-passage .typed { color: var(--reader-typed-ink); }
.landing-passage .next::before { content: ''; position: absolute; left: -1px; bottom: .08em; height: 1em; width: 1px; border-radius: 1px; background: var(--color-accent); pointer-events: none; }
.landing-passage .incorrect { color: var(--color-error); background: var(--color-error-bg); }
.landing-passage .incorrect::before { background: var(--color-error); }
.landing-reader[data-caret-style="underline"] .next::before { left: 0; bottom: 0; width: 100%; height: 2px; }
.landing-reader[data-typing-active="false"] .next::before { visibility: hidden; }
.landing-capture { position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.landing .landing-capture input { display: block; width: 1px; height: 1px; padding: 0; border: 0; outline: none; box-shadow: none; opacity: 0; }
.landing-how { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; padding-block: var(--landing-section-space); scroll-margin-top: 24px; }
.landing-how h2, .landing-library h2, .landing-faq-wrap > h2 { font-size: var(--landing-section-title); letter-spacing: -.035em; }
.landing-how h2 span, .landing-final-cta h2 span { color: var(--color-accent); }
.landing-how-copy { display: grid; gap: 28px; padding-top: 4px; }
.landing-how-copy h3 { margin: 0 0 6px; color: var(--color-ink); font: 500 16px/1.5 var(--font-body); }
.landing-how-copy p { max-width: 51ch; color: var(--color-muted); font-size: 14px; }
.landing-library { padding-block: var(--landing-section-space); }
.landing-library-copy { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 32px; }
.landing-library-copy p { max-width: 47ch; margin-top: 20px; color: var(--color-muted); font-size: 15px; }
.landing-library-link { flex-shrink: 0; }
.landing-books { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.landing-books .book-card { min-width: 0; margin: 0; padding: 0; border: 0; background: var(--color-clear); box-shadow: none; }
.landing-books .book-display { display: flex; align-items: center; justify-content: center; width: 100%; height: 300px; padding: 24px; border-radius: 20px; }
.landing-books .book-cover { width: 146px; height: 212px; }
.landing-book-info { padding: 18px 4px 0; }
.landing-book-info h3 { margin: 0 0 4px; font: 500 15px/1.45 var(--font-body); color: var(--color-ink); overflow-wrap: anywhere; }
.landing-book-info p { color: var(--color-muted); font-size: 13px; }
.landing-book-info > span { display: block; margin-top: 10px; color: var(--color-muted); font-size: 9px; letter-spacing: 1px; }
.landing-faq-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; padding-block: var(--landing-section-space); }
.landing-faq details { padding: 18px 0; border: 0; }
.landing-faq details:first-child { padding-top: 4px; }
.landing-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; list-style: none; font-size: 15px; color: var(--color-ink); }
.landing-faq summary::-webkit-details-marker { display: none; }
.landing-faq summary::after { content: '+'; display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--landing-soft); color: var(--color-muted); }
.landing-faq details[open] summary::after { content: '−'; }
.landing-faq details p { max-width: 56ch; margin-top: 12px; color: var(--color-muted); font-size: 14px; }
.landing-final-cta { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: var(--landing-section-space) 0 44px; text-align: center; }
.landing-final-cta h2 { font-size: clamp(48px, 6vw, 76px); letter-spacing: -.035em; }
.landing-final-cta p { max-width: 44ch; color: var(--color-muted); font-size: 15px; text-wrap: balance; }
.landing-footer { display: flex; justify-content: center; padding-block: 20px; color: var(--color-muted); font-size: 12px; }
.landing-footer > div { display: flex; gap: 8px; }
.landing-footer a { white-space: nowrap; }
.landing-footer .button { min-height: 44px; padding: 10px 18px; border: 1px solid var(--color-rule); border-radius: var(--radius-small); background: var(--color-surface); color: var(--color-body); font: 500 13px/1.6 var(--font-body); }
@media (max-width: 767px) {
  .landing-wrap { width: calc(100% - 40px); }
  .landing-heading { padding: 24px 0 28px; }
  .landing-heading > p { max-width: 32ch; font-size: 14px; margin-top: 18px; }
  .landing-heading h1 { letter-spacing: -.04em; }
  .landing-demo { position: relative; padding: 12px 20px; border-radius: 18px; }
  .landing-reader { min-height: 160px; }
  .landing-reader-copy { min-height: 120px; padding: 16px 0; }
  .landing-how, .landing-faq-wrap { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .landing-how-copy { gap: 22px; }
  .landing-library-copy { flex-direction: column; align-items: flex-start; gap: 22px; }
  .landing-library-copy p { font-size: 14px; margin-top: 16px; }
  .landing-books { gap: 18px; }
  .landing-books .book-display { height: 232px; padding: 16px; }
  .landing-books .book-cover { width: 118px; height: 172px; }
  .landing-book-info h3 { font-size: 13px; }
  .landing-faq details { padding-block: 14px; }
  .landing-faq summary { font-size: 14px; }
  .landing-final-cta { padding-bottom: 28px; }
}
@media (max-width: 540px) {
  .landing-books { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .landing-books .book-display { height: 272px; }
  .landing-books .book-cover { width: 138px; height: 200px; }
  .landing-book-info { padding-top: 12px; }
  .landing-book-info h3 { font-size: 15px; }
  .landing-library h2 { font-size: 36px; }
}
@media (hover: hover) {
  .landing .button:hover { background: var(--color-hover); color: var(--color-hover-ink); transform: translateY(-1px); }
  .landing .button.primary:hover { background: var(--color-accent-hover); color: var(--color-on-accent); }
  .landing summary:hover { color: var(--color-accent); }
  .landing-footer .button:hover { background: var(--color-hover); color: var(--color-hover-ink); transform: none; }
}
.landing .button:active { transform: translateY(1px); }
.landing button:disabled, .landing input:disabled { opacity: .55; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .landing *, .landing *::before, .landing *::after { transition: none !important; animation: none !important; } }

/* Hallmark · component: Library shelf cards · genre: editorial · theme: existing tokens
 * Pre-emit critique: P5 H5 E5 S5 R5 V4
 * Use the desktop cover-above-details structure at every screen width.
 * Existing action, loading, empty, error, and progress states remain in the app. */
.library-view .book-grid { grid-template-columns: repeat(4, minmax(0, 220px)); }
.library-view .continue-cover .book-cover { transform: none; }
.library-view .book-card { display: block; padding: 0; border: 0; border-radius: 0; background: transparent; }
.library-view .book-display { height: 184px; padding: 28px 20px; border-radius: 12px; }
.library-view .book-info { padding: 14px 4px 0; }
@media (max-width: 1100px) {
  .library-view .book-grid { grid-template-columns: repeat(3, minmax(0, 220px)); }
}
@media (max-width: 540px) {
  .library-view .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .library-view .book-display .book-cover { width: 88px; height: 128px; }
  .library-view .book-byline { margin-top: 4px; }
  .library-view .book-meta { margin-top: 8px; font-size: 9px; flex-wrap: wrap; }
  .library-view .book-info .progress-track { margin-top: 8px; }
  .library-view .book-last-opened { margin-top: 5px; }
  .library-view .book-card:nth-child(odd) .book-title-row { position: relative; }
  .library-view .book-card:nth-child(odd) .book-menu-wrap { position: static; }
  .library-view .book-card:nth-child(odd) .book-menu { left: -4px; right: auto; }
}

/* Keep the desktop thickness on phones; do not let the old thin rule win. */
html:root, html:root * { scrollbar-width: auto; }
@supports selector(::-webkit-scrollbar) {
  html:root, html:root * { scrollbar-color: auto; }
  html:root::-webkit-scrollbar, html:root *::-webkit-scrollbar { width: 10px; height: 10px; }
}
/* Hide a native bar only after its replacement is attached. */
html:root[data-bookslop-scrollbar], html:root [data-bookslop-scrollbar] { scrollbar-width: none; }
html:root[data-bookslop-scrollbar]::-webkit-scrollbar,
html:root [data-bookslop-scrollbar]::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* A captured thumb drag controls the position; do not bounce or re-anchor it. */
html:root[data-bookslop-scrollbar-dragging],
html:root [data-bookslop-scrollbar-dragging] { overscroll-behavior: none; overflow-anchor: none; scroll-behavior: auto; }
.bookslop-scrollbars { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.bookslop-scrollbar { position: absolute; background: var(--bar-track); border-radius: 999px; pointer-events: auto; touch-action: none; user-select: none; cursor: default; }
.bookslop-scrollbar[hidden] { display: none; }
.reading-heatmap-body { position: relative; }
.bookslop-scrollbar.calendar { z-index: 1; }
.bookslop-scrollbar.x { height: 10px; }
.bookslop-scrollbar.y { width: 10px; }
.bookslop-scrollbar-thumb { background: var(--bar-thumb); border: 2px solid var(--bar-track); border-radius: 999px; box-sizing: border-box; }
.bookslop-scrollbar.x .bookslop-scrollbar-thumb { height: 10px; }
.bookslop-scrollbar.y .bookslop-scrollbar-thumb { width: 10px; }
/* Keep the resting shade the same for mouse and touch; brighten while held. */
.bookslop-scrollbar.dragging .bookslop-scrollbar-thumb { background: var(--bar-hover); }
.bookslop-scrollbar.dragging .bookslop-scrollbar-thumb { will-change: transform; }
@media (forced-colors: active) {
  .bookslop-scrollbar { background: Canvas; }
  .bookslop-scrollbar-thumb { background: CanvasText; border-color: Canvas; }
  .bookslop-scrollbar:hover .bookslop-scrollbar-thumb,
  .bookslop-scrollbar.dragging .bookslop-scrollbar-thumb { background: Highlight; }
}

.bookslop-portrait-notice {
  position: fixed; inset: 0; margin: 0; width: 100%; max-width: none;
  height: 100%; height: 100dvh; max-height: none; box-sizing: border-box;
  border: 0; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: var(--color-paper); color: var(--color-ink); text-align: center;
  font-family: var(--font-body); overflow: auto; overscroll-behavior: none;
}
.bookslop-portrait-notice[open] { display: grid; place-items: center; }
.bookslop-portrait-notice::backdrop { background: var(--color-paper); }
.bookslop-portrait-notice svg { width: 36px; height: 48px; fill: none; stroke: var(--color-accent); stroke-width: 2; }
.bookslop-portrait-notice h1 { margin: 16px 0 12px; font: 400 28px/1.2 var(--font-display); }
.bookslop-portrait-notice p { margin: 0; color: var(--color-body); font-size: 14px; line-height: 1.6; }

/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V4
 * component: Activity calendar and session controls · genre: editorial
 * theme: existing Bookslop tokens · reference: the calendar year selector */
/* A horizontal-only calendar must pass vertical wheel/trackpad input to the page. */
.reading-calendar .reading-heatmap-scroll { overscroll-behavior-y: auto; }

.reading-day-details > .shelf-pagination {
  gap: var(--space-1);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.reading-day-details > .shelf-pagination > span:first-child {
  margin-right: auto;
  padding-right: var(--space-3);
  line-height: 1.4;
  white-space: nowrap;
}
.reading-day-details > .shelf-pagination > .reading-session-page-number {
  min-width: 40px;
  margin: 0;
  color: var(--color-ink);
  font-size: 13px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}
.reading-day-details > .shelf-pagination .icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 0;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-small);
  background: var(--color-clear);
  color: var(--color-muted);
  line-height: 1;
}
.reading-day-details > .shelf-pagination .icon-button:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}
.reading-day-details > .shelf-pagination .icon-button:active:not(:disabled) { opacity: .7; }
.reading-day-details > .shelf-pagination .icon-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
@media (hover: hover) {
  .reading-day-details > .shelf-pagination .icon-button:hover:not(:disabled) { color: var(--color-ink); }
}
