/* Pricing page: three priced plans plus Enterprise, billing toggle on top. */

:root {
    --primary-accent-color: #34A9FF;
    --plan-ink: #111827;
    --plan-body: #475569;
    --plan-muted: #6b7280;
    --plan-line: #dfe5ec;
    --plan-accent-ink: #0b74d1;
    --plan-tint: #f3f9ff;
}

body {
    margin: 0;
    width: 100%;
    font-family: "Poppins", sans-serif;
    color: var(--plan-ink);
}

#plans-page {
    box-sizing: border-box;
    max-width: 1280px;
    margin: 0 auto;
    padding: 8.5rem 1.5rem 4rem;
}

#plans-page .plans-head {
    max-width: 40rem;
    margin: 0 auto 2rem;
    text-align: center;
}

#plans-page h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 3.6vw, 2.75rem);
    line-height: 1.15;
    font-weight: 600;
}

#plans-page h1 b {
    color: var(--primary-accent-color);
    font-weight: 600;
}

#plans-page .plans-head p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--plan-body);
}

/* ---------- billing toggle ---------- */

.billing-toggle {
    display: flex;
    width: max-content;
    max-width: 100%;
    margin: 0 auto 3rem;
    padding: 0.3rem;
    border: 1px solid var(--plan-line);
    border-radius: 999px;
    background: #f5f7fa;
}

.billing-toggle button {
    display: inline-flex;
    align-items: center;
    column-gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 999px;
    background: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--plan-muted);
    cursor: pointer;
}

.billing-toggle button.active {
    background: #fff;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
    font-weight: 600;
    color: var(--plan-ink);
}

.billing-toggle button small {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--plan-accent-ink);
}

.billing-toggle button:focus-visible,
.plan .cta:focus-visible {
    outline: 3px solid rgba(52, 169, 255, 0.45);
    outline-offset: 2px;
}

/* ---------- plan cards ---------- */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.plan {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--plan-line);
    border-radius: 16px;
    background: #fff;
}

.plan.featured {
    border: 2px solid var(--primary-accent-color);
    box-shadow: 0 12px 34px rgba(52, 169, 255, 0.16);
}

.plan .badge {
    position: absolute;
    top: -0.8rem;
    left: 1.5rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: var(--primary-accent-color);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
}

.plan h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.plan .for {
    min-height: 2.8rem;
    margin: 0.35rem 0 1.25rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--plan-muted);
}

.plan .price {
    display: flex;
    align-items: baseline;
    column-gap: 0.35rem;
    margin: 0;
}

.plan .price b {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.plan .price span {
    font-size: 0.85rem;
    color: var(--plan-muted);
}

.plan .terms {
    margin: 0.4rem 0 1.25rem;
    font-size: 0.78rem;
    color: var(--plan-muted);
}

.plan .cta {
    display: block;
    padding: 0.75rem 1rem;
    border: 2px solid #000;
    border-radius: 10px;
    background: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: #000;
    transition: background-color 0.15s, color 0.15s;
}

.plan .cta:hover,
.plan.featured .cta {
    background: #000;
    color: #fff;
}

.plan.featured .cta:hover {
    border-color: #1f2937;
    background: #1f2937;
}

/* features */
.plan ul {
    margin: 1.25rem 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--plan-line);
    list-style: none;
}

.plan li {
    position: relative;
    margin-bottom: 0.65rem;
    padding-left: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--plan-body);
}

.plan li:last-child {
    margin-bottom: 0;
}

.plan li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.35rem;
    width: 0.3rem;
    height: 0.6rem;
    border: solid var(--plan-accent-ink);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.plan li.lead {
    padding-left: 0;
    font-weight: 600;
    color: var(--plan-ink);
}

.plan li.lead::before {
    display: none;
}

/* the AI allowance is the line people compare on */
.plan li.ai {
    font-weight: 600;
    color: var(--plan-ink);
}

/* ---------- sections below the cards ---------- */

.plans-section {
    max-width: 52rem;
    margin: 8rem auto 0;
}

.plans-section h2 {
    margin: 0 0 0.9rem;
    font-size: 1.6rem;
    line-height: 1.25;
    font-weight: 600;
    text-align: center;
}

.plans-section .section-sub {
    max-width: 36rem;
    margin: 0 auto 3rem;
    font-size: 1rem;
    line-height: 1.7;
    text-align: center;
    color: var(--plan-body);
}

.plans-section .section-note {
    margin: 1.25rem 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    text-align: center;
    color: var(--plan-muted);
}

.plans-section a {
    color: var(--plan-accent-ink);
}

/* Meta's rate + our fee = what you pay */
.rate-table {
    border: 1px solid var(--plan-line);
    border-radius: 16px;
    overflow: hidden;
}

.rate-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr));
    align-items: center;
    column-gap: 1rem;
    padding: 1.3rem 1.5rem;
    border-top: 1px solid var(--plan-line);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.rate-row > div:not(:first-child) {
    text-align: right;
}

.rate-head {
    border-top: none;
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--plan-muted);
}

.rate-name b {
    display: block;
    font-weight: 600;
}

.rate-name span {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--plan-muted);
}

.rate-meta,
.rate-fee {
    color: var(--plan-body);
}

.rate-pay {
    font-size: 1.05rem;
    font-weight: 700;
}

.rate-head > div:last-child {
    color: var(--plan-ink);
}

