.psc-calculator {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  font-size: 15px;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

.psc-calculator * {
  box-sizing: border-box;
}

.psc-calculator__form {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 20px 24px;
}

.psc-calculator__title {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
}

.psc-field-row--dims {
  display: flex;
  gap: 20px;
  margin-bottom: 0;
}

.psc-field-row--dims .psc-field-group {
  flex: 1;
}

.psc-field-group {
  margin-bottom: 14px;
}

.psc-section-card {
  background: #faf8f4;
  border: 1px solid #f0ece3;
  border-radius: 8px;
  padding: 14px 16px;
}

.psc-field-group.psc-section-card,
.psc-field-row--dims.psc-section-card {
  margin-bottom: 16px;
}

.psc-color-disclaimer {
  margin-top: 8px;
  font-size: 11.5px;
  color: #8a8a8a;
  line-height: 1.4;
}

.psc-info-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}

.psc-info-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #d97706;
  background: #fff;
  color: #d97706;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.psc-info-icon:hover,
.psc-info-icon[aria-expanded="true"] {
  background: #d97706;
  color: #fff;
}

.psc-info-popup {
  position: absolute;
  top: 24px;
  left: 0;
  z-index: 20;
  width: 240px;
  max-width: 70vw;
  background: #fff;
  border: 1px solid #e2c68a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  color: #4a3c2a;
  text-transform: none;
  letter-spacing: normal;
}

.psc-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Supporting SEO copy added below the calculator on the /cost-calculator/ page itself
   (in the WP page content, not this template) — give it breathing room from the Divi
   "custom quote" section that immediately follows it, and a visible divider from the
   calculator above it so the two sections read as distinct. */
.psc-seo-content {
  padding-bottom: 32px;
  padding-top: 28px;
  margin-top: 8px;
  border-top: 3px solid #e8c68a;
}

/* Real installed-screen photo gallery, added below the SEO copy in the same WP page content.
   Real photos (not schematics) so customers can see actual look/texture and use cases. */
.psc-photo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0 32px;
}

.psc-photo-gallery figure {
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #faf8f4;
  border: 1px solid #f0ece3;
  box-shadow: 0 2px 8px rgba(180, 120, 20, 0.08);
}

.psc-photo-gallery img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.psc-photo-gallery figcaption {
  padding: 10px 14px 14px;
  font-size: 13px;
  line-height: 1.4;
  color: #6b5a3f;
  text-align: center;
  font-weight: 600;
}

@media (max-width: 860px) {
  .psc-photo-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .psc-photo-gallery {
    grid-template-columns: 1fr;
  }
  .psc-photo-gallery img {
    height: 180px;
  }
}

.psc-field-group__label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

.psc-hover-hint {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  color: #999;
  vertical-align: middle;
}

@media (hover: hover) {
  .psc-hover-hint {
    display: inline-flex;
  }
}

.psc-field-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.psc-field-row {
  display: flex;
  gap: 10px;
}

.psc-field {
  flex: 1;
}

.psc-calculator input[type="number"],
.psc-calculator select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
}

.psc-field-row--submit {
  align-items: flex-start;
  margin-bottom: 0;
}

.psc-field-group--qty {
  flex: 0 0 70px;
  margin-bottom: 0;
}

.psc-field-group--cart {
  flex: 1;
  margin-bottom: 0;
  /* offsets the "QTY" label's height so the button top lines up with the qty input's top */
  margin-top: 20px;
}

.psc-range-error {
  background: #fdecea;
  border: 1px solid #f4c7c3;
  color: #7a1f1f;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.psc-range-error a {
  font-weight: 600;
}

.psc-note {
  background: #fff8e5;
  border: 1px solid #f0dfa0;
  color: #6b5200;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.psc-style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Mount Type's note sits directly under its buttons (unlike Style #'s note, which is only shown
   in the rare no-eligible-style case) — scoped to just this container's button row so Style #
   isn't affected. */
#psc-mount-options {
  margin-bottom: 10px;
}

.psc-style-option {
  padding: 7px 12px;
  border: 2px solid #d8d8d8;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.psc-style-option:hover {
  border-color: #d97706;
}

.psc-style-option.is-active {
  border-color: #d97706;
  background: #fff3e0;
  color: #a15200;
}

.psc-style-option:focus-visible,
.psc-color-swatch:focus-visible,
.psc-add-to-cart:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

.psc-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 6px;
  padding: 6px 2px 2px;
}

.psc-color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 46px;
}

.psc-color-swatch {
  width: 37px;
  height: 37px;
  border-radius: 6px;
  border: 2px solid #d8d8d8;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px #fff;
  transition: border-color 0.15s;
  position: relative;
}

.psc-color-swatch.is-active {
  border-color: #d97706;
}

