/* ==========================================================================
   Blog article styles
   --------------------------------------------------------------------------
   Works together with assets/blog.js. JS-only states are scoped under
   `.blog-js` so the article stays fully readable if scripts fail to load.
   ========================================================================== */

:root {
    --blog-accent: #1abc9c;          /* brand teal – decorative use (bars, borders) */
    --blog-accent-ink: #0d7d67;      /* darker teal – passes WCAG AA for text on white */
    --blog-accent-soft: #e9f8f4;
    --blog-green: #52b977;
    --blog-ink: #1f2933;             /* headings */
    --blog-text: #3e4c59;            /* body copy */
    --blog-muted: #616e7c;
    --blog-border: #e4e9ee;
    --blog-surface: #f6f8fa;
    --blog-radius: 12px;
    --blog-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
    --blog-shadow-md: 0 12px 28px -10px rgba(16, 24, 40, 0.22);
    --blog-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --blog-header-h: 120px;          /* real value is measured and set by blog.js */
    --blog-anchor-gap: 24px;         /* breathing room between fixed header and a jumped-to heading */
    --blog-fab-offset: 24px;         /* raise this if a chat/WhatsApp widget sits bottom-right */
}


/* --------------------------------------------------------------------------
   Legacy utilities (kept – may be used by shared partials such as share-us.php)
   -------------------------------------------------------------------------- */

.text-underline {
    text-decoration: underline;
}

.share-blog {
    flex-direction: row;
    gap: 40px;
    width: auto;
    box-shadow: none;
    justify-content: end;
}

.cutomrounded {
    border-radius: 15px;
}

.justify-content-space-evenly {
    justify-content: space-evenly;
}

.w-40 {
    width: 40%;
}

.font16 {
    font-size: 16px !important;
}

.postheader li > a {
    color: #1abc9c !important;
}

@media only screen and (max-width: 600px) {
    .w-40 {
        width: 65%;
    }
}


/* --------------------------------------------------------------------------
   Reading progress bar (desktop – lives inside <header>, see blog.js)
   -------------------------------------------------------------------------- */

.progress-container {
    display: none;
    position: fixed;
    z-index: -1;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(16, 24, 40, 0.06);
    pointer-events: none;
}

.progress-container.is-visible {
    display: block;
}

.progress-container .progress-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--blog-green), var(--blog-accent));
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: none;
    will-change: transform;
}

@media (max-width: 768px) {
    .progress-container,
    .progress-container.is-visible {
        display: none;
    }
}


/* --------------------------------------------------------------------------
   Hero image & meta
   -------------------------------------------------------------------------- */

.blog-wrapper .post-thumb img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    box-shadow: var(--blog-shadow-sm);
}

.blog-wrapper .article-meta ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 1rem 0 1.75rem;
    padding: 0;
    color: var(--blog-muted);
    font-size: 0.9rem;
}

.blog-wrapper .article-meta li {
    display: inline-flex;
    align-items: center;
}

.blog-wrapper .article-meta i {
    margin-right: 0.45rem;
    color: var(--blog-accent-ink);
}

.blog-wrapper .article-meta a {
    color: inherit;
    text-decoration: none;
}

.blog-wrapper .article-meta a:hover {
    color: var(--blog-accent-ink);
}


/* --------------------------------------------------------------------------
   Article typography
   -------------------------------------------------------------------------- */

.blog-wrapper p {
    font-size: 16px;
    line-height: 1.85;
}

@media only screen and (min-width: 1700px) {
    .blog-wrapper p {
        font-size: 16px !important;
    }
}

#blogdata {
    color: var(--blog-text);
    overflow-wrap: break-word;
}

#blogdata p {
    margin: 0 0 1.15rem;
}

#blogdata strong {
    color: var(--blog-ink);
    font-weight: 600;
}

#blogdata a {
    color: var(--blog-accent-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(13, 125, 103, 0.35);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

#blogdata a:hover {
    text-decoration-color: currentColor;
}

