/* Base bookmark styles */
.no-bookmarks-wrapper,
.bookmarks-list {
  margin-block-start: 1.5rem;
}

.bookmarks-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookmark-entry {
  animation: card-enter 0.2s ease both;
  background-color: var(--ls-surface-card);
  border: 1px solid var(--ls-border);
  border-radius: var(--ls-radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.bookmark-entry:hover {
  border-color: var(--ls-border-hover);
  box-shadow: var(--ls-shadow-md);
}

/* Unread indicator — teal left border */
.bookmark-entry:not(.read) {
  border-inline-start: 3px solid var(--ls-accent);
}

/* Domain line */
.bookmark-domain {
  align-items: center;
  color: var(--ls-text-tertiary);
  display: flex;
  font-family: var(--minimalist-typography-code-family);
  font-size: 0.75rem;
  gap: 0.375rem;
  margin-block-end: 0.375rem;
}

.bookmark-domain img {
  border-radius: 2px;
  height: 14px;
  width: 14px;
}

.bookmark-info h3,
.bookmark-info h4 {
  margin: 0;
  overflow-wrap: break-word;
}

.bookmark-title {
  -webkit-box-orient: vertical;
  color: var(--ls-text-primary);
  display: -webkit-box;
  font-family: var(--minimalist-typography-heading-family);
  font-size: 1.125rem;
  font-weight: 400;
  -webkit-line-clamp: 2;
  line-height: 1.35;
  overflow: hidden;
}

/* Unread titles are bolder */
.bookmark-entry:not(.read) .bookmark-title {
  font-weight: 600;
}

.bookmark-link {
  color: inherit;
  text-decoration: none;
}

.bookmark-link:hover .bookmark-title {
  color: var(--ls-accent);
}

.bookmark-description {
  -webkit-box-orient: vertical;
  color: var(--ls-text-secondary);
  display: -webkit-box;
  font-size: 0.8125rem;
  -webkit-line-clamp: 2;
  line-height: 1.5;
  margin-block-start: 0.375rem;
  overflow: hidden;
}

.bookmark-actions {
  align-items: center;
  display: flex;
  gap: 0.375rem;
  justify-content: space-between;
  margin-block-start: auto;
  padding-block-start: 0.75rem;
}

.bookmark-actions-primary {
  display: flex;
  flex: 1;
  gap: 0.375rem;
}

.bookmark-actions button {
  max-inline-size: unset;
}

.review-card .bookmark-info {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.review-card .bookmark-description:empty,
.review-card .bookmark-tags:empty {
  display: none;
}

.review-domain {
  margin-block-end: 0;
}

.review-controls {
  display: grid;
  gap: 0.75rem;
  margin-block-start: 0.25rem;
}

.review-card .form-field {
  margin-block-end: 0;
}

.review-card .review-reason,
.review-card .review-note {
  inline-size: 100%;
}

.review-card .bookmark-actions {
  justify-content: end;
}

.review-actions-primary {
  flex: 0 0 auto;
  justify-content: end;
}

/* No bookmarks state */
.no-bookmarks-wrapper {
  block-size: 50vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.no-bookmarks-wrapper * {
  margin: 0;
}

.no-bookmarks h2 {
  color: var(--ls-text-primary);
  font-family: var(--minimalist-typography-body-family);
  font-size: 1.25rem;
  font-weight: 600;
}

.no-bookmarks p {
  color: var(--ls-text-secondary);
  font-size: 0.9375rem;
  margin-block-start: 0.5rem;
}

.no-bookmarks::before {
  color: var(--ls-accent);
  content: "[ ]";
  display: block;
  font-family: var(--minimalist-typography-code-family);
  font-size: 3rem;
  margin-block-end: 1rem;
}

/* ===== Grid View Layout ===== */
#bookmarks-container.view-grid .bookmarks-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (width >= 40rem) {
  #bookmarks-container.view-grid .bookmarks-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .review-controls {
    grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  }
}

@media (width >= 64rem) {
  #bookmarks-container.view-grid .bookmarks-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bookmark-entry:nth-child(1) { animation-delay: 0ms; }
.bookmark-entry:nth-child(2) { animation-delay: 30ms; }
.bookmark-entry:nth-child(3) { animation-delay: 60ms; }
.bookmark-entry:nth-child(4) { animation-delay: 90ms; }
.bookmark-entry:nth-child(5) { animation-delay: 120ms; }
.bookmark-entry:nth-child(6) { animation-delay: 150ms; }
.bookmark-entry:nth-child(7) { animation-delay: 180ms; }
.bookmark-entry:nth-child(8) { animation-delay: 210ms; }
.bookmark-entry:nth-child(9) { animation-delay: 240ms; }

#bookmarks-container.view-grid .bookmark-entry {
  display: flex;
  flex-direction: column;
}

#bookmarks-container.view-grid .bookmark-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

/* ===== List View Layout ===== */
#bookmarks-container.view-list .bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#bookmarks-container.view-list .bookmark-entry {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

#bookmarks-container.view-list .bookmark-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

#bookmarks-container.view-list .bookmark-title {
  font-size: 1rem;
  -webkit-line-clamp: 1;
}

#bookmarks-container.view-list .bookmark-description {
  -webkit-line-clamp: 1;
  margin-block-start: 0.25rem;
}

#bookmarks-container.view-list .bookmark-actions {
  padding-block-start: 0.5rem;
}

#bookmarks-container.view-list .bookmark-actions button {
  flex: 0 1 auto;
  inline-size: auto;
}

/* Mobile adjustments for list view */
@media (width <= 48rem) {
  #bookmarks-container.view-list .bookmark-entry {
    align-items: stretch;
    flex-direction: column;
  }

  .review-card .bookmark-actions {
    justify-content: stretch;
  }

  .review-actions-primary {
    flex: 1;
  }

  .review-actions-primary .button {
    flex: 1 1 0;
  }
}

/* ===== Card entrance animation ===== */
@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bookmark-entry {
    animation: none;
  }
}
