/* =====================================================
   FREE COLOR TOOLS — Blog Stylesheet
   ===================================================== */

/* ── Blog Layout ────────────────────────────────────── */
.blog-wrap {
    padding-bottom: var(--sp-2xl);
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--sp-2xl);
    align-items: start;
}

.blog-main {
    min-width: 0;
}

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-lg);
    position: sticky;
    top: 88px;
}

.sidebar-widget {
    padding: 20px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: var(--glass-border);
}

/* ── Blog Divider ────────────────────────────────────── */
.blog-divider {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: var(--sp-2xl) 0;
}

/* ── Breadcrumb ──────────────────────────────────────── */
.blog-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: .82rem;
    color: var(--clr-muted);
    margin-bottom: var(--sp-xl);
}

.blog-breadcrumb a {
    color: var(--clr-muted);
    text-decoration: none;
}

.blog-breadcrumb a:hover {
    color: var(--clr-violet);
}

.blog-breadcrumb span {
    color: var(--clr-subtle);
}

.blog-breadcrumb [aria-current] {
    color: var(--clr-text);
}

/* ── Category Pill ───────────────────────────────────── */
.blog-cat-pill {
    display: inline-block;
    background: rgba(124, 92, 252, .14);
    color: var(--clr-violet);
    border: 1px solid rgba(124, 92, 252, .3);
    border-radius: 50px;
    padding: 3px 12px;
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .05em;
    transition: background .2s;
}

.blog-cat-pill:hover {
    background: rgba(124, 92, 252, .25);
}

/* ── Blog Meta ───────────────────────────────────────── */
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: .78rem;
    color: var(--clr-muted);
    margin-top: 8px;
}

/* ── Blog Hero (Single Post) ─────────────────────────── */
.blog-hero {
    margin-bottom: var(--sp-2xl);
    text-align: center;
    padding-bottom: var(--sp-xl);
    border-bottom: 1px solid var(--clr-border);
}

.blog-hero__content {
    max-width: 780px;
    margin: 0 auto var(--sp-lg);
}

.blog-hero__cats {
    margin-bottom: var(--sp-md);
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.blog-hero__title {
    font-size: clamp(1.8rem, 4.5vw, 3rem);
    line-height: 1.2;
    margin-bottom: var(--sp-md);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--clr-text);
}

.blog-hero__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: .88rem;
    color: var(--clr-muted);
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 50px;
    padding: 8px 20px;
    width: fit-content;
    margin: 0 auto;
}

.blog-hero__author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--clr-text);
    font-weight: 500;
}

.author-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(124, 92, 252, .4);
    flex-shrink: 0;
}

.meta-dot {
    color: var(--clr-border);
    font-size: .7rem;
}

.blog-hero__image-wrap {
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    max-height: 550px;
    aspect-ratio: 21/9;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .2);
    border: var(--glass-border);
}

@media (max-width: 768px) {
    .blog-hero__image-wrap {
        border-radius: 16px;
        aspect-ratio: 16/9;
        max-height: 400px;
    }
}

.blog-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-hero__caption {
    position: absolute;
    bottom: 12px;
    right: 16px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: .8rem;
}


/* ── Featured Grid ───────────────────────────────────── */
.featured-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: var(--sp-md);
    margin-bottom: var(--sp-xl);
    height: 480px;
}

.featured-card {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s;
    min-height: 0;
    position: relative;
    background: var(--clr-bg2);
    border: var(--glass-border);
}

.featured-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
}

/* ── Main (left) card: full-bleed image with overlay ── */
.featured-card--main {
    grid-row: 1 / 3;
}

.featured-card--main .featured-card__img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.featured-card--main .featured-card__img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            transparent 25%,
            rgba(0, 0, 0, .35) 55%,
            rgba(0, 0, 0, .82) 100%);
}

.featured-card--main .featured-card__body {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: none;
}

.featured-card--main .featured-card__body h2 a,
.featured-card--main .featured-card__body h2 a:hover {
    color: #fff;
}

.featured-card--main .featured-card__excerpt {
    color: rgba(255, 255, 255, .78);
}

.featured-card--main .blog-meta {
    color: rgba(255, 255, 255, .6);
}

