/*!
 * god-mode-subloader.css  v3.1.0   (pairs with god-mode-loading.js v3.x)
 * GOD MODE — the ONE visible loading overlay: pure white viewport, thin black line,
 * small black "Loading". No logo, nothing from the previous page shows through.
 *
 * Isolation: every selector is namespaced "god-mode-". The overlay is a child of <html>
 * (outside <body>, outside every canvas) and resets inherited/site styles with `all: initial`,
 * so a site's own responsive CSS neither styles nor is changed by it. It sets NO styles on
 * <html>/<body> other than a class (white cover pseudo-element) and aria-busy.
 *
 * The CSS 40s failsafe below is a SUPPLEMENT only: it cannot help a frozen main thread, and the real, earlier release is
 * the loader's own startup deadline (JS). It also covers the opt-in .god-mode-chip (small, non-blocking retry chip).
 *
 * Load as a normal blocking stylesheet in <head>, before the site's own CSS and before
 * god-mode-loading.js.
 */

/* Instant white cover on <html> itself — works before <body> exists (no flash of old/new content). */
html.god-mode-covering::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: #fff;
  z-index: 2147483645;
  pointer-events: none;
  /* Pure-CSS failsafe: if all JS dies, the cover removes itself. Never a permanent white screen. */
  animation: god-mode-failsafe 1ms linear 40s forwards;
}

/* ---------- overlay ---------- */
.god-mode-overlay,
.god-mode-overlay * {
  all: initial;
  box-sizing: border-box;
}
.god-mode-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2147483646;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #fff;
  color: #000;
  opacity: 1;
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}
.god-mode-overlay[hidden] { display: none !important; }
/* Cover-in is instant (no transition) so the previous page never peeks out. */
.god-mode-overlay[data-state="on"] {
  display: flex;
  animation: god-mode-failsafe 1ms linear 40s forwards;
}
/* Reveal is a short fade; the overlay stops catching input immediately. */
.god-mode-overlay[data-state="leaving"] {
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.god-mode-overlay .god-mode-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(260px, 72vw);
  /* Text + line appear after a short delay so very fast loads show a clean white frame only. */
  opacity: 0;
  animation: god-mode-in 0.18s ease 0.14s forwards;
}

.god-mode-overlay .god-mode-text {
  display: block;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: 0.14em;
  color: #000;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ---------- progress line ---------- */
.god-mode-overlay .god-mode-bar {
  display: block;
  position: relative;
  width: 100%;
  height: 2px;
  background: rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.god-mode-overlay .god-mode-fill {
  display: block;
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  background: #000;
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.28s ease;
}
/* Unknown duration (navigation, no stages yet): a sliding segment, never a fake percentage. */
.god-mode-overlay .god-mode-bar[data-mode="indeterminate"] .god-mode-fill {
  right: auto;
  width: 36%;
  transform: none;
  transition: none;
  animation: god-mode-slide 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* ---------- failure / timeout actions ---------- */
.god-mode-overlay .god-mode-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}
.god-mode-overlay .god-mode-actions[hidden],
.god-mode-overlay .god-mode-btn[hidden] { display: none !important; }
.god-mode-overlay .god-mode-btn {
  display: inline-block;
  min-height: 36px;
  padding: 11px 18px;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.12em;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.god-mode-overlay .god-mode-btn:hover { background: #000; color: #fff; }
.god-mode-overlay .god-mode-btn:focus-visible { outline: 2px solid #000; outline-offset: 3px; }
@media (pointer: coarse) {
  .god-mode-overlay .god-mode-btn { min-height: 44px; min-width: 44px; padding: 15px 22px; font-size: 12px; }
  .god-mode-overlay .god-mode-text { font-size: 12px; }
}
@media (max-width: 360px) {
  .god-mode-overlay .god-mode-actions { flex-direction: column; align-items: stretch; width: 100%; }
}
@media (max-height: 320px) {
  .god-mode-overlay .god-mode-center { gap: 8px; }
}

/* ---------- keyframes ---------- */
@keyframes god-mode-slide { from { transform: translateX(-100%); } to { transform: translateX(280%); } }
@keyframes god-mode-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes god-mode-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* ---------- reduced motion: no fade, no sliding; same information ---------- */
@media (prefers-reduced-motion: reduce) {
  .god-mode-overlay[data-state="leaving"] { transition: none; }
  .god-mode-overlay .god-mode-fill { transition: none; }
  .god-mode-overlay .god-mode-center { animation: god-mode-in 1ms linear 0.14s forwards; }
  .god-mode-overlay .god-mode-bar[data-mode="indeterminate"] .god-mode-fill {
    animation: none;
    width: 100%;
    opacity: 0.35;
  }
}

/* ---------- high contrast ---------- */
@media (forced-colors: active) {
  .god-mode-overlay { background: Canvas; color: CanvasText; }
  .god-mode-overlay .god-mode-fill { background: CanvasText; }
  .god-mode-overlay .god-mode-bar { background: GrayText; }
  .god-mode-overlay .god-mode-btn { background: ButtonFace; color: ButtonText; border-color: ButtonText; }
}

@media print {
  .god-mode-overlay,
  html.god-mode-covering::before { display: none !important; }
}

/* ---------- opt-in retry chip (retryChip:true): small, corner-anchored, never fullscreen, never blocks the page ---------- */
.god-mode-chip {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2147483646;
  display: inline-block;
  max-width: calc(100vw - 24px);
  padding: 9px 13px;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: .08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.god-mode-chip:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
@media (pointer: coarse) { .god-mode-chip { min-height: 44px; padding: 12px 16px; } }
@media (forced-colors: active) { .god-mode-chip { border-color: ButtonText; color: ButtonText; background: ButtonFace; } }
