/* ============================================================
   KALIFORGE ONE™ — RESPONSIVE & MOBILE GOVERNANCE
   Touch Targets >= 44px, Zero iOS Auto-Zoom, Inertia Momentum Touch,
   Modal Sheet Ergonomics & High-Contrast Guarantee Phrase
   ============================================================ */

/* ------------------------------------------------------------
   Global Mobile Ergonomics & Touch Controls
   ------------------------------------------------------------ */
html, body {
  overflow-x: clip;
  max-width: 100vw;
  -webkit-tap-highlight-color: rgba(0, 229, 255, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Guarantee phrase in FAQ bridge displayed in white under light theme */
[data-theme="light"] .kf-faq-proof-bridge-desc,
[data-theme="light"] #kf-faq-guarantee-phrase,
[data-theme="light"] .kf-faq-guarantee-phrase {
  color: #FFFFFF !important;
}

[data-theme="light"] .kf-faq-proof-bridge-desc em,
[data-theme="light"] #kf-faq-guarantee-phrase em {
  color: #00E5FF !important;
}

[data-theme="light"] .kf-faq-proof-bridge-title {
  color: #FFFFFF !important;
}

/* Hide internal founder pilot cockpit overlay on all screens */
.kf-founder-cockpit,
#kf-founder-cockpit {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Mobile Navigation Drawer */
.kf-mobile-drawer {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--kf-bg-root);
  z-index: 1050;
  padding: 20px 18px 36px 18px;
  display: none;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--kf-border);
}

.kf-mobile-drawer.active {
  display: flex;
}

.kf-mobile-nav-link {
  font-size: 1rem;
  font-weight: 600;
  color: var(--kf-text-primary);
  padding: 12px 10px;
  border-bottom: 1px solid var(--kf-border-subtle);
  border-inline-start: 3px solid transparent;
  min-height: 48px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, padding 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
}

.kf-mobile-nav-link.active {
  color: var(--kf-cyan);
  background: rgba(0, 229, 255, 0.08);
  border-inline-start-color: var(--kf-cyan);
}

.kf-mobile-nav-link:active {
  color: var(--kf-cyan);
  padding-inline-start: 14px;
}

.kf-mobile-progress-header {
  position: sticky;
  top: -20px;
  z-index: 2;
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: var(--kf-radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.kf-mobile-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.75rem;
}

.kf-mobile-progress-label {
  font-weight: 700;
  color: var(--kf-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--kf-font-mono);
}

.kf-mobile-progress-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--kf-font-mono);
  font-weight: 800;
  color: var(--kf-cyan);
  font-variant-numeric: tabular-nums;
}

.kf-mobile-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.kf-mobile-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--kf-cyan) 0%, #38bdf8 100%);
  transition: width 0.16s ease-out;
}

