/**
 * PostNow Studio Shell (Option 1: Focus Stage + Docked Workbenches)
 * Matched 1:1 to ProofNow's Full-Bleed Outer Studio Shell + postnow-brand-acss tokens.
 * Every dimension inside #pn-studio-shell uses explicit px values (ACSS 62.5% rem-scale guard).
 */

:root {
  --pn-primary: #E00022;
  --pn-primary-dark: #B8001B;
  --pn-primary-tint: #FFF1F3;
  --pn-secondary: #0E83CC;
  --pn-navy: #053E66;
  --pn-navy-dark: #032B47;
  --pn-navy-hover: #084D77;
  --pn-navy-tint: #E8F1F7;
  --pn-navy-deep: #0F172A;
  --pn-accent: #00BFF4;
  --pn-base: #232323;
  --pn-base-dark: #1A1A1A;
  --pn-text: #0F172A;
  --pn-text-body: #404040;
  --pn-text-muted: #595959;
  --pn-canvas: #F8FAFC;
  --pn-surface: #FFFFFF;
  --pn-surface-alt: #F1F5F9;
  --pn-border: #CBD5E1;
  --pn-border-subtle: #E2E8F0;
  --pn-success: #16A34A;
  --pn-success-tint: #ECFDF5;
  --pn-warning: #D97706;
  --pn-warning-tint: #FFFBEB;
  --pn-radius-btn: 4px;
  --pn-radius-input: 4px;
  --pn-radius-card: 5px;
  --pn-radius-badge: 4px;
  --pn-font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --pn-rail-width: 56px;
  --pn-drawer-width: 268px;
  --pn-right-width: 300px;
}

.pn-studio-root-wrap {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pn-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--pn-text);
  position: static;
}

/* Full-Bleed ProofNow Oxygen Breakout (Edge-to-Edge Viewport Width) */
.pn-studio-root-wrap.pn-is-fullbleed {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}

body:has(.pn-studio-root-wrap.pn-is-fullbleed) {
  overflow-x: clip;
}

body.pn-fullscreen-active {
  height: 100vh !important;
  overflow: hidden !important;
}

body.pn-fullscreen-active #wpadminbar,
body.pn-fullscreen-active #masthead,
body.pn-fullscreen-active .pnh-main-header,
body.pn-fullscreen-active .oxy-header-wrapper,
body.pn-fullscreen-active header.oxy-header,
body.pn-fullscreen-active .ct-header,
body.pn-fullscreen-active .site-header {
  display: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
}

#pn-studio-shell,
#pn-studio-shell *,
#pn-studio-shell *::before,
#pn-studio-shell *::after {
  box-sizing: border-box;
}

#pn-studio-shell {
  font-family: var(--pn-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--pn-text);
  background: var(--pn-canvas);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  width: 100% !important;
  max-width: none !important;
  overflow: hidden;
  isolation: isolate;
}

/* Host Geometry: ProofNow 85vh Full-Bleed Embedded vs Full Screen */
#pn-studio-shell.pn-view-normal {
  height: 85vh;
  max-height: 85vh;
  min-height: 620px;
  border-top: 1px solid var(--pn-border);
  border-bottom: 1px solid var(--pn-border);
  border-left: none;
  border-right: none;
  border-radius: 0;
  z-index: 0;
}

#pn-studio-shell.pn-view-fullscreen,
#pn-studio-shell.pn-is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  min-height: 100vh !important;
  z-index: 2147483640 !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.pn-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--pn-surface);
  color: var(--pn-navy);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--pn-primary);
  border-radius: var(--pn-radius-btn);
  z-index: 200;
  text-decoration: none;
}

.pn-skip-link:focus {
  left: 8px;
}

/* ==========================================================================
   ProofNow Master 3-Track Studio Header (58px)
   ========================================================================== */
#pn-studio-shell .pn-studio-header {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  min-height: 58px;
  background: linear-gradient(135deg, #053E66 0%, #1A1A1A 100%);
  border-bottom: 2px solid var(--pn-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 70;
}

#pn-studio-shell .pn-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 0 0 auto;
}

#pn-studio-shell .pn-app-badge-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
  min-width: 0;
}

#pn-studio-shell .pn-brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

#pn-studio-shell .pn-brand-link {
  text-decoration: none !important;
  font-family: var(--pn-font-sans) !important;
  font-weight: 800 !important;
  font-size: 19px !important;
  letter-spacing: -0.02em !important;
  line-height: 1.15 !important;
  color: #FFFFFF !important;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

#pn-studio-shell .pn-logo-text,
#pn-studio-shell .pn-app-title {
  color: #FFFFFF;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

#pn-studio-shell .pn-logo-post {
  color: #FFFFFF;
}

#pn-studio-shell .pn-logo-now {
  color: #FF3352;
}

#pn-studio-shell .pn-app-subtitle {
  font-family: var(--pn-font-sans);
  font-size: 12px;
  font-weight: 500;
  color: #CBD5E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 310px;
}

