/* Flex "Split rent" calculator v2 — two-column embed styles
   Scope everything under .flex-calc-v2 so the widget doesn't fight host page styles. */

/* Fonts declared inline as woff2 (latin subsets).
   These four faces previously came from two @import'd stylesheets plus one
   local rule. @import cost two extra chained round trips before a single font
   byte could even be requested:
       flex-calculator-v2.css -> ABCDiatype-Regular.css -> ABCDiatype-Regular.woff2
   Declaring them here removes both hops. Family names, weights and styles are
   identical to before, so nothing renders differently.
   Latin-only subsets: fine for this widget (English copy + currency). */
@font-face {
  font-family: "ABCDiatype";
  src: url("https://assets.braze.prod.getflex.com/ABCDiatype-Regular-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABCDiatype";
  src: url("https://assets.braze.prod.getflex.com/ABCDiatype-Bold-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cooper Medium BT";
  src: url("https://assets.braze.prod.getflex.com/CooperBT-Medium-latin.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cooper Medium BT";
  src: url("https://assets.braze.prod.getflex.com/CooperMdBT-Italic-latin.woff2") format("woff2");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

.flex-calc-v2 {
  /* Palette */
  --v2-purple-accent: #6a3db8;
  --v2-ink: #1d1d1d;
  --v2-ink-subdued: #6a6a6a;
  --v2-ink-eyebrow: #716b83;
  --v2-ink-disclaimer: #524d65;
  --v2-cta-bg: #2c194d;
  --v2-cta-fg: #f7f7f7;
  --v2-input-border: #c7c3d1;
  --v2-input-bg: #ffffff;
  --v2-tile-flex-1: #edebf1;
  --v2-tile-flex-2: #eee2fc;
  --v2-tile-without: #d5d1db;
  --v2-card-bg: #ffffff;
  --v2-divider: rgba(0, 0, 0, 0.08);

  /* Type */
  --v2-sans: "ABCDiatype", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --v2-serif: "Cooper Medium BT", "Cooper", Georgia, "Times New Roman", serif;

  /* Layout */
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) clamp(16px, 4vw, 60px);
  font-family: var(--v2-sans);
  color: var(--v2-ink);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  grid-template-columns: minmax(0, 459px) minmax(0, 490px);
  /* Row 1 sizes to left content; row 2 takes the rest so the right
     column (which spans both rows) extends to its full content height,
     while the CTA sits right below the input. Row 3 holds the disclaimer
     beneath the right column. */
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "left  right"
    "cta   right"
    ".     disc";
  column-gap: clamp(40px, 6vw, 96px);
  row-gap: 48px;
  justify-content: space-between;
  align-items: start;
}

.flex-calc-v2,
.flex-calc-v2 *,
.flex-calc-v2 *::before,
.flex-calc-v2 *::after {
  box-sizing: border-box;
}

/* ============ LEFT COLUMN ============ */
.flex-calc-v2__left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: flex-v2-rise 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.flex-calc-v2__title {
  font-family: var(--v2-serif);
  font-weight: normal;
  font-size: clamp(32px, 5.2vw, 54px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--v2-ink);
  margin: 0;
}

.flex-calc-v2__title-accent {
  font-style: italic;
  color: var(--v2-purple-accent);
}

.flex-calc-v2__title-rest {
  font-style: normal;
  color: var(--v2-ink);
}

/* Input */
.flex-calc-v2__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-calc-v2__label {
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--v2-ink);
}

.flex-calc-v2__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 12px 16px;
  background: var(--v2-input-bg);
  border: 1px solid var(--v2-input-border);
  border-radius: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.flex-calc-v2__input-wrap:focus-within {
  border-color: var(--v2-purple-accent);
  box-shadow: 0 0 0 3px rgba(106, 61, 184, 0.18);
}

.flex-calc-v2__input-prefix {
  color: var(--v2-ink);
  font-size: 20px;
  line-height: 1.4;
  user-select: none;
}

.flex-calc-v2__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--v2-ink);
  padding: 0;
  -moz-appearance: textfield;
}

.flex-calc-v2__input::placeholder {
  color: var(--v2-ink-subdued);
}

.flex-calc-v2__input::-webkit-outer-spin-button,
.flex-calc-v2__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* CTA */
.flex-calc-v2__cta {
  grid-area: cta;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 300px;
  height: 48px;
  padding: 8px 32px;
  background: var(--v2-cta-bg);
  color: var(--v2-cta-fg);
  font-family: var(--v2-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.flex-calc-v2__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -10px rgba(44, 25, 77, 0.55);
}

.flex-calc-v2__cta:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px -8px rgba(44, 25, 77, 0.5);
}

.flex-calc-v2__cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(106, 61, 184, 0.45);
}

/* ============ RIGHT COLUMN ============ */
.flex-calc-v2__right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: flex-v2-rise 520ms 80ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.flex-calc-v2__eyebrow {
  font-family: var(--v2-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--v2-ink-eyebrow);
  margin: 0;
}