.rate-pay span {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--plan-accent-ink);
}

.free-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 2.5rem;
}

.free-row > div {
    padding: 1.2rem 1.35rem;
    border-radius: 12px;
    background: #f0faf4;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--plan-body);
}

.free-row b {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #15803d;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem;
}

.why-grid b {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 1rem;
    font-weight: 600;
}

.why-grid span {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--plan-body);
}

/* calculators */
.plan-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.plan-link {
    display: block;
    padding: 1.5rem 1.65rem;
    border-radius: 14px;
    background: var(--plan-tint);
    text-decoration: none;
    transition: background-color 0.15s;
}

.plan-link:hover {
    background: #e4f2ff;
}

.plan-link b {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--plan-accent-ink);
}

.plan-link b::after {
    content: " \2192";
}

.plan-link span {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--plan-body);
}

/* how pricing works */
.plans-faq h2 {
    margin-bottom: 2.5rem;
}

.plans-faq details {
    border-bottom: 1px solid var(--plan-line);
}

.plans-faq details:first-of-type {
    border-top: 1px solid var(--plan-line);
}

.plans-faq summary {
    position: relative;
    padding: 1.4rem 2.5rem 1.4rem 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    list-style: none;
}

.plans-faq summary::-webkit-details-marker {
    display: none;
}

.plans-faq summary::after {
    content: "";
    position: absolute;
    right: 0.5rem;
    top: 1.75rem;
    width: 0.5rem;
    height: 0.5rem;
    border: solid var(--plan-accent-ink);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform 0.15s;
}

.plans-faq details[open] summary::after {
    top: 2rem;
    transform: rotate(-135deg);
}

.plans-faq details p {
    max-width: 44rem;
    margin: 0 0 1.6rem;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--plan-body);
}

.plan-fineprint {
    max-width: 46rem;
    margin: 3.5rem auto 0;
    font-size: 0.8rem;
    line-height: 1.6;
    text-align: center;
    color: var(--plan-muted);
}

@media (max-width: 1100px) {
    #plans-page {
        max-width: 760px;
    }

    .plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 1.75rem;
    }
}

@media (max-width: 640px) {
    #plans-page {
        max-width: 460px;
        padding: 7rem 1.25rem 3rem;
    }

    .billing-toggle {
        margin-bottom: 2.25rem;
    }

    .billing-toggle button {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .plan-grid,
    .plan-links,
    .free-row,
    .why-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .why-grid {
        gap: 2.25rem;
    }

    .plans-section {
        margin-top: 5.5rem;
    }

    .plans-section .section-sub {
        margin-bottom: 2.25rem;
    }

    .plans-section h2 {
        font-size: 1.35rem;
    }

    /* each rate becomes: name and total on one line, the sum underneath */
    .rate-head {
        display: none;
    }

    .rate-row {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: 0.5rem;
        padding: 1.2rem 1.1rem;
    }

    .rate-row:nth-child(2) {
        border-top: none;
    }

    .rate-name {
        grid-row: 1;
        grid-column: 1;
    }

    .rate-pay {
        grid-row: 1;
        grid-column: 2;
    }

    .rate-meta,
    .rate-fee {
        grid-row: 2;
        font-size: 0.8rem;
    }

    .rate-row > .rate-meta {
        grid-column: 1;
        text-align: left;
    }

    .rate-fee {
        grid-column: 2;
    }

    .rate-meta::before,
    .rate-fee::before {
        content: attr(data-label) " ";
        color: var(--plan-muted);
    }

    /* recommended plan first on small screens */
    .plan.featured {
        order: -1;
    }

    .plan .for {
        min-height: 0;
    }
}

/* country dropdown above the message charges table */
.rate-country {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 0 0 1.75rem;
}

.rate-country > span {
    font-size: 0.95rem;
    color: var(--plan-body);
}

.rate-country .country-picker {
    width: 300px;
}

@media (max-width: 640px) {
    .rate-country {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .rate-country > span {
        text-align: center;
    }

    .rate-country .country-picker {
        width: 100%;
    }
}

/* AI model rates, per 1M tokens */
.ai-rates-title {
    text-align: center;
    margin-top: 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--plan-ink);
}

.ai-rate-table {
    border: 1px solid var(--plan-line);
    border-radius: 16px;
    overflow: hidden;
}

.ai-rate-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
    align-items: center;
    column-gap: 1rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--plan-line);
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
    color: var(--plan-body);
}

.ai-rate-row > div:not(:first-child) {
    text-align: right;
}

.ai-rate-head {
    border-top: none;
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--plan-muted);
}

.ai-rate-name b {
    font-weight: 600;
    color: var(--plan-ink);
}

.ai-rate-name span {
    margin-left: 0.5rem;
    font-size: 0.78rem;
    color: var(--plan-muted);
}

@media (max-width: 640px) {
    .ai-rate-head {
        display: none;
    }

    .ai-rate-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        row-gap: 0.4rem;
        padding: 0.9rem 1.1rem;
    }

    .ai-rate-row:nth-child(2) {
        border-top: none;
    }

    .ai-rate-name {
        grid-column: 1 / -1;
    }

    .ai-rate-row > div:not(:first-child) {
        text-align: left;
        font-size: 0.82rem;
    }

    .ai-rate-row > div:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: 0.68rem;
        color: var(--plan-muted);
    }
}
