/*
 Theme Name:   Astra Child
 Theme URI:    https://techmansion.tech
 Description:  Custom child theme for Tech Mansion, based on the Astra theme.
 Author:       Tech Mansion
 Author URI:   https://techmansion.tech
 Template:     astra
 Version:      1.3.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  astra-child
*/

/* =================================================================
   1.0 Variables & Global Styles
   ================================================================= */
:root {
    --tm-primary: #114070;
    --tm-accent: #ff6600;
    --tm-light-bg: #f4f7f8;
    --tm-dark-text: #1a202c;
    --tm-light-text: #718096;
    --tm-card-bg: #fff;
    --tm-border-color: #e2e8f0;
    --tm-bg-accent: #f8fafc;
}

body, 
.ast-separate-container { 
    background-color: var(--tm-bg-accent); 
}

/* Force full-width container on homepage */
.home .ast-container { 
    max-width: 100vw !important; 
    padding: 0 !important; 
}

/* =================================================================
   2.0 Homepage Layout & Containers
   ================================================================= */
.tm-section-container {
    max-width: 1720px;
    margin: 0 auto;
    padding: 0 2vw;
    background: var(--tm-light-bg);
    box-shadow: 0 0 0 100vmax var(--tm-light-bg);
    clip-path: inset(0 -100vmax);
    border-radius: 0 0 2.5rem 2.5rem;
}

@media (max-width: 1400px) {
    .tm-section-container { max-width: 98vw; }
}

.tm-main-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 2.5rem; 
    padding: 2.5rem 0; 
}

@media (min-width: 1200px) { 
    .tm-main-grid { 
        grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr); 
    } 
}

.tm-section-header { 
    margin-bottom: 1.5rem; 
    border-bottom: 3px solid var(--tm-primary); 
    padding-bottom: 0.75rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: baseline; 
}

.tm-section-title { 
    font-size: 2.2rem; 
    font-weight: 800; 
    color: var(--tm-primary); 
    margin: 0; 
}

.tm-view-all-link { 
    font-size: 0.95rem; 
    font-weight: 600; 
    color: var(--tm-accent); 
    text-decoration: none; 
    transition: color 0.2s ease; 
}

.tm-view-all-link:hover { 
    color: var(--tm-dark-text); 
}

/* =================================================================
   3.0 Post Card Styles (Generic)
   ================================================================= */
.tm-post-card { 
    background-color: var(--tm-card-bg); 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    text-decoration: none; 
    height: 100%; 
    border-radius: 0.5rem; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
}

.tm-post-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.07); 
}

.tm-post-card-thumbnail a { 
    display: block; 
    position: relative; 
    aspect-ratio: 16 / 9; 
    overflow: hidden; 
    background-color: #e2e8f0; 
}

.tm-post-card-thumbnail img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); 
}

.tm-post-card:hover .tm-post-card-thumbnail img { 
    transform: scale(1.08); 
}

.tm-post-card-content { 
    padding: 1rem; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
}

.tm-post-card-title { 
    font-weight: 700; 
    color: var(--tm-dark-text); 
    line-height: 1.4;
    margin: 0;
}

.tm-post-card-title a { 
    color: inherit; 
    text-decoration: none; 
}

.tm-post-card-title a:hover { 
    color: var(--tm-accent); 
}

.tm-post-card-meta { 
    font-size: 0.8rem; 
    color: var(--tm-light-text); 
    margin-top: auto; 
    padding-top: 0.75rem; 
}

/* =================================================================
   4.0 Homepage Section Grids
   ================================================================= */

/* --- 4.1 Latest Stories Top Grid --- */
.tm-top-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
}
@media (min-width: 768px) { 
    .tm-top-grid { grid-template-columns: 1fr 1fr; } 
}
@media (min-width: 1024px) { 
    .tm-top-grid { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, auto); } 
}

.tm-top-grid > .tm-post-card-large { grid-column: 1 / -1; }
@media (min-width: 768px) { 
    .tm-top-grid > .tm-post-card-large { grid-column: 1 / 3; grid-row: 1 / 3; } 
}

.tm-post-card-large .tm-post-card-thumbnail a { aspect-ratio: 16 / 10; }
.tm-post-card-large .tm-post-card-title { font-size: 1.75rem; }

.tm-top-grid > .tm-post-card-medium { grid-column: 1 / -1; }
@media (min-width: 768px) { 
    .tm-top-grid > .tm-post-card-medium:nth-of-type(2) { grid-column: 1 / 2; } 
    .tm-top-grid > .tm-post-card-medium:nth-of-type(3) { grid-column: 2 / 3; } 
}
@media (min-width: 1024px) { 
    .tm-top-grid > .tm-post-card-medium:nth-of-type(2) { grid-column: 3 / 5; } 
    .tm-top-grid > .tm-post-card-medium:nth-of-type(3) { grid-column: 3 / 4; } 
    .tm-top-grid > .tm-post-card-medium:nth-of-type(4) { grid-column: 4 / 5; } 
}
.tm-post-card-medium .tm-post-card-title { font-size: 1.1rem; }
.tm-post-card-medium .tm-post-card-content { padding: 1.25rem; }

