/*
 * Lokarta — mobile subpages QA 1.24.11
 * Final containment/readability pass for dedicated subpages.
 * HOME is intentionally excluded. /wiedza/ keeps its own, later refinement layer.
 */

@media (max-width: 780px) {
  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.wz-page,
    .ws-page,.thx-page,.product-page
  ) {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  /* Grid/flex children must be allowed to shrink instead of widening the viewport. */
  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.wz-page,
    .ws-page,.thx-page,.product-page
  ) * {
    min-width: 0;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.wz-page,
    .ws-page,.thx-page,.product-page
  ) :is(img,video,iframe,canvas) {
    max-width: 100%;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.wz-page,
    .ws-page,.thx-page,.product-page
  ) :is(h1,h2,h3,p,a,button,summary,label,strong,b,small,em) {
    overflow-wrap: break-word;
    word-break: normal;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.wz-page,
    .ws-page,.thx-page,.product-page
  ) :is(input,textarea,select,button) {
    max-width: 100%;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) .section-heading {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) .button {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.28;
  }

  /* ---------- FUNKCJE: the page had the same mobile overflow symptoms as Wiedza ---------- */
  .fn-page .fn-hero {
    padding-bottom: 54px;
  }

  .fn-page .fn-hero-grid,
  .fn-page .fn-hero-copy,
  .fn-page .fn-hero-visual,
  .fn-page .fn-core-window,
  .fn-page .fn-data-ui,
  .fn-page .fn-choice-shell,
  .fn-page .fn-choice-preview,
  .fn-page .fn-sales-ui,
  .fn-page .fn-control-ui {
    width: 100%;
    max-width: 100%;
  }

  .fn-page .fn-hero-grid {
    gap: 28px;
  }

  .fn-page .fn-hero-copy h1 {
    width: 100%;
    max-width: 100%;
    margin: 14px 0 18px;
    font-size: clamp(34px, 9.4vw, 42px) !important;
    line-height: .99 !important;
    text-wrap: balance;
  }

  .fn-page .fn-hero-lead {
    width: 100%;
    max-width: 100%;
    font-size: 16px !important;
    line-height: 1.56;
  }

  .fn-page .fn-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    width: 100%;
    margin-top: 22px;
  }

  .fn-page .fn-actions .button {
    width: 100%;
    justify-content: center;
  }

  .fn-page .fn-hero-proof {
    width: 100%;
    max-width: 100%;
    align-items: flex-start;
    padding: 13px 14px;
  }

  .fn-page .fn-hero-proof > span {
    flex: 0 0 auto;
  }

  .fn-page .fn-hero-proof p {
    min-width: 0;
  }

  .fn-page .fn-hero-proof b {
    display: block;
    font-size: .83rem;
    line-height: 1.4;
  }

  /* Turn the desktop orbit into a compact product grid on phones. */
  .fn-page .fn-hero-visual {
    min-height: 0;
    margin-top: 2px;
    perspective: none;
  }

  .fn-page .fn-core-window {
    padding: 14px;
    border-radius: 24px;
    transform: none !important;
  }

  .fn-page .fn-window-top,
  .fn-page .fn-window-foot {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .fn-page .fn-window-top > small,
  .fn-page .fn-window-foot > span {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .fn-page .fn-core-center {
    height: auto !important;
    min-height: 0;
    margin: 12px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .fn-page .fn-core-center > svg {
    display: none;
  }

  .fn-page .fn-local-core,
  .fn-page .fn-core-node,
  .fn-page .node-map,
  .fn-page .node-search,
  .fn-page .node-card,
  .fn-page .node-crm,
  .fn-page .node-booking,
  .fn-page .node-gov {
    position: static;
    inset: auto;
    transform: none !important;
  }

  .fn-page .fn-local-core {
    grid-column: 1 / -1;
    width: 100% !important;
    height: auto !important;
    min-height: 118px;
    border-radius: 20px;
    padding: 17px 14px;
  }

  .fn-page .fn-local-core strong {
    font-size: 1.35rem;
  }

  .fn-page .fn-core-node {
    width: 100% !important;
    padding: 11px 9px;
    border-radius: 14px;
  }

  .fn-page .fn-core-node b {
    font-size: .78rem;
  }

  .fn-page .fn-core-node small {
    font-size: .61rem;
  }

  .fn-page .fn-hero-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
    margin-top: 20px;
  }

  .fn-page .fn-hero-strip > div {
    min-height: 0;
    padding: 14px 12px;
    border-radius: 17px;
  }

  .fn-page .fn-hero-strip > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .fn-page .fn-hero-strip span {
    width: 30px;
    height: 30px;
    margin-bottom: 9px;
  }

  .fn-page .fn-hero-strip strong {
    font-size: .85rem;
  }

  .fn-page .fn-hero-strip small {
    font-size: .7rem;
    line-height: 1.35;
  }

  .fn-page .fn-feature-list article,
  .fn-page .fn-dark-list > div {
    grid-template-columns: 38px minmax(0,1fr);
    gap: 11px;
    padding: 13px;
  }

  .fn-page .fn-feature-list article > span,
  .fn-page .fn-dark-list > div > span {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .fn-page .fn-feature-list h3 {
    font-size: .94rem;
  }

  .fn-page .fn-feature-list p,
  .fn-page .fn-dark-list b {
    font-size: .8rem;
    line-height: 1.45;
  }

  .fn-page .fn-data-ui {
    padding: 18px;
    border-radius: 24px;
  }

  .fn-page .fn-data-head {
    flex-wrap: wrap;
  }

  .fn-page .fn-structure-tree .branch-row {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 8px;
  }

  .fn-page .fn-structure-tree .unit-row {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 7px;
  }

  .fn-page .fn-structure-tree .unit-row > div {
    padding: 10px 9px;
  }

  .fn-page .fn-structure-tree .unit-row > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .fn-page .fn-choice-tabs {
    padding: 10px;
  }

  .fn-page .fn-choice-tabs button {
    min-height: 68px;
    padding: 11px;
  }

  .fn-page .fn-choice-preview {
    gap: 15px;
    padding: 18px;
  }

  .fn-page .fn-preview-copy h3 {
    font-size: clamp(24px, 7vw, 31px);
  }

  .fn-page .fn-preview-ui,
  .fn-page .fn-map-preview {
    min-height: 0 !important;
    height: auto;
  }

  .fn-page .fn-map-preview {
    padding: 0;
    border-radius: 18px;
  }

  .fn-page .fn-map-preview img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: inherit;
  }

  .fn-page .fn-lead-card {
    padding: 14px;
    border-radius: 20px;
  }

  .fn-page .fn-lead-card img {
    width: 100%;
    height: auto;
  }

  .fn-page .fn-panel-head,
  .fn-page .fn-dashboard-head,
  .fn-page .fn-ui-head {
    flex-wrap: wrap;
  }

  .fn-page .fn-gov-log > div,
  .fn-page .fn-log-lines > div,
  .fn-page .fn-monitor-card > div {
    grid-template-columns: minmax(0,1fr) auto;
  }

  .fn-page .fn-gov-log > div > i,
  .fn-page .fn-monitor-card > div > i {
    display: none;
  }

  /* Full product chain: no horizontal page-sized rail on mobile. */
  .fn-page .fn-flow-track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding-bottom: 0;
  }

  .fn-page .fn-flow-track > i {
    display: none;
  }

  .fn-page .fn-flow-item {
    width: auto !important;
    min-height: 98px;
    padding: 13px 10px;
    transform: none !important;
  }

  .fn-page .fn-flow-item:last-of-type:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .fn-page .fn-final-box {
    padding: 22px 18px;
  }

  .fn-page .fn-final-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 9px;
  }

  .fn-page .fn-final-actions .button {
    width: 100%;
    justify-content: center;
  }

  /* ---------- Other pages found during the same mobile QA ---------- */

  /* Cennik: absolute system map was unnecessarily tall on phones. */
  .pr-page .pr-system-map {
    min-height: 360px !important;
  }

  /* CRM: preserve scroll only inside the actual kanban/pipeline, never on the page itself. */
  .crm-page .crm-kanban,
  .crm-page .crm-connection-flow {
    max-width: 100%;
  }

  .crm-page .crm-kanban-columns,
  .crm-page .crm-connection-flow {
    -webkit-overflow-scrolling: touch;
  }

  /* Demo: compact role KPIs without dropping information. */
  .dm-page .dm-role-manager-kpis,
  .dm-page .dm-role-context-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  /* Integracje and Licencja: tabs remain scrollable, but cannot widen the document. */
  .ig-page .ig-mechanism-tabs,
  .lc-page .lc-responsibility-tabs,
  .lc-page .lc-docs-sidebar,
  .ol-page .ol-release-pipeline,
  .kt-page .kt-process {
    width: 100%;
    max-width: 100%;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Interaktywna mapa: prevent the laboratory preview from creating page overflow. */
  .mp-page .mp-map-stage,
  .mp-page .mp-tooltip-showcase,
  .mp-page .mp-phone-wrap,
  .mp-page .mp-hero-visual {
    max-width: 100%;
  }

  /* O Lokarcie / Licencja / Integracje: large orbital diagrams stay inside the viewport. */
  .ol-page .ol-system-stage,
  .ol-page .ol-scope-visual,
  .lc-page .lc-console-core,
  .ig-page .ig-stack-stage {
    max-width: 100%;
    overflow: hidden;
  }

  /* Wyszukiwarka: phone + drawer mockup may overlap, but must not widen the page. */
  .ws-page .ws-phone-showcase,
  .ws-page .ws-hero-browser,
  .ws-page .ws-app-window {
    max-width: 100%;
    overflow: hidden;
  }

  .ws-page .ws-mobile-drawer {
    max-width: calc(100% - 10px);
  }

  /* Contact form: labels/fields never exceed the mobile card. */
  .kt-page :is(input,textarea,select) {
    width: 100%;
  }
}

