/* THB Catalog Refinement v1
   Compact hero, clearer discovery controls, consistent product cards, responsive layout.
   Intentionally limited to katalog.php components. */

body .page-shell .catalog-hero {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  align-items: center;
  gap: clamp(18px, 2.8vw, 34px);
  padding: clamp(22px, 2.8vw, 34px) clamp(22px, 3vw, 38px);
  margin-bottom: 18px;
  border-radius: 26px;
  box-shadow: 0 14px 34px rgba(31, 67, 45, .075);
}

body .page-shell .catalog-hero .eyebrow {
  margin: 0 0 8px;
  font-size: .72rem;
  letter-spacing: .16em;
}

body .page-shell .catalog-hero h1 {
  max-width: 18ch;
  margin: 5px 0 10px;
  font-size: clamp(2.2rem, 3.6vw, 3.35rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}

body .page-shell .catalog-hero p:not(.eyebrow) {
  max-width: 60ch;
  margin: 0;
  font-size: .95rem;
  line-height: 1.65;
}

body .page-shell .catalog-summary {
  min-width: 0;
  padding: 17px 19px;
  border-radius: 20px;
  box-shadow: 0 8px 22px rgba(23, 63, 43, .045);
}

body .page-shell .catalog-summary strong {
  font-size: clamp(1.8rem, 2.6vw, 2.2rem);
  line-height: 1.12;
  letter-spacing: -.025em;
}

body .page-shell .catalog-summary span {
  margin: 3px 0 10px;
  font-size: .88rem;
}

body .page-shell .catalog-summary a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .88rem;
  line-height: 1.4;
}

body .page-shell .catalog-tools {
  grid-template-columns: minmax(250px, 1.6fr) minmax(180px, 1fr) minmax(170px, .95fr) minmax(100px, .45fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 25px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 24px rgba(31, 67, 45, .045);
}

body .page-shell .catalog-tools label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body .page-shell .catalog-tools label span,
body .page-shell .catalog-tool-count span {
  margin-bottom: 6px;
  font-size: .7rem;
  letter-spacing: .075em;
}

body .page-shell .catalog-tools input,
body .page-shell .catalog-tools select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #dce5dc;
  border-radius: 13px;
  background: #fff;
  color: #203528;
  font: 500 .92rem/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

body .page-shell .catalog-tools input::placeholder { color: #8a968d; }
body .page-shell .catalog-tools input:focus,
body .page-shell .catalog-tools select:focus {
  outline: none;
  border-color: #39855a;
  box-shadow: 0 0 0 3px rgba(39, 117, 69, .12);
}

body .page-shell .catalog-tool-count {
  min-width: 0;
  align-self: center;
  padding: 0 4px 3px;
  white-space: nowrap;
}

body .page-shell .catalog-tool-count strong {
  display: block;
  margin-top: 2px;
  color: #195e39;
  font-size: .95rem;
  line-height: 1.35;
}

body .page-shell #katalog.catalog-modern {
  margin-bottom: 30px;
}

body .page-shell #katalog .section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

body .page-shell #katalog .section-head .eyebrow {
  margin-bottom: 7px;
  font-size: .7rem;
}

body .page-shell #katalog .section-head h2 {
  margin: 0;
  line-height: 1.12;
}

body .page-shell #katalog .section-head p:not(.eyebrow) {
  margin-top: 7px;
  line-height: 1.55;
}

body .page-shell #katalog .collection-count {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #dce8de;
  border-radius: 999px;
  background: #f5faf5;
  color: #285e3d;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .045em;
  white-space: nowrap;
}

body .page-shell #catalog-grid.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 22px 18px;
}

body .page-shell #catalog-grid .catalog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e1e9e1;
  border-radius: 19px;
  background: linear-gradient(155deg, #fff 0%, #fcfdfb 70%, #f6f9f5 100%);
  box-shadow: 0 6px 19px rgba(24, 63, 42, .045);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

@media (hover: hover) and (pointer: fine) {
  body .page-shell #catalog-grid .catalog-card:hover {
    transform: translateY(-4px);
    border-color: #c1d8c5;
    box-shadow: 0 15px 32px rgba(24, 63, 42, .105);
  }
}

