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

/* "Get Deal Updates": a wall of past-deal cards fills the section as its
   background, with the form in a white rounded card on top. Card styling is
   ported from the live site (royalty-exchange.shared.css: .artist-card*).
   Breakpoints are container queries. */

.duf {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  color: var(--rex-text);
}

/* Foreground: the form card, centred above the wall. */
.duf-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--rex-space-9) var(--rex-space-4);
  /* Clicks on the empty area reach the deal cards behind. */
  pointer-events: none;
}

/* ---- Form card ---- */

.duf-form-col {
  /* Two columns: heading + subheading | form fields. */
  display: grid;
  /* Heading column gets the larger share so prod's 48px h2 fits on one line. */
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--rex-space-8);
  width: 100%;
  max-width: 960px;
  padding: var(--rex-space-7) var(--rex-space-8);
  border: 1px solid var(--rex-border-tint);
  border-radius: var(--rex-radius);
  background: #fff;
  box-shadow: 0 24px 48px -16px rgba(42, 38, 103, 0.28), 0 2px 6px rgba(42, 38, 103, 0.08);
  pointer-events: auto;
}

.duf-form {
  width: 100%;
}

.duf-title {
  font-size: var(--rex-h2-size);
  line-height: var(--rex-heading-line);
  font-weight: var(--rex-h2-weight);
  letter-spacing: var(--rex-h2-tracking);
}

.duf-desc {
  margin-top: var(--rex-space-3);
  color: var(--rex-gray-11);
  font-size: 18px;
  line-height: 1.4;
}

.duf-label {
  display: block;
  margin-bottom: var(--rex-space-1);
  padding: 0;
  font-size: 16px;
  font-weight: var(--rex-label-weight);
}

.duf-input {
  display: block;
  width: 100%;
  height: 38px;
  margin-bottom: var(--rex-space-4);
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: var(--rex-radius);
  background: #fff;
  color: var(--rex-text);
  font: inherit;
  font-size: 14px;
}

.duf-input:focus {
  border-color: var(--rex-purple);
  outline: 2px solid var(--rex-focus);
  outline-offset: 0;
}

.duf-input[aria-invalid='true'] {
  border-color: #c62828;
}

/* Field-level errors sit right under their field. */
.duf-field-error {
  margin-top: calc(-1 * var(--rex-space-3));
  margin-bottom: var(--rex-space-3);
}

.duf-fieldset .duf-field-error {
  margin-top: var(--rex-space-2);
  margin-bottom: 0;
}

.duf-radio-group[aria-invalid='true'] .duf-radio input {
  border-color: #c62828;
}

.duf-fieldset {
  margin: 0 0 var(--rex-space-5);
  padding: 0;
  border: 0;
  min-width: 0;
}

/* Options side by side; they wrap onto two lines only if the column is too narrow. */
.duf-radio-group {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--rex-space-6);
  row-gap: var(--rex-space-1);
  margin-top: var(--rex-space-1);
}

.duf-radio {
  display: flex;
  align-items: center;
  gap: var(--rex-space-2);
  font-size: 16px;
  cursor: pointer;
}

/* Custom radio: 1px black ring, filled with a thick purple ring when checked. */
.duf-radio input {
  appearance: none;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1px solid #000;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: border-width 0.15s var(--rex-ease-snap), border-color 0.15s var(--rex-ease-snap);
}

.duf-radio input:checked {
  border: 4px solid var(--rex-purple);
}

.duf-radio input:focus-visible {
  outline: 3px solid var(--rex-focus);
  outline-offset: 2px;
}

.duf-submit {
  transition-property: background-color, box-shadow, color, border-color;
}

.duf-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.duf-error {
  margin-top: var(--rex-space-3);
  color: #c62828;
  font-size: 14px;
}

.duf-terms {
  margin-top: var(--rex-space-4);
  color: var(--rex-gray-11);
  font-size: 12px;
}

.duf-terms a {
  color: var(--rex-purple);
  text-decoration: underline;
}

.duf-success-msg {
  font-size: 18px;
  font-weight: 600;
}

/* Receives focus programmatically after submit; it isn't a control, so no ring. */
.duf-success-msg:focus {
  outline: none;
}

/* ---- Past-deal cards, laid flat on a tilted plane ---- */

/* Background layer: fills the whole section; every edge fades out softly. */
.duf-cards {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12%, #000 92%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 12%, #000 92%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-composite: intersect;
}

/* Isometric-style plane. Rows of touching cards; alternate rows are shifted
   half a card, like brickwork.
   Kept crisp on purpose:
   - The tilt is a 2D transform. Without perspective, rotateX(52deg) is just
     scaleY(cos 52deg), and browsers rasterize 3D-transformed layers as
     bitmaps (soft text) but keep 2D-transformed text sharp.
   - Rows are shrunk with `zoom`, not scale(): zoom lays text out at its final
     size instead of downscaling text already drawn at full size. */
