/* The plan comparison matrix - the mobile-first reference design from
   atlasholly-jamfor-planer.html, as one reusable component (pm-*).

   Mobile: a compact plan bar stuck to the top of the viewport (offset via
   --pm-sticky-top when a host page has its own sticky chrome), feature
   groups as accordions, the label on its own line with the four values in
   a row beneath it. Desktop (>=1024px): the classic matrix - label column
   left, groups locked open (plan-matrix.js), the popular column tinted
   top to bottom.

   Data comes from apps.billing.feature_info.plan_comparison via
   templates/includes/plan_matrix.html - the registries decide the words,
   this file only decides the shape. */

.pm { position: relative; background: var(--ah-surface, #fff); border: 1px solid var(--ah-bd-card, #eeeadd); border-radius: 18px; box-shadow: 0 18px 44px -26px rgba(60, 55, 30, .3); --pm-label-w: 320px; container-type: inline-size; container-name: pm; }
.pm > * { position: relative; z-index: 1; }

.pm-head { position: sticky; top: var(--pm-sticky-top, 0px); z-index: 20; background: var(--ah-surface, #fff); border-bottom: 1px solid var(--ah-bd-row, #f0ecdf); border-radius: 17px 17px 0 0; padding: 10px 8px; }
.pm-corner { display: none; }
.pm-plans { display: grid; grid-template-columns: repeat(var(--pm-cols, 4), minmax(0, 1fr)); gap: 6px; }
.pm-plan { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; text-align: center; padding: 10px 2px; border-radius: 12px; }
.pm-plan--pop { background: var(--ah-lime-tint, oklch(0.98 0.09 115.3)); border: 1px solid var(--ah-lime-border, oklch(0.85 0.16 115.3)); }
.pm-poptab { max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: var(--ah-lime, oklch(0.96 0.18 115.3)); border: 1px solid var(--ah-ink, #201f1a); border-radius: 99px; font-size: 9px; font-weight: 700; line-height: 1.5; padding: 1px 7px; white-space: nowrap; }
.pm-pname { font-weight: 700; font-size: 14px; line-height: 1.2; }
.pm-price { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.pm-price b { font-family: var(--ah-display, system-ui); font-weight: 800; font-size: clamp(13px, 3.7vw, 15px); letter-spacing: -0.02em; white-space: nowrap; }
.pm-price span { color: var(--ah-cap, #8b8a7c); font-size: 11px; }
.pm-try { display: inline-block; max-width: 100%; border: 1.5px solid var(--ah-ink, #201f1a); border-radius: 99px; padding: 5px clamp(6px, 2vw, 10px); font-size: clamp(9.5px, 2.8vw, 11px); font-weight: 600; text-decoration: none; white-space: nowrap; color: inherit; }
.pm-plan--pop .pm-try { background: var(--ah-ink, #201f1a); color: #fff; }
.pm-try--current { border-style: dashed; pointer-events: none; opacity: 0.7; }

.pm-group { border-top: 1px solid var(--ah-bd-row, #f0ecdf); }
.pm-group:first-of-type { border-top: 0; }
.pm-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px; padding: 13px 16px; background: var(--ah-alt, #fcfbf6); border: 1px solid var(--ah-bd-card, #eeeadd); border-radius: 14px; }
.pm-group > summary::-webkit-details-marker { display: none; }
.pm-gname { font-family: var(--ah-mono, monospace); font-size: 12.5px; letter-spacing: 0.08em; color: var(--ah-list, #3d3c33); text-transform: uppercase; }
.pm-chev { color: var(--ah-ink, #201f1a); transition: transform .2s ease; flex: none; }
.pm-group[open] .pm-chev { transform: rotate(180deg); }

.pm-rows { padding: 0 10px 10px; }
.pm-row { padding: 6px 0 10px; border-top: 1px solid var(--ah-bd-row, #f0ecdf); }
.pm-rows .pm-row:first-child { border-top: 0; }
.pm-feat { padding: 8px 12px; font-size: 15.5px; font-weight: 500; color: var(--ah-list, #3d3c33); line-height: 1.35; }
.pm-feat small { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--ah-cap, #8b8a7c); line-height: 1.35; }
.pm-vals { display: grid; grid-template-columns: repeat(var(--pm-cols, 4), minmax(0, 1fr)); gap: 6px; }
.pm-cell { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 10px; }
.pm-cell--pop { background: var(--ah-lime-tint, oklch(0.98 0.09 115.3)); }
.pm-ok { width: 22px; height: 22px; border-radius: 50%; background: var(--ah-lime, oklch(0.96 0.18 115.3)); border: 1px solid var(--ah-lime-border, oklch(0.85 0.16 115.3)); display: inline-flex; align-items: center; justify-content: center; }
.pm-ok::after { content: ""; width: 5px; height: 9px; border: solid var(--ah-ink, #201f1a); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.pm-no { font-style: normal; color: var(--ah-dash, #c9c5b2); font-size: 17px; line-height: 1; }
.pm-txt { font-weight: 700; font-size: 13px; text-align: center; line-height: 1.2; padding: 0 3px; }

.pm-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 14px 0 4px; color: var(--ah-muted, #5c5b50); font-size: 14px; }
.pm-legend span { display: inline-flex; align-items: center; gap: 7px; }

.pm--nopop::before { content: none !important; }

@media (min-width: 1024px) {
    .pm::before { content: ""; position: absolute; z-index: 0; top: 0; bottom: 0; left: calc(var(--pm-label-w) + (100% - var(--pm-label-w)) / var(--pm-cols, 4) * var(--pm-pop-index, 2)); width: calc((100% - var(--pm-label-w)) / var(--pm-cols, 4)); background: var(--ah-lime-tint, oklch(0.98 0.09 115.3)); border-radius: 0 0 16px 16px; }
    .pm-head { display: grid; grid-template-columns: var(--pm-label-w) 1fr; padding: 0; }
    .pm-corner { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 0 26px 26px; }
    .pm-ctitle { font-family: var(--ah-mono, monospace); font-size: 13px; letter-spacing: 0.08em; color: var(--ah-cap, #8b8a7c); text-transform: uppercase; }
    .pm-cnote { font-size: 14px; color: var(--ah-muted, #5c5b50); line-height: 1.5; max-width: 250px; }
    .pm-plans { gap: 0; }
    .pm-plan { padding: 54px 16px 24px; border: 0; border-radius: 0; gap: 10px; background: transparent; }
    .pm-plan--pop { background: var(--ah-lime-tint, oklch(0.98 0.09 115.3)); border: 0; }
    .pm-poptab { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 12.5px; padding: 3px 12px; }
    .pm-pname { font-size: 19px; }
    /* The price keeps its stacked layout (unit under the number). The
       size scales with the COMPONENT, not the viewport: the offer page
       puts the matrix in a ~700px column where the reference design's
       30px price overflows the plan cell and the neighbours collide. */
    .pm-price b { font-size: 20px; }
    .pm-price span { font-size: 13px; }
    .pm-try { padding: 9px 20px; font-size: 15px; }
    .pm-group > summary { display: grid; grid-template-columns: var(--pm-label-w) 1fr; margin: 0; padding: 24px 26px 6px; background: transparent; border: 0; border-radius: 0; cursor: default; }
    .pm-gname { color: var(--ah-cap, #8b8a7c); font-size: 13px; }
    .pm-chev { display: none; }
    .pm-group { border-top: 0; }
    .pm-rows { padding: 0; }
    .pm-row { display: grid; grid-template-columns: var(--pm-label-w) 1fr; align-items: center; padding: 0; border-top: 1px solid var(--ah-bd-row, #f0ecdf); }
    .pm-rows .pm-row:first-child { border-top: 1px solid var(--ah-bd-row, #f0ecdf); }
    .pm-feat { padding: 16px 26px; font-size: 16.5px; }
    .pm-vals { gap: 0; align-self: stretch; }
    .pm-cell { min-height: 58px; border-radius: 0; }
    .pm-cell--pop { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .pm-chev { transition: none; } }

/* Wide hosts (the marketing price page): room for the reference sizes. */
@container pm (min-width: 960px) {
    .pm-price b { font-size: 30px; }
    .pm-price span { font-size: 14px; }
}

/* Tabs (the offer page): the matrix and the feature story share a spot. */
.pm-tabs { display: flex; gap: 8px; margin: 0 0 18px; }
.pm-tab { font: inherit; font-weight: 600; font-size: 14px; padding: 8px 18px; border: 1.5px solid var(--ah-ink, #201f1a); border-radius: 99px; background: transparent; color: var(--ah-ink, #201f1a); cursor: pointer; }
.pm-tab[aria-selected="true"] { background: var(--ah-ink, #201f1a); color: var(--ah-lime, oklch(0.96 0.18 115.3)); }
.pm-panel[hidden] { display: none; }
