/*
 * blog.css — Memphis-styled public /blog index + article pages.
 * Visually mirrors learnwithhasan.com/blog: warm cream canvas, hard 3px
 * black borders with hard 4px shadows, Poppins, purple/pink/teal accents.
 * Scoped under .page-blog-index and .page-blog-article so it can never
 * bleed into the rest of the public-site cascade.
 *
 * Loaded directly by Views/Blog/Index.cshtml + Detail.cshtml (no bundle).
 */

.page-blog-index,
.page-blog-article {
    /* Memphis token set — aliased to the canonical --tn-* system so the blog
       shares one surface/accent palette with the rest of the public site AND
       inherits dark mode. Surfaces + ink/gray map to THEME-FLIPPING tokens
       (the blog ships no html.dark overrides of its own, so these aliases are
       what give it a correct dark theme); brand accents map to the fixed
       --tn-color-* brand hues. */
    --mp-cream: var(--tn-surface-panel-muted);
    --mp-white: var(--tn-surface-panel);
    --mp-black: var(--tn-text-default);
    --mp-gray: var(--tn-text-muted);
    --mp-gray-soft: var(--tn-text-soft);
    --mp-purple: var(--tn-color-purple);
    --mp-pink: var(--tn-color-pink);
    --mp-teal: var(--tn-color-teal);
    --mp-yellow: var(--tn-color-yellow);
    --mp-yellow-light: var(--tn-color-yellow-soft);

    --mp-border: var(--tn-border-heavy);
    --mp-shadow: 4px 4px 0 0 var(--tn-border-strong);
    --mp-shadow-sm: 3px 3px 0 0 var(--tn-border-strong);
    --mp-radius: 16px;
    --mp-radius-sm: 10px;
    --mp-radius-pill: 50px;

    background-color: var(--mp-cream);
    color: var(--mp-black);
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ──────────────────── Shared hero ──────────────────── */

.page-blog-index .directory-hero,
.page-blog-article .directory-hero {
    background: transparent;
    border: 0;
    padding: 3rem 0 1.5rem;
}

.page-blog-index .directory-hero__decor,
.page-blog-article .directory-hero__decor {
    display: none;
}

/* The user-end-vnext bundle wraps the hero inner in a bordered/padded card;
   LWH's hero is a flat block, so strip the chrome here. */
.page-blog-index .directory-hero__inner,
.page-blog-article .directory-hero__inner {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.page-blog-index .directory-shell,
.page-blog-article .directory-shell {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-blog-index .directory-breadcrumbs,
.page-blog-article .directory-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--mp-gray);
    margin-bottom: 1.5rem;
}

.page-blog-index .directory-breadcrumbs a,
.page-blog-article .directory-breadcrumbs a {
    color: var(--mp-purple);
    text-decoration: none;
    font-weight: 500;
}

.page-blog-index .directory-breadcrumbs a:hover,
.page-blog-article .directory-breadcrumbs a:hover {
    text-decoration: underline;
}

.page-blog-index .directory-hero__title,
.page-blog-article .directory-hero__title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(2.25rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--mp-black);
    margin: 0;
}

.page-blog-index .directory-hero__intro {
    margin-top: 1rem;
    max-width: 38rem;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--mp-gray);
}

.page-blog-index .directory-hero__intro p {
    margin: 0;
}

/* ──────────────────── Index: section title ──────────────────── */

.page-blog-index .directory-grid-section {
    padding: 1rem 0 4rem;
}

.page-blog-index .directory-section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mp-black);
    margin: 0 0 1.5rem;
}

/* ──────────────────── Index: Memphis card grid ──────────────────── */

.blog-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 1.75rem;
}

.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--mp-white);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.blog-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 0 var(--mp-black);
}

.blog-card__media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--mp-cream);
    border-bottom: var(--mp-border);
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    flex: 1;
}

.blog-card__category {
    align-self: flex-start;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--mp-purple);
    color: var(--mp-white);
    border: 2px solid var(--mp-black);
    border-radius: var(--mp-radius-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.4;
}

.blog-card:nth-child(3n+2) .blog-card__category {
    background: var(--mp-pink);
}

