/* ==========================================================================
   Retail Membership Calculator widget
   Components/Widgets/RetailMembershipCalculator/
   ========================================================================== */

.rmc {
    /* Surface */
    --rmc-surface: #fff;
    --rmc-border: #e8e8e8;
    --rmc-shadow: 0 2px 18px rgba(0, 37, 105, .07);
    --rmc-radius: 16px;
    /* Type */
    --rmc-font: 'Gotham Book', 'Gotham', 'Gotham SSm A', 'Gotham SSm B', Helvetica Neue, sans-serif;
    --rmc-font-medium: 'Gotham Medium', 'Gotham', 'Gotham SSm A', 'Gotham SSm B', Helvetica Neue, sans-serif;
    --rmc-heading: #002569;
    --rmc-text: #434343;
    --rmc-muted: #707070;
    /* Accents */
    --rmc-accent: #0053a5;
    --rmc-amount: #0053a5;
    --rmc-error: #b71d1c;
    /* Field */
    --rmc-field-bg: #fff;
    --rmc-field-border: #c9d2da;
    --rmc-field-text: #002569;
    --rmc-focus: #0090d4;
    --rmc-focus-ring: rgba(0, 144, 212, .25);
    /* Result / rate-card panels */
    --rmc-panel: rgba(219, 234, 185, .35);
    --rmc-panel-border: rgba(0, 37, 105, .08);
    --rmc-rule: rgba(0, 37, 105, .1);
    --rmc-zebra: rgba(219, 234, 185, .3);
    /* Button */
    --rmc-btn-bg: #0053a5;
    --rmc-btn-text: #fff;
    --rmc-btn-bg-hover: #002569;

    box-sizing: border-box;
    max-width: 760px;
    margin: 24px auto;
    padding: 36px 36px 32px;
    background: var(--rmc-surface);
    border: 1px solid var(--rmc-border);
    border-radius: var(--rmc-radius);
    box-shadow: var(--rmc-shadow);
    font-family: var(--rmc-font);
    color: var(--rmc-text);
}

    .rmc *,
    .rmc *::before,
    .rmc *::after {
        box-sizing: inherit;
    }

    /* The component toggles visibility with the `hidden` attribute; several of these
       elements are given a display value below, which would otherwise override it. */
    .rmc [hidden] {
        display: none !important;
    }

/* ---------------------------------------------------------------- Themes */

.rmc--navy {
    --rmc-surface: linear-gradient(155deg, #002569 0%, #00397f 55%, #0053a5 100%);
    --rmc-border: transparent;
    --rmc-shadow: 0 10px 34px rgba(0, 37, 105, .28);
    --rmc-heading: #fff;
    --rmc-text: rgba(255, 255, 255, .88);
    --rmc-muted: rgba(255, 255, 255, .72);
    --rmc-amount: #b9d300;
    --rmc-error: #ffbebe;
    --rmc-field-border: rgba(255, 255, 255, .38);
    --rmc-focus: #b9d300;
    --rmc-focus-ring: rgba(185, 211, 0, .3);
    --rmc-panel: rgba(255, 255, 255, .08);
    --rmc-panel-border: rgba(255, 255, 255, .2);
    --rmc-rule: rgba(255, 255, 255, .18);
    --rmc-zebra: rgba(255, 255, 255, .05);
    --rmc-btn-bg: #fff;
    --rmc-btn-text: #002569;
    --rmc-btn-bg-hover: #b9d300;
}

.rmc--plain {
    --rmc-surface: transparent;
    --rmc-border: transparent;
    --rmc-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

/* ---------------------------------------------------------------- Header */

.rmc__heading {
    margin: 0 0 10px;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: clamp(24px, 4.2vw, 32px);
    line-height: 1.2;
    color: var(--rmc-heading);
}

.rmc__intro {
    margin: 0 0 26px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--rmc-text);
}

    .rmc__intro > :first-child {
        margin-top: 0;
    }

    .rmc__intro > :last-child {
        margin-bottom: 0;
    }

/* ---------------------------------------------------------------- Input */

.rmc__label {
    display: block;
    margin-bottom: 10px;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: 16px;
    line-height: 1.4;
    color: var(--rmc-heading);
}

.rmc__field {
    display: flex;
    align-items: stretch;
    background: var(--rmc-field-bg);
    border: 1.5px solid var(--rmc-field-border);
    border-radius: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .rmc__field:focus-within {
        border-color: var(--rmc-focus);
        box-shadow: 0 0 0 3px var(--rmc-focus-ring);
    }

.rmc__field--invalid {
    border-color: var(--rmc-error);
}

.rmc__currency {
    display: flex;
    align-items: center;
    padding: 0 2px 0 18px;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: clamp(22px, 5vw, 26px);
    line-height: 1;
    color: var(--rmc-muted);
    user-select: none;
}

.rmc__input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    /* 22px floor keeps iOS Safari from zooming the page on focus (needs >= 16px). */
    padding: 16px 18px 16px 6px;
    border: 0;
    background: transparent;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: clamp(22px, 5vw, 26px);
    line-height: 1.25;
    color: var(--rmc-field-text);
    font-variant-numeric: tabular-nums;
    appearance: none;
}

    .rmc__input:focus {
        outline: none; /* the ring is drawn on .rmc__field so it wraps the "$" too */
    }

    .rmc__input::placeholder {
        color: var(--rmc-muted);
        opacity: .55;
    }

.rmc__help,
.rmc__echo {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rmc-muted);
}

