/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-page: #ffffff;
    --primary-green: #10b981;
    --primary-orange: #f97316;
    --primary-blue: #3b82f6;
    --dark-green: #059669;
    --dark-blue: #1e40af;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-accent: #FF7E5F;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-page);
}

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

/* Navigation */
.navbar {
    background-color: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
}

.house-icon {
    color: var(--primary-green);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--primary-green);
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary-green);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--text-dark);
    transition: all 0.3s;
    transform-origin: center;
}

/* Hero Section */
.hero-section {
    position: relative;
    margin-bottom: 2rem;
    overflow: hidden;
}

.hero-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 380px;
}

.hero-slide {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2.5rem 7vw;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-orange) 100%);
    color: var(--white);
    align-items: center;
}

.hero-slide.active {
    display: grid;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.hero-description {
    font-size: 1.1rem;
    opacity: 0.95;
    line-height: 1.6;
}

.hero-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.hero-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease-out;
}

.hero-image-link {
    text-decoration: none;
    cursor: pointer;
}

.hero-image-link:hover img {
    transform: scale(1.06);
}

.hero-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--primary-orange);
    font-size: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    z-index: 10;
}

.hero-nav:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.hero-nav.prev {
    left: 20px;
}

.hero-nav.next {
    right: 20px;
}

.hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.dot.active {
    background: var(--white);
}

/* Content Sections */
.content-section {
    margin-bottom: 4rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.section-icon {
    color: var(--primary-green);
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
}

.section-description {
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.view-all-btn {
    display: inline-block;
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.view-all-btn:hover {
    color: var(--dark-green);
}

/* Category sections (below Trending) - match reference screenshot */
.category-section .section-header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.category-section .section-title-wrapper {
    justify-content: center;
}

.category-section .section-icon {
    color: #7c3aed; /* subtle purple like reference */
}

.category-section .section-description {
    margin-top: 0.25rem;
}

.category-section .view-all-btn {
    margin-top: 1.25rem;
    padding: 0.85rem 2.2rem;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(90deg, #10b981 0%, #f97316 100%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    font-weight: 700;
}

.category-section .view-all-btn:hover {
    color: #ffffff;
    filter: brightness(0.98);
}

.section-panel {
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.10);
    padding: 2rem;
}

/* Make the old carousel behave like a 3-col grid inside panel */
.category-section .articles-carousel {
    position: relative;
}

.category-section .carousel-container {
    overflow: visible;
    transform: none !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.category-section .carousel-item {
    min-width: 0;
}

.category-section .carousel-nav {
    display: none !important;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Trending Now special layout (desktop) */
.trending-top-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 2rem;
    align-items: stretch;
}

.trending-top-grid .article-card {
    display: flex;
    flex-direction: column;
    position: relative;
}

.trending-top-grid .article-card:first-child {
    grid-column: 1 / 2;
}

.trending-top-grid .article-card:nth-child(2) {
    grid-column: 2 / 3;
}

.trending-bottom-grid {
    margin-top: 2.25rem;
}

/* Ensure images in bottom Trending row have uniform height on desktop */
@media (min-width: 1024px) {
    .trending-bottom-grid .article-image-wrapper {
        aspect-ratio: auto;
        height: 260px;
    }
}

.article-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.article-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--bg-light);
}

.article-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.22s ease-out, transform 0.35s ease-out;
}

.article-image-wrapper img.loaded,
.hero-image img.loaded,
.ad-image-wrapper img.loaded {
    opacity: 1;
}

.article-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    line-height: 1.4;
}

.article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 0.75rem;
}

.article-content > .read-more {
    margin-top: auto;
    padding-top: 0.75rem;
}

