/*
 * Article surfaces — single.php (post detail) and the post archive grid.
 * Ports _mockup-article.html. Mobile-first; sidebar collapses below body
 * under 1200px and goes sticky at >=1200px.
 */

/* === Hero ============================================================= */
.rm-article-hero {
    position: relative;
    height: 340px;
    overflow: hidden;
    background: var(--rm-charcoal);
}
.rm-article-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.55);
}
.rm-article-hero__content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--rm-sp-5) var(--rm-sp-4);
    color: var(--rm-white);
}
.rm-article-hero__content .rm-container { width: 100%; }
.rm-article-hero__eyebrow {
    display: inline-block;
    background: var(--rm-red);
    padding: 5px 12px;
    font-family: var(--rm-font-h);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: var(--rm-fs-xs);
    border-radius: 3px;
    margin-bottom: var(--rm-sp-3);
    align-self: flex-start;
    color: var(--rm-white);
}
.rm-article-hero h1 {
    color: var(--rm-white);
    font-size: 1.8rem;
    text-transform: uppercase;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1.05;
}
.rm-article-hero__meta {
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--rm-fs-sm);
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.rm-article-hero__meta .by { display: flex; align-items: center; gap: 8px; }
.rm-article-hero__meta .rm-avatar-sm {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--rm-mid-gray);
    object-fit: cover;
}

/* === Layout: body + sidebar =========================================== */
.rm-article-layout {
    display: flex;
    flex-direction: column;
    gap: var(--rm-sp-5);
    padding: var(--rm-sp-5) var(--rm-sp-4);
    max-width: var(--rm-container-max);
    margin: 0 auto;
}

/* === Body ============================================================= */
.rm-article-body {
    font-family: var(--rm-font-b);
    font-size: var(--rm-fs-md);
    line-height: 1.7;
    color: var(--rm-charcoal);
}
.rm-article-body .lead,
.rm-article-body > p:first-of-type {
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--rm-charcoal);
    font-weight: 500;
    border-left: 4px solid var(--rm-red);
    padding-left: 14px;
    margin-bottom: 22px;
}
/* Don't apply lead style if author already used a .lead class — avoid double. */
.rm-article-body p.lead + p,
.rm-article-body p:not(.lead) ~ p:first-of-type { border-left: none; padding-left: 0; }

.rm-article-body p { margin: 0 0 18px; }
.rm-article-body h2 {
    font-size: 1.4rem;
    text-transform: none;
    letter-spacing: 0;
    margin: 24px 0 10px;
}
.rm-article-body h3 {
    font-size: 1.15rem;
    margin: 20px 0 8px;
}
.rm-article-body figure { margin: 22px 0; }
.rm-article-body figure img { border-radius: var(--radius-sm); }
.rm-article-body figcaption {
    font-size: var(--rm-fs-xs);
    color: var(--rm-mid-gray);
    margin-top: 6px;
    font-style: italic;
    text-align: center;
}
.rm-article-body blockquote {
    border-left: 4px solid var(--rm-accent);
    padding: 6px 16px;
    margin: 22px 0;
    font-size: 1.05rem;
    font-family: var(--rm-font-h);
    font-weight: 500;
    color: var(--rm-charcoal);
}
.rm-article-body a {
    color: var(--rm-red);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.rm-article-body img { border-radius: var(--radius-sm); }
.rm-article-body ul,
.rm-article-body ol { padding-left: 1.4em; margin-bottom: 18px; }
.rm-article-body li { margin-bottom: 6px; }

/* === Sidebar ========================================================== */
.rm-side-card {
    background: var(--rm-white);
    border: 1px solid var(--rm-border);
    border-radius: var(--radius-sm);
    padding: var(--rm-sp-4);
    margin-bottom: 14px;
}
.rm-side-card h4 {
    margin: 0 0 10px;
    font-size: var(--rm-fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--rm-red);
}
.rm-side-card .author {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}
.rm-side-card .author .rm-avatar-md {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--rm-mid-gray);
    flex-shrink: 0;
    object-fit: cover;
}
.rm-side-card .author b {
    font-family: var(--rm-font-h);
    font-size: var(--rm-fs-md);
    display: block;
}
.rm-side-card .author span {
    color: var(--rm-mid-gray);
    font-size: var(--rm-fs-xs);
    display: block;
}
.rm-side-card .rm-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.rm-side-card .rm-related-list li {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rm-border);
}
.rm-side-card .rm-related-list li:last-child { border-bottom: none; }
.rm-side-card .rm-related-list a {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    color: inherit;
}
.rm-side-card .rm-related-list .r-img {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-sm);
    background: var(--rm-light-gray);
    overflow: hidden;
    flex-shrink: 0;
}
.rm-side-card .rm-related-list .r-img img {
    width: 100%; height: 100%; object-fit: cover;
}
.rm-side-card .rm-related-list .r-title {
    font-family: var(--rm-font-h);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
}
.rm-side-card .rm-related-list .r-price {
    color: var(--rm-red);
    font-weight: 700;
    font-size: 0.88rem;
    margin-top: 2px;
}
.rm-side-card .share {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.rm-side-card .share a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rm-light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rm-charcoal);
    text-decoration: none;
}

