/* ====================BLOG: scoped <nav> reset====================
   index-styles.css uses a bare `nav { position: fixed; ... }` rule that
   targets EVERY <nav> on the page. The blog has semantic <nav> elements
   for the breadcrumb and table of contents — they need to render in flow,
   not as a fixed top bar. Reset everything that rule applies. */

nav.post-breadcrumb {
    position: static;
    left: auto;
    transform: none;
    width: auto;
    max-width: none;
    z-index: auto;
    border-bottom: none;
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding: 0;
}

/* ====================BLOG: layout containers==================== */

.blog-main {
    width: 100%;
    max-width: var(--lockedvw);
    margin: 0 auto;

    padding: 150px var(--sidepadding) 90px;

    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* ====================BLOG INDEX: header + grid==================== */

.blog-index-header {
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;

    padding: 0 clamp(12px, -134.1536px + 29.2308vw, 240px);
}

.blog-eyebrow {
    color: var(--default);
    font-weight: 400;
}

.blog-index-header h1 {
    font-size: clamp(36px, 32.2704px + 0.9945vw, 45px);
    letter-spacing: -1px;
    line-height: 1.05;
    max-width: 24ch;
}

.blog-subtitle {
    color: var(--default);
    max-width: 60ch;
    line-height: 1.5;
}

/* ====================BLOG INDEX: tag filter row==================== */

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;

    padding: 0 var(--sidepadding);
}

.tag-pill {
    display: inline-block;

    padding: 4px 10px;
    border-radius: 50vw;

    background-color: hsl(from var(--muted) h s l / 0.24);
    color: var(--default);

    font-size: 13px;
    font-weight: 450;

    transition: background-color .2s ease, color .2s ease;
}

.tag-pill:hover {
    background-color: hsl(from var(--muted) h s l / 0.4);
    color: var(--strong);
}

.tag-pill.is-active {
    background-color: var(--accent);
    color: var(--base);
}

/* ====================CARD GRID==================== */

.post-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;

    padding: 0 clamp(0px, -48px + 8vw, 48px);
}

@media (min-width: 600px) { .post-card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .post-card-grid { grid-template-columns: 1fr 1fr 1fr; } }

.post-card {
    display: flex;
    flex-direction: column;

    background-color: var(--base);
    border: 1px solid hsl(from var(--muted) h s l / 0.5);
    border-radius: 10px;
    overflow: hidden;

    color: inherit;

    transition: border-color .2s ease;
}

.post-card:hover {
    border-color: hsl(from var(--default) h s l / 0.6);
}

.card-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: hsl(from var(--muted) h s l / 0.24);
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;

    transition: transform .4s ease;
}

.post-card:hover .card-image-wrap img { transform: scale(1.03); }

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;

    padding: 18px 20px 22px;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 12px;
    color: var(--default);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.card-meta .card-tag {
    color: var(--accent);
    background-color: var(--accent-subtle);
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0;
}

.card-title {
    font-size: 18px;
    line-height: 1.3;
    color: var(--strong);
    transition: color .2s ease;

    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    color: var(--default);
    font-size: 14px;
    line-height: 1.5;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-date {
    margin-top: auto;
    padding-top: 8px;

    color: var(--default);
    font-size: 13px;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--default);
    padding: 60px 0;

    font-size: 15px;
}

/* ====================POST PAGE: breadcrumb==================== */

/* No max-width on .blog-post — each child sets its own consistent reading width. */
.blog-post {
    display: flex;
    flex-direction: column;
    gap: 36px;

    width: 100%;
}

/* Shared reading-column width for every block in the article. */
.blog-post > .post-breadcrumb,
.blog-post > .post-header,
.blog-post > .post-hero,
.blog-post > .post-body,
.blog-post > .post-cta,
.blog-post > .post-related {
    max-width: 760px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.post-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    font-size: 13px;
    color: var(--default);
}

.post-breadcrumb a {
    color: var(--default);
    transition: color .2s ease;
}

.post-breadcrumb a:hover { color: var(--strong); text-decoration: underline; }

.post-breadcrumb a.breadcrumb-back {
    display: inline-flex;
    align-items: center;
    width: 19px;
    height: 19px;
    margin-right: 9px;
    
    & svg { fill: var(--default); transition: fill .2s ease; width: fit-content; height: fit-content; }
}

.post-breadcrumb a.breadcrumb-back:hover svg { fill: var(--hover); }

.post-breadcrumb a.breadcrumb-back svg { display: block; }

.post-breadcrumb span[aria-hidden="true"] {
    color: var(--muted);
    margin: 0 2px;
}

.breadcrumb-current {
    color: var(--strong);
    font-weight: 500;

    /* Truncate long titles */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(60ch, 100%);
}

/* ====================POST PAGE: header==================== */

.post-header {
    display: flex;
    flex-direction: column;
    gap: 18px;

    text-align: center;
}

.post-header h1 {
    font-size: clamp(32px, 27.7408px + 1.1364vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.8px;
}

.post-byline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;

    color: var(--default);
    font-size: 14px;
}

