/* Plans: audience tabs, plan cards (grid on desktop, snap carousel on mobile)
 * and the expandable comparison table. */

.pricing {
  padding: var(--section-y) var(--gutter) clamp(48px, 6vw, 72px);
}

.pricing__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-bottom: clamp(30px, 3.6vw, 46px);
}

.pricing__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: -.03em;
  max-width: 20ch;
}

/* Audience tabs */

.pricing__tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  background: var(--nx-bone-2);
  border: 1px solid var(--nx-bone-3);
  padding: 5px;
  border-radius: var(--r-pill);
  gap: 4px;
  margin-top: 6px;
}

.pricing__tab {
  border: none;
  cursor: pointer;
  padding: 11px clamp(14px, 4vw, 22px);
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 600;
  background: transparent;
  color: var(--nx-600);
  transition: background .25s var(--ease), color .25s;
}

.pricing__tab[aria-selected="true"] {
  background: var(--nx-ink);
  color: var(--nx-white);
}

/* Accountant savings banner */

.pricing__banner {
  background: var(--nx-ink);
  border-radius: 22px;
  padding: clamp(28px, 4vw, 48px);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.pricing__banner[hidden] {
  display: none;
}

.pricing__banner-sparkle--1 {
  right: 6%;
  top: -24px;
  width: 150px;
  opacity: .07;
}

.pricing__banner-sparkle--2 {
  left: -30px;
  bottom: -40px;
  width: 180px;
  opacity: .06;
}

.pricing__banner-before {
  position: relative;
  color: var(--nx-400);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.5;
  max-width: 34ch;
  margin: 0;
}

.pricing__banner-before strong {
  color: var(--nx-200);
  font-family: var(--font-display);
  font-weight: 500;
}

.pricing__banner-after {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--nx-white);
  line-height: 1;
}

.pricing__banner-after em {
  color: var(--nx-billing);
  font-style: normal;
}

/* Plan cards */

.pricing__plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(262px, 100%), 1fr));
  gap: 20px;
  align-items: start;
}

.plan {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: var(--r-lg);
  padding: clamp(24px, 2.6vw, 30px);
  background: var(--nx-white);
  border: 1px solid var(--nx-bone-3);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.plan--featured {
  border: 1.5px solid var(--nx-billing);
  box-shadow: 0 26px 60px -34px rgba(16, 185, 129, .75);
  transform: translateY(-8px);
}

.plan__flag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nx-billing);
  color: var(--nx-white);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.plan__name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.015em;
}

.plan__price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan__price {
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -.035em;
}

.plan__period {
  font-size: 14px;
  color: var(--nx-500);
}

.plan__tagline {
  font-size: 14px;
  color: var(--nx-600);
  line-height: 1.55;
  min-height: 42px;
}

.plan__cta {
  display: block;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 12px;
  background: var(--nx-bone-2);
  color: var(--nx-ink);
  border: 1px solid var(--nx-bone-3);
  transition: transform .25s var(--ease), box-shadow .25s;
}

.plan--featured .plan__cta {
  background: var(--nx-billing);
  color: var(--nx-white);
  border: none;
  box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .8);
}

.plan__features {
  list-style: none;
  margin: 6px 0 0;
  padding: 18px 0 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  border-top: 1px solid var(--nx-bone-3);
}

.plan__features li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14.2px;
  color: var(--nx-700);
  line-height: 1.45;
}

.plan__features .icon {
  --icon-size: 17px;
  margin-top: 2px;
  color: var(--nx-billing);
}

/* Carousel dots */

.pricing__dots {
  display: none;
  gap: 7px;
  justify-content: center;
  margin-top: 18px;
}

.pricing__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--nx-300);
  transition: width .3s var(--ease), background .3s;
}

.pricing__dot[aria-current="true"] {
  width: 22px;
  background: var(--nx-billing);
}

.pricing__note {
  text-align: center;
  color: var(--nx-500);
  font-size: 13px;
  line-height: 1.6;
  margin: 28px auto 0;
  max-width: 70ch;
}

/* Compare toggle */

.pricing__compare-toggle-wrap {
  text-align: center;
  margin-top: 14px;
}

