/* ============================================================
   IRON CAPITAL MARKETS — Preloader
   ============================================================
   Matched to the IRON group loading screen used across the
   sister sites, so the family reads as one brand on entry.

   • The mark draws itself as a hairline, then fills.
   • A meter tracks REAL progress — readyState, images, fonts,
     window load — not a fixed fake timer, so it never shows
     100% while the page is still working and a warm cache
     lifts almost immediately.
   • Exit is a two-panel curtain that splits to reveal the page.
   • Muted brand red (#8b1a1a), consistent with the site.
   ============================================================ */

/* ── Core overlay ────────────────────────────────────────── */
#iron-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
  /* The theme's `.page-loading` translates its preloader a full viewport up;
     stay put even if that class is ever reapplied. */
  transform: none;
  /* Failsafe: if JS never runs at all, the screen still lifts. */
  animation: pl-failsafe 0s linear 8s forwards;
}

#iron-preloader.loaded {
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.72s;
}

/* ── Curtain halves ──────────────────────────────────────── */
.pl-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.2%;            /* slight overlap so no seam shows mid-split */
  z-index: 1;
  transition: transform 0.72s cubic-bezier(0.77, 0, 0.175, 1);
}
.pl-panel--left  { left: 0;  background: linear-gradient(90deg, #0b0b0c, #1c1c1c); }
.pl-panel--right { right: 0; background: linear-gradient(90deg, #1c1c1c, #0b0b0c); }
.pl-panel--left.pl-panel--out  { transform: translateX(-100%); }
.pl-panel--right.pl-panel--out { transform: translateX(100%); }

/* ── Centred brand block ─────────────────────────────────── */
.preloader-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 248px;
  max-width: 64vw;
  /* The Brook theme ships its own `.preloader-wrap {display:table;width:100%;
     height:100%}`. Without an explicit height here that 100% survives, the
     block fills the viewport and the mark pins to the top edge instead of
     centring. */
  height: auto;
  transition: opacity 0.32s;
}
#iron-preloader.loaded .preloader-wrap { opacity: 0; }

/* ── The mark: draw, then fill ───────────────────────────── */
.pl-mark {
  width: 58px;
  height: 58px;
  overflow: visible;
}
.pl-mark-line {
  fill: none;
  stroke: #f7f6f4;
  stroke-width: 1.1;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: pl-draw 1.3s cubic-bezier(0.62, 0.02, 0.34, 1) forwards;
}
.pl-mark-fill {
  fill: #f7f6f4;
  opacity: 0;
  animation: pl-fill 0.8s ease 0.8s forwards;
}
@keyframes pl-draw { to { stroke-dashoffset: 0; } }
@keyframes pl-fill { to { opacity: 1; } }

/* ── Wordmark ────────────────────────────────────────────── */
.preloader-tagline {
  margin: 26px 0 0;
  font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-indent: 0.34em;      /* balances the trailing tracking so it optically centres */
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
  text-align: center;
  line-height: 1.6;
  white-space: normal;
}

/* ── Real-progress meter ─────────────────────────────────── */
.preloader-progress {
  margin-top: 24px;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.preloader-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #8b1a1a;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pl-status {
  margin-top: 11px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}
.pl-pct { font-variant-numeric: tabular-nums; }

@keyframes pl-failsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* ── Small screens ───────────────────────────────────────── */
@media (max-width: 480px) {
  .preloader-wrap { width: 212px; }
  .pl-mark { width: 50px; height: 50px; }
  .preloader-tagline {
    font-size: 8.5px;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
  }
  .pl-status { font-size: 8px; letter-spacing: 0.18em; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pl-mark-line { animation: none; stroke-dashoffset: 0; }
  .pl-mark-fill { animation: none; opacity: 1; }
  .pl-panel,
  .preloader-wrap,
  .preloader-progress-fill { transition-duration: 0.01ms; }
}