.article-excerpt {
    font-size: 0.98rem;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

.article-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.article-date {
    color: var(--text-gray);
}

.read-more {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.read-more:hover {
    color: var(--dark-green);
}

/* Trending Now badge over image */
.trending-section .article-card .article-meta {
    position: absolute;
    top: 18px;
    right: 24px;
    margin: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trending-section .article-card .article-content {
    padding: 1.75rem 2rem 1.5rem;
}

.trending-section .article-card:first-child .article-image-wrapper {
    aspect-ratio: 16 / 7;
}

.trending-section .article-card:nth-child(2) .article-image-wrapper {
    aspect-ratio: 4 / 3;
}

/* Carousel */
.articles-carousel {
    position: relative;
}

.carousel-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: transform 0.3s ease;
}

.carousel-container::-webkit-scrollbar {
    display: none;
}

.carousel-item {
    flex: 0 0 auto;
    min-width: 300px;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-nav:hover {
    background: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.carousel-nav.prev {
    left: -20px;
}

.carousel-nav.next {
    right: -20px;
}

/* Search Modal */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.search-modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    z-index: 10001;
}

.search-modal.active .search-modal-content {
    transform: scale(1) translateY(0);
}

.search-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.search-modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.search-modal-box {
    padding: 2.5rem 2rem 2rem;
}

.search-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    text-align: center;
}

.search-modal-form {
    width: 100%;
}

.search-modal-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-modal-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-modal-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-modal-submit {
    position: absolute;
    right: 0.5rem;
    background: var(--primary-green);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-modal-submit:hover {
    background: var(--dark-green);
}

/* Search Page */
.search-main {
    padding: 3rem 0 4rem;
    min-height: 60vh;
}

.search-header {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: center;
}

.search-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.search-box-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-submit-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-green);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-submit-btn:hover {
    background: var(--dark-green);
}

.search-results {
    max-width: 1000px;
    margin: 0 auto;
}

.search-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-gray);
}

.search-placeholder p {
    font-size: 1.1rem;
}

.search-results-header {
    margin-bottom: 2rem;
}

.search-results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.search-results-grid {
    display: grid;
    gap: 1.5rem;
}

.search-result-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, transform 0.2s;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    text-decoration: none;
    color: inherit;
}

.search-result-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.search-result-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 200px;
    overflow: hidden;
    background: var(--bg-light);
}

.search-result-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease-out;
}

.search-result-card:hover .search-result-image-wrapper img {
    transform: scale(1.06);
}

.search-result-image-wrapper a {
    display: block;
    width: 100%;
    height: 100%;
}

.search-result-time-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.search-result-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.search-result-category {
    background: var(--primary-green);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
}

.search-result-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.search-result-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.search-result-title a:hover {
    color: var(--primary-green);
}

.search-result-excerpt {
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0.5rem 0;
}

.search-result-card .read-more {
    margin-top: 0.5rem;
}

/* Footer */
.footer {
    margin-top: 4rem;
}

.footer-cta {
    background: linear-gradient(135deg, var(--dark-green) 0%, var(--dark-blue) 100%);
    color: var(--white);
    padding: 4rem 20px;
    text-align: center;
}

.footer-cta h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.footer-cta p {
    font-size: 1.1rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

.footer-bottom {
    background: var(--text-dark);
    color: var(--white);
    padding: 2rem 20px;
}

.footer-bottom .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
}

.copyright {
    opacity: 0.8;
}

/* ------------------------------ */
/* Category pages (layout like reference screenshot) */
.nav-menu a.is-active {
    color: var(--primary-green);
    font-weight: 700;
}

.category-hero {
    width: 100%;
    background: linear-gradient(90deg, #4fb6a9 0%, #f08a64 100%);
    color: #ffffff;
    padding: 3.25rem 16px 3rem;
}

.category-hero-inner {
    max-width: 980px;
    margin: 0 auto;
    text-align: center;
}

.category-hero-title {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    font-weight: 800;
}

.category-hero-desc {
    max-width: 760px;
    margin: 0 auto 1.25rem;
    opacity: 0.95;
    font-size: 1.05rem;
}

.category-hero-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.category-main {
    background: #f7f7f7;
    padding: 2.75rem 0 3.5rem;
}

.category-section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 1.75rem;
    color: var(--text-dark);
}

.category-articles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.category-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.category-card-media {
    position: relative;
    height: 220px;
    background: var(--bg-light);
}

.category-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.22s ease-out, transform 0.35s ease-out;
}

.category-card-media img.loaded {
    opacity: 1;
}

.category-card:hover .category-card-media img {
    transform: scale(1.06);
}

