:root {
  --brand: #294D49;
  --brand-dark: #1d3835;
  --bg: #ffffff;
  --text: #000000;
  --muted: #5b615f;
  --line: #e2e5e4;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --maxw: 1280px;
  --stick: 51px; /* height of the sticky catalog nav (the header scrolls away); rail/section offsets key off this */
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text); background: var(--bg); }
.site-header { background: var(--bg); padding: 14px 24px; border-bottom: 1px solid var(--line); }
.site-title { color: var(--brand); font-weight: 700; font-size: 20px; text-decoration: none; }
.hero-banner { display: block; max-width: var(--maxw); margin: 16px auto 8px; padding: 0 5px; }
.hero-banner img { width: 100%; height: auto; display: block; border-radius: 10px;
  aspect-ratio: 1900 / 500; object-fit: cover; }
@media (max-width: 600px){ .hero-banner img { aspect-ratio: 600 / 800; } }
.intro-copy { max-width: var(--maxw); margin: 22px auto 4px; padding: 0 5px; }
.intro-copy h1 { font-size: 26px; color: var(--brand); margin: 0 0 10px; line-height: 1.25; }
.intro-copy p { color: var(--text); line-height: 1.6; margin: 0;}
@media (max-width: 600px){ .intro-copy h1 { font-size: 22px; } }
#app { max-width: var(--maxw); margin: 0 auto; padding: 0 5px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px){ .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px){ .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.card { border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s ease; }
.card:hover { transform: translateY(-2px); }
.card img { width: 100%; aspect-ratio: 1/1; display: block;
  background: #f1f3f2; }
.card .body { padding: 12px; }
.card h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.card .count { color: var(--muted); font-size: 13px; }
.cat-desc { color: var(--muted); font-size: 13px; margin: 6px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* All-fabrics home: stacked catalog sections */
.catalog-section { margin-bottom: 28px; scroll-margin-top: var(--stick);
  border: 1px solid var(--line); border-radius: 10px; padding: 20px 15px; }
.cat-title { margin: 0; font-size: 20px; color: var(--brand); }
.cat-grid { margin-top: 16px; }
.loading, .error { padding: 40px; text-align: center; color: var(--muted); }
.back { display: inline-block; color: var(--brand);
  text-decoration: none; font-weight: 600; }
.sop { margin: 12px 0 4px; overflow-x: auto; }
.sop-intro { color: var(--text); line-height: 1.55; margin: 0 0 16px; }
.sop-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.sop-table th { background: var(--brand); color: #fff; text-align: left;
  padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--brand); }
.sop-table td { border: 1px solid var(--line); padding: 12px 14px; vertical-align: top;
  line-height: 1.5; width: 33.33%; }
.sop-table ul, .sop-table ol { margin: 0; padding-left: 18px; }
/* Mobile: stack the three columns with their labels instead of a scrolling table */
@media (max-width: 600px){
  .sop { overflow-x: visible; }
  .sop-table { min-width: 0; }
  .sop-table thead { display: none; }
  .sop-table tr { display: block; }
  .sop-table td { display: block; width: auto; border: none;
    border-bottom: 1px solid var(--line); padding: 12px 0; }
  .sop-table tr td:last-child { border-bottom: none; }
  .sop-table td::before { content: attr(data-label); display: block; margin-bottom: 6px;
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; color: var(--brand); }
}
/* Two-column layout: sticky rail + results */
.page-title { margin: 20px 0 8px; font-size: 24px; color: var(--brand); }
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px;
  padding: 12px 0 40px; align-items: start; }
.rail { position: sticky; top: var(--stick); align-self: start;
  max-height: calc(100vh - var(--stick) - 24px); overflow: auto; padding-right: 4px; }
.rail-close { display: none; }
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.f-search { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; background: #fff; }
.f-search:focus { outline: none; border-color: var(--brand); }
.fgroup { border-bottom: 1px solid var(--line); }
.fgroup-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 2px;
  background: none; border: none; cursor: pointer; font-size: 14px; color: var(--text);
  text-align: left; }
.fgroup-head.active { color: var(--brand); font-weight: 600; }
.fgroup-head .caret { margin-left: auto; color: var(--muted); font-size: 11px; transition: transform .15s; }
.fgroup-head.open .caret { transform: rotate(90deg); }
.fgroup-badge { background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; line-height: 1; padding: 3px 7px; }
.fgroup-body { padding: 2px 0 10px; overflow: auto; }
.fopt { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 6px;
  font-size: 14px; cursor: pointer; }
.fopt:hover { background: #f1f5f4; }
.fopt input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.clear { width: 100%; margin-top: 14px; background: none; color: var(--brand);
  border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; }
.clear:hover { border-color: var(--brand); }
/* Results column toolbar */
.results-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; min-height: 32px; }
.results-top .count { color: var(--muted); font-size: 14px; }
.filters-toggle { display: none; align-items: center; gap: 7px; padding: 8px 14px;
  border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--text); }
