/* ==========================================================================
   The Dissertation Solution — Blog
   Brand tokens: --blue #3e50f7, --hover_blu #7a86fa, --navy_blue #001a66,
   --yellow #ffb800, --gray_dk #7a7a7a, --nib_font "Nib Pro", --lato_font "Lato"
   ========================================================================== */

.blog-page,
.skip-link {
    --blog-max: 1200px;
    --blog-blue: #3e50f7;
    --blog-blue-hover: #7a86fa;
    --blog-navy: #001a66;
    --blog-yellow: #ffb800;
    --blog-light: #f5f7ff;
    --blog-border: #e1e5f2;
    --blog-text: #2c2c2a;
    --blog-muted: #595959;
    --blog-radius: 10px;
    --blog-shadow: 0 10px 30px rgba(0, 26, 102, 0.08);
    --blog-transition: 0.3s ease;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .blog-page *,
    .blog-page *::before,
    .blog-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== Page header / banner ========== */
.blog-header {
    background: linear-gradient(135deg, var(--blog-navy) 0%, #0b1a4d 60%, var(--blog-blue) 100%);
    color: #fff;
    padding: 56px 0 48px;
    position: relative;
    overflow: hidden;
}
.blog-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../img/blog/general.svg") center / 220px no-repeat;
    opacity: 0.07;
    pointer-events: none;
    z-index: 0;
}
.blog-header .container {
    position: relative;
    z-index: 1;
}
.blog-header .eyebrow {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--blog-yellow);
    margin: 0 0 10px;
    display: inline-block;
}
.blog-header h1 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.2;
    margin: 0 0 14px;
    color: #fff;
}
.blog-header p.lead {
    font-family: var(--lato_font);
    font-size: clamp(16px, 1.4vw, 20px);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.92);
    margin: 0;
    max-width: 700px;
}

/* ========== Listing page ========== */
.blog-container {
    max-width: var(--blog-max);
    margin: 0 auto;
    padding: 40px 18px;
}
.blog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
}
.blog-results {
    font-family: var(--lato_font);
    font-size: 15px;
    color: var(--blog-muted);
}
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-btn {
    font-family: var(--lato_font);
    font-size: 14px;
    padding: 7px 16px;
    border: 1px solid var(--blog-border);
    background: #fff;
    color: var(--blog-text);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--blog-transition);
}
.filter-btn:hover, .filter-btn.active {
    border-color: var(--blog-blue);
    color: var(--blog-blue);
    background: var(--blog-light);
}

/* Post grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 26px;
}
.blog-card {
    background: #fff;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--blog-transition);
    opacity: 0;
    transform: translateY(20px);
    animation: blogCardUp 0.6s ease forwards;
}
.blog-card:nth-child(1) { animation-delay: 0.04s; }
.blog-card:nth-child(2) { animation-delay: 0.10s; }
.blog-card:nth-child(3) { animation-delay: 0.16s; }
.blog-card:nth-child(4) { animation-delay: 0.22s; }
.blog-card:nth-child(5) { animation-delay: 0.28s; }
.blog-card:nth-child(6) { animation-delay: 0.34s; }
.blog-card:nth-child(7) { animation-delay: 0.40s; }
.blog-card:nth-child(8) { animation-delay: 0.46s; }
.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--blog-shadow);
    border-color: var(--blog-blue);
}
@keyframes blogCardUp {
    to { opacity: 1; transform: translateY(0); }
}
.blog-card__image {
    position: relative;
    width: 100%;
    height: 210px;
    overflow: hidden;
    background: var(--blog-light);
}
.blog-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--blog-transition);
}
.blog-card:hover .blog-card__image img {
    transform: scale(1.04);
}
.blog-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 12px;
    background: var(--blog-blue);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.blog-card__body {
    padding: 20px 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card__meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    font-family: var(--lato_font);
    font-size: 13px;
    color: var(--blog-muted);
}
.blog-card__meta time {
    font-weight: 600;
    color: var(--blog-text);
}
.blog-card__title {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 19px;
    line-height: 1.35;
    color: var(--blog-navy);
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--blog-transition);
}
.blog-card__title a:hover {
    color: var(--blog-blue);
}
.blog-card__excerpt {
    font-family: var(--lato_font);
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--blog-text);
    margin: 0 0 16px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card__footer {
    margin-top: auto;
    border-top: 1px solid var(--blog-border);
    padding-top: 14px;
}
.read-more {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 15px;
    color: var(--blog-blue);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--blog-transition);
}
.read-more:hover {
    color: var(--blog-navy);
    gap: 12px;
}
.read-more::after {
    content: "\2192";
    font-size: 16px;
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--blog-muted);
    font-family: var(--lato_font);
    font-size: 17px;
}

/* ========== Post detail page ========== */
.post-article {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 18px 60px;
}
.post-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-family: var(--lato_font);
    font-size: 13px;
    color: var(--blog-muted);
}
.post-meta-bar span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.post-article h1 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: clamp(26px, 2.6vw, 40px);
    line-height: 1.3;
    color: var(--blog-navy);
    margin: 0 0 6px;
}
.post-hero {
    width: 100%;
    height: 320px;
    border-radius: var(--blog-radius);
    overflow: hidden;
    background: var(--blog-light);
    margin: 14px 0 20px;
    position: relative;
}
.post-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.post-excerpt {
    font-family: var(--lato_font);
    font-size: 17px;
    line-height: 1.7;
    color: var(--blog-text);
    margin: 0 0 22px;
    border-left: 4px solid var(--blog-yellow);
    padding: 0 0 0 16px;
    font-style: italic;
}
.post-body {
    font-family: var(--lato_font);
    font-size: 17px;
    line-height: 1.85;
    color: var(--blog-text);
}
.post-body p {
    margin: 0 0 1.5rem;
}
.post-body a {
    color: var(--blog-blue);
    text-decoration: underline;
    transition: color var(--blog-transition);
}
.post-body a:hover {
    color: var(--blog-navy);
}
.post-body h2 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.35;
    color: var(--blog-navy);
    margin: 2.6rem 0 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blog-light);
}
.post-body h3 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.4;
    color: var(--blog-blue);
    margin: 2rem 0 0.75rem;
}
.post-body ul, .post-body ol {
    margin: 0 0 1.5rem 1.2rem;
    padding-left: 1rem;
}
.post-body li {
    margin-bottom: 0.55rem;
}
.post-body strong {
    color: var(--blog-navy);
}
.post-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 6px;
    border: 1px solid var(--blog-border);
}

