/**
 * CTX Widgets & Homepage Styles
 *
 * Sidebar widget styles, homepage section layouts, and responsive breakpoints.
 * Uses SmartMag CSS custom properties for color consistency.
 */

/* ==========================================================================
   1. Recent Posts Widget
   ========================================================================== */

.ctx-recent-posts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ctx-rp-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--c-separator, #e8e8e8);
}

.ctx-rp-item:first-child {
    padding-top: 0;
}

.ctx-rp-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ctx-rp-thumb {
    flex-shrink: 0;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
    line-height: 0;
}

.ctx-rp-thumb img {
    display: block;
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.ctx-rp-item:hover .ctx-rp-thumb img {
    opacity: 0.85;
}

.ctx-rp-content {
    flex: 1;
    min-width: 0;
}

.ctx-rp-title {
    display: block;
    font-size: var(--title-size-xs, 14px);
    font-weight: 600;
    line-height: 1.4;
    color: var(--c-headings, #161616);
    font-family: var(--title-font, var(--ui-font, var(--body-font)));
    transition: color 0.2s ease;
}

.ctx-rp-title:hover {
    color: var(--c-main, #2ab391);
}

.ctx-rp-date {
    display: block;
    font-size: 12px;
    color: var(--c-post-meta, #8a8a8a);
    margin-top: 4px;
    line-height: 1.3;
}

/* ==========================================================================
   2. Categories Widget
   ========================================================================== */

.ctx-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ctx-cat-item {
    border-bottom: 1px solid var(--c-separator, #e8e8e8);
}

.ctx-cat-item:last-child {
    border-bottom: none;
}

.ctx-cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    color: var(--c-headings, #161616);
    font-size: var(--text-size, 14px);
    transition: color 0.2s ease;
}

.ctx-cat-link:hover {
    color: var(--c-main, #2ab391);
}

.ctx-cat-name {
    font-weight: 500;
    transition: color 0.2s ease;
}

.ctx-cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-contrast-500, #777);
    background: var(--c-contrast-50, #f7f7f7);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.ctx-cat-link:hover .ctx-cat-count {
    background: var(--c-main, #2ab391);
    color: #fff;
}

/* ==========================================================================
   3. CTX Dynamic Homepage — Container & Sections
   Production-tested layout from udaipurtourism.com (Feb 2026)
   Uses CSS Grid for reliable, self-contained layout.
   ========================================================================== */

.hp-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 0;
}

.hp-sec {
    margin-bottom: 40px;
}

/* Section heading with accent underline */
.hp-head {
    border-bottom: 2px solid var(--c-main, #2ec4b6);
    margin-bottom: 20px;
    padding-bottom: 8px;
    overflow: hidden;
}

.hp-head h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--c-headings, #222);
    float: left;
}

.hp-head a.hp-va {
    float: right;
    font-size: 13px;
    color: var(--c-main, #2ec4b6);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 28px;
}

/* ==========================================================================
   4. Hero Section — 3-Column Overlay Grid
   ========================================================================== */

.hp-ogrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.hp-ov {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    min-height: 280px;
    background-size: cover;
    background-position: center;
    background-color: #555;
}

.hp-ov-c {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 20px 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.hp-ov h3 {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.4;
}

.hp-ov h3 a {
    color: #fff;
    text-decoration: none;
}

.hp-ov .hp-d {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* ==========================================================================
   5. Two-Column Layout — Featured Card + List Items
   ========================================================================== */

.hp-2c {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* ==========================================================================
   6. Grid Layouts — 3-col and 2-col
   ========================================================================== */

.hp-3g {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.hp-2g {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

/* ==========================================================================
   7. Card Styles — Featured cards, grid cards
   ========================================================================== */

.hp-cd {
    margin-bottom: 25px;
}

.hp-cd img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
}

.hp-cd .hp-iw {
    display: block;
    margin-bottom: 10px;
}

/* Category badge */
.hp-cd .hp-bg {
    display: inline-block;
    background: var(--c-main, #2ec4b6);
    color: #fff;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 6px;
    text-decoration: none;
    border-radius: 2px;
}

.hp-cd h3 {
    margin: 0 0 4px;
    font-size: 17px;
    line-height: 1.4;
}

.hp-cd h3 a {
    color: var(--c-headings, #222);
    text-decoration: none;
}

.hp-cd .hp-d {
    color: #999;
    font-size: 13px;
}

.hp-cd .hp-ex {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 6px 0 0;
}

/* ==========================================================================
   8. List Items — Compact rows with thumbnail
   ========================================================================== */

.hp-li {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--c-separator, #eee);
}

.hp-li img {
    width: 110px;
    height: 75px;
    object-fit: cover;
    display: block;
    border-radius: 3px;
    flex-shrink: 0;
    margin-right: 15px;
}

.hp-li-t {
    flex: 1;
}

.hp-li h4 {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.35;
}

.hp-li h4 a {
    color: var(--c-headings, #222);
    text-decoration: none;
}

.hp-li .hp-d {
    color: #999;
    font-size: 12px;
}

/* ==========================================================================
   9. Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .hp-ogrid {
        grid-template-columns: 1fr;
    }

    .hp-2c {
        grid-template-columns: 1fr;
    }

    .hp-3g {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .hp-3g {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   10. Dark Mode Support
   ========================================================================== */

.s-dark .ctx-rp-title,
.s-dark .ctx-cat-link {
    color: var(--c-headings);
}

.s-dark .ctx-cat-count {
    color: var(--c-contrast-400);
    background: var(--c-contrast-100);
}

.s-dark .ctx-rp-item,
.s-dark .ctx-cat-item {
    border-color: var(--c-separator);
}

.s-dark .hp-cd h3 a,
.s-dark .hp-li h4 a {
    color: var(--c-headings);
}

.s-dark .hp-li {
    border-color: var(--c-separator);
}

.s-dark .hp-head {
    border-color: var(--c-main);
}

.s-dark .hp-head h4 {
    color: var(--c-headings);
}