.active-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rail-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
/* Mobile: rail becomes a drawer */
@media (max-width: 899px){
  .layout { grid-template-columns: 1fr; }
  .rail { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 40;
    background: #fff; box-shadow: 2px 0 16px rgba(0,0,0,.18); padding: 16px;
    max-height: none; transform: translateX(-100%); transition: transform .2s ease; }
  .rail.open { transform: translateX(0); }
  .rail-close { display: block; float: right; border: none; background: none;
    font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
  .filters-toggle { display: inline-flex; }
  /* Keep search + filters stuck below the catalog chips on mobile */
  .results-head { position: sticky; top: calc(var(--stick) - 2px); z-index: 15;
    background: var(--bg); padding-bottom: 10px; }
  .search-row { margin-bottom: 10px; }
  .filters-toggle { flex: 0 0 auto; }
  .results-top { margin-bottom: 0; }
  .catalog-section { scroll-margin-top: 150px; }
}
.active-chip { border: none; background: #e6f2ee; color: var(--brand); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; }
.active-chip:hover { background: #d3e8e1; }
.active-chip span { font-size: 15px; line-height: 1; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px;
  border-radius: 999px; }
.badge.in { background: #e6efec; color: var(--brand); }
.badge.no { background: #f1f2f2; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11px; background: #eef1f0; color: var(--text); padding: 2px 8px;
  border-radius: 999px; }
.placeholder { width: 100%; aspect-ratio: 1/1; background:
  repeating-linear-gradient(45deg,#eee,#eee 10px,#f6f6f6 10px,#f6f6f6 20px);
  display: grid; place-items: center; color: #aaa; font-size: 12px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); max-width: 760px; width: 100%;
  max-height: 90vh; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; }
.modal img, .modal .placeholder { width: 100%; height: 100%; min-height: 280px;
  object-fit: cover; }
.modal .info { padding: 20px; }
.modal h2 { margin: 0 0 6px; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.modal-share { display: inline-flex; align-items: center; gap: 7px; background: var(--brand);
  color: #fff; border: none; padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; font-weight: 600; }
.modal-share:hover { background: var(--brand-dark); }
.modal-share svg { width: 16px; height: 16px; }
.modal dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; }
.modal dt { color: var(--muted); font-size: 13px; }
.modal dd { margin: 0; font-size: 14px; }
.modal .x { position: sticky; top: 0; float: right; border: none; background: none;
  font-size: 24px; cursor: pointer; color: var(--muted); }
.detail-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; }
.cat-nav { position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.cat-nav-chips { display: flex; gap: 8px; overflow-x: auto; flex: 1;
  padding: 4px 0; scrollbar-width: none; -ms-overflow-style: none; }
.cat-nav-chips::-webkit-scrollbar { display: none; }
.cat-chip { flex: 0 0 auto; padding: 6px 13px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; font-size: 13px; cursor: pointer;
  color: var(--text); white-space: nowrap; }
.cat-chip:hover { border-color: var(--brand); }
.cat-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.share-btn { flex: 0 0 auto; width: 38px; height: 38px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; background: var(--brand);
  color: #fff; border: none; border-radius: 50%; cursor: pointer; }
.share-btn:hover { background: var(--brand-dark); }
.share-btn svg { width: 18px; height: 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand-dark); color: #fff; padding: 10px 18px; border-radius: 8px;
  z-index: 60; }
@media (max-width: 640px){ .modal { grid-template-columns: 1fr; } }

/* Info sections: Martindale rating + FAQs */
.info-section { max-width: var(--maxw); margin: 40px auto; padding: 0 5px; }
.info-title { font-size: 22px; color: var(--brand); margin: 0 0 14px; }
.info-lead { color: var(--text); line-height: 1.6; margin: 0 0 18px;}
.info-table { width: 100%; border-collapse: collapse; }
.info-table th { background: var(--brand); color: #fff; text-align: left; padding: 10px 14px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--brand); }
.info-table td { border: 1px solid var(--line); padding: 12px 14px; vertical-align: top; line-height: 1.5; }
.info-table td:first-child { white-space: nowrap; font-weight: 600; }
.info-note { color: var(--text); line-height: 1.6; margin: 16px 0 0; }
.faq { border-bottom: 1px solid var(--line); }
.faq:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 4px; font-weight: 600; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--brand); font-size: 22px; font-weight: 400;
  line-height: 1; flex: 0 0 auto; }
.faq[open] summary::after { content: '\2013'; }
.faq p { margin: 0 0 16px; padding: 0 4px; color: var(--muted); line-height: 1.6; }
