/*
 * Blog styles for phppointofsale.com
 *
 * Loaded only on /blog and /blog/<slug>. Typography, colours and buttons reuse
 * the main site's palette so the blog reads as part of the website rather than
 * an embedded application.
 *
 * Layout rules that the migration depends on:
 *   - wide comparison tables scroll inside their own container, never the page
 *   - images are fluid and never overflow their column
 *   - the table of contents is a sticky sidebar on desktop and a collapsible
 *     block above the article on smaller screens
 */

.blog-page {
    --blog-accent: #3995E4;
    --blog-accent-dark: #1976DF;
    --blog-ink: #2B2B2B;
    --blog-heading: #091124;
    --blog-muted: #707070;
    --blog-rule: #e3e8ef;
    --blog-tint: #EFF6FC;
    --blog-surface: #ffffff;
    --blog-radius: 12px;
    --blog-measure: 720px;
}

.blog-page .blog-container {
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 20px;
}

/* Keep long unbroken strings (URLs, SKUs) from forcing a horizontal scrollbar. */
.blog-page .blog-prose,
.blog-page .blog-card,
.blog-page .blog-article-header {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ---------------------------------------------------------------- article */

.blog-article-header {
    padding-top: 34px;
}

.blog-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: 14px;
    color: var(--blog-muted);
}

.blog-breadcrumb li + li::before {
    content: "/";
    margin-right: 8px;
    color: #b9c2ce;
}

.blog-breadcrumb a {
    color: var(--blog-muted);
    text-decoration: none;
}

.blog-breadcrumb a:hover,
.blog-breadcrumb a:focus {
    color: var(--blog-accent);
    text-decoration: underline;
}

.blog-eyebrow {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blog-accent);
}

.blog-article-title {
    margin: 0 0 20px;
    max-width: 22ch;
    font-size: clamp(30px, 5vw, 50px);
    line-height: 1.16;
    font-weight: 700;
    color: var(--blog-heading);
    text-wrap: balance;
}

.blog-byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 15px;
    color: var(--blog-muted);
}

.blog-author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.blog-author-name {
    font-weight: 600;
    color: var(--blog-heading);
}

.blog-byline-separator {
    color: #c3cbd6;
}

.blog-hero {
    margin: 28px 0 0;
}

.blog-hero-img {
    width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    display: block;
}

/* ----------------------------------------------------------------- layout */

.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 48px;
    align-items: start;
    padding: 40px 0 10px;
}

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

/*
 * width:100% pins the column to its grid track. Without it a wide table (which
 * keeps a min-width so its columns stay readable) stretches this item past the
 * track and the whole page scrolls sideways instead of just the table.
 */
.blog-content {
    width: 100%;
    min-width: 0;
    max-width: var(--blog-measure);
}

.blog-layout-single .blog-content {
    margin-inline: auto;
}

/* ------------------------------------------------------ table of contents */

.blog-toc a {
    color: var(--blog-ink);
    text-decoration: none;
}

.blog-toc a:hover,
.blog-toc a:focus {
    color: var(--blog-accent);
    text-decoration: underline;
}

.blog-toc-list {
    margin: 0;
    padding-left: 20px;
    font-size: 15px;
    line-height: 1.5;
}

.blog-toc-list li {
    margin-bottom: 9px;
}

.blog-toc-sublist {
    margin: 9px 0 0;
    padding-left: 18px;
    list-style: lower-alpha;
    color: var(--blog-muted);
}