.pricing__compare-toggle {
  background: none;
  border: none;
  color: var(--nx-billing);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pricing__compare-toggle .icon {
  --icon-size: 16px;
  transition: transform .3s var(--ease);
}

.pricing__compare-toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

/* Compare table */

.compare {
  margin-top: 22px;
  border: 1px solid var(--nx-bone-3);
  border-radius: var(--r-lg);
  background: var(--nx-white);
  overflow: hidden;
  animation: nxReveal .34s var(--ease) both;
}

.compare[hidden] {
  display: none;
}

.compare__scroll {
  overflow-x: auto;
}

.compare__table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.compare__table thead tr {
  background: var(--nx-bone-2);
}

.compare__table th {
  padding: 14px 12px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--nx-ink);
  text-align: center;
}

.compare__table th.compare__feature-head {
  text-align: left;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--nx-600);
  font-weight: 500;
  position: sticky;
  left: 0;
  background: var(--nx-bone-2);
  z-index: 2;
}

.compare__table tbody tr {
  border-top: 1px solid var(--nx-bone-3);
  background: var(--nx-white);
}

.compare__table tbody tr:nth-child(even) {
  background: var(--nx-bone);
}

.compare__table .compare__label {
  padding: 13px 18px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 400;
  text-align: left;
  color: var(--nx-700);
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
  white-space: nowrap;
}

.compare__cell {
  padding: 13px 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--nx-600);
}

.compare__cell--muted {
  color: var(--nx-500);
  font-size: 12px;
}

.compare__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--nx-bone-3);
  background: var(--nx-bone);
  margin: 0;
  font-size: 13px;
  color: var(--nx-500);
  line-height: 1.6;
}

/* Mobile: plans become a snap carousel, featured card first */

@media (max-width: 720px) {
  .pricing__plans {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 7vw 6px;
    margin: 0 -20px;
    scrollbar-width: none;
  }

  .pricing__plans::-webkit-scrollbar {
    display: none;
  }

  .plan {
    scroll-snap-align: center;
    flex: 0 0 86%;
    min-width: 86%;
    margin-top: 14px;
  }

  .pricing__dots {
    display: flex;
  }
}

/* Very narrow phones: the pill would wrap into a lozenge with one tab stacked
 * on the other. Two equal columns read better and stay on one line. */
@media (max-width: 420px) {
  .pricing__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    border-radius: 16px;
  }

  .pricing__tab {
    padding: 11px 6px;
    font-size: 13px;
    border-radius: 12px;
  }
}

/* Below 800px the 760px-wide table would only show one plan column at a time,
 * so it stops being a table and becomes a stack: the feature name takes its
 * own full-width line and the plan values sit underneath in equal columns.
 * All plans stay visible and the horizontal scroll disappears.
 *
 * The plan names pin themselves under the site header, otherwise by row ten
 * you no longer know which column is which. --compare-cols is set by
 * js/modules/pricing.js because the column count changes with the audience
 * tab (4 plans for negocio, 3 for contador). */
@media (max-width: 800px) {
  .compare,
  .compare__scroll {
    overflow: visible;
  }

  .compare__table {
    display: block;
    min-width: 0;
  }

  .compare__table thead {
    display: block;
    position: sticky;
    top: var(--header-h);
    z-index: 3;
  }

  .compare__table thead tr,
  .compare__table tbody tr {
    display: grid;
    grid-template-columns: repeat(var(--compare-cols, 4), minmax(0, 1fr));
    gap: 6px;
    padding: 12px 14px;
  }

  .compare__table thead tr {
    border-bottom: 1px solid var(--nx-bone-3);
    border-radius: calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0 0;
  }

  .compare__table th.compare__feature-head {
    display: none;
  }

  .compare__table thead th {
    padding: 0;
    font-size: 12px;
    line-height: 1.25;
  }

  .compare__table tbody {
    display: block;
  }

  .compare__table .compare__label {
    grid-column: 1 / -1;
    position: static;
    padding: 0 0 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--nx-ink);
    white-space: normal;
  }

  .compare__cell {
    padding: 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .compare__cell--muted {
    font-size: 10.5px;
  }

  .compare__foot {
    border-radius: 0 0 calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px);
  }
}

/* Under 400px the four plan names collide, so the whole stack tightens up */
@media (max-width: 400px) {
  .compare__table thead tr,
  .compare__table tbody tr {
    padding: 10px;
    gap: 4px;
  }

  /* A plan name that cannot fit gets hyphenated (the page declares lang="es-EC")
   * rather than snapped in half mid-word. */
  .compare__table thead th {
    font-size: 10.5px;
    hyphens: auto;
    overflow-wrap: break-word;
  }

  .compare__table .compare__label {
    font-size: 12.5px;
  }

  .compare__cell {
    font-size: 11px;
  }

  .compare__cell--muted {
    font-size: 10px;
  }
}