.rmc__echo {
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    color: var(--rmc-accent);
}

.rmc--navy .rmc__echo {
    color: #fff;
}

.rmc__error {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    color: var(--rmc-error);
}

/* ---------------------------------------------------------------- Actions */

.rmc__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    margin-top: 22px;
}

.rmc__btn {
    display: inline-block;
    min-height: 52px;
    padding: 15px 34px;
    border: 0;
    border-radius: 30px;
    background: var(--rmc-btn-bg);
    color: var(--rmc-btn-text);
    font-family: var(--rmc-font-medium);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.375;
    text-align: center;
    cursor: pointer;
    transition: background-color .18s ease, transform .12s ease;
}

    .rmc__btn:hover,
    .rmc__btn:focus-visible {
        background: var(--rmc-btn-bg-hover);
    }

    .rmc__btn:active {
        transform: translateY(1px);
    }

.rmc__reset {
    padding: 8px 4px;
    border: 0;
    background: none;
    font-family: var(--rmc-font);
    font-size: 15px;
    line-height: 1.4;
    color: var(--rmc-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

    .rmc__reset:hover,
    .rmc__reset:focus-visible {
        color: var(--rmc-heading);
    }

.rmc__btn:focus-visible,
.rmc__reset:focus-visible,
.rmc__breakdown-summary:focus-visible,
.rmc__rates-summary:focus-visible,
.rmc__cta:focus-visible {
    outline: 3px solid var(--rmc-focus);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- Result */

.rmc__result {
    margin-top: 28px;
    padding: 26px 24px 20px;
    background: var(--rmc-panel);
    border: 1px solid var(--rmc-panel-border);
    border-radius: var(--rmc-radius);
}

.rmc__result-label {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--rmc-muted);
}

.rmc__amount {
    margin: 6px 0 0;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: clamp(34px, 9vw, 52px);
    line-height: 1.08;
    letter-spacing: -.01em;
    color: var(--rmc-amount);
    /* Digits keep a fixed advance width, so the figure does not jitter while typing. */
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.rmc__note {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rmc-muted);
}

/* ---------------------------------------------------------------- Breakdown */

.rmc__breakdown {
    margin-top: 18px;
    border-top: 1px solid var(--rmc-rule);
    padding-top: 8px;
}

.rmc__breakdown-summary,
.rmc__rates-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: 15px;
    line-height: 1.4;
    color: var(--rmc-accent);
    cursor: pointer;
    list-style: none;
}

    .rmc__breakdown-summary::-webkit-details-marker,
    .rmc__rates-summary::-webkit-details-marker {
        display: none;
    }

    .rmc__breakdown-summary::before,
    .rmc__rates-summary::before {
        content: "";
        flex: 0 0 auto;
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(-45deg);
        transition: transform .18s ease;
    }

.rmc__breakdown[open] > .rmc__breakdown-summary::before,
.rmc__rates[open] > .rmc__rates-summary::before {
    transform: rotate(45deg);
}

.rmc--navy .rmc__breakdown-summary,
.rmc--navy .rmc__rates-summary {
    color: #fff;
}

.rmc__breakdown-list {
    margin: 6px 0 8px;
}

.rmc__breakdown-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--rmc-rule);
    font-size: 15px;
    line-height: 1.45;
}

    .rmc__breakdown-row dt {
        margin: 0;
        font-weight: inherit;
        color: var(--rmc-muted);
    }

    .rmc__breakdown-row dd {
        margin: 0;
        font-family: var(--rmc-font-medium);
        font-weight: 350;
        color: var(--rmc-text);
        font-variant-numeric: tabular-nums;
        text-align: right;
    }

.rmc__breakdown-row--total {
    border-bottom: 0;
    padding-top: 12px;
    font-size: 16px;
}

    .rmc__breakdown-row--total dt {
        font-family: var(--rmc-font-medium);
        font-weight: 350;
        color: var(--rmc-heading);
    }

    .rmc__breakdown-row--total dd {
        color: var(--rmc-heading);
    }

.rmc--navy .rmc__breakdown-row--total dt,
.rmc--navy .rmc__breakdown-row--total dd {
    color: #fff;
}

.rmc__cta {
    margin-top: 20px !important;
    margin-bottom: 0 !important;
}

/* ---------------------------------------------------------------- Disclaimer */

.rmc__disclaimer {
    margin-top: 18px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--rmc-muted);
}

    .rmc__disclaimer > :first-child {
        margin-top: 0;
    }

    .rmc__disclaimer > :last-child {
        margin-bottom: 0;
    }

/* ---------------------------------------------------------------- Rate card */

.rmc__rates {
    margin-top: 18px;
    border-top: 1px solid var(--rmc-rule);
}

