/* ============================================================
   Puzzle Painting — Blog Detail Page
   Aesthetic: Premium editorial, light mode only
   Tokens match blog-list page (--bl-* vars)
   Fonts: DM Serif Display (display) + Source Serif 4 (body) + DM Mono (data)
   ============================================================ */

/* ── Design tokens (mirrors blog-list) ── */
:root {
    --bl-red:        #D92B2B;
    --bl-red-light:  #FFF0F0;
    --bl-dark:       #1A1818;
    --bl-mid:        #4A4646;
    --bl-muted:      #8A8585;
    --bl-border:     #E8E4E0;
    --bl-bg:         #FAFAF8;
    --bl-white:      #FFFFFF;
    --bl-serif:      'DM Serif Display', Georgia, serif;
}

/* ── Reading Progress Bar ── */
.bp-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--bl-red);
    z-index: 9999;
    transition: width 0.12s linear;
    border-radius: 0 2px 2px 0;
}

/* ── Hero — matches blog-list aesthetic exactly ── */
.bp-hero {
    background: var(--bl-white);
    border-bottom: 1px solid var(--bl-border);
    padding: 64px 0 56px;
}

.bp-hero__inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    animation: bp-fade-up 0.6s ease both;
}

/* "• Insights & Guides" eyebrow — identical to blog list */
.bp-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bl-red);
    margin-bottom: 20px;
}

.bp-hero__eyebrow-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bl-red);
    flex-shrink: 0;
}

/* Service category tag */
.bp-hero__tag {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-red);
    background: var(--bl-red-light);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 18px;
    transition: background 0.2s;
}

.bp-hero__tag:hover { background: #FCDCDC; }

/* Title — always 2 lines, never 3+ */
.bp-hero__title {
    font-family: var(--bl-serif);
    font-size: clamp(1.55rem, 2.6vw, 2.35rem);
    font-weight: 400;
    color: var(--bl-dark);
    line-height: 1.16;
    letter-spacing: -0.02em;
    margin: 0 0 28px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.bp-hero__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--bl-muted);
    margin-bottom: 36px;
}

.bp-hero__meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bp-hero__meta-item svg {
    width: 13px;
    height: 13px;
    opacity: 0.6;
    flex-shrink: 0;
}

.bp-hero__meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--bl-border);
}

/* Divider — identical to blog list */
.bp-hero__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.bp-hero__divider span:not(.bp-hero__divider-dot) {
    display: block;
    width: 60px;
    height: 1px;
    background: var(--bl-border);
}

.bp-hero__divider-dot {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--bl-red);
}

/* ── Featured Image (between hero and content) ── */
.bp-featured-img {
    background: var(--bl-white);
    padding: 32px 2rem 40px;
    border-bottom: 1px solid var(--bl-border);
}

.bp-featured-img__inner {
    max-width: 980px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    aspect-ratio: 16/7;
    position: relative;
    min-height: 1px; /* Safari <15.4 fallback: prevents collapse when all children are position:absolute */
}

.bp-featured-img__inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* Hide all in-content figures — featured_image shown via template, Pexels refs are broken */
.bp-content .blog-hero-image,
.bp-content .blog-image {
    display: none !important;
}

/* Hide any broken inline images gracefully */
.bp-content .blog-content img:not([src]),
.bp-content .blog-content img[src=""],
.bp-content .blog-content figure:has(img[naturalWidth="0"]) {
    display: none;
}

/* ── Main Layout ── */
.bp-layout {
    background: var(--bl-bg);
    padding: 0 0 72px;
}

.bp-layout__grid {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0 56px;
    align-items: start;
}

/* ── Article Content (65%) ── */
.bp-content {
    padding-top: 52px;
    min-width: 0;
}

.bp-content .blog-content {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--bl-mid);
}

/* Lead paragraph */
.bp-content .blog-lead {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.18rem;
    line-height: 1.7;
    color: var(--bl-dark);
    font-weight: 400;
    border-left: 3px solid var(--bl-red);
    padding-left: 1.25rem;
    margin-bottom: 2rem;
}

/* Images */
.bp-content .blog-hero-image {
    margin: 0 0 2.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bl-border);
}

.bp-content .blog-hero-image img,
.bp-content .blog-image img {
    width: 100%;
    height: auto;
    display: block;
}

.bp-content .blog-image {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--bl-border);
}

.bp-content .blog-hero-image figcaption,
.bp-content .blog-image figcaption {
    font-size: 0.72rem;
    color: var(--bl-muted);
    padding: 0.5em 0.75rem;
    letter-spacing: 0.02em;
    background: var(--bl-bg);
}

/* In-content TOC (mobile fallback) */
.bp-content .blog-toc {
    background: var(--bl-white);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin: 0 0 2.5rem;
    border: 1px solid var(--bl-border);
    border-left: 3px solid var(--bl-red);
    display: none;
}

.bp-content .blog-toc p {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-muted);
    margin: 0 0 0.75rem;
}

