/* Substack Feed Widget */

.sfw-feed {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Card */
.sfw-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    padding: 20px;
}

/* Header: avatar + meta */
.sfw-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.sfw-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sfw-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sfw-author-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sfw-author {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
}

.sfw-date-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #757575;
    flex-wrap: wrap;
}

.sfw-sep {
    color: #bbb;
}

.sfw-tag {
    background: #f0f0f0;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #555;
}

/* Excerpt */
.sfw-excerpt {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.55;
    color: #1a1a1a;
}

.sfw-excerpt p {
    margin: 0;
}

/* Featured image with title overlay */
.sfw-image-link {
    display: block;
    text-decoration: none;
    margin-bottom: 16px;
}

.sfw-image-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.sfw-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.sfw-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 16px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    display: flex;
    align-items: flex-end;
}

.sfw-image-title {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Title-only fallback (no image) */
.sfw-title-only {
    margin-bottom: 16px;
}

.sfw-title-only a {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
}

.sfw-title-only a:hover {
    text-decoration: underline;
}

/* Footer / Read on Substack button */
.sfw-card-footer {
    display: flex;
    justify-content: center;
}

.sfw-read-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    color: #ff6719;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sfw-read-btn:hover {
    background: #fff5f0;
    border-color: #ff6719;
    color: #ff6719;
}

.sfw-substack-icon {
    flex-shrink: 0;
    color: #ff6719;
}

/* Pinned post */
.sfw-pinned {
    border-left: 3px solid #ff6719;
}

.sfw-pin-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ff6719;
    margin-bottom: 10px;
}

/* Infinite scroll */
.sfw-sentinel {
    height: 1px;
}

.sfw-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #757575;
    font-size: 14px;
}

.sfw-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #ff6719;
    border-radius: 50%;
    animation: sfw-spin 0.6s linear infinite;
}

@keyframes sfw-spin {
    to { transform: rotate(360deg); }
}

.sfw-end-message {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px;
    margin: 0;
}

/* Error message */
.sfw-error {
    color: #c00;
    font-style: italic;
}

/* Dark mode (auto-detects OS/browser preference) */
@media (prefers-color-scheme: dark) {
    .sfw-card {
        background: #1a1a1a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    .sfw-author {
        color: #e5e5e5;
    }

    .sfw-date-line {
        color: #999;
    }

    .sfw-sep {
        color: #555;
    }

    .sfw-tag {
        background: #333;
        color: #bbb;
    }

    .sfw-excerpt {
        color: #d4d4d4;
    }

    .sfw-title-only a {
        color: #e5e5e5;
    }

    .sfw-read-btn {
        border-color: #333;
    }

    .sfw-read-btn:hover {
        background: #2a1a10;
        border-color: #ff6719;
    }

    .sfw-spinner {
        border-color: #444;
        border-top-color: #ff6719;
    }

    .sfw-loading,
    .sfw-end-message {
        color: #777;
    }

    .sfw-error {
        color: #f87171;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .sfw-card {
        padding: 16px;
    }

    .sfw-avatar {
        width: 38px;
        height: 38px;
    }

    .sfw-image-title {
        font-size: 15px;
    }
}
