/* ==========================================================================
   Coffee Masters — PDP (Product Detail Page)
   File: css/pdp.css
   Scope rule: pdp-* only
   ========================================================================== */

:root{
  --pdp-sand: #e7ded2;
}

/* ==================================================
   PDP Main Tile — split layout (white media / sand content)
   ================================================== */

.pdp-main{
  padding: 0;
  overflow: hidden;
}

.pdp-main__layout{
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "head"
    "media"
    "body";
}


.pdp-right--head{ grid-area: head; }
.pdp-left--media{ grid-area: media; }
.pdp-right--body{ grid-area: body; }

/* Panel backgrounds */
.pdp-left--media{
  background: #fff;
  padding: 24px;
}

/* Head */
.pdp-right--head{
  background: var(--pdp-sand);
  padding: 24px;
}

/* Body padding */
.pdp-inner{
  padding: 22px 24px 26px;
  display: grid;
  gap: 14px; /* global rhythm for the body */
}

@media (min-width: 1024px){
  .pdp-main__layout{
    grid-template-columns: minmax(350px, 420px) 1fr;
    grid-template-areas:
      "media head"
      "media body";
    align-items: stretch;
  }

  .pdp-right--body{
    min-height: 100%;
  }

  .pdp-left--media{ padding: 28px; }
  .pdp-right--head{ padding: 22px 32px 16px; } /* less bottom padding */
  .pdp-inner{ padding: 16px 32px 30px; }       /* less top padding */
}

/* ==================================================
   PDP header (title + size + brand + short description)
   ================================================== */


.pdp-head__titles h1, .pdp-head__titles p { margin:0; }

