/* MSID Mobile App Experience 6.7.50
 * Final phone-only UX layer. Loaded after public design layers.
 * Goal: a branded app shell using the canonical aubergine/lime/ivory palette,
 * readable two-card discovery grids, safe-area docks and consistent touch ergonomics.
 */
@media (max-width:767px){
  :root{
    --msid-app-header-h:60px;
    --msid-app-tabbar-h:66px;
    --msid-app-tabbar-edge:10px;
    --msid-app-safe-bottom:max(8px,env(safe-area-inset-bottom,0px));
    --msid-app-tabbar-total:calc(var(--msid-app-tabbar-h) + var(--msid-app-safe-bottom) + var(--msid-app-tabbar-edge));
    --msid-app-gutter:16px;
    --msid-app-card-radius:20px;
    --msid-app-sheet-radius:28px;
    --msid-app-touch:48px;
  }

  html{
    scroll-padding-top:calc(var(--msid-app-header-h) + 16px);
    scroll-padding-bottom:calc(var(--msid-app-tabbar-total) + 18px);
    background:var(--msid-ivory);
  }
  body:not(.page-template-page-dashboard){
    min-width:320px;
    padding-bottom:var(--msid-app-tabbar-total);
    background:var(--msid-ivory);
    overscroll-behavior-y:none;
  }
  body.msid-mobile-search-open{overflow:hidden;touch-action:none}
  body.msid-mobile-keyboard-open .msid-mobile-tabbar,
  body.msid-mobile-keyboard-open :is(.course-mobile-cta,.msid-inst-mobile-bar,.trainer-v4-mobile-dock){
    opacity:0;
    transform:translateY(110%);
    pointer-events:none;
  }

  /* App bar */
  #site-header.msid-global-header.msid-learning-header{
    min-height:var(--msid-app-header-h);
    box-shadow:0 6px 22px rgba(42,14,47,.15);
  }
  #site-header .msid-learning-header-inner,
  #site-header .header-inner{
    height:var(--msid-app-header-h);
    min-height:var(--msid-app-header-h);
    gap:8px;
  }
  #site-header > .container{padding-inline:var(--msid-app-gutter)}
  #site-header .msid-learning-logo{min-height:38px;display:flex;align-items:center}
  #site-header .msid-brand-logo--header{height:32px;max-width:min(43vw,148px)}
  #site-header .msid-header-left-tools,
  #site-header .msid-learning-actions{gap:8px}
  #site-header .menu-toggle,
  #site-header .msid-mobile-header-search{
    width:42px;
    height:42px;
    min-width:42px;
    border-radius:14px;
    background:rgba(255,253,248,.11);
    border-color:rgba(255,253,248,.24);
    transition:background .16s ease,border-color .16s ease,transform .16s ease;
  }
  #site-header .menu-toggle:active,
  #site-header .msid-mobile-header-search:active{transform:scale(.94)}
  #site-header .msid-mobile-header-search svg{width:21px;height:21px}
  body.msid-mobile-header-scrolled #site-header.msid-global-header{box-shadow:0 8px 24px rgba(42,14,47,.20)}

  /* Existing menu becomes a compact app sheet above the tab bar. */
  body.msid-mobile-menu-open::before{
    inset:0;
    background:rgba(23,21,24,.42);
    backdrop-filter:blur(4px);
    -webkit-backdrop-filter:blur(4px);
  }
  #site-header .mobile-nav{
    top:auto;
    right:10px;
    bottom:calc(var(--msid-app-tabbar-total) + 10px);
    left:10px;
    max-height:min(70dvh,560px);
    padding:10px 10px 14px;
    border:1px solid var(--msid-line-soft);
    border-radius:var(--msid-app-sheet-radius);
    box-shadow:0 24px 70px rgba(42,14,47,.28);
    transform:translateY(20px) scale(.985);
    transform-origin:bottom center;
  }
  #site-header .mobile-nav.open{transform:translateY(0) scale(1)}
  body.admin-bar #site-header .mobile-nav{top:auto}
  body.admin-bar.msid-mobile-menu-open::before{top:0}
  #site-header .mobile-nav::before{
    content:"";
    display:block;
    width:42px;
    height:4px;
    margin:1px auto 8px;
    border-radius:999px;
    background:var(--msid-line-strong);
  }
  #site-header .mobile-nav ul{gap:3px}
  #site-header .mobile-nav li a{
    min-height:48px;
    padding:9px 12px;
    border-radius:14px;
    font-size:.9rem;
    font-weight:800;
  }
  #site-header .mobile-nav .mobile-primary-link{min-height:50px;margin-top:5px}

  /* Global app bottom navigation: branded floating dock, no generic black button bleed. */
  .msid-mobile-tabbar{
    position:fixed;
    z-index:10020;
    right:var(--msid-app-tabbar-edge);
    bottom:var(--msid-app-safe-bottom);
    left:var(--msid-app-tabbar-edge);
    height:var(--msid-app-tabbar-h);
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:stretch;
    gap:4px;
    padding:6px;
    border:1px solid var(--msid-aubergine-line);
    border-radius:22px;
    background:rgba(255,253,248,.97);
    box-shadow:0 12px 34px rgba(42,14,47,.16),0 2px 8px rgba(42,14,47,.06);
    backdrop-filter:blur(18px) saturate(1.15);
    -webkit-backdrop-filter:blur(18px) saturate(1.15);
    transition:opacity .18s ease,transform .18s ease;
  }
  .msid-mobile-tabbar-item{
    position:relative;
    min-width:0;
    min-height:52px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    padding:4px 2px;
    border:1px solid transparent;
    border-radius:15px;
    background:transparent;
    color:var(--msid-text-secondary);
    box-shadow:none;
    text-decoration:none;
    -webkit-tap-highlight-color:transparent;
    transition:background .16s ease,color .16s ease,border-color .16s ease,transform .16s ease;
  }
  .msid-mobile-tabbar-item svg{
    width:21px;
    height:21px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.9;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  .msid-mobile-tabbar-item span:last-child{
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:.61rem;
    line-height:1.15;
    font-weight:850;
  }
  .msid-mobile-tabbar-item[aria-current="page"]{
    border-color:var(--msid-lime-line);
    background:var(--msid-lime-soft);
    color:var(--msid-aubergine);
  }
  .msid-mobile-tabbar-item[aria-current="page"]::after{
    content:"";
    position:absolute;
    top:4px;
    width:18px;
    height:3px;
    border-radius:999px;
    background:var(--msid-lime);
  }
  .msid-mobile-tabbar-item:active{background:var(--msid-aubergine-soft);transform:scale(.97)}
  .msid-mobile-tabbar-item:focus-visible{outline:2px solid var(--msid-lime);outline-offset:2px}

  /* The central search is a normal branded tab, not a floating circle/black frame.
   * Element + class specificity intentionally beats the legacy generic button rule. */
  .msid-mobile-tabbar button.msid-mobile-tabbar-search{
    overflow:hidden;
    border:1px solid var(--msid-aubergine);
    background:var(--msid-aubergine);
    color:#fff;
    box-shadow:0 7px 16px rgba(60,22,66,.18);
  }
  .msid-mobile-tabbar button.msid-mobile-tabbar-search:active{
    border-color:var(--msid-aubergine-hover);
    background:var(--msid-aubergine-hover);
    color:#fff;
  }
  .msid-mobile-tabbar-search .msid-mobile-tabbar-search-icon{
    width:25px;
    height:25px;
    margin:0;
    display:grid;
    place-items:center;
    border:0;
    border-radius:9px;
    background:rgba(255,255,255,.10);
    color:#fff;
    box-shadow:none;
  }
  .msid-mobile-tabbar-search .msid-mobile-tabbar-search-icon svg{width:19px;height:19px}
  .msid-mobile-tabbar button.msid-mobile-tabbar-search span:last-child{margin:0;color:#fff}
  body.page-template-page-login .msid-mobile-tabbar,
  body.page-template-page-register .msid-mobile-tabbar{display:none}
  body.page-template-page-login,
  body.page-template-page-register{padding-bottom:0}

  /* Full-screen mobile search experience. */
  .msid-mobile-search-sheet{
    position:fixed;
    z-index:20000;
    inset:0;
    display:block;
    background:var(--msid-ivory);
  }
  .msid-mobile-search-sheet[hidden]{display:none}
  .msid-mobile-search-panel{
    height:100dvh;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    background:var(--msid-ivory);
  }
  .msid-mobile-search-head{
    flex:0 0 auto;
    display:grid;
    grid-template-columns:44px minmax(0,1fr) 44px;
    align-items:center;
    gap:9px;
    padding:max(10px,env(safe-area-inset-top,0px)) var(--msid-app-gutter) 10px;
    border-bottom:1px solid var(--msid-line-soft);
    background:rgba(250,248,242,.96);
  }
  .msid-mobile-search-head>div{text-align:center;min-width:0}
  .msid-mobile-search-head strong{display:block;color:var(--msid-ink);font-size:.98rem;font-weight:900}
  .msid-mobile-search-head small{display:block;margin-top:1px;color:var(--msid-muted);font-size:.62rem}
  .msid-mobile-search-close{
    width:44px;
    height:44px;
    min-height:44px;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid var(--msid-line-soft);
    border-radius:14px;
    background:var(--msid-surface);
    color:var(--msid-ink);
    font-size:1.35rem;
    line-height:1;
  }
  .msid-mobile-search-head-spacer{width:44px;height:44px}
  .msid-mobile-search-body{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    padding:14px var(--msid-app-gutter) calc(24px + env(safe-area-inset-bottom,0px));
  }
  .msid-mobile-search-form{
    position:relative;
    display:grid;
    grid-template-columns:42px minmax(0,1fr) 42px;
    align-items:center;
    gap:4px;
    min-height:56px;
    margin:0;
    padding:4px 6px;
    border:1px solid var(--msid-aubergine-line);
    border-radius:18px;
    background:var(--msid-surface);
    box-shadow:0 8px 26px rgba(42,14,47,.07);
  }
  .msid-mobile-search-form:focus-within{
    border-color:var(--msid-aubergine);
    box-shadow:0 0 0 3px rgba(60,22,66,.08),0 10px 28px rgba(42,14,47,.08);
  }
  .msid-mobile-search-form>svg{width:21px;height:21px;margin:auto;fill:none;stroke:var(--msid-aubergine);stroke-width:1.8;stroke-linecap:round}
  .msid-mobile-search-form input{
    width:100%;
    min-width:0;
    min-height:46px;
    padding:0 4px;
    border:0;
    outline:0;
    background:transparent;
    box-shadow:none;
    color:var(--msid-ink);
    font-size:16px;
    font-weight:700;
  }
  .msid-mobile-search-form input::placeholder{color:var(--msid-subtle);font-weight:600}
  .msid-mobile-search-submit{
    width:42px;
    height:42px;
    min-height:42px;
    padding:0;
    display:grid;
    place-items:center;
    border:0;
    border-radius:14px;
    background:var(--msid-aubergine);
    color:var(--msid-ivory);
  }
  .msid-mobile-search-submit svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
  .msid-mobile-search-sheet .msid-universal-search-panel{
    position:static;
    grid-column:1/-1;
    width:100%;
    max-height:none;
    margin-top:12px;
    padding:0;
    overflow:visible;
    border:0;
    border-radius:0;
    background:transparent;
    box-shadow:none;
  }
  .msid-mobile-search-sheet .msid-universal-group-title{margin:18px 2px 8px}
  .msid-mobile-search-sheet .msid-universal-result-list{display:grid;gap:8px}
  .msid-mobile-search-sheet .msid-universal-result{
    min-height:72px;
    padding:9px;
    border:1px solid var(--msid-line-soft);
    border-radius:16px;
    background:var(--msid-surface);
    box-shadow:none;
  }
  .msid-mobile-search-sheet .msid-universal-result-media{width:52px;height:52px;border-radius:13px}
  .msid-mobile-search-sheet .msid-universal-search-all{min-height:48px;margin-top:10px;border-radius:14px}
  .msid-mobile-search-shortcuts{margin-top:22px}
  .msid-mobile-search-shortcuts h2{margin:0 0 10px;color:var(--msid-ink);font-size:.86rem;font-weight:900}
  .msid-mobile-search-shortcuts-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .msid-mobile-search-shortcuts a{
    min-height:74px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:11px;
    border:1px solid var(--msid-line-soft);
    border-radius:17px;
    background:var(--msid-surface);
    color:var(--msid-ink);
    text-decoration:none;
  }
  .msid-mobile-search-shortcuts a span{
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:grid;
    place-items:center;
    border-radius:12px;
    background:var(--msid-aubergine-soft);
    color:var(--msid-aubergine);
    font-size:1rem;
  }
  .msid-mobile-search-shortcuts a strong{font-size:.73rem;line-height:1.45;font-weight:850}
  .msid-mobile-search-sheet.has-query .msid-mobile-search-shortcuts{display:none}

  /* App canvas and touch rhythm. */
  body:not(.page-template-page-dashboard) :is(button,.btn,.button,a[role="button"]){touch-action:manipulation}
  body:not(.page-template-page-dashboard) :is(button,.btn,.button):active{transform:scale(.985)}
  body:not(.page-template-page-dashboard) :is(input,select,textarea){border-radius:14px}
  body:not(.page-template-page-dashboard) .container{padding-inline:var(--msid-app-gutter)}
  body:not(.page-template-page-dashboard) :is(.section,.mc-section){padding-block:28px}
  body:not(.page-template-page-dashboard) :is(.section-head,.mc-section-head,.course-section-head){margin-bottom:14px}
  /* Mobile brand close: keep the pre-footer CTA and footer unmistakably MSID. */
  body.home .mc-final-cta{background:var(--msid-ivory);padding:32px 0 42px}
  body.home .mc-final-cta-inner{
    position:relative;
    overflow:hidden;
    border-color:var(--msid-aubergine);
    background:
      radial-gradient(circle at 14% 16%,rgba(200,241,53,.18),transparent 32%),
      linear-gradient(145deg,var(--msid-aubergine-dark),var(--msid-aubergine));
    color:#fff;
    box-shadow:0 18px 44px rgba(60,22,66,.15);
  }
  body.home .mc-final-cta span{color:var(--msid-lime)}
  body.home .mc-final-cta h2{color:#fff}
  body.home .mc-final-cta p{color:rgba(255,255,255,.78)}
  body.home .mc-final-cta .mc-btn-light{
    border-color:var(--msid-lime);
    background:var(--msid-lime);
    color:var(--msid-aubergine-dark);
    box-shadow:0 8px 20px rgba(18,8,20,.14);
  }
  body.home .mc-final-cta .mc-btn-light:is(:hover,:focus-visible){background:var(--msid-lime-hover);color:var(--msid-aubergine-dark)}

  #site-footer.msid-global-footer.msid-footer-minimal{
    margin-top:22px;
    padding-bottom:16px;
    border-top:3px solid var(--msid-lime);
    background:linear-gradient(155deg,var(--msid-aubergine-dark),var(--msid-aubergine));
  }
  #site-footer .msid-footer-minimal-inner{gap:14px}
  #site-footer .msid-learning-footer-brand p{color:rgba(255,255,255,.78)}
  #site-footer .msid-footer-minimal-links a{color:rgba(255,255,255,.9)}
  #site-footer .msid-footer-minimal-links a:is(:hover,:focus-visible){color:var(--msid-lime)}
  #site-footer .msid-learning-footer-bottom{border-top-color:rgba(255,255,255,.15);color:rgba(255,255,255,.62)}

  /* Home: short decision-first hero + swipeable discovery. */
  body.home .msid-home-hero-v3{padding:12px 0 8px;background:var(--msid-ivory)}
  body.home .msid-home-hero-v3>.container{padding-inline:var(--msid-app-gutter)}
  body.home .msid-home-hero-main{padding-top:4px}
  body.home .msid-home-hero-v3 h1{
    max-width:360px;
    margin:0;
    text-align:right;
    font-size:clamp(1.72rem,7.8vw,2.18rem);
    line-height:1.25;
    letter-spacing:-.025em;
  }
  body.home .msid-home-hero-v3 .mc-hero-title-accent{margin:2px 0 0}
  body.home .msid-home-hero-lead{
    max-width:360px;
    margin:7px 0 14px;
    text-align:right;
    font-size:.76rem;
    line-height:1.75;
  }
  body.home .msid-home-discovery-search{min-height:56px;border-radius:18px;box-shadow:0 8px 26px rgba(42,14,47,.08)}
  body.home .msid-home-domain-strip{
    display:grid;
    grid-auto-flow:column;
    grid-template-columns:none;
    grid-template-rows:repeat(2,82px);
    grid-auto-columns:82px;
    gap:8px;
    margin:15px calc(var(--msid-app-gutter) * -1) 0;
    padding:0 var(--msid-app-gutter) 4px;
    overflow-x:auto;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
  }
  body.home .msid-home-domain-strip::-webkit-scrollbar{display:none}
  body.home .msid-home-domain-card,
  body.home .msid-home-domain-card:nth-child(n){
    min-height:82px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:7px 5px;
    border:1px solid var(--msid-line-soft);
    border-radius:17px;
    background:var(--msid-surface);
    box-shadow:none;
    scroll-snap-align:start;
  }
  body.home .msid-home-domain-card--all{
    grid-column:auto;
    min-height:82px;
    flex-direction:column;
    gap:4px;
  }
  body.home .msid-home-domain-card--all small{display:block}
  body.home .msid-home-domain-icon{width:32px;height:32px}
  body.home .msid-home-domain-card strong{font-size:.65rem;line-height:1.3}
  body.home .msid-home-domain-card small{font-size:.5rem}
  body.home .msid-home-popular-row{margin-top:10px}
  body.home .msid-directory-home>.mc-section{padding-block:10px}
  body.home .msid-home-panel,
  body.home .msid-home-proof-panel{
    padding:14px;
    border:1px solid var(--msid-line-soft);
    border-radius:var(--msid-app-card-radius);
    background:var(--msid-surface);
    box-shadow:none;
  }
  body.home .msid-home-panel .mc-section-head h2{font-size:1.06rem}
  /* Homepage listing-card layout is owned by the canonical 6.8.1 two-column block below. */

  /* Directory: sticky decision toolbar and readable one-result-per-row cards. */
  .msid-mobile-directory-discovery,
  .msid-mobile-school-discovery{padding:10px 0 8px;background:var(--msid-ivory)}
  .msid-mobile-directory-search,
  .msid-mobile-school-search{min-height:50px;border-radius:16px;background:var(--msid-surface)}
  .msid-mobile-results-toolbar{
    position:sticky;
    top:calc(var(--msid-app-header-h) + 6px);
    z-index:48;
    margin:0 0 10px;
    padding:8px;
    border:1px solid var(--msid-line-soft);
    border-radius:16px;
    background:rgba(255,253,248,.95);
    box-shadow:0 7px 20px rgba(42,14,47,.06);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
  }
  body.admin-bar .msid-mobile-results-toolbar{top:calc(var(--msid-app-header-h) + 52px)}
  .msid-mobile-directory-drawer,
  .msid-mobile-school-drawer{bottom:var(--msid-app-tabbar-total);border-radius:var(--msid-app-sheet-radius) var(--msid-app-sheet-radius) 0 0}

  /* Public result-card layout is owned by the canonical 6.8.1 two-column block below. */

  /* Detail pages: contextual actions sit above global navigation. */
  body.single-tk_course,
  body.single-tk_institution,
  body.single-tk_trainer{padding-bottom:calc(var(--msid-app-tabbar-total) + 72px)}
  body.single-tk_course .msid-course-modern .course-modern-tabs{
    top:calc(var(--msid-app-header-h) + 6px);
    margin-inline:-4px;
    padding:7px;
    border-radius:16px;
  }
  body.admin-bar.single-tk_course .msid-course-modern .course-modern-tabs{top:calc(var(--msid-app-header-h) + 52px)}
  body.single-tk_course .msid-course-modern .course-modern-section,
  body.single-tk_trainer .trainer-v4-card,
  body.single-tk_institution .msid-inst-card{border-radius:var(--msid-app-card-radius)}
  body.single-tk_course .msid-course-modern .course-mobile-cta,
  body.single-tk_institution .msid-inst-mobile-bar,
  body.single-tk_trainer .trainer-v4-mobile-dock{
    bottom:var(--msid-app-tabbar-total);
    z-index:10010;
    min-height:64px;
    padding:8px 12px;
    border-top:1px solid var(--msid-line-soft);
    background:rgba(255,253,248,.97);
    box-shadow:0 -8px 24px rgba(42,14,47,.08);
    backdrop-filter:blur(16px);
    -webkit-backdrop-filter:blur(16px);
    transition:opacity .18s ease,transform .18s ease;
  }
  body.single-tk_course .msid-course-modern .course-mobile-cta{grid-template-columns:minmax(0,1fr) minmax(142px,1fr)}
  body.single-tk_course .msid-course-modern .course-mobile-cta button{min-height:46px;border-radius:14px}
  body.single-tk_institution .msid-inst-mobile-bar{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.single-tk_institution .msid-inst-mobile-bar .msid-inst-btn{min-height:46px;border-radius:14px}
  body.single-tk_trainer .trainer-v4-mobile-dock{
    position:fixed;
    right:0;
    left:0;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:8px;
  }
  body.single-tk_trainer .trainer-v4-mobile-dock>a,
  body.single-tk_trainer .trainer-v4-mobile-dock>button,
  body.single-tk_trainer .trainer-v4-mobile-dock .trainer-v4-mobile-save{
    min-height:46px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    margin:0;
    padding:8px 13px;
    border-radius:14px;
    font:inherit;
    font-size:.72rem;
    font-weight:900;
  }
  body.single-tk_trainer .trainer-v4-mobile-primary{border:1px solid var(--msid-aubergine);background:var(--msid-aubergine);color:var(--msid-ivory);text-decoration:none}
  body.single-tk_trainer .trainer-v4-mobile-save{min-width:92px;border:1px solid var(--msid-line);background:var(--msid-surface);color:var(--msid-aubergine)}
  body.single-tk_trainer .trainer-v4-mobile-save svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8}
  body.msid-mobile-menu-open :is(.course-mobile-cta,.msid-inst-mobile-bar,.trainer-v4-mobile-dock){opacity:0;transform:translateY(110%);pointer-events:none}

  /* Motion remains subtle and respects OS preference. */
  @media (prefers-reduced-motion:reduce){
    .msid-mobile-tabbar,
    .msid-mobile-tabbar-item,
    #site-header .mobile-nav,
    :is(.course-mobile-cta,.msid-inst-mobile-bar,.trainer-v4-mobile-dock){transition:none}
  }
}


/* 6.7.51 — final phone cascade ownership.
 * These rules replace legacy priority overrides from mobile.css/mobile-directory.css.
 * mobile-app.css loads after controls/filters, so no priority flag is required. */
@media (max-width:760px){
  /* Mobile discovery replaces legacy desktop filters/heroes on phones. */
  body.home :is(.fp-priority-strip,.mc-filter-bar,.mc-filter-meta){display:none}
  body.home .msid-mobile-subfield-panels{display:none}
  body.home .msid-mobile-field-discovery.is-drilling :is(.msid-mobile-field-head,.msid-mobile-field-carousel){display:none}
  body.home .msid-mobile-field-discovery.is-final{display:none}

  body:is(.post-type-archive-tk_course,.post-type-archive-tk_trainer,.tax-tk_field) .tk-dir-hero,
  body:is(.post-type-archive-tk_course,.post-type-archive-tk_trainer,.tax-tk_field) :is(.tk-cat-icons-bar,.tk-filters-bar,.tk-active-filters),
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) :is(.tk-cat-icons-bar,.tk-filters-bar,.tk-active-filters),
  body.page-template-page-private-lessons :is(.msid-school-hero,.sp-grade-tabs-wrap,.sp-subjects-wrap,.sp-filters-bar){display:none}
  .tdh-course-nearby{display:none}

  /* Taxonomy browser geometry: final, readable two-row ownership. */
  body.home .msid-mobile-field-discovery{
    min-height:0;
    height:auto;
    max-height:none;
    overflow:hidden;
    background:var(--msid-surface);
  }
  body.home .msid-mobile-field-carousel,
  body.home .msid-mobile-field-discovery.is-drilling .msid-mobile-field-level{
    grid-template-rows:92px;
    grid-auto-columns:calc((100% - 18px)/4);
    gap:8px 6px;
    align-content:start;
    min-height:0;
    height:auto;
    max-height:none;
    padding:1px 0 4px;
  }
  body.home .msid-mobile-field-carousel:has(> :nth-child(5)),
  body.home .msid-mobile-field-discovery.is-drilling .msid-mobile-field-level:has(> :nth-child(5)){
    grid-template-rows:repeat(2,92px);
  }
  body.home .msid-mobile-field-head{margin-bottom:9px}
  body.home .msid-mobile-field-carousel{margin-bottom:0}
  body.home .mc-discovery.fp-filters{background:var(--msid-surface);overflow:hidden}

  /* Semantic field-icon palette, now after generic button rules. */
  [data-mobile-color="blue"]{--msid-mi-fg:#2563eb;--msid-mi-bg:#eff6ff;--msid-mi-border:#bfdbfe}
  [data-mobile-color="violet"]{--msid-mi-fg:#7c3aed;--msid-mi-bg:#f5f3ff;--msid-mi-border:#ddd6fe}
  [data-mobile-color="amber"]{--msid-mi-fg:#b45309;--msid-mi-bg:#fffbeb;--msid-mi-border:#fde68a}
  [data-mobile-color="rose"]{--msid-mi-fg:#be123c;--msid-mi-bg:#fff1f2;--msid-mi-border:#fecdd3}
  [data-mobile-color="green"]{--msid-mi-fg:#15803d;--msid-mi-bg:#f0fdf4;--msid-mi-border:#bbf7d0}
  [data-mobile-color="indigo"]{--msid-mi-fg:#4338ca;--msid-mi-bg:#eef2ff;--msid-mi-border:#c7d2fe}
  [data-mobile-color="plum"]{--msid-mi-fg:#a21caf;--msid-mi-bg:#fdf4ff;--msid-mi-border:#f5d0fe}
  [data-mobile-color="teal"]{--msid-mi-fg:#0f766e;--msid-mi-bg:#f0fdfa;--msid-mi-border:#99f6e4}
  [data-mobile-color="cyan"]{--msid-mi-fg:#0e7490;--msid-mi-bg:#ecfeff;--msid-mi-border:#a5f3fc}
  [data-mobile-color="orange"]{--msid-mi-fg:#c2410c;--msid-mi-bg:#fff7ed;--msid-mi-border:#fed7aa}
  [data-mobile-color="red"]{--msid-mi-fg:#b91c1c;--msid-mi-bg:#fef2f2;--msid-mi-border:#fecaca}
  [data-mobile-color="slate"]{--msid-mi-fg:#475569;--msid-mi-bg:#f8fafc;--msid-mi-border:#cbd5e1}

  body.home button.msid-mobile-field-icon{
    background:transparent;
    border:0;
    box-shadow:none;
    border-radius:0;
    padding:4px 2px;
    transform:none;
  }
  body.home button.msid-mobile-field-icon:is(:hover,:focus-visible){
    background:transparent;
    border:0;
    box-shadow:none;
    transform:none;
  }
  body.home button.msid-mobile-field-icon[data-mobile-color] .msid-mobile-field-glyph{
    width:54px;
    height:54px;
    border-radius:17px;
    background:var(--msid-mi-bg);
    color:var(--msid-mi-fg);
    -webkit-text-fill-color:var(--msid-mi-fg);
    border:1px solid var(--msid-mi-border);
    box-shadow:none;
  }
  body.home button.msid-mobile-field-icon[data-mobile-color]:is(:hover,:focus-visible) .msid-mobile-field-glyph{
    border-color:var(--msid-mi-fg);
    box-shadow:0 0 0 3px var(--msid-mi-bg);
  }
  body.home button.msid-mobile-field-icon[data-mobile-color]:is(.is-active,.is-parent-active) .msid-mobile-field-glyph{
    background:var(--msid-mi-fg);
    color:#fff;
    -webkit-text-fill-color:#fff;
    border-color:var(--msid-mi-fg);
    box-shadow:0 0 0 3px var(--msid-mi-bg);
  }
  body.home button.msid-mobile-field-icon[data-mobile-color] .msid-mobile-field-more{
    color:var(--msid-mi-fg);
    -webkit-text-fill-color:var(--msid-mi-fg);
  }
  body.home button.msid-mobile-field-icon[data-mobile-color]>span:nth-child(2){
    margin-top:4px;
    color:var(--msid-ink);
    -webkit-text-fill-color:var(--msid-ink);
    font-size:.74rem;
    line-height:1.28;
    font-weight:850;
  }
  body.home button.msid-mobile-field-icon[data-mobile-color] .msid-mobile-field-glyph svg{width:26px;height:26px}

  body.home .mc-section-head p{display:none}
  body.home .trainer-card-follow{display:none}
  .msid-footer-minimal{padding:20px 0 10px}
}


/* 6.8.1 — canonical phone card rhythm: two cards per row across public discovery. */
@media(max-width:767px){
  body.home :is(#front-courses-grid,.mc-trainer-grid,.msid-home-school-grid,.msid-home-articles-grid,.msid-book-grid){
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-rows:none;
    grid-auto-flow:row;
    grid-auto-columns:auto;
    gap:9px;
    margin-inline:0;
    padding:2px 0 8px;
    overflow:visible;
    scroll-snap-type:none;
  }
  body.home :is(#front-courses-grid,.mc-trainer-grid,.msid-home-school-grid,.msid-home-articles-grid,.msid-book-grid)>*{
    width:100%;
    min-width:0;
    max-width:none;
    flex:none;
    scroll-snap-align:none;
  }
  body.home :is(.msid-home-course-card,.mc-trainer-grid>.trainer-card,.msid-home-school-grid>.sp-school-ad-card,.msid-home-article,.msid-book-card){
    border-radius:16px;
  }
  body.home :is(.msid-home-course-card .sp-tc-media,.mc-trainer-grid .trainer-card-media,.msid-home-school-grid .sp-tc-media,.msid-home-article-media){aspect-ratio:16/10}
  body.home :is(.msid-home-course-card,.msid-home-school-grid .sp-school-ad-card) .sp-tc-card-body,
  body.home .mc-trainer-grid .trainer-card-body,
  body.home .msid-home-article .msid-home-article-copy{padding:9px;gap:5px}
  body.home .mc-trainer-grid .trainer-card-bio,body.home .mc-trainer-grid .trainer-card-institution,body.home .mc-trainer-grid .trainer-card-extra-meta{display:none}
  body.home :is(.msid-home-course-card,.msid-home-school-grid .sp-school-ad-card) .sp-tc-card-facts{display:none}
  body.home :is(.msid-home-course-card,.msid-home-school-grid .sp-school-ad-card) .sp-tc-card-title,body.home .mc-trainer-grid .trainer-card-title,body.home .msid-home-article h3{font-size:.78rem;line-height:1.42}
  body.home :is(.msid-home-course-card,.msid-home-school-grid .sp-school-ad-card) .sp-tc-card-role,body.home .mc-trainer-grid .trainer-card-role{font-size:.6rem}
  body.home .msid-home-course-card .sp-tc-card-actions{grid-template-columns:1fr;gap:5px}
  body.home .msid-home-course-card :is(.sp-btn-view,.sp-btn-wa),body.home .msid-home-school-grid .sp-btn-view{min-height:34px;padding:6px 7px;font-size:.62rem}
  body.home .mc-trainer-grid :is(.trainer-card-profile,.trainer-card-follow,.msid-follow-action){min-height:34px;padding:6px 7px;font-size:.62rem}
  body.home .msid-home-article p{display:none}
  body.home .msid-home-article-link{font-size:.62rem}
  body.home .msid-book-card-body{padding:10px}
  body.home .msid-book-card h3{font-size:.78rem;line-height:1.45}
  body.home .msid-book-card-foot{gap:6px;margin-top:10px}
  body.home .msid-book-add{padding:7px 8px;font-size:.62rem}

  /* Non-directory phone cards remain owned by the app shell layer. */
  body.post-type-archive-tk_book .msid-book-grid,
  body.tax-tk_book_category .msid-book-grid,
  .msid-journal-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
  }
  .msid-journal-card{
    display:flex;
    flex-direction:column;
    min-height:0;
    height:auto;
    aspect-ratio:auto;
    overflow:hidden;
    border-radius:16px;
  }
  .msid-journal-card .msid-journal-media{
    width:100%;
    height:auto;
    min-height:0;
    aspect-ratio:16/10;
    flex:0 0 auto;
  }
  .msid-journal-card .msid-journal-card-body{
    width:100%;
    min-width:0;
    height:auto;
    padding:9px;
    gap:5px;
  }
  .msid-journal-card h2{font-size:.78rem;line-height:1.42}
  .msid-journal-card p{display:none}
}

/* 761–767px bridge: legacy discovery bundles stop at 760px, so preserve the
 * previous compact archive fallback only in this seven-pixel transition band.
 * At <=760px, mobile-directory-results.css and trainer-cards.css are the sole
 * directory-card geometry owners. */
@media(min-width:761px) and (max-width:767px){
  body.post-type-archive-tk_course #results-grid,
  body.post-type-archive-tk_trainer #results-grid,
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) #results-grid,
  body.tax-tk_field #results-grid,
  body.page-template-page-private-lessons .sp-teachers-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
  }
  body.post-type-archive-tk_course .course-card-editorial,body.tax-tk_field .course-card-editorial,
  body.post-type-archive-tk_trainer .trainer-card-editorial,
  body.page-template-page-private-lessons .sp-school-ad-card{
    display:flex;
    flex-direction:column;
    min-height:0;
    height:auto;
    aspect-ratio:auto;
    overflow:hidden;
    border-radius:16px;
  }
  body.post-type-archive-tk_course .course-card-editorial .course-editorial-media,body.tax-tk_field .course-card-editorial .course-editorial-media,
  body.post-type-archive-tk_trainer .trainer-card-media,
  body.page-template-page-private-lessons .sp-school-ad-card .sp-tc-media{
    width:100%;
    height:auto;
    min-height:0;
    aspect-ratio:16/10;
    flex:0 0 auto;
  }
  body.post-type-archive-tk_course .course-card-editorial .course-editorial-body,body.tax-tk_field .course-card-editorial .course-editorial-body,
  body.post-type-archive-tk_trainer .trainer-card-body,
  body.page-template-page-private-lessons .sp-school-ad-card .sp-tc-card-body{
    width:100%;
    min-width:0;
    height:auto;
    padding:9px;
    gap:5px;
  }
  body.post-type-archive-tk_course .course-editorial-title,body.tax-tk_field .course-editorial-title,
  body.post-type-archive-tk_trainer .trainer-card-title,
  body.page-template-page-private-lessons .sp-tc-card-title{font-size:.78rem;line-height:1.42}
  body.post-type-archive-tk_course .course-editorial-institution,body.tax-tk_field .course-editorial-institution,
  body.post-type-archive-tk_course .course-editorial-facts,body.tax-tk_field .course-editorial-facts,
  body.post-type-archive-tk_trainer .trainer-card-bio,body.post-type-archive-tk_trainer .trainer-card-institution,
  body.page-template-page-private-lessons .sp-tc-card-facts{display:none}
  body.post-type-archive-tk_course .course-editorial-actions,body.tax-tk_field .course-editorial-actions{grid-template-columns:1fr;gap:5px}
  body.post-type-archive-tk_course .course-editorial-details,body.tax-tk_field .course-editorial-details{min-height:36px;padding:6px 8px;font-size:.62rem}
  body.post-type-archive-tk_course .course-editorial-secondary-actions,body.tax-tk_field .course-editorial-secondary-actions{display:grid;grid-template-columns:1fr 1fr;gap:4px}
  body.post-type-archive-tk_course .course-editorial-secondary-actions :is(.msid-user-action,.msid-compare-btn),body.tax-tk_field .course-editorial-secondary-actions :is(.msid-user-action,.msid-compare-btn){min-height:34px;padding:5px 4px;font-size:.56rem}
  body.post-type-archive-tk_trainer .trainer-card-footer{margin-top:4px;grid-template-columns:1fr;gap:5px}
  body.post-type-archive-tk_trainer :is(.trainer-card-profile,.trainer-card-follow,.msid-follow-action){width:100%;min-height:34px;padding:5px 6px;font-size:.58rem}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-card-modern{height:auto;padding:9px;gap:7px;border-radius:16px}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-card-head{align-items:flex-start;flex-direction:column;gap:7px}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) :is(.inst-logo-wrap,.inst-logo){width:58px;height:58px;flex:0 0 58px;border-radius:14px}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-name{font-size:.78rem;line-height:1.4}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-summary{display:none}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-card-actions{width:100%;grid-template-columns:1fr;gap:5px}
  body:is(.post-type-archive-tk_institution,.msid-institution-preset) .inst-card-actions :is(.msid-card-action,.inst-card-link){width:100%;min-height:34px;font-size:.58rem}
}