/* Jump targets clear the fixed header (replaces the old h2::before hack). */
#blogdata [id],
#faqs {
    scroll-margin-top: calc(var(--blog-header-h) + var(--blog-anchor-gap));
}

/* Section headings */
#blogdata > h2 {
    position: relative;
    margin: 2.75rem 0 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--blog-border);
    color: var(--blog-ink);
    font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

#blogdata h2[tabindex="-1"]:focus {
    outline: none;
}

/* Copy-link button injected into each heading */
.blog-heading-anchor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    margin-left: 0.35rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--blog-muted);
    vertical-align: middle;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.blog-heading-anchor svg {
    width: 1rem;
    height: 1rem;
}

#blogdata > h2:hover .blog-heading-anchor,
.blog-heading-anchor:focus-visible {
    opacity: 1;
}

.blog-heading-anchor:hover {
    background: var(--blog-accent-soft);
    color: var(--blog-accent-ink);
}

@media (hover: none) {
    .blog-heading-anchor {
        opacity: 0.6;
    }
}

/* Bullet lists */
#blogdata .highlight-list {
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

#blogdata .highlight-list li {
    position: relative;
    margin-bottom: 0.6rem;
    padding-left: 1.75rem;
    line-height: 1.75;
}

#blogdata .highlight-list li::before {
    content: "";
    position: absolute;
    top: calc(0.875em - 4px);
    left: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blog-accent);
    box-shadow: 0 0 0 4px rgba(26, 188, 156, 0.16);
}

/* Key takeaway / pull-quote */
#blogdata .blog-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--blog-accent);
    border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
    background: var(--blog-accent-soft);
    color: var(--blog-ink);
}


/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.blog-table-wrapper {
    margin: 1.5rem 0 2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    background: #fff;
    box-shadow: var(--blog-shadow-sm);
}

.blog-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    font-size: 15px;
    line-height: 1.7;
}

.blog-table th,
.blog-table td {
    padding: 0.85rem 1rem;
    border: 0;
    border-bottom: 1px solid var(--blog-border);
    text-align: left;
    vertical-align: top;
}

.blog-table th + th,
.blog-table td + td {
    border-left: 1px solid var(--blog-border);
}

.blog-table th {
    background: var(--blog-surface);
    color: var(--blog-ink);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.blog-table td:first-child {
    color: var(--blog-ink);
    font-weight: 500;
}

.blog-table tbody tr:last-child td {
    border-bottom: 0;
}

.blog-table tbody tr:nth-child(even) td {
    background: #fbfcfd;
}

.blog-table tbody tr:hover td {
    background: var(--blog-accent-soft);
}

.blog-table-wrapper.is-scrollable:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: 2px;
}

/* Phones: each row becomes a labelled card instead of a squeezed/scrolling table. */
@media (max-width: 576px) {
    .blog-table-wrapper.is-enhanced {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .blog-table.is-enhanced,
    .blog-table.is-enhanced tbody,
    .blog-table.is-enhanced tr,
    .blog-table.is-enhanced td {
        display: block;
        width: 100%;
    }

    .blog-table.is-enhanced thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .blog-table.is-enhanced tr {
        margin-bottom: 0.85rem;
        overflow: hidden;
        border: 1px solid var(--blog-border);
        border-radius: var(--blog-radius);
        background: #fff;
        box-shadow: var(--blog-shadow-sm);
    }

    .blog-table.is-enhanced tbody tr td {
        padding: 0.55rem 1rem;
        border: 0;
        background: transparent;
    }

    .blog-table.is-enhanced tbody td:first-child {
        padding: 0.8rem 1rem;
        border-bottom: 1px solid var(--blog-border);
        background: var(--blog-surface);
        font-weight: 600;
    }

    .blog-table.is-enhanced tbody td:last-child {
        padding-bottom: 0.9rem;
    }

    .blog-table.is-enhanced td:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.1rem;
        color: var(--blog-muted);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }
}


/* --------------------------------------------------------------------------
   Sidebar: table of contents + related posts
   -------------------------------------------------------------------------- */