.time-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.category-card-body {
    padding: 1.25rem 1.25rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.category-card-title {
    font-size: 1.15rem;
    line-height: 1.35;
    font-weight: 800;
    color: var(--text-dark);
}

.category-card-excerpt {
    color: var(--text-gray);
    font-size: 0.98rem;
}

.category-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #ececec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Featured first row like reference: 1 wide + 1 regular */
.category-card--featured {
    grid-column: 1 / 3;
}

.category-card--featured .category-card-media {
    height: 240px;
}

.category-card--side {
    grid-column: 3 / 4;
}

/* Explore Other Categories */
.explore-categories {
    margin-top: 3rem;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.explore-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: var(--text-dark);
    border: 1px solid #f0f0f0;
    cursor: pointer;
}

.explore-card h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.explore-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .category-articles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .category-card--featured {
        grid-column: 1 / -1;
    }

    .category-card--side {
        grid-column: auto;
    }

    .explore-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .category-hero {
        padding: 2.5rem 16px 2.25rem;
    }

    .category-hero-title {
        font-size: 1.7rem;
    }

    .category-main {
        padding: 2rem 0 3rem;
    }

    .category-articles {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .category-card-media {
        height: 200px;
    }
}

/* ------------------------------ */
/* Post / detail page (layout like reference screenshot) */
.post-page {
    background: #f7f7f7;
}

.post-main {
    padding: 2.25rem 0 0;
}

.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.post-article {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
    padding: 1.75rem 1.75rem 2rem;
}

.post-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.post-pill {
    background: #d7f5ee;
    color: #0b7a64;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-weight: 700;
    font-size: 0.75rem;
}

.post-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    font-weight: 900;
    color: var(--text-dark);
}

.post-hero-media {
    width: 100%;
    height: 340px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-light);
}

.post-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-content {
    margin-top: 1.5rem;
    color: #374151;
    font-size: 1rem;
    line-height: 1.75;
}

.post-content h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-dark);
}

.post-content blockquote {
    margin: 1.25rem 0;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--primary-green);
    background: #f6fffb;
    color: #0f766e;
    border-radius: 10px;
}

.post-content h3 {
    margin: 1.1rem 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-dark);
}

.post-content ul,
.post-content ol {
    margin: 0.6rem 0 1rem;
    padding-left: 1.25rem;
}

.post-content li {
    margin: 0.35rem 0;
}

.post-content hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 1.4rem 0;
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    margin: 1rem 0;
}

.post-content a {
    color: var(--primary-green);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 900;
    margin-bottom: 0.9rem;
    color: var(--text-dark);
}

.sidebar-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    counter-reset: sidebarRank;
}

.sidebar-list > .sidebar-item:nth-child(n + 4) {
    display: none;
}

.sidebar-item {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 0.75rem;
    align-items: start;
    counter-increment: sidebarRank;
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 0.6rem 0.6rem;
}

.sidebar-item:hover {
    background: #f3f4f6;
}

.sidebar-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.dot-ico {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.75);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    margin-top: 0;
    flex: 0 0 auto;
}

.dot-ico::before {
    content: counter(sidebarRank);
}

.sidebar-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.35;
}

.sidebar-link:hover {
    color: var(--primary-green);
}

/* Fallback: in case some pages miss the sidebar-link class */
.sidebar-item a,
.sidebar-item a:visited {
    text-decoration: none;
    color: var(--text-dark);
}

.sidebar-item a:hover {
    color: var(--primary-green);
}

.sidebar-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.05rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 900;
    color: #ffffff;
}

.tag::before {
    margin-right: 0.35rem;
    font-size: 0.85rem;
    line-height: 1;
}

.tag-budget::before { content: "💰"; }
.tag-family::before { content: "👨‍👩‍👧‍👦"; }
.tag-bodyweight::before { content: "💪"; }
.tag-compact::before { content: "📦"; }

