/**
 * Action Center - front-end styles.
 *
 * Theme-agnostic by design: this stylesheet provides layout and restrained,
 * neutral surfaces and inherits the active theme's fonts, text color, and form
 * controls. Every color comes from a CSS custom property with a neutral default,
 * so a site brands it by setting a few variables (optional), for example:
 *
 *   .cta-single, .cta-list, .cta-section-group, .cta-filters,
 *   .cta-upcoming-block, .cta-builder { --cta-accent: #1a3d2b; }
 *
 * Buttons are self-contained (class `.cta-btn`) and colored from `--cta-accent`,
 * which defaults to the theme's own primary color. They deliberately do NOT carry
 * `wp-element-button`: some themes paint that class with a near-white secondary
 * color and white text, which made the plugin's buttons invisible. A solid accent
 * button in the theme's primary color stays readable everywhere and still adapts.
 */

.cta-archive,
.cta-list,
.cta-single,
.cta-section-group,
.cta-filters,
.cta-upcoming-block,
.cta-builder {
    /* Content width: match the theme's own content measure where it exposes one, so
       the plugin never breaks out; fall back to a calm default on classic themes. */
    --cta-content-width: var(--wp--style--global--content-size, 960px);
    /* Accent: the theme's own primary color where it exposes one, else a calm default. */
    --cta-accent: var(--wp--preset--color--primary, #2c6e49);
    --cta-on-accent: #ffffff;
    /* Borders and surfaces derive from the current text color, so they adapt to
       light and dark themes instead of forcing a palette. */
    --cta-border: color-mix(in srgb, currentColor 20%, transparent);
    --cta-surface: color-mix(in srgb, currentColor 4%, transparent);
    --cta-muted: color-mix(in srgb, currentColor 65%, transparent);
}

/* Buttons: a self-contained accent button. Normal class specificity (not :where)
   so it reliably wins over generic theme `button`/element rules, while remaining
   easy to override with `--cta-accent` / `--cta-on-accent`. */
.cta-btn {
    display: inline-block;
    padding: 0.6em 1.2em;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    background: var(--cta-accent);
    color: var(--cta-on-accent);
    font: inherit;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.cta-btn:hover,
.cta-btn:focus {
    background: color-mix(in srgb, var(--cta-accent) 85%, black);
    color: var(--cta-on-accent);
    text-decoration: none;
}
.cta-btn:focus-visible {
    outline: 2px solid var(--cta-accent);
    outline-offset: 2px;
}
.cta-btn:disabled,
.cta-btn[disabled],
.cta-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: default;
}

/* CTA archive and single layout */

/* One wrapper owns the archive's content width and top offset; the filters,
   section headings, and card grids inside all fill it, so nothing breaks out. */
.cta-archive {
    max-width: var(--cta-content-width, 960px);
    margin-inline: auto;
    padding-block: 2.5rem 3rem;
}
.cta-archive .cta-filters,
.cta-archive .cta-section-group,
.cta-archive .cta-list {
    max-width: none;
    margin-inline: 0;
}

.cta-section-group {
    margin: 0 0 2.5rem;
}
.cta-section-group:last-child {
    margin-bottom: 0;
}

.cta-list {
    margin: 1.5rem 0 0;
    max-width: 960px;
}

.cta-list--grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .cta-list--grid {
        grid-template-columns: 1fr 1fr;
    }
}

.cta-card {
    background: var(--cta-surface);
    border-radius: 4px;
    border: 1px solid var(--cta-border);
    padding: 1.25rem 1.5rem;
}

.cta-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
}

.cta-card__summary {
    margin: 0 0 0.75rem;
}

.cta-card__deadline {
    margin: 0;
    font-size: 0.9rem;
}

.cta-card__actions {
    margin: 0;
    margin-top: 1rem;
    text-align: right;
}

/* Filters */

.cta-filters {
    margin: 0 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    /* Bottom-align every group so the label-less submit button lines up with the
       select controls (not their labels) on themes like Astra that do not stretch
       the group to full row height. */
    align-items: flex-end;
}

.cta-filters__group {
    display: flex;
    flex-direction: column;
    flex: 1 1 160px;
    min-width: 0;
}

.cta-filters__label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.cta-filters__select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    /* Normalize the native select so it is the same height as the Apply Filters
       button on every theme: same vertical padding, line-height, border and radius.
       appearance:none removes the platform chrome; a custom chevron replaces the
       native arrow, with room reserved on the right for it. */
    font: inherit;
    line-height: 1.3;
    color: inherit;
    padding: 0.6em 2.2em 0.6em 0.75em;
    border: 1px solid var(--cta-border);
    border-radius: 0.3rem;
    background-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5l4 4 4-4' fill='none' stroke='%23666' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    background-size: 0.75em;
}

/* The submit group has no label, so keep it button-sized. The parent's
   align-items:flex-end bottom-aligns it with the select controls. */
.cta-filters__group--submit {
    flex: 0 0 auto;
}

