/* Modiv's Education - phone layout. Linked LAST on every page so it can
   refine the page's own styles. Desktop is untouched: everything below sits
   inside max-width media queries (except the two safety rules at the top). */

html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
img,video,canvas,iframe{max-width:100%}
@supports (overflow:clip){html,body{overflow-x:clip}}
@supports not (overflow:clip){html{overflow-x:hidden}}

header.mv-header nav li.mv-extra{display:none}

/* ---------- Tablets and phones (<= 960px) : dashboards ---------- */
@media(max-width:960px){
  /* Sidebar becomes a compact profile card + a swipeable tab strip */
  .app{grid-template-columns:minmax(0,1fr);padding:12px 14px 96px;gap:14px}
  .app>.side,.app>main{min-width:0}
  .app>.side{position:static;max-height:none;overflow:visible;padding:10px;border-radius:18px}
  .app>.side .pf{display:grid;grid-template-columns:56px 1fr;column-gap:12px;align-items:center;text-align:left;padding:12px 14px}
  .app>.side .pf .ava{width:56px;height:56px;font-size:1.25rem;margin:0;grid-row:1 / span 3;border-width:2px}
  .app>.side .pf h2{font-size:1.05rem;grid-column:2}
  .app>.side .pf .hl{grid-column:2;margin:0}
  .app>.side .pf .ver,.app>.side .pf .vp{grid-column:2;justify-self:start;margin-top:4px}
  .app>.side .pf .mini,.app>.side .pf .b{grid-column:1 / -1}
  .app>.side .pf .b{margin-top:10px}
  .app>.side .nav{display:flex;gap:6px;margin:10px -2px 0;padding:2px 2px 6px;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .app>.side .nav::-webkit-scrollbar{display:none}
  .app>.side .nav button{flex:0 0 auto;width:auto;white-space:nowrap;padding:10px 14px;border-radius:12px;scroll-snap-align:start}
  .app>.side .nav button.out{margin:0;border-top:0;border-radius:12px;padding-top:10px}
  .app main h1{font-size:1.5rem}
  .coinbar{padding:14px 16px}
  .coinbar .r{flex-wrap:wrap;width:100%}
  .coinbar .r .b{flex:1 1 140px;text-align:center}
}

/* ---------- Phones (<= 768px) ---------- */
@media(max-width:768px){
  body{overflow-wrap:break-word}

  /* Forms: 16px stops iPhones zooming in when a field is tapped */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),select,textarea{font-size:16px!important}
  input[type=search]{min-width:0!important;max-width:100%}
  .b,.btn,.tab{min-height:42px}

  /* Filter rows (Tutors, Active Leads): search on top, dropdowns two-up */
  .tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .tools>input[type=search]{grid-column:1 / -1;min-width:0}
  .tools>select{width:100%;min-width:0}

  /* Popups fit the screen and scroll inside themselves */
  dialog{max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px);overflow:auto}
  dialog form,dialog .dbody{max-width:100%}
  .mvw-card{padding:30px 20px 22px}

  /* Wide tables scroll sideways inside their own box, not the whole page */
  .tablewrap,.tbl-wrap,.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Cards and content blocks */
  .box{padding:16px}
  .head{align-items:flex-start}
  .tools select{flex:1 1 calc(50% - 6px);min-width:0;width:auto;max-width:100%}
  .tools input[type=search]{flex:1 1 100%}
  .head .tools{display:flex;width:100%}
  .head .tools input[type=search]{flex:1 1 100%}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .packs{gap:10px}
  .row{flex-wrap:wrap}
  .set{gap:12px}
  .toast{max-width:calc(100vw - 32px)}

  /* Shared header */
  header.mv-header .mv-wrap{padding:0 14px}
  header.mv-header .mv-bar{gap:8px}
  header.mv-header .mv-brand{min-width:0;flex:0 1 auto}
  header.mv-header .mv-brand img{height:48px;max-width:100%}
  header.mv-header .acts{min-width:0;flex-shrink:1;gap:6px}
  header.mv-header .acts .mv-moved{display:none!important}
  header.mv-header .adm-pill{display:none}
  header.mv-header .cartbtn span:not(.n){display:none}
  header.mv-header nav{max-height:calc(100dvh - 72px);overflow-y:auto}
  header.mv-header nav a{padding:12px 14px;font-size:1rem}
  header.mv-header nav li.mv-extra{display:list-item}
  header.mv-header nav li.mv-extra:first-of-type,
  header.mv-header nav li.mv-extra-first{margin-top:6px;padding-top:10px;border-top:1px solid var(--mv-line)}
  header.mv-header nav li.mv-extra a{background:var(--mv-navy);color:var(--mv-cream);text-align:center}
  header.mv-header nav li.mv-extra a:hover{background:#2a3350}
}

/* ---------- Small phones (<= 480px) ---------- */
@media(max-width:340px){.stats{grid-template-columns:minmax(0,1fr)}}
@media(max-width:480px){
  header.mv-header .mv-brand img{height:42px}
  header.mv-header .acts .btn{padding:7px 11px;font-size:.8rem}
  header.mv-header .burger{padding:7px 11px;font-size:.85rem}
  .app{padding-left:10px;padding-right:10px}
  .box{padding:14px;border-radius:14px}
  .ask{padding:10px 16px;right:12px}
}

