.records-index-page,
.record-post-page {
  background: #f2f3f5;
}

.records-library-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
}

.records-library-toc {
  position: sticky;
  top: calc(var(--zj-nav-height) + 1.5rem);
  border-left: 3px solid var(--zj-blue);
  padding: 0.15rem 0 0.15rem 0.85rem;
  font-size: 0.82rem;
}

.records-library-toc nav {
  display: grid;
  gap: 0.28rem;
  margin-top: 0.6rem;
}

.records-library-toc a {
  border-radius: 0.3rem;
  padding: 0.25rem 0.4rem;
  color: var(--zj-muted);
  text-decoration: none;
}

.records-library-toc a:hover,
.records-library-toc a:focus-visible {
  color: var(--zj-blue);
  background: #e7f1ff;
}

.records-groups {
  display: grid;
  min-width: 0;
  gap: 2rem;
}

.records-group {
  min-width: 0;
  scroll-margin-top: calc(var(--zj-nav-height) + 1rem);
}

.records-group__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid #d5d9dd;
  padding-bottom: 0.55rem;
}

.records-group__header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.records-group__count {
  color: var(--zj-muted);
  font-size: 0.74rem;
}

.records-group__meta,
.records-group__tools,
.record-card-order {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.records-group__meta {
  gap: 0.7rem;
}

.records-group__tools[hidden],
.record-card-order[hidden] {
  display: none;
}

.records-group__tools button,
.record-card-order button {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border: 1px solid #ced4da;
  border-radius: 50%;
  color: #495057;
  background: rgb(255 255 255 / 94%);
  font-size: 0.68rem;
}

.records-group__tools button:hover,
.record-card-order button:hover {
  color: #fff;
  border-color: var(--zj-blue);
  background: var(--zj-blue);
}

.records-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.record-card-item {
  position: relative;
  min-width: 0;
}

.record-card {
  display: flex;
  height: 100%;
  min-height: 285px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d5d9dd;
  border-radius: 0.7rem;
  color: inherit;
  background: #fff;
  box-shadow: 0 0.4rem 1.4rem rgb(33 37 41 / 7%);
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.record-card:hover {
  color: inherit;
  box-shadow: 0 0.8rem 2rem rgb(33 37 41 / 13%);
  transform: translateY(-3px);
}

.record-card__preview {
  display: grid;
  min-height: 160px;
  flex: 1;
  place-items: center;
  overflow: hidden;
  color: #6c757d;
  background: linear-gradient(145deg, #fff, #edf1f4);
  font-size: 2rem;
}

.record-card__preview img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  max-height: 205px;
  padding: 0.45rem;
  object-fit: contain;
}

.record-card__body {
  padding: 0.9rem 1rem 1rem;
}

.record-card__type,
.record-post__eyebrow span {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  color: #084298;
  background: #cfe2ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.record-card__body h2 {
  margin: 0.55rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.record-card__summary {
  margin: 0.45rem 0 0;
  color: var(--zj-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.record-card-delete {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  right: 0.65rem;
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid #f1aeb5;
  border-radius: 50%;
  color: #b02a37;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 0.25rem 0.8rem rgb(33 37 41 / 12%);
}

.record-card-order {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  left: 0.65rem;
}

.record-card-delete[hidden] {
  display: none;
}

.record-card-delete:hover {
  color: #fff;
  background: #dc3545;
}

.record-editor-chrome.is-sticky {
  position: sticky;
  top: calc(var(--zj-nav-height) + 0.5rem);
  z-index: 1040;
  margin-bottom: 1rem;
  border-radius: 0.6rem;
  padding-top: 0.05rem;
  background: rgb(242 243 245 / 96%);
  box-shadow: 0 0.7rem 1.4rem rgb(33 37 41 / 8%);
  backdrop-filter: blur(8px);
}

.record-editor-chrome.is-sticky .admin-toolbar {
  margin-top: 0;
}

.record-post {
  width: 100%;
  margin: 0;
  border: 1px solid #d5d9dd;
  border-radius: 0.75rem;
  padding: clamp(1.25rem, 3vw, 2.75rem);
  background: #fff;
  box-shadow: 0 0.5rem 1.7rem rgb(33 37 41 / 7%);
}

.record-post__header {
  margin-bottom: 1.6rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 1.25rem;
}

.record-post__eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.record-post__eyebrow span:first-child {
  color: #146c43;
  background: #d1e7dd;
}

.record-post__header h1 {
  width: 100%;
  max-width: none;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.record-post__summary {
  width: 100%;
  max-width: none;
  margin: 0.6rem 0 0;
  color: var(--zj-muted);
  font-size: 0.92rem;
}

.record-post.is-editing .record-post__summary:empty {
  min-height: 1.5em;
  border-radius: 0.25rem;
}

.record-post.is-editing .record-post__summary:empty::before {
  color: #adb5bd;
  content: attr(data-edit-placeholder);
}

.record-content {
  min-width: 0;
}

.record-content > * + * {
  margin-top: 1rem;
}

.record-section {
  border: 1px solid #e2e6ea;
  border-radius: 0.65rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  background: #fff;
  box-shadow: 0 0.3rem 1rem rgb(33 37 41 / 5%);
}

.record-section + .record-section {
  margin-top: 1.1rem;
}

.record-section > :last-child {
  margin-bottom: 0;
}

.record-grid:not(.post-grid),
.demo-grid:not(.post-grid) {
  display: grid;
  grid-template-columns: repeat(var(--record-columns, 2), minmax(0, 1fr));
  gap: 0.9rem;
}

.record-grid--1,
.demo-grid--1 { --record-columns: 1; }
.record-grid--2,
.demo-grid--2 { --record-columns: 2; }
.record-grid--3,
.demo-grid--3 { --record-columns: 3; }
.record-grid--4,
.demo-grid--4 { --record-columns: 4; }

.record-grid-column,
.demo-grid-column {
  min-width: 0;
}

.record-media-item,
.demo-media-item {
  min-width: 0;
  margin: 0 0 1rem;
}

.record-grid .record-media-item,
.record-grid .demo-media-item,
.demo-grid .record-media-item,
.demo-grid .demo-media-item {
  margin-bottom: 0;
}

.record-media-frame,
.demo-media-frame {
  position: relative;
  display: grid;
  max-height: min(68vh, 720px);
  place-items: center;
  overflow: hidden;
  border-radius: 0.45rem;
  background: #f6f7f8;
}

.record-media-frame img,
.record-media-frame video,
.record-media-frame iframe,
.demo-media-frame img,
.demo-media-frame video,
.demo-media-frame iframe,
.record-content > img,
.record-content > video,
.record-content > iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(68vh, 720px);
  border: 0;
  object-fit: contain;
}

.record-content figcaption,
.editor-media-caption {
  margin-top: 0.45rem;
  color: var(--zj-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.record-content figcaption:empty {
  display: none;
}

.record-post:not(.is-editing) .record-content img {
  cursor: zoom-in;
}

.record-post.is-editing iframe,
.record-post.is-editing video {
  pointer-events: none;
}

.record-post.is-editing [data-demo-media],
.record-post.is-editing .demo-grid-column:not(.post-grid-column),
.record-post.is-editing .record-grid-column:not(.post-grid-column),
.record-post.is-editing [data-demo-grid]:not(.post-grid),
.record-post.is-editing [data-record-section]:not(.post-section) {
  outline: 2px dashed rgb(13 110 253 / 22%);
  outline-offset: 2px;
}


@media (max-width: 991px) {
  .records-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-grid--4,
  .demo-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .records-library-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .records-library-toc {
    position: static;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid #d5d9dd;
    padding: 0 0 0.75rem;
  }

  .records-library-toc strong {
    display: block;
    margin-bottom: 0.5rem;
  }

  .records-library-toc nav {
    display: flex;
    width: max-content;
    margin-top: 0;
  }

  .records-library-toc a {
    border: 1px solid #ced4da;
    padding: 0.35rem 0.65rem;
    background: #fff;
  }

  .records-card-grid,
  .record-grid,
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .record-card {
    min-height: 265px;
  }

  .record-card__preview img {
    max-height: 190px;
  }
}