.blog-card:nth-child(3n+3) .blog-card__category {
    /* a11y: white on --mp-teal #4db8a8 is 2.37:1 (fails WCAG AA). Darken to
       a deeper teal so the white label clears 4.5:1, keeping the white-on-
       color treatment consistent with the pink/purple categories. */
    background: #2b756a;
}

.blog-card__title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    color: var(--mp-black);
}

.blog-card__title a {
    color: inherit;
    text-decoration: none;
    background-image: none;
}

.blog-card__title a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.blog-card:hover .blog-card__title {
    color: var(--mp-purple);
}

.blog-card__excerpt {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--mp-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__date {
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 2px solid rgba(26, 26, 46, 0.1);
    font-size: 0.8125rem;
    color: var(--mp-gray);
}

.page-blog-index .directory-empty-state {
    padding: 3rem 0 5rem;
    text-align: center;
    color: var(--mp-gray);
}

/* ──────────────────── Article: reading progress ──────────────────── */

.blog-progress {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 4px;
    width: 100%;
    background: transparent;
}

.blog-progress__bar {
    display: block;
    height: 100%;
    width: var(--blog-progress, 0%);
    background: var(--mp-purple);
    transition: width 0.1s linear;
}

@media (prefers-reduced-motion: reduce) {
    .blog-progress__bar {
        transition: none;
    }
}

/* ──────────────────── Article: header (category + title + meta) ──────────────────── */

.page-blog-article .directory-hero {
    padding: 2rem 0 2rem;
}

.page-blog-article .directory-hero__inner {
    max-width: 56rem;
}

.blog-article__category {
    display: inline-block;
    margin-bottom: 1.25rem;
    padding: 0.3125rem 0.875rem;
    background: var(--mp-purple);
    color: var(--mp-white);
    border: 2px solid var(--mp-black);
    border-radius: var(--mp-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.4;
}

.page-blog-article .directory-hero__title {
    font-size: clamp(2rem, 4.5vw, 3rem);
    line-height: 1.1;
    margin: 0 0 1.5rem;
}

.blog-article__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.875rem;
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--mp-gray);
}

.blog-article__meta-author {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-article__meta-avatar {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--mp-purple);
    color: var(--mp-white);
    border: var(--tn-border-heavy);
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1;
}

.blog-article__byline {
    font-weight: 500;
    color: var(--mp-black);
}

.blog-article__meta-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--mp-gray-soft);
    display: inline-block;
}

/* ──────────────────── Article: hero image ──────────────────── */

.blog-article__hero-media {
    margin: 2rem 0 0;
}

.blog-article__hero-media .directory-shell {
    max-width: 72rem;
}

.blog-article__hero-media img {
    width: 100%;
    max-height: 28rem;
    object-fit: cover;
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow);
    display: block;
}

/* ──────────────────── Article: two-column layout ──────────────────── */

.blog-article__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 3rem;
    padding: 3rem 0 2rem;
    align-items: start;
}

@media (max-width: 64rem) {
    .blog-article__layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
        padding: 2rem 0 1rem;
    }
}

/* ──────────────────── Article: TOC ──────────────────── */

/* Track 3c: the sidebar column owns the sticky behavior so the TOC + the
   above-fold ad slot move as one unit. The sidebar starts below the hero
   image (it's a grid sibling of .blog-article__body, which itself begins
   below the hero), so the sticky only engages once the user has scrolled
   the hero past the top of the viewport — exactly the "stick only after
   hero scrolls past" requirement. */
.blog-article__sidebar {
    position: sticky;
    top: 2rem;
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-self: start;
}

@media (max-width: 64rem) {
    .blog-article__sidebar {
        position: static;
        order: 0;
    }
}

.blog-toc {
    padding: 1.25rem;
    background: var(--mp-white);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow-sm);
}

@media (max-width: 64rem) {
    .blog-toc {
        margin-bottom: 1rem;
    }
}

.blog-toc__heading {
    margin: 0 0 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mp-black);
}

.blog-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid rgba(26, 26, 46, 0.12);
}

.blog-toc__item--level-3 {
    padding-left: 0.875rem;
}

.blog-toc__link {
    display: block;
    padding: 0.375rem 0 0.375rem 0.875rem;
    margin-left: -2px;
    border-left: 2px solid transparent;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--mp-gray);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.blog-toc__link:hover {
    color: var(--mp-black);
}

