/*
 * Responsive finishing layer shared by /komplekty, /katalog and project pages.
 */

html,
body,
.page-shell {
  max-width: 100%;
}

body {
  overflow-x: clip;
}

.page-shell,
.page-shell main,
.page-shell section,
.page-shell .container,
.page-shell [class*="grid"],
.page-shell article {
  min-width: 0;
}

.page-shell img,
.page-shell video,
.page-shell canvas,
.page-shell svg {
  max-width: 100%;
}

@media (min-width: 760px) and (max-width: 1100px) {
  .container {
    width: min(calc(100% - 40px), 960px);
    max-width: min(calc(100% - 40px), 960px);
  }

  .section {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .home-section--popular .project-grid,
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filter-panel {
    position: static;
  }

  .catalog-toolbar {
    align-items: stretch;
  }

  .project-card__body {
    min-height: 0;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 900px) {
  .project-card,
  .proof-card,
  .direction-panel,
  .power-item,
  .b2c-price-factor,
  .step-card {
    transform: none !important;
  }

  .b2c-kit-shared .power-item__text {
    min-height: 0;
  }

  .b2c-kit-shared .power-item__text-base {
    display: none;
  }

  .b2c-kit-shared .power-item__text-more {
    position: static;
    display: block;
    opacity: 1;
    transform: none;
  }

  .b2c-price-factor span {
    position: static;
    margin-top: auto;
    padding: 10px 12px;
    border: 1px solid rgba(207, 222, 255, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    opacity: 1;
    transform: none;
  }

  .b2c-price-factor:hover,
  .b2c-price-factor:focus,
  .b2c-price-factor:focus-visible {
    border-color: rgba(207, 222, 255, 0.9);
    background: #f6f9ff;
    box-shadow: var(--shadow-soft);
  }

  .b2c-price-factor:hover strong,
  .b2c-price-factor:focus strong,
  .b2c-price-factor:focus-visible strong {
    color: var(--text);
  }

  .b2c-price-factor:hover span,
  .b2c-price-factor:focus span,
  .b2c-price-factor:focus-visible span {
    color: var(--muted);
  }

  .b2c-price-factor:hover .b2c-price-factor__icon,
  .b2c-price-factor:focus .b2c-price-factor__icon,
  .b2c-price-factor:focus-visible .b2c-price-factor__icon {
    opacity: 1;
    transform: none;
  }

  .home-section--steps .step-card {
    min-height: 190px;
    aspect-ratio: auto;
    gap: 18px;
  }

  .home-section--steps .step-card h3,
  .home-section--steps .step-card p {
    grid-area: auto;
    opacity: 1;
    transform: none;
  }

  .home-section--steps .step-card h3 {
    max-width: none;
  }

  .home-section--steps .step-card p {
    align-self: end;
    color: var(--color-muted);
    pointer-events: auto;
  }

  .home-section--steps .step-card:hover,
  .home-section--steps .step-card:focus-visible {
    border-color: var(--color-line);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 14px 32px rgba(35, 58, 120, 0.08);
    transform: none;
  }

  .home-section--steps .step-card:hover h3,
  .home-section--steps .step-card:focus-visible h3,
  .home-section--steps .step-card:hover p,
  .home-section--steps .step-card:focus-visible p {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 759px) {
  :root {
    --radius-card: 22px;
    --card-gap: 18px;
    --card-gap-mobile: 14px;
    --card-padding-text-mobile: 22px;
  }

  .container,
  .header-shell.container {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
  }

  .site-header {
    padding-top: 12px;
  }

  .header-shell.container {
    min-height: 52px;
  }

  .header-shell.is-menu-open {
    top: 12px;
    width: min(360px, calc(100vw - 20px));
    height: calc(100dvh - 12px);
    padding: 26px 20px 22px;
  }

  .header-shell.is-menu-open .nav-toggle {
    top: 22px;
    right: 18px;
  }

  .site-nav a,
  .site-nav a.is-active {
    min-height: 48px;
    padding: 13px 0;
  }

  .section {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .hero--landing,
  .hero--catalog-main.hero--landing {
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .hero--landing .hero-grid,
  .hero--catalog-main.hero--landing .hero-grid {
    width: 100%;
    max-width: 100%;
    gap: 16px;
    overflow: hidden;
    border-radius: 24px;
  }

  .hero--landing .hero-copy__main,
  .hero--landing .hero-actions,
  .hero--landing .hero-benefit-tabs,
  .hero--catalog-main.hero--landing .hero-copy,
  .hero--catalog-main.hero--landing .hero-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
  }

  .hero--landing .hero-copy__main {
    padding: 22px 22px 0;
  }

  .hero--landing .hero-copy h1,
  .hero--catalog-main.hero--landing .hero-copy h1,
  .section-head h2,
  .product-title h1,
  .request-section h2,
  .b2c-kit-shared .assembly-kit-heading .ash-section-title {
    max-width: 100%;
    font-size: clamp(30px, 9vw, 36px);
    line-height: 1.08 !important;
    text-wrap: pretty;
  }

  .hero--landing .hero-copy .lead,
  .section-head__lead,
  .b2c-kit-shared .assembly-kit-heading__text {
    max-width: 100%;
    font-size: 16px;
    line-height: 1.5;
  }

  .hero--landing .hero-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 22px;
  }

  .hero--landing .hero-actions .button,
  .hero--catalog-main.hero--landing .hero-actions .button {
    width: 100%;
    min-height: 52px;
    white-space: normal;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    width: 100%;
    max-width: 100%;
    min-height: clamp(300px, 82vw, 380px);
    height: clamp(300px, 82vw, 380px);
    margin: 0;
    border-radius: 20px;
  }

  .hero--landing .hero-benefit-tabs {
    padding: 0 22px 22px;
  }

  .home-section--popular .container,
  .section-head,
  .assembly-kit-heading {
    gap: 22px;
  }

  .home-section--popular .project-grid,
  .project-grid,
  .catalog-grid,
  .landing-kit-grid,
  .landing-price-grid,
  .landing-proof-grid,
  .landing-stat-grid,
  .b2c-price-factor-grid,
  .b2c-kit-shared .power-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .project-card,
  .detail-card,
  .filter-panel,
  .catalog-toolbar,
  .buy-card,
  .gallery-stage,
  .b2c-kit-shared .power-item {
    border-radius: 22px;
  }

  .project-card__body,
  .home-section--popular .project-card__body {
    min-height: 0;
    gap: 14px;
    padding: 20px;
  }

  .project-card h3,
  .home-section--popular .project-card__body h3 {
    min-height: 0;
    font-size: clamp(23px, 7vw, 28px);
  }

  .project-card p,
  .home-section--popular .project-card__body > p {
    min-height: 0;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }

  .project-card .button {
    width: 100%;
    min-height: 50px;
  }

  .b2c-kit-shared .power-item {
    min-height: 0;
    gap: 18px;
    padding: 22px;
  }

  .b2c-kit-shared .power-item__title {
    max-width: calc(100% - 62px);
    font-size: 21px;
  }

  .b2c-kit-shared .power-item__icon {
    --icon-size: 46px;
    width: 52px;
    height: 52px;
  }

  .b2c-kit-shared .power-item__text-more,
  .b2c-kit-shared .power-item__text-base {
    font-size: 15px;
    line-height: 1.48;
  }

  .b2c-price-factor {
    min-height: 250px;
    aspect-ratio: 4 / 3;
    padding: 20px;
  }

  .home-section--steps .step-card {
    min-height: 0;
    padding: 22px;
  }

  .catalog-layout {
    padding-top: 24px;
  }

  .catalog-layout__grid,
  .product-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .filter-panel {
    position: static;
    gap: 14px;
    padding: 20px;
  }

  .filter-panel__head h2 {
    max-width: 100%;
    font-size: 30px;
  }

  .filter-group {
    padding: 14px;
  }

  .catalog-toolbar {
    gap: 10px;
    padding: 12px;
  }

  .catalog-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .catalog-stat,
  .sort-box {
    min-width: 0;
    padding: 12px;
  }

  .sort-box,
  .sort-box__field,
  .sort-box__select {
    width: 100%;
  }

  .product-hero {
    display: flex;
    flex-direction: column;
  }

  .buy-card {
    position: static;
    order: 1;
    padding: 20px;
  }

  .product-gallery {
    order: 2;
  }

  .gallery-stage {
    min-height: 0;
  }

  .buy-card__actions {
    order: 3;
  }

  .buy-card__actions .button {
    width: 100%;
  }

  .media-modal {
    padding: 8px;
  }

  .media-modal__dialog,
  #model-modal .media-modal__dialog--model {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 22px;
  }

  .media-modal__header {
    gap: 12px;
    padding: 16px;
  }

  .model-view-switch {
    max-width: 100%;
    overflow-x: auto;
  }

  .landing-faq-item summary {
    min-height: 62px;
    padding: 18px 56px 18px 20px;
    font-size: 16px;
  }

  .landing-faq-item p {
    padding: 0 20px 20px;
  }
}

@media (max-width: 420px) {
  .container,
  .header-shell.container {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
  }

  .header-shell.is-menu-open {
    width: calc(100vw - 12px);
  }

  .section {
    padding-top: 42px;
    padding-bottom: 42px;
  }

  .hero--landing .hero-copy__main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .hero--landing .hero-actions,
  .hero--landing .hero-benefit-tabs {
    padding-right: 20px;
    padding-left: 20px;
  }

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

@media (max-width: 900px) and (orientation: landscape) and (max-height: 620px) {
  .hero--landing .hero-grid,
  .hero--catalog-main.hero--landing .hero-grid {
    min-height: 0;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    min-height: 300px;
    height: 300px;
  }

  .header-shell.is-menu-open {
    padding-top: 22px;
  }

  .site-nav a,
  .site-nav a.is-active {
    min-height: 42px;
    padding: 10px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/*
 * Final touch-layout pass: compact price factors and a predictable hero order.
 */
@media (max-width: 1100px) {
  .b2c-price-factor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .b2c-price-factor,
  .b2c-price-factor:hover,
  .b2c-price-factor:focus,
  .b2c-price-factor:focus-visible {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 156px;
    aspect-ratio: auto;
    align-items: center;
    gap: 8px 16px;
    padding: 14px;
    border: 1px solid var(--color-line, rgba(207, 222, 255, 0.9));
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(35, 58, 120, 0.07);
  }

  .b2c-price-factor__icon,
  .b2c-price-factor:hover .b2c-price-factor__icon,
  .b2c-price-factor:focus .b2c-price-factor__icon,
  .b2c-price-factor:focus-visible .b2c-price-factor__icon {
    position: static;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 132px;
    height: 126px;
    border-radius: 16px;
    object-fit: cover;
    opacity: 1;
    transform: none;
  }

  .b2c-price-factor strong {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 19px;
    line-height: 1.2;
  }

  .b2c-price-factor span,
  .b2c-price-factor:hover span,
  .b2c-price-factor:focus span,
  .b2c-price-factor:focus-visible span {
    position: static;
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted, var(--color-muted));
    font-size: 14px;
    line-height: 1.42;
    opacity: 1;
    transform: none;
  }

  .b2c-price-factor-grid .b2c-price-factor:last-child {
    grid-column: 1 / -1;
  }

  .hero--landing .hero-grid,
  .hero--catalog-main.hero--landing .hero-grid {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    overflow: hidden;
  }

  .hero--landing .hero-copy,
  .hero--catalog-main.hero--landing .hero-copy {
    display: contents;
  }

  .hero--landing .hero-copy__main,
  .hero--catalog-main.hero--landing .hero-copy__main {
    order: 1;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .hero--landing .hero-copy h1,
  .hero--catalog-main.hero--landing .hero-copy h1 {
    max-width: 16ch;
    font-size: clamp(38px, 5.8vw, 52px);
    line-height: 1.05;
  }

  .hero--landing .hero-copy .lead,
  .hero--catalog-main.hero--landing .hero-copy .lead {
    max-width: 680px;
    font-size: 17px;
    line-height: 1.48;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    position: relative;
    inset: auto;
    order: 2;
    width: 100%;
    max-width: 100%;
    min-height: 380px;
    height: clamp(380px, 50vw, 470px);
    margin: 0;
    overflow: hidden;
    border-radius: 22px;
  }

  .hero--landing .hero-actions,
  .hero--catalog-main.hero--landing .hero-actions {
    order: 3;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 720px;
    gap: 12px;
    margin: 0;
    padding: 0;
  }

  .hero--landing .hero-benefit-tabs,
  .hero--catalog-main.hero--landing .hero-benefit-tabs {
    order: 4;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .product-hero {
    display: flex;
    flex-direction: column;
  }

  .product-hero .buy-card {
    position: static;
    order: 1;
  }

  .product-hero .product-gallery {
    order: 2;
  }
}

@media (max-width: 759px) {
  .b2c-price-factor-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .b2c-price-factor,
  .b2c-price-factor:hover,
  .b2c-price-factor:focus,
  .b2c-price-factor:focus-visible {
    grid-template-columns: 88px minmax(0, 1fr);
    min-height: 116px;
    gap: 6px 14px;
    padding: 13px;
    border-radius: 20px;
  }

  .b2c-price-factor__icon,
  .b2c-price-factor:hover .b2c-price-factor__icon,
  .b2c-price-factor:focus .b2c-price-factor__icon,
  .b2c-price-factor:focus-visible .b2c-price-factor__icon {
    width: 88px;
    height: 88px;
    border-radius: 14px;
  }

  .b2c-price-factor strong {
    font-size: 17px;
    line-height: 1.18;
  }

  .b2c-price-factor span,
  .b2c-price-factor:hover span,
  .b2c-price-factor:focus span,
  .b2c-price-factor:focus-visible span {
    font-size: 13px;
    line-height: 1.36;
  }

  .hero--landing,
  .hero--catalog-main.hero--landing {
    padding-top: 16px;
    padding-bottom: 40px;
  }

  .hero--landing .hero-grid,
  .hero--catalog-main.hero--landing .hero-grid {
    gap: 16px;
    padding: 22px;
    border-radius: 24px;
  }

  .hero--landing .hero-copy h1,
  .hero--catalog-main.hero--landing .hero-copy h1 {
    max-width: 100%;
    font-size: clamp(31px, 9vw, 36px);
    line-height: 1.07;
  }

  .hero--landing .hero-copy .lead,
  .hero--catalog-main.hero--landing .hero-copy .lead {
    font-size: 16px;
    line-height: 1.48;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    min-height: 270px;
    height: clamp(270px, 76vw, 330px);
    border-radius: 18px;
  }

  .hero--landing .hero-actions,
  .hero--catalog-main.hero--landing .hero-actions {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .filter-panel {
    gap: 10px;
    padding: 16px;
  }

  .filter-panel__head {
    gap: 8px;
  }

  .filter-panel__head h2 {
    font-size: 27px;
  }

  .filter-panel__lead {
    font-size: 14px;
    line-height: 1.4;
  }

  .filter-panel__meta,
  .filter-group {
    padding: 12px;
  }
}

/*
 * Keep the complete offer together above the 3D scene.
 * Earlier landing styles use display: contents, which lets the canvas sit
 * between the heading and the lead on narrow screens.
 */
@media (max-width: 1100px) {
  .hero--landing .hero-copy,
  .hero--catalog-main.hero--landing .hero-copy {
    position: relative;
    z-index: 3;
    display: flex !important;
    order: 1;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    margin: 0;
    padding: 0;
    pointer-events: auto;
  }

  .hero--landing .hero-copy__main,
  .hero--catalog-main.hero--landing .hero-copy__main {
    display: block;
    order: 1;
    width: 100%;
    max-width: 100%;
  }

  .hero--landing .hero-copy .lead,
  .hero--catalog-main.hero--landing .hero-copy .lead {
    margin-top: 18px;
  }

  .hero--landing .hero-actions,
  .hero--catalog-main.hero--landing .hero-actions {
    order: 2;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    position: relative !important;
    inset: auto !important;
    order: 2;
  }
}

@media (max-width: 759px) {
  .hero--landing .hero-copy,
  .hero--catalog-main.hero--landing .hero-copy {
    gap: 18px;
  }

  .hero--landing .hero-copy .lead,
  .hero--catalog-main.hero--landing .hero-copy .lead {
    margin-top: 16px;
  }

  .hero--landing .hero-visual,
  .hero--catalog-main.hero--landing .hero-visual {
    min-height: 230px;
    height: clamp(230px, 62vw, 270px);
  }

  .hero--landing .model-scene--hero .model-scene__viewport,
  .hero--catalog-main.hero--landing .model-scene--hero .model-scene__viewport {
    inset: 0 -18% -8%;
    transform: scale(1.12);
    transform-origin: center;
  }
}
