/* Pergola product pages: avoid horizontal clipping; inner tables use overflow-x:auto */
html:has(#price-calculator-pergola) {
  overflow-x: auto;
  max-width: 100%;
}
body:has(#price-calculator-pergola) {
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
}
body:has(#price-calculator-pergola) .container {
  min-width: 0;
  box-sizing: border-box;
}

/* Pergola live calculator — stable field layout + readable breakdown tables */
#product-pricing-root .pergola-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}

#product-pricing-root .pergola-field-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 108px;
  flex: 0 1 auto;
}

#product-pricing-root .pergola-field-cell--roof {
  min-width: 200px;
  flex: 1 1 220px;
}

#product-pricing-root .pergola-lbl-type {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #475569;
  line-height: 1.2;
  height: 2.4rem;
  min-height: 2.4rem;
  max-height: 2.4rem;
  overflow: hidden;
  width: 100%;
  min-width: 9.5rem;
  max-width: 12rem;
  box-sizing: border-box;
}

#product-pricing-root .pergola-field-cell select,
#product-pricing-root .pergola-field-cell input {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#weight-summary-root .pergola-breakdown-wrap,
#pricing-output .pergola-breakdown-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
}

#weight-summary-root table.pergola-detail-table,
#pricing-output table.pergola-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  background: #fff;
}

#weight-summary-root table.pergola-detail-table thead th,
#pricing-output table.pergola-detail-table thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  vertical-align: bottom;
}

#weight-summary-root table.pergola-detail-table thead th.pergola-col-num,
#pricing-output table.pergola-detail-table thead th.pergola-col-num {
  text-align: right;
}

#weight-summary-root table.pergola-detail-table td,
#pricing-output table.pergola-detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  word-wrap: break-word;
}

#weight-summary-root table.pergola-detail-table td.pergola-td-num,
#pricing-output table.pergola-detail-table td.pergola-td-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#weight-summary-root table.pergola-detail-table td.pergola-td-item {
  font-weight: 500;
  color: #1e293b;
}

#weight-summary-root table.pergola-detail-table-mats td:first-child {
  width: 42%;
  font-weight: 500;
  color: #334155;
}

#weight-summary-root table.pergola-detail-table-mats td:last-child {
  width: 58%;
  text-align: left;
  color: #475569;
}

@media (max-width: 640px) {
  #product-pricing-root .pergola-lbl-type {
    min-width: 7rem;
    max-width: 100%;
  }
  #product-pricing-root .pergola-field-cell--roof {
    flex: 1 1 100%;
  }
}

/* Long-form SEO copy */
.pergola-seo-article {
  max-width: 900px;
  color: #475569;
  font-size: 0.98rem;
  line-height: 1.8;
}
.pergola-seo-article p {
  margin: 0 0 1rem;
}
.pergola-seo-article h2 {
  font-family: "Playfair Display", serif;
  font-size: 1.35rem;
  color: #0f172a;
  margin: 1.5rem 0 0.75rem;
}

/* FAQ accordion (<details>) */
.pergola-faq-wrap {
  max-width: 900px;
}
.pergola-faq-wrap .pergola-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  background: #fff;
  overflow: hidden;
}
.pergola-faq-wrap .pergola-faq-q {
  cursor: pointer;
  list-style: none;
  padding: 14px 44px 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  position: relative;
  user-select: none;
}
.pergola-faq-wrap .pergola-faq-q::-webkit-details-marker {
  display: none;
}
.pergola-faq-wrap .pergola-faq-q::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 600;
  color: #0a0e17;
  line-height: 1;
}
.pergola-faq-wrap .pergola-faq-item[open] .pergola-faq-q::after {
  content: "−";
}
.pergola-faq-wrap .pergola-faq-a {
  padding: 0 16px 14px;
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.65;
  border-top: 1px solid #f1f5f9;
}
.pergola-faq-wrap .pergola-faq-a p {
  margin: 0.65rem 0 0;
}

/* Related systems cross-links */
.pergola-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pergola-related-grid li a {
  display: block;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #0a0e17;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}
.pergola-related-grid li a:hover {
  border-color: #0a0e17;
  background: #f8fafc;
}