.cta-filters__submit {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .cta-filters {
        flex-direction: column;
    }

    .cta-filters__group {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Single CTA layout */

.cta-single {
    max-width: var(--cta-content-width, 960px);
    margin: 2rem auto 3rem;
}

.cta-back-link {
    margin-bottom: 1rem;
}

.cta-section {
    margin-top: 2rem;
}

.cta-section__title {
    margin: 0 0 0.75rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.cta-section__title--spaced {
    margin-top: 2.5rem;
}

.cta-section__body p:last-child {
    margin-bottom: 0;
}

/* Steps section */

.cta-steps-grid--detail {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cta-step-card {
    border-radius: 4px;
    border: 1px solid var(--cta-border);
    background: var(--cta-surface);
    padding: 1.25rem 1.5rem;
}

.cta-step-card__label,
.cta-step-number {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cta-muted);
    margin-bottom: 0.5rem;
}

.cta-step-card__body,
.cta-step-body {
    font-size: 0.95rem;
}

.cta-step-card__body p:last-child,
.cta-step-body p:last-child {
    margin-bottom: 0;
}

/* Sample Text */

.cta-card--sample-text {
    border-radius: 4px;
    border: 1px solid var(--cta-border);
    background: var(--cta-surface);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.cta-sample-text__option-title {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cta-muted);
}

/* Inherit the theme's form-control look; only set size and spacing. */
.cta-sample-text__textarea {
    width: 100%;
    min-height: 12rem;
    margin: 0;
    font: inherit;
    resize: vertical;
}

.cta-sample-text__copy-row {
    margin-top: 0.75rem;
}

/* Related Links & Files */

.cta-links-list,
.cta-files-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cta-links-list__item,
.cta-files-list__item {
    margin-bottom: 0.5rem;
}

.cta-links-list__item a,
.cta-files-list__item a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    border: 1px solid var(--cta-border);
    background: var(--cta-surface);
    text-decoration: none;
    color: inherit;
}

.cta-links-list__item a:hover,
.cta-links-list__item a:focus,
.cta-files-list__item a:hover,
.cta-files-list__item a:focus {
    border-color: var(--cta-accent);
}

/* Meta (types, orgs) as pills */

.cta-meta {
    margin: 0;
}

.cta-meta--pills dt {
    font-weight: 600;
}

.cta-meta--pills dd {
    margin: 0;
}

.cta-meta__group {
    margin-right: 0.75rem;
    margin-bottom: 0.5rem;
}

.cta-meta--bottom {
    margin-top: 1.5rem;
}

.cta-meta__intro {
    margin: 0 0 1rem;
    color: var(--cta-muted);
}

/* Clickable filter pills linking back to the Action Center */
.cta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--cta-border);
    background: var(--cta-surface);
    color: inherit;
    font-size: 0.8rem;
    text-decoration: none;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
}

/* Arrow affordance signals the pill navigates/filters rather than labeling this CTA */
.cta-pill::after {
    content: '\2192';
    font-size: 0.9em;
    line-height: 1;
}

.cta-pill:hover,
.cta-pill:focus {
    border-color: var(--cta-accent);
    color: var(--cta-accent);
}

/* Videos section */

.cta-videos-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cta-video-item__label {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.cta-video-item__embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
}

.cta-video-item__embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.cta-video-item__fallback {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--cta-muted);
}

.cta-video-item__fallback a {
    color: inherit;
}

/* Urgent / Ongoing section groups on Action Center */

.cta-section-group {
    margin-top: 2.5rem;
}

.cta-section-group__title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.cta-section-group__description {
    margin: 0 0 1rem;
    color: var(--cta-muted);
    font-size: 0.95rem;
}

.cta-section-group--ongoing .cta-section-group__title {
    color: var(--cta-muted);
}

/* Ongoing badge on cards */

.cta-card__ongoing-badge,
.cta-upcoming-card__ongoing-badge {
    display: inline-block;
    margin: 0.35rem 0 0;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--cta-surface);
    border: 1px solid var(--cta-border);
    color: var(--cta-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Ongoing badge on single CTA page */

.cta-single__ongoing-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--cta-surface);
    border: 1px solid var(--cta-border);
    color: var(--cta-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

/* Legislator lookup section */

.cta-card--legislators {
    background: var(--cta-surface);
    border: 1px solid var(--cta-border);
}

.cta-legislators__intro {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.cta-legislators__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cta-legislators__link {
    display: inline-block;
    font-weight: 600;
    color: var(--cta-accent);
    text-decoration: none;
}

.cta-legislators__link:hover,
.cta-legislators__link:focus {
    text-decoration: underline;
}

/* Accordion (details/summary) for Related Links and Related Files */

.cta-section--links,
.cta-section--files {
    margin-top: 2.5rem;
}

.cta-accordion {
    border: 1px solid var(--cta-border);
    border-radius: 6px;
    overflow: hidden;
}

.cta-accordion__trigger {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    user-select: none;
    margin: 0;
    padding: 0.85rem 1.1rem;
    background: var(--cta-surface);
    color: inherit;
    font-size: 1rem;
    font-weight: 700;
}

.cta-accordion[open] > .cta-accordion__trigger {
    border-bottom: 1px solid var(--cta-border);
}

.cta-accordion__trigger:hover,
.cta-accordion__trigger:focus {
    background: color-mix(in srgb, currentColor 8%, transparent);
}

.cta-accordion__trigger::-webkit-details-marker {
    display: none;
}

.cta-accordion__trigger::after {
    content: '';
    flex-shrink: 0;
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    border-right: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-top: -0.2em;
    opacity: 0.7;
}

.cta-accordion[open] > .cta-accordion__trigger::after {
    transform: rotate(-135deg);
    margin-top: 0.2em;
}

.cta-accordion .cta-links-list,
.cta-accordion .cta-files-list {
    margin: 0;
    padding: 0.9rem 1.1rem;
}

/* Override inherited section title top margin on accordion triggers */
.cta-section--links .cta-accordion__trigger,
.cta-section--files .cta-accordion__trigger {
    margin-top: 0;
}
