/* ============================================================
   OLIVEWOOD SHOP · front-end tweaks
   main.css is kept byte-for-byte from the design; genuine
   responsive bug-fixes that the static mockup didn't account for
   live here so the verbatim guarantee holds.
   Tokens come from main.css :root.
   ============================================================ */

/* ---- Long-form page content (.entry-content) ----
   The design had no rich text pages, so main.css never styled them — give
   classic/block page content readable rhythm, headings, lists and links. */
.entry-content{
  color: var(--ink-soft);
  max-width: 820px;
}
.entry-content > *:first-child{ margin-top: 0; }
.entry-content p{ margin: 0 0 1.1em; }
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4{
  color: var(--olive-deep);
  margin: 1.8em 0 .55em;
  line-height: 1.2;
}
.entry-content h2{ font-size: 1.6rem; }
.entry-content h3{ font-size: 1.3rem; }
.entry-content h4{ font-size: 1.1rem; }
.entry-content ul,
.entry-content ol{
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}
.entry-content ul{ list-style: disc; }
.entry-content ol{ list-style: decimal; }
.entry-content li{ margin-bottom: .5em; }
.entry-content li::marker{ color: var(--wood); }
.entry-content a{ color: var(--wood-deep); text-decoration: underline; }
.entry-content a:hover{ color: var(--olive); }
.entry-content img{ border-radius: var(--radius); margin: 12px 0; height: auto; }
.entry-content blockquote{
  margin: 0 0 1.1em;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--wood);
  color: var(--ink);
  font-style: italic;
}
.entry-content hr{
  border: none;
  border-top: 1px solid var(--bone-3);
  margin: 1.8em 0;
}
.entry-content table{
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.1em;
}
.entry-content th,
.entry-content td{
  border: 1px solid var(--bone-3);
  padding: 10px 12px;
  text-align: left;
}