body .page-shell #catalog-grid .catalog-card .card-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.12;
  margin: 0;
  padding: 15px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid #edf2ed;
  border-radius: 0;
  background: linear-gradient(145deg, #f1f6f0 0%, #f8f8f2 52%, #eff5f0 100%);
}

body .page-shell #catalog-grid .catalog-card .card-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform .28s ease;
}

@media (hover: hover) and (pointer: fine) {
  body .page-shell #catalog-grid .catalog-card .card-image:hover img { transform: scale(1.035); }
}

body .page-shell #catalog-grid .catalog-card .book {
  width: min(78%, 220px);
  min-height: 78%;
  padding: 15px;
  border-radius: 4px;
}

body .page-shell #catalog-grid .catalog-card .card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: 14px 15px 15px;
}

body .page-shell #catalog-grid .catalog-card .card-body > p:first-child {
  margin: 0 0 5px;
  color: #7a8b7e;
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .045em;
  line-height: 1.45;
}

body .page-shell #catalog-grid .catalog-card .catalog-card-price {
  min-height: 24px;
  margin: 6px 0 4px;
  color: #176b43;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.3;
}

body .page-shell #catalog-grid .catalog-card .catalog-card-price .discount-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 8px;
}

body .page-shell #catalog-grid .catalog-card .catalog-card-price .discount-new {
  color: #176b43;
  font-size: 1rem;
  font-weight: 900;
}

body .page-shell #catalog-grid .catalog-card .catalog-card-price .discount-old {
  color: #8b968d;
  font-size: .75rem;
}

body .page-shell #catalog-grid .catalog-card .card-body h3 {
  min-height: 2.7em;
  margin: 4px 0 0;
  color: #213b2c;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.37;
  overflow-wrap: anywhere;
}

body .page-shell #catalog-grid .catalog-card .card-body h3 .product-detail-link {
  color: inherit;
  text-decoration: none;
}

body .page-shell #catalog-grid .catalog-card .card-body h3 .product-detail-link:hover { color: #1f7548; }

body .page-shell #catalog-grid .catalog-card .card-body .desc {
  display: -webkit-box;
  min-height: 2.7em;
  margin: 7px 0 0;
  overflow: hidden;
  color: #758278;
  font-size: .76rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body .page-shell #catalog-grid .catalog-card .card-bottom {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

body .page-shell #catalog-grid .catalog-card .card-bottom form {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

body .page-shell #catalog-grid .catalog-card .card-bottom button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 39px;
  padding: 9px 12px;
  border: 1px solid #247447;
  border-radius: 999px;
  background: #247447;
  color: #fff;
  font: 800 .8rem/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

body .page-shell #catalog-grid .catalog-card .card-bottom button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #174d31;
  background: #174d31;
}

body .page-shell #catalog-grid .catalog-card .card-bottom button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

body .page-shell .catalog-pagination {
  margin-top: 24px;
  border-radius: 18px;
}

