/* ---------------------------------------------------------------------------
   Styles Tailwind's utility classes can't express cleanly: the locked-content
   fade, generated-prose typography, and reduced-motion overrides.
   Everything else lives in utility classes on the markup.
   --------------------------------------------------------------------------- */

:root {
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --surface: #f8fafc;
}

/* Smooth, non-jarring page entry (GSAP takes over from here). */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------- Locked fade
   Purely decorative. The server never sends locked body text to the client,
   so this is a visual affordance, not a security control. */
.locked-fade {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 9rem;
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0), rgba(248, 250, 252, 0.9) 55%, #f8fafc 100%);
  pointer-events: none;
}

/* ------------------------------------------------------------------- Prose
   Applied to markdownify output and preview text. The filter emits its own
   Tailwind classes for headings/lists; these rules cover what it doesn't. */
.prose-reset {
  max-width: 68ch;
  color: #334155;
}

.prose-reset > *:first-child {
  margin-top: 0;
}

.prose-reset p {
  margin-bottom: 1rem;
  line-height: 1.75;
}

.prose-reset table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prose-reset th,
.prose-reset td {
  border: 1px solid #e2e8f0;
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.prose-reset th {
  background: #f8fafc;
  font-weight: 600;
}

/* Long words and URLs must not blow out the layout on narrow screens. */
.prose-reset {
  overflow-wrap: break-word;
}

/* Any wide block scrolls inside itself rather than the page. */
.prose-reset pre,
.prose-reset table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

/* ------------------------------------------------------- Search suggestions */
.suggestion-item {
  display: block;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item.is-active {
  background-color: #eef2ff;
}

/* ------------------------------------------------------------ Progress pulse */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(0.94); }
}

[data-spinner] {
  display: inline-block;
  animation: pulse-soft 1.8s ease-in-out infinite;
}

/* ------------------------------------------------------- Elements pre-reveal
   Hidden until GSAP animates them in. Guarded so that if JavaScript fails to
   load, content is still visible rather than permanently invisible. */
.js-enabled [data-reveal] {
  opacity: 0;
}

/* --------------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .js-enabled [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------------- Print */
@media print {
  header,
  footer,
  aside,
  [data-toast-stack],
  form {
    display: none !important;
  }

  .prose-reset {
    max-width: none;
    color: #000;
  }
}