.bp-content .blog-toc ol {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bp-content .blog-toc a {
    font-size: 0.85rem;
    color: var(--bl-mid);
    text-decoration: none;
    transition: color 0.15s;
}

.bp-content .blog-toc a:hover {
    color: var(--bl-red);
}

/* Headings */
.bp-content .blog-content h2 {
    font-family: var(--bl-serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--bl-dark);
    margin: 3rem 0 1rem;
    line-height: 1.22;
    padding-top: 1rem;
    border-top: 1px solid var(--bl-border);
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.bp-content .blog-content h2 .section-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    color: var(--bl-red);
    font-weight: 500;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    margin-top: 0.25em;
    opacity: 0.7;
}

.bp-content .blog-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bl-dark);
    margin: 2rem 0 0.6rem;
    letter-spacing: -0.01em;
}

/* Paragraphs */
.bp-content .blog-content p {
    margin-bottom: 1.4em;
}

.bp-content .blog-content strong {
    color: var(--bl-dark);
    font-weight: 700;
}

/* Lists */
.bp-content .blog-content ul,
.bp-content .blog-content ol {
    padding-left: 1.25rem;
    margin: 0 0 1.5rem;
}

.bp-content .blog-content li {
    margin-bottom: 0.5em;
    line-height: 1.7;
}

.bp-content .blog-content ul li::marker {
    color: var(--bl-red);
}

.bp-content .blog-content ol li::marker {
    color: var(--bl-red);
    font-family: 'DM Mono', monospace;
    font-size: 0.85em;
    font-weight: 500;
}

/* CTA links */
.bp-content .blog-cta-link {
    color: var(--bl-red);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    font-weight: 600;
    transition: all 0.2s;
}

.bp-content .blog-cta-link:hover {
    text-decoration-thickness: 2px;
}

/* ── Tables — ALL bare <table> tags + .blog-table class ── */

/* Scroll wrapper injected by JS */
.bp-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.75rem 0;
    border-radius: 12px;
    border: 1px solid var(--bl-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

@media (max-width: 600px) {
    .bp-table-wrap {
        position: relative;
    }
}

.bp-content .blog-content table,
.bp-content .blog-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: var(--bl-white);
}

.bp-content .blog-content table thead tr,
.bp-content .blog-table thead tr {
    background: var(--bl-bg);
    border-bottom: 2px solid var(--bl-border);
}

.bp-content .blog-content table th,
.bp-content .blog-table th {
    padding: 0.85em 1.25em;
    text-align: left;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bl-mid);
    white-space: nowrap;
}

.bp-content .blog-content table td,
.bp-content .blog-table td {
    padding: 0.8em 1.25em;
    border-bottom: 1px solid var(--bl-border);
    color: var(--bl-mid);
    line-height: 1.45;
    vertical-align: middle;
}

.bp-content .blog-content table td:last-child,
.bp-content .blog-table td:last-child {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bl-dark);
    white-space: nowrap;
}

.bp-content .blog-content table tbody tr:last-child td,
.bp-content .blog-table tbody tr:last-child td {
    border-bottom: none;
}

.bp-content .blog-content table tbody tr:nth-child(even) td,
.bp-content .blog-table tbody tr:nth-child(even) td {
    background: var(--bl-bg);
}

.bp-content .blog-content table tbody tr:hover td,
.bp-content .blog-table tbody tr:hover td {
    background: #F0EBE6;
    transition: background 0.15s;
}

/* Article end */
.bp-article-end {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bl-border);
}

.bp-article-end__mark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bl-muted);
}

.bp-article-end__mark::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--bl-red);
    border-radius: 2px;
}

/* ── Right Sidebar (25%) ── */
.bp-sidebar {
    padding-top: 52px;
}

.bp-sidebar__inner {
    will-change: transform;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* TOC card */
.bp-toc-card {
    background: var(--bl-white);
    border: 1px solid var(--bl-border);
    border-radius: 14px;
    padding: 22px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.bp-toc-card__label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bl-muted);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bl-border);
}

.bp-toc__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bp-toc__item a {
    display: block;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--bl-muted);
    text-decoration: none;
    padding: 6px 10px 6px 12px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: all 0.18s ease;
}

.bp-toc__item a:hover {
    color: var(--bl-dark);
    border-left-color: var(--bl-border);
    background: var(--bl-bg);
}

.bp-toc__item.is-active a {
    color: var(--bl-red);
    border-left-color: var(--bl-red);
    font-weight: 600;
    background: var(--bl-red-light);
}

/* CTA card */
.bp-cta-card {
    background: var(--bl-white);
    border: 1px solid var(--bl-border);
    border-radius: 14px;
    padding: 24px 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    overflow: hidden;
    position: relative;
}

.bp-cta-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bl-red);
    border-radius: 14px 14px 0 0;
}

.bp-cta-card__eyebrow {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bl-red);
    margin-bottom: 10px;
    margin-top: 4px;
}