.blog-toc-sticky {
    position: sticky;
    top: 96px;
    padding: 22px;
    border: 1px solid var(--blog-rule);
    border-radius: var(--blog-radius);
    background: var(--blog-surface);
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.blog-toc-title {
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

/* The inline copy is for narrow screens; the sidebar covers desktop. */
.blog-toc-inline {
    display: none;
    margin-bottom: 30px;
    border: 1px solid var(--blog-rule);
    border-radius: var(--blog-radius);
    background: var(--blog-tint);
}

.blog-toc-inline summary {
    padding: 14px 18px;
    font-weight: 700;
    color: var(--blog-heading);
    cursor: pointer;
}

.blog-toc-inline .blog-toc-list {
    padding: 0 18px 18px 38px;
}

/* ------------------------------------------------------------------ prose */

.blog-prose {
    font-size: 18px;
    line-height: 1.72;
    color: var(--blog-ink);
}

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

.blog-prose p {
    margin: 0 0 1.35em;
}

.blog-prose h2 {
    margin: 2.1em 0 0.6em;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.25;
    font-weight: 700;
    color: var(--blog-heading);
    scroll-margin-top: 100px;
}

.blog-prose h3 {
    margin: 1.8em 0 0.5em;
    font-size: clamp(20px, 2.4vw, 24px);
    line-height: 1.3;
    font-weight: 700;
    color: var(--blog-heading);
    scroll-margin-top: 100px;
}

.blog-prose h4 {
    margin: 1.6em 0 0.45em;
    font-size: 19px;
    line-height: 1.35;
    font-weight: 700;
    color: var(--blog-heading);
    scroll-margin-top: 100px;
}

.blog-prose ul,
.blog-prose ol {
    margin: 0 0 1.35em;
    padding-left: 26px;
}

.blog-prose li {
    margin-bottom: 0.55em;
}

.blog-prose li > ul,
.blog-prose li > ol {
    margin: 0.55em 0 0;
}

.blog-prose a {
    color: var(--blog-accent-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-prose a:hover,
.blog-prose a:focus {
    color: var(--blog-accent);
}

.blog-prose strong {
    font-weight: 700;
    color: var(--blog-heading);
}

.blog-prose blockquote {
    margin: 1.6em 0;
    padding: 4px 0 4px 22px;
    border-left: 4px solid var(--blog-accent);
    color: var(--blog-heading);
    font-style: italic;
}

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

.blog-prose hr {
    margin: 2.4em 0;
    border: 0;
    border-top: 1px solid var(--blog-rule);
}

.blog-prose code {
    padding: 2px 6px;
    border-radius: 5px;
    background: #f2f5f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.blog-code {
    margin: 0 0 1.5em;
    padding: 18px 20px;
    border-radius: var(--blog-radius);
    background: #0f172a;
    color: #e2e8f0;
    overflow-x: auto;
}

.blog-code code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: 14px;
    line-height: 1.6;
}

/* Images and figures never exceed their column. */
.blog-prose img,
.blog-figure img {
    max-width: 100%;
    height: auto;
}

.blog-figure {
    margin: 2em 0;
}

.blog-figure-img {
    width: 100%;
    border-radius: var(--blog-radius);
    display: block;
}

.blog-figure figcaption {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--blog-muted);
    text-align: center;
}

/* ----------------------------------------------------------------- tables */

/*
 * Wide comparison tables scroll inside this wrapper. It is focusable so the
 * scroll region is reachable by keyboard, which is why it also carries a
 * visible focus ring.
 */
.blog-table-wrap {
    margin: 1.8em 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--blog-rule);
    border-radius: var(--blog-radius);
}

.blog-table-wrap:focus-visible {
    outline: 3px solid var(--blog-accent);
    outline-offset: 2px;
}

.blog-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 16px;
    background: var(--blog-surface);
}

.blog-table th,
.blog-table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--blog-rule);
}

.blog-table thead th {
    background: var(--blog-tint);
    color: var(--blog-heading);
    font-weight: 700;
    white-space: nowrap;
}

.blog-table tbody tr:last-child td {
    border-bottom: 0;
}

.blog-table tbody tr:nth-child(even) {
    background: #fafbfd;
}

/* ------------------------------------------------------------- disclaimer */

.blog-disclaimer {
    margin: 40px 0 10px;
    padding: 18px 20px;
    border-left: 3px solid var(--blog-rule);
    background: #f7f9fc;
    border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
}

.blog-disclaimer p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--blog-muted);
}

/* ------------------------------------------------------------ index/cards */

.blog-index-header {
    padding: 40px 0 8px;
}

.blog-index-title {
    margin: 0 0 14px;
    font-size: clamp(32px, 5vw, 50px);
    line-height: 1.15;
    font-weight: 700;
    color: var(--blog-heading);
}

.blog-index-tagline {
    max-width: 62ch;
    margin: 0;
    font-size: 18px;
    line-height: 1.65;
    color: var(--blog-muted);
}