.tag-budget { background: #10b981; }
.tag-family { background: #10b981; }
.tag-bodyweight { background: #10b981; }
.tag-compact { background: #10b981; }

/* Only tint "More Recommend" pills with sidebar accent */
.recommend-list .tag-budget,
.recommend-list .tag-family,
.recommend-list .tag-bodyweight,
.recommend-list .tag-compact {
    background: var(--sidebar-accent);
}

.tag-meta {
    color: var(--text-gray);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.recommend-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.recommend-item {
    display: flex;
    gap: 0.9rem;
    text-decoration: none;
    color: var(--text-dark);
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.6rem 0.6rem;
    border-radius: 12px;
    flex-wrap: nowrap;
}

.recommend-item:hover {
    background: #f3f4f6;
}

.recommend-body {
    flex: 1 1 auto;
    min-width: 0;
    order: 1;
}

.recommend-thumb {
    flex: 0 0 88px;
    order: 2;
}

.recommend-thumb {
    width: 88px;
    height: 72px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-light);
}

.recommend-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recommend-title {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recommend-excerpt {
    margin-top: 0.35rem;
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-related {
    margin-top: 2.5rem;
    padding: 2.75rem 0 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding-bottom: 2.5rem;
}

.related-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.clickable-card {
    cursor: pointer;
}

.related-media {
    position: relative;
    height: 190px;
    background: var(--bg-light);
}

.related-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.related-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(16, 185, 129, 0.95);
    color: #ffffff;
    font-weight: 900;
    font-size: 0.65rem;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.related-body {
    padding: 1.15rem 1.15rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.related-title {
    font-weight: 900;
    font-size: 1rem;
    line-height: 1.35;
}

.related-excerpt {
    color: var(--text-gray);
    font-size: 0.92rem;
}

.related-footer {
    margin-top: auto;
    padding-top: 0.9rem;
    border-top: 1px solid #ececec;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 1024px) {
    .post-layout {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .post-article {
        padding: 1.25rem;
    }

    .post-title {
        font-size: 1.5rem;
    }

    .post-hero-media {
        height: 230px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-btn {
        margin-left: auto;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background-color: var(--white);
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
        gap: 1rem;
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .hero-slide {
        grid-template-columns: 1fr;
        padding: 2rem 20px;
        height: 520px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-nav {
        display: none !important;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* Trending Now: stack featured cards on mobile to avoid stretched heights */
    .trending-top-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        align-items: start;
    }

    .trending-top-grid .article-card:first-child,
    .trending-top-grid .article-card:nth-child(2) {
        grid-column: auto;
    }

    .trending-bottom-grid {
        margin-top: 1.5rem;
    }

    .section-panel {
        padding: 1.25rem;
        border-radius: 18px;
    }

    .category-section .carousel-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* On mobile/tablet, use aspect-ratio for flexible height */
    .trending-bottom-grid .article-image-wrapper {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .carousel-container {
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .carousel-item {
        min-width: 100%;
    }

    .carousel-nav {
        display: none !important;
    }
    
    .articles-carousel {
        overflow: hidden;
    }
    
    .carousel-container {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .carousel-item {
        scroll-snap-align: start;
    }

    .footer-bottom .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-cta {
        padding: 3rem 20px;
    }

    .footer-cta h2 {
        font-size: 1.5rem;
    }

    .footer-cta p {
        font-size: 1rem;
    }

    /* Search Page Mobile */
    .search-title {
        font-size: 1.75rem;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 0.875rem 3rem 0.875rem 1.25rem;
    }

    .search-submit-btn {
        right: 0.5rem;
        padding: 0.4rem;
    }

    .search-result-card {
        grid-template-columns: 1fr;
        padding: 0;
    }

    .search-result-image-wrapper {
        min-height: 220px;
        width: 100%;
    }

    .search-result-content {
        padding: 1.25rem;
    }

    .search-result-title {
        font-size: 1.1rem;
    }

    /* Search Modal Mobile */
    .search-modal-box {
        padding: 2rem 1.5rem 1.5rem;
    }

    .search-modal-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .search-modal-input {
        font-size: 0.95rem;
        padding: 0.875rem 3rem 0.875rem 1.25rem;
    }

    .search-modal-submit {
        right: 0.4rem;
        padding: 0.4rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .article-content h3 {
        font-size: 1rem;
    }
}

/* Prevent Layout Shift */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Loading placeholder to prevent CLS */
.article-image-wrapper,
.hero-image,
.ad-image-wrapper {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    position: relative;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Stop skeleton via JS when images load (see `optimizeImageLoading()` in pages) */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Back to top */
.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-orange) 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
    z-index: 10001;
}

.back-to-top:hover {
    filter: brightness(1.02);
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:active {
    transform: translateY(1px);
}

.back-to-top:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.35);
    outline-offset: 3px;
}

.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-dark);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
    margin-bottom: 0.9rem;
}

.page-back-link:hover {
    color: var(--primary-green);
    border-color: rgba(16, 185, 129, 0.35);
}

/* Focus styles for accessibility */
a:focus,
button:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}
