/*
 * License page: comparison (slug "compare") - master template block 4.
 * Figma: desktop band 2:159 lower half (head 2:308, table 2:314, foot 2:356), mobile 259:11000 lower half
 *        (head 259:11310, table 259:11481 + scroll bar 259:11484, foot 259:11447).
 * Continues the band gradient from fees.css (same split colour, see there).
 * Table = CSS grid on the <table> (thead/tbody/tr are display:contents, semantics stay a table):
 *   column 1 = criteria, then one column per jurisdiction; the target column gets the light pillar (2:316) drawn by
 *   .lpl-cmp__table::before as an absolutely positioned grid item spanning every row (--tcol / --rows from compare.php).
 *   After every criterion row a 3px gradient rule (2:336 / 93:1591) spans the whole width.
 * base.css centres every section head (!important, earlier customer request); this section follows Figma 2:308
 * (tag + H2 left, lead right), so the head rules carry a more specific selector + !important.
 */

.lpl-sec--compare {
  --lpl-cmp-split: rgb(91.81 15.61 138.06);
  --lpl-cmp-end: #8315a5;
  position: relative;
  overflow: hidden;
  padding: 55px 0 90px;                          /* half of the 110px gap; 2:159 py 90 */
  background: linear-gradient(180deg, var(--lpl-cmp-split), var(--lpl-cmp-end));
  font-family: var(--lpl-font);
  color: #fff;
}

.lpl-sec--compare *,
.lpl-sec--compare *::before,
.lpl-sec--compare *::after {
  box-sizing: border-box;
}

/* bottom-left glow (Figma Ellipse 1, 113:38966: 546px at x-204 y2060 of the 2264 band; export bleeds 36.63% -> 946px
   at x-404 y1860, i.e. 542px below the band bottom) */
.lpl-sec--compare::after {
  content: '';
  position: absolute;
  z-index: 0;
  left: -404px;
  bottom: -542px;
  width: 946px;
  height: 946px;
  background: url('../../img/license/fees-ellipse-1.svg') center / 100% 100% no-repeat;
  pointer-events: none;
}

.lpl-compare__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 60px;                                     /* 2:307 gap 60 */
}

/* ---------- head (2:308): tag + H2 left (716), lead right (525, right-aligned) ---------- */
.lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head {
  display: flex !important;                      /* own layout: base.css no longer flexes every section head */
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 48px !important;
  text-align: left !important;
}

.lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head-main {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 16px;
  flex: 0 1 716px !important;
  width: auto !important;
  max-width: 716px !important;
  min-width: 0;
  text-align: left !important;
}

.lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head h2 {
  margin: 0 !important;
  max-width: 716px !important;
  text-align: left !important;
}

.lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head .lpl-compare__lead {
  flex: 0 1 525px !important;
  width: auto !important;
  max-width: 525px !important;
  margin: 0 !important;
  text-align: right !important;                  /* 2:313 */
}

/* ---------- body paragraphs: text-only mode only (no table); typography of the closing text 2:357 ---------- */
.lpl-compare__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1000px;
}

.lpl-compare__para {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  color: #e0e0e0;
  overflow-wrap: anywhere;
}

/* ---------- table ---------- */
.lpl-cmp { position: relative; }

.lpl-cmp__scroll {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 0 -3px;                              /* room for the 3px pillar overhang below, no layout shift */
  padding: 0 0 3px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;                         /* Figma shows its own bar (259:11484) */
}
.lpl-cmp__scroll::-webkit-scrollbar { display: none; }
.lpl-cmp__scroll:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lpl-cmp__table {
  position: relative;
  display: grid;
  grid-template-columns: 250px repeat(var(--cols, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 3), auto);
  column-gap: 64px;                              /* derived for 3+ columns (pillar bleeds 26 + 29px) */
  width: 100%;
  min-width: calc(250px + var(--cols, 2) * 214px);
  margin: 0;
  padding: 9px 0 57px;                           /* pillar 2:316 starts 9px down, ends 60px under the last rule, 3px past 2:314 */
  border-collapse: separate;
  border-spacing: 0;
}

/* two jurisdictions = the Figma geometry: 250 | 129 | 411 | 129 | 441 */
.lpl-cmp--n2 .lpl-cmp__table {
  grid-template-columns: 250px minmax(0, 411fr) minmax(0, 441fr);
  column-gap: 129px;
  min-width: 900px;
}

.lpl-cmp__table thead,
.lpl-cmp__table tbody,
.lpl-cmp__table tr { display: contents; }

.lpl-cmp__table th,
.lpl-cmp__table td {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  vertical-align: middle;
  font-weight: inherit;
}