@media (max-width: 1120px) {
  body .page-shell .catalog-hero { grid-template-columns: minmax(0, 1fr) minmax(150px, 190px); }
  body .page-shell .catalog-tools {
    grid-template-columns: minmax(220px, 1.4fr) minmax(165px, 1fr);
  }
  body .page-shell .catalog-tool-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    grid-column: 1 / -1;
    padding: 3px 4px 0;
  }
  body .page-shell .catalog-tool-count span { margin: 0; }
  body .page-shell .catalog-tool-count strong { margin: 0; }
  body .page-shell #catalog-grid.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body .page-shell .catalog-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    padding: 21px 18px;
    margin-bottom: 13px;
    border-radius: 21px;
  }
  body .page-shell .catalog-hero h1 {
    max-width: 100%;
    margin: 6px 0 9px;
    font-size: clamp(2rem, 8vw, 2.7rem);
    line-height: 1.02;
  }
  body .page-shell .catalog-hero p:not(.eyebrow) {
    font-size: .88rem;
    line-height: 1.55;
  }
  body .page-shell .catalog-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 8px;
    padding: 11px 13px;
    border-radius: 15px;
  }
  body .page-shell .catalog-summary strong {
    display: inline-block;
    margin: 0 2px 0 0;
    font-size: 1.5rem;
  }
  body .page-shell .catalog-summary span { margin: 0; font-size: .8rem; }
  body .page-shell .catalog-summary a {
    margin-left: auto;
    font-size: .78rem;
    text-align: right;
  }
  body .page-shell .catalog-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 21px;
    padding: 11px;
    border-radius: 17px;
  }
  body .page-shell .catalog-tools .catalog-search { grid-column: 1 / -1; }
  body .page-shell .catalog-tools label span,
  body .page-shell .catalog-tool-count span { font-size: .65rem; }
  body .page-shell .catalog-tools input,
  body .page-shell .catalog-tools select { min-height: 44px; padding: 10px 11px; border-radius: 11px; font-size: .82rem; }
  body .page-shell .catalog-tool-count {
    grid-column: 1 / -1;
    padding: 2px 3px 0;
  }
  body .page-shell .catalog-tool-count strong { font-size: .84rem; }
  body .page-shell #katalog .section-head {
    align-items: center;
    gap: 9px;
    margin-bottom: 15px;
  }
  body .page-shell #katalog .section-head .eyebrow { margin-bottom: 5px; font-size: .61rem; }
  body .page-shell #katalog .section-head h2 { font-size: clamp(1.45rem, 6vw, 1.8rem); }
  body .page-shell #katalog .section-head p:not(.eyebrow) { margin-top: 5px; font-size: .76rem; }
  body .page-shell #katalog .collection-count { padding: 6px 8px; font-size: .58rem; }
  body .page-shell #catalog-grid.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 10px;
  }
  body .page-shell #catalog-grid .catalog-card { border-radius: 14px; }
  body .page-shell #catalog-grid .catalog-card .card-image {
    aspect-ratio: 1 / 1.08;
    padding: 9px;
  }
  body .page-shell #catalog-grid .catalog-card .card-body { padding: 10px 10px 11px; }
  body .page-shell #catalog-grid .catalog-card .card-body > p:first-child {
    margin-bottom: 4px;
    font-size: .59rem;
    letter-spacing: .015em;
  }
  body .page-shell #catalog-grid .catalog-card .catalog-card-price {
    min-height: 21px;
    margin: 5px 0 3px;
    font-size: .85rem;
  }
  body .page-shell #catalog-grid .catalog-card .catalog-card-price .discount-new { font-size: .85rem; }
  body .page-shell #catalog-grid .catalog-card .catalog-card-price .discount-old { font-size: .65rem; }
  body .page-shell #catalog-grid .catalog-card .card-body h3 {
    min-height: 2.7em;
    font-size: .82rem;
    line-height: 1.33;
  }
  body .page-shell #catalog-grid .catalog-card .card-body .desc {
    min-height: 0;
    margin-top: 5px;
    font-size: .68rem;
    line-height: 1.4;
  }
  body .page-shell #catalog-grid .catalog-card .card-bottom { gap: 5px; padding-top: 10px; }
  body .page-shell #catalog-grid .catalog-card .card-bottom button {
    min-height: 35px;
    padding: 8px 5px;
    font-size: .68rem;
    border-radius: 10px;
  }
  body .page-shell .catalog-pagination { margin-top: 17px; }
}

@media (max-width: 370px) {
  body .page-shell .catalog-summary { align-items: flex-start; }
  body .page-shell .catalog-summary a { flex-basis: 100%; margin: 2px 0 0; text-align: left; }
  body .page-shell #katalog .collection-count { display: none; }
  body .page-shell #catalog-grid .catalog-card .card-body { padding: 9px; }
  body .page-shell #catalog-grid .catalog-card .card-bottom button { font-size: .64rem; }
}

@media (prefers-reduced-motion: reduce) {
  body .page-shell #catalog-grid .catalog-card,
  body .page-shell #catalog-grid .catalog-card .card-image img,
  body .page-shell #catalog-grid .catalog-card .card-bottom button {
    transition: none !important;
  }
}
