/*
 * Design tokens + base styles for code components.
 * Values mirror mockup/design-tokens.css (extracted from the live
 * royaltyexchange.com Webflow CSS). Keep the two in sync.
 *
 * Shadow DOM rules:
 * - Tokens sit on :host, not :root. :root doesn't match inside a shadow root.
 * - No font loading here. @font-face doesn't take effect inside a shadow root,
 *   and the Webflow site already loads Mona Sans. Inherit it from the page.
 * - Page classes don't reach in, so shared classes (.rex-button) live here.
 */

:host {
  display: block;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;

  /* ---- Brand ---- */
  --rex-purple: #4e3bca;
  --rex-purple-deep: #4227b8;
  --rex-purple-link: #584dd1;
  --rex-heading-ink: #2a2667;
  --rex-blue: #4735ea;
  --rex-green: #7af299;

  /* ---- Indigo-tinted neutrals ---- */
  --rex-bg: #fdfdff;
  --rex-bg-2: #f7f8ff;
  --rex-bg-interactive: #eff1ff;
  --rex-bg-interactive-2: #e4e7ff;
  --rex-border-tint: #c8cdff;
  --rex-focus: #999df9;

  /* ---- Gray ramp ---- */
  --rex-gray-1: #fcfcfd;
  --rex-gray-2: #f9f9fb;
  --rex-gray-3: #f0f0f3;
  --rex-gray-4: #e8e8ec;
  --rex-gray-6: #d9d9e0;
  --rex-gray-8: #b9bbc6;
  --rex-gray-9: #8b8d98;
  --rex-gray-11: #60646c;
  --rex-gray-12: #1c2024;
  --rex-text: #000;

  /* ---- Space scale (4 → 64) ---- */
  --rex-space-1: 4px;
  --rex-space-2: 8px;
  --rex-space-3: 12px;
  --rex-space-4: 16px;
  --rex-space-5: 24px;
  --rex-space-6: 32px;
  --rex-space-7: 40px;
  --rex-space-8: 48px;
  --rex-space-9: 64px;

  /* ---- Radii: buttons are square ---- */
  --rex-radius-sm: 4px;
  --rex-radius-md: 8px;
  --rex-radius-lg: 16px;
  --rex-radius-xl: 32px;

  /* ---- Motion ---- */
  --rex-ease-snap: cubic-bezier(0.77, 0, 0.175, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

h1, h2, h3, h4, p {
  margin: 0;
}

/* ---- Buttons (square corners; hover = hard 3px offset shadow) ---- */

.rex-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: var(--rex-space-2);
  padding: 12px 56px;
  border: 2px solid transparent;
  border-radius: 0;
  background: var(--rex-purple);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s var(--rex-ease-snap);
}

.rex-button:hover {
  box-shadow: 3px 3px 0 0 var(--rex-focus);
}

.rex-button.is-hero:hover {
  box-shadow: 3px 3px 0 0 var(--rex-green);
}

.rex-button.is-secondary {
  background: var(--rex-bg);
  border-color: var(--rex-purple);
  color: var(--rex-purple);
  font-weight: 600;
}

.rex-button.is-secondary:active {
  background: var(--rex-bg-interactive-2);
}

/* Ported from mockup/featured_blog_posts. Breakpoint is a container query:
   the section sizes to the slot it's dropped into, not the viewport. */

.fbp {
  container-type: inline-size;
  color: var(--rex-text);
}

/* ---- Header row ---- */

.fbp-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--rex-space-4);
  margin-bottom: var(--rex-space-5);
}

.fbp-title {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.56px;
  color: var(--rex-heading-ink);
}

.fbp-subtitle {
  margin-top: var(--rex-space-1);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.56px;
  color: var(--rex-gray-11);
}

.fbp-nav {
  display: flex;
  flex-shrink: 0;
  gap: var(--rex-space-2);
}

