/**
 * CTA Band Section Styles
 * Configurable Call-to-Action repeater component for Grav CMS
 */

:root,
.cta-band {
    --cta-bg: #ffffff;
    --cta-title-color: #2563eb;
    --cta-text-color: #374151;
    --cta-btn-bg: #4d633c;
    --cta-btn-text: #ffffff;
    --cta-btn-hover-bg: #3d522f;
    --cta-border-color: rgba(0, 0, 0, 0.08);
}

.cta-bands-wrapper {
    width: 100%;
    position: relative;
}

.cta-band {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--cta-bg, #ffffff);
    color: var(--cta-text-color, #374151);
    transition: background-color 200ms ease, color 200ms ease;
}

/* Borders */
.cta-band--border-top {
    border-top: 1px solid var(--cta-border-color, rgba(0, 0, 0, 0.08));
}
.cta-band--border-bottom {
    border-bottom: 1px solid var(--cta-border-color, rgba(0, 0, 0, 0.08));
}
.cta-band--border-both {
    border-top: 1px solid var(--cta-border-color, rgba(0, 0, 0, 0.08));
    border-bottom: 1px solid var(--cta-border-color, rgba(0, 0, 0, 0.08));
}

/* Padding variants */
.cta-band--padding-compact {
    padding: clamp(2.5rem, 4vw, 3.5rem) 1.5rem;
}
.cta-band--padding-normal {
    padding: clamp(4rem, 6vw, 6rem) 1.5rem;
}
.cta-band--padding-spacious {
    padding: clamp(6rem, 9vw, 9rem) 1.5rem;
}
.cta-band--padding-none {
    padding: 0 1.5rem;
}

/* Container widths */
.cta-band__container {
    width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
}
.cta-band--width-compact .cta-band__container {
    max-width: 640px;
}
.cta-band--width-narrow .cta-band__container {
    max-width: 780px;
}
.cta-band--width-standard .cta-band__container {
    max-width: 1024px;
}
.cta-band--width-wide .cta-band__container {
    max-width: 1240px;
}
.cta-band--width-full .cta-band__container {
    max-width: 100%;
    padding-inline: clamp(1.5rem, 4vw, 4rem);
}

/* Content Layout */
.cta-band__inner {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Text alignments */
.cta-band--align-center .cta-band__inner,
.cta-band--align-center .cta-band__header,
.cta-band--align-center .cta-band__content {
    text-align: center;
    align-items: center;
}
.cta-band--align-left .cta-band__inner,
.cta-band--align-left .cta-band__header,
.cta-band--align-left .cta-band__content {
    text-align: left;
    align-items: flex-start;
}
.cta-band--align-right .cta-band__inner,
.cta-band--align-right .cta-band__header,
.cta-band--align-right .cta-band__content {
    text-align: right;
    align-items: flex-end;
}

/* Eyebrow */
.cta-band__eyebrow {
    display: inline-block;
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cta-title-color, #2563eb);
    opacity: 0.9;
}

/* Heading */
.cta-band__title {
    margin: 0;
    font-family: inherit;
    font-size: clamp(2rem, 4.2vw, 3.25rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: var(--cta-title-color, #2563eb);
}

/* Content / Body */
.cta-band__body {
    margin-top: 1.15rem;
    font-size: clamp(1.05rem, 1.4vw, 1.25rem);
    line-height: 1.65;
    color: var(--cta-text-color, #374151);
}
.cta-band__body > :first-child {
    margin-top: 0;
}
.cta-band__body > :last-child {
    margin-bottom: 0;
}
.cta-band__body p {
    margin: 0 0 1rem;
    line-height: 1.65;
}
.cta-band__body a {
    color: var(--cta-title-color, #2563eb);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Actions / Buttons area */
.cta-band__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-top: clamp(1.5rem, 2.5vw, 2.25rem);
}

/* Button alignments */
.cta-band--btn-center .cta-band__actions {
    justify-content: center;
}
.cta-band--btn-left .cta-band__actions {
    justify-content: flex-start;
}
.cta-band--btn-right .cta-band__actions {
    justify-content: flex-end;
}
.cta-band--btn-stacked .cta-band__actions {
    flex-direction: column;
    width: 100%;
}
.cta-band--btn-stacked .cta-band__actions .cta-button {
    width: 100%;
    text-align: center;
}

/* Button Base Styles */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 3.25rem;
    padding: 0.85rem 2rem;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.cta-button:active {
    transform: translateY(0);
}

.cta-button:focus-visible {
    outline: 3px solid var(--cta-title-color, #2563eb);
    outline-offset: 3px;
}

/* Corner radius */
.cta-button--rounded {
    border-radius: 0.35rem;
}
.cta-button--pill {
    border-radius: 9999px;
}
.cta-button--square {
    border-radius: 0;
}

/* Primary Button Styles */
.cta-button--primary.cta-button--solid {
    background-color: var(--cta-btn-bg, #4d633c);
    color: var(--cta-btn-text, #ffffff);
    border: 2px solid var(--cta-btn-bg, #4d633c);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.cta-button--primary.cta-button--solid:hover {
    background-color: var(--cta-btn-hover-bg, #3d522f);
    border-color: var(--cta-btn-hover-bg, #3d522f);
    color: var(--cta-btn-text, #ffffff);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.cta-button--primary.cta-button--outline {
    background-color: transparent;
    color: var(--cta-btn-bg, #4d633c);
    border: 2px solid var(--cta-btn-bg, #4d633c);
}
.cta-button--primary.cta-button--outline:hover {
    background-color: var(--cta-btn-bg, #4d633c);
    color: var(--cta-btn-text, #ffffff);
}

.cta-button--primary.cta-button--subtle {
    background-color: color-mix(in srgb, var(--cta-btn-bg, #4d633c) 15%, transparent);
    color: var(--cta-btn-bg, #4d633c);
    border: 2px solid transparent;
}
.cta-button--primary.cta-button--subtle:hover {
    background-color: var(--cta-btn-bg, #4d633c);
    color: var(--cta-btn-text, #ffffff);
}

.cta-button--primary.cta-button--link {
    background: transparent;
    border: 0;
    padding: 0.5rem 0;
    min-height: auto;
    color: var(--cta-btn-bg, #4d633c);
    text-decoration: underline;
    text-underline-offset: 0.25em;
}
.cta-button--primary.cta-button--link:hover {
    transform: none;
    color: var(--cta-btn-hover-bg, #3d522f);
}

/* Secondary Button Styles */
.cta-button--secondary {
    font-size: 0.95rem;
}
.cta-button--secondary.cta-button--outline {
    background-color: transparent;
    color: var(--cta-text-color, #374151);
    border: 2px solid currentColor;
    opacity: 0.85;
}
.cta-button--secondary.cta-button--outline:hover {
    opacity: 1;
    background-color: color-mix(in srgb, currentColor 10%, transparent);
}
.cta-button--secondary.cta-button--solid {
    background-color: color-mix(in srgb, var(--cta-text-color, #374151) 15%, transparent);
    color: var(--cta-text-color, #374151);
    border: 2px solid transparent;
}
.cta-button--secondary.cta-button--solid:hover {
    background-color: color-mix(in srgb, var(--cta-text-color, #374151) 25%, transparent);
}
.cta-button--secondary.cta-button--subtle {
    background-color: transparent;
    color: var(--cta-text-color, #374151);
    border: 2px solid transparent;
}
.cta-button--secondary.cta-button--subtle:hover {
    background-color: color-mix(in srgb, currentColor 8%, transparent);
}

/* Image styles */
.cta-band__media {
    overflow: hidden;
}
.cta-band__image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.35rem;
}

/* Image placement: Above */
.cta-band--img-above .cta-band__media {
    margin-bottom: 1.75rem;
    display: flex;
}
.cta-band--align-center.cta-band--img-above .cta-band__media {
    justify-content: center;
}
.cta-band--align-left.cta-band--img-above .cta-band__media {
    justify-content: flex-start;
}
.cta-band--align-right.cta-band--img-above .cta-band__media {
    justify-content: flex-end;
}
.cta-band--img-above .cta-band__image {
    max-height: 280px;
    object-fit: cover;
}

/* Image placement: Below */
.cta-band--img-below .cta-band__media {
    margin-top: 2rem;
    display: flex;
}
.cta-band--align-center.cta-band--img-below .cta-band__media {
    justify-content: center;
}
.cta-band--img-below .cta-band__image {
    max-height: 280px;
    object-fit: cover;
}

/* Image placement: Two-column (Left / Right) */
.cta-band--img-left .cta-band__layout,
.cta-band--img-right .cta-band__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.cta-band--img-right .cta-band__layout {
    grid-template-columns: 1fr 1fr;
}
.cta-band--img-left .cta-band__media {
    grid-column: 1;
}
.cta-band--img-left .cta-band__content {
    grid-column: 2;
}
.cta-band--img-right .cta-band__content {
    grid-column: 1;
}
.cta-band--img-right .cta-band__media {
    grid-column: 2;
}

/* Image placement: Background */
.cta-band--img-background {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    isolation: isolate;
}
.cta-band--img-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: -1;
}

/* Inline / Side-by-Side button layout (Text on left, buttons on right) */
@media screen and (min-width: 768px) {
    .cta-band--btn-inline .cta-band__inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 3rem;
    }
    .cta-band--btn-inline .cta-band__content {
        flex: 1 1 auto;
        text-align: left;
    }
    .cta-band--btn-inline .cta-band__actions {
        flex: 0 0 auto;
        margin-top: 0;
        justify-content: flex-end;
    }
}

/* Responsive adjustments */
@media screen and (max-width: 767px) {
    .cta-band--img-left .cta-band__layout,
    .cta-band--img-right .cta-band__layout {
        grid-template-columns: 1fr;
    }
    .cta-band--img-left .cta-band__media,
    .cta-band--img-right .cta-band__media {
        grid-column: 1;
        margin-bottom: 1.5rem;
    }
    .cta-band--img-left .cta-band__content,
    .cta-band--img-right .cta-band__content {
        grid-column: 1;
    }
    .cta-band__actions {
        width: 100%;
    }
    .cta-band--btn-center .cta-band__actions,
    .cta-band--btn-left .cta-band__actions,
    .cta-band--btn-right .cta-band__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .cta-band__actions .cta-button {
        width: 100%;
        text-align: center;
    }
}
