/* ============================================================
   Container — shared responsive layout constraint
   Provides 1024px max content width with responsive side padding.
   Import this in any component that uses the .container class.
   ============================================================ */

.container {
  position:   relative;
  width:      100%;
  max-width:  calc(1024px + 160px); /* 1024px content + 80px × 2 */
  padding:    0 80px;
  margin:     0 auto;
  box-sizing: border-box;
}

/* Tablet (≤991px): 60px sides */
@media (max-width: 991px) {
  .container {
    padding: 0 60px;
  }
}

/* Landscape mobile (≤767px): 2rem sides */
@media (max-width: 767px) {
  .container {
    padding: 0 2rem;
  }
}



/* ============================================================
   Wide container — 1360px content + 48px side padding
   Used for full-bleed section content blocks (slider, big cards)
   that need to be wider than the standard 1024px text container.
   ============================================================ */

.container-wide {
  width:      100%;
  max-width:  calc(1384px + 96px);   /* 1384px content + 48px × 2 */
  padding:    0 3rem;                /* 48px sides */
  margin:     0 auto;
  box-sizing: border-box;
}

/* Tablet (≤991px): 16px less than .container (60px → 44px) */
@media (max-width: 991px) {
  .container-wide {
    padding: 0 44px;
  }
}

/* Landscape mobile (≤767px): 16px less than .container (2rem → 1rem) */
@media (max-width: 767px) {
  .container-wide {
    padding: 0 1rem;
  }
}


/* ============================================================
   Button — Component Styles
   Scheme-aware: inherits data-scheme from a parent element.
   All color tokens flip automatically in dark context.
   ============================================================ */

.btn {
  /* Layout */
  align-items:      center;
  border:           1px solid transparent;
  box-sizing:       border-box;
  cursor:           pointer;
  display:          inline-flex;
  flex-shrink:      0;
  justify-content:  center;
  overflow:         hidden;
  text-decoration:  none;
  user-select:      none;
  white-space:      nowrap;
  background-clip:  padding-box;

  /* Typography */
  font-family: var(--font-family-default);
  font-weight: var(--font-weight-medium);

  /* Transition */
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}


/* ============================================================
   Sizes
   Heights: xs=26px  sm=32px  md=36px  lg=40px
   All use font-size-sm (14px) except xs which uses font-size-xs (12px).
   ============================================================ */

.btn[data-size="xs"] {
  font-size:   var(--font-size-xs);      /* 12px */
  line-height: var(--line-height-xs);    /* 16px */
  gap:         0.25rem;                  /* 4px  */
  padding:     0.3125rem 0.75rem;        /* 5px 12px → height 26px */
  --btn-gap:   0.25rem;
}

.btn[data-size="sm"] {
  font-size:   var(--font-size-sm);      /* 14px */
  line-height: var(--line-height-sm);    /* 20px */
  gap:         0.375rem;                 /* 6px  */
  padding:     0.375rem 1rem;            /* 6px 16px → height 32px */
  --btn-gap:   0.375rem;
}

.btn[data-size="md"] {
  font-size:   var(--font-size-sm);      /* 14px */
  line-height: var(--line-height-sm);    /* 20px */
  gap:         0.375rem;                 /* 6px  */
  padding:     0.5rem 1rem;              /* 8px 16px → height 36px */
  --btn-gap:   0.375rem;
}

.btn[data-size="lg"] {
  font-size:   var(--font-size-sm);      /* 14px */
  line-height: var(--line-height-sm);    /* 20px */
  gap:         0.5rem;                   /* 8px  */
  padding:     0.625rem 1.5rem;          /* 10px 24px → height 40px */
  --btn-gap:   0.5rem;
}

.btn[data-icon-only="true"] {
  padding: 0;
}

.btn[data-size="xs"][data-icon-only="true"] {
  width:  1.625rem; /* 26px */
  height: 1.625rem;
}

.btn[data-size="sm"][data-icon-only="true"] {
  width:  2rem; /* 32px */
  height: 2rem;
}

.btn[data-size="md"][data-icon-only="true"] {
  width:  2.25rem; /* 36px */
  height: 2.25rem;
}

.btn[data-size="lg"][data-icon-only="true"] {
  width:  2.5rem; /* 40px */
  height: 2.5rem;
}