.duf-plane {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -50%) scaleY(0.6157) rotate(-34deg);
}

.duf-row {
  display: flex;
  align-items: stretch;
  zoom: 0.72;
}

.duf-row:nth-child(even) {
  margin-left: 120px;
}

.duf-card {
  position: relative;
  /* Every card is the same size: fixed width and height, with the title,
     description and facts laid out in fixed slots below. */
  flex: 0 0 240px;
  height: 432px;
  display: block;
  padding: 8px;
  border: 1px solid var(--rex-focus);
  border-radius: var(--rex-radius);
  background-color: #edebf9;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 5px var(--rex-focus);
  transition: transform 0.25s var(--rex-ease-snap), box-shadow 0.25s var(--rex-ease-snap);
}

/* Lift toward the viewer along the plane on hover/focus. */
.duf-card:hover,
.duf-card:focus-visible {
  z-index: 2;
  transform: translate(-6px, -10px);
  box-shadow: 10px 16px 24px -6px var(--rex-focus);
}

.duf-card:focus-visible {
  outline: 3px solid var(--rex-purple);
  outline-offset: 2px;
}

.duf-card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: var(--rex-radius);
  background: #fff;
}

.duf-card-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 39 / 24;
  object-fit: cover;
  object-position: 0% 50%;
}

.duf-card-body {
  padding: 20px;
  text-align: left;
}

.duf-card-title {
  /* Always two lines tall, so descriptions start at the same height. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.4em;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.48px;
  color: var(--rex-text);
}

.duf-card-desc {
  /* Capped at four lines; the full text stays in the HTML. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin-top: var(--rex-space-2);
  color: #344054;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.duf-card-facts {
  display: flex;
  flex-direction: column;
  gap: var(--rex-space-2);
  /* Pinned to the bottom so fact rows line up across cards. */
  margin: auto 0 0;
  padding-top: var(--rex-space-4);
}

.duf-card-facts div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}

.duf-card-facts dt {
  color: #4b4f57;
}

.duf-card-facts dd {
  margin: 0;
}

/* Details-panel tones, varied card to card for texture. */
.duf-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.duf-card.tone-tint .duf-card-body {
  background: var(--rex-bg-interactive-2);
}

.duf-card.tone-lavender .duf-card-body {
  background: #938ada;
}

.duf-card.tone-periwinkle .duf-card-body {
  background: var(--rex-focus);
}

.duf-card.tone-periwinkle .duf-card-title,
.duf-card.tone-periwinkle .duf-card-desc,
.duf-card.tone-periwinkle .duf-card-facts dt {
  color: var(--rex-heading-ink);
}

.duf-card.tone-purple .duf-card-body {
  background: var(--rex-purple);
}

.duf-card.tone-ink .duf-card-body {
  background: var(--rex-heading-ink);
}

.duf-card.tone-lavender .duf-card-body,
.duf-card.tone-lavender .duf-card-title,
.duf-card.tone-lavender .duf-card-desc,
.duf-card.tone-purple .duf-card-body,
.duf-card.tone-purple .duf-card-title,
.duf-card.tone-purple .duf-card-desc,
.duf-card.tone-ink .duf-card-body,
.duf-card.tone-ink .duf-card-title,
.duf-card.tone-ink .duf-card-desc {
  color: #fff;
}

.duf-card.tone-lavender .duf-card-facts dt {
  color: #f0eeff;
  font-weight: 600;
}

.duf-card.tone-purple .duf-card-facts dt,
.duf-card.tone-ink .duf-card-facts dt {
  color: var(--rex-border-tint);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .duf-card,
  .duf-radio input {
    transition: none;
  }
}

/* Two columns get tight: smaller heading so it stays on one line longer. */
@container (max-width: 960px) {
  .duf-title {
    font-size: 36px;
    letter-spacing: -0.8px;
  }
}

/* Narrower: stack heading above the fields in a single column. */
@container (max-width: 760px) {
  .duf-form-col {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--rex-space-4);
    max-width: 520px;
    padding: var(--rex-space-7);
  }

  .duf-title {
    font-size: 35px;
    letter-spacing: -0.7px;
  }

  .duf-row {
    zoom: 0.56;
  }
}

/* Phones: tighter card, smaller wall peeking around it. */
@container (max-width: 480px) {
  .duf-inner {
    min-height: 0;
    padding: var(--rex-space-8) var(--rex-space-3);
  }

  .duf-form-col {
    padding: var(--rex-space-5);
  }

  .duf-radio-group {
    column-gap: var(--rex-space-4);
  }

  .duf-radio {
    font-size: 15px;
  }

  .duf-row {
    zoom: 0.46;
  }
}