.blog-toc__link.is-active {
    color: var(--mp-purple);
    border-left-color: var(--mp-purple);
    font-weight: 600;
}

/* ──────────────────── Article: ad / affiliate slots (Track 3c) ──────────────────── */

/* Empty, labeled placeholders only — no network/ad code. Rendered as dashed
   wells so the seam is visible in dev but unobtrusive once filled. */
.blog-ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 6rem;
    padding: 1.25rem;
    border: 1px dashed rgba(26, 26, 46, 0.22);
    border-radius: var(--mp-radius);
    background: rgba(26, 26, 46, 0.02);
}

.blog-ad-slot__label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mp-gray);
    opacity: 0.55;
}

.blog-ad-slot--sidebar {
    min-height: 16rem;
}

.blog-ad-slot--in-content {
    margin: 2.5rem 0;
}

.blog-ad-slot--end {
    margin-top: 3rem;
}

/* ──────────────────── Article: rendered body (prose) ──────────────────── */

.blog-article__body {
    max-width: 46rem;
    font-size: 1.125rem;
    line-height: 1.78;
    color: var(--mp-gray);
}

.blog-article__body h2,
.blog-article__body h3,
.blog-article__body h4 {
    font-family: 'Poppins', sans-serif;
    color: var(--mp-black);
    font-weight: 700;
}

.blog-article__body h2 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    line-height: 1.3;
    scroll-margin-top: 4rem;
}

.blog-article__body h3 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
    line-height: 1.4;
    scroll-margin-top: 4rem;
}

.blog-article__body p {
    margin: 0 0 1.5rem;
    color: var(--mp-gray);
}

.blog-article__body ul,
.blog-article__body ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
    color: var(--mp-gray);
}

.blog-article__body li {
    margin-bottom: 0.5rem;
}

.blog-article__body li::marker {
    color: var(--mp-teal);
}

.blog-article__body a {
    color: var(--mp-pink);
    font-weight: 500;
    text-decoration: none;
    background-image: none;
}

.blog-article__body a:hover {
    text-decoration: underline;
}

.blog-article__body strong {
    color: var(--mp-black);
    font-weight: 600;
}

.blog-article__body blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--mp-pink);
    background: var(--mp-white);
    border-radius: 0 var(--mp-radius-sm) var(--mp-radius-sm) 0;
    color: var(--mp-gray);
    font-style: normal;
}

.blog-article__body blockquote p:last-child {
    margin-bottom: 0;
}

.blog-article__body code {
    background: var(--mp-yellow-light);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--mp-black);
}

.blog-article__body pre {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    background: var(--mp-black);
    border: var(--mp-border);
    border-radius: var(--mp-radius-sm);
    color: #f5f5f5;
}

.blog-article__body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.blog-article__body table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: separate;
    border-spacing: 0;
    border: var(--mp-border);
    border-radius: var(--mp-radius-sm);
    overflow: hidden;
    font-size: 0.9375rem;
    background: var(--mp-white);
}

.blog-article__body th,
.blog-article__body td {
    padding: 0.625rem 0.875rem;
    border-bottom: 2px solid rgba(26, 26, 46, 0.1);
    text-align: left;
}

.blog-article__body tr:last-child th,
.blog-article__body tr:last-child td {
    border-bottom: 0;
}

.blog-article__body th {
    background: var(--mp-yellow-light);
    color: var(--mp-black);
    font-weight: 700;
}

.blog-article__body hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 2px dashed rgba(26, 26, 46, 0.2);
}

/* ──────────────────── Article: TL;DR ──────────────────── */

.blog-tldr {
    margin: 0 0 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--mp-yellow-light);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow-sm);
}

.blog-tldr__label {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mp-black);
}

.blog-tldr__text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--mp-black);
}

/* ──────────────────── Article: share + author ──────────────────── */

.blog-article__share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin: 0 0 2rem;
    padding-top: 2rem;
    border-top: 2px dashed rgba(26, 26, 46, 0.2);
}

.blog-article__share-label {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mp-black);
}