@media (max-width: 560px) {
  /* One consistent phone H1 scale across all dedicated product pages. */
  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) :is(
    .pr-hero-copy h1,.crm-hero-copy h1,.dg-hero-copy h1,.dm-hero-copy h1,.fq-hero-copy h1,
    .fn-hero-copy h1,.hc-hero-copy h1,.wi-hero-copy h1,.ig-hero-copy h1,.mp-hero-copy h1,
    .jd-hero-copy h1,.jc-hero h1,.kl-hero-copy h1,.kt-hero-copy h1,.lc-hero-copy h1,
    .ol-hero-copy h1,.rv-hero-copy h1,.ws-hero-copy h1,.product-hero h1
  ) {
    font-size: clamp(34px, 9.6vw, 42px) !important;
    line-height: .99 !important;
    max-width: 100%;
    text-wrap: balance;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) .section-heading h2 {
    font-size: clamp(29px, 8.2vw, 36px) !important;
    line-height: 1.03 !important;
    text-wrap: balance;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    width: 100%;
  }

  :is(
    .pr-page,.crm-page,.dg-page,.dm-page,.fq-page,.fn-page,.hc-page,.wi-page,.ig-page,
    .mp-page,.jd-page,.jc-page,.kl-page,.kt-page,.lc-page,.ol-page,.rv-page,.ws-page,
    .thx-page,.product-page
  ) .hero-actions .button {
    width: 100%;
    justify-content: center;
  }

  /* Functions: keep the compact two-column product grid even on normal phones. */
  .fn-page .fn-core-center,
  .fn-page .fn-hero-strip,
  .fn-page .fn-flow-track {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }

  .fn-page .fn-choice-tabs button {
    flex-basis: 148px;
  }

  .fn-page .fn-price-history {
    grid-template-columns: 1fr;
  }

  .fn-page .fn-price-history > i {
    justify-self: center;
    transform: rotate(90deg);
  }

  /* Keep long technical labels inside their cards. */
  .crm-page .crm-mini-pipeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mp-page .mp-depth-steps b,
  .lc-page .lc-responsibility-tabs button,
  .ig-page .ig-mechanism-tabs button {
    white-space: normal;
  }

  .ol-page .ol-system-stage {
    min-height: 610px;
  }

  .ws-page .ws-phone-showcase {
    height: 610px;
  }
}

@media (max-width: 360px) {
  .fn-page .fn-core-center,
  .fn-page .fn-flow-track {
    grid-template-columns: 1fr !important;
  }

  .fn-page .fn-local-core,
  .fn-page .fn-flow-item:last-of-type:nth-child(odd) {
    grid-column: auto;
  }

  .fn-page .fn-structure-tree .branch-row,
  .fn-page .fn-structure-tree .unit-row {
    grid-template-columns: 1fr !important;
  }

  .fn-page .fn-structure-tree .unit-row > div:last-child:nth-child(odd),
  .fn-page .fn-hero-strip > div:last-child:nth-child(odd) {
    grid-column: auto;
  }
}