.featured-card--main .blog-cat-pill {
    width: fit-content;
    background: rgba(255, 255, 255, .18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, .45);
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* No image fallback for main card */
.featured-card--main:not(:has(.featured-card__img)) {
    background: linear-gradient(135deg, var(--clr-bg2) 0%, rgba(124, 92, 252, .18) 100%);
}

/* ── Small (right) cards: image left, content right ── */
.featured-card:not(.featured-card--main) {
    flex-direction: row;
}

.featured-card:not(.featured-card--main) .featured-card__img-link {
    display: block;
    flex-shrink: 0;
    width: 130px;
    align-self: stretch;
}

.featured-card:not(.featured-card--main) .featured-card__img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.featured-card:not(.featured-card--main) .featured-card__body {
    flex: 1;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
    min-height: 0;
}

.featured-card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.featured-card__body h2 {
    font-size: 1.05rem;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.featured-card--main .featured-card__body h2 {
    font-size: 1.45rem;
    -webkit-line-clamp: 3;
}

/* Category pills row inside featured cards */
.featured-card__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 2px;
}

.featured-card__body h2 a {
    color: var(--clr-text);
    text-decoration: none;
}

.featured-card__body h2 a:hover {
    color: var(--clr-violet);
}

.featured-card__excerpt {
    font-size: .84rem;
    color: var(--clr-muted);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Blog Card Grid ──────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-md);
}

.blog-card {
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s;
    padding: 0;
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}

.blog-card__img-wrap {
    display: block;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.blog-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.blog-card:hover .blog-card__img {
    transform: scale(1.04);
}

.blog-card__body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blog-card__title {
    font-size: 1rem;
    line-height: 1.45;
    margin: 0;
}

.blog-card__title a {
    color: var(--clr-text);
    text-decoration: none;
}

.blog-card__title a:hover {
    color: var(--clr-violet);
}

.blog-card__excerpt {
    font-size: .84rem;
    color: var(--clr-muted);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Pagination ──────────────────────────────────────── */
.blog-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--sp-xl);
    justify-content: center;
}

.blog-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--clr-text);
    text-decoration: none;
    font-size: .9rem;
    transition: background .2s, color .2s;
}

.blog-page-btn.active,
.blog-page-btn:hover:not(.disabled) {
    background: var(--clr-violet);
    color: #fff;
    border-color: var(--clr-violet);
}

.blog-page-btn.disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

.blog-page-prev,
.blog-page-next {
    font-size: 1.1rem;
    font-weight: 700;
    width: 38px;
}

.blog-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
    font-size: .9rem;
    color: var(--clr-muted);
    user-select: none;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar-title {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--clr-muted);
    margin-bottom: 14px;
}

.sidebar-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--clr-text);
    text-decoration: none;
    font-size: .88rem;
    transition: background .15s;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(124, 92, 252, .12);
    color: var(--clr-violet);
}

.sidebar-count {
    font-size: .75rem;
    background: rgba(255, 255, 255, .08);
    border-radius: 50px;
    padding: 1px 8px;
    color: var(--clr-muted);
}

.sidebar-posts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-posts li {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-posts li a {
    font-size: .86rem;
    color: var(--clr-text);
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-posts li a:hover {
    color: var(--clr-violet);
}

.sidebar-posts li span {
    font-size: .75rem;
    color: var(--clr-muted);
}

/* ── Single Post ─────────────────────────────────────── */
.post-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    line-height: 1.25;
    margin: 16px 0 12px;
    letter-spacing: -.02em;
}

.post-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: .82rem;
    color: var(--clr-muted);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--clr-border);
}

/* ── Reactions & Share ───────────────────────────────── */
.post-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: var(--sp-2xl) 0 var(--sp-lg);
    padding: var(--sp-lg) var(--sp-lg);
    border-top: 1px solid var(--clr-border);
    border-bottom: 1px solid var(--clr-border);
    background: var(--glass-bg);
    border-radius: 12px;
    border: var(--glass-border);
}

.reactions-label {
    font-size: .82rem;
    color: var(--clr-muted);
    margin-right: 4px;
    font-weight: 500;
}

.share-label {
    font-size: .82rem;
    color: var(--clr-muted);
    font-weight: 500;
}

.share-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--clr-text);
    font-size: .9rem;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.reaction-btn:hover {
    background: rgba(124, 92, 252, .12);
    border-color: rgba(124, 92, 252, .4);
}