/* --- 4.2 "In Case You Missed It" Section --- */
.tm-in-case-you-missed-it {
    margin: 3.5rem 0;
}
.tm-in-case-you-missed-it .tm-section-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: #191919;
    border: none;
    margin-bottom: 1.2em;
    letter-spacing: -1px;
}
.tm-icymi-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.1rem;
}
@media (max-width: 900px) {
    .tm-icymi-list-grid { grid-template-columns: 1fr; }
}
.tm-icymi-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1.3rem;
    background: #fff;
    border-radius: 0.7rem;
    border: 1px solid var(--tm-border-color);
    padding: 0.7rem 1.2rem 0.7rem 0.7rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.18s, transform 0.18s;
    min-height: 90px;
}
.tm-icymi-list-item:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    transform: translateY(-2px) scale(1.01);
}
.tm-icymi-thumb-link {
    display: block;
    width: 110px;
    height: 70px;
    background: #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
}
.tm-icymi-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}
.tm-icymi-list-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.tm-icymi-title-link {
    font-weight: 700;
    font-size: 1.06rem;
    color: #191919;
    text-decoration: none;
    line-height: 1.24;
    margin-bottom: 0.18em;
    display: block;
    transition: color 0.18s;
}
.tm-icymi-title-link:hover {
    color: var(--tm-accent);
    text-decoration: underline;
}
.tm-icymi-meta {
    font-size: 0.97rem;
    color: var(--tm-light-text);
    font-weight: 500;
}
.tm-icymi-dot {
    color: #bbb;
    margin: 0 0.3em;
}
.tm-icymi-btn-row {
    text-align: center;
    margin-top: 2.3rem;
}
.tm-icymi-btn {
    background: #2196f3;
    color: #fff;
    border: none;
    border-radius: 2em;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.8em 2.1em;
    cursor: pointer;
    transition: background-color 0.18s, box-shadow 0.18s;
    box-shadow: 0 2px 8px rgba(33,150,243,0.09);
    text-decoration: none;
}
.tm-icymi-btn:hover {
    background: #1769aa;
    box-shadow: 0 8px 24px rgba(33,150,243,0.13);
}


/* --- 4.3 Laptops Section --- */
.tm-laptops-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 2rem; 
}
@media (min-width: 992px) { 
    .tm-laptops-grid { 
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); 
    } 
}
.tm-laptops-main .tm-post-card-title {
    font-size: 1.6rem;
}
.tm-laptops-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* This targets the list-style cards used in the laptop section and sidebar */
.tm-laptops-list .tm-list-item,
.tm-sidebar-list .tm-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}
.tm-laptops-list .tm-list-item .tm-post-card-thumbnail,
.tm-sidebar-list .tm-list-item .tm-post-card-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}
.tm-laptops-list .tm-list-item .tm-post-card-thumbnail a,
.tm-sidebar-list .tm-list-item .tm-post-card-thumbnail a {
    aspect-ratio: 1 / 1;
}
.tm-laptops-list .tm-list-item h4,
.tm-sidebar-list .tm-list-item h4 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}
.tm-laptops-list .tm-list-item h4 a,
.tm-sidebar-list .tm-list-item h4 a {
    color: var(--tm-dark-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.tm-laptops-list .tm-list-item h4 a:hover,
.tm-sidebar-list .tm-list-item h4 a:hover {
    color: var(--tm-accent);
}

/* --- 4.4 Default Category Grid --- */
.tm-category-posts-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem; 
}

/* --- 4.5 Devices Grid --- */
.tm-devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}
.tm-device-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.tm-device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.tm-device-card-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.tm-device-card-content {
    padding: 1rem;
}
.tm-device-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.tm-device-card-title a {
    text-decoration: none;
    color: var(--tm-dark-text);
}
.tm-view-specs-btn {
    background-color: var(--tm-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease;
}
.tm-view-specs-btn:hover {
    background-color: var(--tm-accent);
}

/* =================================================================
   5.0 Sidebar
   ================================================================= */
.tm-sidebar-widget { 
    background: var(--tm-card-bg); 
    padding: 1.5rem; 
    border-radius: 0.5rem; 
    margin-bottom: 2rem; 
    border: 1px solid var(--tm-border-color); 
}

.tm-sidebar-widget-title { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: var(--tm-primary); 
    margin: -1.5rem -1.5rem 1.5rem -1.5rem; 
    padding: 1rem 1.5rem; 
    background-color: var(--tm-light-bg); 
    border-bottom: 1px solid var(--tm-border-color); 
    border-radius: 0.5rem 0.5rem 0 0; 
}

.tm-sidebar-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* This specifically targets the <li> elements in the sidebar for border separation */
.tm-sidebar-list li {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--tm-border-color);
}
.tm-sidebar-list li:last-child { 
    border-bottom: none; 
    padding-bottom: 0;
}

/* --- 5.1 Tag Cloud Widget --- */
.tm-tag-cloud .tag-cloud-link { 
    display: inline-block;
    background-color: #eef2f5;
    color: var(--tm-light-text);
    padding: 0.4rem 0.8rem;
    margin: 0.2rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.9rem !important; /* Override default WP font sizes */
    transition: all 0.2s ease;
}
.tm-tag-cloud .tag-cloud-link:hover {
    background-color: var(--tm-accent);
    color: white;
}

/* =================================================================
   6.0 Modals & Buttons
   ================================================================= */
.tm-load-more-container { text-align: center; margin-top: 2.5rem; }
.tm-load-more-btn { background-color: var(--tm-primary); color: white; padding: 0.75rem 2rem; border: none; border-radius: 0.5rem; cursor: pointer; font-weight: 600; transition: background-color 0.2s ease; }
.tm-load-more-btn:hover { background-color: var(--tm-accent); }
.tm-load-more-btn.loading { background-color: var(--tm-light-text); cursor: wait; }

/* --- Specs Modal --- */
.tm-specs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1001;
    display: none;
}
.tm-specs-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1002;
    display: none;
}
.tm-specs-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

