:root {
  --ink: #202124;
  --muted: #646761;
  --line: #dedbd2;
  --paper: #f7f4ed;
  --panel: #fffdf8;
  --accent: #1f6f64;
  --accent-dark: #164f48;
  --coral: #b85c4c;
  --gold: #c59844;
  --shadow: 0 18px 45px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(32, 33, 36, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(0deg, rgba(32, 33, 36, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 54px);
  background: rgba(255, 253, 248, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand-block h1,
.hero-copy h2,
.panel-header h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 700;
  text-transform: lowercase;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-button,
.ghost-button,
.chip,
.select-toggle {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.icon-button {
  width: 42px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.2rem;
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 750;
}

.primary-button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.ghost-button,
.chip {
  padding: 0 14px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.chip:hover,
.select-toggle:hover {
  transform: translateY(-1px);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 52px;
}

.catalog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(22px, 4vw, 54px);
  align-items: stretch;
  min-height: 330px;
  padding: clamp(24px, 5vw, 56px) 0;
}

.hero-copy {
  align-self: center;
}

.hero-copy h2 {
  max-width: 760px;
  font-size: clamp(2.35rem, 6vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 570px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.hero-swatch {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 12px;
  min-height: 300px;
}

.hero-swatch span {
  border: 1px solid rgba(32, 33, 36, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.42), transparent 38%, rgba(0, 0, 0, 0.12)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 2px, rgba(0,0,0,0.08) 2px 4px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.12) 0 1px, rgba(0,0,0,0.08) 1px 3px),
    var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.hero-swatch span:nth-child(2),
.hero-swatch span:nth-child(5) {
  transform: translateY(28px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 2fr) minmax(170px, 0.6fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(32, 33, 36, 0.06);
}

.search-box,
.select-box,
.enquiry-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.search-box input,
.select-box select,
.enquiry-form input,
.enquiry-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
  text-transform: none;
}

.search-box input:focus,
.select-box select:focus,
.enquiry-form input:focus,
.enquiry-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 100, 0.14);
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 16px;
}

.summary-row p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 16px;
}

.fabric-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(32, 33, 36, 0.06);
}

.swatch-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.45 / 1;
  border: 0;
  border-bottom: 1px solid rgba(32, 33, 36, 0.14);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.45), transparent 27%),
    linear-gradient(130deg, rgba(255, 255, 255, 0.24), transparent 46%, rgba(0, 0, 0, 0.18)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.17) 0 2px, rgba(0,0,0,0.08) 2px 4px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.12) 0 1px, rgba(0,0,0,0.08) 1px 3px),
    var(--fabric-color);
}

.swatch-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(45deg, transparent 48%, rgba(255,255,255,0.16) 50%, transparent 52%);
  background-size: 15px 15px;
  opacity: var(--pattern-opacity, 0);
}

.swatch-text {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  min-width: 68px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(32, 33, 36, 0.12);
}

.card-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
}

.code {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.fabric-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.select-toggle {
  min-width: 82px;
  padding: 0 11px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-weight: 750;
}

.fabric-card.selected .select-toggle {
  background: var(--gold);
  border-color: var(--gold);
  color: #241d0f;
}

.fabric-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.fabric-meta div {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.fabric-meta div:last-child {
  border-right: 0;
}

.fabric-meta dt,
.fabric-meta dd {
  margin: 0;
}

.fabric-meta dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fabric-meta dd {
  margin-top: 3px;
  font-size: 0.82rem;
  font-weight: 700;
}

.inquiry-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.inquiry-panel.open {
  display: block;
}

.panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(32, 33, 36, 0.35);
}

.panel-card {
  position: absolute;
  top: 0;
  right: 0;
  width: min(430px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.selected-list {
  display: grid;
  gap: 10px;
  min-height: 54px;
  margin-bottom: 18px;
}

.selected-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-swatch {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.17) 0 2px, rgba(0,0,0,0.08) 2px 4px),
    var(--fabric-color);
  border: 1px solid rgba(32, 33, 36, 0.12);
}

.selected-item p {
  margin: 0;
  font-weight: 800;
}

.selected-item small {
  color: var(--muted);
  font-weight: 700;
}

.remove-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.enquiry-form {
  display: grid;
  gap: 12px;
}

.form-status {
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-weight: 750;
  line-height: 1.5;
}

@media (max-width: 820px) {
  .app-header {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .catalog-hero,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    font-size: clamp(2.1rem, 13vw, 4rem);
  }

  .hero-swatch {
    min-height: 220px;
  }

  .summary-row {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .primary-button {
    padding: 0 12px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .fabric-meta {
    grid-template-columns: 1fr;
  }

  .fabric-meta div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .fabric-meta div:last-child {
    border-bottom: 0;
  }
}
