﻿/* Fiber-concrete configurator: scoped to category price lists. */
.fibro-category {
  container-type: inline-size;
  container-name: fibro-price;
}

.fibro-category .fibro-intro {
  max-width: 86ch;
}

.fibro-category .fibro-intro p,
.fibro-category .fibro-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.fibro-category .fibro-intro p + p {
  margin-top: 5px;
}

.fibro-category .fibro-table {
  width: 100%;
  table-layout: fixed;
}

.fibro-category .fibro-table th,
.fibro-category .fibro-table td {
  padding: 17px 12px;
  vertical-align: top;
}

.fibro-category .fibro-table th {
  padding-block: 14px;
  font-size: 11px;
  line-height: 1.45;
}

.fibro-category .fibro-table th:first-child {
  width: 90px;
}

.fibro-category .fibro-table th:nth-child(2) {
  width: 70px;
}

.fibro-category .fibro-table th:nth-child(4) {
  width: 150px;
}

.fibro-category .fibro-table th:nth-child(5) {
  width: 164px;
}

.fibro-category .fibro-table tbody tr:last-child td {
  border-bottom: none;
}

.fibro-category .fibro-class {
  padding-top: 17px;
  font-size: 14px;
  white-space: nowrap;
}

.fibro-category .fibro-name {
  display: block;
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.fibro-category .fibro-composition {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.fibro-category .fibro-primary,
.fibro-category .fibro-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.fibro-category .fibro-primary {
  grid-template-columns: minmax(0, 1.65fr) minmax(90px, 1fr);
  margin-top: 13px;
}

.fibro-category .fibro-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  align-content: start;
}

.fibro-category .fibro-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.fibro-category .fibro-field--wide,
.fibro-category .fibro-options-grid > .fibro-hint {
  grid-column: 1 / -1;
}

.fibro-category .fibro-field select,
.fibro-category .fibro-field input,
.fibro-category .fibro-field textarea,
.fibro-category .fibro-mark select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(27, 33, 39, 0.15);
  border-radius: 9px;
  background-color: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.fibro-category .fibro-field select,
.fibro-category .fibro-mark select {
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

.fibro-category .fibro-mark select {
  padding-left: 9px;
  font-weight: 700;
}

.fibro-category .fibro-field textarea {
  min-height: 80px;
  resize: vertical;
}

.fibro-category .fibro-field textarea::placeholder,
.fibro-category .fibro-field input::placeholder {
  color: #7b838a;
  font-size: 13px;
}

.fibro-category .fibro-field :is(select, input, textarea):hover,
.fibro-category .fibro-mark select:hover {
  border-color: rgba(240, 138, 36, 0.6);
}

.fibro-category .fibro-field :is(select, input, textarea):focus-visible,
.fibro-category .fibro-mark select:focus-visible,
.fibro-category .fibro-options > summary:focus-visible,
.fibro-category .fibro-delivery > summary:focus-visible {
  outline: 2px solid var(--brand-dark);
  outline-offset: 3px;
}

.fibro-category [hidden] {
  display: none !important;
}

.fibro-category .fibro-options {
  min-width: 0;
  margin-top: 9px;
}

.fibro-category .fibro-options > summary,
.fibro-category .fibro-delivery > summary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 6px 0;
  border-radius: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.fibro-category .fibro-options > summary::after,
.fibro-category .fibro-delivery > summary::after {
  content: "";
  position: static;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 0;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  border-radius: 0;
  background: none;
  transform: rotate(45deg);
}

.fibro-category .fibro-options[open] > summary::after,
.fibro-category .fibro-delivery[open] > summary::after {
  content: "";
  margin-top: 3px;
  transform: rotate(225deg);
}

.fibro-category .fibro-options > summary:hover,
.fibro-category .fibro-delivery > summary:hover {
  color: var(--brand-dark);
}

.fibro-category .fibro-options > .fibro-options-grid {
  margin-top: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f6f7f8;
}

.fibro-category .fibro-price .price-tag {
  display: block;
  margin: 5px 0 0;
  font-size: 18px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.fibro-category [data-fibro-alternative] {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
}

.fibro-category .fibro-quote-reason {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.fibro-category .fibro-delivery {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fa;
}

.fibro-category .fibro-delivery > summary {
  font-size: 13px;
}

.fibro-category .fibro-delivery > .fibro-options-grid {
  margin-top: 12px;
  padding-bottom: 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@container fibro-price (max-width: 820px) {
  .fibro-category .fibro-table th:first-child { width: 90px; }
  .fibro-category .fibro-table th:nth-child(2) { width: 60px; }
  .fibro-category .fibro-table th:nth-child(4) { width: 130px; }
  .fibro-category .fibro-table th:nth-child(5) { width: 140px; }
  .fibro-category .fibro-table th,
  .fibro-category .fibro-table td { padding-inline: 9px; }
  .fibro-category .fibro-primary { grid-template-columns: minmax(0, 1fr); }
  .fibro-category .volume-control { grid-template-columns: 30px 56px 30px; }
  .fibro-category .volume-step { width: 30px; }
  .fibro-category .volume-input { width: 56px; }
}

@container fibro-price (max-width: 760px) {
  .fibro-category .price-table-wrap { overflow: visible; border: none; border-radius: 0; }
  .fibro-category .fibro-table,
  .fibro-category .fibro-table tbody { display: block; }
  .fibro-category .fibro-table thead { display: none; }
  .fibro-category .fibro-table tbody { display: grid; gap: 12px; }
  .fibro-category .fibro-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }
  .fibro-category .fibro-table tbody td {
    display: grid;
    gap: 5px;
    width: auto;
    min-width: 0;
    padding: 0;
    border: none;
    align-content: start;
    order: initial;
  }
  .fibro-category .fibro-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
  }
  .fibro-category .fibro-table tbody td[data-column="1"] { order: 0; grid-column: 1; }
  .fibro-category .fibro-table tbody td[data-column="2"] { order: 0; grid-column: 2; }
  .fibro-category .fibro-table tbody td[data-column="3"] { order: 1; grid-column: 1 / -1; }
  .fibro-category .fibro-table tbody td[data-column="4"] { order: 2; grid-column: 1; }
  .fibro-category .fibro-table tbody td[data-column="5"] { order: 2; grid-column: 2; }
  .fibro-category .fibro-table tbody td.fibro-description::before { display: none; }
  .fibro-category .fibro-mark select { width: 135px; max-width: 100%; }
  .fibro-category .fibro-class { align-content: center; font-weight: 700; }
  .fibro-category .fibro-primary { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
  .fibro-category .fibro-price .price-tag { margin-top: 0; }
  .fibro-category .volume-control { justify-self: start; }
}

@media (max-width: 760px) {
  .fibro-category .fibro-intro p { font-size: 12px; }
  .fibro-category .fibro-table,
  .fibro-category .fibro-table tbody { display: block; }
  .fibro-category .fibro-table thead { display: none; }
  .fibro-category .fibro-table tbody { display: grid; gap: 12px; }
  .fibro-category .fibro-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 12px;
    padding: 14px;
  }
  .fibro-category .fibro-table tbody td {
    display: grid;
    gap: 5px;
    width: auto;
    min-width: 0;
    padding: 0;
    border: none;
    align-content: start;
    order: initial;
  }
  .fibro-category .fibro-table tbody td::before {
    font-size: 10px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
  }
  .fibro-category .fibro-table tbody td[data-column="1"] { order: 0; grid-column: 1; }
  .fibro-category .fibro-table tbody td[data-column="2"] { order: 0; grid-column: 2; }
  .fibro-category .fibro-table tbody td[data-column="3"] { order: 1; grid-column: 1 / -1; }
  .fibro-category .fibro-table tbody td[data-column="4"] { order: 2; grid-column: 1; }
  .fibro-category .fibro-table tbody td[data-column="5"] { order: 2; grid-column: 2; }
  .fibro-category .fibro-table tbody td.fibro-description::before { display: none; }
  .fibro-category .fibro-mark select { width: 100%; max-width: 135px; }
  .fibro-category .fibro-class { align-content: center !important; font-weight: 700; }
  .fibro-category .fibro-name { margin-top: 1px; }
  .fibro-category .fibro-primary { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .fibro-category .fibro-options-grid { gap: 10px 8px; }
  .fibro-category .fibro-options > .fibro-options-grid { padding: 11px; }
  .fibro-category .fibro-field :is(select, input, textarea),
  .fibro-category .fibro-mark select { min-height: 42px; }
  .fibro-category .fibro-price .price-tag { margin-top: 0; font-size: 17px; }
  .fibro-category [data-fibro-alternative] { margin-top: 2px; }
  .fibro-category .volume-control { grid-template-columns: 30px minmax(34px, 1fr) 30px; max-width: 100%; }
  .fibro-category .volume-step { width: 30px; min-height: 42px; }
  .fibro-category .volume-input { width: 100%; min-width: 0; min-height: 42px; }
  .fibro-category .volume-control.has-volume { grid-template-columns: 30px minmax(28px, 1fr) 30px 30px; }
  .fibro-category .volume-control.has-volume .volume-jump { display: grid; place-items: center; width: 30px; min-height: 42px; }
  .fibro-category .fibro-delivery > .fibro-options-grid { grid-template-columns: minmax(0, 1fr); }
  .fibro-category .fibro-hint { font-size: 12px; }
}

@media (max-width: 380px) {
  .fibro-category .fibro-table tbody tr { padding: 12px; gap: 13px 9px; }
  .fibro-category .fibro-options-grid { grid-template-columns: minmax(0, 1fr); }
  .fibro-category .fibro-table tbody td[data-column="4"],
  .fibro-category .fibro-table tbody td[data-column="5"] { grid-column: 1 / -1; }
  .fibro-category .volume-control { grid-template-columns: 34px 64px 34px; justify-self: start; }
  .fibro-category .volume-step { width: 34px; }
  .fibro-category .volume-control.has-volume { grid-template-columns: 34px 64px 34px 34px; }
  .fibro-category .volume-control.has-volume .volume-jump { width: 34px; }
  .fibro-category .fibro-price .price-tag { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .fibro-category .fibro-field :is(select, input, textarea),
  .fibro-category .fibro-mark select { transition: none; }
}

.fibro-category .fibro-field :disabled {
  border-color: var(--line);
  background-color: #f0f2f3;
  color: #7b838a;
  cursor: not-allowed;
}

/* Keep full mix specifications readable in the category calculator. */
.price-layout:has([data-fibro-category]) .price-calculator__stat {
  align-items: center;
}

.price-layout:has([data-fibro-category]) .price-calculator__stat > strong {
  min-width: 0;
  line-height: 1.3;
  text-align: right;
  overflow-wrap: anywhere;
}

.price-layout:has([data-fibro-category]) .price-calculator__item {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
}

.price-layout:has([data-fibro-category]) .price-calculator__item > strong {
  grid-column: 1 / -1;
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.price-layout:has([data-fibro-category]) .price-calculator__item > em {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.price-layout:has([data-fibro-category]) .price-calculator__item > span:not(.price-calculator__quote-note) {
  grid-column: 1;
  grid-row: 3;
  align-self: center;
}

.price-layout:has([data-fibro-category]) .price-calculator__item .price-calculator__remove {
  grid-column: 2;
  grid-row: 3;
}

.price-layout:has([data-fibro-category]) .price-calculator__quote-note {
  grid-column: 1 / -1;
  grid-row: 4;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}


/* Keep the calculator tied to the full price-list section, not the page shell. */
.page-shell:has(.price-layout [data-fibro-category]) {
  overflow-x: clip;
  overflow-y: visible;
}

.price-layout:has([data-fibro-category]) {
  align-items: start;
  overflow: visible;
}

.price-layout:has([data-fibro-category]) > .price-shell {
  min-width: 0;
}

.fibro-category .fibro-mark select {
  min-width: 86px;
  padding-left: 8px;
  padding-right: 26px;
  text-overflow: clip;
}

@media (min-width: 1081px) {
  .price-layout:has([data-fibro-category]) > .price-calculator {
    position: sticky;
    top: 120px;
    align-self: start;
    min-width: 0;
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 140px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8ced2 transparent;
  }
}

@media (max-width: 1080px) {
  .price-layout:has([data-fibro-category]) > .price-calculator {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}

/* Fixed grades share the baseline with the adjacent class. */
.fibro-category .fibro-fixed-mark {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  white-space: normal;
}
