.article-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgb(0 0 0 / 0.04);
  border: 1px solid rgb(0 0 0 / 0.04);
  border-radius: var(--radius-lg);
}

.article-list:not(:has(.article-item)) {
  display: none;
}

.article-list:not(:has(.article-item))[data-empty-label] {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px dashed rgb(0 0 0 / 0.12);
  color: var(--color-armadillo-500);
  font-size: 0.8125rem;
  font-style: italic;
  min-height: 3rem;
  padding: var(--space-sm);
}

.article-list:not(:has(.article-item))[data-empty-label]::before {
  content: attr(data-empty-label);
}

.article-list > .article-item:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.article-list > .article-item:last-child {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.article-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-white);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.article-item:hover {
  background: var(--color-spring-wood-100);
}

.article-item:has(.article-item__main:focus-visible) {
  outline: 2px solid var(--color-primary-900);
  outline-offset: -2px;
}

.article-item__main:focus {
  outline: none;
}

.article-item__main {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.article-item__main::before {
  content: "";
  position: absolute;
  inset: 0;
}

.article-item__drag-handle {
  position: relative;
  z-index: 1;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.25rem;
  margin-left: calc(var(--space-md) * -1 + 0.25rem);
  margin-right: calc(var(--space-sm) * -1);
  color: var(--color-armadillo-200);
  cursor: grab;
  transition: color var(--transition-fast);
}

.article-item:hover .article-item__drag-handle {
  color: var(--color-armadillo-400);
}

.article-item__drag-handle:active {
  cursor: grabbing;
}

.article-list .btn--icon {
  background: transparent;
  border-color: transparent;
  color: var(--color-armadillo-400);
}

.article-list .btn--icon:hover {
  background: transparent;
  color: var(--color-armadillo-800);
}

/* Sits above .article-item__main::before (the inset:0 link overlay) so the menu is clickable. */
.article-item__actions {
  z-index: 1;
  flex-shrink: 0;
}

/* The z-index above traps the open menu at the row's level; lift the whole row while
   its menu is open so it draws over the rows below (and their handles/actions). */
.article-item:has(.dropdown__menu--open) {
  z-index: 2;
}

.article-item.sortable-ghost {
  opacity: 0.4;
}

.article-item.sortable-fallback {
  cursor: grabbing;
  box-shadow: var(--shadow-md);
}

.article-item__title {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-armadillo-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .article-item__date {
    display: none;
  }

  .article-item__drag-handle {
    padding-block: var(--space-md);
    margin-block: calc(var(--space-md) * -1);
  }
}

.article-item__date {
  font-size: 0.75rem;
  color: var(--color-armadillo-400);
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot--draft {
  background: transparent;
  border: 1.5px solid var(--color-armadillo-400);
  box-sizing: border-box;
}

.status-dot--published {
  background: oklch(60% 0.12 155);
}

.status-dot--pending {
  background: transparent;
  border: 1.5px solid oklch(60% 0.12 155);
  box-sizing: border-box;
}

.attachment__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Article tree rows — used by the content rail (components/rail.css) to list a
   collection's articles. The status dot + current-item treatment carry over. */
.article-toc__heading {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-armadillo-500);
  font-weight: 600;
  margin: var(--space-md) 0 var(--space-2xs, 0.25rem);
}

.article-toc__heading:first-of-type {
  margin-top: 0;
}

.article-toc__list {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.article-toc__link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-armadillo-700);
  text-decoration: none;
  line-height: 1.35;
  font-size: 0.875rem;
}

.article-toc__link--current {
  color: var(--color-armadillo-900);
  font-weight: 600;
}

.article-toc__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact status pill — passive info about the article's publish state.
   Lives in the info strip above the topbar. */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--color-armadillo-600);
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.status-pill__label {
  font-weight: 500;
}

/* Briefly highlight the pill when its status just transitioned (e.g. first
   keystroke on a clean Published article flips it to Pending changes). The
   turbo-stream re-render adds this class only when the server detects a
   status change. */
.status-pill--flash {
  animation: status-pill-flash 1.2s ease-out 1;
}

@keyframes status-pill-flash {
  0%   { background-color: var(--color-spring-wood-300); box-shadow: 0 0 0 0.1875rem var(--color-spring-wood-300); }
  100% { background-color: transparent; box-shadow: 0 0 0 0.1875rem transparent; }
}

/* Quiet one-line info row above the topbar. Carries status + (when editing)
   save indicator + relative timestamp. No border — separation from the action
   bar comes from spacing and size hierarchy alone. */
.info-strip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.25rem 0;
  margin-bottom: var(--space-xs);
  font-size: 0.75rem;
  color: var(--color-armadillo-500);
}

.info-strip__sep {
  width: 1px;
  height: 0.75rem;
  background: var(--color-spring-wood-500);
  flex-shrink: 0;
}

/* The save-status is hidden until the autosave controller sets a data-state.
   Collapse the leading separator alongside it so we don't leave a "| |" gap. */
.info-strip__sep:has(+ .save-status:not([data-state])) {
  display: none;
}

.info-strip__date {
  color: var(--color-armadillo-500);
  white-space: nowrap;
}

/* The badge wrapper exists only as a turbo target; its children (separator + chip)
   participate directly in the info-strip flex row, so the 1px separator sizes. */
.info-strip__public {
  display: contents;
}

/* Edit / Preview toggle — sits where the back link used to be on desktop. */
.read-modes {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  background: rgb(0 0 0 / 0.04);
  border-radius: var(--radius-md);
  padding: 2px;
  flex-shrink: 0;
}

.read-modes__item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-armadillo-700);
  text-decoration: none;
  border-radius: calc(var(--radius-md) - 2px);
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: 1.25;
  white-space: nowrap;
}

.read-modes__item:hover {
  color: var(--color-armadillo-900);
  background: rgb(255 255 255 / 0.6);
}

.read-modes__item--active {
  background: var(--color-white);
  color: var(--color-armadillo-900);
  box-shadow: 0 1px 1.5px rgb(0 0 0 / 0.08), 0 0 0 0.5px rgb(0 0 0 / 0.04);
  cursor: default;
}

.read-modes__item--active:hover { background: var(--color-white); }

/* In the document's meta row (above the title) the toggle is a BORDERED, flat
   segmented control — a hairline outline + a divider between segments keeps the
   "this is a control" read, while a soft tinted active fill replaces the band
   version's grey trough + raised chip, so it sits quietly under the title. */
.sheet__meta-row .read-modes {
  background: transparent;
  padding: 0;
  gap: 0;
  border: 1px solid var(--color-spring-wood-600);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sheet__meta-row .read-modes__item {
  color: var(--color-armadillo-600);
  font-size: 0.8125rem;
  padding: 0.3125rem 0.625rem;
  border-radius: 0;
}

.sheet__meta-row .read-modes__item + .read-modes__item {
  border-left: 1px solid var(--color-spring-wood-600);
}

.sheet__meta-row .read-modes__item--active,
.sheet__meta-row .read-modes__item--active:hover {
  background: var(--color-spring-wood-200);
  color: var(--color-armadillo-900);
  box-shadow: none;
}

.sheet__meta-row .read-modes__item:hover:not(.read-modes__item--active) {
  background: rgb(0 0 0 / 0.03);
  color: var(--color-armadillo-900);
}

/* The toggle becomes a primary touch target on phones — keep it finger-sized. */
@media (max-width: 640px) {
  .sheet__meta-row .read-modes__item {
    padding-block: 0.5rem;
    min-height: 2.5rem;
  }
}