/* ---- Screen-reader-only text (WP core class the design never had) ---- */
.screen-reader-text{
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Archive / search pagination ----
   the_posts_pagination() outputs .pagination > .nav-links > .page-numbers,
   not the .woocommerce-pagination <ul> the WC glue styles — so the trail
   rendered as bare "1 2 … 4 →" text. Same pill look as everything else. */
.pagination .nav-links{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 44px 0 0;
}
.pagination .page-numbers{
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--bone-3);
  border-radius: 999px;
  background: #fffaf0;
  font-weight: 700;
  font-size: .86rem;
  color: var(--ink-soft);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.pagination a.page-numbers:hover{
  border-color: var(--wood);
  color: var(--wood-deep);
}
.pagination .page-numbers.current{
  background: var(--olive);
  border-color: var(--olive);
  color: var(--bone);
}
.pagination .page-numbers.dots{
  border-color: transparent;
  background: none;
  min-width: 0;
  padding: 0 4px;
}
.pagination .page-numbers.prev,
.pagination .page-numbers.next{
  font-size: 1.05rem;
  line-height: 1;
}

/* ---- Long product titles ----
   Real product names are much longer than the mockup's. Keep the single-page
   H1 readable (smaller than the design's h-lg), balance the line wrapping,
   and cap card titles to a tidy height so the grid stays even. */
.pd-title{
  font-size: clamp(1.6rem, 1.2vw + 1.05rem, 2.25rem);
  line-height: 1.18;
  text-wrap: balance;
  margin-bottom: 6px;
}

/* ---- Breadcrumb ----
   The design shipped a plain "a / a / text" line, which truncated badly on
   long category + product names and gave no hint of the shop hierarchy.
   The trail is now a real <ol> (schema.org BreadcrumbList) — chevron
   separators, wraps instead of overflowing, and only the current page is
   ellipsised. */
.breadcrumb{ max-width: 100%; }
.breadcrumb ol{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35em .7em;
}
.page-hero .breadcrumb ol{ justify-content: center; }
.breadcrumb li{ display: inline-flex; align-items: center; gap: .7em; min-width: 0; }
.breadcrumb li + li::before{
  content: "";
  width: 5px; height: 5px;
  border-top: 1.5px solid var(--wood);
  border-right: 1.5px solid var(--wood);
  transform: rotate(45deg);
  opacity: .65;
  flex: none;
}
.breadcrumb a{
  color: var(--ink-soft);
  transition: color .2s ease;
}
.breadcrumb a:hover{ color: var(--wood-deep); }
.breadcrumb .breadcrumb-current{
  color: var(--olive-deep);
  font-weight: 700;
  /* Long product / category names stay on one tidy line. */
  max-width: min(52ch, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Single product: the trail sits above the gallery, not in a page hero. */
.breadcrumb--single{ margin-bottom: 34px; }

@media (max-width: 640px){
  .breadcrumb{ font-size: .72rem; }
  .breadcrumb .breadcrumb-current{ max-width: 100%; }
}

/* Product cards: clamp the name to 2 lines so every card lines up. */
.product-name{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.product-card .product-info{ min-height: 0; }

/* ---- Category grid adapts to the real number of categories ----
   main.css hard-codes 5 columns (the original 5 families); auto-fit lets it
   sit nicely whether there are 3, 4, 5 or more categories. */
.cat-grid{
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ---- Sort select: custom chevron tucked next to the label ---- */
.sort-select{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.6em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232B2719' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1em center;
  background-size: 12px 12px;
}

/* ---- Header search ----
   The mockup had no search UI. The icon sits next to the cart and drops a
   panel down from the header, matching the .newsletter pill form. */
.search-panel{
  border-top: 1px solid var(--bone-3);
  background: rgba(244,237,223,.97);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.search-panel[hidden]{ display: none; }
.search-panel .container{ padding: 16px 0 18px; }
.search-form{
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffaf0;
  border: 1px solid var(--bone-3);
  border-radius: 999px;
  padding: 7px 7px 7px 18px;
  max-width: 720px;
  margin-inline: auto;
}
.search-form-icon{ color: var(--ink-soft); flex: none; }
.search-form input[type="search"]{
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: .45em 0;
  font-size: .95rem;
  -webkit-appearance: none;
  appearance: none;
}
.search-form input[type="search"]::-webkit-search-cancel-button{ display: none; }
.search-form input[type="search"]:focus{ outline: none; }
.search-form .btn{ padding: .7em 1.5em; flex: none; }
.search-form .search-close{
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.4rem; line-height: 1;
  color: var(--ink-soft);
  transition: background .2s ease, color .2s ease;
}
.search-form .search-close:hover{ background: var(--bone-2); color: var(--wood-deep); }

@media (max-width: 560px){
  .search-form{ padding-left: 14px; }
  .search-form .btn{
    padding: .7em 1.1em;
    font-size: .82rem;
  }
}

/* ---- Header "Shop" category dropdown (fallback nav + WP menus) ---- */
.main-nav .has-sub{ position: relative; }
.main-nav .sub-menu{ list-style: none; margin: 0; padding: 0; }
.main-nav .has-sub > a::after,
.main-nav .menu-item-has-children > a::after{
  content: "";
}

@media (min-width: 861px){
  .main-nav .has-sub,
  .main-nav .menu-item-has-children{
    position: relative;
    display: inline-flex;
    align-items: center;
  }
  .main-nav .has-sub > .sub-menu,
  .main-nav .menu-item-has-children > .sub-menu{
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bone);
    border: 1px solid var(--bone-3);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: grid;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    z-index: 80;
  }
  .main-nav .has-sub:hover > .sub-menu,
  .main-nav .has-sub:focus-within > .sub-menu,
  .main-nav .menu-item-has-children:hover > .sub-menu,
  .main-nav .menu-item-has-children:focus-within > .sub-menu{
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .main-nav .sub-menu a{
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink);
  }
  .main-nav .sub-menu a::after{ display: none; }
  .main-nav .sub-menu a:hover{ background: var(--bone-2); color: var(--wood-deep); }
}

@media (max-width: 860px){
  /* Submenu shows as an indented list under Shop in the mobile menu. */
  .main-nav .has-sub,
  .main-nav .menu-item-has-children{ display: block; }
  .main-nav .sub-menu{ padding-left: 16px; }
  .main-nav .sub-menu a{ font-weight: 400; }

  /* Mobile menu: its top edge is set to the real header bottom by main.js
     (the design's hard-coded offset breaks when the top bar wraps to 2+
     lines). Give it a solid background + sit above the header so it never
     shows through / under the logo. */
  .main-nav{
    z-index: 70;
    background: var(--bone);
    box-shadow: 0 18px 30px -18px rgba(34,28,18,.4);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }
  /* The design only slides the closed menu up by 130% — not enough to clear
     its positive top offset, so the last item ("Contact") peeks at the very
     top. Actually hide it when closed; reveal (and let it slide) when open. */
  .main-nav:not(.open){
    visibility: hidden;
    pointer-events: none;
  }
  .main-nav.open{
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 640px){
  /* Shop filter pills → a single, swipeable row instead of a tall wrap.
     Cleaner on phones and keeps the sort control on its own line. */
  .shop-tools{
    display: block;
  }
  .filter-pills{
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -18px 14px;          /* bleed to the screen edges */
    padding: 2px 18px 8px;
  }
  .filter-pills::-webkit-scrollbar{ display: none; }
  .filter-pills .pill{
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .sort-select{
    width: 100%;
  }
}
