@import "./section-common.css";

.blogs-section {
    padding-top: calc(var(--nav-offset) + var(--sec-pad-y));
}

.blogs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-top: var(--sec-gap);
}

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.blog-card:hover {
    border-color: var(--brand-line);
    transform: translateY(-2px);
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: DM Sans;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.blog-card-category {
    color: var(--brand-bright);
}

.blog-card-date {
    color: var(--text-4);
}

.blog-card-title {
    font-family: DM Sans;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
}

.blog-card-excerpt {
    font-family: DM Sans;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-3);
    margin: 0;
    /* No flex-grow: it would stretch the box past the clamp height and let a
       4th line show through half-cut. .blog-card-cta's margin-top:auto is what
       pins the footer to the bottom of the card instead. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.blog-card-tag {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: DM Sans;
    font-size: 11px;
    color: var(--text-3);
}

.blog-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: DM Sans;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-bright);
    margin-top: auto;
}

.blog-card svg {
    transition: transform 0.2s ease;
}

.blog-card:hover svg {
    transform: translateX(3px);
}

.blogs-empty {
    padding: 64px 0;
    text-align: center;
    color: var(--text-3);
    font-family: DM Sans;
}

.blogs-empty-link {
    color: var(--brand-bright);
    text-decoration: none;
    font-weight: 500;
}

.blogs-empty-link:hover {
    text-decoration: underline;
}

/* --- Pagination ---------------------------------------------------------- */

.blog-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 48px;
}

.blog-pagination-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.blog-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    font-family: DM Sans;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-3);
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.blog-page-link:hover {
    border-color: var(--brand-line);
    color: var(--text);
}

.blog-page-link.is-current {
    background: var(--brand-solid);
    border-color: var(--brand-solid);
    color: #ffffff;
}

.blog-page-link.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.blog-page-gap {
    padding: 0 4px;
    color: var(--text-4);
    font-family: DM Sans;
    font-size: 14px;
}

/* --- Detail page --------------------------------------------------------- */

.blog-detail-section {
    padding-top: calc(var(--nav-offset) + var(--sec-pad-y));
}

.blog-detail-inner {
    max-width: 760px;
}

.blog-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: DM Sans;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-bright);
    text-decoration: none;
    margin-bottom: 32px;
}

.blog-back-link svg {
    transform: rotate(180deg);
}

.blog-detail-meta {
    font-family: DM Sans;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--brand-bright);
    margin: 0 0 16px;
}

.blog-detail-title {
    max-width: none;
    margin-bottom: 20px;
}

.blog-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.blog-detail-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin-bottom: 32px;
    display: block;
}

.blog-detail-content {
    padding-top: 32px;
    border-top: var(--rule);
    font-family: DM Sans;
    font-size: 17px;
    font-weight: 300;
    line-height: 1.65;
    letter-spacing: -0.01em;
    color: var(--text-2);
}

.blog-detail-content > * + * {
    margin-top: 20px;
}

/* Backstop for WYSIWYG markup that sanitizeCmsHtml didn't reach (e.g. a color
   set via a class rather than an inline style): keep article text on the
   theme's own colour rather than the editor's baked-in black. Links and the
   headings below opt back out. */
.blog-detail-content :where(p, span, div, li, td, th, b, strong, em, i, u, h1, h2, h3, h4, h5, h6) {
    color: inherit;
}

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

/* The editor emits Bootstrap grid markup; without Bootstrap loaded these are
   plain divs, so stop them collapsing to zero-width or forcing overflow. */
.blog-detail-content :where(.container, .row, [class^="col-"], [class*=" col-"]) {
    width: auto;
    max-width: 100%;
    margin-inline: 0;
    padding-inline: 0;
    float: none;
}

.blog-detail-content h2,
.blog-detail-content h3 {
    font-family: DM Sans;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-top: 36px;
}

.blog-detail-content h2 {
    font-size: 24px;
}

.blog-detail-content h3 {
    font-size: 19px;
}

.blog-detail-content ul,
.blog-detail-content ol {
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blog-detail-content a {
    color: var(--brand-bright);
}

.blog-detail-content strong {
    color: var(--text);
    font-weight: 500;
}

.blog-detail-content blockquote {
    border-left: 2px solid var(--brand-line);
    padding-left: 20px;
    color: var(--text-3);
}

@media (max-width: 480px) {
    .blog-card {
        padding: 22px;
    }
}
