@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Sans+3:wght@400;600&display=swap");

:root {
  --reader-host-ink: #1f1b16;
  --reader-host-muted: #6c645a;
  --reader-host-accent: #028f80;
  --reader-host-border: #d8dee8;
  --reader-host-titlebar-h: 52px;
  --reader-host-bottombar-h: 40px;
}

html.reader-host-shell,
body.reader-host-shell {
  margin: 0;
  min-height: 100%;
  font-family: "Source Sans 3", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--reader-host-ink);
  background: #f6f1e9;
}

/* Spinner and loading overlay defined in host-entry.shell inline CSS
   so they apply from first paint before this file loads. */

#reader-host-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#reader-host-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--reader-host-titlebar-h);
  padding: 8px 14px;
  border-bottom: 1px solid var(--reader-host-border);
  background: #fff;
  box-sizing: border-box;
}

.reader-host-shell-top-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.reader-host-shell-top-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--reader-host-accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}

.reader-host-metainfo {
  flex: 1;
  min-width: 0;
}

#reader-host-book-title {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#reader-host-book-author {
  font-size: 13px;
  color: var(--reader-host-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#reader-host-title-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#reader-host-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

#reader-access-gate {
  flex: 1;
  overflow-y: auto;
}

#reader-engine-mount {
  flex: 1;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  opacity: 0;
  transition: opacity 0.15s;
}
#reader-engine-mount.is-revealed {
  opacity: 1;
}

/* Host titlebar hidden by default — only shown during gate/error states */
#reader-host-titlebar,
#reader-host-bottombar {
  display: none;
}
body.reader-host-access-gate #reader-host-titlebar {
  display: flex;
}

body.reader-host-legacy-active #reader-host-main {
  flex: 1;
  min-height: 0;
}

body.reader-host-protected-active #reader-host-main {
  flex: 1;
  min-height: 0;
}

.reader-host-protected-mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-host-protected-mount #container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.reader-host-protected-mount #main {
  flex: 1;
  min-height: 0;
}

.reader-host-legacy-mount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-host-legacy-mount #container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.reader-host-legacy-mount #main {
  flex: 1;
  min-height: 0;
}

.reader-host-engine-stub {
  max-width: 520px;
  padding: 20px 24px;
  border-radius: 12px;
  border: 1px dashed var(--reader-host-border);
  background: #fff;
  text-align: center;
  line-height: 1.45;
}

.reader-host-engine-stub-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 16px;
}

.reader-host-engine-stub-meta {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--reader-host-muted);
}

#reader-host-status {
  position: fixed;
  left: 50%;
  bottom: calc(var(--reader-host-bottombar-h) + 16px);
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(18, 28, 45, 0.88);
  color: #fff;
  font-size: 14px;
  z-index: 40;
}

#reader-host-status.is-loading {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  font-size: 0;
  box-shadow: none;
}

#reader-host-status.is-loading::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid rgba(2, 143, 128, 0.22);
  border-top-color: var(--reader-host-accent);
  animation: reader-host-status-spin 0.75s linear infinite;
}

#reader-host-status.is-error {
  background: #8a1f13;
}

@keyframes reader-host-status-spin {
  to {
    transform: rotate(360deg);
  }
}



body.reader-host-access-gate #reader-host-titlebar,
body.reader-host-access-gate #reader-engine-mount,
body.reader-host-access-gate #reader-host-status {
  display: none !important;
}

body.reader-host-access-gate #reader-access-gate {
  display: block;
}

/* Purchase gate (shared with protected reader) */
.protected-purchase-gate {
  min-height: 100%;
  padding: 28px 18px 48px;
  box-sizing: border-box;
  font-family: "Source Sans 3", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f1b16;
}

.protected-purchase-gate .wrap {
  width: min(100%, 960px);
  margin: 0 auto;
}

.protected-purchase-gate .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.protected-purchase-gate .brandLink {
  text-decoration: none;
}

.protected-purchase-gate .brandLogo {
  width: 44px;
  height: 44px;
  display: block;
}

.protected-purchase-gate .brandText {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.protected-purchase-gate .title {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  color: #6a4a22;
  letter-spacing: 0.4px;
}

.protected-purchase-gate .brandSubtitle {
  font-size: 14px;
  line-height: 1.2;
  color: #586273;
}

.protected-purchase-gate-card {
  max-width: 480px;
  margin: 44px auto 0;
  text-align: center;
}

.protected-purchase-gate-cover {
  max-width: 200px;
  border-radius: 12px;
  border: 1px solid #d8dee8;
  margin-bottom: 20px;
}

.protected-purchase-gate-title {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 24px;
  margin: 0 0 8px;
  color: #1f1b16;
}

.protected-purchase-gate-author {
  color: #6c645a;
  margin-bottom: 16px;
}

.protected-purchase-gate-annotation {
  font-size: 14px;
  line-height: 1.5;
  color: #1f1b16;
  margin: 0 0 20px;
}

.protected-purchase-gate-offers {
  margin: 20px auto;
  max-width: 100%;
  width: 100%;
}

.protected-purchase-gate-price {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0 auto 12px;
  padding: 8px 16px;
  background: #e8f5f3;
  color: #1f1b16;
  border: 1px solid #b8ddd8;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  box-sizing: border-box;
}

.protected-purchase-gate-button {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 8px auto;
  padding: 12px 18px;
  background: #028f80;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
}

.protected-purchase-gate-link {
  display: block;
  margin-top: 16px;
  color: #028f80;
  text-decoration: none;
  font-size: 14px;
}

.protected-purchase-gate-signin {
  margin-top: 12px;
  font-weight: 600;
}

.protected-purchase-gate-empty {
  color: #6c645a;
  font-size: 14px;
}

.reader-express-checkout-element {
  min-height: 220px;
  width: 100%;
}

.reader-payment-element {
  margin-top: 14px;
}

.reader-checkout-pay-btn {
  width: 100%;
  margin-top: 14px;
  cursor: pointer;
}

.reader-checkout-pay-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.reader-checkout-status {
  margin: 12px 0 0;
  font-size: 14px;
  color: #5f5a52;
  text-align: center;
}

.reader-checkout-status.is-error {
  color: #8a1f13;
}