/* Related posts */
.related-posts {
    max-width: var(--blog-max);
    margin: 0 auto;
    padding: 48px 18px 60px;
    border-top: 1px solid var(--blog-border);
}
.related-posts h2 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 24px;
    color: var(--blog-navy);
    margin: 0 0 24px;
    text-align: center;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.related-card {
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    overflow: hidden;
    transition: var(--blog-transition);
    background: #fff;
}
.related-card:hover {
    border-color: var(--blog-blue);
    transform: translateY(-3px);
}
.related-card__image {
    width: 100%;
    height: 150px;
    overflow: hidden;
    background: var(--blog-light);
}
.related-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.related-card__body {
    padding: 14px 16px;
}
.related-card__title {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 16px;
    line-height: 1.35;
    color: var(--blog-navy);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--blog-transition);
}
.related-card__title a:hover {
    color: var(--blog-blue);
}
.related-card__meta {
    font-family: var(--lato_font);
    font-size: 12.5px;
    color: var(--blog-muted);
}

/* CTA box */
.blog-cta {
    max-width: var(--blog-max);
    margin: 0 auto 56px;
    padding: 34px 22px;
    background: var(--blog-navy);
    border-radius: var(--blog-radius);
    color: #fff;
    text-align: center;
}
.blog-cta h2 {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: clamp(22px, 2vw, 28px);
    color: #fff;
    margin: 0 0 10px;
}
.blog-cta p {
    font-family: var(--lato_font);
    font-size: 16px;
    margin: 0 0 20px;
    color: rgba(255, 255, 255, 0.9);
}
.btn-blog {
    font-family: var(--nib_font);
    font-weight: 700;
    font-size: 16px;
    background: var(--blog-yellow);
    color: var(--blog-navy);
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: var(--blog-transition);
}
.btn-blog:hover {
    background: #ffc933;
    transform: translateY(-2px);
}

/* Back link */
.back-link {
    max-width: var(--blog-max);
    margin: 0 auto 8px;
    padding: 0 18px;
}
.back-link a {
    font-family: var(--lato_font);
    font-size: 14px;
    color: var(--blog-blue);
    text-decoration: none;
    transition: color var(--blog-transition);
}
.back-link a:hover {
    color: var(--blog-navy);
}

/* ========== Mobile ========== */
@media (max-width: 640px) {
    .blog-header { padding: 40px 0 32px; }
    .blog-toolbar { flex-direction: column; align-items: stretch; }
    .category-filters { justify-content: center; }
    .blog-grid { grid-template-columns: 1fr; gap: 20px; }
    .post-hero { height: 240px; }
    .post-excerpt { font-size: 15.5px; }
    .blog-card__title { font-size: 18px; }
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    width: auto;
    height: auto;
    padding: 10px 16px;
    background: #fff;
    color: var(--blog-navy);
    border: 2px solid var(--blog-blue);
    border-radius: 4px;
    z-index: 10000;
    font-weight: 700;
    text-decoration: none;
    font-family: var(--lato_font);
    font-size: 15px;
}
#blog-content,
#post-content {
    scroll-margin-top: calc(var(--nav_h) + 16px); /* skip-link jumps land below the fixed header */
}
#blog-content:focus,
#post-content:focus {
    outline: none; /* skip-link target, focused by script only (tabindex="-1"), not a control */
}
