/* =====================================================================
   Blog — listing (/blog) and post (/blog/{slug}) pages.
   Builds on the .project-page-* hero / CTA styles in styles.css.
   ===================================================================== */

/* ---------- Hero ---------- */
.blog-hero { min-height: 70vh; }
.blog-hero--compact { min-height: 80vh; }
.blog-hero .project-back-link,
.blog-section-head .project-back-link,
.post-footer-row .project-back-link { transition: color .2s ease; }
.blog-hero .project-back-link:hover,
.blog-section-head .project-back-link:hover,
.post-footer-row .project-back-link:hover { color: #fff; }
.blog-count {
    flex: 0 0 auto;
    color: #b59ad8;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* ---------- Shared bits ---------- */
.blog-tag {
    display: inline-flex;
    align-items: center;
    padding: .32rem .6rem;
    color: #d5baff;
    background: rgba(117, 67, 207, .16);
    border: 1px solid rgba(196, 154, 255, .19);
    border-radius: 8px;
    font-size: .64rem;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .7rem;
    color: #8f879b;
    font-size: .78rem;
}
.blog-meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}

/* ---------- Listing ---------- */
.blog-list-section { padding-top: clamp(3rem, 6vw, 5rem) !important; }

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
}

.blog-card {
    position: relative;
    background: #14111b;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease;
}
.blog-card:hover {
    border-color: rgba(196, 154, 255, .32);
    transform: translateY(-4px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.blog-card.fade-in.visible:hover { transform: translateY(-4px); }
.blog-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}
.blog-card-link:focus-visible { outline: 2px solid #d9b8ff; outline-offset: -2px; border-radius: 20px; }

.blog-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #0f0c15;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.blog-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.blog-card:hover .blog-card-media img { transform: scale(1.045); }

.blog-card-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        repeating-linear-gradient(70deg, rgba(0, 0, 0, .55) 0 6%, transparent 6% 11%),
        linear-gradient(70deg, rgba(255, 159, 252, .55) 0%, rgba(82, 39, 255, .75) 100%);
}
.blog-card-placeholder span {
    color: rgba(255, 255, 255, .9);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -.04em;
}
.blog-card-placeholder em { color: #fff; font-style: normal; opacity: .6; }

.blog-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .9rem;
    padding: clamp(1.25rem, 2.4vw, 1.6rem);
}
.blog-card-title {
    margin: 0;
    color: #fff;
    text-align: left;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
    line-height: 1.18;
    letter-spacing: -.03em;
    text-wrap: balance;
}
.blog-card-excerpt {
    margin: 0;
    color: #a39cad;
    font-size: .92rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card-more {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: auto;
    padding-top: .4rem;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}
.blog-card-more span { transition: transform .25s ease; }
.blog-card:hover .blog-card-more span { transform: translateX(4px); }

/* Featured (first post on page 1) */
.blog-card--featured { margin-bottom: clamp(1rem, 2vw, 1.5rem); border-radius: 24px; }
.blog-card--featured .blog-card-link { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.blog-card--featured .blog-card-media { aspect-ratio: auto; min-height: 420px; border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .06); }
.blog-card--featured .blog-card-body { justify-content: center; gap: 1.2rem; padding: clamp(1.75rem, 4vw, 3.5rem); }
.blog-card--featured .blog-card-title { font-size: clamp(1.9rem, 3.6vw, 3.1rem); line-height: 1.02; letter-spacing: -.05em; }
.blog-card--featured .blog-card-excerpt { font-size: 1rem; -webkit-line-clamp: 4; }
.blog-card--featured .blog-card-more {
    align-self: flex-start;
    margin-top: .6rem;
    padding: .75rem 1rem;
    color: #121015;
    background: #fff;
    border-radius: 10px;
}

/* Empty state */
.blog-empty {
    padding: clamp(2.5rem, 7vw, 5rem);
    text-align: center;
    background: #14111b;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 24px;
}
.blog-empty h2 { margin: 0 0 1rem; font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -.04em; }
.blog-empty p { margin: 0 auto; max-width: 460px; }

/* Pagination */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.blog-page-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.blog-page-btn,
.blog-page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-width: 40px;
    height: 40px;
    padding: 0 .9rem;
    color: #d8d2e0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.blog-page-num { padding: 0; }
.blog-page-btn:hover,
.blog-page-num:hover { border-color: rgba(196, 154, 255, .45); color: #fff; }
.blog-page-num.is-active { color: #121015; background: #fff; border-color: #fff; }
.blog-page-btn.is-disabled { opacity: .35; pointer-events: none; }

/* ---------- Post ---------- */
.post-preview-bar {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    z-index: 200;
    transform: translateX(-50%);
    padding: .7rem 1.1rem;
    color: #fff;
    background: rgba(124, 58, 237, .92);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
    font-size: .82rem;
    white-space: nowrap;
}
.post-preview-bar a { margin-left: .6rem; color: #fff; font-weight: 700; }

.post-hero { min-height: auto; padding-bottom: clamp(3rem, 6vw, 5rem) !important; }
.post-hero .project-back-link { margin-bottom: clamp(3rem, 7vw, 5.5rem); }
.post-intro { max-width: 1000px; }
.post-title {
    max-width: 1000px;
    margin: 0;
    color: #fff;
    font-size: clamp(2.6rem, 6.4vw, 5.6rem);
    line-height: .96;
    letter-spacing: -.065em;
    text-wrap: balance;
}
.post-lead {
    max-width: 720px;
    margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
    color: #c4bdcd;
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    line-height: 1.65;
}
.post-byline {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
}
.post-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: linear-gradient(135deg, #ff9ffc, #5227ff);
    border-radius: 12px;
    font-weight: 800;
}
.post-author { display: block; color: #fff; font-size: .92rem; font-weight: 650; }
.post-byline-meta { display: flex; align-items: center; gap: .6rem; color: #8f879b; font-size: .8rem; }

.post-content-section { padding-top: 0 !important; }
.post-cover {
    margin: 0 0 clamp(2.5rem, 6vw, 5rem);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 24px;
    background: #0f0c15;
}
.post-cover img { display: block; width: 100%; max-height: 640px; object-fit: cover; }

.post-layout {
    display: grid;
    grid-template-columns: 1fr minmax(0, 720px) 1fr;
    gap: 2rem;
}
.post-body { grid-column: 2; min-width: 0; }

/* Share rail */
.post-share {
    position: sticky;
    top: 7.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    justify-self: start;
    align-self: start;
}
.post-share-label {
    margin-bottom: .35rem;
    color: #8f879b;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.post-share a,
.post-share button {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #d8d2e0;
    background: #14111b;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 11px;
    text-decoration: none;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.post-share a:hover,
.post-share button:hover { color: #fff; border-color: rgba(196, 154, 255, .45); transform: translateY(-2px); }
.post-copy-link.is-copied { color: #fff; border-color: #9b6cff; }
.post-copy-link.is-copied::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + .5rem);
    padding: .3rem .55rem;
    color: #fff;
    background: #2a2236;
    border-radius: 7px;
    font-size: .7rem;
    white-space: nowrap;
}

/* Article typography */
.post-body { color: #c9c3d1; font-size: 1.08rem; line-height: 1.8; }
.post-body > * + * { margin-top: 1.4em; }
.post-body p { color: inherit; font-size: inherit; }
.post-body h2,
.post-body h3,
.post-body h4 { color: #fff; text-align: left; letter-spacing: -.035em; line-height: 1.15; }
.post-body h2 { margin: 2.2em 0 0; font-size: clamp(1.7rem, 3vw, 2.2rem); }
.post-body h3 { margin: 1.9em 0 0; font-size: clamp(1.35rem, 2.3vw, 1.6rem); }
.post-body h4 { margin: 1.7em 0 0; font-size: 1.15rem; }
.post-body h2 + *,
.post-body h3 + *,
.post-body h4 + * { margin-top: .8em; }
.post-body a { color: #d5baff; text-decoration: underline; text-decoration-color: rgba(213, 186, 255, .4); text-underline-offset: 3px; transition: text-decoration-color .2s ease, color .2s ease; }
.post-body a:hover { color: #fff; text-decoration-color: #fff; }
.post-body strong,
.post-body b { color: #fff; font-weight: 650; }
.post-body ul,
.post-body ol { padding-left: 1.4em; }
.post-body li + li { margin-top: .5em; }
.post-body li::marker { color: #9b6cff; }
.post-body blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 1.2rem 1.5rem;
    color: #ece6f3;
    background: rgba(117, 67, 207, .1);
    border-left: 3px solid #9b6cff;
    border-radius: 0 14px 14px 0;
    font-size: 1.15rem;
    line-height: 1.65;
}
.post-body code {
    padding: .15em .4em;
    color: #ead9ff;
    background: rgba(255, 255, 255, .07);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
}
.post-body pre {
    overflow-x: auto;
    padding: 1.2rem 1.4rem;
    background: #0b0910;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88rem;
    line-height: 1.65;
    color: #e2dcea;
}
.post-body pre code { padding: 0; background: none; font-size: inherit; }
.post-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 16px;
}
.post-body figure { margin: 2em 0; }
.post-body figcaption { margin-top: .7rem; color: #8f879b; font-size: .85rem; text-align: center; }
.post-body hr { height: 1px; margin: 2.5em 0; background: rgba(255, 255, 255, .12); border: 0; }

.post-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 720px;
    margin: clamp(3rem, 6vw, 4.5rem) auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
}
.post-footer-row .project-back-link { margin: 0; }

/* Related */
.blog-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.blog-section-head h2 { margin: 0; text-align: left; font-size: clamp(2rem, 4.5vw, 3.4rem); letter-spacing: -.055em; }
.blog-section-head .project-back-link { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .post-layout { grid-template-columns: 56px minmax(0, 1fr); gap: 1.5rem; }
    .post-body { grid-column: 2; }
}
@media (max-width: 960px) {
    .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .blog-card--featured .blog-card-link { grid-template-columns: 1fr; }
    .blog-card--featured .blog-card-media { min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
}
@media (max-width: 768px) {
    .blog-hero { min-height: auto; }
    .post-title { font-size: clamp(2.3rem, 11vw, 3.6rem); }
    .post-layout { display: flex; flex-direction: column-reverse; gap: 2.5rem; }
    .post-share { position: static; flex-direction: row; justify-self: auto; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, .1); width: 100%; }
    .post-share-label { margin: 0 .4rem 0 0; }
    .post-copy-link.is-copied::after { left: auto; top: calc(100% + .4rem); }
    .post-body { font-size: 1.02rem; }
    .post-cover { border-radius: 17px; }
    .blog-pagination .blog-page-numbers { display: none; }
}
@media (max-width: 600px) {
    .blog-grid { grid-template-columns: 1fr; }
    .blog-section-head { flex-direction: column; align-items: flex-start; }
    .post-preview-bar { left: 1rem; right: 1rem; transform: none; white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    .blog-card, .blog-card-media img, .blog-card-more span, .post-share a, .post-share button { transition: none; }
    .blog-card:hover, .blog-card.fade-in.visible:hover { transform: none; }
    .blog-card:hover .blog-card-media img { transform: none; }
}
