/* ===================================================
   Tokens
=================================================== */
:root{
  --bg: #F6F7F5;
  --panel: #FFFFFF;
  --ink: #16181B;
  --ink-soft: #565B58;
  --line: #E3E6E1;
  --accent: #1F6F5C;
  --accent-ink: #0F4A3C;
  --accent-soft: #E4F0EB;
  --warn: #C0392B;
  --warn-soft: #FBEAE8;
  --amber: #DB9A31;
  --amber-soft: #FBF0DD;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22,24,27,.04), 0 6px 20px rgba(22,24,27,.05);
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

*{ box-sizing: border-box; }
html{ scroll-padding-top: 90px; }
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3{ font-family: var(--font-head); margin: 0 0 .4em; line-height: 1.15; }
p{ margin: 0 0 1em; color: var(--ink-soft); }
a{ color: var(--accent-ink); text-decoration: none; }
a:hover{ text-decoration: underline; }
img{ max-width: 100%; display:block; }
button{ font-family: inherit; }

.wrap{
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===================================================
   Header
=================================================== */
.site-header{
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  height: 68px;
  gap: 24px;
}
.logo{
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  display:flex;
  align-items:center;
  gap:10px;
}
.logo:hover{ text-decoration:none; }
.logo__mark{
  width: 22px; height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--accent), var(--amber), var(--accent));
  flex: none;
}
.logo__mark--image{
  width: 32px; height: 32px;
  border-radius: 8px;
  background: none;
  object-fit: contain;
}
.main-nav{
  display:flex;
  align-items:center;
  gap: 28px;
  font-weight: 500;
}
.main-nav a{ color: var(--ink-soft); position:relative; }
.main-nav a:hover{ color: var(--ink); text-decoration:none; }
.main-nav a.is-active{ color: var(--ink); }
.nav-request{
  display:flex; align-items:center; gap:6px;
  color: var(--ink) !important;
}
.cart-count{
  background: var(--accent);
  color:#fff;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 0 5px;
}
.cart-count[data-empty="true"]{ background: var(--ink-soft); opacity:.5; }

/* ===================================================
   Hero
=================================================== */
.hero{
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}
.hero h1{
  font-size: clamp(30px, 4vw, 42px);
  max-width: 14ch;
}
.hero p{
  max-width: 52ch;
  font-size: 17px;
}
.hero__cta{
  display:inline-flex;
  margin-top: 6px;
}

/* ===================================================
   Catalogue layout
=================================================== */
.catalogue{
  padding: 40px 0 80px;
}

/* Filters (horizontal bar) */
.filters{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 26px;
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap: 20px 32px;
}
.filter-group{ margin-bottom: 0; }
.filter-group--search{ min-width: 220px; }
.filter-group__label{
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
  display:block;
}
.filter-search{
  width: 220px;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
}

.filter-group--price{ min-width: 200px; }
.price-slider{
  position: relative;
  height: 32px;
  margin-top: 4px;
}
.price-slider input[type="range"]{
  position: absolute;
  top: 12px; left: 0;
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  pointer-events: none;
}
.price-slider input[type="range"]::-webkit-slider-runnable-track{
  height: 4px;
  background: var(--line);
  border-radius: 2px;
}
.price-slider input[type="range"]::-moz-range-track{
  height: 4px;
  background: var(--line);
  border-radius: 2px;
}
.price-slider input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  margin-top: -6px;
  cursor: pointer;
}
.price-slider input[type="range"]::-moz-range-thumb{
  pointer-events: auto;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  cursor: pointer;
}
.filter-search:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }

