/* ============================================================
   TOOLBITES — BLOG CSS
   Covers: single.php, archive.php, page.php, sidebar.php
============================================================ */

/* ============================================================
   SHARED LAYOUT
============================================================ */
.single-post-layout,
.page-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}
.archive-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}
@media (max-width: 960px) {
    .single-post-layout,
    .archive-layout,
    .page-layout {
        grid-template-columns: 1fr;
    }
    .blog-sidebar { order: 2; }
}

/* ============================================================
   BREADCRUMB
============================================================ */
.post-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.post-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}
.post-breadcrumb a:hover { color: var(--brand); }
.post-breadcrumb span:last-child {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.post-breadcrumb__sep { color: var(--border-dark); }

/* ============================================================
   POST HEADER (single.php)
============================================================ */
.post-header { margin-bottom: 28px; }
.post-header__title {
    font-size: clamp(24px, 3.5vw, 38px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Meta Row */
.post-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.post-meta-author {
    display: flex;
    align-items: center;
    gap: 10px;
}
.post-meta-author__avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover;
}
.post-meta-author__name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.post-meta-author__role {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}
.post-meta-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.post-meta-details__item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.post-meta-details__dot { color: var(--border-dark); }

/* Featured Image */
.post-thumbnail {
    margin-bottom: 32px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
.post-thumbnail__img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   POST CONTENT TYPOGRAPHY
============================================================ */
.post-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 32px;
}
.post-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--brand-light);
}
.post-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 10px;
}
.post-content h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 22px 0 8px;
}
.post-content p { margin-bottom: 18px; }
.post-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: var(--brand-dark); }
.post-content strong { color: var(--text-primary); font-weight: 600; }
.post-content em { font-style: italic; }
.post-content ul,
.post-content ol {
    margin: 14px 0 18px 22px;
    list-style: disc;
}
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
    margin: 24px 0;
    padding: 18px 24px;
    background: var(--brand-xlight);
    border-left: 4px solid var(--brand);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--text-primary);
}
.post-content blockquote p { color: var(--text-primary); margin: 0; }
.post-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--brand-dark);
}
.post-content pre {
    background: var(--text-primary);
    color: #e8e8e8;
    padding: 20px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.6;
}
.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.post-content img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 20px 0;
    border: 1px solid var(--border);
}
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}
.post-content th {
    background: var(--bg-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.post-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.post-content tr:nth-child(even) td { background: var(--bg-secondary); }

/* ============================================================
   POST TAGS
============================================================ */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
}
.post-tags__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.post-tag {
    display: inline-flex;
    padding: 4px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}
.post-tag:hover {
    background: var(--brand-light);
    border-color: var(--brand);
    color: var(--brand-dark);
}

/* ============================================================
   SHARE BAR
============================================================ */
.post-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}
.post-share__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 4px;
}
.post-share__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.post-share__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: all var(--transition);
}
.post-share__btn--twitter  { background: #e8f4fd; color: #1da1f2; border-color: #c5e3f7; }
.post-share__btn--facebook { background: #e8edf5; color: #1877f2; border-color: #c5ceea; }
.post-share__btn--linkedin { background: #e8f0f8; color: #0a66c2; border-color: #c0d4e8; }
.post-share__btn--copy     { background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border); }
.post-share__btn:hover { transform: translateY(-1px); opacity: 0.85; }

/* ============================================================
   AUTHOR BOX
============================================================ */
.post-author-box {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: var(--brand-xlight);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
}
.post-author-box__avatar {
    width: 72px !important;
    height: 72px !important;
    border-radius: 50% !important;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--brand-light);
}
.post-author-box__info { flex: 1; }
.post-author-box__label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 4px;
}
.post-author-box__name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.post-author-box__bio {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   POST NAVIGATION
============================================================ */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 40px;
}
.post-nav__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition);
}
.post-nav__item:hover {
    border-color: var(--brand);
    background: var(--brand-xlight);
    transform: translateY(-1px);
}
.post-nav__item--next { text-align: right; }
.post-nav__dir {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.post-nav__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } }

/* ============================================================
   RELATED POSTS
============================================================ */
.related-posts { margin-top: 40px; }
.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.related-posts__card {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.related-posts__img {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}
.related-posts__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.related-posts__card:hover .related-posts__img img { transform: scale(1.04); }
.related-posts__body { padding: 14px 16px; }
.related-posts__date { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.related-posts__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-posts__excerpt { font-size: 13px; color: var(--text-muted); }
@media (max-width: 700px) { .related-posts__grid { grid-template-columns: 1fr; } }

/* ============================================================
   ARCHIVE PAGE
============================================================ */
.archive-hero {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    padding: 52px 0 40px;
    margin-bottom: 40px;
}
.archive-hero__title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}
.archive-hero__desc {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    max-width: 540px;
    margin-bottom: 16px;
}
.archive-hero__author {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}
.archive-hero__author-avatar {
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    border: 3px solid rgba(255,255,255,0.4) !important;
    object-fit: cover;
}
.archive-hero__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 99px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}
.archive-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.archive-bar__showing { font-size: 14px; color: var(--text-muted); }
.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.archive-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    overflow: hidden;
    padding: 0;
}
.archive-card--featured {
    grid-column: 1 / -1;
    flex-direction: row;
}
.archive-card--featured .archive-card__img { flex: 0 0 48%; }
.archive-card--featured .archive-card__body { flex: 1; padding: 24px; }
.archive-card--featured .archive-card__title { font-size: 22px; }
.archive-card--ad {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-dark);
}
.archive-card__img {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}
.archive-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.archive-card:hover .archive-card__img img { transform: scale(1.04); }
.archive-card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.archive-card__cat {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 8px;
    display: block;
}
.archive-card__title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 8px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.archive-card__excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.archive-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.archive-card__avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
}
.archive-card__author { font-weight: 500; color: var(--text-secondary); }
.archive-card__dot { color: var(--border-dark); }
.archive-pagination { margin-top: 40px; }
.archive-pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.archive-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all var(--transition);
}
.archive-pagination .page-numbers.current,
.archive-pagination .page-numbers:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.archive-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.archive-empty svg { margin: 0 auto 16px; }
.archive-empty h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-primary); }
.archive-empty p { margin-bottom: 20px; }
@media (max-width: 700px) {
    .archive-grid { grid-template-columns: 1fr; }
    .archive-card--featured { flex-direction: column; }
    .archive-card--featured .archive-card__img { flex: none; }
}

/* ============================================================
   PAGE TEMPLATE (page.php)
============================================================ */
.page-header { margin-bottom: 28px; }
.page-header__title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.page-header__excerpt {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 14px;
}
.page-header__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.page-header__meta span { display: flex; align-items: center; gap: 4px; }
.page-content { font-size: 16px; line-height: 1.8; }
.page-children { margin-top: 40px; }
.page-children__heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.page-children__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.page-children__card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.page-children__card p { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ============================================================
   SIDEBAR
============================================================ */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 90px;
}
.sidebar-widget {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.sidebar-widget__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--brand-light);
}
.sidebar-widget--tools-cta {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    border-color: var(--brand-dark);
}
.sidebar-tools-cta { text-align: center; }
.sidebar-tools-cta__icon { font-size: 32px; margin-bottom: 8px; }
.sidebar-tools-cta h3 { color: #fff; font-size: 18px; margin-bottom: 6px; }
.sidebar-tools-cta p { color: rgba(255,255,255,0.8); font-size: 13px; margin-bottom: 16px; }

/* Search Widget */
.sidebar-search__inner {
    display: flex;
    gap: 6px;
}
.sidebar-search__inner input {
    flex: 1;
    padding: 9px 12px;
    font-size: 14px;
}
.sidebar-search__btn {
    padding: 0 12px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
}
.sidebar-search__btn:hover { background: var(--brand-dark); }

/* Post List */
.sidebar-post-list { display: flex; flex-direction: column; gap: 12px; list-style: none; }
.sidebar-post-list__item { display: flex; gap: 10px; align-items: flex-start; }
.sidebar-post-list__num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    background: var(--brand-light);
    color: var(--brand);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-post-list__content { flex: 1; }
.sidebar-post-list__title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 3px;
}
.sidebar-post-list__title:hover { color: var(--brand); }
.sidebar-post-list__date { font-size: 12px; color: var(--text-muted); }

/* Recent Posts */
.sidebar-recent-posts { display: flex; flex-direction: column; gap: 14px; }
.sidebar-recent-posts__item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-decoration: none;
}
.sidebar-recent-posts__img {
    width: 64px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-recent-posts__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sidebar-recent-posts__content { flex: 1; }
.sidebar-recent-posts__date { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.sidebar-recent-posts__content h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    transition: color var(--transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sidebar-recent-posts__item:hover h4 { color: var(--brand); }

/* Categories */
.sidebar-cat-list { display: flex; flex-direction: column; gap: 4px; list-style: none; }
.sidebar-cat-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}
.sidebar-cat-list__item:last-child { border: none; }
.sidebar-cat-list__item a {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}
.sidebar-cat-list__item a:hover { color: var(--brand); }
.sidebar-cat-list__count {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-light);
    padding: 2px 8px;
    border-radius: 99px;
}

/* Tags */
.sidebar-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Newsletter */
.sidebar-widget--newsletter { background: var(--bg-secondary); }
.sidebar-newsletter input {
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}