@media (max-width: 1400px) {
  #pn-studio-shell .pn-app-subtitle {
    display: none;
  }
}

#pn-studio-shell .pn-view-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--pn-radius-badge);
  color: #E2E8F0;
  white-space: nowrap;
}

/* Header Center Translucent Capsule (Matched to ProofNow .pn-header-center-info) */
#pn-studio-shell .pn-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#pn-studio-shell .pn-header-center-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 5px 11px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#pn-studio-shell .pn-center-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #F8FAFC;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pn-studio-shell .pn-status-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

#pn-studio-shell .pn-status-pill.is-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #FDE68A;
  border: 1px solid rgba(245, 158, 11, 0.42);
}

#pn-studio-shell .pn-status-pill.is-green {
  background: rgba(22, 163, 74, 0.22);
  color: #BBF7D0;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

#pn-studio-shell .pn-status-pill.is-navy {
  background: rgba(14, 131, 204, 0.24);
  color: #BAE6FD;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

#pn-studio-shell .pn-status-pill.is-red {
  background: rgba(224, 0, 34, 0.28);
  color: #FECDD3;
  border: 1px solid rgba(244, 63, 94, 0.5);
  text-decoration: none;
}

#pn-studio-shell .pn-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

/* Header Action Buttons (Matched to ProofNow .pn-btn-studio) */
#pn-studio-shell .pn-hdr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-family: var(--pn-font-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #F8FAFC;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#pn-studio-shell .pn-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.36);
  color: #FFFFFF;
}

#pn-studio-shell .pn-hdr-btn:focus-visible,
#pn-studio-shell .pn-rail-btn:focus-visible,
#pn-studio-shell .pn-sidebar-resizer:focus-visible,
#pn-studio-shell .pn-drawer-close:focus-visible {
  outline: 2px solid var(--pn-accent);
  outline-offset: 2px;
}

#pn-studio-shell .pn-hdr-btn-primary {
  background: var(--pn-primary);
  border-color: var(--pn-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(224, 0, 34, 0.28);
}

#pn-studio-shell .pn-hdr-btn-primary:hover {
  background: var(--pn-primary-dark);
  border-color: var(--pn-primary-dark);
  color: #FFFFFF;
}

#pn-studio-shell .pn-fs-icon-compress {
  display: none;
}

#pn-studio-shell.pn-view-fullscreen .pn-fs-icon-expand {
  display: none;
}

#pn-studio-shell.pn-view-fullscreen .pn-fs-icon-compress {
  display: inline-block;
}

/* ==========================================================================
   Workspace Flex Body
   ========================================================================== */
#pn-studio-shell .pn-studio-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  position: relative;
  overflow: hidden;
  background: var(--pn-canvas);
}

/* ==========================================================================
   Persistent 56px Left Icon Rail (Storyboard v2.2 / ACSS #053E66)
   ========================================================================== */
#pn-studio-shell .pn-nav-rail {
  width: var(--pn-rail-width);
  min-width: var(--pn-rail-width);
  background: #053E66;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  flex-shrink: 0;
  position: relative;
  z-index: 65;
}

#pn-studio-shell .pn-rail-top,
#pn-studio-shell .pn-rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#pn-studio-shell .pn-rail-section-divider {
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 2px 0;
}

#pn-studio-shell .pn-rail-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #D9D9D9;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#pn-studio-shell .pn-rail-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

#pn-studio-shell .pn-rail-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.16);
  border-left: 3px solid var(--pn-primary);
  border-radius: 3px;
  box-shadow: none;
}

#pn-studio-shell .pn-rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background: var(--pn-accent);
  color: var(--pn-navy-deep);
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  border-radius: 3px;
}

#pn-studio-shell .pn-rail-tooltip {
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--pn-navy-deep);
  color: #FFFFFF;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
  z-index: 120;
  transition: opacity 0.12s ease;
}

#pn-studio-shell .pn-rail-btn:hover .pn-rail-tooltip,
#pn-studio-shell .pn-rail-btn:focus-visible .pn-rail-tooltip {
  opacity: 1;
}

/* ==========================================================================
   Collapsible Left Drawer (Overlay below 1360px)
   ========================================================================== */
#pn-studio-shell .pn-drawer-backdrop {
  display: none;
}

#pn-studio-shell .pn-slide-drawer {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--pn-surface);
  border-right: 0 solid var(--pn-border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.18s ease;
  z-index: 55;
}

#pn-studio-shell .pn-slide-drawer.is-open {
  width: var(--pn-drawer-width);
  min-width: var(--pn-drawer-width);
  border-right-width: 1px;
}

@media (min-width: 1360px) {
  #pn-studio-shell .pn-slide-drawer.pn-drawer-default-open:not(.is-user-closed) {
    width: var(--pn-drawer-width);
    min-width: var(--pn-drawer-width);
    border-right-width: 1px;
  }
}

#pn-studio-shell .pn-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--pn-border-subtle);
  background: var(--pn-surface-alt);
  flex-shrink: 0;
}

