:root {
  --wp-primary: #9d7248;
  --wp-dark: #1f1f1f;
  --wp-border: #e4ddd4;
  --wp-bg: #f8f6f2;
  --wp-body: var(--wpic-primary-font), 'Caviar Dreams', serif;
  --wp-secondary: var(--wpic-secondary-font), 'Lato', sans-serif;
  --wpic-content-max-width: 1280px;
}

body { overflow-x: hidden; }

/* Main Wrapper - Removed the 100vw hack to keep it contained */
.wpic-wrap,
.wpic-single-wrap {
  width: 100%;
  margin: 0;
  padding: 0 0 34px;
  font-family: var(--wp-secondary);
  background: #f8f6f2; /* Matches the clean background of the second image */
}

.wpic-wrap {
  position: relative;
  overflow-x: hidden;
}

/* Single post/page containment */
.wpic-single-wrap {
  padding-top: 28px;
}

.wpic-single-top,
.wpic-video-player,
.wpic-article-hero-image,
.wpic-single-content,
.wpic-single-tax {
  width: min(calc(100% - 40px), 980px);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.wpic-single-top {
  padding-bottom: 14px;
}

.wpic-breadcrumbs {
  margin-bottom: 14px;
  font-size: 13px;
  color: #6f675e;
}

.wpic-breadcrumbs a {
  color: #6f675e;
  text-decoration: none;
}

.wpic-breadcrumbs a:hover {
  color: var(--wp-primary);
  text-decoration: underline;
}

.wpic-single-top h1 {
  margin: 0 0 8px;
  font-family: var(--wp-body);
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.18;
  font-weight: 500;
  color: #231f1a;
}

.wpic-meta {
  margin: 0;
  font-size: 14px;
  color: #736b61;
}

.wpic-video-player,
.wpic-article-hero-image {
  margin-top: 18px;
}

.wpic-video-player iframe,
.wpic-video-player video,
.wpic-article-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #d9d1c4;
  background: #efebe4;
}

.wpic-single-content {
  margin-top: 24px;
  padding: 0;
  font-size: 17px;
  line-height: 1.8;
  color: #2b2823;
}

.wpic-single-content > *:first-child {
  margin-top: 0;
}

.wpic-single-content h2,
.wpic-single-content h3,
.wpic-single-content h4 {
  font-family: var(--wp-body);
  color: #201d18;
  margin-top: 28px;
  margin-bottom: 10px;
}

.wpic-single-content p {
  margin: 0 0 1em;
}

.wpic-single-content img {
  max-width: 100%;
  height: auto;
}

.wpic-single-tax {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #ddd5c8;
  background: #f6f2eb;
  font-size: 14px;
  line-height: 1.7;
  color: #4a433a;
}

.wpic-single-tax > div + div {
  margin-top: 8px;
}

/* Content shell and global containment rules for all templates/pages */
.wpic-content-shell {
  width: min(calc(100% - 40px), var(--wpic-content-max-width));
  margin: 0 auto;
  box-sizing: border-box;
}

.walletplus-toolbar,
.walletplus-filter-panel,
.wpic-sections,
.wpic-pagination {
  width: min(calc(100% - 40px), var(--wpic-content-max-width));
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Hero Section - Keeps background full width but centers text */
.wpic-hero {
  width: 100%;
  min-height: 188px;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--wp-border);
  margin-bottom: 24px;
  background-color: #f3f1ec; /* Light texture background */
}

.wpic-hero h1 {
  margin: 0 0 14px;
  font-family: var(--wp-body);
  font-weight: 500;
  color: #8d4f1f;
  font-size: 52px;
  line-height: 1.2;
  text-align: center;
}

/* Search Bar */
.wpic-search {
  max-width: 760px;
  width: min(92%, 760px);
  height: 46px;
  border-radius: 999px;
  background: #fff;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--wp-border);
}
.wpic-search-icon { margin: 0 12px 0 16px; opacity: .7; }
.wpic-search input { flex: 1; border: 0; outline: 0; font-size: 14px; background: transparent; }
.wpic-search button { border: 0; background: var(--wp-primary); color: #fff; height: 100%; padding: 0 30px; cursor: pointer; }

/* Toolbar - The Bar with Filter and Sort */
.walletplus-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  background: transparent;
  border: 0;
  padding: 14px 22px;
  min-height: 58px;
  box-sizing: border-box;
  margin-top: 0;
  position: relative;
  z-index: 0;
}

.walletplus-toolbar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: #f2f0ec;
  border-top: 1px solid #e1dbd0;
  border-bottom: 1px solid #e1dbd0;
  z-index: -1;
}

