/* Responsive overrides loaded after the brand styles. Keep desktop typography intact. */
html { -webkit-text-size-adjust: 100%; }
img, video { max-width: 100%; }
.hero-layout > *, .sectionhead > *, .consult-grid > *, .course-grid > *,
.brand-grid > *, .nerd-world-entry > *, .nerd-guests-grid > *, .story-layout > *,
.academy-video > *, .lesson-workspace > * { min-width: 0; }
dialog { overscroll-behavior: contain; }

@media (max-width: 800px) {
  html { scroll-padding-top: calc(var(--mobile-header-height, 112px) + 16px); }
  body { overflow-x: clip; }
  .connected-journey .wrap { padding-inline: clamp(18px, 5vw, 30px); }
  .nav.wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding-block: 12px; min-height: 108px; }
  .nav .logo { grid-column: 1; grid-row: 1; min-width: 0; gap: 10px; }
  .nav .logo strong { font-size: 12px; letter-spacing: .8px; }
  .nav .logo small { display: none; }
  .nav .mark { width: 36px; height: 36px; flex: 0 0 36px; }
  .nav .navtools { display: contents; }
  .nav .navtools > .motion, .nav .navtools > .btn { display: none; }
  .nav .preferences { grid-row: 2; grid-column: 1; width: auto; justify-content: start; gap: 8px; }
  .nav .pref { min-height: 44px; padding: 8px 12px; font-size: 12px; }
  .nav .motion-mobile { display: inline-flex; align-items: center; justify-content: center; grid-column: 2; grid-row: 2; margin: 0; padding: 8px 10px; min-height: 44px; font-size: 10px; }
  .nav .menu { position: static; grid-column: 2; grid-row: 1; justify-self: end; display: grid; place-items: center; width: 44px; height: 44px; padding: 9px; }
  .header .navlinks { inset: 100% 0 auto; width: 100%; margin: 0; padding: 12px 20px 20px; gap: 4px; align-items: stretch; max-height: calc(100dvh - var(--mobile-header-height, 112px)); overflow-y: auto; background: var(--bg); box-shadow: 0 20px 35px #0003; }
  .navlinks a, html[lang=ar] .navlinks a { display: flex; align-items: center; min-height: 48px; padding: 10px 12px; font-size: 15px; }
  .navlinks a:after { display: none; }
  .navlinks a.active { background: var(--surface); border-inline-start: 2px solid var(--gold); }
  .hero-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 38px; padding-bottom: 30px; }
  .hero h1 { font-size: clamp(43px, 10.5vw, 68px); letter-spacing: -.045em; line-height: 1.09; overflow-wrap: normal; }
  html[lang=ar] .hero h1 { font-size: clamp(32px, 8.8vw, 49px); line-height: 1.5; letter-spacing: 0; }
  .hero p.intro { font-size: 15px; max-width: 100%; }
  .hero-actions { gap: 12px 18px; }
  .hero-actions .btn, .hero-actions .link { min-height: 48px; font-size: 13px; }
  .hero-footer { gap: 10px; line-height: 1.8; flex-wrap: wrap; }
  .hero-footer span + span { padding-inline-start: 10px; }
  .hero .orbital { width: min(100%, 390px); min-width: 0; margin-block: 4px 18px; }
  .hero .satellite { max-width: 46%; font-size: 9px; letter-spacing: .6px; padding: 9px; }
  .hero .satellite span { font-size: 7px; letter-spacing: .4px; }
  .hero .satellite.s1 { left: 0; }
  .hero .satellite.s2 { right: 0; }
  .hero .hero-badge { left: 15%; right: 15%; text-align: center; font-size: 8px; letter-spacing: 1px; }
  .section { scroll-margin-top: calc(var(--mobile-header-height, 112px) + 16px); }
  h2 { font-size: clamp(30px, 8vw, 43px); letter-spacing: -.04em; }
  html[lang=ar] h2 { font-size: clamp(27px, 7.5vw, 37px); line-height: 1.55; }
  .kicker { overflow-wrap: anywhere; }
  .kicker:before { flex-shrink: 0; }
  .gateway, .course-card, .nerd-pass { min-width: 0; }
  .gateway { text-align: start; padding: 18px 15px; }
  .gateway h3 { line-height: 1.45; }
  .service-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-tab { min-width: 0; flex-direction: column; align-items: start; justify-content: center; gap: 10px; padding: 14px 11px; text-align: start; }
  .service-tab .name { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
  .service-tab .small { display: none; }
  .service-panel, .brand-right, .course-feature { padding: 24px 20px; }
  .service-bottom, .learning-note { align-items: stretch; }
  .solution-map { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .solution-map > svg { display: none; }
  .solution-map strong { font-size: 13px; }
  .solution-map small { display: block; font-size: 11px; }
  .course-feature { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .academy-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .academy-stats strong { font-size: 26px; }
  .academy-stats small { display: block; font-size: 11px; line-height: 1.65; }
  .academy-actions .btn { flex: 1 1 150px; }
  .academy-toolbar { flex-direction: column; align-items: stretch; }
  .academy-toolbar input { width: 100%; max-width: none; }
  .course-note { overflow-wrap: anywhere; }
  .nerd-world-title h2 { font-size: clamp(35px, 9vw, 49px); }
  html[lang=ar] .nerd-world-title h2 { font-size: clamp(29px, 8vw, 39px); }
  .nerd-world-collage { min-height: 340px; overflow: clip; }
  .nerd-world-photo { width: 62%; max-width: 225px; }
  .nerd-world-photo img { height: auto; aspect-ratio: 16 / 9; }
  .nerd-world-photo.portrait-2 { width: 52%; max-width: 195px; }
  .nerd-world-ring { width: min(290px, 90%); height: auto; aspect-ratio: 1; }
  .nerd-world-ring.second { width: min(210px, 70%); height: auto; }
  .nerd-world-coordinate { bottom: 2px; }
  .nerd-pass-body { min-height: 0; }
  .nerd-pass-footer { gap: 6px; line-height: 1.7; }
  .nerd-next-card > .btn { width: 100%; }
  .social-platforms a { min-width: 0; gap: 10px; padding: 18px 12px; }
  .social-platforms a > span { min-width: 0; }
  .social-platforms small { overflow-wrap: anywhere; }
  .collab-list li { flex-wrap: wrap; gap: 6px; }
  .story-topline { flex-wrap: wrap; gap: 8px; padding-block: 14px 8px; }
  .story-copy h2 { font-size: clamp(27px, 7.5vw, 40px); }
  .story-copy p, html[lang=ar] .story-copy p { font-size: 13px; }
  .story-copy .btn { min-height: 44px; font-size: 12px; }
  .story-chapters button, html[lang=ar] .story-chapters button { min-height: 44px; padding: 9px 5px; font-size: 9px; flex-wrap: wrap; gap: 2px 5px; }
  .story-narrative { max-height: none; }
  .story-stage { height: calc(100svh - var(--story-nav-height)); }
  .story-layout { grid-template-rows: minmax(255px, 1fr) minmax(150px, .8fr); }
  .story-engine { min-height: 150px; }
  .story-scroll-hint { display: none; }
  .story-static .story-layout { display: block; }
  .story-static .story-narrative { height: auto; }
  .story-static .story-copy h2, html[lang=ar] .story-static .story-copy h2 { font-size: clamp(28px, 7.5vw, 38px); }
  .chapter-bridge { padding-block: 30px; }
  .bridge-copy { min-width: 0; }
  .bridge-copy span { letter-spacing: 1px; line-height: 1.8; }
  .bridge-copy p { font-size: 18px; }
  .filter, .pref, .close { min-height: 44px; }
  .close { width: 44px; height: 44px; }
  dialog, dialog.learning-modal, #nerdGuestDialog { width: calc(100% - 24px); max-width: none; max-height: calc(var(--mobile-visual-height, 100dvh) - 24px); margin: auto; }
  .dialog-inner, .cinema-modal .dialog-inner { padding: 22px 18px; }
  .dialog-head { gap: 12px; }
  .dialog-head h2, .cinema-modal .dialog-head h2 { font-size: 25px; line-height: 1.45; overflow-wrap: anywhere; }
  .dialog-actions > .btn { flex: 1 1 170px; }
  .level-roadmap { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .level-node { padding: 17px; min-width: 0; }
  .level-node strong { font-size: 18px; }
  .level-detail { padding: 20px 16px; }
  .level-heading { flex-direction: column; gap: 12px; }
  .lesson-workspace, .academy-video, .learning-dashboard { grid-template-columns: minmax(0, 1fr); }
  .learning-lesson-list { border-inline: 0; padding-inline: 0; }
  .question-block { min-width: 0; }
  .field input, .field select, .field textarea, #nerdInput, .academy-toolbar input, .library-search input, .library-search select { font-size: 16px; min-width: 0; }
  .player-toolbar > button, .player-toolbar > a { flex: 1 1 130px; }
  .social-rail { inset: auto auto calc(14px + env(safe-area-inset-bottom)) 12px; }
  .social-rail a { width: 40px; height: 44px; }
  html[dir=rtl] .social-rail { left: auto; right: 12px; }
  #robotDock { width: 62px; height: 66px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  #nerdLauncher { width: 62px; height: 66px; }
  #nerdLauncher .robotic-head { width: 62px; height: 62px; }
  html[dir=rtl] #robotDock { left: 12px; right: auto; }
  #robotPrompt { width: min(250px, calc(100vw - 28px)); padding: 12px; }
  #robotPrompt #robotPromptDismiss { min-width: 32px; min-height: 32px; }
  #nerdChat, html[dir=rtl] #nerdChat { position: fixed; inset: calc(var(--mobile-visual-top, 0px) + 12px) 12px auto; width: calc(100% - 24px); max-width: none; height: calc(var(--mobile-visual-height, 100dvh) - 24px); max-height: none; margin: 0; border-radius: 16px; overflow: hidden; }
  #nerdChat header { flex-shrink: 0; padding: 14px 18px; }
  #nerdClose { width: 44px; height: 44px; }
  #nerdNotice { padding: 10px 18px; font-size: 11px; flex-shrink: 0; }
  #nerdLog { min-height: 70px; padding: 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #nerdLog p { font-size: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-width: 95%; align-self: start; overflow-wrap: anywhere; }
  #nerdLog .user { align-self: end; background: color-mix(in srgb, var(--gold) 10%, var(--bg)); }
  #nerdChoices { padding: 8px 14px; gap: 8px; flex-shrink: 0; max-height: 128px; overflow-y: auto; }
  #nerdChoices button { min-height: 44px; font-size: 12px; padding: 9px 12px; border-radius: 20px; }
  #nerdForm { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); flex-shrink: 0; }
  #nerdInput { min-height: 48px; border-radius: 8px; }
  #nerdForm button { min-width: 48px; border-radius: 8px; }
  body.mobile-dialog-open .social-rail, body.mobile-dialog-open #robotDock { visibility: hidden; }
  .connected-journey .custom-scroll { display: none; }
  .toast { bottom: calc(94px + env(safe-area-inset-bottom)); text-align: center; }
  .connected-journey .footer { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  .academy-page header, .academy-page footer { padding: 20px; gap: 18px; }
  .academy-page header { align-items: start; flex-direction: column; }
  .academy-page nav { width: 100%; flex-wrap: wrap; gap: 8px 16px; }
  .academy-page nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .academy-page nav button { min-width: 44px; min-height: 44px; }
  .academy-page main { padding: 38px 20px 70px; }
  .academy-page h1 { font-size: clamp(32px, 9vw, 48px); overflow-wrap: anywhere; }
  .academy-page .grid, .academy-page .row { grid-template-columns: minmax(0, 1fr); }
  .academy-page .panel { min-width: 0; padding: 22px 18px; }
  .academy-page input, .academy-page select, .academy-page textarea { font-size: 16px; min-width: 0; }
  .academy-page .filters { display: grid; grid-template-columns: minmax(0, 1fr); }
  .academy-page .filters input, .academy-page .filters select { min-width: 0; width: 100%; }
  .academy-page .actions > button, .academy-page .actions > .button { flex: 1 1 160px; text-align: center; }
  .academy-page .table { max-width: 100%; overscroll-behavior-inline: contain; }
  .academy-page .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .academy-page .stat { padding: 16px 12px; min-width: 0; }
  .academy-page .intro, .academy-page .notice, .academy-page .request, .academy-page .audit { overflow-wrap: anywhere; }
  .academy-page dialog { padding: 22px 18px; }
  .academy-page dialog .close { width: 44px; height: 44px; padding: 0; }
  .academy-page footer { flex-direction: column; align-items: start; }
}

@media (max-width: 380px) {
  .gateways, .nerd-guests-grid, .feed-cards, .channel-row, .social-platforms { grid-template-columns: minmax(0, 1fr); }
  .gateway { min-height: 130px; }
  .nerd-pass-body strong, html[lang=ar] .nerd-pass-body strong { font-size: 17px; }
  .nerd-pass-top { font-size: 8px; }
}

@media (hover: none) {
  .gateway:hover, .course-card:hover, .nerd-pass:hover, .btn:hover { transform: none; }
  .social-rail-tip { display: none; }
}