/* ------------------------------------------------------------
   Compact Desktop / Laptop Breakpoint (1180px)
   ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .kf-nav {
    display: none;
  }

  .kf-header .kf-actions > .kf-header-client-link {
    display: none;
  }

  .kf-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ------------------------------------------------------------
   Tablet Breakpoint (1024px)
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .kf-os-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kf-footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .kf-cockpit-body {
    grid-template-columns: 1fr;
  }

  .kf-cockpit-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--kf-border);
  }

  .kf-faq-proof-bridge-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .kf-roadmap-modal-body {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kf-scale-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ------------------------------------------------------------
   Mobile Breakpoint (768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Prevent iOS automatic zoom by ensuring font-size is at least 16px on inputs */
  input, textarea, select {
    font-size: 16px !important;
  }

  .kf-container {
    padding-left: 14px;
    padding-right: 14px;
    max-width: 100%;
  }

  /* Header Compactness */
  .kf-header-inner {
    height: 68px;
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
    width: 100%;
  }

  .kf-brand {
    min-width: 0;
    flex-shrink: 1;
  }

  .kf-brand img {
    height: 44px !important;
    width: 164px !important;
    max-width: 168px !important;
    object-fit: fill !important;
  }

  .kf-nav {
    display: none;
  }

  .kf-header .kf-actions > .kf-btn,
  .kf-header .kf-actions > .kf-header-client-link {
    display: none;
  }

  .kf-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 4px;
  }

  .kf-actions .kf-select {
    padding: 4px 6px;
    min-height: 36px;
    max-width: 82px;
    font-size: 0.75rem !important;
  }

  .kf-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
  }

  /* Section Spacing Ergonomics */
  .kf-section {
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .kf-section-header {
    margin-bottom: 22px;
  }

  .kf-section-title {
    font-size: clamp(1.4rem, 6vw, 1.85rem);
    line-height: 1.2;
  }

  /* Hero Adjustments */
  .kf-hero {
    padding-top: 24px;
    padding-bottom: 36px;
  }

  .kf-hero-title {
    font-size: clamp(1.75rem, 7vw, 2.3rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    word-break: break-word;
  }

  .kf-hero-subtitle {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  .kf-hero-7s-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .kf-hero-7s-item {
    font-size: 0.8125rem;
  }

  /* Hero CTA Group - Mobile Column Stacking */
  .kf-hero-cta-group,
  .kf-hero-ctas {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 12px !important;
    margin-top: 20px;
    margin-bottom: 24px;
  }

  .kf-hero-cta-group .kf-btn,
  .kf-hero-ctas .kf-btn {
    width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Central Decision Fabric Mobile Display */
  .kf-fabric-container {
    height: auto !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    margin-top: 20px;
    margin-bottom: 28px;
  }

  .kf-fabric-canvas {
    height: 320px !important;
    width: 100% !important;
    display: block !important;
    touch-action: none;
  }

  .kf-fabric-toolbar {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    border-radius: 0 0 var(--kf-radius-lg) var(--kf-radius-lg) !important;
    border: none !important;
    border-top: 1px solid var(--kf-border) !important;
    background: var(--kf-bg-subtle) !important;
    padding: 14px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
  }

  .kf-fabric-legend {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 12px !important;
    font-size: 0.75rem !important;
  }

  .kf-fabric-legend > span[data-i18n="hero.fabricLegend"],
  .kf-fabric-legend > span:first-child {
    width: 100% !important;
    display: block !important;
    font-size: 0.8125rem !important;
    font-weight: 700 !important;
    color: var(--kf-text-primary) !important;
    margin-bottom: 2px !important;
  }

  .kf-fabric-legend .kf-meta-sep {
    display: none !important;
  }

  #kf-fabric-inspector {
    min-width: 0 !important;
    width: 100% !important;
    text-align: left !important;
    padding-top: 10px !important;
    border-top: 1px solid var(--kf-border-subtle) !important;
    font-size: 0.75rem !important;
    color: var(--kf-text-secondary) !important;
  }

  .kf-fabric-controls {
    top: 10px;
    right: 10px;
  }

  .kf-fabric-tooltip {
    width: calc(100% - 20px);
    left: 10px !important;
    top: 10px !important;
  }

  /* Grids and Cards */
  .kf-os-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kf-layer-card {
    padding: 20px 16px;
  }

  .kf-value-comparison {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .kf-valuation-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 16px;
  }

  .kf-footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* Scale Grid (11. Envergure) */
  .kf-scale-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Form 2-Column Responsive Stacking */
  .kf-form-row-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Touch Target Standard */
  .kf-btn {
    min-height: 46px;
    padding: 10px 18px;
    white-space: normal;
    max-width: 100%;
    text-align: center;
  }

  .kf-icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Visitor Clarity Layer & Discovery Conversion Sections */
  #visitor-clarity-layer,
  #discovery-conversion-engine,
  #pov-packaging {
    padding: 40px 14px !important;
  }

  .kf-booking-controls,
  .kf-trust-form,
  #kf-trust-download-form {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .kf-booking-controls input,
  .kf-booking-controls select,
  .kf-booking-controls button,
  .kf-trust-form input,
  .kf-trust-form button,
  #kf-trust-download-form input,
  #kf-trust-download-form button {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Tables: Diff Card & Transparency Disclosure */
  .kf-diff-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--kf-radius-md);
    margin: 0 -2px;
  }

  .kf-diff-table {
    min-width: 520px;
    width: 100%;
  }

  .kf-transparency-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: normal;
    min-width: 100%;
  }

  .kf-transparency-table th,
  .kf-transparency-table td {
    min-width: 140px;
  }

  /* Interactive Validation Tooltip - Safe Viewport Bounding */
  .kf-proof-tooltip {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(6px) !important;
    box-sizing: border-box !important;
  }

  .kf-proof-tooltip::after {
    left: 28px !important;
    transform: none !important;
  }

  .kf-proof-card:hover .kf-proof-tooltip,
  .kf-proof-card:focus-within .kf-proof-tooltip,
  .kf-proof-card.tooltip-open .kf-proof-tooltip {
    transform: translateY(0) !important;
  }

  /* Roadmap Mobile Ergonomics */
  .kf-roadmap-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .kf-roadmap-filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .kf-roadmap-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .kf-roadmap-tab {
    flex-shrink: 0;
    min-height: 40px;
    padding: 8px 14px;
  }

  .kf-roadmap-track-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-bottom: 20px;
    scrollbar-width: none;
  }

  .kf-roadmap-track-container::-webkit-scrollbar {
    display: none;
  }

  .kf-roadmap-track-nodes {
    min-width: 480px;
  }

  .kf-roadmap-node {
    flex: 0 0 120px;
    padding: 8px 6px;
  }

  .kf-roadmap-carousel {
    grid-template-columns: repeat(4, min(310px, 86vw));
    gap: 14px;
    scroll-padding: 0 14px;
    padding-bottom: 12px;
  }

  .kf-roadmap-card {
    min-height: auto;
    padding: 20px 16px;
    scroll-snap-align: center;
  }

  .kf-roadmap-deliverables li {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .kf-roadmap-details-btn {
    min-height: 44px;
    padding: 10px 14px;
  }

  .kf-roadmap-summary-ribbon {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px 14px;
    gap: 14px;
  }

  /* FAQ Mobile Optimizations */
  .kf-faq-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: 14px;
    scrollbar-width: none;
  }

  .kf-faq-tabs::-webkit-scrollbar {
    display: none;
  }

  .kf-faq-tab {
    flex-shrink: 0;
    min-height: 40px;
    padding: 8px 14px;
  }

  .kf-faq-search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .kf-faq-search-wrapper {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .kf-faq-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .kf-faq-header-btn {
    padding: 16px 14px;
    gap: 10px;
    min-height: 52px;
  }

  .kf-faq-question {
    font-size: 0.9375rem;
    line-height: 1.4;
    padding-right: 6px;
  }

  .kf-faq-answer {
    padding: 0 14px 16px 14px;
    font-size: 0.875rem;
    line-height: 1.55;
  }

  .kf-faq-proof-bridge {
    padding: 20px 16px;
    margin-top: 24px;
  }

  .kf-faq-proof-bridge-title {
    font-size: 1.1875rem;
    line-height: 1.35;
  }

  .kf-faq-proof-bridge-desc {
    font-size: 0.84375rem;
    line-height: 1.55;
  }

  .kf-faq-proof-main-cta {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .kf-faq-proof-links-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Modal Mobile Sheet Ergonomics */
  .kf-modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }

  .kf-modal {
    padding: 24px 16px 20px 16px;
    border-radius: 16px 16px 0 0;
    max-height: 93vh;
    width: 100%;
    margin: 0;
    -webkit-overflow-scrolling: touch;
  }

  .kf-modal-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    z-index: 10;
  }

  /* Roadmap Modal Specifics on Mobile */
  .kf-roadmap-modal-body {
    grid-template-columns: 1fr;
    gap: 14px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .kf-roadmap-modal-col {
    padding: 14px;
  }

  #kf-roadmap-modal .kf-modal-footer,
  #kf-roadmap-modal > div > div:last-child {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #kf-roadmap-modal-prev,
  #kf-roadmap-modal-next,
  #kf-roadmap-modal-done {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* OS Explorer Modal on Mobile */
  #kf-os-modal .kf-modal {
    max-height: 94vh;
  }

  #kf-os-search {
    max-width: 100% !important;
    width: 100%;
  }

  #kf-os-modal > div > div:nth-child(3) > div:last-child {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    width: 100%;
  }

  .kf-os-filter-btn {
    flex-shrink: 0;
    min-height: 38px;
  }

  #kf-os-explorer-grid {
    grid-template-columns: 1fr;
    max-height: 52vh;
    padding-right: 0;
  }
}