.rmc__rates-body {
    margin: 4px 0 8px;
    border: 1px solid var(--rmc-panel-border);
    border-radius: 12px;
    overflow: hidden;
}

.rmc .rmc__rate-table {
    display: table;
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 15px;
    line-height: 1.45;
    overflow: visible;
}

.rmc .rmc__rate-table th,
.rmc .rmc__rate-table td {
    padding: 14px 16px;
    border: 0;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: break-word;
}

.rmc .rmc__rate-table thead th {
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    font-size: 13px;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--rmc-muted);
    background: var(--rmc-zebra);
}

.rmc .rmc__rate-table tbody th {
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    color: var(--rmc-heading);
}

.rmc--navy .rmc__rate-table tbody th {
    color: #fff;
}

.rmc .rmc__rate-table tbody td {
    color: var(--rmc-text);
    font-variant-numeric: tabular-nums;
}

.rmc .rmc__rate-table tbody tr + tr th,
.rmc .rmc__rate-table tbody tr + tr td {
    border-top: 1px solid var(--rmc-rule);
}

.rmc .rmc__rate-table tfoot th,
.rmc .rmc__rate-table tfoot td {
    background: var(--rmc-zebra);
    font-family: var(--rmc-font-medium);
    font-weight: 350;
    color: var(--rmc-heading);
    font-variant-numeric: tabular-nums;
}

.rmc--navy .rmc__rate-table tfoot th,
.rmc--navy .rmc__rate-table tfoot td {
    color: #fff;
}

.rmc__noscript {
    margin: 18px 0 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--rmc-muted);
}

/* ---------------------------------------------------------------- Page Builder */

.rmc__builder-warning {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    font-size: 14px;
    line-height: 1.5;
    color: #7a4b00;
}

/* ---------------------------------------------------------------- Utility */

.rmc__sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------- Mobile */

@media (max-width: 767.98px) {
    .rmc {
        margin: 16px auto;
        padding: 24px 20px 22px;
    }

    .rmc__result {
        padding: 20px 18px 16px;
    }

    .rmc__actions {
        gap: 12px;
    }

    .rmc__btn {
        /* A single full-width target is easier to hit than a centred pill. */
        flex: 1 1 100%;
    }

    .rmc__reset {
        flex: 1 1 100%;
        text-align: center;
    }
}

@media (max-width: 575.98px) {
    /* The rate card is three short values per row; stacked cards read better than a
       sideways scroll, and data-label carries the column header onto each card. */
    .rmc .rmc__rate-table,
    .rmc .rmc__rate-table tbody,
    .rmc .rmc__rate-table tfoot,
    .rmc .rmc__rate-table tr,
    .rmc .rmc__rate-table th,
    .rmc .rmc__rate-table td {
        display: block;
    }

    .rmc .rmc__rate-table thead {
        display: none;
    }

    .rmc .rmc__rate-table tbody tr,
    .rmc .rmc__rate-table tfoot tr {
        padding: 16px;
    }

    .rmc .rmc__rate-table tbody tr + tr {
        border-top: 1px solid var(--rmc-rule);
    }

    .rmc .rmc__rate-table tbody tr + tr th,
    .rmc .rmc__rate-table tbody tr + tr td {
        border-top: 0;
    }

    .rmc .rmc__rate-table th,
    .rmc .rmc__rate-table td {
        padding: 0;
    }

    .rmc .rmc__rate-table tbody th {
        font-size: 16px;
    }

    .rmc .rmc__rate-table td[data-label] {
        margin-top: 10px;
    }

    .rmc .rmc__rate-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        font-family: var(--rmc-font-medium);
        font-size: 12px;
        line-height: 1.35;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--rmc-muted);
    }

    .rmc .rmc__rate-table tfoot tr {
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }

    .rmc .rmc__rate-table tfoot td[data-label]::before {
        content: none;
    }

    .rmc .rmc__rate-table tfoot td[data-label] {
        margin-top: 0;
    }
}

/* ---------------------------------------------------------------- Motion */

.rmc__amount {
    animation: rmc-amount-in .28s ease-out;
}

@keyframes rmc-amount-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rmc *,
    .rmc *::before,
    .rmc *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------------------------------------------------------------- Print */

@media print {
    .rmc {
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: none;
        color: #000;
    }

    .rmc__actions,
    .rmc__echo,
    .rmc__noscript,
    .rmc__builder-warning {
        display: none !important;
    }

    /* Paper has no affordance for opening a disclosure, so print the contents. */
    .rmc details > *:not(summary) {
        display: block !important;
    }

    .rmc .rmc__rate-table,
    .rmc .rmc__rate-table thead,
    .rmc .rmc__rate-table tbody,
    .rmc .rmc__rate-table tfoot,
    .rmc .rmc__rate-table tr {
        display: revert;
    }

    .rmc .rmc__rate-table th,
    .rmc .rmc__rate-table td {
        display: revert;
        padding: 8px 10px;
    }

    .rmc .rmc__rate-table td[data-label]::before {
        content: none;
    }

    .rmc__result {
        break-inside: avoid;
    }
}
