/* ==========================================================================
   Collection Feed — Photo-first browse experience (Session 8)
   ========================================================================== */

/* --- Break out of app-workspace__content padding for edge-to-edge photos --- */

.app-workspace__content:has(.collection-feed),
.app-workspace__content:has(.feed-skeleton) {
  padding: 0;
  max-width: none;
}

/* --- Feed container --- */

.collection-feed {
  width: 100%;
}

/* --- Feed divider --- */

.feed-divider {
  height: 1px;
  background: rgba(26, 13, 8, 0.06);
}

/* --- Feed item (shared) --- */

.feed-item {
  position: relative;
  width: 100%;
  overflow: hidden;
}

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

.feed-item__photo {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--color-parch);
}

.feed-item--full .feed-item__photo,
.feed-item--half .feed-item__photo {
  aspect-ratio: 1;
}

.feed-item--grid-hero .feed-item__photo {
  aspect-ratio: 4 / 3;
}

.feed-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- No-photo placeholder --- */

.feed-item__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-item__placeholder svg {
  width: 80px;
  height: 80px;
  opacity: 0.15;
}

/* --- Gradient overlay (matches item-hero__overlay from item_detail.css) --- */

.feed-item__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent 0%, rgba(26, 13, 8, 0.25) 30%, rgba(26, 13, 8, 0.85) 100%);
  padding: 48px 16px 14px;
}

.feed-item--half .feed-item__overlay {
  padding: 28px 10px 10px;
}

.feed-item__title {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: var(--color-ivory);
  line-height: 1.2;
  margin: 0 0 3px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item--half .feed-item__title {
  font-size: 13px;
  -webkit-line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
}

.feed-item__value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-item__value {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 700;
  font-size: 24px;
  color: var(--color-ivory);
}

.feed-item--half .feed-item__value {
  font-size: 16px;
}

.feed-item__value-row .delta-badge {
  font-size: 11px;
  padding: 2px 8px;
}

/* --- Grail star --- */

.feed-item__grail {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  background: var(--color-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ivory);
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(192, 48, 26, 0.4);
  z-index: 2;
}

/* --- Photo count badge --- */

.feed-item__photo-count {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--color-ivory);
  padding: 3px 8px;
  border-radius: 10px;
  z-index: 2;
}

/* --- Magazine 2-up pair --- */

.feed-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(26, 13, 8, 0.06);
}

/* --- Grid mode thumbnails --- */

.collection-feed--grid .grid-area {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: rgba(26, 13, 8, 0.06);
}

.grid-thumb {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
}

.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-thumb__placeholder {
  width: 100%;
  height: 100%;
}

/* --- Skeleton loading --- */

.feed-skeleton {
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-parch);
  position: relative;
  overflow: hidden;
}

.feed-skeleton--hero {
  aspect-ratio: 4 / 3;
}

.feed-skeleton--half {
  aspect-ratio: 1;
}

.feed-skeleton-grid {
  display: grid;
  gap: 1px;
}

.feed-skeleton-grid--thirds {
  grid-template-columns: 1fr 1fr 1fr;
}

.feed-skeleton-grid--halves {
  grid-template-columns: 1fr 1fr;
}

.feed-skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(250, 246, 238, 0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .feed-skeleton::after {
    animation: none;
    opacity: 0;
  }
}

/* --- Bulk select overlay --- */

.feed-item__checkbox {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  width: 28px;
  height: 28px;
  display: none;
}

.feed-item__checkbox input[type="checkbox"] {
  width: 28px;
  height: 28px;
  accent-color: var(--color-red);
  cursor: pointer;
}

.bulk-select-active .feed-item__checkbox {
  display: block;
}

.bulk-select-active .feed-item__grail {
  display: none;
}

/* ==========================================================================
   Options Modal — Full-screen dark overlay
   ========================================================================== */

.collection-options {
  position: fixed;
  inset: 0;
  background: rgba(26, 13, 8, 0.95);
  z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal, 400ms) var(--ease-brand, cubic-bezier(0.22, 1, 0.36, 1)),
              visibility var(--duration-normal, 400ms);
}

.collection-options--open {
  opacity: 1;
  visibility: visible;
}

.collection-options__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(250, 246, 238, 0.08);
}

.collection-options__title {
  font-family: var(--font-display, 'Bebas Neue', Impact, sans-serif);
  font-size: 20px;
  letter-spacing: 0.08em;
  color: var(--color-ivory);
  margin: 0;
}

.collection-options__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  border: 1.5px solid rgba(250, 246, 238, 0.15);
  background: none;
  color: var(--color-ivory);
  font-size: 18px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.collection-options__body {
  padding: 20px 20px calc(80px + env(safe-area-inset-bottom, 0px));
}

.collection-options__section-label {
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-amber, #E8960C);
  margin-bottom: 12px;
}

/* --- View mode picker --- */