@media (hover: hover) {
  .psc-color-swatch {
    transition: transform 0.12s ease-out, border-color 0.15s;
  }
  .psc-color-swatch:hover {
    transform: scale(3);
    z-index: 5;
    box-shadow: inset 0 0 0 2px #fff, 0 6px 18px rgba(0, 0, 0, 0.35);
  }
}

.psc-color-item-label {
  font-size: 10.5px;
  color: #a15200;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  min-height: 2.6em;
  width: 100%;
  overflow-wrap: normal;
  hyphens: none;
}

/* Swatch color approximations, sampled from the site's own product swatches */
.psc-swatch-white          { background: #f1efe9; }
.psc-swatch-black          { background: #0d0d0d; }
.psc-swatch-champagne      { background: #b7a685; }
.psc-swatch-coffee         { background: #3a2010; }
.psc-swatch-frosted-coffee { background: linear-gradient(135deg, #4a3c30, #362a20); }
.psc-swatch-grey           { background: #4a4a4a; }
.psc-swatch-frosted-grey   { background: linear-gradient(135deg, #4b535c, #363c42); }
.psc-swatch-yellow-wood-grain {
  background: repeating-linear-gradient(100deg, #9a5a26 0px, #b06a30 3px, #8a4e20 6px, #a3602c 9px);
}
.psc-swatch-red-wood-grain {
  background: repeating-linear-gradient(100deg, #6e1f16 0px, #82271b 3px, #5e1a12 6px, #79251a 9px);
}

.psc-add-to-cart {
  width: 100%;
  padding: 10px 20px;
  background: #d97706;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.psc-add-to-cart:disabled {
  background: #cfcfcf;
  cursor: not-allowed;
}

.psc-add-to-cart:not(:disabled):hover {
  background: #b85f04;
}

.psc-add-status {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1e7e34;
  min-height: 1.2em;
}

.psc-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1e7e34;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  margin-right: 2px;
  animation: psc-pop 0.25s ease-out;
}

@keyframes psc-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes psc-flash-update {
  0%   { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); }
  55%  { transform: scale(1.02); }
  100% { transform: scale(1); box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}

.psc-flash-update {
  animation: psc-flash-update 0.35s ease-out;
}

.psc-reassurance {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f2f8f4;
  border: 1px solid #cfe8d6;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #3f6b4c;
}

/* WooCommerce injects its own "View cart" link (a.added_to_cart.wc-forward) right after our
   Add to Cart button when the standard 'added_to_cart' event fires — scoped/styled here rather
   than in markup we control. */
#psc-calculator .added_to_cart.wc-forward {
  display: inline-block;
  margin: 14px 0 8px;
  padding: 6px 0;
  font-size: 26px;
  font-weight: 700;
  color: #a15200;
  text-decoration: underline;
}

#psc-calculator .added_to_cart.wc-forward:hover {
  color: #d97706;
}

.psc-calculator__price {
  flex: 0 0 320px;
  background: linear-gradient(180deg, #fffaf3 0%, #fdf1e0 100%);
  border: 1px solid #f0dcb8;
  border-top: 4px solid #d97706;
  border-radius: 10px;
  padding: 22px 20px;
  text-align: center;
  align-self: flex-start;
  position: sticky;
  top: 20px;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(180, 120, 20, 0.12);
}

.psc-calculator__price h3 {
  margin-top: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a15200;
  font-weight: 700;
}

.psc-price-list {
  font-size: 16px;
  font-weight: 600;
  color: #a99a86;
  text-decoration: line-through;
  min-height: 1.3em;
}

.psc-price {
  font-size: 36px;
  font-weight: 800;
  color: #7a3e00;
  margin: 2px 0 4px;
}

.psc-price-unit {
  font-size: 13px;
  color: #8a6a3f;
  min-height: 1.2em;
  margin-bottom: 10px;
}

.psc-promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #e8f5ec;
  border: 1px solid #b9e0c4;
  border-radius: 999px;
  color: #1e7e34;
  font-size: 12px;
  font-weight: 700;
}

/* `display: inline-flex` above would otherwise beat the [hidden] attribute's default
   `display: none` — author CSS always wins over the browser's UA stylesheet. */
.psc-promo-badge[hidden] {
  display: none;
}

.psc-selection {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0dcb8;
  text-align: center;
}

.psc-selection__label {
  font-size: 16.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a15200;
  font-weight: 700;
  margin-bottom: 8px;
}

.psc-selection__style {
  font-size: 14px;
  font-weight: 600;
  color: #4a3c2a;
  margin-bottom: 8px;
}

.psc-selection__color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b5a3f;
}

.psc-selection-color-dot {
  display: block;
  width: 100%;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

#psc-selection-color-text {
  font-size: 14px;
  font-weight: 700;
  color: #a15200;
}

.psc-diagram-wrap {
  margin-top: 12px;
}

.psc-diagram-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.psc-diagram {
  max-width: 100%;
  max-height: 160px;
  display: block;
  margin: 0 auto;
  background: #fff;
  border-radius: 6px;
  transition: transform 0.15s ease-out;
}

/* `display: block` above would otherwise beat the [hidden] attribute's default
   `display: none` — same fix as .psc-promo-badge, needed here for both the <img>
   and its inline-SVG replacement so toggling between them actually works. */
.psc-diagram[hidden] {
  display: none;
}

.psc-diagram-svg {
  width: 100%;
}

.psc-diagram-svg svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  margin: 0 auto;
}

.psc-zoom-hint {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e2c68a;
  color: #a15200;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

@media (hover: hover) {
  .psc-diagram {
    cursor: zoom-in;
  }
  .psc-diagram:hover {
    transform: scale(2.5);
    position: relative;
    z-index: 6;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  }

  /* Animated open/close demo — only on hover-capable devices, same gating as the
     zoom preview above, since touch devices can't reliably trigger :hover. The
     static arrows already show slide direction without it. */
  .psc-diagram-svg .psc-anim-left,
  .psc-diagram-svg .psc-anim-right {
    transition: transform 0.3s ease-in-out;
  }
  .psc-diagram-svg:hover .psc-anim-left {
    animation: psc-slide-left 3s ease-in-out infinite;
  }
  .psc-diagram-svg:hover .psc-anim-right {
    animation: psc-slide-right 3s ease-in-out infinite;
  }

  /* "Side to Side" styles: the whole assembly slides as one rigid unit, so it needs a much
     bigger travel distance than the center-close halves to fully retract off-canvas. */
  .psc-diagram-svg .psc-anim-solo {
    transition: transform 0.3s ease-in-out;
  }
  .psc-diagram-svg:hover .psc-anim-solo {
    animation: psc-slide-solo 3s ease-in-out infinite;
  }

  /* Frame "accumulates" against the outer edges as the screen retracts — a modest scaleX
     grow on the same open/close timing as the panel slide, not a permanent thick block. */
  .psc-diagram-svg .psc-accum-left,
  .psc-diagram-svg .psc-accum-right {
    transition: transform 0.3s ease-in-out;
  }
  .psc-diagram-svg .psc-accum-left {
    transform-origin: 28px 255px;
  }
  .psc-diagram-svg .psc-accum-right {
    transform-origin: 872px 255px;
  }
  .psc-diagram-svg:hover .psc-accum-left,
  .psc-diagram-svg:hover .psc-accum-right {
    animation: psc-accum-grow 3s ease-in-out infinite;
  }

  /* Arrows mirror in place to point the other way while the screen is "open" — they always
     show the direction that pair is currently moving, not just its closing direction. */
  .psc-diagram-svg .psc-arrow-flip {
    transition: transform 0.3s ease-in-out;
  }
  .psc-diagram-svg:hover .psc-arrow-flip {
    animation: psc-arrow-flip 3s ease-in-out infinite;
  }
}

@keyframes psc-slide-left {
  0%, 15%  { transform: translateX(0); }
  50%, 65% { transform: translateX(-430px); }
  100%     { transform: translateX(0); }
}

@keyframes psc-slide-right {
  0%, 15%  { transform: translateX(0); }
  50%, 65% { transform: translateX(430px); }
  100%     { transform: translateX(0); }
}

@keyframes psc-slide-solo {
  0%, 15%  { transform: translateX(0); }
  50%, 65% { transform: translateX(-820px); }
  100%     { transform: translateX(0); }
}

@keyframes psc-accum-grow {
  0%, 15%  { transform: scaleX(1); }
  50%, 65% { transform: scaleX(2.2); }
  100%     { transform: scaleX(1); }
}

@keyframes psc-arrow-flip {
  0%, 15%  { transform: scaleX(1); }
  50%, 65% { transform: scaleX(-1); }
  100%     { transform: scaleX(1); }
}

@media not all and (hover: hover) {
  .psc-zoom-hint {
    display: none;
  }
}

/* Tablet: still two columns but narrower right column */
@media (max-width: 1100px) {
  .psc-calculator__price {
    flex-basis: 260px;
  }
}

/* Below this, side-by-side no longer fits comfortably — stack, and scrolling is expected */
@media (max-width: 860px) {
  .psc-calculator {
    flex-direction: column;
  }
  .psc-calculator__price {
    position: static;
    width: 100%;
    flex-basis: auto;
  }
  .psc-field-row--dims {
    flex-direction: column;
    gap: 0;
  }
  @media (hover: hover) {
    .psc-color-swatch:hover {
      transform: scale(2.2);
    }
    .psc-diagram:hover {
      transform: scale(1.8);
    }
  }
}

@media (max-width: 480px) {
  .psc-calculator {
    padding: 0 12px;
  }
  .psc-calculator__form,
  .psc-calculator__price {
    padding: 16px;
  }
}
