/*
 * Loads after reference CSS. Pins «Оновлення» while the page scrolls.
 * Reference clears .workbench-sidebar sticky below 1220px; this keeps the first card sticky.
 */

/* Header logo tile stays white in dark theme (logo asset is light-background). */
html[data-theme="dark"] .masthead .brand-mark {
	background: #ffffff !important;
	border-color: rgba(188, 201, 213, 0.9) !important;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.workbench-sidebar > .home-side-box--updates-sticky {
  position: sticky;
  top: 16px;
  z-index: 2;
  align-self: start;
  overflow: visible;
}

body.admin-bar .workbench-sidebar > .home-side-box--updates-sticky {
  top: calc(16px + 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .workbench-sidebar > .home-side-box--updates-sticky {
    top: calc(16px + 46px);
  }
}

ul.portal-category-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-category-menu > .menu-item {
  display: contents;
}

/* Portal material single: document preview modal */
.portal-document-preview-modal[hidden] {
  display: none !important;
}

.portal-document-preview-modal:not([hidden]) {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.portal-document-preview-dialog {
  width: min(960px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel-bg, #fff);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.portal-document-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.portal-document-preview-content {
  flex: 1;
  min-height: 400px;
  overflow: auto;
}

.portal-document-preview-content iframe {
  display: block;
  border: 0;
}

.portal-document-preview-content img,
.portal-document-preview-content video,
.portal-document-preview-content audio {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.portal-document-preview-content video {
  width: 100%;
  max-height: min(70vh, 720px);
  background: #000;
}

.portal-document-preview-content audio {
  width: 100%;
}

.portal-document-preview-text {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.9rem;
  line-height: 1.45;
}

.portal-document-preview-error {
  margin: 0;
  padding: 16px;
}

.portal-document-card + .portal-document-card {
  margin-top: 12px;
}

.portal-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.portal-material-featured {
  margin: 0 0 1rem;
}

.portal-material-featured img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Rubric page: stacked materials match main portal rhythm */
.main--portal-rubric .portal-rubric-material-entry + .portal-rubric-material-entry {
	margin-top: 2.5rem;
	padding-top: 2.5rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.main--portal-rubric .portal-rubric-materials-stack {
	padding-bottom: 2rem;
}

.main--portal-rubric .portal-rubric-page-content > *:first-child {
	margin-top: 0;
}
