/* Deb8er Diplomat — DiplomatMobile shell.
   The dedicated committee surface for phones. Everything here is scoped under
   .dpm (the mobile frame) except the page-level rules in the media query at the
   bottom, which switch the desktop chamber off while the shell is mounted.
   The desktop chamber (>900px) is untouched by this file. */

.dpm {
  --dpm-nav-h: 62px;
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 16% -6%, rgba(166, 138, 249, 0.2), transparent 62%),
    radial-gradient(760px 420px at 94% 2%, rgba(58, 190, 255, 0.12), transparent 60%),
    #080b12;
  color: var(--dp-text, #E5E7EB);
  font-family: inherit;
}

/* ── header ── */
.dpm__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
}
.dpm__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dpm__crest {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--dp-grad, linear-gradient(135deg, #a68af9, #3ABEFF));
  color: #0b0f19;
  font-family: var(--heading-font, "Unbounded", sans-serif);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.dpm__brandname {
  display: block;
  font-family: var(--heading-font, "Unbounded", sans-serif);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dp-text, #E5E7EB);
}
.dpm__brandsub { min-height: 14px; max-width: 200px; }
.dpm__brandsub .dp-kicker { margin: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpm__headstatus { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.dpm__headstatus .dp-btn--sm { min-height: 38px; }

/* ── phase bar + order paper ── */
.dpm__phase { flex: 0 0 auto; padding: 2px 16px 0; }
.dpm__phase .dp-phasebar { padding: 9px 12px; gap: 10px; }

.dpm__strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 10px 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.dpm__strip::-webkit-scrollbar { display: none; }
.dpm__strip li { flex: 0 0 auto; display: flex; align-items: center; }
.dpm__strip li + li::before {
  content: "";
  width: 16px;
  height: 1px;
  margin: 0 5px;
  background: var(--dp-line, rgba(255,255,255,.09));
}
.dpm__strip b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--dp-line, rgba(255,255,255,.09));
  background: var(--dp-panel, rgba(255,255,255,.035));
  color: var(--dp-muted, #97a0af);
  font-family: var(--heading-font, "Unbounded", sans-serif);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.dpm__strip li[data-state="done"] b { color: var(--dp-green, #34D399); border-color: rgba(52, 211, 153, .35); }
.dpm__strip li[data-state="now"] b {
  border: 0;
  background: var(--dp-grad, linear-gradient(135deg, #a68af9, #3ABEFF));
  color: #0b0f19;
  box-shadow: 0 0 0 4px rgba(166, 138, 249, .16);
}
.dpm__strip span { display: none; }
.dpm__strip li[data-state="now"] span {
  display: inline;
  margin-left: 8px;
  white-space: nowrap;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dp-violet, #a68af9);
}

/* ── views ── */
.dpm__views { flex: 1 1 auto; min-height: 0; display: grid; }
.dpm__view {
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 14px calc(14px + env(safe-area-inset-bottom));
}
.dpm__view.is-active { display: block; }

/* ── arena: the room in one column ── */
.dpm .dp-room {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 8px;
  overflow: visible;
}
.dpm .dp-room::after { display: none; }
.dpm .dp-room > .dp-blocroom,
.dpm .dp-room > .dp-drafting,
.dpm .dp-room > .dp-speeches,
.dpm .dp-room > .dp-voting {
  overflow: visible;
  min-height: 0;
}

.dpm .dp-chaircard { padding: 10px 12px; }
.dpm .dp-chaircard__line { -webkit-line-clamp: 3; }

.dpm .dp-podium { padding: 4px 6px 0; gap: 7px; }
.dpm .dp-podium__portrait { width: 84px; height: 84px; }
.dpm .dp-podium__speech { font-size: .92rem; }

/* the delegation rail: the horseshoe re-forms as a horizontal strip of coins */
.dpm .dp-horseshoe {
  justify-content: flex-start;
  gap: 4px;
  padding: 4px 2px 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.dpm .dp-horseshoe::-webkit-scrollbar { display: none; }
.dpm .dp-horseshoe .dp-seat {
  flex: 0 0 74px;
  transform: none;
  transition: none;
}
.dpm .dp-horseshoe .dp-seat__portrait { width: 52px; height: 52px; }
.dpm .dp-horseshoe .dp-seat--speaking .dp-seat__portrait {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .4), 0 0 20px rgba(251, 191, 36, .3);
}

/* A dimmed composer is one the delegate cannot type in — the live control is
   the flow above it. Hiding it keeps the Arena to one job at a time. Scoped to
   the live caucus so a stale dim class can never swallow another phase. */
.dpm__view[data-view="arena"]:has(#dpPaneCaucus:not([hidden])) .dp-compose.dp-panel--dim { display: none; }

/* Sticky offsets are measured against the scrollport's padding box: the view's
   bottom padding would leave a window under the pinned bar, showing the content
   scrolling behind it. The Arena lets the bar sit flush; its own padding
   carries the safe area. */
.dpm__view[data-view="arena"] { padding-bottom: 0; }

/* ── More: the record is worth marking before it is worth reading, so the
   evaluation sits above the live transcript when it is live ── */
.dpm__view[data-view="more"] #dpmSlotEval:has(#dpEvalPanel:not([hidden])) { margin-bottom: 12px; }
#dpmSlotLog { margin-bottom: 12px; }

/* ── the action bar pins to the bottom of the Arena; the composer scrolls
   with the room, and the keyboard lifts everything with it ── */#dpmSlotFoot { position: sticky; bottom: 0; z-index: 2; margin: 0 -14px; padding: 0 14px; }
#dpmSlotFoot .dp-stagefoot {
  margin: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--dp-line, rgba(255,255,255,.09));
  background: rgba(10, 14, 24, .96);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .38);
}

/* ── the caucus flow stays on the podium: motions, the motion vote, points of
   information and their suggestions sit between the room and the composer, so
   answering never leaves the Arena. The phase bar already names the phase and
   the room already carries Debix, so the pane's duplicate heading and chair
   head are dropped to keep the floor quiet. ── */
#dpmSlotCaucus { margin: 6px 0 2px; }
#dpmSlotCaucus .dp-pane[data-pane="caucus"] > .dp-block__title { display: none; }
#dpmSlotCaucus .dp-caucushead { margin: 0 0 8px; scroll-margin-top: 6px; }
#dpmSlotCaucus .dp-debix { display: none; }
#dpmSlotCaucus .dp-poiinbox { margin-top: 8px; }
#dpmSlotCaucus .dp-poihints { margin-top: 8px; }
#dpmSlotCaucus .dp-motions { margin-top: 2px; }

.dpm .dp-btn { min-height: 44px; }
.dpm .dp-btn--sm { min-height: 44px; }

/* ── workspaces, panes and panels flow with the view ── */
.dpm .dp-clauselist { max-height: 200px; overflow-y: auto; }
.dpm .dp-pane, .dpm .dp-panes { max-height: none; overflow: visible; }
.dpm .dp-transcript { max-height: none; }
.dpm textarea, .dpm input, .dpm select { font-size: 1rem; }
.dpm .dp-votemodal__docs { grid-template-columns: 1fr; }

/* ── bottom navigation ── */
.dpm__nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: rgba(9, 12, 21, .94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--dp-line, rgba(255,255,255,.09));
}
.dpm__nav button {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--dp-muted, #97a0af);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.dpm__nav button svg { width: 21px; height: 21px; }
.dpm__nav button[aria-current="page"] { color: var(--dp-violet, #a68af9); }
.dpm__nav button[aria-current="page"] svg { filter: drop-shadow(0 0 7px rgba(166, 138, 249, .65)); }

/* ── the delegate sheet ── */
.dpm__sheet { position: absolute; inset: 0; z-index: 10; display: grid; align-content: end; }
.dpm__sheetback { position: absolute; inset: 0; background: rgba(3, 5, 10, .72); backdrop-filter: blur(3px); }
.dpm__sheetpanel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin: 0 10px calc(10px + env(safe-area-inset-bottom));
  padding: 22px 18px 18px;
  border-radius: 18px;
  border: 1px solid var(--dp-line-strong, rgba(255,255,255,.16));
  background: #0d1322;
  text-align: center;
  animation: dpm-sheet-in .22s ease;
}
@keyframes dpm-sheet-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.dpm__sheetclose {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--dp-line, rgba(255,255,255,.09));
  border-radius: 50%;
  background: var(--dp-panel, rgba(255,255,255,.035));
  color: var(--dp-muted, #97a0af);
  font-size: 1.15rem;
  line-height: 1;
}
.dpm__sheetportrait { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(255,255,255,.2); }
.dpm__sheetportrait svg { display: block; width: 100%; height: 100%; }
.dpm__sheetflag { min-height: 20px; }
.dpm__sheetflag img { border-radius: 3px; }
.dpm__sheetname { font-family: var(--heading-font, "Unbounded", sans-serif); font-size: .82rem; font-weight: 700; }
.dpm__sheetrole { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dp-violet, #a68af9); }
.dpm__sheetnote { margin: 6px 0 0; font-size: .74rem; line-height: 1.5; color: var(--dp-muted, #97a0af); }

.dpm :focus-visible { outline: 2px solid var(--dp-blue, #3ABEFF); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .dpm *, .dpm__sheetpanel { animation: none !important; transition: none !important; }
}

/* ── page-level switches (mobile widths only) ── */
@media (max-width: 900px) {
  /* While the shell is mounted, the desktop chamber furniture stands down. */
  .dp-shell[data-mobile="on"] > .dp-topbar,
  .dp-shell[data-mobile="on"] > .dp-chamber,
  .dp-shell[data-mobile="on"] > .dp-shell__note { display: none; }

  /* The site navbar is position:fixed at z-index 1000 — the app frame, the
     record drawer and the toast all live below it. The shell has its own
     header and its own Leave, so the navbar stands down with the rest. */
  body[data-viewport="mobile"] .navbar { display: none; }

  /* The site's fadeIn fills forwards with a transform, which makes <main> the
     containing block for position:fixed overlays forever after — the drawer
     and the vote sheet would anchor to the document instead of the screen. */
  .dp-page:has(.dp-shell:not([hidden])) main { animation: none; }

  /* Overlays become bottom sheets. */
  .dp-drawer { place-items: end center; padding: 0; }
  .dp-drawer__panel {
    width: 100%;
    max-height: 76dvh;
    border-radius: 18px 18px 0 0;
    animation: dpm-sheet-in .22s ease;
  }
  .dp-votemodal {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .dp-votemodal__panel {
    margin: auto auto 0;
    width: 100%;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--dp-line-strong, rgba(255,255,255,.16));
    animation: dpm-sheet-in .22s ease;
  }

  /* The toast clears the bottom navigation. */
  body[data-viewport="mobile"] .dp-toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
