/*
 * Shared mobile layout — loaded on every HTML page (after inline <style>).
 * Cross-device: containment, timelines, tabs, forms, touch targets, safe-areas,
 * reduced loader cost on narrow viewports (see page-loader.css).
 */

/* Keep navbar fixed on scroll and offset page content below it. */
.nav-shell {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

body {
  padding-top: calc(var(--nav-bar-h, 68px) + env(safe-area-inset-top, 0px));
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 900px) {
  :root {
    --section-pad-h: clamp(16px, 4.2vw, 28px);
  }

  section,
  header,
  footer,
  main {
    min-width: 0;
  }

  /* Section wrappers commonly used across solution pages */
  section [class$="-shell"],
  section [class$="-container"],
  section [class$="-inner"],
  footer [class$="-shell"],
  footer [class$="-inner"] {
    min-width: 0;
    max-width: 100%;
  }

  section [class*="-grid"],
  section [class*="duct-"],
  section [class*="chiller-"] {
    min-width: 0;
    max-width: 100%;
  }

  .info-tab-pane-inner {
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(18px, 4vw, 26px);
  }

  .info-tab-content,
  .info-tab-media {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .info-tab-btn {
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Chiller: stack operation split before tablet breakpoint */
  .operation-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .tabs-row,
  .tabs-menu,
  .tabs-image-shell,
  .tabs-image-pane,
  .tabs-container,
  .tabs-content,
  .tab-link,
  .tab-pane,
  .tab-pane-inner,
  .tab-pane-content,
  .component-card,
  .component-card-content,
  .components-grid,
  .types-grid,
  .type-column,
  .type-column-content,
  .content-image-inner,
  .content-image-left,
  .content-image-right,
  .content-list-items,
  .content-list-item,
  .tfa-media-shell,
  .tfa-split-shell,
  .tfa-split-inner,
  .tfa-split-left,
  .tfa-split-right,
  .tfa-list-row,
  .tfa-list-item,
  .comparison-grid,
  .comparison-card,
  .comparison-row,
  .explained-inner,
  .options-bento,
  .options-small-cards,
  .small-cards-row,
  .units-grid,
  .excel-grid,
  .how-shell,
  .cards-row,
  .timeline,
  .timeline-item,
  .benefits-cards {
    min-width: 0;
    max-width: 100%;
  }

  /* Journey timeline cards — balanced padding on narrow viewports (how-we-work; safe if reused elsewhere) */
  .timeline-card {
    box-sizing: border-box;
  }

  .timeline-card.timeline-left,
  .timeline-card.timeline-right {
    padding: clamp(22px, 5.5vw, 30px);
    gap: clamp(14px, 3.2vw, 20px);
  }

  .timeline-card-titles {
    gap: clamp(10px, 2.5vw, 14px);
  }

  .timeline-card .text-md {
    line-height: 1.68;
    margin: 0;
  }

  .timeline-item {
    padding-bottom: clamp(26px, 5vw, 42px);
  }

  .timeline-item:last-child {
    padding-bottom: clamp(8px, 2vw, 16px);
  }

  /* Home process grid + any similar numbered step cards */
  .process-card {
    padding: clamp(22px, 5.5vw, 30px);
    gap: clamp(14px, 3.2vw, 20px);
    box-sizing: border-box;
  }

  .process-card-body {
    gap: clamp(10px, 2.5vw, 14px);
  }

  .process-card-body .text-reg,
  .process-card-body .text-md,
  .process-card-body p {
    line-height: 1.68;
    margin: 0;
  }

  .tab-link,
  .tab-link .text-reg,
  .tab-link .h4,
  .component-card-content,
  .type-column-content,
  .content-list-item,
  .tfa-list-item,
  .comparison-row-label,
  .comparison-row-value,
  .tab-pane-content,
  .explained-body,
  .section-title-centered .title-content,
  .section-title-left .title-content {
    overflow-wrap: anywhere;
    word-wrap: break-word;
  }

  .h1, .h2, .h3, .h4, .h5, .h6 {
    overflow-wrap: anywhere;
  }

  /* VRF / section-how: horizontal tab bar — avoid min-width sum exceeding viewport */
  .section-how .tabs-menu {
    max-width: 100%;
  }

  .section-how .tab-btn {
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Tab panes: stack earlier with tighter gutters so flex row never blows out */
  .tab-pane-inner {
    flex-direction: column;
    align-items: stretch;
    gap: clamp(18px, 4vw, 28px);
    padding: clamp(20px, 4vw, 32px) clamp(16px, 4vw, 22px);
  }

  .tab-pane-visual {
    max-width: 100% !important;
    width: 100%;
    min-width: 0;
  }

  /* Ventilation / similar: hero image pane stays within column */
  .tabs-image-shell {
    width: 100%;
  }

  .tabs-image-pane {
    width: 100%;
    max-width: 100%;
  }

  .tabs-image-pane img {
    max-width: 100%;
  }

  .comparison-row .comparison-row-label,
  .comparison-row .comparison-row-value {
    min-width: 0;
  }

  .form-wrapper,
  .form-info-panel,
  .form-right-panel,
  .section-form input.form-input,
  .section-form select.form-select,
  .section-form textarea.form-textarea {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .section-form input.form-input,
  .section-form select.form-select,
  .section-form textarea.form-textarea {
    width: 100%;
  }

  /* Notch / home indicator: keep nav & drawer clear of unsafe areas */
  .nav-shell {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
    padding-left: calc(var(--section-pad-h) + env(safe-area-inset-left, 0px));
    padding-right: calc(var(--section-pad-h) + env(safe-area-inset-right, 0px));
  }

  .navbar-inner {
    min-width: 0;
  }

  /* Inset gutters for drawer links on notched phones (additive to clamp in page CSS) */
  .mobile-nav-link {
    padding-left: calc(env(safe-area-inset-left, 0px) + clamp(16px, 4vw, 24px));
    padding-right: calc(env(safe-area-inset-right, 0px) + clamp(16px, 4vw, 24px));
  }

  .mobile-solutions-toggle {
    padding-left: calc(env(safe-area-inset-left, 0px) + clamp(16px, 4vw, 24px));
    padding-right: calc(env(safe-area-inset-right, 0px) + clamp(16px, 4vw, 24px));
  }

  .mobile-solutions-list {
    padding-left: calc(env(safe-area-inset-left, 0px) + clamp(16px, 4vw, 24px));
    padding-right: calc(env(safe-area-inset-right, 0px) + clamp(16px, 4vw, 24px));
  }

  /* Services & wide flex cards */
  .service-card,
  .service-card-content,
  .engineering-inner {
    min-width: 0;
    max-width: 100%;
  }

  .service-card-content .text-reg,
  .service-card-content .text-md {
    overflow-wrap: anywhere;
  }

  .benefit-card-inner,
  .benefit-card-text,
  .unit-card-content {
    min-width: 0;
    max-width: 100%;
  }

  /* Small KPI / misc cards inside grids */
  .small-card,
  .op-item-header,
  .op-item-body-inner {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .op-item-header .text-reg {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 768px) {
  .section-how .tab-btn,
  .info-tab-btn {
    font-size: clamp(12px, 3.2vw, 14px);
    padding: 12px 10px;
  }
}

@media (max-width: 640px) {
  .timeline-card.timeline-left,
  .timeline-card.timeline-right {
    padding: clamp(20px, 6vw, 28px);
  }

  .process-card {
    padding: clamp(20px, 6vw, 28px);
  }
}

/* Minimum tap targets (~44×44 CSS px) — phones / tablets without hover */
@media (hover: none) and (pointer: coarse) and (max-width: 900px) {
  .nav-hamburger {
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-nav-link,
  .mobile-solution-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
  }

  .mobile-solutions-toggle {
    min-height: 48px;
  }

  .nav-consult-icon {
    min-width: 30px;
    min-height: 30px;
  }
}