/**
 * 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);
}

/* ==========================================================================
   CTX Homepage — news layout (10.4.2-ctx)
   ========================================================================== */

.hpn { padding-top: 24px; }
.hpn .hp-sec { margin-bottom: 36px; }

.hpn-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    padding-bottom: 0;
    overflow: visible;
}
.hpn-head h2 {
    position: relative;
    margin: 0;
    padding: 0 0 8px;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--c-headings, #161616);
}
.hpn-head h2::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: var(--c-main, #2ec4b6);
}
.hpn-head a.hp-va { float: none; line-height: 1; font-size: 12px; white-space: nowrap; }

.hpn h3 { margin: 0; font-weight: 700; line-height: 1.35; }
.hpn h3 a { color: var(--c-headings, #161616); text-decoration: none; }
.hpn h3 a:hover { color: var(--c-main, #2ec4b6); }

.hpn-badge {
    display: inline-block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--c-main, #2ec4b6);
    text-decoration: none;
}
.hpn-badge:hover { text-decoration: underline; }

.hpn-t { display: block; margin-top: 4px; font-size: 12px; color: #6b7280; }
.hpn-ex { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: #4b5563; }

/* 1. Top Stories */
.hpn-top-g {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 24px;
}
.hpn-lead {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 420px;
    border-radius: 6px;
    overflow: hidden;
    background: #374151 center / cover no-repeat;
}
.hpn-lead-noimg { min-height: 260px; }
.hpn-lead-cover { position: absolute; inset: 0; z-index: 1; }
.hpn-lead-c {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 70px 24px 22px;
    background: linear-gradient(to top, rgba(0, 0, 0, .88), rgba(0, 0, 0, .55) 60%, transparent);
    pointer-events: none;
}
.hpn-lead-c a { pointer-events: auto; }
.hpn-lead .hpn-badge { color: #fff; background: var(--c-main, #2ec4b6); padding: 3px 8px; border-radius: 2px; }
.hpn-lead h3 { font-size: 26px; line-height: 1.25; }
.hpn-lead h3 a, .hpn-lead h3 a:hover { color: #fff; }
.hpn-lead .hpn-ex { color: rgba(255, 255, 255, .85); }
.hpn-lead .hpn-t { color: rgba(255, 255, 255, .75); }

.hpn-side { display: flex; flex-direction: column; }
.hpn-side .hpn-row:first-child { padding-top: 0; }

/* Headline row (side list, category blocks) */
.hpn-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eef0f3;
}
.hpn-row:last-child { border-bottom: 0; }
.hpn-row-img { flex: 0 0 96px; }
.hpn-row-img img { width: 96px; height: 68px; object-fit: cover; border-radius: 4px; display: block; }
.hpn-row-b { min-width: 0; }
.hpn-row h3 { font-size: 15px; }

/* 2. Latest Updates + categories */
.hpn-latest-g {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 32px;
}
.hpn-tl { list-style: none; margin: 0; padding: 0; }
.hpn-tl li {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #eef0f3;
}
.hpn-tl li:last-child { border-bottom: 0; }
.hpn-tl .hpn-t { margin-top: 2px; font-weight: 600; color: var(--c-main, #2ec4b6); }
.hpn-tl .hpn-badge { display: block; margin-bottom: 2px; color: #6b7280; }
.hpn-tl-a { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--c-headings, #161616); text-decoration: none; }
.hpn-tl-a:hover { color: var(--c-main, #2ec4b6); }

.hpn-cats ul { list-style: none; margin: 0; padding: 0; }
.hpn-cats li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #eef0f3;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-headings, #161616);
    text-decoration: none;
}
.hpn-cats li a:hover { color: var(--c-main, #2ec4b6); }
.hpn-cats li b {
    min-width: 28px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #f3f4f6;
    font-size: 12px;
    text-align: center;
    color: #4b5563;
}

/* 3. Category blocks */
.hpn-blocks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 32px;
}
.hpn-block .hpn-card { margin-bottom: 4px; }
.hpn-block .hpn-card-img img { aspect-ratio: 2 / 1; }

/* Cards (category block lead, More Stories) */
.hpn-card-img { display: block; margin-bottom: 10px; }
.hpn-card-img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; display: block; }
.hpn-card h3 { font-size: 18px; }

/* 4. More Stories */
.hpn-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 24px;
}
.hpn-grid .hpn-card h3 { font-size: 16px; }

@media (max-width: 1024px) {
    .hpn-lead { min-height: 360px; }
    .hpn-lead h3 { font-size: 22px; }
    .hpn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .hpn { padding-top: 14px; }
    .hpn-top-g,
    .hpn-latest-g,
    .hpn-blocks,
    .hpn-grid { grid-template-columns: minmax(0, 1fr); }
    .hpn-lead { min-height: 300px; }
    .hpn-lead-c { padding: 60px 16px 16px; }
    .hpn-lead h3 { font-size: 20px; }
    .hpn-lead .hpn-ex { display: none; }
    .hpn-tl li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .hpn-cats li:nth-child(n+9) { display: none; }
    .hpn-row-img { flex-basis: 84px; }
    .hpn-row-img img { width: 84px; height: 60px; }
}
