/* Shared critical CSS for GPT Reader pages
 * Loaded before React to prevent flash of unstyled content.
 * Used by: home_react.php, content_react.php, static_react.php
 */

/* Font stack */
:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-ui: 'Red Hat Display', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base reset */
html {
  font-family: var(--font-body);
  background-color: hsl(40, 33%, 98%);
  color: hsl(30, 15%, 12%);
}

html[data-theme="dark"] {
  background-color: hsl(30, 15%, 8%);
  color: hsl(40, 20%, 92%);
}

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

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

/* Loading state — shows centered spinner text when no SSR fallback exists */
.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(30, 15%, 45%);
}

/* Brand loading overlay — fades out when React mounts (via createAppEntry) */
.gpt-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: hsl(40, 33%, 98%);
  transition: opacity 0.4s ease;
}

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

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

.gpt-loading-name,
.gpt-loading-rule,
.gpt-loading-tagline {
  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(345, 72%, 55%);
}

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

.gpt-loading-tagline {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: hsl(30, 15%, 55%);
  letter-spacing: 0.05em;
}

html[data-theme="dark"] .gpt-loading-tagline {
  color: hsl(30, 15%, 65%);
}