.blog-section-title {
    margin: 46px 0 22px;
    font-size: 26px;
    font-weight: 700;
    color: var(--blog-heading);
}

.blog-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding-bottom: 10px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--blog-rule);
    border-radius: var(--blog-radius);
    background: var(--blog-surface);
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.blog-card:hover {
    box-shadow: 0 12px 30px rgba(9, 17, 36, 0.1);
    transform: translateY(-2px);
}

.blog-card-media {
    display: block;
    line-height: 0;
    background: var(--blog-tint);
}

.blog-card-img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
}

.blog-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px;
}

.blog-card-title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 700;
}

.blog-card-title a {
    color: var(--blog-heading);
    text-decoration: none;
}

.blog-card-title a:hover,
.blog-card-title a:focus {
    color: var(--blog-accent-dark);
    text-decoration: underline;
}

.blog-card-excerpt {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--blog-ink);
}

.blog-card-meta {
    margin: auto 0 14px;
    font-size: 14px;
    color: var(--blog-muted);
}

.blog-card-cta {
    margin: 0;
}

.blog-card-link {
    font-weight: 600;
    color: var(--blog-accent-dark);
    text-decoration: none;
}

.blog-card-link:hover,
.blog-card-link:focus {
    text-decoration: underline;
}

.blog-empty {
    padding: 40px 0 60px;
    font-size: 18px;
    color: var(--blog-muted);
}

/* ------------------------------------------------------------- pagination */

.blog-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.blog-pagination a,
.blog-pagination-current {
    display: inline-block;
    min-width: 42px;
    padding: 9px 12px;
    border: 1px solid var(--blog-rule);
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: var(--blog-ink);
}

.blog-pagination-current {
    background: var(--blog-accent);
    border-color: var(--blog-accent);
    color: #fff;
    font-weight: 700;
}

/* -------------------------------------------------------------- related/CTA */

.blog-related {
    padding: 20px 0 10px;
    border-top: 1px solid var(--blog-rule);
    margin-top: 50px;
}

.blog-cta {
    margin: 56px 0 0;
    padding: 0 0 64px;
}

.blog-cta-inner {
    padding: 44px 36px;
    border-radius: 18px;
    background: linear-gradient(135deg, #091124 0%, #14284d 100%);
    color: #fff;
    text-align: center;
}

.blog-cta-title {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.4vw, 34px);
    font-weight: 700;
    color: #fff;
}

.blog-cta-text {
    max-width: 60ch;
    margin: 0 auto 26px;
    font-size: 17px;
    line-height: 1.65;
    color: #cdd7e6;
}

.blog-cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin: 0;
}

.blog-btn {
    display: inline-block;
    padding: 13px 26px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.blog-btn-primary {
    background: var(--blog-accent);
    color: #fff;
}

.blog-btn-primary:hover,
.blog-btn-primary:focus {
    background: #57a8ec;
    color: #fff;
}

.blog-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.blog-btn-secondary:hover,
.blog-btn-secondary:focus {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.blog-btn-link {
    color: #9fc6f2;
    padding-inline: 8px;
}

.blog-btn-link:hover,
.blog-btn-link:focus {
    color: #fff;
}

/* ------------------------------------------------------------ a11y basics */

.blog-page .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.blog-page a:focus-visible,
.blog-page summary:focus-visible {
    outline: 3px solid var(--blog-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

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

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

/* ------------------------------------------------------------- responsive */

@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .blog-content {
        max-width: none;
        margin-inline: auto;
    }

    .blog-sidebar {
        display: none;
    }

    .blog-toc-inline {
        display: block;
    }
}

@media (max-width: 640px) {
    .blog-page .blog-container {
        padding-inline: 16px;
    }

    .blog-prose {
        font-size: 17px;
    }

    .blog-article-title {
        max-width: none;
    }

    .blog-card-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    .blog-cta-inner {
        padding: 32px 20px;
    }

    .blog-cta-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Narrowest supported width (320px): keep gutters usable and nothing clipped. */
@media (max-width: 360px) {
    .blog-page .blog-container {
        padding-inline: 14px;
    }

    .blog-table {
        min-width: 420px;
    }
}

@media print {
    .blog-sidebar,
    .blog-toc-inline,
    .blog-cta,
    .blog-related {
        display: none;
    }
}