/* ---------- Page-specific phone fixes ---------- */
@media(max-width:768px){
  /* Shop filter bar: not sticky on phones (it was taking ~40% of the screen),
     search and sort full width, class/subject side by side */
  .tools:has(>.row){display:block;position:static;padding:12px 0}
  .tools>.row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .tools>.row>.seg,.tools>.row>input[type=search],.tools>.row>select#sort{grid-column:1 / -1}
  .tools>.row>.seg{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .tools>.row>.seg::-webkit-scrollbar{display:none}
  .tools>.row>.seg>button{flex:0 0 auto;white-space:nowrap}
  .tools>.row>.sp{display:none}
  .tools>.row>input[type=search],.tools>.row>select{width:100%;max-width:none;min-width:0}
}
@media(max-width:480px){
  /* Home page "Send us a message" card: stack the two buttons with a gap */
  .cbox>a.btn{display:flex;justify-content:center;width:100%}
  .cbox>a.btn+a.btn{margin-top:10px}
}
@media(max-width:480px){
  /* Card grids with a 250-340px minimum column overflowed narrow phones (320-360px) */
  .bgrid,.tgrid,.lgrid,.revs,.why,.cgrid,.layout,.grid:not(#aSubs){grid-template-columns:minmax(0,1fr)}
  /* Long emails/URLs must wrap instead of widening the column */
  .doc,.cbox,.state,.bempty,.layout>*{overflow-wrap:anywhere;min-width:0}
}
@media(max-width:360px){.cbox{padding:22px 16px}}

/* ---------- Phone polish (v2) ---------- */
/* Home page city strip: the city names are links now */
.qb-stat span a{color:inherit;text-decoration:none;display:inline-block;padding:4px 2px}
.qb-stat span a:hover{text-decoration:underline}

@media(max-width:1024px){
  /* In-page links (#faq, #pricing, ...) must not hide under the sticky header */
  html{scroll-padding-top:84px}
}
@media(max-width:768px){
  /* Same side gutters everywhere; stay clear of notches in landscape */
  .wrap,header.mv-header .mv-wrap{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  h1,h2,h3{overflow-wrap:break-word}
  /* Tables that are not already in a scroll box scroll sideways instead of widening the page */
  main table:not(.keep){display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  /* Easier taps in footer + inline chip lists */
  footer .fv-list a,footer .fv-cities a{min-height:40px;display:inline-flex;align-items:center}
  .chips a,.sm-chips a,.list-inline a{min-height:36px}
  pre,code{white-space:pre-wrap;overflow-wrap:anywhere}
}
@media(max-width:480px){
  .wrap,header.mv-header .mv-wrap{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
  /* Primary calls to action fill the width on small phones */
  .hero .btn,.hero .b{min-height:46px}
}
@media(max-width:360px){
  header.mv-header .mv-brand img{height:38px}
  header.mv-header .acts .btn{padding:6px 9px;font-size:.76rem}
  h1{font-size:clamp(1.6rem,8vw,2rem)}
}

/* ---------- Phone polish (v3): bigger tap targets, small-phone safety ---------- */
@media(max-width:768px){
  /* Header menu button */
  header.mv-header .burger{min-height:44px;min-width:44px}
  /* Footer: legal links, social icons, app badges */
  footer.mv-foot.v2 .fv-legal a{padding:11px 0}
  footer.mv-foot.v2 .fv-soc{gap:12px}
  footer.mv-foot.v2 .fv-soc a{width:42px;height:42px}
  footer.mv-foot.v2 .fv-soc a svg{width:20px;height:20px}
  footer.mv-foot.v2 .fv-badge{min-height:44px}
  footer.mv-foot.v2 .fv-bottom{flex-direction:column;align-items:flex-start}
  footer.mv-foot.v2 .fv-legal{display:grid;grid-template-columns:1fr 1fr;gap:0 16px;width:100%}
  footer.mv-foot.v2 .fv-legal a+a::before{display:none!important}
  /* Breadcrumbs, "we also have tutors in..." link rows and filter chips */
  .crumbs a,.crumb a,nav[aria-label=Breadcrumb] a,.more a,p.more a{display:inline-block;padding:6px 2px}
  .ls-mode,.tl-seg button,.tl-clear{min-height:40px}
  .pills button{min-height:40px}
  /* Contact page: phone / email / social links */
  .cbox a[href^="tel:"],.cbox a[href^="mailto:"]{display:inline-block;padding:8px 0}
}
@media(max-width:380px){
  /* Decorative sparkle next to headings can poke past the edge on the smallest phones */
  .ht-spark{display:none}
  footer.mv-foot.v2{padding-left:16px;padding-right:16px}
  footer.mv-foot.v2 .fv-col{padding-left:0;padding-right:0}
}
@media(max-width:480px){
  /* Don't let any media or embed push the page wider than the screen */
  figure,picture,video,iframe,embed,object{max-width:100%}
  .tgrid .tc{min-width:0}
}