.walletplus-show-filter { border: none; background: transparent; font-size: 14px; letter-spacing: .03em; display: inline-flex; align-items: center; gap: 10px; color: #1b1b1b; cursor: pointer; }
.walletplus-show-filter span { font-size: 18px; line-height: 1; }
.wpic-strip-center { display: flex; align-items: center; gap: 34px; justify-self: center; }
.wpic-tab { font-size: 15px; color: #1f1f1f; text-decoration: none; font-weight: 500; }
.wpic-tab:hover { text-decoration: underline; color: var(--wp-primary); }
.wpic-mobile-section-select { display: none; }

.walletplus-toolbar-right { display: flex; align-items: center; gap: 10px; justify-self: end; }
.walletplus-toolbar-right select { border: none; background: transparent; font-size: 16px; padding: 0 16px 0 0; cursor: pointer; }
.walletplus-view-btn { width: 32px; height: 32px; border: 1px solid #c9bba7; background: #fff; color: #594730; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.walletplus-view-btn.is-active { background: var(--wp-primary); border-color: var(--wp-primary); color: #fff; }

/* Hard reset for theme-injected control styles */
.walletplus-show-filter,
.walletplus-view-btn,
.walletplus-toolbar-right select,
.wpic-mobile-section-select {
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none;
}

.walletplus-show-filter {
  border: 1px solid #d2c7b7 !important;
  border-radius: 0 !important;
  padding: 10px 14px !important;
  line-height: 1 !important;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.walletplus-show-filter:hover,
.walletplus-show-filter:focus-visible {
  background: #ece7df !important;
  border-color: #b9a489 !important;
  color: #1b1b1b !important;
}

.walletplus-view-btn:hover,
.walletplus-view-btn:focus-visible {
  background: #f1ece4;
  border-color: #b9a489;
}

/* Filter Panel */
.walletplus-filter-panel {
  display: none;
  padding: 20px;
  background: transparent;
  border: 0;
  position: relative;
  z-index: 0;
}

.walletplus-filter-panel::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: #fff;
  border-bottom: 1px solid #e1dbd0;
  z-index: -1;
}
.walletplus-filter-panel.is-open { display: block; }

/* Section Title */
.wpic-sections { padding-top: 40px; }
.wpic-section-title { font-family: var(--wp-body); font-size: 44px; font-weight: 400; text-align: center; margin: 0 0 30px; color: #222; }

/* Product/Article Cards Grid */
.wpic-cards { 
  display: grid; 
  grid-template-columns: repeat(4, minmax(0, 1fr)); 
  gap: 20px; 
}

/* Grid view states controlled by JS toggle */
.walletplus-grid.walletplus-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.walletplus-grid.walletplus-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.walletplus-grid.walletplus-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.walletplus-grid.walletplus-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }

.wpic-card { background: #fff; border: 1px solid #d5ccbd; padding: 10px; transition: transform 0.2s; }
.wpic-card:hover { transform: translateY(-3px); }
.wpic-card-image-wrap { display: block; aspect-ratio: 1 / 0.78; overflow: hidden; position: relative; background: #eee; }
.wpic-card-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.wpic-card-logo { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; background: rgba(255,255,255,.9); border-radius: 50%; padding: 2px; }
.wpic-card-body { padding: 12px 4px 5px; }
.wpic-card h3 { font-size: 15px; line-height: 1.4; margin: 0; font-family: var(--wp-secondary); font-weight: 600; color: #333; }

/* Pagination */
.wpic-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 30px; }
.wpic-pagination .page-numbers { padding: 5px 12px; border: 1px solid var(--wp-border); text-decoration: none; color: #6b665f; }
.wpic-pagination .current { background: var(--wp-primary); color: #fff; border-color: var(--wp-primary); }

/* Mobile Optimization */
@media (max-width: 1024px) {
  .wpic-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .walletplus-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "filter sort"
      "jump jump";
    row-gap: 12px;
    column-gap: 12px;
  }
  .walletplus-show-filter { grid-area: filter; }
  .walletplus-toolbar-right { grid-area: sort; justify-self: end; }
  .wpic-strip-center { grid-area: jump; display: block; width: 100%; }
  .wpic-tab { display: none !important; }
  .wpic-mobile-section-select {
    display: block;
    width: 100%;
    height: 44px;
    border: 1px solid #d2c7b7;
    background: #fff;
    color: #262626;
    font-size: 15px;
    padding: 0 14px;
    line-height: 44px;
  }

  .wpic-single-top,
  .wpic-video-player,
  .wpic-article-hero-image,
  .wpic-single-content,
  .wpic-single-tax {
    width: min(calc(100% - 30px), 920px);
  }
}

@media (max-width: 767px) {
  .wpic-hero h1 { font-size: 32px; }
  .wpic-search {
    width: calc(100% - 32px);
    max-width: 360px;
    height: 40px;
  }
  .wpic-search input { font-size: 13px; }
  .wpic-search button { padding: 0 18px; }
  .walletplus-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "filter sort"
      "jump jump";
    row-gap: 12px;
    column-gap: 10px;
    padding: 12px;
  }
  .walletplus-show-filter { grid-area: filter; justify-self: start; font-size: 13px; padding: 10px 12px !important; }
  .walletplus-toolbar-right { grid-area: sort; justify-self: end; gap: 8px; }
  .walletplus-toolbar-right label { font-size: 12px; letter-spacing: .08em; }
  .walletplus-toolbar-right select { font-size: 14px; }
  .wpic-strip-center {
    grid-area: jump;
    display: block;
    width: 100%;
  }
  .wpic-tab { display: none !important; }
  .wpic-mobile-section-select {
    display: block;
    width: 100%;
    height: 44px;
    border: 1px solid #d2c7b7;
    background: #fff;
    color: #262626;
    font-size: 15px;
    padding: 0 14px;
    line-height: 44px;
  }
  .walletplus-toolbar,
  .walletplus-filter-panel,
  .wpic-sections,
  .wpic-pagination,
  .wpic-content-shell {
    width: calc(100% - 20px);
  }
  .wpic-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wpic-section-title { font-size: 28px; }

  .wpic-single-wrap {
    padding-top: 18px;
  }
  .wpic-single-top,
  .wpic-video-player,
  .wpic-article-hero-image,
  .wpic-single-content,
  .wpic-single-tax {
    width: calc(100% - 20px);
  }
  .wpic-single-top h1 {
    font-size: 30px;
  }
  .wpic-single-content {
    margin-top: 18px;
    font-size: 15px;
    line-height: 1.75;
  }
  .wpic-single-tax {
    margin-top: 16px;
    padding: 12px 14px;
    font-size: 13px;
  }
}