/* ============================================================
   Shapes
   ============================================================ */

.btn[data-shape="rounded"] { border-radius: var(--radius-sm);   } /* 8px  */
.btn[data-shape="round"]   { border-radius: var(--radius-full); } /* pill */


/* ============================================================
   Variants
   ============================================================ */

.btn[data-variant="primary"][data-tone="default"] {
  background-color: var(--primary);
  border-color:     var(--primary);
  color:            var(--primary-foreground);
}

.btn[data-variant="secondary"][data-tone="default"] {
  background-color: transparent;
  border-color:     var(--primary);
  color:            var(--primary);
}

.btn[data-variant="primary"][data-tone="accent"] {
  background-color: var(--accent);
  border-color:     var(--accent);
  color:            var(--foreground);
}

.btn[data-variant="secondary"][data-tone="accent"] {
  background-color: transparent;
  border-color:     var(--accent);
  color:            var(--accent);
}


.btn[data-variant="info"] {
  background-color: var(--info);
  border-color:     var(--info);
  color:            var(--info-foreground);
}

.btn[data-variant="success"] {
  background-color: var(--success);
  border-color:     var(--success);
  color:            var(--success-foreground);
}

.btn[data-variant="warning"] {
  background-color: var(--warning);
  border-color:     var(--warning);
  color:            var(--warning-foreground);
}

.btn[data-variant="destructive"] {
  background-color: var(--destructive);
  border-color:     var(--destructive);
  color:            var(--destructive-foreground);
}


/* ============================================================
   States
   ============================================================ */

/* Primary hover — 20% dark overlay on background, full opacity */
.btn[data-variant="primary"][data-tone="default"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--primary) 80%, #282825 20%);
  border-color:     color-mix(in srgb, var(--primary) 80%, #282825 20%);
  opacity:          1;
}

.btn[data-variant="primary"][data-tone="accent"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--accent) 80%, transparent);
  border-color:     color-mix(in srgb, var(--accent) 80%, transparent);
  opacity:          1;
}

/* Secondary hover — darker primary border + text, no fill */
.btn[data-variant="secondary"][data-tone="default"]:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: color-mix(in srgb, var(--primary) 80%, #282825 20%);
  color:        color-mix(in srgb, var(--primary) 80%, #282825 20%);
  opacity:      1;
}

.btn[data-variant="secondary"][data-tone="accent"]:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: color-mix(in srgb, var(--accent) 80%, transparent);
  color:        color-mix(in srgb, var(--accent) 80%, transparent);
  opacity:      1;
}

.btn[data-variant="info"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--info) 80%, #282825 20%);
  border-color:     color-mix(in srgb, var(--info) 80%, #282825 20%);
  color:            var(--info-foreground);
  opacity:          1;
}

.btn[data-variant="success"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--success) 80%, #282825 20%);
  border-color:     color-mix(in srgb, var(--success) 80%, #282825 20%);
  color:            var(--success-foreground);
  opacity:          1;
}

.btn[data-variant="warning"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--warning) 80%, #282825 20%);
  border-color:     color-mix(in srgb, var(--warning) 80%, #282825 20%);
  color:            var(--warning-foreground);
  opacity:          1;
}