/* === Article-archive left sidebar (home.php + archive.php) ============ */
.rm-article-layout-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--rm-sp-5);
}
.rm-article-layout-wrap__main { min-width: 0; }

.rm-article-sidebar {
    border-top: 2px solid var(--rm-red);
    padding-top: var(--rm-sp-3);
}
.rm-article-sidebar__title {
    font-family: var(--rm-font-h);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.95rem;
    margin: 0 0 var(--rm-sp-2);
    color: var(--rm-charcoal);
}
.rm-article-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    /* Mobile: horizontal-scroll chip strip so it doesn't push the grid down. */
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.rm-article-sidebar__list li { flex: 0 0 auto; scroll-snap-align: start; }
.rm-article-sidebar__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--rm-light-gray);
    color: var(--rm-charcoal);
    border-radius: 999px;
    font-family: var(--rm-font-h);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    white-space: nowrap;
    min-height: 36px;
}
.rm-article-sidebar__link:hover { background: var(--rm-border); }
.rm-article-sidebar__link.is-active {
    background: var(--rm-red);
    color: var(--rm-white);
}
.rm-article-sidebar__count {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.rm-article-sidebar__link.is-active .rm-article-sidebar__count {
    background: rgba(255, 255, 255, 0.22);
}

/* === Tablet (>=720px) ================================================= */
@media (min-width: 720px) {
    .rm-article-hero { height: 420px; }
    .rm-article-hero h1 { font-size: 2.4rem; }
}

/* === Desktop (>=1024px) — sidebar moves to the left rail ============== */
@media (min-width: 1024px) {
    .rm-article-layout-wrap {
        display: grid;
        grid-template-columns: 240px 1fr;
        gap: var(--rm-sp-5);
        align-items: start;
    }
    .rm-article-sidebar {
        border-top: none;
        padding-top: 0;
        position: sticky;
        top: 90px;
    }
    .rm-article-sidebar__list {
        flex-direction: column;
        gap: 4px;
        overflow: visible;
    }
    .rm-article-sidebar__link {
        display: flex;
        justify-content: space-between;
        width: 100%;
        border-radius: var(--radius-sm);
    }
}

/* === Desktop (>=1200px) — sidebar goes to the right + sticky ========== */
@media (min-width: 1200px) {
    .rm-article-hero { height: 520px; }
    .rm-article-hero h1 { font-size: 3.4rem; }
    .rm-article-body { font-size: 1.08rem; line-height: 1.75; }
    .rm-article-body .lead { font-size: 1.25rem; padding-left: 18px; }
    .rm-article-body h2 { font-size: 1.7rem; }

    .rm-article-layout {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 48px;
        padding: 60px var(--rm-sp-5);
    }
    .rm-article-side {
        position: sticky;
        top: 90px;
        align-self: start;
    }
}

/* ---- Article archive LIST layout (parallel to .rm-product-list on /shop/) -- *
 * One article per row: thumb (left), title+excerpt+meta (middle), "Read article"
 * CTA on the right. Stacks single-column on mobile, becomes 3-zone horizontal
 * row from ≥720px. Used on /articles/, category, tag, and author archives. */
.rm-article-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--rm-border);
}
.rm-article-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--rm-border);
    align-items: start;
}
@media (min-width: 720px) {
    .rm-article-row {
        grid-template-columns: 200px 1fr 160px;
        gap: 24px;
        padding: 22px 0;
        align-items: center;
    }
}
.rm-article-row__img {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--rm-light-gray);
    border-radius: var(--radius-sm);
}
.rm-article-row__img img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--rm-dur-base) var(--rm-ease);
}
.rm-article-row__img:hover img { transform: scale(1.04); }

.rm-article-row__body { min-width: 0; }
.rm-article-row__tag {
    display: inline-block;
    background: var(--rm-red);
    color: var(--rm-white);
    padding: 3px 10px;
    font-family: var(--rm-font-h);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.66rem;
    border-radius: 3px;
    margin-bottom: 8px;
}
.rm-article-row__title {
    font-family: var(--rm-font-h);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 6px;
    color: var(--rm-charcoal);
}
.rm-article-row__title a {
    color: inherit;
    text-decoration: none;
}
.rm-article-row__title a:hover { color: var(--rm-red); }
.rm-article-row__desc {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: var(--rm-mid-gray);
    line-height: 1.5;
}
.rm-article-row__meta {
    display: flex;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--rm-mid-gray);
    align-items: center;
}
.rm-article-row__meta-sep { opacity: 0.5; }

.rm-article-row__actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: stretch;
}
@media (min-width: 720px) {
    .rm-article-row__actions { grid-column: auto; justify-content: flex-end; }
}
.rm-article-row__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rm-charcoal);
    color: var(--rm-white);
    padding: 10px 18px;
    font-family: var(--rm-font-h);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background var(--rm-dur-fast) var(--rm-ease);
    width: 100%;
}
@media (min-width: 720px) {
    .rm-article-row__btn { width: auto; min-width: 140px; }
}
.rm-article-row__btn:hover { background: var(--rm-red); }