@media (min-width: 769px) {
    #rightsidedata {
        position: sticky;
        top: calc(var(--blog-header-h) + 20px);
        max-height: calc(100vh - var(--blog-header-h) - 40px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 4px;
        scrollbar-width: thin;
        scrollbar-color: #cfd8e0 transparent;
    }

    #rightsidedata::-webkit-scrollbar {
        width: 6px;
    }

    #rightsidedata::-webkit-scrollbar-thumb {
        border-radius: 3px;
        background: #cfd8e0;
    }
}

/* Bootstrap's negative row gutters would be clipped by the scrolling sidebar. */
#rightsidedata .row {
    margin-right: 0;
    margin-left: 0;
}

#tablecontents {
    margin-bottom: 2rem;
}

#tablecontents .blog-toc-title,
#rightsidedata > h3 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.85rem;
    color: var(--blog-ink);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#tablecontents .blog-toc-list {
    margin: 0;
    padding: 0;
    border-left: 2px solid var(--blog-border);
    list-style: none;
}

#tablecontents .blog-toc-list li {
    margin: 0;
}

#tablecontents .blog-toc-link {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin-left: -2px;
    padding: 0.45rem 0.6rem 0.45rem 0.85rem;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
    color: var(--blog-muted);
    font-size: 0.875rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#tablecontents .blog-toc-link:hover {
    background: var(--blog-surface);
    color: var(--blog-ink);
}

#tablecontents .blog-toc-link.is-active {
    border-left-color: var(--blog-accent);
    background: var(--blog-accent-soft);
    color: var(--blog-accent-ink);
    font-weight: 600;
}

#tablecontents .blog-toc-link:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: -2px;
}

.blog-toc-num {
    flex: none;
    min-width: 1.4rem;
    color: var(--blog-accent-ink);
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.blog-toc-toggle {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--blog-ink);
    cursor: pointer;
}

.blog-toc-toggle[hidden] {
    display: none;
}

/* Stretch the toggle's hit area over the whole title row. */
.blog-toc-toggle::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.blog-toc-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
    transition: transform 0.25s var(--blog-ease);
}

.blog-toc-toggle:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: 2px;
}

/* Mobile: TOC sits at the top of the article as a collapsible card. */
#tablecontents.is-collapsible {
    margin: 0 0 2rem;
    overflow: hidden;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    background: var(--blog-surface);
}

#tablecontents.is-collapsible .blog-toc-title {
    margin: 0;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
}

#tablecontents.is-collapsible .blog-toc-nav {
    display: none;
    padding: 0 1rem 1rem 1.1rem;
}

#tablecontents.is-collapsible.is-open .blog-toc-nav {
    display: block;
}

#tablecontents.is-open .blog-toc-toggle svg {
    transform: rotate(180deg);
}

/* Related posts */
.relatedpost {
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    background: #fff;
    transition: transform 0.3s var(--blog-ease), box-shadow 0.3s var(--blog-ease), border-color 0.3s ease;
}

.relatedpost a {
    display: block;
    height: 100%;
    color: var(--blog-ink);
    text-decoration: none;
}

.relatedpost img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.5s var(--blog-ease);
}

#rightsidedata .relatedpost p {
    display: -webkit-box;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0.75rem 0.25rem 0.85rem;
    overflow: hidden;
    font-size: 0.9rem !important;
    line-height: 1.45;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.relatedpost:hover,
.relatedpost:focus-within {
    transform: translateY(-3px);
    border-color: rgba(26, 188, 156, 0.45);
    box-shadow: var(--blog-shadow-md);
}

.relatedpost:hover img {
    transform: scale(1.04);
}

.relatedpost:hover p,
.relatedpost a:focus-visible p {
    color: var(--blog-accent-ink);
}

.relatedpost a:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: -2px;
    border-radius: var(--blog-radius);
}


/* --------------------------------------------------------------------------
   FAQ accordion
   -------------------------------------------------------------------------- */

#faqs .accordion {
    overflow: hidden;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    background: #fff;
    box-shadow: var(--blog-shadow-sm);
}

