/* ============================================================================
   "RECORD BROKEN" cinematic sequence — overlays the marq-feat layout when a
   featured record has rec.fresh + rec.previous set.
   ========================================================================= */

/* ---------- Keyframes ---------- */
@keyframes mfbCameraShake {
  0%   { transform: translate(0,0); }
  15%  { transform: translate(-4px, 2px) rotate(-0.25deg); }
  30%  { transform: translate( 5px,-2px) rotate( 0.30deg); }
  45%  { transform: translate(-3px, 3px) rotate(-0.20deg); }
  60%  { transform: translate( 3px,-1px) rotate( 0.15deg); }
  80%  { transform: translate(-1px, 1px); }
  100% { transform: translate(0,0); }
}
@keyframes mfbFlash {
  0%   { opacity: 0; }
  10%  { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes mfbStrike {
  0%   { transform: scaleX(0); transform-origin: left center; }
  60%  { transform: scaleX(1.04); transform-origin: left center; }
  100% { transform: scaleX(1);    transform-origin: left center; }
}
@keyframes mfbFall {
  0%   { transform: translateY(0)   rotate(0deg);   opacity: 1; filter: blur(0); }
  100% { transform: translateY(36px) rotate(-2deg); opacity: 0; filter: blur(2px); }
}
@keyframes mfbRise {
  0%   { transform: translateY(48px) scale(1.08); opacity: 0; }
  60%  { transform: translateY(-4px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes mfbPortraitIn {
  0%   { transform: translate(40px, 0) scale(0.95); opacity: 0; }
  100% { transform: translate(0,0)     scale(1);    opacity: 1; }
}
@keyframes mfbStampSlam {
  /* Slams down onto the nail from above-left. Transform-origin is the nail
     (top-center of box) so the rotation reads as the sign pivoting on it. */
  0%   { transform: translateX(-50%) translateY(-180%) rotate(8deg);    opacity: 0; }
  35%  { transform: translateX(-50%) translateY(8px)   rotate(-20deg);  opacity: 1; }
  60%  { transform: translateX(-50%) translateY(-2px)  rotate(-6deg); }
  78%  { transform: translateX(-50%) translateY(0)     rotate(-15deg); }
  90%  { transform: translateX(-50%) translateY(0)     rotate(-10deg); }
  100% { transform: translateX(-50%) translateY(0)     rotate(-12deg);  opacity: 1; }
}
@keyframes mfbStampHold {
  /* Lazy pendulum swing on the nail. */
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-12deg); }
  50%      { transform: translateX(-50%) translateY(0) rotate(-10.6deg); }
}
@keyframes mfbBurstDash {
  0%   { transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateX(8px);  opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateX(calc(var(--len) + 80px)); opacity: 0; }
}
@keyframes mfbBurstRing {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}
@keyframes mfbHeadlineGoldPulse {
  0%, 100% { text-shadow: 0 0 0 rgba(168, 137, 78, 0); }
  50%      { text-shadow: 0 0 28px rgba(168, 137, 78, 0.18); }
}
@keyframes mfbSwapIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes mfbDeckSwapIn {
  from { opacity: 0; transform: translateY(6px); filter: blur(1px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* ---------- Container & shake ---------- */
.marq-feat--broken {
  position: relative;
  overflow: visible;
  /* Subtle ongoing gold pulse once the new record settles */
}
.marq-feat--shake { animation: mfbCameraShake 520ms var(--ease-editorial) both; }

/* The headline gets a soft gold pulse once the sequence is over */
.marq-feat--broken .marq-feat__headline {
  animation: mfbHeadlineGoldPulse 3.6s ease-in-out infinite;
  animation-delay: 3.4s;
}

/* ---------- Portrait column ---------- */
.mfb__portrait { position: relative; }

.mfb__banner-wrap {
  position: absolute;
  top: -64px; left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex; justify-content: center;
  pointer-events: none;
  width: max-content;
}
.mfb__banner {
  background: var(--paper);
  color: var(--ink-700);
  padding: 7px 16px;
  border: 1px solid var(--ink-300);
  display: flex; flex-direction: column; align-items: center;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  transform: rotate(-2deg);
}
.mfb__banner--prev {
  animation: mfbSwapIn 320ms var(--ease-standard) both;
}
.mfb__banner-eyebrow {
  font-size: 8px;
  color: var(--ink-500);
}
.mfb__banner-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--ink-800);
  margin-top: 2px;
  text-transform: uppercase;
}
.mfb__banner--new {
  animation: mfbStampSlam 600ms var(--ease-editorial) both;
  /* The .marq-feat__banner base style provides the ink fill + gold border */
}

/* The portrait frame is the anchor for the wax-seal stamp — needs to be
   `position: relative` so the stamp's absolute positioning is local to it. */
.mfb__portrait-frame {
  position: relative;
  min-height: 380px;   /* hold space so the swap doesn't reflow */
  /* Allow the stamp's hanging shadow to extend outside the frame */
  overflow: visible;
}

.mfb__portrait-layer {
  position: absolute;
  inset: 24px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: none;
}
.mfb__portrait-layer.is-on { opacity: 1; }
.mfb__portrait-layer.is-falling {
  animation: mfbFall 500ms var(--ease-editorial) forwards;
}
.mfb__portrait-layer--new.is-on {
  animation: mfbPortraitIn 700ms var(--ease-editorial) both;
}

/* ---------- Phase label + replay ---------- */
.marq-feat--broken .marq-feat__cat-row { position: relative; }
.mfb__phase-label {
  margin-left: auto;
  padding-left: 14px;
  color: var(--ink-500);
  border-left: 1px solid var(--ink-200);
  position: relative;
  transition: color var(--dur-med) var(--ease-standard);
}
.mfb__phase-label::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--info);
  vertical-align: middle;
  animation: mfbHeadlineGoldPulse 1.4s ease-in-out infinite;
}
.mfb__phase-label.is-broken { color: var(--gold-600); }
.mfb__phase-label.is-broken::before { background: var(--gold-500); animation: none; }

.mfb__replay {
  appearance: none;
  font: inherit;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-600);
  border: 1px solid var(--ink-300);
  padding: 6px 10px 6px 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}
.mfb__replay:hover {
  color: var(--ink-900);
  border-color: var(--ink-800);
  background: var(--paper);
}
.mfb__replay svg { display: block; }

/* ---------- Deck (italic blurb) swaps content between phases ---------- */
.mfb__deck {
  min-height: 70px;
  animation: mfbDeckSwapIn 360ms var(--ease-standard) both;
}

/* ---------- Big number stage ---------- */
.mfb__big { grid-template-columns: minmax(0, auto) 1fr; }

.mfb__num-stage {
  position: relative;
  min-width: 0;
  /* hold space — the largest number sets the box */
  min-height: clamp(96px, 12vw, 220px);
  display: flex; align-items: center;
  /* Keep tabular alignment for all child numbers — prevents in-place width
     jitter between integer states ("$186.40M" ↔ "$186.4M", etc.) */
  font-variant-numeric: tabular-nums lining-nums;
}

.mfb__num-layer {
  position: relative;
  opacity: 0;
  pointer-events: none;
  display: inline-flex; align-items: center;
}
.mfb__num-layer.is-on { opacity: 1; pointer-events: auto; }
.mfb__num-layer--new {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  align-items: center;
  /* Lock the new layer's right edge so the trailing letter ("M", "K",
     " bps") sits in the same place every frame regardless of the digits
     to its left. The number grows/shrinks within this fixed box. */
  right: 0;
  justify-content: flex-start;
}

.mfb__num-old { color: var(--ink-700); position: relative; z-index: 1; }
.mfb__num-new { color: var(--ink-800); position: relative; z-index: 1; }

.mfb__num-layer.is-falling { animation: mfbFall 500ms var(--ease-editorial) forwards; }
.mfb__num-layer--new.is-on { animation: mfbRise 720ms var(--ease-editorial) both; }

/* Gold strikethrough — scales across the previous number */
.mfb__strike {
  position: absolute;
  top: 50%;
  left: -6px; right: -6px;
  height: 4px;
  background: var(--gold-500);
  transform-origin: left center;
  transform: translateY(-50%) scaleX(0);
  pointer-events: none;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(168, 137, 78, 0.15);
}
.mfb__num-layer.is-struck .mfb__strike {
  animation: mfbStrike 460ms var(--ease-editorial) forwards;
  animation-delay: 60ms;
}

/* ---------- Impact: flash + burst ---------- */
.mfb__impact {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  z-index: 3;
}
.mfb__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
              rgba(255,255,255,0.92) 0%,
              rgba(255,255,255,0.5)  35%,
              rgba(255,255,255,0)    72%);
  animation: mfbFlash 520ms ease-out both;
  mix-blend-mode: screen;
}