.reaction-btn.active {
    background: rgba(124, 92, 252, .2);
    border-color: var(--clr-violet);
    color: var(--clr-violet);
}



.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--clr-border);
    background: var(--glass-bg);
    color: var(--clr-text);
    transition: background .2s;
}

.share-btn:hover {
    background: rgba(124, 92, 252, .15);
    border-color: rgba(124, 92, 252, .4);
}

/* ── Prose (Post Content) ────────────────────────────── */
.prose {
    line-height: 1.8;
    font-size: 1.02rem;
    color: var(--clr-text);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5 {
    margin: 1.8em 0 .6em;
    line-height: 1.3;
    letter-spacing: -.01em;
}

.prose h2 {
    font-size: 1.45rem;
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: .4em;
}

.prose h3 {
    font-size: 1.18rem;
    color: var(--clr-orange);
}

.prose p {
    margin-bottom: 1.2em;
}

.prose ul,
.prose ol {
    margin: 0 0 1.2em 1.4em;
}

.prose li {
    margin-bottom: .4em;
}

.prose a {
    color: var(--clr-violet);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose a:hover {
    color: var(--clr-pink);
}

.prose strong {
    color: var(--clr-text);
}

.prose code {
    background: rgba(124, 92, 252, .12);
    color: var(--clr-violet);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: .9em;
}

.prose pre {
    background: var(--clr-bg2);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 1.4em;
}

.prose pre code {
    background: none;
    padding: 0;
}

.prose blockquote {
    border-left: 3px solid var(--clr-violet);
    margin: 1.5em 0;
    padding: 12px 20px;
    background: rgba(124, 92, 252, .06);
    border-radius: 0 8px 8px 0;
    color: var(--clr-muted);
    font-style: italic;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.4em;
    font-size: .9rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.prose th {
    background: rgba(124, 92, 252, .12);
    color: var(--clr-text);
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--clr-border);
}

.prose td {
    padding: 9px 14px;
    border: 1px solid var(--clr-border);
}

.prose tr:nth-child(even) td {
    background: rgba(255, 255, 255, .03);
}

.prose img {
    max-width: 100%;
    border-radius: 10px;
    margin: 1em 0;
}

.prose mark {
    background: rgba(255, 209, 71, .25);
    color: var(--clr-text);
    padding: 0 3px;
    border-radius: 3px;
}

/* ── Tags ────────────────────────────────────────────── */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-link {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--clr-muted);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: .78rem;
    text-decoration: none;
    transition: color .2s, border-color .2s;
}

.tag-link:hover {
    color: var(--clr-violet);
    border-color: rgba(124, 92, 252, .4);
}

/* ── Related Posts ───────────────────────────────────── */
.related-posts {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--clr-border);
}

.related-title {
    font-size: 1.2rem;
    margin-bottom: var(--sp-md);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--sp-md);
}

.related-card {
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    transition: transform .2s;
}

.related-card:hover {
    transform: translateY(-2px);
}

.related-card__img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.related-card__title {
    font-size: .9rem;
    line-height: 1.4;
    margin: 0;
}

.related-card__title a {
    color: var(--clr-text);
    text-decoration: none;
}

.related-card__title a:hover {
    color: var(--clr-violet);
}

/* ── Admin table (shared) ────────────────────────────── */
.admin-table {
    border-collapse: collapse;
}

.admin-table th {
    padding: 12px 16px;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--clr-muted);
    border-bottom: 1px solid var(--clr-border);
    text-align: left;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--clr-border);
    font-size: .88rem;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, .02);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        order: 2;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .featured-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }

    .featured-card--main {
        grid-row: auto;
        min-height: 320px;
    }

    .featured-card--main .featured-card__img {
        position: absolute;
        inset: 0;
    }

    .featured-card:not(.featured-card--main) {
        flex-direction: column;
    }

    .featured-card:not(.featured-card--main) .featured-card__img-link {
        width: 100%;
    }

    .featured-card:not(.featured-card--main) .featured-card__img {
        height: 180px;
    }
}

@media (max-width: 640px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .share-buttons {
        margin-left: 0;
    }

    .post-reactions {
        gap: 8px;
    }
}