.blog-article__share-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    background: var(--mp-white);
    border: 2px solid var(--mp-black);
    border-radius: var(--mp-radius-pill);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mp-black);
    text-decoration: none;
    box-shadow: 2px 2px 0 0 var(--mp-black);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.blog-article__share-link:hover {
    background: var(--mp-purple);
    color: var(--mp-white);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 0 var(--mp-black);
}

/* share.ts popover — replicated here because the blog page loads the
   user-end-vnext bundle, not tool-public-editorial.bundle.css where the
   canonical .tn-share-popover rules live. blog.css is direct-served. */
.blog-article__share .tn-share-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    padding: var(--tn-space-2, 0.5rem);
    background: var(--mp-white, #fff);
    border: 2px solid var(--mp-black, #1a1a2e);
    border-radius: var(--tn-radius-md, 8px);
    box-shadow: 4px 4px 0 0 var(--mp-black, #1a1a2e);
}

.blog-article__share .tn-share-popover__item {
    display: block;
    width: 100%;
    padding: var(--tn-space-2, 0.5rem) var(--tn-space-3, 0.75rem);
    border: 0;
    border-radius: var(--tn-radius-sm, 6px);
    background: transparent;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    color: var(--mp-black, #1a1a2e);
    cursor: pointer;
}

.blog-article__share .tn-share-popover__item:hover,
.blog-article__share .tn-share-popover__item:focus-visible {
    background: var(--mp-purple, #6c5ce7);
    color: var(--mp-white, #fff);
    outline: none;
}

.blog-article__share .tn-share-popover__copy {
    margin-top: var(--tn-space-1, 0.25rem);
    border-top: 1px solid rgba(26, 26, 46, 0.2);
    border-radius: 0;
}

.blog-article__author {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 0 0 2.5rem;
    padding: 1.5rem;
    background: var(--mp-white);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow-sm);
}

.blog-article__author-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: var(--mp-purple);
    color: var(--mp-white);
    border: var(--tn-border-heavy);
    font-weight: 700;
    font-size: 1.25rem;
}

.blog-article__author-name {
    margin: 0 0 0.25rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--mp-black);
}

.blog-article__author-bio {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--mp-gray);
}

/* ──────────────────── Article: FAQ ──────────────────── */

.page-blog-article .directory-faq {
    padding: 2.5rem 0 0;
}

.page-blog-article .directory-faq__title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mp-black);
    margin: 0 0 1.5rem;
}

.page-blog-article .directory-faq__list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 46rem;
}

.page-blog-article .directory-faq__item {
    background: var(--mp-white);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow-sm);
    overflow: hidden;
}

.page-blog-article .directory-faq__question {
    padding: 1rem 1.25rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--mp-black);
    cursor: pointer;
    list-style: none;
}

.page-blog-article .directory-faq__question::-webkit-details-marker {
    display: none;
}

.page-blog-article .directory-faq__question::after {
    content: '+';
    float: right;
    font-size: 1.25rem;
    color: var(--mp-purple);
    line-height: 1;
}

.page-blog-article .directory-faq__item[open] .directory-faq__question::after {
    content: '−';
}

.page-blog-article .directory-faq__answer {
    padding: 0 1.25rem 1.25rem;
    color: var(--mp-gray);
    line-height: 1.65;
}

/* ──────────────────── Article: related strip ──────────────────── */

.blog-related {
    margin: 3rem 0 4rem;
    padding: 2.5rem 0 0;
    border-top: 2px dashed rgba(26, 26, 46, 0.2);
}

.blog-related__title {
    font-family: 'Poppins', sans-serif;
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mp-black);
}

.blog-related__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1.25rem;
}

.blog-related__card {
    display: flex;
    flex-direction: column;
    background: var(--mp-white);
    border: var(--mp-border);
    border-radius: var(--mp-radius);
    box-shadow: var(--mp-shadow-sm);
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.blog-related__card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 0 var(--mp-black);
}

.blog-related__media {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--mp-cream);
    border-bottom: var(--mp-border);
}

.blog-related__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-related__body {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem 1.125rem 1.25rem;
}

.blog-related__category {
    align-self: flex-start;
    padding: 0.1875rem 0.625rem;
    background: var(--mp-teal);
    color: var(--mp-white);
    border: 2px solid var(--mp-black);
    border-radius: var(--mp-radius-pill);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.blog-related__card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--mp-black);
}
