/*!
 * MJH interaction layer. One shared stylesheet that keeps the pointer calm.
 * Loaded after each page's own <style> so it wins on equal specificity.
 *
 * Root causes this removes (see the K10 audit):
 *  1. Nav logo swap changed the link's own width (40px -> 160px) on hover, so
 *     the hit box moved under a resting pointer.
 *  2. Hover lifts (translateY on buttons, cards and the chat launcher) moved the
 *     element up and away from a pointer resting on its bottom edge, which
 *     dropped :hover, dropped the lift, restored :hover, and so on.
 *  3. "Magnetic" buttons were pulled toward the mouse by script (removed in each
 *     page) so the target always ran away from the pointer.
 *  4. `transition: all` animated layout properties on hover.
 *  5. Icons that lift, scale and rotate inside links could hand the pointer to a
 *     different element, flipping the cursor and the hover state.
 *  6. The nav underline (::after, 2px below the link) caught the pointer and
 *     left a dead 2px strip between link and underline.
 *  7. Dropdown menus closed instantly when the pointer wobbled out of line.
 *
 * Rule of thumb. Hover effects may change color, background, border color,
 * shadow, opacity and transforms of NON-hit-testable decoration. They never
 * move the box that owns :hover.
 */

/* ---------- 1. Cursor and selection stay consistent on every control ---------- */
a[href], button, summary, select, label[for], [role="button"],
input[type="submit"], input[type="button"], input[type="checkbox"], input[type="radio"] {
  cursor: pointer;
}
button:disabled, [aria-disabled="true"], input:disabled, select:disabled {
  cursor: not-allowed;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]):not(:disabled),
textarea:not(:disabled) {
  cursor: text;
}
/* Children of a control never switch the cursor to text or default. */
a[href] *, button *, summary *, [role="button"] * { cursor: inherit; }

/* Labels on buttons, chips, tabs and nav links are not selectable text. */
.btn, button, [role="button"], summary, .ib-chip, .tab-btn, .filter-btn, .pricing-button,
.support-btn, .applybtn, .nav-links a, .nav-logo, .hamburger, .faq-question,
.mjh-cx-launch, .mjh-cx-chip, .mjh-cx-iconbtn {
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }

/* Decorative icons and images inside links and buttons never take the pointer.
   The link or button itself always owns hover and the cursor. The logo is
   excluded because its wordmark must keep the hover area open. */
a[href]:not(.nav-logo) svg, a[href]:not(.nav-logo) img,
button svg, button img, summary svg, [role="button"] svg,
.btn span, .btn svg, .sector-cta span {
  pointer-events: none;
}
/* Icons in cards are decoration, not controls. */
[data-mo-icon] { pointer-events: none; cursor: inherit; }

/* Overlays and decoration that must never intercept the pointer. */
.particle-canvas, canvas.particle-canvas, .grain, .vignette, #stage, #stage canvas,
.scroll-progress, #scroll-progress {
  pointer-events: none;
}

/* ---------- 2. No `transition: all`. Animate only paint properties ---------- */
.btn, .btn-primary, .btn-outline, .btn-ghost, .support-btn, .pricing-button, .filter-btn, .tab-btn,
.why-card, .service-card, .pricing-card, .project-card, .cert-card, .skill-category, .skill-tag,
.faq-item, .faq-question, .timeline-item, .hamburger span, #dots button {
  transition-property: color, background-color, background, border-color, box-shadow,
    transform, opacity, text-shadow, fill, stroke, filter;
}
.btn, .tab-btn, .filter-btn, .pricing-button, .support-btn { text-decoration: none; }

/* ---------- 3. Hover lifts keep a stable hit box ---------- */
/* While a lifted control is hovered, an invisible strip under it follows the
   lift, so a pointer resting near the bottom edge never loses :hover. */
.btn, .support-btn, .pricing-button, .applybtn, .mjh-cx-launch { position: relative; }
.btn:hover::after, .support-btn:hover::after, .pricing-button:hover::after,
.applybtn:hover::after, .mjh-cx-launch:hover::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -7px;
  height: 7px;
  background: transparent;
  pointer-events: auto;
}
/* The strip must not be clipped. */
.btn, .btn-magnetic { overflow: visible; }

/* Cards do not lift. The fading hairline and corner bracket carry the hover,
   so the card the pointer is resting on never moves. */
.service-card:hover, .why-card:hover, .pricing-card:hover, .project-card:hover,
.cert-card:hover, .skill-category:hover {
  transform: none !important;
}
/* Portfolio design tiles lift via inline script in older markup. */
#design-grid > div { transform: none !important; }

/* Buttons are never pulled by script. */
.btn-magnetic:not(:hover) { transform: none; }

/* Sparkle and other infinite micro-animations rest while the pointer is on them. */
.mjh-cx-launch:hover .mjh-cx-spark { animation-play-state: paused; }

/* ---------- 4. Nav ---------- */
/* The underline is decoration. Without this, it left a 2px dead strip between
   the link and its own underline that flipped :hover on active links. */
.nav-links a::after, .nav-links a::before { pointer-events: none; }