.byline-author { color: var(--strong); font-weight: 500; }
.byline-sep { color: var(--muted); }

.post-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

/* ====================POST PAGE: hero image==================== */

.post-hero {
    margin: 0;
    width: 100%;

    border-radius: 12px;
    overflow: hidden;
    background-color: hsl(from var(--muted) h s l / 0.24);

    aspect-ratio: 16 / 9;
}

.post-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ====================POST PAGE: prose body==================== */

.post-body {
    font-size: 17px;
    line-height: 1.75;
    color: hsl(from var(--strong) h s l / 0.92);

    min-width: 0;
}

.post-body > * + * { margin-top: 1.25em; }

.post-body h2,
.post-body h3,
.post-body h4 {
    color: var(--strong);
    line-height: 1.25;
    letter-spacing: -0.4px;

    scroll-margin-top: 96px;
    position: relative;
}

.post-body h2 {
    font-size: 26px;
    margin-top: 2em;
    padding-top: 0.25em;
    border-top: 1px solid hsl(from var(--muted) h s l / 0.36);
    padding-top: 1.25em;
}

.post-body h3 {
    font-size: 20px;
    margin-top: 1.75em;
}

.post-body h4 {
    font-size: 17px;
    margin-top: 1.5em;
}

.post-body .anchor-link {
    color: var(--muted);
    text-decoration: none;
    margin-left: 8px;
    opacity: 0;
    transition: opacity .2s ease;
    font-weight: 400;
}

.post-body h2:hover .anchor-link,
.post-body h3:hover .anchor-link,
.post-body :focus-within > .anchor-link { opacity: 1; }

.post-body p {
    color: inherit;
}

.post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    text-decoration-color: hsl(from var(--accent) h s l / 0.4);
    transition: text-decoration-color .2s ease;
}

.post-body a:hover { text-decoration-color: var(--accent); }

.post-body ul,
.post-body ol {
    padding-left: 1.5em;
}

.post-body li { margin-top: 0.4em; }
.post-body li::marker { color: var(--default); }

.post-body blockquote {
    margin: 1.5em 0;
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--accent);
    color: var(--default);
    font-style: italic;
}

.post-body blockquote p { color: inherit; }

.post-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    background-color: hsl(from var(--muted) h s l / 0.3);
    color: var(--strong);
    padding: 2px 6px;
    border-radius: 4px;
}

.post-body pre.code-block {
    background-color: #0e0e0e;
    color: #ebebeb;
    padding: 18px 20px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.55;

    border: 1px solid hsl(from var(--muted) h s l / 0.5);
    box-shadow: 0 4px 14px hsl(from var(--default) h s l / 0.16);
}

.post-body pre.code-block code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 14px;
}

.post-body hr {
    border-top: 1px solid hsl(from var(--muted) h s l / 0.5);
    margin: 2.5em 0;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1.5em auto;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    margin: 1.5em 0;
}

.post-body th,
.post-body td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid hsl(from var(--muted) h s l / 0.5);
}

.post-body th {
    font-weight: 600;
    color: var(--strong);
    background-color: hsl(from var(--muted) h s l / 0.18);
}

.post-body strong { color: var(--strong); font-weight: 600; }

/* ====================POST PAGE: CTA==================== */

.post-cta {
    margin-top: 16px;
}

.post-cta-inner {
    background: linear-gradient(135deg, hsl(from var(--accent) h s l / 0.08) 0%, hsl(from var(--accent) h s l / 0.02) 100%);
    border: 1px solid hsl(from var(--accent) h s l / 0.3);
    border-radius: 12px;

    padding: clamp(24px, 4vw, 36px);
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.post-cta-eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.post-cta-headline {
    font-size: clamp(22px, 19.2px + 0.75vw, 28px);
    line-height: 1.2;
    letter-spacing: -0.4px;
    max-width: 22ch;
}

.post-cta-sub {
    color: var(--default);
    font-size: 14px;
}

.post-cta-button {
    margin-top: 12px;
    background-color: var(--accent);
    color: var(--base);

    padding: 11px 22px;
    border-radius: 50vw;

    font-weight: 500;
    transition: opacity .2s ease, transform .15s ease;
}

.post-cta-button:hover { opacity: 0.88; }
.post-cta-button:active { transform: scale(0.98); }

/* ====================POST PAGE: related posts==================== */

.post-related {
    /* Wider than the reading column so the 3-card row breathes. */
    max-width: min(1100px, 100%) !important;
    margin-top: 24px;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-related h2 {
    font-size: 24px;
    text-align: center;
    letter-spacing: -0.3px;
}

.post-related .post-card-grid {
    padding: 0;
}

/* ====================RESPONSIVE TWEAKS==================== */

@media (max-width: 600px) {
    .blog-main { padding-top: 96px; gap: 32px; }
    .blog-post { gap: 24px; }
    .post-body { font-size: 16px; line-height: 1.7; }
    .post-body pre.code-block { font-size: 13px; }
}

footer { margin-top: 45px; }