/*
Theme Name: MJHD Wallpapers - Grid
Description: Minimal, fast grid theme for Product Images CPT (product_images). Natural aspect thumbnails, JSON-LD schema, lazy loading.
Version: 1.1
Author: You
Text Domain: mjhdwallpapers-grid
*/

/* Root variables */
:root {
    --max-width: 1200px;
    --gap: 12px;
    --bg: #ffffff;
    --accent: #222;
}

/* Base reset */
* {
    box-sizing: border-box;
}
html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: #111;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}
a {
    color: var(--accent);
    text-decoration: none;
}

/* Header/Footer */
.header, .footer {
    background: #111;
    color: #fff;
    padding: 18px;
    text-align: center;
}
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 18px;
}
.site-title {
    margin: 0;
    font-size: 20px;
}
.searchform {
    margin-top: 8px;
}

/* Navigation Menu */
.main-nav {
    position: relative;
}
.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
}
.nav-menu li {
    display: inline-block;
}
.nav-menu a {
    text-decoration: none;
    color: #fff !important;
    font-weight: 500;
    display: block;
    padding: 8px 12px;
    transition: background 0.3s;
}
.nav-menu a:hover {
    background: #333;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .nav-menu {
        display: none;
        flex-direction: column;
        background: #fff;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    .nav-menu.active { display: flex; }
    .nav-menu li {
        padding: 10px;
        border-bottom: 1px solid #eee;
    }
}

/* Product grid */
.product-image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    align-items: start;
}
@media (max-width: 1024px) {
    .product-image-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .product-image-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .product-image-grid { grid-template-columns: 1fr; }
}
.product-image-item {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 8px;
    border-radius: 6px;
    overflow: hidden;
}
.product-image-item figure { margin: 0 0 8px 0; }
.product-image-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}
.product-title {
    font-size: 15px;
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meta-line {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* Pagination */
.pagination, .pagination-wrapper {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.pagination a, .pagination span {
    margin: 0 4px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #007bff;
}
.pagination .current {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Tags */
.mjhd-image-tags {
    margin-top: 20px;
    font-size: 14px;
}
.mjhd-image-tags a {
    color: #0073aa;
    text-decoration: none;
}
.mjhd-image-tags a:hover {
    text-decoration: underline;
}

/* Thumbnails for prev/next */
.nav-thumbs {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.thumb-link {
    flex: 1 1 calc(50% - 10px);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}
.responsive-thumb {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.thumb-label {
    margin-top: 4px;
    font-size: 13px;
    color: #333;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 14px;
    background: #f9f9f9;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}
.breadcrumb a {
    color: #003366;
    text-decoration: underline;
    font-weight: 500;
}
.breadcrumb a:hover { color: #000080; }
.breadcrumb .separator { margin: 0 5px; color: #666; }

/* Meta info */
.image-meta {
    margin: 10px 0;
    font-size: 14px;
}
.image-meta strong {
    font-weight: bold;
    color: #111;
}
.image-meta a {
    color: #003366;
    text-decoration: underline;
}
.image-meta a:hover {
    color: #000080;
}

/* Single post layout */
.single-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--gap);
  max-width: var(--max-width);
  margin: auto;
  padding: var(--gap);
}

/* Left column (main image + prev/next) */
.single-left {
  flex: 0 0 auto;
  width: calc((180px * 2) + var(--gap)); /* same as 2 grid thumbs combined */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Main image */
.image-wrapper {
  width: 100%;
  margin: 0 auto;
}
.image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
}

/* Prev/Next grid under main image */
.prev-next-mini .grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  width: 100%;
  margin-top: 12px;
}
.prev-next-mini .grid-item img {
  border-radius: 12px;
  width: 100%;
  transition: transform 0.3s ease;
}
.prev-next-mini .grid-item:hover img {
  transform: scale(1.05);
}

/* Right side (content + related + tags + FAQ) */
.single-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Ensure right content starts at top beside image */
.single-right > *:first-child {
  margin-top: 0;
}

/* Related images grid (right side) */
.related-images-grid .grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--gap);
}
.related-images-grid .grid-item img {
  border-radius: 12px;
  transition: transform 0.3s ease;
}
.related-images-grid .grid-item:hover img {
  transform: scale(1.04);
}

/* Stats & download button under image */
.image-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: #555;
}
.download-btn {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
  transition: background 0.3s ease;
}
.download-btn:hover {
  background: #000;
}

/* Responsive stacking */
@media (max-width: 900px) {
  .single-layout {
    flex-direction: column;
  }
  .single-left,
  .single-right {
    width: 100%;
    max-width: 100%;
  }
  .image-wrapper,
  .prev-next-mini .grid-container {
    width: 100%;
  }
}

