/* Aevy mobile overflow guard. Loaded last, so it wins over the other sheets.
   Nothing here changes the desktop layout; it only stops phone-width pages from scrolling sideways. */

/* browsers without overflow:clip would otherwise let the page pan sideways */
@supports not (overflow: clip) {
  html, body { overflow-x: hidden; }
}
html, body { max-width: 100%; overscroll-behavior-x: none; }
body { overflow-wrap: break-word; }

/* Developer controls use a compact disclosure menu instead of a loose row of buttons. */
.pp-devtools { width: min(100%, 620px); padding: 0; overflow: hidden; border-color: color-mix(in srgb, var(--accent-hi) 24%, var(--line2)); box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 5%, transparent); }
.devtools { margin: 0; gap: 0; }
.devtools > summary { display: flex; align-items: center; gap: 11px; min-height: 58px; padding: 10px 14px; cursor: pointer; list-style: none; user-select: none; }
.devtools > summary::-webkit-details-marker { display: none; }
.devtools-mark { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; color: var(--accent-text); background: var(--accent-soft); font-size: 14px; }
.devtools > summary > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.devtools > summary strong { font-size: 14px; }
.devtools > summary small { color: var(--muted); font-size: 12px; }
.devtools-chevron { margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .18s ease; }
.devtools[open] .devtools-chevron { transform: rotate(180deg); }
.devtools-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 10px; padding: 0 14px 14px; }
.devtools-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); }
.devtools-group h4 { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.devtools-group .row { display: flex; flex-wrap: wrap; gap: 7px; }
.devtools-group .btn { min-height: 36px; }
.devtools-danger { border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }
@media (max-width: 760px) {
  .pp-devtools { margin: 0 12px 14px; width: auto; }
  .devtools > summary { min-height: 54px; padding: 9px 11px; }
  .devtools-menu { grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px; gap: 8px; }
  .devtools-group { padding: 10px; }
  .devtools-group .btn { flex: 1 1 130px; justify-content: center; }
}

/* grids that refused to shrink below a fixed column width: never wider than their container */
#view-scripts #cards { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.gw-grid { grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.cs-side { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }

/* media can never be wider than the column it sits in */
img, video, canvas, iframe, embed, object { max-width: 100%; }
img, video, canvas { height: auto; }

@media (max-width: 760px) {
  /* flex and grid children default to min-width:auto, so one long word or wide child stretches the page */
  .wrap, .wrap > *, .post, .card, .ax-in > *, .home-social > *, .dev-hero > *,
  #homeRoot > *, [class*="-grid"] > *, [class*="-row"] > *, [class*="-main"], [class*="-body"], [class*="-text"] { min-width: 0; }

  /* long names, links, emails and filenames wrap instead of pushing the layout */
  h1, h2, h3, h4, p, li, a, label, small, .post, .card, .mx-p, .mx-h { overflow-wrap: anywhere; }

  /* code and data scroll inside their own box */
  pre { max-width: 100%; overflow-x: auto; }
  table { display: block; max-width: 100%; overflow-x: auto; }

  /* floating cards and the check-your-email screen stay inside the screen */
  .mx-back { overflow: hidden; padding: 14px; }
  .mx-card { max-width: 100%; padding-inline: 20px; }
  .dx { max-width: calc(100vw - 24px); }
  .mp, #mtoasts, .pwa-card { max-width: calc(100vw - 24px); }
  .ax-float { max-width: calc(100% - 8px); }
  .ax-stage, .ax-win, .ax-hero { max-width: 100%; }

  /* Profile: keep action labels from colliding with the identity and each other. */
  .pp-card .pp-head.ig-head { grid-template-columns: 72px minmax(0, 1fr); gap: 0 12px; padding: 16px 12px 14px; }
  .pp-card .ig-ring .avatar { width: 64px !important; height: 64px !important; font-size: 28px !important; }
  .pp-card .pf-main { grid-column: 2; width: 100%; }
  .pp-card .pf-row { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
  .pp-card .pp-id, .pp-card .pp-id h1, .pp-card .pf-un { min-width: 0; max-width: 100%; }
  .pp-card .pp-id h1 { font-size: 1.25rem; font-weight: 650; line-height: 1.2; }
  .pp-card .pf-un { font-size: 14px; }
  .pp-card .pf-un { flex-wrap: wrap; gap: 4px 6px; }
  .pp-card .badges.big { gap: 4px; margin-left: 3px; }
  .pp-card .badges.big .vbadge { font-size: 21px; }
  .pp-card .badges.big .rbadge { font-size: 10.5px; letter-spacing: .035em; padding: 3px 7px; top: 0; }
  .pp-card .pf-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 7px; }
  .pp-card .pf-acts .btn { display: inline-flex; min-width: 0; min-height: 38px; padding: 7px 8px; justify-content: center; white-space: normal; text-align: center; line-height: 1.2; font-size: 12.5px; }
  .pp-card .pf-acts .btn svg { flex: none; margin-right: 4px; }
  .pp-card .pf-stats { grid-column: 1 / -1; display: flex; justify-content: space-around; gap: 8px; width: 100%; margin: 14px 0 0; }
  .pp-card .pf-stats li { min-width: max-content; flex: 0 1 auto; flex-direction: row; align-items: baseline; gap: 4px; text-align: left; white-space: nowrap; }
  .pp-card .pf-stats b { flex: none; font-size: 1rem; white-space: nowrap; overflow-wrap: normal; }
  .pp-card .pf-stats span { flex: none; font-size: 12px; white-space: nowrap; overflow-wrap: normal; }
  .pp-card .ig-bio { grid-column: 1 / -1; min-width: 0; margin-top: 12px; }
  .pp-card .ig-tabs { overflow-x: auto; justify-content: space-around; gap: 0; }
  .pp-card .ig-tabs button { flex: 0 0 auto; padding-inline: 12px; }

  /* Chat: clearer grouping, softer surfaces, and a compact modern composer. */
  .cw-head { min-height: 58px; padding: 8px 10px 8px 4px; gap: 6px; background: var(--surface); border-bottom-color: var(--line2); }
  .cw-who { flex: 1; min-width: 0; }
  .cw-t, .cw-t b { min-width: 0; max-width: 100%; }
  .cw-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cw-body { gap: 3px; padding: 14px 14px 10px; background: var(--bg); }
  .cw-day { margin: 14px 0 12px; }
  .cw-day span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 11px; }
  .cb { max-width: min(82%, 420px); margin: 2px 0; }
  .cb-in { padding: 10px 14px; border-radius: 20px; font-size: 15px; line-height: 1.45; box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 8%, transparent); }
  .cb.me .cb-in { background: var(--accent); color: var(--accent-ink); }
  .cb.them .cb-in { background: var(--surface2); color: var(--text); }
  .cw-compose { padding: 9px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
  .cw-input { min-height: 46px; border-color: var(--line2); background: var(--surface2); border-radius: 24px; padding-top: 12px; padding-bottom: 12px; }
  .cw-input:focus { background: var(--surface); border-color: var(--accent-hi); }
  .cw-send { bottom: calc(15px + env(safe-area-inset-bottom, 0px)); }
}
