/* Responsive final pass — one owner for viewport-specific composition and motion. */

img, canvas { max-width: 100%; }
.signal-core canvas { max-width: none; }
button, a { -webkit-tap-highlight-color: transparent; }
body, body * {
  -webkit-hyphens: none;
  hyphens: none;
}
p, li, a, button { overflow-wrap: break-word; }
h1, h2, h3, strong { overflow-wrap: normal; word-break: normal; }

@media (max-width: 900px) {
  :root { --page: 22px; }
  html { scroll-padding-top: 76px; }
  main > section,
  main > section[id] { scroll-margin-top: 76px; }

  .site-header {
    display: flex !important;
    justify-content: space-between;
    gap: 12px !important;
    width: 100%;
    min-width: 0;
  }
  .site-header .brand,
  .site-header .header-actions { min-width: 0; }
  .site-header .brand img { width: clamp(126px, 39vw, 149px); }

  /* Keep the first scene complete and readable: promise, object and explanation. */
  .hero-refraction {
    height: auto !important;
    min-height: 100svh;
    padding: 84px var(--page) 20px !important;
    justify-content: flex-start;
    contain: inline-size paint;
  }
  .hero-refraction .hero-backword {
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
  }
  .hero-refraction .hero-copy h1 {
    max-width: 9.4ch;
    font-size: clamp(42px, 11.2vw, 58px);
    line-height: .91;
    letter-spacing: -.07em;
  }
  .hero-refraction .signal-stage {
    height: clamp(230px, 31vh, 278px);
    min-height: 230px;
    margin: 4px 0 -4px;
  }
  .hero-refraction .signal-core { width: min(58vw, 238px); }
  .hero-refraction .hero-insight {
    min-height: 0;
    padding: 15px 17px 16px;
    border-radius: 20px;
  }
  .hero-refraction .hero-insight h2 { font-size: clamp(22px, 6vw, 26px); line-height: .98; }
  .hero-refraction .hero-insight p { font-size: 14px; line-height: 1.45; }
  .hero-refraction .hero-insight > span { font-size: 12px; }

  /* Mobile navigation stays within the visual viewport and has a stable control. */
  .site-menu {
    height: 100dvh;
    min-height: 100svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-content: start;
    padding-bottom: max(34px, env(safe-area-inset-bottom));
  }
  .menu-toggle { min-width: 94px; min-height: 44px; font-size: 12px; }
  .menu-links a { min-height: 44px; }
  .menu-links a small { font-size: 12px !important; }
  .menu-footer {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    margin-top: 28px !important;
    box-sizing: border-box;
  }
  .menu-footer > span,
  .menu-footer a { font-size: 13px !important; }
  .menu-footer a { min-height: 44px; }

  /* Cards are genuine grid items at every narrow width; no off-canvas translated item. */
  .competence-map {
    width: 100%;
    min-height: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(132px, auto)) minmax(126px, auto) !important;
    gap: 10px !important;
  }
  .competence-node,
  .competence-node:nth-of-type(n) {
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    align-self: stretch;
    transform: none !important;
  }
  .competence-node.is-current { transform: translateY(-3px) !important; }
  .competence-core { min-width: 0; width: auto !important; }
  .competence-core p { font-size: 14px !important; line-height: 1.45 !important; }

  .diagnosis-stack,
  .issue-card,
  .solution-grid,
  .solution-card,
  .solution-face,
  .contact-choices,
  .contact-choice { min-width: 0; width: 100% !important; max-width: 100%; }
  .issue-card { position: relative; }
  .issue-card { grid-template-columns: 37px minmax(0, 1fr) !important; }
  .issue-card > div { min-width: 0; }
  .issue-action {
    position: absolute !important;
    right: 20px;
    bottom: 20px;
  }
  .solution-card .solution-toggle {
    block-size: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
  }
  .solution-card,
  .solution-card .solution-face,
  .solution-card .solution-details {
    border-radius: 24px !important;
  }
  .proof-rail span { font-size: 12px !important; line-height: 1.4 !important; }
  .proof-rail > div:last-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .issue-card small,
  .clients-kicker,
  .flip-caption > span,
  .flip-label,
  .product-mark > span,
  .contact-kicker,
  .contact-choice small { font-size: 11px !important; line-height: 1.4 !important; }
  .system-step li { font-size: 14px !important; line-height: 1.4 !important; }
  .system-step:nth-child(2) h3 {
    max-width: 100% !important;
    font-size: clamp(40px, 11vw, 52px) !important;
    letter-spacing: -.075em !important;
  }
  .solution-card .solution-face > p,
  .solution-details p,
  .solution-details li,
  .department-columns li,
  .contact-choice span { font-size: 14px !important; line-height: 1.45 !important; }
  .solution-card .product-mark > span,
  .solution-card .product-chips span,
  .values span { font-size: 11px !important; line-height: 1.3 !important; }
  .solution-card .solution-toggle,
  .solution-card .solution-toggle span { font-size: 13px !important; line-height: 1.25 !important; }
  .solution-details .text-link,
  .trust .button,
  .footer-contact a,
  .footer-links a { font-size: 13px !important; }
  .site-footer small,
  .footer-bottom a { font-size: 11px !important; line-height: 1.4 !important; }
  .competence-node > span,
  .cert-grid article > span,
  .footer-contact > span { font-size: 11px !important; }
  .site-footer > *,
  .footer-brand,
  .footer-contact,
  .footer-links,
  .footer-bottom { min-width: 0; max-width: 100%; }
  .site-footer {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .site-footer > * { grid-column: 1 !important; width: 100%; }
  .footer-links a { min-height: 44px; display: inline-flex; align-items: center; }
  .footer-bottom { flex-wrap: wrap; gap: 12px 20px; }

  /* Reset the tablet grid placement inherited by the AICEL artwork. */
  .trust {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .trust-copy,
  .trust > img {
    grid-column: 1 !important;
    width: 100%;
  }
  .trust > img {
    width: min(100%, 300px);
    justify-self: center;
    order: -1;
  }

  .menu-links,
  .menu-links a,
  .menu-links a span,
  .manifesto-source,
  .manifesto-source .manifesto-line,
  .solution-card .solution-face h3,
  .trust-copy,
  .trust-copy h2,
  .trust-points,
  .trust-points span {
    min-width: 0;
    max-width: 100%;
    width: auto;
    white-space: normal !important;
  }
  .manifesto-luminance .manifesto-source .manifesto-line {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Touch feedback supplements the desktop choreography without changing its timing. */
  .solution-toggle:active,
  .menu-toggle:active,
  .competence-node:active { transform: scale(.985) !important; }
  .contact-choice,
  .contact-choice.meeting,
  .contact-choice:hover,
  .contact-choice:focus-visible,
  .contact-choice:active,
  .contact-choice.meeting:hover,
  .contact-choice.meeting:focus-visible,
  .contact-choice.meeting:active {
    min-height: 184px !important;
    padding: 24px !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    border-radius: 24px !important;
    background: rgba(255,255,255,.045) !important;
    transform: none !important;
  }
  .contact-choice:active,
  .contact-choice.meeting:active {
    background: rgba(255,255,255,.085) !important;
    border-color: rgba(255,255,255,.48) !important;
  }
  .contact-choice .feature-icon {
    display: grid !important;
    place-items: center;
    flex: 0 0 36px;
    width: 36px !important;
    height: 36px !important;
    margin: 0 0 15px !important;
    padding: 8px !important;
    border: 1px solid rgba(255,255,255,.62) !important;
    border-radius: 12px 6px 12px 6px !important;
    color: rgba(255,255,255,.92);
  }
  .contact-choice .feature-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .diagnosis-stack,
  .logo-river { touch-action: pan-y; }
  .logo-track { animation-play-state: running; }

  /* Avoid a clipped first line / control on text enlargement. */
  .diagnosis-intro h2,
  .solutions-heading h2,
  .competence-intro h2,
  .trust-copy h2,
  .cert-heading h2,
  .contact-title { line-height: .94 !important; }
}

@media (max-width: 340px) {
  .trust h2 { font-size: 42px !important; }
  .system h2 { font-size: 42px !important; }
  .manifesto h2 { font-size: 36px !important; }
  .solution-card .solution-face h3 { font-size: 34px !important; }
  .competence-map { grid-template-rows: repeat(2, minmax(124px, auto)) minmax(126px, auto) !important; }
  .competence-node,
  .competence-node:nth-of-type(n) {
    padding: 12px !important;
    font-size: 15px !important;
    letter-spacing: -.055em !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
}

/* Landscape phones need a distinct composition, not a compressed portrait scene. */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  .site-header { height: 62px; padding-inline: 20px; }
  .site-header .brand img { width: 132px; }
  .menu-toggle { min-height: 44px; min-width: 88px; }
  .hero-refraction {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(160px, .8fr) minmax(180px, .9fr);
    grid-template-rows: 1fr;
    align-items: center;
    gap: 16px;
    height: auto !important;
    min-height: 100svh;
    padding: 66px 20px 14px !important;
  }
  .hero-refraction .hero-copy { grid-column: 1; grid-row: 1; }
  .hero-refraction .hero-copy h1 { max-width: 9.8ch; font-size: clamp(30px, 4.5vw, 42px); line-height: .91; }
  .hero-refraction .signal-stage { grid-column: 2; grid-row: 1; height: min(66vh, 266px); min-height: 178px; margin: 0; }
  .hero-refraction .signal-core { width: min(21vw, 190px); }
  .hero-refraction .hero-insight { grid-column: 3; grid-row: 1; margin: 0; padding: 14px; }
  .hero-refraction .hero-insight h2 { font-size: clamp(18px, 2.5vw, 24px); }
  .hero-refraction .hero-insight p { font-size: 14px; line-height: 1.4; }
}

@media (max-width: 680px) and (orientation: landscape) and (max-height: 560px) {
  .hero-refraction {
    grid-template-columns: minmax(0, 1.15fr) minmax(150px, .85fr);
    grid-template-rows: auto auto;
    align-items: center;
    padding-bottom: 20px !important;
  }
  .hero-refraction .hero-copy { grid-column: 1; grid-row: 1; }
  .hero-refraction .hero-copy h1 { font-size: clamp(28px, 5.6vw, 36px); }
  .hero-refraction .signal-stage { grid-column: 2; grid-row: 1; height: 190px; min-height: 170px; }
  .hero-refraction .signal-core { width: min(30vw, 170px); }
  .hero-refraction .hero-insight { grid-column: 1 / -1; grid-row: 2; width: 100%; }
}

@media (min-width: 901px) and (max-height: 760px) {
  .site-menu { overflow-y: auto; }
  .site-menu .menu-links a { min-height: 42px; }
  .hero-refraction .hero-copy h1 { line-height: .88; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
