/* ==========================================================================
   Sleepy Baby – Blog article shared styles
   ใช้เฉพาะหน้าบทความและหน้ารวมบทความ ทุก selector มี namespace ขึ้นต้นด้วย .blog-
   โหลดต่อท้าย <style> เดิมของแต่ละหน้า เพื่อให้ค่าใหม่ทับค่าเดิมได้
   ========================================================================== */

.blog-article-content {
    --blog-ink: #133a31;
    --blog-text: #24413a;
    --blog-muted: #4f6660;
    --blog-line: rgba(19, 58, 49, .12);
    --blog-mint: #e2ede7;
    --blog-cream: #f5f9f7;

    width: min(100%, 760px);
    margin-inline: auto;
    font-size: 18px;
    line-height: 1.85;
    color: var(--blog-text);
    text-wrap: pretty;
}

.blog-article-content>*:first-child {
    margin-top: 0;
}

.blog-article-content p {
    margin: 0 0 1.3em;
}

.blog-article-content h2,
.blog-article-content h3 {
    color: var(--blog-ink);
    font-weight: 600;
    scroll-margin-top: 96px;
    text-wrap: balance;
}

.blog-article-content h2 {
    margin-top: 2.25em;
    margin-bottom: .75em;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    line-height: 1.4;
}

.blog-article-content h3 {
    margin-top: 1.8em;
    margin-bottom: .65em;
    font-size: clamp(1.2rem, 2.5vw, 1.42rem);
    line-height: 1.45;
}

.blog-article-content ul,
.blog-article-content ol {
    margin: 0 0 1.3em;
    padding-left: 1.5rem;
}

.blog-article-content li {
    margin-bottom: .65em;
}

.blog-article-content li>ul,
.blog-article-content li>ol {
    margin-top: .65em;
    margin-bottom: .2em;
}

.blog-article-content strong {
    color: var(--blog-ink);
    font-weight: 600;
}

.blog-article-content a {
    color: #0f5544;
    text-decoration: underline;
    text-underline-offset: .18em;
    text-decoration-thickness: 1px;
}

.blog-article-content a:hover {
    color: #0b3f33;
    text-decoration-thickness: 2px;
}

.blog-article-content a:focus-visible,
.blog-related-card:focus-visible {
    outline: 3px solid rgba(19, 58, 49, .35);
    outline-offset: 3px;
    border-radius: 6px;
}

.blog-article-content blockquote {
    background: var(--blog-cream);
    border-left: 5px solid #ccd6d1;
    margin: 1.6em 0;
    padding: 16px 20px;
    border-radius: 14px;
    color: var(--blog-text);
}

.blog-article-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-article-content hr {
    border: 0;
    border-top: 1px solid var(--blog-line);
    margin: 2em 0;
}

.blog-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
}

/* ---------- กล่องสรุปบทความ ---------- */
.blog-summary {
    width: min(100%, 760px);
    margin: 0 auto 2em;
    padding: 20px 22px;
    background: linear-gradient(180deg, #eef5f1 0%, #f7faf8 100%);
    border: 1px solid rgba(19, 58, 49, .12);
    border-left: 5px solid #7fa697;
    border-radius: 18px;
    color: #24413a;
    font-size: 17px;
    line-height: 1.8;
}

.blog-summary h2 {
    margin: 0 0 .6em;
    font-size: 1.15rem;
    line-height: 1.4;
    font-weight: 600;
    color: #133a31;
}

.blog-summary p {
    margin: 0 0 .8em;
}

.blog-summary ul {
    margin: 0;
    padding-left: 1.25rem;
}

.blog-summary li {
    margin-bottom: .5em;
}

.blog-summary li:last-child,
.blog-summary p:last-child {
    margin-bottom: 0;
}

/* ---------- กล่องคำแนะนำจากโค้ช ---------- */
.blog-coach-note {
    width: min(100%, 760px);
    margin: 2.2em auto;
    padding: 20px 22px;
    background: #fdfaf3;
    border: 1px solid rgba(19, 58, 49, .1);
    border-left: 5px solid #d8bc85;
    border-radius: 18px;
    color: #24413a;
    font-size: 17px;
    line-height: 1.8;
}

.blog-coach-note h2 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .6em;
    font-size: 1.12rem;
    line-height: 1.4;
    font-weight: 600;
    color: #133a31;
}

.blog-coach-note-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: #f2e6cd;
    font-size: .95rem;
}

.blog-coach-note p {
    margin: 0 0 .8em;
}

.blog-coach-note p:last-child {
    margin-bottom: 0;
}

/* ---------- Step card ---------- */
.blog-steps {
    width: min(100%, 760px);
    margin: 0 auto 1.8em;
    display: grid;
    gap: .75rem;
}

.blog-step {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid rgba(19, 58, 49, .12);
    border-radius: 16px;
}

.blog-step-number {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #e2ede7;
    color: #133a31;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}

.blog-step-content>*:first-child {
    margin-top: 0;
}

.blog-step-content>*:last-child {
    margin-bottom: 0;
}

.blog-step-content h3 {
    margin: 0 0 .4em;
    font-size: 1.08rem;
    line-height: 1.45;
    font-weight: 600;
    color: #133a31;
}

.blog-step-content p {
    margin: 0 0 .6em;
}

.blog-step-content ul {
    margin: .4em 0 0;
    padding-left: 1.2rem;
}

.blog-step-content li {
    margin-bottom: .45em;
}

/* ---------- บทความที่เกี่ยวข้อง (การ์ด) ---------- */
.blog-related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.blog-related-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(19, 58, 49, .1);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    color: #133a31;
    box-shadow: 0 8px 20px rgba(19, 58, 49, .06);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.blog-related-card:hover {
    transform: translateY(-3px);
    border-color: rgba(19, 58, 49, .22);
    box-shadow: 0 14px 28px rgba(19, 58, 49, .12);
}

.blog-related-card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #eef3ef;
    display: block;
}

.blog-related-card-body {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 14px 16px 18px;
    flex: 1;
}

.blog-related-card-tag {
    align-self: flex-start;
    padding: 5px 11px;
    border-radius: 999px;
    background: #edf4f0;
    color: #244b40;
    font-size: .78rem;
    line-height: 1.4;
}

.blog-related-card-title {
    font-size: 1.02rem;
    line-height: 1.45;
    font-weight: 600;
}

.blog-related-card-cta {
    margin-top: auto;
    padding-top: .35rem;
    font-size: .92rem;
    font-weight: 600;
    color: #0f5544;
}

@media (max-width:640px) {
    .blog-article-content {
        font-size: 16.8px;
        line-height: 1.8;
    }

    .blog-summary,
    .blog-coach-note {
        font-size: 16.5px;
        padding: 18px;
        border-radius: 16px;
    }

    .blog-step {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 12px;
        padding: 14px 15px;
    }

    .blog-step-number {
        width: 32px;
        height: 32px;
        font-size: .95rem;
    }

    .blog-related-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion:reduce) {
    .blog-related-card {
        transition: none !important;
    }

    .blog-related-card:hover {
        transform: none;
    }
}
