/**
 * TEMPLATE T1: Jademond CMS
 * Article Page Layout
 * 
 * Load for: page_type_name = 'article'
 * 
 * Contains: Article hero, two-column layout, article header, sidebar positioning
 */

/* ============================================
   ARTICLE HERO IMAGE
   ============================================ */

.t1-article-hero {
    width: 100%;
    margin-top: 70px; /* Account for fixed header */
    background: var(--ink);
    position: relative;
    overflow: hidden;
}

.t1-article-hero__image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.t1-article-hero__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 1rem 1.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    font-style: italic;
}

/* Adjust article layout when hero is present */
.t1-article-hero + .t1-article-layout {
    padding-top: 0;
}

.t1-article-hero + .t1-article-layout > .container {
    padding-top: 3rem;
}

/* Full-bleed hero variant */
.t1-article-hero--full {
    max-height: 70vh;
}

.t1-article-hero--full .t1-article-hero__image {
    max-height: 70vh;
    min-height: 400px;
}

/* Constrained hero (matches content width) */
.t1-article-hero--constrained {
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    margin-top: 100px;
    padding: 0 1.5rem;
    background: transparent;
}

.t1-article-hero--constrained .t1-article-hero__image {
    border-radius: 12px;
    max-height: 450px;
}

.t1-article-hero--constrained .t1-article-hero__caption {
    position: static;
    background: none;
    color: var(--stone);
    padding: 0.75rem 0 0;
    text-align: center;
}

@media (max-width: 768px) {
    .t1-article-hero__image {
        max-height: 300px;
    }
    
    .t1-article-hero--full .t1-article-hero__image {
        max-height: 50vh;
        min-height: 250px;
    }
}

/* ============================================
   ARTICLE LAYOUT (Two-Column)
   ============================================ */

.t1-article-layout {
    padding-top: 80px; /* Account for fixed header */
    min-height: 100vh;
}

.t1-article-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

/* Two-column layout when sidebar exists */
.t1-article-content:has(.t1-article-sidebar) {
    grid-template-columns: 1fr 320px;
    align-items: start;
}

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
    .t1-article-content {
        grid-template-columns: 1fr 320px;
        align-items: start;
    }
}

.t1-article-main {
    min-width: 0; /* Prevent overflow */
}

.t1-article-sidebar {
    position: sticky;
    top: 100px; /* Below fixed header */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 1024px) {
    .t1-article-content,
    .t1-article-content:has(.t1-article-sidebar) {
        grid-template-columns: 1fr;
    }
    
    .t1-article-sidebar {
        position: static;
        max-height: none;
        border-top: 1px solid var(--pearl);
        padding-top: 2rem;
        margin-top: 1rem;
    }
}

/* ============================================
   ARTICLE HEADER
   ============================================ */

.t1-article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--pearl);
}

.t1-article-header small {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--jade);
    margin-bottom: 0.75rem;
}

.t1-article-header h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 0.75rem;
}

.t1-article-header > p {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--charcoal);
    margin: 0 0 1.25rem;
}

.t1-article-header dl {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    column-gap: 0.375rem;
    row-gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--stone);
    margin: 0;
}

.t1-article-header dt {
    font-weight: 400;
}

.t1-article-header dt::after {
    content: ":";
    margin-right: 0.375rem;
}

.t1-article-header dd {
    margin: 0;
    color: var(--charcoal);
    font-weight: 500;
}

@media (min-width: 640px) {
    .t1-article-header dl {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 1.5rem;
    }
    
    .t1-article-header dd:not(:last-of-type)::after {
        content: "•";
        margin-left: 1.5rem;
        color: var(--stone);
    }
}

/* ============================================
   ARTICLE CTA
   ============================================ */

.t1-article-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--jade-light);
    border-radius: 12px;
    margin: 3rem 0;
}

.t1-article-cta > div {
    flex: 1;
    min-width: 200px;
}

.t1-article-cta strong {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.t1-article-cta p {
    font-size: 0.9375rem;
    color: var(--charcoal);
    margin: 0;
}

.t1-article-cta .btn {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .t1-article-cta {
        flex-direction: column;
        text-align: center;
    }
    
    .t1-article-cta .btn {
        width: 100%;
    }
}

/* ============================================
   LISTINGS INSIDE ARTICLE CONTEXT
   ============================================ */

.t1-article-main .t1-listing {
    padding: 3rem 0;
}

.t1-article-main .t1-listing > hgroup {
    text-align: left;
    margin-bottom: 1.5rem;
}

/* Ensure proper grid columns in article context */
.t1-article-main .t1-listing--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.t1-article-main .t1-listing--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 900px) {
    .t1-article-main .t1-listing,
    .t1-article-main .t1-listing--cols-2,
    .t1-article-main .t1-listing--cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .t1-article-main .t1-listing,
    .t1-article-main .t1-listing--cols-2,
    .t1-article-main .t1-listing--cols-3 {
        grid-template-columns: 1fr;
    }
}
