/* ─────────────────────────────────────────────────────────────────
   Shared blog stylesheet used by PHP-generated /blog/{slug}/ pages.
   Mirrors the design tokens from src/app/globals.css so article pages
   stay visually consistent with the rest of the site until extract-shell.mjs
   replaces the placeholder header/footer with real Next.js markup + CSS.
   ───────────────────────────────────────────────────────────────────── */

:root {
    --color-primary: #5EA183;
    --color-primary-hover: #4E8D72;
    --color-cta: #CB734D;
    --color-cta-hover: #B5623F;
    --color-text: #272C35;
    --color-text-secondary: #6A7181;
    --color-text-green: #15803D;
    --color-border: #E3E5E8;
    --color-bg-light: #F7F7F7;
    --color-success: #16A34A;
    --color-success-light: #F0FDF4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Proxima Nova", "Inter", -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
    letter-spacing: -0.005em;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Site chrome ───────────────────────────────────────────────── */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: saturate(180%) blur(6px);
}
.site-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text);
}
.site-brand__logo { display: inline-flex; }
.site-brand__name {
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
}
.site-brand__name span {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-secondary);
}
.site-nav {
    display: flex;
    gap: 24px;
    font-size: 14px;
    font-weight: 500;
}
.site-nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.site-nav a:hover { color: var(--color-primary); }

.site-main {
    min-height: calc(100vh - 220px);
    padding: 0 0 48px;
}

.site-footer {
    background: var(--color-bg-light);
    border-top: 1px solid var(--color-border);
    padding: 32px 0;
    margin-top: 48px;
}
.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}
.site-footer__brand {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--color-text);
}
.site-footer__links {
    margin: 0 0 16px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
}
.site-footer__links a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.site-footer__links a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}
.site-footer__note {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-secondary);
    max-width: 640px;
    margin-inline: auto;
}

/* ── Article layout ────────────────────────────────────────────── */
.article-shell {
    width: 100%;
    min-width: 0;
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px;
}
.article-breadcrumbs {
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
}
.article-breadcrumbs a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.article-breadcrumbs a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}
.article-breadcrumbs span.sep { margin: 0 6px; }

.article-category-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(94, 161, 131, 0.1);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}

.article-title {
    font-size: 40px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    font-weight: 700;
}
@media (max-width: 600px) {
    .article-title { font-size: 30px; }
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}
.article-meta__author { font-weight: 600; color: var(--color-text); }
.article-meta__dot { color: var(--color-border); }

.article-hero {
    width: 100%;
    border-radius: 12px;
    margin: 0 0 32px;
    overflow: hidden;
    background: var(--color-bg-light);
}
.article-hero img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ── Article body (sanitized HTML) ──────────────────────────────── */
.article-body {
    font-size: 17px;
    line-height: 1.75;
    color: var(--color-text);
    max-width: 75ch;
}
.article-body > :first-child { margin-top: 0; }
.article-body h2 {
    font-size: 1.625em;
    margin: 2em 0 0.6em;
    padding-bottom: 0.35em;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.25;
    font-weight: 700;
}
.article-body h3 {
    font-size: 1.25em;
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
    font-weight: 700;
}
.article-body h4 {
    font-size: 1.05em;
    margin: 1.25em 0 0.5em;
    font-weight: 700;
}
.article-body p {
    margin: 1em 0;
}
.article-body a {
    color: var(--color-primary);
    text-decoration: none;
}
.article-body a:hover { text-decoration: underline; }
.article-body strong { font-weight: 700; color: var(--color-text); }
.article-body em { font-style: italic; }
.article-body ul {
    list-style: disc;
    padding-left: 1.5em;
    margin: 1em 0;
}
.article-body ol {
    list-style: decimal;
    padding-left: 1.5em;
    margin: 1em 0;
}
.article-body li { margin: 0.35em 0; }
.article-body li::marker { color: var(--color-text-secondary); }
.article-body blockquote {
    border-left: 3px solid var(--color-primary);
    padding-left: 1em;
    color: var(--color-text-secondary);
    font-style: italic;
    margin: 1.25em 0;
}
.article-body code {
    background: var(--color-bg-light);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.article-body pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.25em 0;
    font-size: 0.9em;
}
.article-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.25em 0;
}
.article-body hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}
.article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.25em 0;
    font-size: 0.95em;
}
.article-body thead {
    background: var(--color-primary);
}
.article-body thead th {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.75em 1em;
    text-align: left;
}
.article-body tbody td {
    padding: 0.75em 1em;
    border-top: 1px solid var(--color-border);
    vertical-align: top;
}
.article-body tbody tr:first-child td { border-top: none; }

/* ── Article footer ─────────────────────────────────────────────── */
.article-tags {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.article-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
    font-size: 12px;
    text-decoration: none;
}
.article-tag:hover { background: rgba(94, 161, 131, 0.1); color: var(--color-primary); }