.mfb__burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mfb__burst-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 80px; height: 80px;
  border: 2px solid var(--gold-500);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  animation: mfbBurstRing 700ms ease-out both;
}
.mfb__burst-dash {
  --angle: 0deg;
  --len: 56px;
  --delay: 0ms;
  position: absolute;
  top: 50%; left: 50%;
  width: var(--len);
  height: 2px;
  background: var(--gold-500);
  transform-origin: left center;
  border-radius: 1px;
  animation: mfbBurstDash 720ms var(--ease-editorial) both;
  animation-delay: var(--delay);
}
.mfb__burst-dash:nth-child(odd) { background: var(--gold-400); }
/* Spread the dashes around the circle via the rotate set inline */
.mfb__burst-dash:nth-child(1)  { --angle: 0deg;   }
.mfb__burst-dash:nth-child(2)  { --angle: 26deg;  }
.mfb__burst-dash:nth-child(3)  { --angle: 52deg;  }
.mfb__burst-dash:nth-child(4)  { --angle: 78deg;  }
.mfb__burst-dash:nth-child(5)  { --angle: 104deg; }
.mfb__burst-dash:nth-child(6)  { --angle: 130deg; }
.mfb__burst-dash:nth-child(7)  { --angle: 156deg; }
.mfb__burst-dash:nth-child(8)  { --angle: 182deg; }
.mfb__burst-dash:nth-child(9)  { --angle: 208deg; }
.mfb__burst-dash:nth-child(10) { --angle: 234deg; }
.mfb__burst-dash:nth-child(11) { --angle: 260deg; }
.mfb__burst-dash:nth-child(12) { --angle: 286deg; }
.mfb__burst-dash:nth-child(13) { --angle: 312deg; }
.mfb__burst-dash:nth-child(14) { --angle: 338deg; }