#pn-studio-shell .pn-drawer-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pn-navy);
}

#pn-studio-shell .pn-drawer-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--pn-border);
  border-radius: 4px;
  color: var(--pn-text-muted);
  cursor: pointer;
}

#pn-studio-shell .pn-drawer-close:hover {
  background: var(--pn-canvas);
  color: var(--pn-text);
}

#pn-studio-shell .pn-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
}

@media (max-width: 1359px) {
  #pn-studio-shell.pn-right-desktop-only .pn-action-sidebar,
  #pn-studio-shell.pn-right-desktop-only .pn-sidebar-resizer {
    display: none;
  }

  #pn-studio-shell .pn-slide-drawer {
    position: absolute;
    left: var(--pn-rail-width);
    top: 0;
    bottom: 0;
    z-index: 60;
    box-shadow: 6px 0 24px rgba(15, 23, 42, 0.18);
  }

  #pn-studio-shell .pn-drawer-backdrop.is-visible {
    display: block;
    position: absolute;
    left: var(--pn-rail-width);
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.36);
    z-index: 50;
  }
}

/* ==========================================================================
   Center Focus Stage (ProofNow #F8FAFC + Crisp White Toolbar Bar)
   ========================================================================== */
#pn-studio-shell .pn-canvas-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--pn-canvas);
  display: flex;
  flex-direction: column;
}

#pn-studio-shell .pn-stage-bar {
  background: var(--pn-surface);
  border-bottom: 1px solid var(--pn-border-subtle);
  padding: 10px 20px;
  flex-shrink: 0;
}

#pn-studio-shell .pn-stage-inner {
  flex: 1 1 auto;
  padding: 18px 20px;
  min-width: 0;
}

/* ==========================================================================
   Optional Compact Right Workbench Sidebar (240px - 380px resizable)
   ========================================================================== */
#pn-studio-shell .pn-sidebar-resizer {
  width: 6px;
  flex-shrink: 0;
  background: var(--pn-border-subtle);
  cursor: col-resize;
  position: relative;
  transition: background-color 0.15s ease;
}

#pn-studio-shell .pn-sidebar-resizer:hover,
#pn-studio-shell .pn-sidebar-resizer.is-dragging {
  background: var(--pn-secondary);
}

#pn-studio-shell .pn-action-sidebar {
  width: var(--pn-right-width);
  min-width: 240px;
  max-width: 380px;
  background: var(--pn-surface);
  border-left: 1px solid var(--pn-border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 14px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1180px) {
  #pn-studio-shell .pn-view-pill,
  #pn-studio-shell .pn-header-center {
    display: none;
  }
}

@media (max-width: 1023px) {
  #pn-studio-shell.pn-view-normal {
    height: auto;
    max-height: none;
  }

  #pn-studio-shell .pn-studio-body {
    flex-wrap: wrap;
    overflow: visible;
  }

  #pn-studio-shell .pn-nav-rail {
    width: 100%;
    min-width: 100%;
    height: auto;
    flex-direction: row;
    padding: 6px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  #pn-studio-shell .pn-rail-top,
  #pn-studio-shell .pn-rail-bottom {
    flex-direction: row;
  }

  #pn-studio-shell .pn-rail-section-divider {
    width: 1px;
    height: 20px;
    margin: 0 2px;
  }

  #pn-studio-shell .pn-rail-tooltip {
    display: none;
  }

  #pn-studio-shell .pn-slide-drawer {
    left: 0;
    top: 52px;
  }

  #pn-studio-shell .pn-drawer-backdrop.is-visible {
    left: 0;
    top: 52px;
  }

  #pn-studio-shell .pn-canvas-stage {
    width: 100%;
    overflow: visible;
  }

  #pn-studio-shell .pn-sidebar-resizer {
    display: none;
  }

  #pn-studio-shell .pn-action-sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-left: none;
    border-top: 1px solid var(--pn-border-subtle);
  }
}

@media (max-width: 680px) {
  #pn-studio-shell .pn-studio-header {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px 8px;
  }

  #pn-studio-shell .pn-header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  #pn-studio-shell .pn-logo-text,
  #pn-studio-shell .pn-app-title {
    font-size: 16px !important;
  }

  #pn-studio-shell .pn-header-right {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 6px;
  }

  #pn-studio-shell .pn-hdr-btn {
    height: 30px;
    padding: 0 9px;
    font-size: 11px;
  }

  #pn-studio-shell .pn-fs-label {
    display: none;
  }

  #pn-studio-shell .pn-stage-bar {
    padding: 8px 12px;
  }

  #pn-studio-shell .pn-stage-inner {
    padding: 12px;
  }
}

/* Modal Escape Hatch Safety Above Full Screen Shell */
.pn-modals-portal .modal {
  z-index: 2147483647 !important;
}

body > .modal-backdrop {
  z-index: 2147483645 !important;
}

@media (prefers-reduced-motion: reduce) {
  #pn-studio-shell *,
  #pn-studio-shell *::before,
  #pn-studio-shell *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