.btn[data-variant="destructive"]:hover:not(:disabled):not([aria-disabled="true"]) {
  background-color: color-mix(in srgb, var(--destructive) 80%, #282825 20%);
  border-color:     color-mix(in srgb, var(--destructive) 80%, #282825 20%);
  color:            var(--destructive-foreground);
  opacity:          1;
}

/* Active / pressed */
.btn:active:not(:disabled):not([aria-disabled="true"]) {
  opacity: 0.76;
}

/* Focus */
.btn:focus-visible {
  outline:        2px solid var(--ring);
  outline-offset: 2px;
}

/* Disabled */
.btn:disabled,
.btn[aria-disabled="true"] {
  cursor:         not-allowed;
  opacity:        0.4;
  pointer-events: none;
}


/* ============================================================
   Icon slot
   ============================================================ */

.btn__icon {
  align-items:     center;
  display:         inline-flex;
  flex-shrink:     0;
  justify-content: center;
}

.btn[data-size="xs"] .btn__icon:not(.btn__icon--hover-only) { height: 0.75rem; width: 0.75rem; } /* 12px */
.btn[data-size="sm"] .btn__icon:not(.btn__icon--hover-only),
.btn[data-size="md"] .btn__icon:not(.btn__icon--hover-only),
.btn[data-size="lg"] .btn__icon:not(.btn__icon--hover-only) { height: 1rem;    width: 1rem;    } /* 16px */

.btn__icon svg {
  display: block;
  height:  100%;
  width:   100%;
}


/* ============================================================
   Hover-only icon — hidden by default, slides/fades in on :hover.
   Negative margin-right cancels the flex gap when collapsed so
   the label stays flush with the padding edge.
   ============================================================ */

/* Must come after the .btn[data-size] .btn__icon rules to win specificity tie */
.btn .btn__icon--hover-only {
  min-width:    0;        /* override flex min-width: auto so item can truly collapse */
  width:        0;
  overflow:     hidden;
  opacity:      0;
  margin-right: calc(-1 * var(--btn-gap, 0.5rem));
  transition:   width 0.2s ease, opacity 0.15s ease, margin-right 0.2s ease;
}

.btn:hover:not(:disabled):not([aria-disabled="true"]) .btn__icon--hover-only {
  width:        1rem; /* sm / md / lg */
  height:       1rem;
  opacity:      1;
  margin-right: 0;
}

.btn[data-size="xs"]:hover:not(:disabled):not([aria-disabled="true"]) .btn__icon--hover-only {
  width:  0.75rem;
  height: 0.75rem;
}


/* ============================================================
   Badge slot — optional count pill inside the button
   ============================================================ */

.btn__badge {
  align-items:      center;
  background-color: var(--primary);
  border-radius:    var(--radius-full);
  color:            var(--primary-foreground);
  display:          inline-flex;
  font-size:        var(--font-size-xs);   /* 12px */
  font-weight:      var(--font-weight-medium);
  justify-content:  center;
  line-height:      var(--line-height-xs); /* 16px */
  min-width:        1.25rem;               /* 20px */
  padding:          0.125rem 0.375rem;     /* 2px 6px */
}

/* ============================================================
   ReferralsHowItWorksSection — Figma bbBZfM3MEfbBCKzElufLvw, node 654:1402.
   Spec: ReferralsHowItWorksSection.figma.md.
   ============================================================ */


/* ---- Panel ------------------------------------------------ */

/* The redesign inset panel (ClioconReportSection / PartnerDirectoryList):
   a 16px WHITE BORDER, 48 radius, cream inside. Padding is inside the
   border, so Figma's offsets from the frame edge lose 16: the first heading
   is 128 from the edge (16 + 112) and the template card ends 128 above the
   bottom edge (112 + 16).

   The two blocks are separate railed containers — each has its own badge,
   so each needs its own rail — and this stack owns the 192 between them
   (cards bottom → "Refer in one email"). */
.referrals-how {
  display:        flex;
  flex-direction: column;
  gap:            12rem;                        /* 192px between the blocks */
  background:     var(--panel-cream);           /* #FAF6F0 */
  border:         16px solid var(--background-white);
  border-radius:  48px;                         /* no 48px radius token */
  padding:        7rem 0;                       /* 112px */
  box-sizing:     border-box;
  font-family:    var(--font-family-default);
  color:          var(--foreground);
}

/* Below 1480 the border would push the content 16px further in than the
   white sections around it, so the container gives it back (80 → 64). At
   1480+ the stock container stays: the sticky rail badge is positioned off
   its 80px padding (PartnerDirectoryListSection's recipe). */
@media (max-width: 1479px) {
  .referrals-how > .container {
    max-width:      calc(1024px + 128px);
    padding-inline: 64px;
  }
}

/* The section-header convention: THIS stack owns header → content (64). */
.referrals-how__content {
  display:        flex;
  flex-direction: column;
  gap:            4rem;                         /* 64px */
}

.referrals-how__sr-only {
  position:    absolute;
  width:       1px;
  height:      1px;
  margin:      -1px;
  padding:     0;
  overflow:    hidden;
  clip:        rect(0 0 0 0);
  white-space: nowrap;
  border:      0;
}


/* ---- Block 1: step cards (682:5861) ------------------------ */

.referrals-how__steps {
  display:     flex;
  gap:         var(--spacing-6);                /* 24px */
  align-items: stretch;                         /* equal heights */
  margin:      0;
  padding:     0;
  list-style:  none;
}

.referrals-how__step {
  flex:           1 1 0;
  min-width:      0;
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-8);             /* 32px icon → text */
  padding:        var(--spacing-7);             /* 28px */
  background:     var(--background-white);
  border-radius:  12px;                         /* no 12px radius token */
}

.referrals-how__step-icon {
  display: flex;
  color:   var(--foreground);
}

.referrals-how__step-text {
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-2);             /* 8px title → description */
}