/* ------------------------------------------------------------
   Small Mobile Breakpoint (480px)
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .kf-roadmap-carousel {
    grid-template-columns: repeat(4, 88vw);
  }

  .kf-roadmap-summary-ribbon {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 10px;
  }

  .kf-roadmap-stat-val {
    font-size: 1.05rem;
  }

  .kf-roadmap-stat-lbl {
    font-size: 0.6875rem;
  }

  .kf-proof-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .kf-brand span {
    font-size: 0.9375rem;
  }
}

/* RTL Adjustments for Arabic */
[dir="rtl"] .kf-pipeline-arrow svg {
  transform: scaleX(-1);
}

[dir="rtl"] .kf-cockpit-sidebar {
  border-right: none;
  border-left: 1px solid var(--kf-border);
}

@media (max-width: 1024px) {
  [dir="rtl"] .kf-cockpit-sidebar {
    border-left: none;
  }
}

[dir="rtl"] .kf-modal-close {
  right: auto;
  left: 10px;
}

[dir="rtl"] .kf-os-feature-item::before {
  margin-left: 8px;
  margin-right: 0;
}

/* RTL for Partner Ecosystem */
[dir="rtl"] .kf-partner-card,
[dir="rtl"] .kf-partner-track-item {
  text-align: right;
}