/* ---------- Wax-seal stamp — the NAIL is driven into the frame's
   bottom-left corner; the stamp body hangs DOWN from that point. ---------- */
.mfb__stamp {
  position: absolute;
  /* The nail sits at the top-center of the stamp box, so we align the
     box's top-center with the frame's bottom-left corner. */
  left: 0;
  top: 100%;
  bottom: auto;
  right: auto;
  transform-origin: 50% 0;     /* pivots from the nail (top-center of box) */
  transform: translateX(-50%) translateY(0) rotate(-12deg);
  opacity: 0;
  pointer-events: none;
  z-index: 5;                  /* above the portrait frame */
}
.mfb__stamp.is-on {
  animation: mfbStampSlam 720ms cubic-bezier(0.34, 1.56, 0.64, 1) both,
             mfbStampHold 4.4s ease-in-out 900ms infinite;
}
.mfb__stamp-inner {
  position: relative;
  background: var(--ink-800);
  color: var(--paper);
  border: 2px solid var(--gold-500);
  /* Compact — the stamp lives in a corner, not the middle. */
  padding: 10px 14px 8px;
  text-align: center;
  box-shadow:
    0 0 0 2px var(--ink-800),
    0 0 0 4px var(--gold-500),
    14px 18px 26px rgba(15, 19, 32, 0.32),
    6px 8px 12px rgba(15, 19, 32, 0.22);
}
.mfb__stamp-title { font-size: 16px; }
.mfb__stamp-eyebrow { font-size: 6.5px; max-width: 14ch; }
.mfb__stamp-foot    { font-size: 7px; margin-top: 4px; padding-top: 3px; }