/* ── Blog index ─────────────────────────────────────────────────── */
.blog-index-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px;
}
.blog-index-header { margin-bottom: 32px; }
.blog-index-header h1 { font-size: 36px; margin: 0 0 8px; letter-spacing: -0.02em; }
.blog-index-header p { margin: 0; color: var(--color-text-secondary); }

.blog-index-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}
.blog-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.blog-card__cover {
    aspect-ratio: 16/9;
    background: var(--color-bg-light);
    overflow: hidden;
}
.blog-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.blog-card__body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.blog-card__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}
.blog-card__excerpt {
    margin: 0 0 12px;
    color: var(--color-text-secondary);
    font-size: 14px;
    flex: 1;
}
.blog-card__meta {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.blog-pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.blog-pagination a,
.blog-pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
}
.blog-pagination a:hover { background: var(--color-bg-light); }
.blog-pagination .current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────
   Mobile menu panel (PHP pages only).
   The header is a static snapshot of the React header, so its burger
   has no handler; a small inline script in _header.php builds this
   panel and toggles [hidden]. Desktop keeps the normal nav.
   ───────────────────────────────────────────────────────────────── */
.ros-mobile-menu {
    display: flex;
    flex-direction: column;
    padding: 8px 0 12px;
    border-top: 1px solid var(--color-border);
}
.ros-mobile-menu[hidden] { display: none; }
.ros-mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
}
.ros-mobile-menu a:hover { color: var(--color-text); }
@media (min-width: 768px) {
    .ros-mobile-menu { display: none; }
}

/* ─────────────────────────────────────────────────────────────────
   Header search overlay (PHP pages only).
   The header here is a static snapshot with no React, so the search
   buttons are wired by an inline script in _header.php. This is the
   styling for the panel it injects. Mirrors the React overlay.
   ───────────────────────────────────────────────────────────────── */
.ros-search {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    background: rgba(18, 22, 28, 0.5);
    overscroll-behavior: contain;
}
.ros-search[hidden] { display: none; }
.ros-search__panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 36rem;
    max-height: 100%;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.ros-search__bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}
.ros-search__bar svg { width: 20px; height: 20px; flex: none; color: var(--color-text-secondary); }
.ros-search__bar input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    /* 16px: anything smaller makes iOS Safari zoom the page on focus */
    font-size: 16px;
    font-family: inherit;
    color: var(--color-text);
}
.ros-search__close {
    flex: none;
    min-height: 32px;
    padding: 4px 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
}
.ros-search__close:hover { color: var(--color-text); }
.ros-search__results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ros-search__msg { margin: 0; padding: 24px 16px; font-size: 14px; color: var(--color-text-secondary); }
.ros-search__results ul { list-style: none; margin: 0; padding: 4px 0; }
.ros-search__results li { margin: 0; }
.ros-search__results a {
    display: flex;
    align-items: center;
    gap: 12px;
    /* 44px tap target */
    min-height: 44px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
}
.ros-search__results a:hover,
.ros-search__results a.is-active { background: var(--color-bg-light); }
.ros-search__t {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ros-search__d { display: none; }
.ros-search__k {
    flex: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 8px;
}
@media (min-width: 640px) {
    .ros-search { padding-top: 12vh; }
    .ros-search__results a { flex-wrap: wrap; }
    .ros-search__d {
        display: block;
        flex-basis: 100%;
        order: 3;
        font-size: 12px;
        color: var(--color-text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ─────────────────────────────────────────────────────────────────
   Blog affiliate CTA (PHP-rendered articles).
   Appended by ros_blog_cta() in admin/includes/internal-links.php.
   Mirrors the Next.js BlogAffiliateCTA used by the localized blogs.
   ───────────────────────────────────────────────────────────────── */
.ros-blog-cta {
    margin: 40px 0 8px;
    padding: 20px;
    border: 1px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-primary) 6%, #fff);
}
.ros-blog-cta__eyebrow {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
}
.ros-blog-cta__name {
    margin: 8px 0 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}
.ros-blog-cta__name a { color: var(--color-text); text-decoration: none; }
.ros-blog-cta__name a:hover { color: var(--color-primary); }
.ros-blog-cta__score {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-secondary);
    white-space: nowrap;
}
.ros-blog-cta__verdict {
    margin: 8px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--color-text-secondary);
}
.ros-blog-cta__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    margin: 16px 0 0;
}
.ros-blog-cta__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px tap target */
    min-height: 44px;
    padding: 0 22px;
    border-radius: 10px;
    background: var(--color-cta);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}
.ros-blog-cta__btn:hover { background: var(--color-cta-hover); color: #fff; }
.ros-blog-cta__all {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.ros-blog-cta__all:hover { text-decoration: underline; }
.ros-blog-cta__disclosure {
    margin: 14px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}
@media (max-width: 520px) {
    .ros-blog-cta { padding: 16px; }
    .ros-blog-cta__btn { width: 100%; }
}
