/* Catalog, product page and home sections. Tokens come from base.css. */

.catalog, .product { padding: clamp(24px, 4vw, 48px) 0 clamp(48px, 8vw, 96px); }
.catalog-title { font-family: var(--font-display); font-size: clamp(32px, 5vw, 48px); font-weight: 600; letter-spacing: -.02em; margin: 8px 0 24px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }
.crumbs [aria-current] { color: var(--text); }

/* toolbar */
/* R09.6: every flex/grid child may shrink below its content width — nothing pushes the page past the right edge at ~800 px */
.catalog-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 28px; max-width: 100%; }
.catalog-toolbar > * { min-width: 0; }
.catalog-search { flex: 1 1 240px; min-width: 0; border-radius: var(--radius-pill); padding-left: 20px; font-size: 17px; }
.catalog-sort { width: auto; max-width: 100%; flex: 0 1 auto; border-radius: var(--radius-pill); text-overflow: ellipsis; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--blue); }
.js .catalog-toolbar [data-nojs-submit] { display: none; }

/* layout: tree + results */
.catalog-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.catalog-layout > * { min-width: 0; }
.catalog-tree { position: sticky; top: calc(var(--header-h) + 16px); font-size: 15px; }
.catalog-tree summary { font-weight: 600; cursor: pointer; list-style: none; margin-bottom: 8px; color: var(--text); }
.catalog-tree summary::-webkit-details-marker { display: none; }
.catalog-tree .cats-current, .catalog-tree .cats-chevron { display: none; }
.catalog-tree ul { list-style: none; margin: 0; padding: 0; }
.catalog-tree ul ul { padding-left: 14px; border-left: 1px solid var(--line-soft); margin: 2px 0 4px 10px; }
.catalog-tree a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.catalog-tree a:hover { background: var(--surface-alt); }
.catalog-tree a[aria-current] { background: var(--navy); color: #fff; }
.catalog-tree a[aria-current] .tree-count { color: rgba(255, 255, 255, .7); }
.tree-count { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.catalog-tree .catalog-configurator { display: block; margin-top: 12px; padding: 12px 10px 0; border-top: 1px solid var(--line-soft); border-radius: 0; color: var(--blue); }
.catalog-tree .catalog-configurator:hover { background: none; }
.catalog-configurator span { display: block; font-weight: 500; }
.catalog-configurator small { display: block; color: var(--text-2); font-size: 13px; margin-top: 2px; }
.catalog-note { margin: -12px 0 24px; font-size: 15px; color: var(--text-2); }
.catalog-note a { color: var(--blue); font-weight: 500; margin-right: 8px; }

.catalog-count { color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.catalog-results.is-loading { opacity: .55; transition: opacity .15s var(--ease); }

/* cards */
.product-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.product-grid > * { min-width: 0; }
.product-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; transition: transform .25s var(--ease), border-color .25s var(--ease); }
.product-card:hover { transform: translateY(-2px); border-color: var(--line); }
.product-card > a { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.pc-media { aspect-ratio: 4 / 3; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; }
.pc-media img { width: 100%; height: 100%; object-fit: contain; }
.is-out .pc-media img { opacity: .55; }
.pc-body { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; flex: 1; }
.pc-name { font-size: 19px; font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.pc-short { color: var(--text-2); font-size: 15px; line-height: 1.4; margin: 0; flex: 1; }
.pc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.price { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge-ok { background: rgba(31, 138, 76, .1); color: var(--ok); }
.badge-out { background: var(--surface-alt); color: var(--text-2); }
.product-ask { margin: 0 0 14px; }
.product-ask a { color: var(--blue); font-weight: 500; }

/* empty state, pager */
.catalog-empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); color: var(--text-3); }
.catalog-empty h2 { color: var(--text); font-size: 24px; margin: 12px 0 6px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.pager a { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); color: var(--text); text-decoration: none; }
.pager a:hover { background: var(--surface-alt); }
.pager a[aria-current] { background: var(--text); color: #fff; }

/* product page */
.product-main { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; margin-top: 16px; }
.gallery-main { background: var(--surface-alt); border-radius: var(--radius); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs button { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--surface-alt); cursor: pointer; overflow: hidden; }
.gallery-thumbs button[aria-current] { border-color: var(--blue); }
.gallery-thumbs img { display: block; width: 72px; height: 54px; object-fit: contain; }
.product-info h1 { font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 44px); font-weight: 600; letter-spacing: -.02em; margin: 0 0 10px; line-height: 1.1; }
.product-short { font-size: 19px; color: var(--text-2); line-height: 1.4; margin: 0 0 20px; }
.product-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.product-price .price { font-size: 30px; }
.vat { color: var(--text-2); font-size: 14px; }
.add-to-cart { display: flex; gap: 12px; align-items: center; margin: 22px 0 14px; }
.add-to-cart .qty { width: 84px; text-align: center; border-radius: var(--radius-pill); }
.add-to-cart .btn[disabled] { background: var(--line); cursor: not-allowed; }
.product-details { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line-soft); padding-top: 32px; }
.product-details h2 { font-size: 24px; margin: 0 0 14px; letter-spacing: -.01em; }
.product-description { font-size: 17px; line-height: 1.55; }
.product-description ul { padding-left: 20px; }
.specs { width: 100%; border-collapse: collapse; font-size: 15px; }
.specs th, .specs td { text-align: left; padding: 11px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.specs th { color: var(--text-2); font-weight: 400; width: 45%; padding-right: 16px; }

/* home sections */
.home-cats, .home-featured { padding: clamp(32px, 6vw, 72px) 0; }
.section-title { font-family: var(--font-display); font-size: clamp(26px, 3.6vw, 36px); font-weight: 600; letter-spacing: -.02em; margin: 0 0 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.cat-tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cat-tile { display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); text-decoration: none; transition: border-color .2s var(--ease); }
.cat-tile:hover { border-color: var(--blue); }
.cat-name { font-size: 19px; font-weight: 600; }
.cat-count { color: var(--text-2); font-size: 14px; }

/* home contacts */
.home-contact { padding: clamp(32px, 6vw, 72px) 0 clamp(48px, 8vw, 96px); }
.contact-strip { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: clamp(24px, 4vw, 40px); text-align: center; }
.contact-strip .section-title { margin-bottom: 10px; }
.contact-lines { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-size: 19px; margin: 0 0 18px; }
.contact-lines a { color: var(--blue); text-decoration: none; }
.contact-lead { color: var(--text-2); font-size: 17px; max-width: 36em; margin: 0 auto 18px; }

/* smart home configurator (placeholder, G08) */
.configurator-head { margin-bottom: clamp(28px, 5vw, 48px); }
.configurator-head .catalog-title { margin-bottom: 12px; }
.configurator-head .lead { margin: 0; }
.configurator-soon { display: inline-block; margin: 8px 0 0; font-size: 13px; font-weight: 500; color: var(--blue); }
.configurator-next { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: 1fr; gap: 16px; }
  .catalog-tree { position: static; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
  .catalog-tree summary { margin: 0; }
  .catalog-tree details[open] summary { margin-bottom: 8px; }
  .product-main, .product-details { grid-template-columns: 1fr; }
}
/* G12: categories on a phone — one "Categories ▾ <current>" row that opens the tree (catalog.js closes it on load) */
@media (max-width: 767px) {
  .catalog-tree { padding: 0; }
  .catalog-tree summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; margin: 0; }
  .catalog-tree details[open] summary { margin: 0; border-bottom: 1px solid var(--line-soft); }
  .catalog-tree .cats-current { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text-2); font-weight: 400; text-align: right; }
  .catalog-tree .cats-chevron { display: block; color: var(--text-2); transition: transform .2s var(--ease); }
  .catalog-tree details[open] .cats-chevron { transform: rotate(180deg); }
  .catalog-tree details > ul:first-of-type { margin-top: 8px; }
  .catalog-tree details > ul, .catalog-tree details > .catalog-configurator { margin-left: 6px; margin-right: 6px; }
  .catalog-tree details > .catalog-configurator { margin-bottom: 6px; padding: 12px 10px; }
}

/* G20 (after G12 on purpose — it overrides it): phone ergonomics — two columns up to 700px only while the text stays large, one column on <= 480px */
@media (max-width: 700px) {
  .crumbs { font-size: 15px; gap: 0 8px; margin-bottom: 4px; }
  .crumbs a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  .catalog-title { margin-bottom: 20px; }
  .catalog-toolbar { gap: 12px; margin-bottom: 20px; }
  .catalog-sort { flex: 1 1 auto; }
  .toggle { min-height: 44px; gap: 12px; font-size: 17px; }
  .toggle input { width: 22px; height: 22px; }
  .catalog-count, .catalog-note { font-size: 15px; }
  .catalog-note a { display: inline-flex; align-items: center; min-height: 44px; }
  .catalog-tree { font-size: 17px; }
  .catalog-tree summary { min-height: 52px; }
  .catalog-tree details > ul + ul { margin-top: 8px; }
  .catalog-tree ul { display: flex; flex-direction: column; gap: 8px; }
  .catalog-tree ul ul { margin: 8px 0 0 12px; }
  .catalog-tree a { align-items: center; min-height: 44px; padding: 8px 12px; }
  .tree-count, .catalog-configurator small { font-size: 15px; }
  .catalog-tree details > .catalog-configurator { padding: 14px 12px; }

  .product-grid { gap: 16px; }
  .pc-body { padding: 16px 18px 18px; gap: 8px; }
  .pc-name { font-size: 18px; }
  .pc-short { font-size: 15px; line-height: 1.45; }
  .price { font-size: 18px; }
  .badge { font-size: 13px; padding: 4px 10px; }
  .pc-foot { flex-wrap: wrap; }

  .pager { gap: 8px; }
  .pager a { min-width: 44px; height: 44px; }

  .product-short { font-size: 18px; }
  .vat { font-size: 15px; }
  .add-to-cart { flex-wrap: wrap; }
  .add-to-cart .qty { width: 96px; }
  .add-to-cart .btn { flex: 1 1 160px; }
  .product-ask a { display: inline-flex; align-items: center; min-height: 44px; font-size: 17px; }
  .gallery-thumbs { gap: 8px; }
  .gallery-thumbs img { width: 76px; height: 57px; }
  .specs { font-size: 15px; }

  .cat-count { font-size: 15px; }
  .cat-tile { padding: 20px; }
  .section-head .link-arrow, .contact-lines a { display: inline-flex; align-items: center; min-height: 44px; }
  .contact-strip .btn { width: 100%; }
  .configurator-next .btn { flex: 1 1 100%; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
  .pc-name { font-size: 20px; }
  .price { font-size: 20px; }
}

/* Task 26: purchase options ("pills") on the product page; without JS they are plain radios sent with the form */
.add-to-cart { flex-wrap: wrap; }
.variant-picker { flex: 1 1 100%; display: grid; gap: 14px; }
.variant-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.variant-group legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line);
  border-radius: var(--radius-pill); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .15s var(--ease); }
.pill:hover { border-color: var(--blue); }
.pill-input:checked + .pill { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); font-weight: 600; }
.pill-input:focus-visible + .pill { outline: 2px solid var(--blue); outline-offset: 2px; }
.pill.is-out { color: var(--text-3); text-decoration: line-through; }
.variant-note { margin: 0; color: var(--text-2); }
.pc-foot .price { white-space: nowrap; }
@media (max-width: 700px) {
  .pill { min-height: 48px; font-size: 17px; }
}