/* pillar 2:316: 466 wide (track 411 + 26 left + 29 right), radius 40, white -> #f5dfff */
.lpl-cmp.has-target .lpl-cmp__table::before {
  content: '';
  position: absolute;
  z-index: 0;
  grid-column: var(--tcol, 2) / span 1;        /* abspos: an "auto" end line would mean the padding edge */
  grid-row: 1 / -1;
  top: 0;
  bottom: -60px;
  left: -26px;
  right: -29px;
  border-radius: 40px;
  background: linear-gradient(180deg, #fff, #f5dfff);
}

/* ----- header (2:317 / 2:355): Inter 600 24 / 28.8, centred; text centre 61.5px under the pillar top ----- */
.lpl-cmp__th {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 47px 0 73px !important;
  font-size: 24px;
  line-height: 28.8px;
  font-weight: 600 !important;
  text-align: center !important;
  color: #fff;
}
.lpl-cmp__th.is-target { color: #000; }

.lpl-cmp__name { min-width: 0; overflow-wrap: break-word; }

/* ----- body rows (2:320 / 2:338): items centred; row -> 50 -> rule (3) -> 75 -> next row ----- */
.lpl-cmp__label,
.lpl-cmp__cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 75px 0 50px !important;
}
.lpl-cmp__row.is-first > .lpl-cmp__label,
.lpl-cmp__row.is-first > .lpl-cmp__cell { padding-top: 0 !important; }

/* criteria 2:321: Inter 600 24 / 34, white, 250 wide */
.lpl-cmp__label {
  font-size: 24px;
  line-height: 34px;
  font-weight: 600 !important;
  color: #fff;
  overflow-wrap: anywhere;
}

.lpl-cmp__cell { align-items: flex-start; color: #fff; }
.lpl-cmp__cell.is-target { color: #000; }

/* icon + sentence (2:322 / 2:328): gap 14, centred; text Inter 14 / 22 */
.lpl-cmp__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.lpl-cmp__ic { display: block; flex: none; width: 24px; height: 24px; }
.lpl-cmp__cell.is-target .lpl-cmp__ic--no { filter: brightness(0); }   /* only a white cross is exported (2:330) */

.lpl-cmp__txt,
.lpl-cmp__val {
  flex: 1 1 0;
  min-width: 0;
  font-size: 14px;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.lpl-cmp__val { flex: none; }
/* optional second text line of a value cell (copy): same cell token */
.lpl-cmp__cap { font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }

/* rule 2:336: 3px, #572479 -> #d8abe8 (49.432%) -> #572479, radius 118, full width, over the pillar */
.lpl-cmp__rule > td {
  grid-column: 1 / -1;
  z-index: 2 !important;
  height: 3px;
  border-radius: 118px;
  background: linear-gradient(90deg, #572479, #d8abe8 49.432%, #572479) !important;
}

/* scroll bar (259:11484): grey track 6.75px, yellow thumb 9px, radius 6; shown only while the table overflows */
.lpl-cmp__bar {
  position: relative;
  display: none;
  height: 9px;
  margin-top: 28px;
  cursor: pointer;
  touch-action: none;
}
.lpl-cmp.can-scroll .lpl-cmp__bar { display: block; }
.lpl-cmp__bar::before {
  content: '';
  position: absolute;
  left: 1px;
  right: 0;
  top: 1px;
  height: 6.75px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(153, 148, 148, 0.18), rgba(153, 153, 153, 0.18), rgba(153, 151, 151, 0.18));
}
.lpl-cmp__thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--thumb-w, 60%);
  height: 9px;
  border-radius: 6px;
  background: #f5b319;
  transform: translateX(var(--thumb-x, 0px));
}

/* ---------- foot (2:356): closing text (1000 wide) left, button right ---------- */
.lpl-compare__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 44px;
}
.lpl-compare__foot--bare { justify-content: flex-end; }

.lpl-compare__closing {
  flex: 0 1 1000px;
  min-width: 0;
  margin: 0;
  font-size: 18px;                               /* 2:357 Inter 18 / 26 #e0e0e0 */
  line-height: 26px;
  color: #e0e0e0;
}

/* 2:358: base .lpl-btn (54h, padding 14/22, radius 15, gap 12, Inter 600 16 / 25.2) */
.lpl-compare__btn { flex: 0 1 auto; max-width: 520px; white-space: normal; text-align: left; }
.lpl-compare__chev { display: block; flex: none; width: 16px; height: 16px; transition: transform var(--lpl-dur) var(--lpl-ease); }
@media (hover: hover) {
  .lpl-compare__btn:hover .lpl-compare__chev { transform: translateX(4px); }
}

/* Figma 2:162/2:309: the H2 text box is 176px for two 83.6px lines (text centred, +4.5px) and the left column overflows the
   216px head row by 15.5px; the lead (right) sits on the row bottom, the next block starts 60px under the row */
@media (min-width: 1000px) {
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head h2 { padding-top: 4.5px !important; }
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head-main { margin-bottom: -15.5px !important; }
}

/* ---------- responsive ---------- */
/* derived (no tablet frame): head stacked below 1000px */
@media (max-width: 999px) {
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head { flex-direction: column !important; align-items: stretch !important; gap: 20px !important; }
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head-main { flex: none !important; max-width: none !important; }
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head h2 { max-width: none !important; }
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head .lpl-compare__lead { flex: none !important; max-width: none !important; text-align: left !important; }
}

/* mobile frame 259:11000 */
@media (max-width: 767.98px) {
  .lpl-sec--compare {
    --lpl-cmp-split: rgb(104.17 17.31 146.55);
    padding: 35px 0 90px;                        /* half of the 70px gap; py 90 */
  }

  /* lower part of Ellipse 1 (259:11001 -> export x-567 y1416 of the 2749 band, split line at 1827); upper part in fees.css */
  .lpl-sec--compare::after { left: -567px; top: -411px; bottom: auto; }

  .lpl-compare__inner { gap: 36px; }             /* 259:11309 */

  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head { gap: 20px !important; }
  .lpl-page .lpl-sec.lpl-sec--compare .lpl-compare__head .lpl-compare__lead { font-size: 12px; line-height: 21px; }   /* 259:11315 */

  .lpl-compare__body { gap: 12px; }
  .lpl-compare__para { font-size: 14px; line-height: 26px; }

  /* 259:11160 / 290:13: 76 | 26.5 | 223 | 26.5 | 223 (575 wide, scrolls inside the 376 frame) */
  .lpl-cmp__table,
  .lpl-cmp--n2 .lpl-cmp__table {
    grid-template-columns: 76px repeat(var(--cols, 2), 223px);
    column-gap: 26.5px;
    width: max-content;
    min-width: 0;
    padding: 0 0 16px;                           /* pillar ends 16px under the last row (258 - 242) */
  }

  /* pillar 259:11478: 244 wide (11.5 left, 9.5 right of the 223 track), radius 19 */
  .lpl-cmp.has-target .lpl-cmp__table::before { bottom: -16px; left: -11.5px; right: -9.5px; border-radius: 19px; }

  /* header 259:11159: Inter 600 12 / 28.8, centre 24.64 under the pillar top, rows start 50px down */
  .lpl-cmp__th { padding: 10px 0 11px !important; font-size: 12px; }

  /* rows 290:13 / 259:11471: row -> 20 -> rule (2) -> 20 -> row; no rule after the last row */
  .lpl-cmp__label,
  .lpl-cmp__cell { padding: 20px 0 20px !important; }
  .lpl-cmp__row:nth-last-child(2) > .lpl-cmp__label,
  .lpl-cmp__row:nth-last-child(2) > .lpl-cmp__cell { padding-bottom: 0 !important; }
  .lpl-cmp__rule:last-child > td { display: none; }

  .lpl-cmp__label { font-size: 12px; line-height: 16px; }        /* 290:14 */
  .lpl-cmp__item { gap: 10px; }                                  /* 290:15 */
  .lpl-cmp__ic { width: 16px; height: 16px; }
  .lpl-cmp__txt,
  .lpl-cmp__val { font-size: 9px; line-height: 15px; }           /* 290:19 */
  /* 290:27: the last ("Others") column text box is 230 wide, running past its 223 frame */
  .lpl-cmp__cell:last-child:not(.is-target) .lpl-cmp__txt { flex: none; width: 230px; }
  .lpl-cmp__cap { font-size: 9px; line-height: 15px; }

  /* 259:11161: 2px, #d8abe8 / #572479 */
  .lpl-cmp__rule > td { height: 2px; background: linear-gradient(90deg, #572479, #d8abe8) !important; }

  /* 259:11447: column, gap 16; closing 14 / 26; button full width, 14px */
  .lpl-compare__foot { flex-direction: column; align-items: stretch; gap: 16px; }
  .lpl-compare__closing { flex: none; font-size: 14px; line-height: 26px; }
  .lpl-compare__btn { width: 100%; max-width: none; font-size: 14px; justify-content: center; text-align: center; }
}

/* ---------- text-only mode (no table rows): kept as before ---------- */
.lpl-compare--text .lpl-compare__body,
.lpl-compare--text .lpl-compare__closing {
  max-width: 860px;
  margin-inline: auto;
  text-align: center;
}
.lpl-compare--text .lpl-compare__para { text-wrap: pretty; }
.lpl-compare--text .lpl-compare__foot { flex-direction: column; justify-content: center; }
.lpl-compare--text .lpl-compare__closing { flex: none; width: 100%; }

/* 3+ jurisdictions (no Figma frame; Figma has 2 columns): short values sit centred under their column name
   instead of hugging the left edge of a wide column. */
.lpl-cmp:not(.lpl-cmp--n2) .lpl-cmp__cell { align-items: center; text-align: center; }
.lpl-cmp:not(.lpl-cmp--n2) .lpl-cmp__item { justify-content: center; width: auto; }
.lpl-cmp:not(.lpl-cmp--n2) .lpl-cmp__txt,
.lpl-cmp:not(.lpl-cmp--n2) .lpl-cmp__val { flex: 0 1 auto; }
