/* ==========================================================================
   Comparison tables — shared styles
   Enqueue from the hello-elementor child theme (or append to style.css).
   Markup lives in one Elementor HTML widget per table.

   Table variants:
     .cmp-table            → 3 plan columns (default)
     .cmp-table.cmp-2plans → 2 plan columns (Bike)

   Value cells:
     <div class="cmp-cell cmp-a" data-value="none"></div>      → –
     <div class="cmp-cell cmp-a" data-value="yes"></div>       → ✓ icon
     <div class="cmp-cell cmp-a" data-value="optional"></div>  → "optional"
     <div class="cmp-cell cmp-a" data-value="specific">250M</div> → text as-is
   ========================================================================== */

.cmp-wrap {
  --cmp-grey: #ececec;
  --cmp-lgreen: #d9efc0;
  --cmp-green: #8dc63f;
  --cmp-text: #555;
  --cmp-plan-w: 150px;
}

.cmp-units {
  font-style: italic;
  color: #888;
  font-size: .9rem;
  margin: 0 0 18px;
}

.cmp-footnote {
  font-size: .85rem;
  color: #888;
  margin: 14px 0 0;
}

.cmp-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, var(--cmp-plan-w));
  column-gap: 14px;
  align-items: stretch;
}
.cmp-table.cmp-2plans {
  grid-template-columns: minmax(0, 1fr) repeat(2, var(--cmp-plan-w));
}

/* ---------- Plan column colors ---------- */
.cmp-head.cmp-a, .cmp-cell.cmp-a { background: var(--cmp-grey); }
.cmp-head.cmp-b, .cmp-cell.cmp-b { background: var(--cmp-lgreen); }
.cmp-head.cmp-c, .cmp-cell.cmp-c { background: var(--cmp-green); color: #fff; }

.cmp-head {
  padding: 22px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 1.3rem;
  border-radius: 14px 14px 0 0;
}
.cmp-head.cmp-a { color: var(--cmp-green); }

.cmp-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 18px 10px;
  font-weight: 500;
  text-align: center;
}
.cmp-cell.is-last { border-radius: 0 0 14px 14px; padding-bottom: 28px; }

/* ---------- Value rendering via data-value ---------- */
.cmp-cell[data-value="none"]::before {
  content: "\2013"; /* – */
  opacity: .55;
}
.cmp-cell[data-value="optional"]::before {
  content: "optional";
}
.cmp-cell[data-value="yes"]::before {
  content: "";
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  background-color: var(--cmp-green);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
}
.cmp-cell.cmp-c[data-value="yes"]::before { background-color: #fff; }

/* footnote marker inside a cell: <sup class="cmp-note">*</sup> */
.cmp-note {
  font-size: .8em;
  line-height: 1;
  align-self: flex-start;
  margin-top: 4px;
}

/* ---------- Feature column ---------- */
.cmp-feature {
  border-bottom: 1px solid #ddd;
  padding: 14px 16px 14px 0;
  align-self: stretch;
}

.cmp-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 700;
  color: var(--cmp-text);
}

/* rows with no description: same alignment, no arrow, no pointer */
/* rows with no description: same alignment, no arrow, no pointer */
.cmp-static {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid #ddd;
  padding: 14px 16px 14px 0;
  align-self: stretch;
}

.cmp-static .cmp-title {
  font-weight: 700;
  color: var(--cmp-text);
  padding-left: 22px; /* aligns with toggle titles (arrow width + gap) */
}

.cmp-arrow {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-right: 2.5px solid #b5b5b5;
  border-bottom: 2.5px solid #b5b5b5;
  transform: rotate(-45deg); /* › */
  transition: transform .25s ease;
}
.cmp-feature.is-open .cmp-arrow {
  transform: rotate(-135deg) translate(-2px, -2px); /* ˄ */
}

/* Collapsible description — 0fr → 1fr grid transition */
.cmp-desc {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .3s ease;
}
.cmp-desc-inner {
  overflow: hidden;
  min-height: 0;
  color: #777;
  font-size: .95rem;
  line-height: 1.5;
  padding-left: 22px;
}
.cmp-feature.is-open .cmp-desc { grid-template-rows: 1fr; }
.cmp-feature.is-open .cmp-desc-inner { padding-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .cmp-desc, .cmp-arrow { transition: none; }
}

/* ---------- Mobile: row-wise stacking ---------- */
@media (max-width: 767px) {
  .cmp-table,
  .cmp-table.cmp-2plans {
    grid-template-columns: repeat(3, 1fr);
    column-gap: 8px;
  }
  .cmp-table.cmp-2plans { grid-template-columns: repeat(2, 1fr); }

  .cmp-corner { display: none; }

  .cmp-head {
    border-radius: 10px;
    padding: 14px 6px;
    font-size: 1.05rem;
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .cmp-feature,
  .cmp-static {
    grid-column: 1 / -1;
    padding: 14px 0 10px;
    border-bottom: 0;
  }

  .cmp-cell {
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px 6px;
    flex-direction: column;
    gap: 4px;
  }
  .cmp-cell.is-last { padding-bottom: 12px; }

  .cmp-cell::after {
    content: attr(data-plan);
    order: -1;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: .65;
  }
  .cmp-note { align-self: center; margin-top: 0; }
}

/* Admin-bar offset for the sticky heads (logged-in views) */
@media (max-width: 767px) {
  body.admin-bar .cmp-head { top: 46px; }
}

/* Auto-round the last row even if is-last is missing on hand-added rows */
.cmp-table > .cmp-cell:nth-last-child(-n+3) {
  border-radius: 0 0 14px 14px;
  padding-bottom: 28px;
}
@media (max-width: 767px) {
  .cmp-table > .cmp-cell:nth-last-child(-n+3) { padding-bottom: 12px; }
}