[dir="rtl"] .kf-partner-flow-arrow svg {
  transform: scaleX(-1);
}

[dir="rtl"] .kf-partner-card-btn svg,
[dir="rtl"] .kf-partner-main-cta svg {
  transform: scaleX(-1);
}

@media (max-width: 768px) {
  .kf-partner-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kf-partner-doctrine-card,
  .kf-partner-opp-card {
    padding: 24px 18px;
  }

  .kf-partner-decision-flow {
    gap: 6px;
    padding: 14px 10px;
  }

  .kf-partner-flow-step {
    font-size: 0.6875rem;
    padding: 5px 8px;
  }

  .kf-partner-main-cta {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .kf-exec-top-bar {
    padding: 6px 0;
  }
  .kf-exec-top-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .kf-exec-top-actions {
    width: 100%;
    justify-content: space-between;
  }
  .kf-exec-launch-card {
    padding: 22px 18px;
    margin: 24px 0;
  }
  .kf-exec-pass-box {
    padding: 18px 14px;
  }
  .kf-exec-guarantees-bar {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }

  .kf-human-societal-section {
    padding: 64px 0 56px 0;
  }
  .kf-hs-card {
    padding: 22px 18px;
  }
  .kf-sdg-wrapper {
    padding: 28px 18px;
    margin-top: 36px;
  }
  .kf-sdg-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Operational Excellence Section Responsive */
  .kf-op-excellence-section {
    padding: 64px 0 56px 0;
  }
  .kf-op-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kf-op-card {
    padding: 22px 18px;
  }
  .kf-op-matrix-wrapper {
    padding: 20px 14px;
  }
  .kf-op-synthesis-card {
    padding: 26px 16px;
  }
  .kf-op-synthesis-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kf-op-synthesis-conclusion {
    font-size: 0.875rem;
    padding: 10px 16px;
    width: 100%;
    border-radius: var(--kf-radius-md);
  }

  /* Triple Navigation Ergonomics Mobile Overrides */
  .kf-mobile-drawer {
    top: 68px;
  }

  main[id],
  main > section[id],
  main > section[data-section],
  main > section,
  #connected-infrastructure,
  #infrastructure,
  #client-space,
  footer[id] {
    scroll-margin-top: 76px;
  }

  .kf-back-to-top {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 16px;
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
    font-size: 0.78rem;
  }

  [dir="rtl"] .kf-back-to-top {
    right: auto;
    left: 16px;
  }

  .kf-next-section-bar {
    justify-content: stretch;
    margin-top: 22px;
    padding-top: 14px;
  }

  .kf-next-section-link {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 10px 14px;
    white-space: normal;
  }

  .kf-next-section-sep {
    display: none;
  }

  .kf-next-section-title {
    white-space: normal;
    max-width: 100%;
    overflow: visible;
    text-overflow: unset;
    flex: 1 1 140px;
    min-width: 0;
    font-size: 0.8rem;
    line-height: 1.35;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .kf-op-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  .kf-op-synthesis-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}



