/* Auth gate — hides page content until authenticated + verified.
   Skipped for returning verified users (proof_of_purchase in localStorage). */
.auth-gated { display: none !important; }
html.auth-ready .auth-gated { display: flex !important; }

/* Chat section: spinner while checking KV, form when ready */
[data-controller~="chat-status"] .chat-form { display: none; }
[data-controller~="chat-status"].ready .chat-form { display: block; }
[data-controller~="chat-status"].ready .chat-spinner { display: none; }

.inline-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2.5px solid rgba(55,65,82,0.15);
  border-top-color: #374152;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Smooth transitions for sidebar */
[data-sidebar-target="panel"] {
  transition: transform 0.25s ease-in-out;
}

/* Ensure the iframe fills the drawer */
[data-drawer-target="iframe"] {
  width: 100%;
  height: 100%;
  border: none;
}

/* Typography refinements */
.prose h3 {
  font-family: 'Source Serif 4', Georgia, serif;
}

/* Box content styling — preserves whitespace from the book */
.box-content {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Rendered markdown content */
.markdown-content {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #374151;
}
.markdown-content h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #1a1a2e;
}
.markdown-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}
.markdown-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}
.markdown-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.375rem;
  color: #555;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
}
.markdown-content p {
  margin-bottom: 0.625rem;
}
.markdown-content ul, .markdown-content ol {
  margin-bottom: 0.625rem;
  padding-left: 1.5rem;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content li {
  margin-bottom: 0.25rem;
}
.markdown-content strong {
  font-weight: 600;
}
.markdown-content a[href^="#content-"] {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
}
.markdown-content a[href^="#content-"]:hover {
  color: #0091ba;
}
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
}
.markdown-content th, .markdown-content td {
  border: 1px solid #e5e7eb;
  padding: 0.375rem 0.5rem;
  text-align: left;
}
.markdown-content th {
  background-color: #f9fafb;
  font-weight: 600;
}
.markdown-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.25rem 0;
}
.markdown-content [data-content] {
  background: #f8fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
}
.markdown-content [data-content] > :last-child {
  margin-bottom: 0;
}