.pdp-head__top{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.pdp-head__titles{
  min-width: 0;
  display: grid;
  gap: 6px;
}

.pdp-head__sub{
  opacity: 0.9;
   font-weight:500;
  font-size: calc(var(--type-h3) * 0.9);
  line-height: var(--lh-h3);
}

.pdp-head__desc{
  margin-top: 12px;
  margin-bottom: 0px;
}

/* Brand logo chip (reused wherever needed) */
.pdp-brand{
  text-decoration: none;
  flex: 0 0 auto;
}

.pdp-brand__box{
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 5px;
  padding: 8px 10px;
  border: 1px solid rgba(25,2,0,0,0.18);
}

.pdp-brand__box img{
  display: block;
  height: auto;
  width: clamp(110px, 12vw, 160px);
}

/* Stack header on mobile */
@media (max-width: 768px){
  .pdp-head__top{
    grid-template-columns: 1fr;
  }

  .pdp-brand{
    justify-self: start;
  }
}

/* ==================================================
   Gallery
   FIX: true square stage with sensible max size (not full-column),
        image always contained & centered
   ================================================== */

.pdp-gallery{
  min-width: 0;
}

/* Center the gallery content within the left panel */
.pdp-gallery__main{
  --stage: clamp(220px, 22vw, 320px);

  width: var(--stage);
  height: var(--stage);
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 10px;

  position: relative; /* NEW: anchor for absolute child */
  overflow: hidden;   /* keep, but now it should never be needed visually */
}


.pdp-gallery__img{
  position: absolute;
  inset: 0;               /* top/right/bottom/left = 0 */

  width: 100%;
  height: 100%;

  object-fit: contain;     /* no crop */
  object-position: center; /* centered */

  display: block;
}

/* Thumbs */
.pdp-gallery__thumbs{
  display: flex;
  justify-content: center;     /* looks nicer under a centered stage */
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
}

.pdp-thumb{
  appearance: none;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.pdp-thumb img{
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
  border-radius: 5px;
  border: 1px solid rgba(25,2,0,0,0.16);
}

.pdp-thumb.is-active{
  border-color: #190200;
}

.pdp-thumb.is-active img{
  border-color: transparent;
}

/* ==================================================
   Bullets
   ================================================== */

.pdp-bullets{
  margin: 0;
  padding-left: 18px;   /* keeps bullets aligned neatly */
  line-height: 1.25;    /* slightly tighter text */
}

.pdp-bullets li{
  margin: 3px 0;
}

/* ==================================================
   PDP links (read more + trade) — shared style
   ================================================== */

.pdp-link{
  display: inline-block;
  width: fit-content;
  margin: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  color: var(--theme-link, #BA5917);
}

.theme .pdp-link{
  color: var(--theme-link, #BA5917);
}

.theme .pdp-link:hover{
  color: var(--theme-link-hover, #8C4312);
}

/* ==================================================
   Roast strength image
   ================================================== */

.pdp-strength{
  height: 30px;
  width: calc(30px * 4.45); /* maintain image ratio (445:100) */
  background-repeat: no-repeat;
  background-size: contain;
}

/* Roast levels */
    .pdp-strength[data-roast="1"] {
        background-image: url("/images/StrengthGuide_Coffee_1.png");
    }

    .pdp-strength[data-roast="2"] {
        background-image: url("/images/StrengthGuide_Coffee_2.png");
    }

    .pdp-strength[data-roast="3"] {
        background-image: url("/images/StrengthGuide_Coffee_3.png");
    }

    .pdp-strength[data-roast="4"] {
        background-image: url("/images/StrengthGuide_Coffee_4.png");
    }

    .pdp-strength[data-roast="5"] {
        background-image: url("/images/StrengthGuide_Coffee_5.png");
    }

/* ==================================================
   Variants (chips)
   ================================================== */

.pdp-variants{
  border: 0;
  padding: 0;
 margin-top: 6px; /* pushes variants down from link */
}

.pdp-variants__legend{
  margin-bottom: 10px;
  font-weight: 600;
}

.pdp-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pdp-chip__input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pdp-chip {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-width: 150px;
    padding: 12px 16px;
    border-radius: 5px;
    border: 2px solid #190200;
    cursor: pointer;
    user-select: none;
    background: #fff;
    color: #190200;
    text-decoration: none !important;
}

.pdp-chip__name{ font-weight: 700; }
.pdp-chip__price{ font-size: 0.95em; opacity: 0.9; }

.pdp-chip.is-selected {
    background: #321400;
    color: #fff;

}

.pdp-chip.is-soldout{
  opacity: 0.55;
  cursor: not-allowed;
}

.pdp-chip__input:focus-visible + .pdp-chip{
  outline: 3px solid rgba(186,89,23,0.55);
  outline-offset: 2px;
}


/* ==================================================
   Purchase row — PDP
   (Visuals handled by shared [data-buy] component in main.css)
   ================================================== */

.pdp-buy{
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 16px 24px;
  justify-content: start;
  margin-top: 6px;
}

.pdp-buy__control[data-buy]{
  --buy-w: 280px;
  --buy-h: 52px;
  --buy-radius: 5px;

  /* PDP removed border/text slightly darker */
  --buy-removed-border: 2px solid #190200;
  --buy-removed-fg: #190200;

  width: var(--buy-w);
  position: relative;
}

.pdp-price{ justify-self: start; }
.pdp-price__value{ line-height: 1; }

@media (max-width: 768px){
  .pdp-buy__control[data-buy]{
    --buy-w: 200px;
    --buy-h: 40px;
  }
}


/* ==================================================
   Accordion (details/summary)
   ================================================== */

.cm-accordion{
  border-top: 1px solid var(--border-strong, #b9ada4);
  padding: 8px 0;
}

.cm-accordion:last-child{
  border-bottom: 1px solid var(--border-strong, #b9ada4);
}

.cm-accordion__summary{
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.cm-accordion__summary::-webkit-details-marker{
  display: none;
}

.cm-accordion__summary::after{
  content: "+";
  font-weight: 700;
  line-height: 1;
  font-size: 1.1em;
  opacity: 0.7;
}

.cm-accordion[open] .cm-accordion__summary::after{
  content: "–";
}

.cm-accordion__content{
  padding: 6px 0 6px 0;
}

/* Optional: tighten headings inside accordion content */
.cm-accordion__content .type-h3{
  margin-top: 12px;
}

/* Accordion heading scale */
.cm-accordion__summary .type-h3{
  font-size: calc(var(--type-h3) * 0.82);
  font-weight: 600;
  margin-bottom: 0px;
}

/* Reduce heading size inside accordion content */
.cm-accordion__content .type-h3{
  font-size: calc(var(--type-h3) * 0.80);
  font-weight: 500;
}

.cm-accordion__content .type-h3{
  font-size: calc(var(--type-h3) * 0.85);
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 500;
}

.pdp-gallery__thumbs .swiper-wrapper {
    display: flex;
    justify-content: center !important;
}
.pdp-gallery__thumbs .swiper-slide-duplicate {
    display: none !important;
}


/*testing*/
/* ==================================================
   Gallery wrapper — stage flanked by arrows
   ================================================== */

.pdp-gallery__main-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pdp-gallery__main {
    --stage: clamp(180px, 20vw, 280px); /* slightly smaller to give arrows room */
    flex: 0 0 var(--stage);
}

/* Take arrows out of Swiper's absolute flow */
.pdp-gallery__main-wrapper .swiper-button-next,
.pdp-gallery__main-wrapper .swiper-button-prev {
    position: static;
    margin: 0;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
}

    /* Remove Swiper's default ::after arrow icon since we use our own img */
    .pdp-gallery__main-wrapper .swiper-button-next::after,
    .pdp-gallery__main-wrapper .swiper-button-prev::after {
        display: none;
    }