/* ── Size tokens ──────────────────────────────────────────────────────── */

:root {
  --p1-subheader-h: 48px; /* single knob — paired with --p1-header-h */
}

/* ── Outer shell ─────────────────────────────────────────────────────── */

.subheader {
  height: var(--p1-subheader-h);
  background: var(--pds-color-surface-default, oklch(1 0 0));
  border-top: 1px solid oklch(0.96 0 0); /* borderSubtle */
  border-bottom: 1px solid oklch(0.96 0 0); /* borderSubtle */
  display: flex;
  align-items: center;
  padding: 0 var(--pds-spacing-m, 1rem);
  gap: var(--pds-spacing-m, 1rem);
  flex-shrink: 0;
}

/* ── Panel toggles group ─────────────────────────────────────────────── */

.panelToggles {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ── History (undo/redo) group ───────────────────────────────────────── */

.historyGroup {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ── Undo/redo size ──────────────────────────────────────────────────── */

.historyGroup :global(.pds-icon-button) {
  --icon-button-size: 1.5rem;
  --icon-button-padding: 0.25rem;
}

/* ── Feature-contributed controls ───────────────────────────────────── */

.featureActions {
  display: inline-flex;
  align-items: center;
  gap: var(--pds-spacing-xs, 0.5rem);
  flex-shrink: 0;
}

/* Every control in the slot self-gates, so a slot that contributed nothing
   leaves an empty container. Neither it nor the rule beside it should take
   toolbar room. */
.featureActions:empty {
  display: none;
}

.divider:has(+ .featureActions:empty) {
  display: none;
}

/* ── Spacer ──────────────────────────────────────────────────────────── */

.spacer {
  flex: 1;
}

/* ── Divider ─────────────────────────────────────────────────────────── */

.divider {
  width: 1px;
  height: 1.25rem;
  background: var(--pds-color-border-default, oklch(0.9 0 0));
  flex-shrink: 0;
}

/* ── Right panel toggle rotation ─────────────────────────────────────── */

.rightPanelToggle :global(.pds-icon) {
  transform: rotate(180deg);
}

/* ── Workstream + Publish button group ────────────────────────────────── */

.workstreamPublishGroup {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Remove rounded corners and right border on workstream switcher when grouped.
 * Match by attribute substring rather than a fixed CSS-module hash so the rule
 * survives rebuilds (the hash changes between build tools, e.g. vbDGzq -> qeUOEG). */
.workstreamPublishGroup
  :global([class*='WorkstreamSwitcher-module'][class*='__trigger']) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

/* Remove rounded corners on the left side of publish button when grouped */
.workstreamPublishGroup :global(.pds-split-button),
.workstreamPublishGroup :global(.pds-button) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* ── Compact mobile layout (< 768px) ────────────────────────────────── */

@media (max-width: 767px) {
  .subheader {
    padding: 0 var(--pds-spacing-xs, 0.5rem);
    gap: var(--pds-spacing-xs, 0.5rem);
  }
}

/* ── Hover target for a disabled toolbar button ──────────────────────── */

/* A disabled button dispatches no pointer events, so the wrapper has to be
   the thing the tooltip hovers on. */
.tooltipTarget {
  display: inline-flex;
}

.tooltipTarget :global(.pds-icon-button:disabled) {
  pointer-events: none;
}
