/* TSTP Enhanced Styles - Complete Overhaul with Dark Mode */

/* Dark Mode Variables */
:root {
    --tstp-bg-light: #ffffff;
    --tstp-bg-secondary-light: #f8f9fa;
    --tstp-text-light: #333333;
    --tstp-text-secondary-light: #666666;
    --tstp-card-bg-light: #ffffff;
    --tstp-card-shadow-light: rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --tstp-bg-light: #1a1a1a;
    --tstp-bg-secondary-light: #2d2d2d;
    --tstp-text-light: #e0e0e0;
    --tstp-text-secondary-light: #b0b0b0;
    --tstp-card-bg-light: #2d2d2d;
    --tstp-card-shadow-light: rgba(0,0,0,0.3);
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--tstp-card-bg-light);
    border: 2px solid var(--tstp-text-secondary-light);
    border-radius: 50px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--tstp-card-shadow-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-mode-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px var(--tstp-card-shadow-light);
}

.dark-mode-toggle .icon {
    font-size: 1.4rem;
}

/* Hide Logo */
.wp-block-site-logo,
.wp-block-site-logo img {
    display: none !important;
}

/* Enhanced Card Styles - Uniform Height */
.tstp-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    background: var(--tstp-card-bg-light);
    color: var(--tstp-text-light);
    position: relative;
    cursor: pointer;
}

[data-theme="dark"] .tstp-card {
    border-color: rgba(255,255,255,0.1);
}

.tstp-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--tstp-card-shadow-light) !important;
}

/* Make Entire Card Clickable */
.tstp-card a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    text-decoration: none;
}

.tstp-card > * {
    position: relative;
    z-index: 2;
}

.tstp-card .wp-block-post-title a,
.tstp-card .wp-block-post-featured-image a {
    position: static;
    z-index: 3;
}

/* Text Truncation */
.tstp-card .wp-block-post-excerpt {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex-grow: 1;
    color: var(--tstp-text-secondary-light);
}

.tstp-card .wp-block-post-title {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 3.2em;
}

/* Improved Grid Layouts - 3 Columns */
.wp-block-post-template.is-layout-grid {
    gap: 30px !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.wp-block-post-template.is-layout-grid.columns-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.wp-block-post-template.is-layout-grid.columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Responsive Grid */
@media (min-width: 1200px) {
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767px) {
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dark-mode-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 1rem;
    }
}

/* Enhanced Post Featured Images */
.tstp-card .wp-block-post-featured-image {
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-shrink: 0;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tstp-bg-secondary-light);
}

.tstp-card .wp-block-post-featured-image img {
    transition: transform 0.5s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tstp-card:hover .wp-block-post-featured-image img {
    transform: scale(1.1);
}

/* Improved Typography */
.tstp-card .wp-block-post-title a {
    color: var(--tstp-text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.tstp-card .wp-block-post-title a:hover {
    color: var(--wp--preset--color--primary);
}

.tstp-card .wp-block-post-date {
    color: var(--tstp-text-secondary-light);
    flex-shrink: 0;
}

/* Enhanced Section Headings */
.wp-block-heading.has-text-align-center {
    position: relative;
    padding-bottom: 20px;
    margin-bottom: 50px !important;
    color: var(--tstp-text-light);
}

.wp-block-heading.has-text-align-center::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--wp--preset--color--primary), var(--wp--preset--color--secondary));
    border-radius: 2px;
}

/* Background Colors for Dark Mode */
[data-theme="dark"] .wp-block-group.alignfull {
    background: var(--tstp-bg-secondary-light) !important;
}

[data-theme="dark"] .wp-block-group.alignfull[style*="background:#f8f9fa"] {
    background: var(--tstp-bg-secondary-light) !important;
}

[data-theme="dark"] .wp-block-group.alignfull[style*="background:#ffffff"] {
    background: var(--tstp-bg-light) !important;
}

[data-theme="dark"] .tstp-card[style*="background:#ffffff"] {
    background: var(--tstp-card-bg-light) !important;
}

[data-theme="dark"] .tstp-card[style*="background:#f8f9fa"] {
    background: var(--tstp-card-bg-light) !important;
}

/* YouTube Section Enhancements */
.wp-block-html {
    margin: 0;
}

.wp-block-html iframe {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Improved Button Styles */
.wp-block-button__link {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wp-block-button__link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.wp-block-button__link:hover::before {
    width: 300px;
    height: 300px;
}

.wp-block-button__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Enhanced Query Blocks */
.wp-block-query {
    margin: 0;
}

/* Animation for Cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tstp-card {
    animation: fadeInUp 0.6s ease-out;
}

.tstp-card:nth-child(1) { animation-delay: 0.1s; }
.tstp-card:nth-child(2) { animation-delay: 0.2s; }
.tstp-card:nth-child(3) { animation-delay: 0.3s; }
.tstp-card:nth-child(4) { animation-delay: 0.4s; }
.tstp-card:nth-child(5) { animation-delay: 0.5s; }

/* Enhanced Link Styles */
a {
    transition: all 0.3s ease;
}

/* Better Focus States */
.tstp-card:focus-within {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 4px;
}

/* Navigation and Header Dark Mode */
[data-theme="dark"] .wp-block-navigation {
    background: var(--tstp-bg-light);
}

[data-theme="dark"] .wp-block-cover {
    background: var(--tstp-bg-light);
}

/* Improved Spacing */
.wp-block-spacer {
    margin: 0;
}

/* Mobile Responsive Improvements */
@media (max-width: 991px) {
    .wp-block-group.alignfull {
        padding-top: 50px !important;
        padding-bottom: 50px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .wp-block-heading.has-text-align-center {
        font-size: clamp(1.5rem, 5vw, 2.5rem) !important;
    }
}

@media (max-width: 575px) {
    .wp-block-group.alignfull {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }
    
    .tstp-card {
        min-height: 350px;
    }
    
    .tstp-card .wp-block-post-featured-image {
        height: 180px;
    }
}

