/* Shared critical CSS for GPT Reader pages
 * Loaded before React to prevent flash of unstyled content.
 */

:root {
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  font-family: var(--font-body);
  background-color: hsl(220, 15%, 97%);
  color: hsl(220, 20%, 12%);
}

html[data-theme='dark'] {
  background-color: hsl(220, 15%, 8%);
  color: hsl(220, 15%, 88%);
}

body {
  margin: 0;
  min-height: 100vh;
}

#gpt-reader-root {
  min-height: 100vh;
}

.app-loading {
  min-height: 100vh;
  font-family: var(--font-ui);
}

.app-loading:not(:has(.ssr-fallback)) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-loading:not(:has(.ssr-fallback))::after {
  content: 'Loading...';
  font-size: 1rem;
  color: hsl(220, 8%, 45%);
}

.gpt-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: hsl(220, 15%, 97%);
  transition: opacity 0.4s ease;
}

html[data-theme='dark'] .gpt-loading-overlay {
  background-color: hsl(220, 15%, 8%);
}

.gpt-loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.gpt-loading-name,
.gpt-loading-rule {
  opacity: 0;
  animation: gpt-loading-reveal 0.4s ease 1s forwards;
}

@keyframes gpt-loading-reveal {
  to {
    opacity: 1;
  }
}

.gpt-loading-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: hsl(168, 75%, 48%);
}

.gpt-loading-rule {
  width: 60px;
  border: none;
  border-top: 2px solid hsl(168, 75%, 48%);
  margin: 0.75rem 0;
}