.flex-calc-v2__card {
  background: var(--v2-card-bg);
  border-radius: 12px;
  padding: clamp(20px, 5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 32px -12px rgba(17, 17, 17, 0.08);
}

.flex-calc-v2__card-heading {
  font-family: var(--v2-serif);
  font-weight: normal;
  font-size: 22px;
  line-height: 37px;
  letter-spacing: -0.01em;
  color: var(--v2-ink);
  margin: 0;
}

.flex-calc-v2__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.flex-calc-v2__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: clamp(10px, 2.5vw, 12px) clamp(8px, 3vw, 16px);
  border-radius: 8px;
  text-align: center;
  min-width: 0;
}

.flex-calc-v2__tile--first,
.flex-calc-v2__tile--second {
  background: var(--v2-tile-flex-2);
}

.flex-calc-v2__tile--without {
  background: var(--v2-tile-without);
}

.flex-calc-v2__amount {
  display: inline-block;
  font-family: var(--v2-sans);
  font-weight: 500;
  font-size: clamp(18px, 5.5vw, 24px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--v2-ink);
  /* Lining nums for consistent height; not tabular — tabular widens the
     comma slot and produces "$1 , 500" with awkward gaps. Tile width is
     grid-fixed (1fr) so the amount itself can be natural-width. */
  font-variant-numeric: lining-nums;
}

.flex-calc-v2__amount-label {
  font-family: var(--v2-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: -0.01em;
  color: var(--v2-ink);
  /* Single-line height reservation. At 13px both "Due on rent day" and
     "Due later in month" fit on one line at typical tile widths; if a
     narrower viewport forces wrap, both tiles wrap together so amounts
     stay aligned. */
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-calc-v2__footnote {
  font-family: var(--v2-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 19px;
  letter-spacing: -0.01em;
  color: var(--v2-ink-subdued);
  text-align: center;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.flex-calc-v2__footnote-text {
  display: inline;
}

/* Tooltip */
.flex-calc-v2__tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.flex-calc-v2__tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--v2-ink-subdued);
  cursor: pointer;
  border-radius: 50%;
  transition: color 120ms ease, background-color 120ms ease;
}

.flex-calc-v2__tip-btn:hover,
.flex-calc-v2__tip-btn[aria-expanded="true"] {
  color: var(--v2-cta-bg);
}

.flex-calc-v2__tip-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(106, 61, 184, 0.45);
}

.flex-calc-v2__tip-bubble {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 16px 20px;
  background: var(--v2-cta-bg);
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(17, 17, 17, 0.45);
  text-align: left;
  z-index: 10;
  opacity: 0;
  animation: flex-v2-tip-in 140ms ease-out forwards;
  pointer-events: auto;
}

.flex-calc-v2__tip-bubble[hidden] {
  display: none;
}

/* Speech-bubble arrow pointing up to the (i) icon */
.flex-calc-v2__tip-bubble::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--v2-cta-bg);
  border-radius: 2px;
}

.flex-calc-v2__tip-heading {
  display: block;
  font-family: var(--v2-sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
  color: #ffffff;
}

.flex-calc-v2__tip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--v2-sans);
  font-size: 14px;
  line-height: 1.5;
  color: #ffffff;
}

.flex-calc-v2__tip-list li {
  position: relative;
  padding-left: 16px;
  margin: 2px 0;
}

/* Bullets via ::before so host page CSS resets can't strip them. */
.flex-calc-v2__tip-list li::before {
  content: "•";
  position: absolute;
  left: 2px;
  top: 0;
  color: #ffffff;
  line-height: inherit;
}

@keyframes flex-v2-tip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-2px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.flex-calc-v2__divider {
  border: none;
  border-top: 1px solid var(--v2-divider);
  margin: 0;
  width: 100%;
}

.flex-calc-v2__disclaimer {
  grid-area: disc;
  font-family: var(--v2-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 19px;
  letter-spacing: -0.01em;
  color: var(--v2-ink-disclaimer);
  margin: 0;
}

/* ============ KEYFRAMES ============ */
@keyframes flex-v2-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============ MOBILE STACK (<820px) ============ */
@media (max-width: 819.98px) {
  .flex-calc-v2 {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "left"
      "right"
      "cta"
      "disc";
    padding: clamp(32px, 8vw, 56px) clamp(16px, 5vw, 24px);
    row-gap: 32px;
    align-items: stretch;
  }

  .flex-calc-v2__title {
    font-size: clamp(32px, 8vw, 42px);
  }

  .flex-calc-v2__cta {
    max-width: none;
    justify-self: stretch;
  }

  .flex-calc-v2__card-heading {
    font-size: 20px;
    line-height: 1.4;
  }

  .flex-calc-v2__amount-label {
    font-size: 12px;
    line-height: 16px;
    min-height: 16px;
  }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .flex-calc-v2,
  .flex-calc-v2 * {
    animation: none !important;
    transition: none !important;
  }
}
