/* Embed Posts Grid
 *
 * Every selector is scoped to the plugin's own classes so nothing here can
 * restyle the host theme. Colors and spacing read prefixed custom properties
 * with built-in defaults; override them on .embed-posts-container, e.g.
 * .embed-posts-container { --rpe-card-background: #f7f7f7; }
 */

/* Grid Styles */
.embed-grid {
    padding: 2em;
    width: 100%;
    display: inline-grid;
    margin: 0;
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
    .embed-grid {
        width: 100%;
        padding: 1em;
        margin: 1em 0;
    }
}

/* Posts Grid Layout */
.embed-posts-wrapper {
    display: grid;
    /* Column configuration is set dynamically via inline CSS */
    grid-gap: var(--rpe-grid-gap, 1em);
}

/* Individual Post Styles */
.embed-posts {
    padding: 1em;
    background: var(--rpe-card-background, #fff);
    box-shadow: var(--rpe-card-shadow, 0 5px 10px rgba(0, 0, 0, 0.1), 0 20px 20px rgba(0, 0, 0, 0.05));
    border-radius: 0.5em;
    border: solid 1px var(--rpe-card-border-color, rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.embed-posts:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), 0 25px 25px rgba(0, 0, 0, 0.08);
}

/* Typography */
.embed-posts h3 {
    font-size: 1.4em;
    margin-bottom: 0.5em;
    color: #333;
    line-height: 1.3;
}

.embed-posts small {
    display: block;
    color: #666;
    margin-bottom: 0.5em;
    font-size: 0.9em;
}

/* Image Styles */
.embed-posts img {
    width: 100%;
    height: auto;
    border-radius: 0.3em;
    margin-bottom: 0.5em;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.embed-posts img:hover {
    opacity: 0.9;
}

/* Read More Link */
.embed-posts .read-more {
    display: inline-block;
    color: #0073a8;
    text-decoration: none;
    margin-top: 0.5em;
    font-weight: bold;
    transition: color 0.3s ease;
}

.embed-posts .read-more:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Grid layout (.embed-posts-layout-grid). Phones show --rpe-cols-mobile
   columns, tablets --rpe-cols-tablet and desktops --rpe-cols. */
.embed-posts-layout-grid .embed-posts-wrapper {
    grid-template-columns: repeat(var(--rpe-cols-mobile, 1), 1fr);
    grid-gap: var(--rpe-grid-gap, 28px);
}

@media (min-width: 544px) {
    .embed-posts-layout-grid .embed-posts-wrapper {
        grid-template-columns: repeat(var(--rpe-cols-tablet, 2), 1fr);
    }
}

@media (min-width: 921px) {
    .embed-posts-layout-grid .embed-posts-wrapper {
        grid-template-columns: repeat(var(--rpe-cols, 3), 1fr);
    }
}

.embed-posts-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--rpe-card-background, #fff);
    border-radius: 8px;
    box-shadow: var(--rpe-card-shadow, 0 2px 8px rgba(0, 0, 0, 0.08));
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.embed-posts-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    transform: translateY(-3px);
}

.embed-posts-card-image {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.embed-posts-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.embed-posts-card:hover .embed-posts-card-image img {
    transform: scale(1.04);
}

.embed-posts-card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 20px;
}

.embed-posts-card-date {
    margin-bottom: 6px;
    color: #888;
    font-size: 0.78em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.embed-posts-card-title {
    margin: 0 0 10px;
    font-size: 1.15em;
    line-height: 1.4;
}

.embed-posts-card-title a {
    color: inherit;
    text-decoration: none;
}

.embed-posts-card-title a:hover {
    color: var(--rpe-link-color, #0073aa);
}

.embed-posts-card-excerpt {
    flex-grow: 1;
    margin: 0 0 16px;
    color: #555;
    font-size: 0.9em;
    line-height: 1.65;
}

.embed-posts-card-excerpt p {
    margin: 0;
}

.embed-posts-card-readmore {
    margin-top: auto;
    color: var(--rpe-link-color, #0073aa);
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
}

.embed-posts-card-readmore:hover {
    text-decoration: underline;
}

/* Load More button */
.embed-posts-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.5em;
}

.embed-posts-load-more {
    display: inline-block;
    padding: 0.7em 1.8em;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    background: #0073a8;
    border: none;
    border-radius: 0.4em;
    cursor: pointer;
    transition: background 0.3s ease, opacity 0.3s ease;
}

.embed-posts-load-more:hover {
    background: #005a87;
}

.embed-posts-load-more:disabled,
.embed-posts-load-more.is-loading {
    opacity: 0.7;
    cursor: default;
}

/* Alternative Layout: Inline Image Style */
.embed-posts-inline {
    width: 100%;
    margin: 2em 0 0;
}

.embed-posts-inline img {
    width: 35%;
    float: left;
    margin-right: 2em;
}

@media only screen and (max-width: 768px) {
    .embed-posts-inline img {
        width: 100%;
        float: none;
        margin-right: 0;
    }
}

/* Demo feed notice (shown to administrators only) */
.embed-posts-demo-notice {
    margin: 0 0 1em;
    padding: 0.75em 1em;
    border-left: 4px solid #dba617;
    background: #fcf9e8;
    color: #1d2327;
    font-size: 0.95em;
    line-height: 1.5;
}

.embed-posts-demo-notice p {
    margin: 0 0 0.4em;
}

.embed-posts-demo-notice p:last-child {
    margin-bottom: 0;
}

.embed-posts-demo-notice a {
    color: #2271b1;
    text-decoration: underline;
}

.embed-posts-demo-notice .embed-posts-demo-notice-meta {
    font-size: 0.9em;
    opacity: 0.75;
}