/* ---------- The Nail — driven through the top-center of the sign ---------- */
.mfb__nail {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 6;          /* sits on top of the stamp face */
}
.mfb__nail-head {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* Brushed-steel ball with a highlight and a rim shadow */
  background:
    radial-gradient(circle at 32% 28%,
      #f3f4f6 0%,
      #cdd0d7 22%,
      #7c8290 56%,
      #2c303b 92%);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.6),
    inset 0 -2px 3px rgba(0,0,0,0.55),
    0 1px 2px rgba(0,0,0,0.45);
  border: 1px solid rgba(15, 19, 32, 0.85);
}
/* Specular highlight on the nail head */
.mfb__nail-glint {
  position: absolute;
  top: 18%; left: 22%;
  width: 34%; height: 34%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 70%);
  filter: blur(0.3px);
}
/* Cast shadow beneath the nail — makes it look proud of the sign */
.mfb__nail-shadow {
  position: absolute;
  top: 75%; left: 50%;
  width: 110%; height: 30%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(15, 19, 32, 0.45) 0%, rgba(15, 19, 32, 0) 65%);
}
/* Two hairline impact rays radiating from the nail — the "just been driven in" feel */
.mfb__nail::before,
.mfb__nail::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 22px; height: 1px;
  background: linear-gradient(90deg,
    rgba(15, 19, 32, 0)    0%,
    rgba(15, 19, 32, 0.55) 30%,
    rgba(15, 19, 32, 0.55) 70%,
    rgba(15, 19, 32, 0)   100%);
  transform-origin: center;
  opacity: 0.55;
}
.mfb__nail::before { transform: translate(-50%, -50%) rotate( 35deg); }
.mfb__nail::after  { transform: translate(-50%, -50%) rotate(-35deg); }
.mfb__stamp-eyebrow {
  font-size: 8px;
  letter-spacing: 0.32em;
  color: var(--gold-300);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  max-width: 18ch;
}
.mfb__stamp-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  margin-top: 6px;
}
.mfb__stamp-foot {
  font-size: 9px;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--gold-300);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(168, 137, 78, 0.4);
}

/* ---------- Side tombstone — swap-in for values ---------- */
.mfb__swap {
  display: inline-block;
  animation: mfbSwapIn 360ms var(--ease-standard) both;
}
.mfb__swap.is-new { color: var(--ink-800); }

/* ---------- Responsive nudges ---------- */
@media (max-width: 1180px) {
  .mfb__big-side {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 32px;
    row-gap: 8px;
    align-items: baseline;
  }
  /* On stacked layouts the portrait sits at top — keep the nail at the
     frame's bottom-left corner. */
  .mfb__stamp { left: 0; top: 100%; bottom: auto; }
}
@media (max-width: 880px) {
  .mfb__portrait-frame { min-height: 360px; }
  .mfb__banner-wrap { top: -56px; }
}

/* Respect users who don't want motion */
@media (prefers-reduced-motion: reduce) {
  .marq-feat--shake,
  .marq-feat--broken .marq-feat__headline,
  .mfb__portrait-layer.is-falling,
  .mfb__portrait-layer--new.is-on,
  .mfb__num-layer.is-falling,
  .mfb__num-layer--new.is-on,
  .mfb__strike,
  .mfb__flash,
  .mfb__burst-ring,
  .mfb__burst-dash,
  .mfb__stamp.is-on,
  .mfb__phase-label::before,
  .mfb__deck,
  .mfb__swap {
    animation: none !important;
  }
  .mfb__num-layer.is-falling { opacity: 0; }
  .mfb__num-layer--new.is-on { opacity: 1; transform: none; }
  .mfb__strike { transform: translateY(-50%) scaleX(1); }
  .mfb__stamp.is-on { opacity: 1; }
}