.referrals-how__step-title {
  margin:      0;
  padding-top: 1px;                             /* Figma's 1px top pad */
  font-size:   var(--font-size-base);           /* 16px */
  line-height: var(--line-height-base);         /* 24px */
  font-weight: var(--font-weight-bold);
  color:       var(--popover-foreground);       /* #3A3A36 */
}

.referrals-how__step-body {
  margin:      0;
  font-size:   var(--font-size-base);
  line-height: var(--line-height-base);
  color:       var(--muted-foreground);         /* #85857A */
}

/* The cc address in step 1: the shared `.text-link` (primary, no underline),
   Medium as Figma draws it. Kept whole: the browser would break it at the
   hyphen on a narrow card. */
.referrals-how__address {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}


/* ---- Block 2: the template card (654:1415) ----------------- */

.referrals-how__template {
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-8);             /* 32px mock → actions */
  padding:        var(--spacing-4) var(--spacing-4) var(--spacing-8);   /* 16 16 32 */
  background:     var(--background);            /* #F5F0E7 */
  border-radius:  2rem;                         /* 32px — no token */
}

/* The email mock (654:1416). */
.referrals-how__email {
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-3);             /* 12px head → body */
  margin:         0;
  padding:        var(--spacing-4);             /* 16px */
  background:     var(--background-white);
  border-radius:  var(--radius-lg);             /* 24px */
}

/* To / Cc / Subject (654:1417). Figma's 0.625px rule. */
.referrals-how__email-head {
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-1);             /* 4px */
  margin:         0;
  padding:        var(--spacing-4);             /* 16px */
  border-bottom:  0.625px solid var(--border);  /* #D6CFC2 */
  font-size:      var(--font-size-sm);          /* 14px */
  line-height:    var(--line-height-sm);        /* 20px */
}

.referrals-how__email-line {
  display:     flex;
  flex-wrap:   wrap;
  align-items: center;
  column-gap:  0.25em;                          /* the space after “To:” */
}

.referrals-how__email-line dt {
  color: var(--muted-foreground);
}

.referrals-how__email-line dd {
  margin:    0;
  min-width: 0;
  color:     var(--foreground);
}

/* The cc address + copy icon: one button, styled as inline text. */
.referrals-how__cc {
  display:         inline-flex;
  align-items:     center;
  gap:             var(--spacing-2);            /* 8px address → icon */
  margin:          0;
  padding:         0;
  border:          0;
  background:      none;
  font:            inherit;
  color:           var(--primary);
  text-align:      left;
  overflow-wrap:   anywhere;
  cursor:          pointer;
  transition:      color 0.2s;
}

