/* Gaffo AI: plan cards and top-up packs. Markup comes from build-pricing.mjs (prices from plans.json).
   Loaded by /pricing and by the home page's pricing teaser, so it stands alone: it needs tokens.css and base.css
   (.card, .btn, .badge, .sr) and nothing else.

   Plans: the featured plan is the large card on the left (first in the markup), the others are compact cards
   stacked beside it. Classes: .plans .plan .featured .plan-head .for .price (small) .per .save .feat .plan-cta,
   .plans-note, and the billing switch [data-billing="month|year"] with .m-only / .y-only.
   Packs: .packs-head, .packs > .pack (.best) with .n .c .u .p and a .btn, .packs-note. */

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.plan { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-content: start; padding: clamp(22px, 2.4vw, 30px); min-width: 0; }
.plan > * { grid-column: 1 / -1; min-width: 0; }
.plan .plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.plan h3 { font-size: var(--t-h3); letter-spacing: -0.02em; line-height: 1.1; overflow-wrap: anywhere; }
.plan .for { margin-top: 6px; color: var(--ink-2); font-size: var(--t-small); max-width: 38ch; }
.plan .price { font: 600 clamp(2rem, 1.5rem + 1.4vw, 2.75rem)/1 var(--f-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan .price small { font: 500 .9375rem/1 var(--f-text); letter-spacing: 0; color: var(--ink-3); }
.plan .per { margin-top: 16px; font: 500 .8125rem/1.5 var(--f-mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan .save { min-height: 1.5em; font-size: .875rem; line-height: 1.5; color: var(--green-hi); }
.plan .feat { list-style: none; display: flex; flex-wrap: wrap; flex-direction: var(--feat-dir, row); gap: 6px 18px; margin-top: 14px; font-size: .875rem; color: var(--ink-2); }
.plan .feat li { display: flex; gap: 9px; align-items: baseline; }
.plan .feat li::before { content: ""; flex: none; width: 6px; height: 6px; background: var(--green-lo); transform: translateY(-2px); }
.plan .plan-cta { margin-top: 20px; display: flex; }

/* compact plans: name and use on the left, the price on the right */
.plan:not(.featured) .plan-head { grid-column: 1; grid-row: 1; }
.plan:not(.featured) .for { grid-column: 1; grid-row: 2; }
.plan:not(.featured) .price { grid-column: 2; grid-row: 1 / span 2; align-self: start; text-align: right; }

/* the featured plan: the large card, first among equals */
.plan.featured { grid-row: span 2; align-self: start; display: flex; flex-direction: column; padding: clamp(26px, 3.2vw, 44px); background: var(--panel); border-color: rgb(0 255 133 / .4); }
.plan.featured::after { content: ""; position: absolute; left: clamp(26px, 3.2vw, 44px); top: -1px; width: 48px; height: 2px; background: var(--green); }
.plan.featured h3 { font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.375rem); }
.plan.featured .for { font-size: var(--t-body); }
.plan.featured .price { margin-top: clamp(28px, 4vw, 56px); font-size: clamp(3.25rem, 2rem + 3.6vw, 5.5rem); letter-spacing: -0.055em; }
.plan.featured .price small { font-size: 1rem; }
.plan.featured .feat { display: grid; gap: 10px; margin-top: 28px; font-size: var(--t-small); color: var(--ink); }
.plan.featured .feat li::before { background: var(--green); }
.plan.featured .plan-cta { margin-top: auto; padding-top: 28px; }
.plan.featured .plan-cta .btn { flex: 1; }

.plan .renew { margin-top: 16px; font-size: .75rem; line-height: 1.45; color: var(--ink-3); }
.plans-note, .packs-note { margin-top: 16px; font-size: var(--t-small); color: var(--ink-3); }

/* billing switch (assets/js/pricing.js sets data-billing) */
[data-billing="year"] .m-only, [data-billing="month"] .y-only { display: none; }

@media (max-width: 860px) {
  .plans { grid-template-columns: minmax(0, 1fr); }
  .plan.featured { grid-row: auto; }
  .plan.featured .price { margin-top: 28px; }
}
@media (max-width: 420px) {
  .plan:not(.featured) .price { font-size: 1.75rem; }
  .plan .plan-cta .btn { flex: 1; }
}

/* ---------- top-up packs: a compact price list ---------- */
.packs-head, .pack { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr) 72px 104px; gap: 16px; align-items: center; }
.packs-head { padding: 0 18px 10px 20px; font: 500 .8125rem/1 var(--f-text); color: var(--ink-3); }
.packs-head span:nth-child(4) { text-align: right; }
.packs { list-style: none; display: grid; gap: 4px; }
.pack { min-height: 64px; padding: 10px 12px 10px 20px; background: var(--bg-2); border: 1px solid transparent; border-radius: 12px; }
.pack .n { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 600 1.0625rem/1.2 var(--f-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.pack .c { color: var(--ink); font-variant-numeric: tabular-nums; }
.pack .u { font: 500 .8125rem/1.4 var(--f-mono); color: var(--ink-3); white-space: nowrap; }
.pack .p { font: 600 1.25rem/1 var(--f-display); letter-spacing: -0.02em; text-align: right; font-variant-numeric: tabular-nums; }
.pack .btn { justify-self: end; min-height: 44px; min-width: 88px; }
.pack.best { background: var(--panel); border-color: rgb(0 255 133 / .3); }
@media (hover: hover) and (pointer: fine) { .pack { transition: background-color var(--d-hover) ease; } .pack:hover { background: var(--panel); } }

@media (max-width: 640px) {
  .packs-head { display: none; }
  .pack { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n p" "c b" "u b"; gap: 4px 16px; padding: 14px 12px 14px 16px; }
  .pack .n { grid-area: n; } .pack .p { grid-area: p; } .pack .c { grid-area: c; font-size: var(--t-small); } .pack .u { grid-area: u; }
  .pack .btn { grid-area: b; align-self: end; }
}

@media (max-width: 680px) { .plan .feat { --feat-dir: column; } }