.collection-options__view-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.collection-options__view-option {
  border: 1.5px solid rgba(250, 246, 238, 0.12);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.collection-options__view-option--active {
  border-color: var(--color-amber, #E8960C);
  background: rgba(232, 150, 12, 0.08);
}

.collection-options__view-thumb {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.collection-options__view-thumb-block {
  height: 12px;
  background: rgba(250, 246, 238, 0.08);
  border-radius: 1px;
}

.collection-options__view-option--active .collection-options__view-thumb-block {
  background: rgba(250, 246, 238, 0.12);
}

.collection-options__view-thumb-block--tall {
  height: 28px;
}

.collection-options__view-thumb-block--medium {
  height: 20px;
}

.collection-options__view-thumb-block--short {
  height: 18px;
}

.collection-options__view-thumb-divider {
  height: 1px;
  background: rgba(250, 246, 238, 0.06);
}

.collection-options__view-thumb-grid {
  display: grid;
  gap: 2px;
}

.collection-options__view-thumb-grid--2col {
  grid-template-columns: 1fr 1fr;
}

.collection-options__view-thumb-grid--3col {
  grid-template-columns: 1fr 1fr 1fr;
}

.collection-options__view-label {
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(250, 246, 238, 0.5);
}

.collection-options__view-option--active .collection-options__view-label {
  color: var(--color-amber, #E8960C);
  font-weight: 600;
}

/* --- Sort options --- */

.collection-options__sort-list {
  margin-bottom: 24px;
}

.collection-options__sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(250, 246, 238, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
}

.collection-options__sort-label {
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 14px;
  color: rgba(250, 246, 238, 0.6);
}

.collection-options__sort-option--active .collection-options__sort-label {
  color: var(--color-ivory);
  font-weight: 500;
}

.collection-options__radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(250, 246, 238, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.collection-options__sort-option--active .collection-options__radio {
  border-color: var(--color-amber, #E8960C);
}

.collection-options__radio-fill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
}

.collection-options__sort-option--active .collection-options__radio-fill {
  background: var(--color-amber, #E8960C);
}

/* --- Category filter chips --- */

.collection-options__category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.collection-options__category-chip {
  padding: 8px 14px;
  border-radius: 20px;
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 12px;
  font-weight: 500;
  color: rgba(250, 246, 238, 0.5);
  border: 1px solid rgba(250, 246, 238, 0.1);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.collection-options__category-chip--active {
  color: var(--color-ivory);
  border-color: rgba(250, 246, 238, 0.2);
  background: rgba(250, 246, 238, 0.1);
  font-weight: 600;
}

/* --- Search --- */

.collection-options__search-wrap {
  position: relative;
  margin-bottom: 24px;
}

.collection-options__search {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px 12px 40px;
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 14px;
  background: rgba(250, 246, 238, 0.06);
  border: 1.5px solid rgba(250, 246, 238, 0.12);
  border-radius: 6px;
  color: var(--color-ivory);
  outline: none;
}

.collection-options__search:focus {
  border-color: rgba(250, 246, 238, 0.25);
}

.collection-options__search::placeholder {
  color: rgba(250, 246, 238, 0.3);
}

.collection-options__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* --- Action rows --- */

.collection-options__action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(250, 246, 238, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
}

.collection-options__action:last-child {
  border-bottom: none;
}

.collection-options__action-icon {
  flex-shrink: 0;
}

.collection-options__action-label {
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 14px;
  color: rgba(250, 246, 238, 0.6);
}

/* ==========================================================================
   Search Bar — Drop-down under header
   ========================================================================== */

.search-bar {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity var(--duration-fast, 120ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
              transform var(--duration-medium, 250ms) var(--ease-brand, cubic-bezier(0.22, 1, 0.36, 1));
}

.search-bar--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.search-bar__backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.search-bar__inner {
  background: rgba(250, 246, 238, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 12px;
  border-bottom: 1.5px solid rgba(26, 13, 8, 0.08);
}

.search-bar__form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar__icon {
  position: absolute;
  left: 10px;
  pointer-events: none;
  z-index: 1;
}

.search-bar__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 80px 10px 32px;
  font-family: var(--font-body, 'Sora', sans-serif);
  font-size: 15px;
  background: rgba(26, 13, 8, 0.04);
  border: 1.5px solid rgba(26, 13, 8, 0.12);
  border-radius: 8px;
  color: var(--color-ink);
  outline: none;
}

.search-bar__input:focus {
  border-color: rgba(26, 13, 8, 0.25);
}

.search-bar__input::placeholder {
  color: var(--color-ink-muted);
}

.search-bar__clear {
  position: absolute;
  right: 40px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26, 13, 8, 0.08);
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.search-bar__clear--visible {
  display: flex;
}

.search-bar__go {
  position: absolute;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--color-ink);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* --- Active search indicator dot on header icon --- */

.app-header__action--has-dot {
  position: relative;
}

.app-header__action-close {
  display: none;
}

.app-header__search-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--color-red);
  border-radius: 50%;
  border: 1.5px solid var(--color-ivory, #FAF6EE);
  display: none;
}

.app-header__search-dot--active {
  display: block;
}
