/* DRAFT mobile-fit: iPhone and iPad layout only. Navy + #a6dfc1. No redesign. */
html { overflow-x: clip; max-width: 100%; }
body { overflow-x: clip; max-width: 100%; }
body.ws {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Grid/flex items default to min-width: auto and can blow out the page (hero, cards, rows). */
.ws-main, .ws-home, .ws-home-hero, .ws-home-copy, .ws-home-tiles, .ws-home-tile,
.ws-grid, .ws-grid > *, .ws-card, .ws-list, .ws-row, .ws-actions, .cx-page, .cx-band,
.cx-dash, .cx-dash-main, .cx-rail, .cx-toolbar, .cx-searchwrap, .fm-stage, .fm-play,
.pub-top, .pub-top-grid, .hero-inner, .wrap, .site-inner {
  min-width: 0;
  max-width: 100%;
}

.ws-top {
  width: 100%;
  max-width: 100%;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}
.ws-main {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: max(120px, calc(88px + env(safe-area-inset-bottom, 0px)));
}
@media (min-width: 960px) {
  .ws-main {
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: max(120px, calc(88px + env(safe-area-inset-bottom, 0px)));
  }
}

.ws-home-hero, .ws-hero, .cx-band, .pub-top { overflow: hidden; }
.ws-home-hero h2, .ws-hero h2, .ws-hero p, .cx-band-title, .cx-band p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Assessment / account rows: the name wraps beside the owner-test chip instead of widening the page. */
.ws-row { flex-wrap: wrap; align-items: center; }
.ws-row .ws-row-main b { overflow-wrap: anywhere; white-space: normal; }
.ws-testtag { max-width: 100%; flex: 0 1 auto; }

/* Closed drawer is off-screen; don't let it widen the document (iOS Safari). */
.ws-nav { max-width: 86vw; }
.wl { max-width: 100%; width: min(380px, 100%); }

.wl-toggle {
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

/* Phone: full-width stacked actions, space above the WALTER pill, smaller pill. */
@media (max-width: 639px) {
  .ws-home-hero { padding: 16px 16px 16px; gap: 12px; }
  .ws-home-hero p, .ws-hero p { margin-bottom: 12px; }
  .ws-home-hero .ws-hero-link { margin-top: 8px; }
  .ws-home-steps { gap: 6px; }
  .ws-home-steps li { padding: 10px 12px; }
  .ws-home-hero .ws-actions, .ws-hero .ws-actions { flex-direction: column; align-items: stretch; }
  .ws-home-hero .ws-actions .ws-btn, .ws-hero .ws-actions .ws-btn { width: 100%; }
  .ws-submitbar { flex-wrap: wrap; }
  .ws-submitbar .ws-btn { white-space: normal; }
  .cx-searchwrap { min-width: 0; }
  .wl-toggle { padding: 6px 11px 6px 6px; font-size: 13px; gap: 6px; }
  .wl-toggle .wl-mark { width: 26px; height: 26px; font-size: 12px; }
}

/* Tablet (iPad portrait 768/820): directory keeps a left rail; buttons can sit in a row if they fit. */
@container cx (min-width: 720px) {
  .cx-dash { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (min-width: 720px) and (max-width: 959px) {
  .ws-main { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
}

/* Public pages */
.pub-top { overflow: hidden; }
.actions { flex-wrap: wrap; }
@media (max-width: 639px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; text-align: center; }
  .pub-top-grid { grid-template-columns: minmax(0, 1fr); }
}
