/* Modal surfaces and document viewer chrome. */

.work-record-popup {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  line-height: normal;
  position: fixed;
  inset: 0;
  z-index: 19; /* One non-modal workspace window; Ask Aleph stays independent. */
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

.work-record-popup.hidden { display: none; }

.work-record-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--surface-rgb), 0.45);
}

.work-record-popup-shell {
  position: relative;
  width: min(430px, 100%);
  height: min(90dvh, calc(100dvh - 36px));
  min-width: 0;
  min-height: 0;
  border-radius: 20px;
  background: var(--bg-float);
  box-shadow: var(--float-shadow);
  color: var(--text-main);
  pointer-events: auto;
}

.work-record-popup-content { height: 100%; min-height: 0; }
.shared-document-panel .work-record-popup-body { display: block; overflow: hidden; }
.shared-document-panel .pdf-modal-frame { height: 100%; min-height: 0; border-radius: 8px; }
.shared-tool-panel .work-record-popup-body { align-content: start; }
.shared-focus-panel .focus-card-body { display: contents; }
.shared-focus-panel .focus-card-close { display: none; }
.shared-focus-panel .focus-card-head { padding: 0; }

.work-record-popup-content > .work-record-panel {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-color: var(--float-line);
}

.work-record-popup-head {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.work-record-popup-body {
  min-height: 0;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  overscroll-behavior: contain;
}

.work-record-popup-head {
  cursor: move;
  touch-action: none;
  user-select: none;
}

.work-record-popup-shell.is-moving { user-select: none; }
.work-record-popup-shell.is-maximised .work-record-resize { display: none; }
.work-record-popup-shell.is-maximised .work-record-popup-head { cursor: default; }

.work-record-window-controls { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; align-items: center; margin-left: auto; max-width: 100%; }
/* The window's controls stay at its top right: the title block takes the rest of the row and wraps its own text. */
.work-record-popup-head .work-record-panel-head { flex-wrap: nowrap; }
.work-record-popup-head .work-record-panel-head > div { flex: 1 1 auto; min-width: 0; }
.work-record-popup-head .work-record-window-controls { align-self: flex-start; }
body.fm-model-viewport-active .asset-card-panel [data-open-asset-in-twin-id] { display: none; }
.work-record-window-controls .work-record-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
}

.work-record-resize { position: absolute; z-index: 2; touch-action: none; }
.work-record-resize[data-work-resize="n"],
.work-record-resize[data-work-resize="s"] { left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.work-record-resize[data-work-resize="n"] { top: -4px; }
.work-record-resize[data-work-resize="s"] { bottom: -4px; }
.work-record-resize[data-work-resize="e"],
.work-record-resize[data-work-resize="w"] { top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.work-record-resize[data-work-resize="e"] { right: -4px; }
.work-record-resize[data-work-resize="w"] { left: -4px; }
.work-record-resize[data-work-resize="ne"],
.work-record-resize[data-work-resize="se"],
.work-record-resize[data-work-resize="sw"],
.work-record-resize[data-work-resize="nw"] { width: 18px; height: 18px; }
.work-record-resize[data-work-resize="ne"] { top: -4px; right: -4px; cursor: nesw-resize; }
.work-record-resize[data-work-resize="sw"] { bottom: -4px; left: -4px; cursor: nesw-resize; }
.work-record-resize[data-work-resize="nw"] { top: -4px; left: -4px; cursor: nwse-resize; }
.work-record-resize[data-work-resize="se"] {
  right: -4px;
  bottom: -4px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 0 52%, var(--input-line) 52% 60%, transparent 60% 72%, var(--input-line) 72% 80%, transparent 80%) 0 0 / 11px 11px no-repeat;
}

.work-record-launcher {
  position: fixed;
  z-index: 19;
  left: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 9px 14px;
  border: 1px solid var(--brand-blue);
  border-radius: 999px;
  background: var(--bg-panel-strong);
  box-shadow: var(--glass-shadow);
  color: var(--text-main);
  font: 600 12px/1.2 'Inter', ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 170ms ease, border-color 170ms ease;
}
.work-record-launcher:hover { transform: translateY(-1px); border-color: var(--brand-blue-soft); }
@media (prefers-reduced-motion: reduce) {
  .work-record-launcher { transition: none; }
  .work-record-launcher:hover { transform: none; }
}
.work-record-launcher.hidden { display: none; }
.work-record-launcher-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .work-record-resize { display: none; }
  .work-record-popup-head { cursor: default; touch-action: auto; user-select: auto; }
}

.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.pdf-modal.hidden {
  display: none;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--surface-rgb), 0.72);
}

.pdf-modal-shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 36px));
  height: min(90dvh, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  background: var(--bg-panel-strong);
  border-color: rgba(var(--brand-blue-rgb), 0.24);
}

.pdf-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pdf-modal-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.pdf-modal-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.pdf-modal-meta {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.pdf-modal-close {
  flex: 0 0 auto;
}

.pdf-modal-frame {
  /* Same in both themes: a media ground (3D, panorama, PDF page) is shown as itself. */
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
}

.pdf-modal-frame-image {
  /* Same in both themes: a media ground (3D, panorama, PDF page) is shown as itself. */
  background: #060d12;
}