.chip-list{ display:flex; flex-wrap:wrap; gap: 8px; }
.chip{
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.chip:hover{ border-color: var(--accent); color: var(--ink); }
.chip.is-active{
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.colour-chip{ display:flex; align-items:center; gap: 7px; }
.colour-dot{
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex: none;
}
.clear-filters{
  width:100%;
  text-align:center;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor:pointer;
}
.clear-filters:hover{ border-color: var(--warn); color: var(--warn); }

/* Product grid */
.catalogue__main{ min-width:0; }
.catalogue__toolbar{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  margin-bottom: 16px;
}
.catalogue__count{ font-size: 14px; color: var(--ink-soft); }

.product-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 1000px){
  .product-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .product-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px){
  .product-grid{ grid-template-columns: 1fr; }
}
/* .hidden is set via JS during filtering — the [hidden] attribute alone
   can be overridden by the .product-card display rule below it, so this
   rule needs the extra specificity to reliably hide filtered-out cards. */
.product-grid .product-card[hidden]{
  display: none;
}

.product-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.product-card__top{
  display:flex;
  align-items:flex-start;
  gap: 10px;
}
.product-card__info{
  flex: 1;
  min-width: 0;
}
.product-card__swatch{
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
  flex: none;
  margin-top: 2px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.product-card__name{
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}
.product-card__name:hover{ text-decoration: underline; }
.product-card__material{
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.product-card__price{
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  margin-left: auto;
  white-space: nowrap;
}
.product-card__stock{
  font-size: 13px;
  font-weight: 500;
  display:inline-flex;
  align-items:center;
  gap:6px;
  color: var(--accent-ink);
}
.product-card__stock::before{
  content:"";
  width:7px; height:7px;
  border-radius:50%;
  background: var(--accent);
}
.product-card__stock.is-low{ color: var(--amber); }
.product-card__stock.is-low::before{ background: var(--amber); }
.product-card__stock.is-out{ color: var(--warn); }
.product-card__stock.is-out::before{ background: var(--warn); }

.product-card__footer{
  margin-top: auto;
  display:flex;
  align-items:center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.qty-control{
  display:flex;
  align-items:center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow:hidden;
}
.qty-control button{
  width: 30px; height: 32px;
  border: none;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  cursor:pointer;
}
.qty-control button:hover{ background: var(--accent-soft); }
.qty-control input{
  width: 36px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align:center;
  height: 32px;
  font-size: 14px;
  -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  cursor:pointer;
}
.btn:hover{ text-decoration:none; }
.btn-primary{ background: var(--accent); color:#fff; }
.btn-primary:hover{ background: var(--accent-ink); }
.btn-primary:disabled{ background: var(--line); color: var(--ink-soft); cursor:not-allowed; }
.btn-secondary{ background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover{ border-color: var(--ink); }
.btn-danger{ background: var(--warn-soft); color: var(--warn); }
.btn-danger:hover{ background: var(--warn); color: #fff; }
.btn-block{ width:100%; }
.btn-sm{ padding: 6px 12px; font-size: 13px; }

.add-to-request{ flex:1; }
.add-to-request.is-added{ background: var(--accent-ink); }

.empty-state[hidden]{
  display: none;
}
.empty-state{
  padding: 60px 20px;
  text-align:center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

/* ===================================================
   Modal (product popup)
=================================================== */
.modal-overlay{
  position: fixed; inset:0;
  background: rgba(15,17,15,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden]{ display:none; }
.modal{
  background: var(--panel);
  border-radius: 14px;
  max-width: 620px;
  width:100%;
  max-height: 88vh;
  overflow-y:auto;
  position:relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal__close{
  position:absolute;
  top: 14px; right: 14px;
  width: 34px; height:34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 18px;
  cursor:pointer;
  line-height:1;
}
.modal__image{
  width:100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
}
.modal__image-placeholder{
  width:100%;
  aspect-ratio: 4/3;
  border-radius: 14px 14px 0 0;
  display:flex; align-items:center; justify-content:center;
}
.modal__gallery{
  display:flex; gap:8px; overflow-x:auto;
  padding: 10px 28px 0;
}
.modal__gallery[hidden]{ display:none; }
.modal__gallery img{
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  flex: none;
}
.modal__gallery img.is-active{ border-color: var(--accent); }
.modal__body{ padding: 24px 28px 28px; }
.modal__colour-row{
  display:flex; align-items:center; gap:10px;
  margin-bottom: 6px;
}
.modal__title{ font-size: 22px; margin-bottom: 2px; }
.modal__meta{
  display:grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px 20px;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.modal__meta dt{ font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.modal__meta dd{ margin:0; font-weight:600; font-size:14px; }
.modal__section-title{ font-size: 14px; margin: 18px 0 6px; }
.modal__material-info{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.modal__material-info[hidden]{ display:none; }
.modal__material-info .modal__meta{
  border: none; padding: 0; margin: 10px 0 0;
  grid-template-columns: 1fr;
  gap: 10px;
}
.modal__material-info .modal__meta dd{ font-weight: 500; font-size: 13px; color: var(--ink-soft); }
.modal__footer{ display:flex; align-items:center; gap:12px; margin-top: 18px; }

/* ===================================================
   Request page
=================================================== */
.page-header{
  padding: 44px 0 8px;
}
.page-header h1{ font-size: 30px; }

.request-page{ padding-bottom: 80px; }
.request-table{
  width:100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.request-table th, .request-table td{
  padding: 14px 16px;
  text-align:left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.request-table th{
  background: var(--bg);
  font-size: 12px;
  text-transform: none;
  color: var(--ink-soft);
  font-weight:600;
}
.request-table tr:last-child td{ border-bottom:none; }
.request-item__name{ font-weight:600; }
.request-item__remove{
  background:none; border:none; color: var(--warn);
  cursor:pointer; font-size: 13px; font-weight:600;
}
.request-actions{
  display:flex; justify-content:space-between; align-items:center;
  margin: 16px 0 40px;
}
.request-summary{
  display:flex; flex-direction:column; align-items:flex-end;
  font-size: 14px;
  margin: 16px 0 24px;
  gap: 6px;
}
.request-summary__row{ display:flex; gap:8px; color: var(--ink-soft); }
.request-summary__row strong{ color: var(--ink); min-width: 80px; text-align:right; }
.request-summary__row--total{ font-size: 16px; color: var(--ink); padding-top:6px; border-top:1px solid var(--line); margin-top:4px; }
.request-summary__row--total strong{ font-family: var(--font-head); font-size: 18px; }

.discount-box{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  max-width: 360px;
  margin-left: auto;
}
.discount-box label{ font-size: 13px; font-weight:600; display:block; margin-bottom:8px; }
.discount-box__row{ display:flex; gap:8px; }
.discount-box__row input{
  flex:1;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px){ .form-grid{ grid-template-columns: 1fr; } }
.form-field{ display:flex; flex-direction:column; gap: 6px; margin-bottom: 16px; }
.form-field.full{ grid-column: 1 / -1; }
.form-field label{ font-size: 13px; font-weight:600; }
.form-field input, .form-field textarea{
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel);
}
.form-field input:focus, .form-field textarea:focus{
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.form-note{ font-size: 13px; color: var(--ink-soft); margin-top: -6px; }
.form-note-inline{ font-weight: 400; color: var(--ink-soft); font-size: 12px; }

.choice-group{ margin: 20px 0; }
.choice-list{
  display:flex; flex-direction:column; gap:8px;
  margin-top: 8px;
}
.choice-option{
  display:flex; align-items:center; gap:10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  background: var(--panel);
}
.choice-option:has(input:checked){
  border-color: var(--accent);
  background: var(--accent-soft);
}
.choice-option input{ width:16px; height:16px; flex:none; }
.choice-option span:first-of-type{ flex:1; }
.choice-option__price{ font-weight:600; color: var(--ink-soft); font-size:13px; }

.company-bill-toggle{
  display:flex; align-items:center; gap:8px;
  font-size: 14px; font-weight:500;
  margin: 4px 0 16px;
  cursor: pointer;
}
.company-bill-toggle input{ width:17px; height:17px; }
#company-bill-fields{ margin-bottom: 20px; }
#company-bill-fields[hidden]{ display:none; }

.status-banner{
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
}
.status-banner.success{ background: var(--accent-soft); color: var(--accent-ink); }
.status-banner.error{ background: var(--warn-soft); color: var(--warn); }

/* ===================================================
   Contact page
=================================================== */
.contact-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 40px 0 80px;
}
@media (max-width: 700px){ .contact-grid{ grid-template-columns: 1fr; } }
.contact-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.contact-card dt{ font-size:12px; color:var(--ink-soft); margin-top:14px; }
.contact-card dd{ margin:2px 0 0; font-weight:600; }

/* ===================================================
   Footer
=================================================== */
.site-footer{
  border-top: 1px solid var(--line);
  padding: 32px 0;
  background: var(--panel);
}
.site-footer__inner{
  display:flex;
  flex-wrap:wrap;
  gap: 24px;
  justify-content:space-between;
  font-size: 14px;
}
.site-footer p{ margin: 2px 0; }
.site-footer__admin a{ color: var(--ink-soft); font-size: 13px; }

/* ===================================================
   Utility
=================================================== */
.visually-hidden{
  position:absolute; width:1px; height:1px;
  overflow:hidden; clip: rect(0 0 0 0); white-space:nowrap;
}
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; }
}

/* ===================================================
   Product card thumbnail
=================================================== */
.product-card__thumb{
  display:block;
  width:100%;
  aspect-ratio: 4 / 3;
  padding:0;
  border:1px solid var(--line);
  border-radius: 8px;
  overflow:hidden;
  background: var(--bg);
  cursor:pointer;
}
.product-card__thumb img{
  width:100%; height:100%;
  object-fit: cover;
}
.product-card__thumb-placeholder{
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
}
.product-card__thumb-dot{
  width: 44px; height: 44px;
  border-radius:50%;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.35);
}