.referrals-how__cc:hover,
.referrals-how__cc:focus-visible {
  color: color-mix(in srgb, var(--primary) 80%, #282825 20%);   /* .text-link's hover */
}

.referrals-how__cc:focus-visible {
  border-radius:  2px;
  outline:        2px solid currentColor;
  outline-offset: 2px;
}

.referrals-how__cc svg {
  flex-shrink: 0;
}

/* Body (654:1427): 18/28, a blank 28px line between paragraphs. */
.referrals-how__email-body {
  display:        flex;
  flex-direction: column;
  gap:            var(--spacing-7);             /* 28px */
  padding:        var(--spacing-4);             /* 16px */
  font-size:      var(--font-size-lg);          /* 18px */
  line-height:    var(--line-height-lg);        /* 28px */
  color:          var(--foreground);
}

.referrals-how__email-body p {
  margin: 0;
}


/* ---- Actions (654:1429) ------------------------------------ */

.referrals-how__actions {
  display:     flex;
  align-items: center;
  gap:         var(--spacing-8);                /* 32px buttons → fine print */
}

.referrals-how__buttons {
  display:     flex;
  flex-wrap:   wrap;
  flex-shrink: 0;
  gap:         var(--spacing-3);                /* 12px */
}

/* "Copy email" ⇄ "Copied" in one grid cell: the button keeps the wider
   label's width, so nothing moves when the label swaps. */
.referrals-how__swap {
  display: inline-grid;
}

.referrals-how__swap > span {
  grid-area: 1 / 1;
}

.referrals-how__swap > span[data-shown='false'] {
  visibility: hidden;
}

.referrals-how__fine-print {
  flex:        1 1 0;
  min-width:   0;
  margin:      0;
  font-size:   var(--font-size-xs);             /* 12px */
  line-height: var(--line-height-xs);           /* 16px */
  color:       var(--muted-foreground);
}


/* ---- Responsive (no mobile frame) -------------------------- */

@media (max-width: 1199px) {
  .referrals-how {
    padding: 5rem 0;                            /* 80 + 16 = 96, the ≤1199 rhythm */
    gap:     9rem;                              /* 144 */
  }
}

@media (max-width: 991px) {
  .referrals-how {
    border-radius: 32px;
    padding:       4rem 0;                      /* 64 + 16 = 80, the ≤991 rhythm */
    gap:           6rem;                        /* 96 */
  }

  /* Header → content 48: 64 reads as a hole above the full-width cards. */
  .referrals-how__content {
    gap: 3rem;                                  /* 48px */
  }

  /* `.container`'s 60 less the border's 16. */
  .referrals-how > .container {
    padding-inline: 44px;
  }

  /* Full-width cards: the icon sits beside the text, so the card isn't a
     short line under an empty row. */
  .referrals-how__steps {
    flex-direction: column;
    gap:            var(--spacing-4);           /* 16px */
  }

  .referrals-how__step {
    flex-direction: row;
    gap:            var(--spacing-5);           /* 20px */
    padding:        var(--spacing-6);           /* 24px */
  }

  /* Buttons on top, fine print below. */
  .referrals-how__actions {
    flex-direction: column;
    align-items:    flex-start;
    gap:            var(--spacing-4);           /* 16px */
  }

  .referrals-how__fine-print {
    flex: none;
  }
}

@media (max-width: 767px) {
  /* ClioCon's phone panel: the 16px white gutter on every side, 32 radius,
     32 above the first badge and 48 below the last block. */
  .referrals-how {
    padding: 2rem 0 3rem;                       /* 32 / 48 inside the border */
  }

  /* Text and cards 32px from the viewport (16 border + 16). */
  .referrals-how > .container {
    padding-inline: var(--spacing-4);           /* 16px */
  }

  /* Header → content 32 on phones, as the ClioCon panels. */
  .referrals-how__content {
    gap: var(--spacing-8);                      /* 32px */
  }

  /* The mock's nested insets (16 + 16 + 16) would leave the email ~230px
     wide on a phone: tighten each layer. */
  .referrals-how__template {
    gap:           var(--spacing-6);            /* 24px */
    padding:       var(--spacing-2) var(--spacing-2) var(--spacing-6);   /* 8 8 24 */
    border-radius: var(--radius-lg);            /* 24px */
  }

  .referrals-how__email {
    gap:           var(--spacing-1);            /* 4px */
    padding:       var(--spacing-1);            /* 4px */
    border-radius: var(--radius-md);            /* 16px */
  }

  .referrals-how__email-head,
  .referrals-how__email-body {
    padding: var(--spacing-3);                  /* 12px */
  }

  .referrals-how__email-body {
    gap:         var(--spacing-6);              /* 24px */
    font-size:   var(--font-size-base);         /* 16px */
    line-height: var(--line-height-base);       /* 24px */
  }

  .referrals-how__actions {
    padding-inline: var(--spacing-2);           /* 8px: text on the mock's inset */
  }
}

/* Phones: too narrow for the icon beside the text, so it goes back on top. */
@media (max-width: 479px) {
  .referrals-how__step {
    flex-direction: column;
    gap:            var(--spacing-6);           /* 24px */
  }
}

