/**
 * PsyGuild Embed & Link Preview Styles
 * Responsive, glass-card style for embed containers and link preview cards.
 */

/* ==================================================================
   1. OEMBED CONTAINER
   ================================================================== */

.psyguild-embed {
    margin: 32px 0;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

/* Responsive 16:9 video wrapper */
.psyguild-embed__video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: inherit;
    overflow: hidden;
}

.psyguild-embed__video iframe,
.psyguild-embed__video video,
.wp-block-embed iframe {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
}

/* Also apply responsive fix to core embed blocks */
.wp-block-embed,
.wp-block-embed__wrapper {
    max-width: 100%;
}

.wp-block-embed .wp-block-embed__wrapper {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
}

.wp-block-embed .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* App embed bar */
.psyguild-embed--app {
    overflow: hidden;
}

.psyguild-embed__app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.04);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
}

.psyguild-embed__app-fullscreen {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #06b6d4;
    font-size: 0.82rem;
    font-weight: 800;
}

.psyguild-embed__app-frame {
    display: block;
    width: 100%;
    min-height: 480px;
    border: none;
    background: #fff;
}

/* ==================================================================
   2. LINK CARD — SHARED
   ================================================================== */

.psyguild-link-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: stretch;
    border-radius: 20px;
    overflow: hidden;
    margin: 28px 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px -4px rgba(15, 23, 42, 0.06);
    text-decoration: none;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.psyguild-link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px -8px rgba(15, 23, 42, 0.12);
}

/* Thumbnail */
.pg-lc-thumb {
    display: block;
    width: 220px;
    min-height: 100%;
    flex-shrink: 0;
    overflow: hidden;
    background: #f1f5f9;
}

.pg-lc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pg-lc-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
    color: #8b5cf6;
}

/* Body */
.pg-lc-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

/* Badge / Category */
.pg-lc-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.08);
    color: #06b6d4;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    align-self: flex-start;
}

/* Title */
.pg-lc-title {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.35;
    color: #0f172a;
    margin: 0;
}

.pg-lc-title a {
    color: inherit;
    text-decoration: none;
}

.pg-lc-title a:hover {
    color: #06b6d4;
}

/* Excerpt */
.pg-lc-excerpt {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Meta */
.pg-lc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 600;
}

.pg-lc-meta-sep {
    margin: 0 6px;
    color: #cbd5e1;
}

/* Domain */
.pg-lc-domain {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pg-lc-favicon {
    border-radius: 3px;
    flex-shrink: 0;
}

/* CTA Button */
.pg-lc-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 4px;
    font-size: 0.85rem;
    font-weight: 800;
    color: #8b5cf6;
    text-decoration: none;
    transition: gap 0.2s ease;
}

.pg-lc-cta:hover {
    gap: 10px;
    color: #06b6d4;
}

.pg-lc-cta-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pg-lc-cta:hover .pg-lc-cta-arrow {
    transform: translate(3px, -3px);
}

/* ==================================================================
   3. INTERNAL CARD SPECIFICS
   ================================================================== */

.psyguild-link-card--internal .pg-lc-thumb {
    width: 240px;
}

/* ==================================================================
   4. EXTERNAL CARD SPECIFICS
   ================================================================== */

.psyguild-link-card--external .pg-lc-thumb {
    width: 200px;
}

/* ==================================================================
   5. SIMPLE LINK FALLBACK
   ================================================================== */

.psyguild-link-card--simple {
    grid-template-columns: 56px 1fr;
    align-items: center;
}

.pg-lc-link-icon {
    color: #94a3b8;
    margin: 0 auto;
    flex-shrink: 0;
}

.pg-lc-url {
    font-size: 0.82rem;
    color: #06b6d4;
    text-decoration: none;
    word-break: break-all;
}

/* ==================================================================
   6. RESPONSIVE
   ================================================================== */

@media (max-width: 768px) {
    .psyguild-link-card {
        grid-template-columns: 1fr;
    }

    .pg-lc-thumb {
        width: 100% !important;
        height: 200px;
        min-height: unset;
    }

    .psyguild-link-card--simple {
        grid-template-columns: 40px 1fr;
    }

    .pg-lc-body {
        padding: 18px 20px;
    }

    .psyguild-embed__app-frame {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .pg-lc-thumb {
        height: 160px;
    }

    .psyguild-link-card {
        margin: 20px 0;
    }
}