@media (hover: hover) and (pointer: fine) {
  /* Logo swap. The link keeps one fixed hit box (the monogram). The wordmark
     is overlaid on top of it and fades in. Nothing changes the link's width. */
  .nav-logo { position: relative; }
  .nav-logo .nl-mark,
  .nav-logo:hover .nl-mark,
  .nav-logo:focus-visible .nl-mark {
    max-width: 60px !important;
  }
  .nav-logo .nl-mark {
    transition: opacity .2s ease, transform .35s cubic-bezier(.22, 1, .36, 1) !important;
  }
  .nav-logo .nl-word {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
  }
  /* Both children belong to the logo link, so the cursor stays a pointer. */
  .nav-logo .nl-mark, .nav-logo .nl-word, .nav-logo .nl-word span { cursor: pointer; }

  /* Dropdowns. Open at once, close after a short grace period, and keep a
     wider invisible bridge so a diagonal move toward the menu never loses it. */
  ul.nav-links li.has-dropdown > ul.dropdown {
    transition: opacity .18s ease .16s, transform .18s ease .16s, visibility 0s linear .34s;
  }
  ul.nav-links li.has-dropdown:hover > ul.dropdown,
  ul.nav-links li.has-dropdown:focus-within > ul.dropdown {
    transition: opacity .2s ease, transform .2s ease, visibility 0s;
  }
  ul.nav-links li.has-dropdown::after { left: -0.75rem; right: -0.75rem; }
}

/* ---------- 5. Touch: no sticky hover lifts, keep tap feedback calm ---------- */
@media (hover: none), (pointer: coarse) {
  .btn:hover, .support-btn:hover, .pricing-button:hover, .applybtn:hover,
  .btn-primary:hover, .btn-outline:hover, .btn-ghost:hover { transform: none; }
  .btn:hover::after, .support-btn:hover::after, .pricing-button:hover::after,
  .applybtn:hover::after, .mjh-cx-launch:hover::after { content: none; }
  [data-mo-hoverroot]:hover [data-mo-icon] { transform: none; }
}

/* ---------- 6. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-primary, .btn-outline, .btn-ghost, .support-btn, .pricing-button, .applybtn, .mjh-cx-launch {
    transform: none !important;
  }
  .btn:hover::after, .support-btn:hover::after, .pricing-button:hover::after,
  .applybtn:hover::after, .mjh-cx-launch:hover::after { content: none; }
  [data-mo-hoverroot]:hover [data-mo-icon] { transform: none; }
  *, *::before, *::after {
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 5. Hover never moves, scales or lifts anything ---------- */
/* One calm rule for the whole site. Hover changes color, background, border
   color, shadow and opacity only. Moving or scaling a control (even by 2px)
   re-rasterizes its text and reads as jitter, so every hover transform is off. */
html body .btn:hover, html body .btn-primary:hover, html body .btn-outline:hover, html body .btn-ghost:hover,
html body .btn-primary:hover:not(:disabled), html body .support-btn:hover, html body .pricing-button:hover,
html body .applybtn:hover, html body .filter-btn:hover, html body .tab-btn:hover, html body .ib-chip:hover,
html body .eng-row:hover, html body .why-card:hover, html body a.why-card.sector-card:hover,
html body .service-card:hover, html body .project-card:hover, html body .media-card:hover,
html body .mjh-cx-launch:hover, html body .mjh-cx-chip:hover, html body .mjh-cx-iconbtn:hover,
html body .mc-play:hover, html body .mc-open:hover, html body .skill-tag:hover {
  transform: none !important;
}
html body .eng-row:hover::after, html body .service-cta a:hover span,
html body a.why-card.sector-card:hover .sector-cta > span,
html body .media-card:hover .mc-motif, html body .media-card:hover .mc-poster {
  transform: none !important;
}
/* Logo swap fades only. No sliding or scaling inside the link. */
html body .nav-logo .nl-mark, html body .nav-logo:hover .nl-mark, html body .nav-logo:focus-visible .nl-mark,
html body .nav-logo .nl-word, html body .nav-logo:hover .nl-word, html body .nav-logo:focus-visible .nl-word {
  transform: none !important;
}

/* ---------- 6. One steady pointer ---------- */
/* Chrome shows a text I-beam over any selectable text with an automatic cursor,
   so crossing a headline, a gap or button text flipped arrow, I-beam and hand.
   Body text now keeps the arrow. Links and buttons keep the hand. Fields keep
   the I-beam. Text can still be selected and copied. */
html body { cursor: default; }
body :where(*) { cursor: inherit; }
/* Hero scenes are full-screen overlays. Their text is for reading, not selecting. */
.scene, .scene * { -webkit-user-select: none; user-select: none; }
.scene a[href], .scene a[href] * { cursor: pointer; }

/* ---------- 7. Solid click surface ---------- */
/* interaction.js adds .mjh-hit to every control. The layer sits above the text,
   covers the whole box, and keeps the hand cursor, so moving along a link or
   button never switches targets. Top level nav links reach into the 48px gap
   between them so the hand holds from one link to the next. */
.mjh-hit-rel { position: relative; }
.mjh-hit::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 1;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
@media (min-width: 861px) {
  nav .nav-links > li > a.mjh-hit::before { inset: -20px -24px; }
}
nav .dropdown a.mjh-hit::before { inset: 0; }
.btn.mjh-hit::before, .support-btn.mjh-hit::before, .pricing-button.mjh-hit::before { inset: 0; }
/* The layer never blocks the dropdown, the assistant or form fields. */
.mjh-hit:disabled::before, .mjh-hit[aria-disabled="true"]::before { cursor: not-allowed; }
nav .nav-links li.has-dropdown > a.mjh-hit::before { content: ""; display: block; }
nav .nav-links a.mjh-hit::before { pointer-events: auto; }
