/* ==========================================================================
   HackHalt – unified mobile layer
   Loaded last on every page. Only affects viewports <= 760px.
   1. uniform page gutters + vertical rhythm
   2. uniform hero actions / chips
   3. ONE stat / proof card (same look as the Tattva.ai / Index strips)
   4. mobile-native layouts for wide components (tables, tracks, diagrams)
   ========================================================================== */

@media (max-width: 760px) {

  html, body { max-width: 100%; overflow-x: hidden; }
  img, video, canvas { max-width: 100%; }

  /* ---------- 1. gutters: every container uses a 16px side gutter ---------- */
  html body :is(.container, .wrap, .page-container, .cloud-container, .grc-container,
                .soc-container, .ni-container, .rt-container, .container-main) {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    margin-inline: auto !important;
    padding-inline: 0 !important;
    box-sizing: border-box;
  }
  html body .site-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 16px !important;
    box-sizing: border-box;
  }
  /* containers that sit inside another container must not shrink twice */
  html body :is(.container, .wrap, .page-container, .cloud-container, .grc-container,
                .soc-container, .ni-container, .rt-container, .site-container)
  :is(.container, .wrap, .page-container, .cloud-container, .grc-container,
      .soc-container, .ni-container, .rt-container, .site-container) {
    width: 100% !important;
    padding-inline: 0 !important;
  }

  /* ---------- vertical rhythm ---------- */
  html body main > section:not([class*="hero"]):not([class*="cta"]):not([class*="proof"]):not([class*="metrics"]):not([class*="strip"]):not([class*="signal"]),
  html body .page-shell > section:not([class*="hero"]):not([class*="cta"]):not([class*="proof"]):not([class*="metrics"]):not([class*="strip"]):not([class*="signal"]) {
    padding-block: 48px !important;
  }
  html body :is(.tech-strip, .signal-strip, .trust-strip, .cloud-platform-strip, .ni-coverage-strip) {
    padding-block: 24px !important;
  }
  html body :is(.metrics, .proof) { padding-block: 24px !important; }
  html body section[class*="hero"], html body header.hero {
    padding-top: 88px !important;
    padding-bottom: 40px !important;
    min-height: 0 !important;
  }
  html body .section-head, html body [class*="section-heading"], html body [class*="section-header"] {
    margin-bottom: 28px !important;
  }

  /* ---------- 2. hero text, buttons and chips ---------- */
  html body :is(.hero-actions, .hero-cta, .actions, .cta-actions, .btn-row, .rt-hero-actions,
                .cloud-hero-actions, .grc-hero-actions, .soc-hero-actions, .ni-hero-actions,
                .grc-cta-actions, .soc-cta-actions, .rt-cta-actions, .hero-buttons) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
  }
  html body :is(.hero-actions, .hero-cta, .actions, .cta-actions, .btn-row, .rt-hero-actions,
                .cloud-hero-actions, .grc-hero-actions, .soc-hero-actions, .ni-hero-actions,
                .grc-cta-actions, .soc-cta-actions, .rt-cta-actions, .hero-buttons) > :is(a, button) {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box;
    white-space: normal !important;
  }
  html body :is(h1) { overflow-wrap: break-word; }

  /* ---------- 3. ONE stat / proof card --------------------------------------
     Same 2-column, divided, rounded card used by Tattva.ai / Index.            */
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip,
                .sc-stat-strip, .tc-stat-strip, .signal-strip-inner, .hero-metrics,
                .grc-hero-proof, .soc-hero-proof, .ni-coverage-grid, .metrics-panel,
                .metric-grid, .metrics-grid) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #dce7f4 !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 28px rgba(18, 53, 100, .06) !important;
    overflow: hidden;
    box-sizing: border-box;
    transform: none !important;
  }
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip,
                .sc-stat-strip, .tc-stat-strip, .signal-strip-inner, .hero-metrics,
                .grc-hero-proof, .soc-hero-proof, .ni-coverage-grid, .metrics-panel,
                .metric-grid, .metrics-grid) > * {
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 14px 16px !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    box-sizing: border-box;
  }
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip,
                .sc-stat-strip, .tc-stat-strip, .signal-strip-inner, .hero-metrics,
                .grc-hero-proof, .soc-hero-proof, .ni-coverage-grid, .metrics-panel,
                .metric-grid, .metrics-grid) > *:nth-child(odd):not(:last-child) {
    border-right: 1px solid #e3ecf7 !important;
  }
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip,
                .sc-stat-strip, .tc-stat-strip, .signal-strip-inner, .hero-metrics,
                .grc-hero-proof, .soc-hero-proof, .ni-coverage-grid, .metrics-panel,
                .metric-grid, .metrics-grid) > *:nth-child(n+3) {
    border-top: 1px solid #e3ecf7 !important;
  }
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip,
                .sc-stat-strip, .tc-stat-strip, .signal-strip-inner, .hero-metrics,
                .grc-hero-proof, .soc-hero-proof, .ni-coverage-grid, .metrics-panel,
                .metric-grid, .metrics-grid) > *:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  /* icons are dropped in the compact card so every strip reads the same */
  html body :is(.grc-proof-icon, .soc-proof-icon, .ni-coverage-icon, .metric-icon, .trust-icon) {
    display: none !important;
  }
  /* title + description typography */
  html body :is(.aw-stat, .oi-stat, .ci-stat, .dp-stat, .is-stat, .sc-stat, .tc-stat, .signal-stat,
                .grc-proof, .soc-proof-item) strong,
  html body :is(.hero-metrics .metric, .ni-coverage-item) :is(strong, .ni-coverage-title) {
    display: block;
    margin: 0 0 3px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
    color: #0b1d3a !important;
  }
  html body :is(.aw-stat, .oi-stat, .ci-stat, .dp-stat, .is-stat, .sc-stat, .tc-stat, .signal-stat,
                .grc-proof, .soc-proof-item) :is(span, small),
  html body :is(.hero-metrics .metric, .ni-coverage-item) :is(span, .ni-coverage-text) {
    display: block;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
    color: #5b6f89 !important;
  }

  /* numeric strips (certifications / diploma) – big number + label */
  html body :is(.metrics-panel .metric-value, .metric-grid .metric strong) {
    display: block;
    font-size: 28px !important;
    line-height: 1.1 !important;
    letter-spacing: -.02em;
    color: #0b1d3a !important;
  }
  html body :is(.metrics-panel .metric-label, .metric-grid .metric span) {
    display: block;
    margin-top: 4px !important;
    font-size: 11.5px !important;
    line-height: 1.4 !important;
    color: #5b6f89 !important;
  }
  /* corporate-training capability cards */
  html body .metrics-grid .metric-label { font-size: 9.5px !important; letter-spacing: .1em; margin-bottom: 4px; color: #1769ff !important; }
  html body .metrics-grid .metric-title { font-size: 14px !important; line-height: 1.3 !important; margin: 0 0 4px !important; color: #0b1d3a !important; }
  html body .metrics-grid .metric-text  { font-size: 11.5px !important; line-height: 1.45 !important; color: #5b6f89 !important; }

  /* application-security trust strip: intro line + 2-column items */
  html body .trust-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 !important;
    background: #fff !important;
    border: 1px solid #dce7f4 !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 28px rgba(18, 53, 100, .06) !important;
    overflow: hidden;
    padding: 0 !important;
  }
  html body .trust-grid > * { margin: 0 !important; padding: 14px 16px !important; background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; min-width: 0; }
  html body .trust-grid > .trust-intro { grid-column: 1 / -1; border-bottom: 1px solid #e3ecf7 !important; }
  html body .trust-grid > .trust-intro span { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #1769ff; margin-bottom: 4px; }
  html body .trust-grid > .trust-intro strong { font-size: 15px; line-height: 1.35; color: #0b1d3a; }
  html body .trust-grid > .trust-item:nth-child(2n) { border-right: 1px solid #e3ecf7 !important; }
  html body .trust-grid > .trust-item:nth-child(n+4) { border-top: 1px solid #e3ecf7 !important; }
  html body .trust-grid > .trust-item:last-child { grid-column: 1 / -1; border-top: 1px solid #e3ecf7 !important; border-right: 0 !important; }
  html body .trust-item strong { display: block; font-size: 14px; line-height: 1.3; margin-bottom: 3px; color: #0b1d3a; }
  html body .trust-item span { display: block; font-size: 11.5px; line-height: 1.45; color: #5b6f89; }

  /* Index + IT Services proof band: keep the Index look, never wrap "Action →" */
  html body :is(.proof-g, .proof-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html body :is(.pi, .proof-card) { padding: 22px 18px !important; min-width: 0; }
  html body :is(.proof-card):nth-child(odd) { border-right: 1px solid var(--line, #e3ecf7) !important; }
  html body :is(.proof-card):nth-child(n+3) { border-top: 1px solid var(--line, #e3ecf7) !important; }
  html body :is(.pn, .proof-number) { white-space: nowrap; font-size: 34px !important; line-height: 1.1; }
  html body :is(.pn small, .proof-number small) { font-size: 16px !important; }
  html body :is(.pl, .proof-label) { font-size: 12px !important; line-height: 1.4; }

  /* ---------- 4. wide components rebuilt for small screens ---------- */

  /* Certifications matrix: table -> stacked cards */
  html body .matrix { overflow: visible !important; border-radius: 20px; }
  html body .matrix-head { display: none !important; }
  html body .matrix-head, html body .matrix-row { min-width: 0 !important; width: 100% !important; }
  html body .matrix-row {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 6px 12px !important;
    align-items: center;
    padding: 14px 16px !important;
  }
  html body .matrix-row > .matrix-cert { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
  html body .matrix-row > .matrix-muted:nth-child(2)::before { content: "Domain · "; opacity: .65; }
  html body .matrix-row > .matrix-muted:nth-child(3)::before { content: "Focus · "; opacity: .65; }
  html body .matrix-row > .matrix-muted { grid-column: 1 / -1; font-size: 12px !important; padding: 0 !important; }
  html body .matrix-row > div:last-child { grid-column: 1 / -1; padding: 0 !important; }

  /* Diploma learning track: horizontal scroller -> vertical timeline */
  html body .learning-track { overflow: visible !important; margin: 28px 0 0 !important; padding: 0 !important; }
  html body .learning-track::before, html body .learning-progress, html body .learning-pulse { display: none !important; }
  html body .learning-steps {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    width: 100% !important;
    gap: 0 !important;
  }
  html body .learning-step {
    position: relative;
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
    padding: 0 0 22px !important;
    text-align: left !important;
  }
  html body .learning-step::before {
    content: ""; position: absolute; left: 31px; top: 64px; bottom: 0; width: 2px;
    background: linear-gradient(#116de0, #13bdd2); opacity: .35;
  }
  html body .learning-step:last-child::before { display: none; }
  html body .learning-step .step-marker { grid-row: 1 / span 3; width: 64px !important; height: 64px !important; margin: 0 !important; }
  html body .learning-step .step-number { font-size: 20px !important; }
  html body .learning-step .step-icon { width: 24px !important; height: 24px !important; right: -4px !important; bottom: -4px !important; font-size: 10px !important; }
  html body .learning-step h3 { margin: 2px 0 4px !important; font-size: 17px !important; }
  html body .learning-step p { margin: 0 0 8px !important; font-size: 13.5px !important; line-height: 1.55 !important; }
  html body .learning-step .step-detail { margin: 0 !important; font-size: 9.5px !important; padding: 8px 10px !important; text-align: left; }

  /* Red-team attack path: wide, centred node cards */
  html body .rt-node.attacker, html body .rt-node.edge, html body .rt-node.identity,
  html body .rt-node.application, html body .rt-node.crown {
    left: 11% !important; right: auto !important;
    width: 78% !important; height: 62px !important;
  }
  html body .rt-node .rt-node-label { font-size: 14px !important; }
  html body .rt-node .rt-node-sub   { font-size: 11px !important; }
  html body .rt-attack-canvas { min-height: 460px !important; }

  /* Network topology: never scaled down – real size, readable text */
  html body .ni-network-canvas { transform: none !important; }
  html body .ni-network-shell { min-height: 560px !important; }
  html body .ni-network-canvas.ni-topology-flow { inset: 58px 12px 50px !important; gap: 6px !important; }
  html body .ni-topology-zone { min-height: 72px !important; grid-template-columns: 92px minmax(0, 1fr) !important; }
  html body .ni-topology-zone-title { font-size: .66rem !important; }
  html body .ni-topology-entry { font-size: .68rem !important; padding: 7px 6px !important; flex: 1 1 70px !important; }

  /* Corporate-training stack visual: real size, not scaled */
  html body .stack-stage { transform: none !important; }
}

@media (max-width: 380px) {
  html body :is(.pn, .proof-number) { font-size: 29px !important; }
  html body :is(.pi, .proof-card) { padding: 18px 14px !important; }
  html body :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip, .sc-stat-strip,
                .tc-stat-strip, .signal-strip-inner, .hero-metrics, .grc-hero-proof, .soc-hero-proof,
                .ni-coverage-grid, .metrics-panel, .metric-grid, .metrics-grid) > * { padding: 12px 12px !important; }
}

@media (max-width: 760px) {
  html body .proof-card:nth-child(-n+2) { border-top: 0 !important; }
  html body .proof-card + .proof-card { border-left: 0; }
}

/* ---- refinements: diploma timeline + certification cards ---- */
@media (max-width: 760px) {
  html body .learning-step > h3,
  html body .learning-step > p,
  html body .learning-step > .step-detail {
    grid-column: 2 !important;
    text-align: left !important;
    margin-inline: 0 !important;
    max-width: none !important;
    width: auto !important;
    justify-self: stretch !important;
  }
  html body .learning-step > .step-detail { display: block; }
  html body .learning-step .step-marker { grid-column: 1 !important; grid-row: 1 / span 3 !important; }

  html body .matrix-row { padding: 16px !important; gap: 8px 12px !important; }
  html body .matrix-row > .matrix-cert { gap: 12px !important; align-items: center !important; }
  html body .matrix-row .matrix-logo { flex: 0 0 auto; min-width: 46px; height: 46px; margin: 0 !important; display: grid; place-items: center; font-size: 11px !important; }
  html body .matrix-row .matrix-cert strong { flex: 1 1 auto; min-width: 0; font-size: 14px !important; line-height: 1.35 !important; text-align: left; }
  html body .matrix-row > .matrix-muted { display: block; line-height: 1.4; }
  html body .matrix-row .matrix-badge { display: inline-block; margin-top: 2px; }
}
@media (max-width: 760px) { html body .matrix-row > .matrix-cert { padding: 0 !important; margin: 0 !important; } }

/* ---- index layer legend + why hero buttons ---- */
@media (max-width: 760px) {
  html body .lgd.flat { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; width: 100% !important; box-sizing: border-box; }
  html body .lgd.flat .lb { min-width: 0 !important; max-width: 100% !important; white-space: normal !important; font-size: 12px !important; padding: 8px 10px !important; }
  html body .scene-wrap, html body .scene-wrap .ro, html body .scene-wrap .ctl { max-width: 100%; box-sizing: border-box; }
  html body .flex.flex-wrap:has(> .primary-btn) { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  html body .flex.flex-wrap > :is(.primary-btn, .secondary-btn) { width: 100% !important; justify-content: center !important; text-align: center; box-sizing: border-box; }
}

/* breathing room between a hero visual and the stat card that follows it */
@media (max-width: 760px) {
  html body :is(.hero, .grc-hero, .soc-hero, .cloud-hero, .rt-hero, .ni-hero) :is(.aw-stat-strip, .oi-stat-strip, .ci-stats, .dp-stats, .is-stat-strip, .sc-stat-strip, .tc-stat-strip, .hero-metrics, .grc-hero-proof, .soc-hero-proof) {
    margin-top: 22px !important;
  }
}

/* chip rows: wrap naturally instead of one chip per line */
@media (max-width: 760px) {
  html body .hero-proof { display: flex !important; flex-wrap: wrap !important; justify-content: center; gap: 8px !important; }
  html body .hero-proof > .proof-chip { width: auto !important; flex: 0 1 auto !important; }
}

/* Mobile viewport and touch refinements. Keep each page's desktop artwork intact. */
@media (max-width: 760px) {
  html, body { width: 100%; }
  body {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  html body :is(main, .page-shell, .site-container, .container, .wrap) { min-width: 0; }
  html body :is(.hero, [class*="-hero"]) :is(.hero-grid, .hero-layout, .hero-inner, .hero-content-grid, .split-layout) > * { min-width: 0; }
  html body :is(.hero, [class*="-hero"]) :is(.scene-wrap, .hero-visual, .hero-visualization, .hero-scene, .hero-art, .hero-graphic, .hero-visual-wrap, .visualization-panel, .hh-hero-stage) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  html body :is(.hero, [class*="-hero"]) :is(canvas, svg, video, img) { max-width: 100%; }
  html body :is(.hero, [class*="-hero"]) :is(.hero-actions, .hero-cta, .actions, .cta-actions) { min-width: 0; }
}

/* Hover-only movement can stick after a tap on iOS. */
@media (max-width: 760px) and (hover: none) {
  html body :is(.pc, .svc, .service-card, .product-card, .feature-card, .info-card, .course-card, .cert-card, .training-card, .benefit-card):hover,
  html body :is(.hero-visual, .hero-visualization, .hero-scene, .hero-art, .hero-graphic):hover { transform: none; }
}

/* Application Security & Auditing: remove desktop two-column spacing when stacked. */
@media (max-width: 760px) {
  html body .risk-intro-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: clamp(16px, 5vw, 24px) !important;
  }
  html body .risk-intro-grid > .section-heading { margin-bottom: 0 !important; }
  html body .risk-intro-grid > .risk-copy p:first-child { margin-top: 0 !important; }
}
