/**
 * Ad spots A to D. One upload fits every spot: on a card the image sits
 * on top; in a row it sits on the left. On a phone every spot is a card.
 */

.td-ad {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    color: var(--wp--preset--color--contrast, #1f2933);
    background: var(--wp--preset--color--base, #fff);
    border: 1px solid var(--wp--preset--color--border, #d5dbe1);
    border-radius: var(--wp--custom--radius--medium, 12px);
}

.td-ad__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.td-ad__link:hover .td-ad__headline,
.td-ad__link:focus-visible .td-ad__headline {
    text-decoration: underline;
}

.td-ad__media {
    display: block;
    aspect-ratio: 1200 / 628;
    background: var(--wp--preset--color--surface, #f4f6f8);
}

.td-ad__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-ad__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--wp--preset--color--muted, #5b6670);
}

.td-ad__body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.85rem 1rem 1rem;
}

.td-ad__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wp--preset--color--muted, #5b6670);
}

.td-ad__headline {
    font-size: 1.05rem;
    line-height: 1.3;
}

.td-ad__line {
    font-size: 0.925rem;
    color: var(--wp--preset--color--muted, #5b6670);
}

.td-ad__button {
    align-self: flex-start;
    margin-top: 0.35rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wp--preset--color--base, #fff);
    text-decoration: none;
    background: var(--wp--preset--color--primary, #2d6a4f);
    border-radius: var(--wp--custom--radius--small, 6px);
}

/* rows (B, D): image on the left */

.td-ad--row .td-ad__link {
    flex-direction: row;
    align-items: center;
}

.td-ad--row .td-ad__media {
    flex: 0 0 min(400px, 38%);
}

.td-ad--row .td-ad__body {
    padding: 1rem 1.5rem;
}

.td-ad--row .td-ad__headline {
    font-size: 1.3rem;
}

/* AdSense and "Your ad here" */

.td-ad--adsense {
    padding: 0.5rem;
    border-style: dashed;
}

.td-ad--yours {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
    padding: 1.25rem;
    text-align: left;
    background: var(--wp--preset--color--surface, #f4f6f8);
    border: 2px dashed var(--wp--preset--color--border, #d5dbe1);
}

.td-ad--row.td-ad--yours {
    min-height: 140px;
    padding: 1.25rem 1.5rem;
}

.td-ad--yours .td-ad__button:hover,
.td-ad--yours .td-ad__button:focus-visible {
    color: var(--wp--preset--color--base, #fff);
    background: var(--wp--preset--color--contrast, #001f54);
}

/* a row inside a business grid spans every column */

.td-ad-row {
    grid-column: 1 / -1;
    margin: var(--wp--preset--spacing--20, 0.5rem) 0;
}

@media (max-width: 600px) {
    .td-ad--row .td-ad__link {
        flex-direction: column;
        align-items: stretch;
    }

    .td-ad--row .td-ad__media {
        flex-basis: auto;
    }

    .td-ad--row .td-ad__body {
        padding: 0.85rem 1rem 1rem;
    }

    .td-ad--row .td-ad__headline {
        font-size: 1.05rem;
    }
}
