/*
 * Royalty Exchange design system: the single source of design tokens.
 *
 * Every brand token reads production's own Webflow variable first, with that
 * variable's current production value as the fallback:
 *
 *   --rex-purple: var(--core--colors--primary--primary-purple, #4e3bca);
 *
 * - In Webflow, site variables cross into code components' shadow roots, so a
 *   token edited in the Designer reaches the components with no code change.
 * - Anywhere else (local preview, mockups) the fallback applies.
 * - `npm run design:sync` pulls the live CSS and fails if any fallback no
 *   longer matches production. Run it after design changes in Webflow.
 *
 * Declared on both :root (pages, mockups) and :host (code-component shadow roots).
 *
 * House decisions that are deliberately NOT production variables:
 * - Corners are square everywhere (2026-10-06). Circles (radio dots) excepted.
 * - Spacing and motion are layout choices, kept as literal values.
 */

:host,
:host {
  /* ---- Fonts (prod loads Mona Sans 300–700 via Google Fonts) ---- */
  --rex-font: var(--globals--font--family--primary, "Mona Sans", sans-serif);

  /* ---- Brand ---- */
  --rex-purple: var(--core--colors--primary--primary-purple, #4e3bca);
  --rex-purple-deep: var(--core--colors--neutral--accent-10, #4227b8);
  --rex-purple-link: var(--core--colors--neutral--accent-11, #584dd1);
  --rex-heading-ink: var(--core--colors--neutral--accent-12, #2a2667);
  --rex-blue: var(--core--color--blue, #4735ea);
  --rex-green: var(--core--color--green, #7af299);

  /* ---- Indigo-tinted neutrals ---- */
  --rex-bg: var(--core--colors--neutral--accent-1, #fdfdff);
  --rex-bg-2: var(--core--colors--neutral--accent-2, #f7f8ff);
  --rex-bg-interactive: var(--core--colors--neutral--accent-3, #eff1ff);
  --rex-bg-interactive-2: var(--core--colors--neutral--accent-4, #e4e7ff);
  --rex-border-tint: var(--core--colors--neutral--accent-6, #c8cdff);
  --rex-focus: var(--core--colors--neutral--accent-8, #999df9);

  /* ---- Gray ramp (Radix gray, as in prod) ---- */
  --rex-gray-1: var(--gray-1, #fcfcfd);
  --rex-gray-2: var(--gray-2, #f9f9fb);
  --rex-gray-3: var(--gray-3, #f0f0f3);
  --rex-gray-4: var(--gray-4, #e8e8ec);
  --rex-gray-6: var(--gray-6, #d9d9e0);
  --rex-gray-8: var(--gray-8, #b9bbc6);
  --rex-gray-9: var(--gray-9, #8b8d98);
  --rex-gray-11: var(--gray-11, #60646c);
  --rex-gray-12: var(--gray-12, #1c2024);
  --rex-text: var(--globals--colors--text--text-dark, black);

  /* ---- Type scale (prod's h1/h2/h3/body/label rules) ---- */
  --rex-h1-size: 72px;
  --rex-h1-weight: 600;
  --rex-h1-tracking: -2px;
  --rex-h2-size: 48px;
  --rex-h2-weight: 600;
  --rex-h2-tracking: -1px;
  --rex-h3-size: 24px;
  --rex-h3-weight: 700;
  --rex-heading-line: 1.2;
  --rex-body-size: 16px;
  --rex-body-line: 1.4;
  --rex-lead-size: 18px;
  --rex-label-weight: 700;

  /* ---- Corners: square everywhere ---- */
  --rex-radius: 0;
  /* Kept so older names still resolve; all square. */
  --rex-radius-sm: var(--rex-radius);
  --rex-radius-md: var(--rex-radius);
  --rex-radius-lg: var(--rex-radius);
  --rex-radius-xl: var(--rex-radius);

  /* ---- 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;

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

/*
 * Shared component styles, built only from design-system/tokens.css.
 * Used by pages (mockups) and inside code-component shadow roots alike.
 * Mirrors prod's `.button` / `.button.is-secondary`: square, 12px x 56px,
 * hard 3px offset shadow on hover, snappy easing.
 */

.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: var(--rex-radius);
  background: var(--rex-purple);
  color: #fff;
  font-family: var(--rex-font);
  font-size: var(--rex-body-size);
  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);
}

.rex-button.is-small {
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1;
}

/*
 * Base styles for every code component's shadow root. Tokens and shared
 * component classes come from the central design system (../../design-system/),
 * loaded alongside this file by globals.webflow.ts.
 *
 * Shadow DOM: page classes don't reach in, so base element styles live here.
 * The font is set explicitly from the design system (prod's Mona Sans
 * variable) rather than inherited, so components render in Mona Sans even on
 * a page that doesn't set it on <body>.
 */

:host {
  display: block;
  font-family: var(--rex-font);
  -webkit-font-smoothing: antialiased;
}

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

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

/* 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: var(--rex-radius);
  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);
  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;
  }
}