.fbp-arrow {
  width: 44px;
  height: 40px;
  border: none;
  border-radius: 0;
  background: var(--rex-bg-interactive);
  color: var(--rex-purple);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s var(--rex-ease-snap);
}

.fbp-arrow:hover {
  background: var(--rex-bg-interactive-2);
  box-shadow: 3px 3px 0 0 var(--rex-focus);
}

.fbp-arrow:focus-visible {
  outline: 3px solid var(--rex-focus);
  outline-offset: 2px;
}

.fbp-arrow svg {
  width: 18px;
  height: 18px;
}

/* ---- Accordion cards ---- */

.fbp-cards {
  display: flex;
  gap: var(--rex-space-3);
  height: 420px;
  /* Leave vertical scrolling to the browser; horizontal swipes change posts. */
  touch-action: pan-y;
}

.fbp-card {
  position: relative;
  flex: 1 1 0%;
  min-width: 56px;
  border-radius: var(--rex-radius-lg);
  overflow: hidden;
  background-size: cover;
  transition: flex-grow 0.7s var(--rex-ease-snap);
}

.fbp-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scrim keeps the overlaid title legible on light artwork */
.fbp-card::after {
  content: '';
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(11, 7, 43, 0.45));
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.fbp-card.is-active::after {
  opacity: 1;
}

.fbp-card.is-active {
  flex-grow: 14;
}

/* Transparent button covering the card; the card clips overflow, so the
   focus ring is drawn inset. */
.fbp-card-toggle {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.fbp-card-toggle:focus-visible {
  outline: 3px solid var(--rex-focus);
  outline-offset: -3px;
}

.fbp-card-title {
  position: absolute;
  z-index: 1;
  left: var(--rex-space-6);
  bottom: var(--rex-space-5);
  width: min(480px, 55cqi);
  font-size: 32px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.64px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s;
}

.fbp-card.is-active .fbp-card-title {
  opacity: 1;
  transition-delay: 0.25s;
}

/* ---- Caption + CTA (all captions stacked; only the shown one is visible) ---- */

.fbp-captions {
  display: grid;
  margin-top: var(--rex-space-5);
  transition: opacity 0.18s;
}

.fbp-captions.is-fading {
  opacity: 0;
}

.fbp-caption {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rex-space-6);
  min-height: 72px;
  visibility: hidden;
}

.fbp-caption.is-shown {
  visibility: visible;
}

.fbp-desc {
  max-width: 640px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--rex-gray-11);
}

.fbp-desc strong {
  color: var(--rex-text);
  font-weight: 600;
}

.fbp-cta {
  flex-shrink: 0;
  padding: 10px 24px;
  font-size: 16px;
  white-space: nowrap;
  /* .rex-button transitions `all`, which would keep a hidden caption's
     button visible mid-switch. */
  transition-property: background-color, box-shadow, color, border-color;
}

.fbp-cta:hover {
  background: var(--rex-bg-interactive);
  box-shadow: 3px 3px 0 0 var(--rex-focus);
}

@media (prefers-reduced-motion: reduce) {
  .fbp-card,
  .fbp-card::after,
  .fbp-card-title,
  .fbp-captions {
    transition: none;
  }
}

@container (max-width: 720px) {
  /* Swipe replaces the arrows on small screens. */
  .fbp-nav {
    display: none;
  }

  .fbp-cards {
    height: 300px;
  }

  .fbp-title,
  .fbp-subtitle {
    font-size: 22px;
    letter-spacing: -0.44px;
  }

  .fbp-card-title {
    font-size: 24px;
    letter-spacing: -0.48px;
    left: var(--rex-space-4);
    bottom: var(--rex-space-4);
    width: calc(100% - 2 * var(--rex-space-4));
  }

  .fbp-caption {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--rex-space-3);
  }
}

@container (max-width: 480px) {
  .fbp-cards {
    gap: var(--rex-space-2);
  }

  .fbp-card {
    min-width: 36px;
  }

  .fbp-card.is-active {
    flex-grow: 20;
  }
}