.bp-cta-card__title {
    font-family: var(--bl-serif);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--bl-dark);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.bp-cta-card__body {
    font-size: 0.83rem;
    line-height: 1.6;
    color: var(--bl-muted);
    margin-bottom: 20px;
}

.bp-cta-card__phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bl-red);
    color: #fff;
    text-decoration: none;
    padding: 13px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    transition: background 0.2s, transform 0.15s;
    margin-bottom: 10px;
}

.bp-cta-card__phone:hover {
    background: #B82020;
    transform: translateY(-1px);
    color: #fff;
}

.bp-cta-card__phone svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.bp-cta-card__service-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--bl-muted);
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px 0;
}

.bp-cta-card__service-link:hover {
    color: var(--bl-red);
}

.bp-cta-card__divider {
    height: 1px;
    background: var(--bl-border);
    margin: 18px 0;
}

.bp-cta-card__trust {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bp-cta-card__trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--bl-mid);
}

.bp-cta-card__trust-item svg {
    width: 13px;
    height: 13px;
    color: var(--bl-red);
    flex-shrink: 0;
}

/* ── Related Posts ── */
.bp-related {
    background: var(--bl-white);
    border-top: 1px solid var(--bl-border);
    padding: 64px 0;
}

.bp-related__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 2rem;
}

.bp-related__header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.bp-related__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bl-red);
    white-space: nowrap;
}

.bp-related__heading {
    font-family: var(--bl-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--bl-dark);
    white-space: nowrap;
    letter-spacing: -0.01em;
    margin: 0;
}

.bp-related__line {
    flex: 1;
    height: 1px;
    background: var(--bl-border);
}

.bp-related__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.bp-related-card {
    background: var(--bl-white);
    border: 1px solid var(--bl-border);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.bp-related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 32px rgba(0,0,0,0.09);
}

.bp-related-card__img {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(145deg, #F5EDE6 0%, #EBD9CC 100%);
    position: relative;
    display: block;
}

.bp-related-card__img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.bp-related-card:hover .bp-related-card__img img {
    transform: scale(1.05);
}

.bp-related-card__body {
    padding: 20px 22px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bp-related-card__title {
    font-family: var(--bl-serif);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--bl-dark);
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.bp-related-card__excerpt {
    font-size: 0.84rem;
    color: var(--bl-muted);
    line-height: 1.55;
    flex: 1;
    margin-bottom: 14px;
}

.bp-related-card__cta {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bl-red);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bp-related-card__cta svg {
    width: 15px;
    height: 15px;
    transition: transform 0.2s;
}

.bp-related-card:hover .bp-related-card__cta svg {
    transform: translateX(3px);
}

/* ── Bottom CTA ── */
.bp-bottom-cta {
    background: var(--bl-bg);
    border-top: 1px solid var(--bl-border);
    padding: 72px 0;
}

.bp-bottom-cta__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
}

.bp-bottom-cta__inner > * {
    min-width: 0; /* prevent grid blowout from wide form inputs */
}

.bp-bottom-cta__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bl-red);
    margin-bottom: 10px;
}

.bp-bottom-cta__heading {
    font-family: var(--bl-serif);
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 400;
    color: var(--bl-dark);
    line-height: 1.2;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.bp-bottom-cta__sub {
    font-size: 0.92rem;
    color: var(--bl-mid);
    line-height: 1.65;
    margin-bottom: 28px;
}

.bp-bottom-cta__contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bp-bottom-cta__phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--bl-dark);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: color 0.2s;
}

.bp-bottom-cta__phone:hover {
    color: var(--bl-red);
}

.bp-bottom-cta__hours {
    font-size: 0.78rem;
    color: var(--bl-muted);
}

/* ── Animations ── */
@keyframes bp-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .bp-layout__grid {
        grid-template-columns: 1fr 280px;
        gap: 0 36px;
    }

    .bp-related__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .bp-bottom-cta__inner {
        gap: 36px;
    }
}

@media (max-width: 768px) {
    .bp-hero {
        padding: 48px 0 40px;
    }

    .bp-hero__title {
        font-size: clamp(1.7rem, 6vw, 2.4rem);
    }

    .bp-layout__grid {
        grid-template-columns: 1fr;
    }

    .bp-sidebar {
        display: none;
    }

    .bp-content .blog-toc {
        display: block;
    }

    .bp-content .blog-lead {
        font-size: 1.05rem;
    }

    .bp-content .blog-image {
        margin: 2rem 0;
    }

    .bp-bottom-cta__inner {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .bp-related__grid {
        grid-template-columns: 1fr;
    }

    .bp-related__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .bp-related__line { display: none; }
}

@media (max-width: 480px) {
    .bp-hero__inner { padding: 0 1.25rem; }
    .bp-layout__grid { padding: 0 1.25rem; }
    .bp-related__inner { padding: 0 1.25rem; }
    .bp-bottom-cta__inner { padding: 0 1.25rem; }
}
