/* Denté — mobile layer. Loaded on every page; only acts below 820px. */
@media (max-width: 820px) {
  html, body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
  img, video, iframe { max-width: 100%; }
  h1, h2, h3 { overflow-wrap: break-word; }

  /* Header: logo + search on row one, pill links on row two */
  nav[style*="sticky"] { position: relative !important; display: flex !important; flex-wrap: wrap !important; align-items: center !important; height: auto !important; padding: 10px 16px 12px !important; gap: 8px 6px !important; align-content: flex-start !important; }
  nav[style*="sticky"] > div { display: contents !important; }
  nav[style*="sticky"]::before { content: ''; order: 3; flex-basis: 100%; height: 0; }
  nav[style*="sticky"] > :nth-child(2) { order: 1; flex: 1 1 auto; }
  nav[style*="sticky"] button { order: 2; min-width: 0 !important; padding: 8px 14px !important; }
  nav[style*="sticky"] .dente-navpill, nav[style*="sticky"] a[href*="substack"] { order: 4; display: inline-block !important; padding: 6px 8px !important; font-size: 9px !important; letter-spacing: .04em !important; }
  nav[style*="sticky"] a[href*="substack"] { font-size: 0 !important; }
  nav[style*="sticky"] a[href*="substack"]::after { content: 'Subscribe'; font-size: 9px; letter-spacing: .04em; }
  nav[style*="sticky"] button svg + * { display: none; }

  /* Layout: stack every multi-column inline grid */
  [style*="grid-template-columns"]:not(nav):not([style*="auto-fill"]):not([style*="auto-fit"]):not([style*="1fr 1fr"]):not([style*="repeat(2"]) { grid-template-columns: 1fr !important; gap: 28px !important; }
  [style*="1fr 1fr"][style*="gap: 80px"], [style*="1fr 1fr"][style*="gap: 64px"], [style*="1fr 1fr"][style*="gap: 56px"], [style*="1fr 1fr"][style*="gap: 48px"], [style*="1fr 1fr"][style*="gap: 40px"] { grid-template-columns: 1fr !important; gap: 32px !important; }
  [style*="padding: 60px 80px"], [style*="padding: 80px 80px"], [style*="padding: 100px 80px"] { padding: 40px 20px 64px !important; }
  [style*="position: sticky"]:not(nav) { position: static !important; }
  [style*="padding-top: 8px"][style*="align-items: center"][style*="flex-direction: column"] { flex-direction: row !important; justify-content: flex-start !important; padding-top: 0 !important; }

  /* Gutters: 40px -> 20px on page containers */
  div[style*="max-width"][style*="padding"], section[style*="padding"], header[style*="padding"], footer[style*="padding"] { padding-left: 20px !important; padding-right: 20px !important; }
  [style*="padding: 64px 40px 100px"], [style*="padding: 60px 40px 100px"], [style*="padding: 56px 40px 100px"], [style*="padding: 48px 40px 100px"] { padding-top: 36px !important; padding-bottom: 64px !important; }
  [style*="padding: 0px 40px"], [style*="padding: 0 40px"] { padding-left: 20px !important; padding-right: 20px !important; }
  [style*="gap: 56px"], [style*="gap: 48px"] { gap: 28px !important; }
  [style*="position: absolute"][style*="bottom: 0"][style*="padding: 0px 40px"], [style*="position: absolute"][style*="bottom: 0"][style*="padding: 0 40px"] { padding: 0 20px 32px !important; }

  /* Reading comfort */
  p { overflow-wrap: break-word; }
  a, button { -webkit-tap-highlight-color: transparent; }
  button, [role="button"] { min-height: 40px; }

  /* Forms */
  input, select, textarea { font-size: 16px !important; max-width: 100%; }

  /* Fixed-width cards that overflow */
  [style*="width: 460px"], [style*="width: 600px"], [style*="max-width: 600px"], [style*="max-width: 460px"] { max-width: 100% !important; }
}
@media (max-width: 480px) {
  [style*="font-size: 17px"] { font-size: 16px !important; }
  [style*="repeat(auto-fill, minmax(270px"], [style*="repeat(auto-fill, minmax(240px"] { grid-template-columns: 1fr !important; }
}
