/*
 * [social_widgets] additions: carousels, post cards, YouTube list and the
 * failed-embed fallback. The base card layout (.social-widgets-row,
 * .social-widget-card, follow cards) stays in style.css.
 */

/* Every card in a row is as tall as the tallest. */
.social-widgets-row .social-widget-col {
    display: flex;
}
.social-widgets-row .social-widget-card {
    flex: 1;
    height: auto;
}
.social-widgets-row .fb-widget .social-card-body {
    flex-direction: column;
    align-items: stretch;
}
.social-card-body > .social-embed {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.social-card-body > .social-embed[hidden] {
    display: none !important;
}

/* Carousel and list stack vertically inside the card */
.social-card-body--stack {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}
/* A follow card on its own is centred in the card, like Facebook's. */
.social-card-body--stack > .twitter-profile-card,
.social-card-body--stack > .instagram-profile-card,
.social-card-body--stack > .youtube-profile-card {
    flex: 1;
}

.social-frame {
    width: 100%;
    min-height: 200px;
    display: flex;
    justify-content: center;
}

/* Facebook: the follow card sits behind the timeline frame and shows (and can
   be clicked) until Facebook reports a rendered timeline. */
.social-frame--fb {
    position: relative;
    min-height: 500px;
    flex: 1;
}
/* social-widgets.js sets the frame's width inline to what Facebook draws. */
.social-frame--fb iframe {
    position: relative;
    z-index: 1;
}
/* Until Facebook reports a rendered timeline the frame stays invisible (still
   loading) and the card behind it shows. */
.social-frame--pending iframe {
    visibility: hidden;
}
.social-frame-behind {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
}
.social-frame-behind[hidden] {
    display: none;
}

/* An embed that did not load swaps back to its follow/caption card */
.social-embed-failed > .social-embed {
    display: none !important;
}
.social-embed-failed > .social-consent-fallback {
    display: block !important;
}

/* ── Carousel ─────────────────────────────────────────────────────────────── */

.social-carousel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.social-slides {
    flex: 1;
    overflow-y: auto;
    max-height: 520px;
}
.social-slide[hidden] {
    display: none !important;
}
.social-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 12px 4px;
    border-top: 1px solid #eee;
}
.social-carousel-btn {
    /* !important: the theme's global button padding/min-width would widen it. */
    width: 32px !important;
    min-width: 0 !important;
    height: 32px;
    padding: 0 !important;
    flex: 0 0 32px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #fff;
    color: #222;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.social-carousel-btn:hover,
.social-carousel-btn:focus-visible {
    background: #f2f2f2;
    border-color: #888;
}
.social-carousel-status {
    font-size: 14px;
    color: #555;
    min-width: 48px;
    text-align: center;
}

/* ── Post cards (X text card, Instagram caption card) ─────────────────────── */

.social-post-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 18px 12px;
}
.social-post-card[hidden] {
    display: none !important;
}
.social-post-author {
    display: flex;
    align-items: center;
    gap: 10px;
}
.social-post-author svg {
    flex-shrink: 0;
}
.social-post-author-name {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.social-post-author-name strong {
    font-size: 15px;
    color: #111;
}
.social-post-author-name span {
    font-size: 13px;
    color: #666;
}
.social-post-text {
    font-size: 15px;
    line-height: 1.55;
    color: #222;
    overflow-wrap: anywhere;
}
.social-post-text p {
    margin: 0;
}
.social-post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}
.social-post-link {
    font-weight: 600;
    text-decoration: none;
}
.social-post-link:hover,
.social-post-link:focus-visible {
    text-decoration: underline;
}

.social-x-embed:empty {
    display: none;
}
.social-x-embed .twitter-tweet {
    margin: 0 auto !important;
}

/* ── YouTube ──────────────────────────────────────────────────────────────── */

.social-yt-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 520px;
    overflow-y: auto;
}
.social-yt-list li + li {
    border-top: 1px solid #f0f0f0;
}
.social-yt-list a {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #222;
    align-items: flex-start;
}
.social-yt-list a:hover .social-yt-title,
.social-yt-list a:focus-visible .social-yt-title {
    text-decoration: underline;
}
.social-yt-thumb {
    flex: 0 0 120px;
    width: 120px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    background: #eee;
}
.social-yt-thumb[hidden] {
    display: none !important;
}
.social-yt-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.social-yt-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.social-yt-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.social-yt-meta time {
    font-size: 12px;
    color: #666;
}

.youtube-widget .social-card-header {
    background: #fdecec;
    color: #c00;
    border-bottom-color: #f6c6c6;
}

/* YouTube follow card — mirrors the other follow cards in style.css */
.youtube-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    width: 100%;
}
.yt-profile-handle {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #000;
}
.yt-profile-desc {
    margin: 0;
    font-size: 14px;
    color: #555;
    max-width: 240px;
    line-height: 1.5;
}
.yt-follow-btn {
    display: inline-block;
    padding: 10px 24px;
    background: #c00;
    color: #fff !important;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s;
}
.yt-follow-btn:hover {
    background: #a00;
}

/* ── Elementor editor only: links that were skipped ───────────────────────── */

.social-widgets-editor-notice {
    margin: 0 0 12px;
    padding: 12px 16px;
    border: 1px solid #f0c36d;
    border-left-width: 4px;
    border-radius: 6px;
    background: #fff8e5;
    color: #5c4400;
    font-size: 14px;
}
.social-widgets-editor-notice ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* ── Card title bar as a link to the account ─────────────────────────────── */

/* Page content styles underline links; these are styled as labels. */
.social-widgets-row .social-yt-list a,
.social-widgets-row .social-post-link,
.social-widgets-row a.social-card-header {
    text-decoration: none !important;
}
.social-widgets-row .social-post-link:hover,
.social-widgets-row .social-post-link:focus-visible,
.social-widgets-row a.social-card-header:hover span,
.social-widgets-row a.social-card-header:focus-visible span {
    text-decoration: underline;
}
.social-card-header-external {
    flex-shrink: 0;
    opacity: 0.75;
}
a.social-card-header:hover .social-card-header-external,
a.social-card-header:focus-visible .social-card-header-external {
    opacity: 1;
}

/* Card title bar as a link to the account: keep each network's colour over
   the theme's link colour. */
.social-widgets-row .fb-widget a.social-card-header { color: #1877F2; }
.social-widgets-row .twitter-widget a.social-card-header { color: #000; }
.social-widgets-row .instagram-widget a.social-card-header { color: #C13584; }
.social-widgets-row .youtube-widget a.social-card-header { color: #c00; }
.social-widgets-row a.social-card-header:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -4px;
}
