/*
Theme Name: Simple Theme v14
Theme URI: http://example.com/simple-theme
Author: Your Name
Author URI: http://example.com
Description: A lightweight editorial WordPress theme with optional widget sidebars, related posts, smart image fallbacks, and long-form content styling.
Version: 14.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: simple-theme
*/

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: #fff;
    color: #222;
}
img { max-width: 100%; height: auto; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header { padding: 20px 0 0; }
.header-container {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.logo img { display: block; max-height: 60px; width: auto; }
.site-title { font-size: 28px; font-weight: 700; line-height: 1.1; }
.site-title a { color: inherit; text-decoration: none; }
.main-navigation { min-width: 0; }
.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 20px;
}
.menu li { margin: 0; }
.menu li a { display: block; padding: 4px 0; }
.menu .menu-item-has-children { position: relative; }
.menu .sub-menu {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: -12px;
    min-width: 190px;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.menu .sub-menu li { margin: 0; }
.menu .sub-menu a { padding: 8px 14px; white-space: nowrap; }
.menu .menu-item-has-children:hover > .sub-menu,
.menu .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Main shell */
.content-area {
    margin: 28px auto 48px;
    max-width: 1280px;
}
.breadcrumb { overflow-wrap: anywhere; }

/* Shortcode wrappers */
.featured-content-bg,
.gray-content-bg {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    padding: 40px 0;
}
.featured-content-bg .content-container,
.gray-content-bg .content-container {
    position: relative;
    margin: 0 auto;
    max-width: 70%;
}

/* Single/page layout: centered by default, two columns only when widgets exist */
.content-layout {
    width: 100%;
    margin: 0 auto;
}
.content-layout.no-sidebar .primary-content {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}
.content-layout.has-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 36px;
    align-items: start;
}
.primary-content { min-width: 0; }
.site-sidebar { min-width: 0; }

/* Article typography tuned for long editorial/review content */
.single-article > h1 {
    margin: 0 0 10px;
    line-height: 1.15;
}
.post-meta {
    color: #777;
    font-size: 14px !important;
    margin: 0 0 28px;
}
.entry-content {
    overflow-wrap: break-word;
}
.entry-content > *:first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h2 {
    line-height: 1.25;
    margin: 1.9em 0 .7em;
}
.entry-content h3 {
    line-height: 1.3;
    margin: 1.55em 0 .6em;
}
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    line-height: 1.35;
    margin: 1.4em 0 .55em;
}
.entry-content ul,
.entry-content ol {
    padding-left: 1.45em;
    margin: 0 0 1.25em;
}
.entry-content li {
    line-height: 1.6;
    margin: .35em 0;
}
.entry-content blockquote {
    margin: 1.6em 0;
    padding: .2em 0 .2em 1.15em;
    border-left: 3px solid #d6d6d6;
    color: #555;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content a { text-decoration: underline; text-underline-offset: 2px; }
.entry-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.5em auto;
}
.entry-content figure { max-width: 100%; margin: 1.6em auto; }
.entry-content figcaption {
    margin-top: .55em;
    color: #777;
    font-size: .88em;
    text-align: center;
}
.entry-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.6em 0;
    white-space: normal;
}
.entry-content th,
.entry-content td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}
.entry-content th { background: #f6f6f6; }
.entry-content pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 16px;
    background: #f6f6f6;
}
.entry-content code { overflow-wrap: anywhere; }

/* Spreadsheet-generated product review components */
.entry-content .product-review-image {
    margin-top: 1.5em !important;
    margin-bottom: 1.5em !important;
}
.entry-content .product-review-image img {
    margin: 0 auto;
    max-height: 680px;
    object-fit: contain;
}
.entry-content .product-scorecard {
    width: 100%;
    max-width: 100%;
    margin-top: 1.75em !important;
    margin-bottom: 1.25em !important;
    overflow: hidden;
}

/* Widgets */
.site-sidebar .widget {
    margin: 0 0 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e5e5;
}
.site-sidebar .widget:last-child { border-bottom: 0; }
.site-sidebar .widget-title { margin: 0 0 12px; font-size: 18px; }
.site-sidebar ul { list-style: none; margin: 0; padding: 0; }
.site-sidebar li { margin: 0 0 9px; line-height: 1.45; }
.site-sidebar img { height: auto; }
.site-sidebar input,
.site-sidebar select,
.site-sidebar textarea { max-width: 100%; }

/* Related posts */
.related-posts {
    margin-top: 52px;
    padding-top: 28px;
    border-top: 1px solid #ddd;
}
.related-posts .section-heading h2 { margin: 0 0 20px; }
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.related-card { min-width: 0; }
.related-card-link { display: block; color: inherit; }
.related-card-link:hover { text-decoration: none; }
.related-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #f3f3f3;
    border-radius: 3px;
}
.related-card-body { padding-top: 9px; }
.related-card-kicker {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-style: italic;
    opacity: .7;
}
.related-card h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

/* Archive/blog listings */
.blog-listings { max-width: 1000px; margin: 0 auto; }
.post-item {
    display: flex;
    align-items: flex-start;
    gap: 22px;
    margin-bottom: 34px;
}
.post-thumbnail {
    flex: 0 0 30%;
    margin: 0;
}
.post-thumbnail img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 3px;
}
.post-content-excerpt { flex: 1 1 auto; min-width: 0; }
.post-title { margin-top: 0; }


/* Content-image fallbacks (not WP featured images), especially Amazon product shots. */
.atc-card img.is-content-image,
.atc-slide img.is-content-image,
.post-thumbnail img.is-content-image,
.related-card-image.is-content-image {
    object-fit: contain;
    background: #f5f5f5;
}

/* Footer */
.site-footer { padding: 28px 0; }
.footer-container { margin: 0 auto; text-align: center; }

/* Responsive */
@media (max-width: 1000px) {
    .content-layout.has-sidebar {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 32px;
    }
}

@media (max-width: 820px) {
    .header-container {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    .menu { justify-content: center; }
    .menu .sub-menu {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 4px;
        padding: 0 0 0 12px;
        border: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: transparent;
    }
    .menu .sub-menu a { padding: 3px 0; white-space: normal; }
    .content-area { width: 90% !important; }
    .header-container,
    .footer-container { width: 90% !important; }
    .content-layout.has-sidebar { display: block; }
    .site-sidebar {
        margin-top: 42px;
        padding-top: 28px;
        border-top: 1px solid #ddd;
    }
    .related-posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .featured-content-bg .content-container,
    .gray-content-bg .content-container { max-width: 90%; width: 90% !important; }
}

@media (max-width: 600px) {
    .content-area { margin-top: 20px; }
    .post-item { display: block; }
    .post-thumbnail { display: block; margin-bottom: 14px; }
    .related-posts-grid { grid-template-columns: 1fr; }
    .related-card-image { aspect-ratio: 16 / 9; }
    .entry-content th,
    .entry-content td { padding: 8px 9px; }
}
