/* B026 mobile + field-mode hardening. Same runtime, responsive/touch-only layer. */
:root{
  --b026-safe-top:env(safe-area-inset-top,0px);
  --b026-safe-right:env(safe-area-inset-right,0px);
  --b026-safe-bottom:env(safe-area-inset-bottom,0px);
  --b026-safe-left:env(safe-area-inset-left,0px);
  --b026-touch:44px;
}

html,body{min-height:100%;height:100dvh;overscroll-behavior:none}
body{padding:var(--b026-safe-top) var(--b026-safe-right) var(--b026-safe-bottom) var(--b026-safe-left)}
button,input,select{min-height:var(--b026-touch)}
#map{touch-action:none;overscroll-behavior:contain}
header,#inspector,dialog{overscroll-behavior:contain}
#field-mode{border:1px solid var(--oa-line);background:var(--oa-bg-2)}
#field-mode[aria-pressed=true]{background:#dbe2dd;color:#151719;border-color:#f1efe5}
#return-site{border:1px solid var(--oa-line);background:var(--oa-bg-2);padding:8px 12px;font-size:12px;min-height:var(--b026-touch);display:inline-flex;align-items:center}
#return-site[hidden]{display:none}
.field-boundary{font-size:11px;line-height:1.5;color:#c8b36b;border-top:1px solid var(--oa-line-soft);padding-top:12px;margin:14px 0 0}
.mobile-drawer-handle{display:none}
.keyboard-active .map-heading,.keyboard-active #legend,.keyboard-active #zone-readout{display:none}

body.field-mode{
  grid-template-rows:minmax(64px,auto) 1fr minmax(30px,auto);
}
body.field-mode header{
  background:#0e1111f2;
}
body.field-mode .map-heading,
body.field-mode #legend,
body.field-mode #zone-readout{
  display:none;
}
body.field-mode #inspector{
  box-shadow:0 -24px 60px #0008;
}

@media(max-width:700px){
  body{grid-template-rows:minmax(128px,auto) minmax(0,1fr) 0}
  header{
    padding:
      max(10px,var(--b026-safe-top))
      max(12px,var(--b026-safe-right))
      8px
      max(12px,var(--b026-safe-left));
    row-gap:7px;
  }
  header nav button,
  .modes button,
  #property-submit,
  #property-picker,
  #sources,
  #field-mode,
  #close-inspector,
  #unavailable-reset{
    min-height:var(--b026-touch);
  }
  .property-entry label,
  .property-entry select,
  .property-entry p{
    display:none;
  }
  .property-entry{
    grid-template-columns:minmax(0,1fr) auto;
  }
  .property-entry input{font-size:15px;min-height:38px}
  header nav{gap:6px}
  header nav button{padding:6px 4px}
  #sources{grid-column:3;grid-row:1;padding:6px 9px}
  #field-mode{grid-column:2;grid-row:1;padding:6px 10px}
  #return-site{grid-column:1/-1;grid-row:4;justify-content:center}
  .subject-link{top:calc(100% - 58px)}
  #inspector{
    height:clamp(150px,32dvh,250px);
    max-height:calc(100dvh - 112px - var(--b026-safe-top));
    padding:10px max(14px,var(--b026-safe-right)) max(16px,calc(12px + var(--b026-safe-bottom))) max(14px,var(--b026-safe-left));
    border-radius:8px 8px 0 0;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }
  .mobile-drawer-handle{
    display:block;
    width:44px;
    height:4px;
    border-radius:99px;
    background:#8f9993;
    opacity:.8;
    margin:0 auto 8px;
  }
  .modes{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:5px;
    padding-bottom:8px;
  }
  .modes button{
    padding:6px 2px;
    font-size:10px;
    line-height:1.1;
  }
  .mode-evidence dl>div,#inspector dl>div{align-items:flex-start}
  .mode-evidence dd,#inspector dd{max-width:55%;overflow-wrap:anywhere}
  .parcel-open .maplibregl-ctrl-bottom-right{bottom:calc(clamp(150px,32dvh,250px) + 12px + var(--b026-safe-bottom))}
  .maplibregl-ctrl-bottom-right{right:max(12px,var(--b026-safe-right));bottom:max(18px,calc(14px + var(--b026-safe-bottom)))}
  .maplibregl-ctrl-group button{width:44px;height:44px}
  footer{display:none;padding:0 max(12px,var(--b026-safe-right)) 0 max(12px,var(--b026-safe-left))}
  dialog{max-height:calc(100dvh - 24px - var(--b026-safe-top) - var(--b026-safe-bottom))}

  body.field-mode{grid-template-rows:minmax(108px,auto) minmax(0,1fr) 0}
  body.field-mode header{
    grid-template-rows:auto auto;
    padding-bottom:6px;
  }
  body.field-mode .property-entry{
    grid-template-columns:1fr auto;
  }
  body.field-mode .property-entry select,
  body.field-mode .property-entry p,
  body.field-mode header nav{
    display:none;
  }
  body.field-mode footer{display:none}
  body.field-mode #inspector{
    height:min(42dvh,340px);
    max-height:42dvh;
  }
  body.field-mode.parcel-open .maplibregl-ctrl-bottom-right{bottom:calc(min(42dvh,340px) + 12px + var(--b026-safe-bottom))}
}

@media(max-width:900px) and (max-height:480px) and (orientation:landscape){
  body{grid-template-rows:minmax(76px,auto) minmax(0,1fr) minmax(28px,auto)}
  header{
    grid-template-columns:auto minmax(220px,1fr) auto auto;
    grid-template-rows:auto;
    column-gap:8px;
  }
  .brand{font-size:18px}
  .property-entry{grid-column:2;grid-row:1;grid-template-columns:1fr auto;align-self:center}
  .property-entry label,.property-entry select,.property-entry p{display:none}
  header nav{grid-column:1/-1;grid-row:2;display:flex}
  #field-mode{grid-column:3;grid-row:1}
  #sources{grid-column:4;grid-row:1}
  #inspector{
    left:0;
    top:auto;
    right:0;
    bottom:0;
    width:100%;
    height:clamp(132px,34dvh,168px);
    max-height:calc(100dvh - 118px - var(--b026-safe-top));
    border-radius:8px 8px 0 0;
    border-top:1px solid var(--oa-line-soft);
    border-left:0;
  }
  .parcel-open .maplibregl-ctrl-bottom-right,
  body.field-mode.parcel-open .maplibregl-ctrl-bottom-right{
    right:max(12px,var(--b026-safe-right));
    bottom:calc(clamp(132px,34dvh,168px) + 12px + var(--b026-safe-bottom));
  }
  body.field-mode{grid-template-rows:minmax(64px,auto) minmax(0,1fr) 0}
}