#faqs .accordion-item {
    border: 0;
    border-bottom: 1px solid var(--blog-border);
    border-radius: 0;
    background: transparent;
}

#faqs .accordion-item:last-child {
    border-bottom: 0;
}

#faqs .accordion-header {
    margin: 0;
}

#faqs .accordion-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1.1rem 1.25rem;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: var(--blog-ink);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Hide Bootstrap 5's built-in chevron – the Font Awesome icon is used instead. */
#faqs .accordion-button::after {
    display: none;
}

#faqs .accordion-button:hover {
    background: var(--blog-surface);
}

#faqs .accordion-button:focus {
    outline: none;
    box-shadow: none;
}

#faqs .accordion-button:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: -2px;
}

#faqs .accordion-item.is-open .accordion-button {
    color: var(--blog-accent-ink);
}

#faqs .accordion-button strong {
    color: inherit;
    font-weight: 600;
}

#faqs .accordion-button .fa {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--blog-surface);
    color: var(--blog-muted);
    font-size: 13px;
    transition: transform 0.18s ease-out, background-color 0.15s ease, color 0.15s ease;
}

#faqs .accordion-button .fa.rotate {
    transform: rotate(180deg);
    background: var(--blog-accent-ink);
    color: #fff;
}

#faqs .accordion-body {
    padding: 0;
    background: #fff;
    color: var(--blog-text);
    font-size: 16px;
}

#faqs .accordion-body > * {
    min-height: 0;
    margin: 0;
    padding: 0 1.25rem 1.15rem;
}

/* Closed answers are hidden only when JS runs (blog.js animates the height);
   without JS every answer stays visible. !important overrides inline styles
   left behind by any older accordion script. */
.blog-js #faqs .accordion-body {
    display: none !important;
    overflow: hidden;
}

.blog-js #faqs .accordion-item.is-open .accordion-body,
.blog-js #faqs .accordion-body.is-animating {
    display: block !important;
}


/* --------------------------------------------------------------------------
   Back-to-top button with reading-progress ring
   -------------------------------------------------------------------------- */

.blog-to-top {
    position: fixed;
    right: var(--blog-fab-offset);
    bottom: var(--blog-fab-offset);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--blog-shadow-md);
    color: var(--blog-ink);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s var(--blog-ease), color 0.2s ease, visibility 0s linear 0.25s;
}

.blog-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.25s ease, transform 0.25s var(--blog-ease), color 0.2s ease, visibility 0s;
}

.blog-to-top:hover {
    color: var(--blog-accent-ink);
}

.blog-to-top:focus-visible {
    outline: 2px solid var(--blog-accent-ink);
    outline-offset: 3px;
}

.blog-to-top__icon {
    position: relative;
    width: 18px;
    height: 18px;
}

.blog-to-top__ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.blog-to-top__ring circle {
    fill: none;
    stroke-width: 3;
}

.blog-to-top__track {
    stroke: var(--blog-border);
}

.blog-to-top__value {
    stroke: var(--blog-accent);
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}


/* --------------------------------------------------------------------------
   Toast (e.g. "Link copied")
   -------------------------------------------------------------------------- */

.blog-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 1080;
    max-width: calc(100vw - 32px);
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    background: var(--blog-ink);
    box-shadow: var(--blog-shadow-md);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity 0.25s ease, transform 0.25s var(--blog-ease);
}

.blog-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}


/* --------------------------------------------------------------------------
   Accessibility & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .blog-wrapper *,
    .blog-wrapper *::before,
    .blog-to-top,
    .blog-toast {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

@media print {
    .progress-container,
    #rightsidedata,
    #tablecontents,
    .blog-to-top,
    .blog-toast,
    .blog-heading-anchor,
    .share-blog {
        display: none !important;
    }

    .blog-js #faqs .accordion-body {
        display: block !important;
    }

    #blogdata a[href^="http"]::after {
        content: " (" attr(href) ")";
        color: #555;
        font-size: 0.8em;
    }

    .blog-table-wrapper,
    .blog-table tr {
        break-inside: avoid;
        box-shadow: none;
    }
}
