/* Edited gallery. Selectors are .eg-* so the RAW file list is unchanged.
   Phone layout that moves the rail is scoped to .is-edited. */

.eg-addbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.8rem 0.7rem 1rem;
  border: 1.5px dashed var(--blush-deep);
  border-radius: 16px;
  background: var(--paper);
}
.eg-addbar .drop-icon { margin: 0; width: 26px; height: 26px; flex: 0 0 auto; }
.eg-addbar-copy { display: grid; gap: 0.05rem; min-width: 0; flex: 1; }
.eg-addbar-copy strong { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; letter-spacing: -0.02em; }
.eg-addbar-copy span { color: var(--muted); font-size: 0.88rem; }
.eg-addbar .eg-browse { border-color: var(--line); }
.eg-addbar .button { min-height: 40px; padding: 0.35rem 1rem; }
.eg-addbar.is-over { background: color-mix(in srgb, var(--blush) 35%, var(--paper)); }

.eg-toolbar {
  position: sticky;
  top: 66px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin: 1rem 0 0.75rem;
  padding: 0.55rem 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(6px);
}
.eg-count { margin: 0; color: var(--muted); font-size: 0.95rem; }
.eg-count strong { color: var(--ink); font-weight: 500; }
.eg-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.eg-sort {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 40px; padding: 0 0.4rem 0 0.95rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--muted); font-size: 0.92rem;
}
.eg-sort select {
  width: auto; min-height: 0; border-radius: 0; font-size: 0.92rem;
  border: 0; background: transparent; font: inherit; color: var(--ink); font-weight: 500;
  padding: 0.3rem 0.4rem; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.eg-sort .chev { color: var(--muted); }
.eg-select-btn {
  min-height: 40px; padding: 0.3rem 1rem; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font: inherit; font-weight: 500;
}
.eg-select-btn.is-on { background: var(--charcoal); border-color: var(--charcoal); color: var(--paper); }
.eg-view.segment button { min-height: 32px; padding: 0.2rem 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.eg-view svg { display: block; }

.eg-grid { display: grid; gap: 8px; }
.eg-row { display: flex; gap: 8px; }
.eg-tile {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(165deg, #e4d2cc 0%, #cbb4b4 48%, #b7a3a6 100%);
  box-shadow: 0 8px 22px rgba(54, 57, 64, 0.06);
}
.eg-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.eg-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 320ms ease; }
.eg-tile:hover .eg-open img, .eg-tile.is-hover .eg-open img { transform: scale(1.015); }
.eg-tile.is-loading,
.eg-tile.is-pending { background: var(--paper); border: 1px solid var(--line); box-shadow: none; }
.eg-tile.is-loading::after,
.eg-tile.is-pending::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(237, 187, 190, 0.28) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: eg-shimmer 1.4s ease-in-out infinite;
}
@keyframes eg-shimmer { from { background-position: 120% 0; } to { background-position: -40% 0; } }

.eg-shade {
  position: absolute; inset: auto 0 0 0; height: 56%;
  background: linear-gradient(to top, rgba(28, 25, 23, 0.62), rgba(28, 25, 23, 0));
  opacity: 0; transition: opacity var(--ease); pointer-events: none;
}
.eg-cap {
  position: absolute; left: 0.75rem; right: 3rem; bottom: 0.6rem;
  color: #fff; font-size: 0.84rem; font-weight: 500; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity var(--ease); pointer-events: none;
}
.eg-cap small { display: block; font-weight: 400; opacity: 0.82; font-size: 0.76rem; }
.eg-more {
  position: absolute; right: 0.45rem; bottom: 0.45rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 999px;
  background: rgba(247, 243, 238, 0.94); color: var(--ink);
  opacity: 0; transition: opacity var(--ease);
}
.files .eg-more { position: static; opacity: 1; width: 40px; height: 40px; background: transparent; }
.eg-tile:hover .eg-shade, .eg-tile:hover .eg-cap, .eg-tile:hover .eg-more,
.eg-tile.is-hover .eg-shade, .eg-tile.is-hover .eg-cap, .eg-tile.is-hover .eg-more,
.eg-tile:focus-within .eg-shade, .eg-tile:focus-within .eg-cap, .eg-tile:focus-within .eg-more { opacity: 1; }
.eg-tile .file-menu { top: auto; bottom: 2.9rem; right: 0.45rem; min-width: 190px; }
.eg-tile:has(.file-menu:not([hidden])) { overflow: visible; z-index: 9; }
.eg-tile:has(.file-menu:not([hidden])) .eg-open { border-radius: 12px; overflow: hidden; }
.file-menu .danger, .text.danger { color: #8d3d3d; }
.file-menu hr { border: 0; border-top: 1px solid var(--line); margin: 0.25rem 0.4rem; }

.eg-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 999px;
  background: rgba(247, 243, 238, 0.92); color: var(--charcoal);
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.22); pointer-events: none;
}
.eg-dur {
  position: absolute; left: 0.55rem; top: 0.55rem;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  background: rgba(28, 25, 23, 0.62); color: #fff;
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.eg-check {
  position: absolute; left: 0.55rem; top: 0.55rem; z-index: 2;
  display: none; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px;
  border: 1.5px solid #fff; background: rgba(28, 25, 23, 0.25);
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.18); color: transparent;
}
.is-selecting .eg-check { display: inline-flex; }
.is-selecting .eg-open { cursor: pointer; }
.is-selecting .eg-tile .eg-more, .is-selecting .eg-tile .eg-shade, .is-selecting .eg-tile .eg-cap { display: none; }
.is-selecting .eg-dur { left: auto; right: 0.55rem; }
.eg-tile.is-picked { box-shadow: 0 0 0 3px var(--blush-deep), 0 8px 22px rgba(54, 57, 64, 0.1); background: color-mix(in srgb, var(--blush) 40%, #fff); }
.eg-tile.is-picked .eg-open img { transform: scale(0.94); border-radius: 8px; }
.eg-tile.is-picked .eg-check { background: var(--blush-deep); border-color: var(--blush-deep); color: #fff; }
.is-selecting .file.is-picked { box-shadow: 0 0 0 3px var(--blush-deep); }
.files .eg-check { position: static; display: none; flex: 0 0 auto; margin-right: 0.15rem; }
.is-selecting .files .eg-check { display: inline-flex; color: transparent; border-color: var(--line); background: #fff; }
.is-selecting .file.is-picked .eg-check { background: var(--blush-deep); border-color: var(--blush-deep); color: #fff; }

.eg-selectbar {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.5rem 0.45rem 1.25rem;
  border-radius: 999px; background: var(--charcoal); color: var(--paper);
  box-shadow: 0 18px 46px rgba(28, 25, 23, 0.28);
  white-space: nowrap; max-width: calc(100vw - 1.5rem);
}
.eg-selectbar strong { font-weight: 500; margin-right: 0.35rem; }
.eg-selectbar .size { color: rgba(247, 243, 238, 0.7); font-size: 0.9rem; margin-right: 0.6rem; }
.eg-selectbar button {
  min-height: 38px; padding: 0.3rem 0.95rem; border-radius: 999px; border: 0;
  background: transparent; color: var(--paper); font: inherit; font-weight: 500;
}
.eg-selectbar button.primary-lite { background: var(--paper); color: var(--charcoal); }
.eg-selectbar button.danger { color: #f3c2c4; }
.eg-selectbar button.close { width: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: rgba(247, 243, 238, 0.75); }

.eg-more-note { margin: 1.1rem 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.eg-removed-link-row { margin: 0.2rem 0 0.8rem; }
.eg-removed-link {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.9rem;
  text-decoration: underline; text-underline-offset: 0.18em; padding: 0;
}
.eg-bin-head { display: grid; gap: 0.25rem; margin: 0.4rem 0 1rem; }
.eg-bin-head h2 { margin: 0; font-size: 1.6rem; }
.eg-bin-head p { margin: 0; color: var(--muted); }
.eg-bin .file { align-items: center; gap: 0.6rem; }
.eg-bin .file-open { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.eg-bin .text { flex: 0 0 auto; }

.eg-empty { text-align: center; padding: 2.4rem 1.7rem 2.2rem; }
.eg-ghosts { display: flex; justify-content: center; gap: 10px; margin: 0 auto 1.4rem; }
.eg-ghosts i { display: block; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--blush-deep) 55%, var(--line)); background: var(--paper); }
.eg-empty h2 { font-size: 1.9rem; margin: 0 0 0.45rem; }
.eg-empty p { margin: 0 auto; max-width: 30rem; color: var(--muted); }
.eg-empty .eg-ctas { display: flex; justify-content: center; align-items: center; gap: 0.6rem; margin-top: 1.3rem; flex-wrap: wrap; }
.eg-empty .eg-ctas form { margin: 0; }
.eg-empty .fine { margin-top: 1.05rem; font-size: 0.86rem; color: var(--muted); }
.eg-empty-drop { margin-top: 1.4rem; }
.eg-empty-drop label.dropzone { min-height: 150px; }

.eg-lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: auto 1fr auto;
  background: rgba(22, 20, 18, 0.96); color: var(--paper);
}
.eg-lb-bar { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.25rem; }
.eg-lb-id { display: grid; gap: 0.05rem; min-width: 0; flex: 1; }
.eg-lb-id h2 { font-size: 1.35rem; color: var(--paper); margin: 0; }
.eg-lb-id span { color: rgba(247, 243, 238, 0.62); font-size: 0.88rem; }
.eg-lb-count { color: rgba(247, 243, 238, 0.78); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.eg-lb-actions { position: relative; display: flex; align-items: center; gap: 0.5rem; flex: 1; justify-content: flex-end; }
.eg-lb-actions .button.light { min-height: 40px; padding: 0.35rem 1.05rem; background: var(--paper); color: var(--charcoal); border-color: var(--paper); gap: 0.45rem; }
.eg-lb-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid rgba(247, 243, 238, 0.22);
  background: transparent; color: var(--paper);
}
.eg-lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 5.5rem; }
.eg-lb-stage img, .eg-lb-stage video {
  display: block; max-width: 100%; max-height: calc(100vh - 150px);
  border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); background: #000;
}
.eg-lightbox.is-highlight .eg-lb-bar { flex-wrap: wrap; align-items: flex-start; }
.eg-lightbox.is-highlight .eg-lb-actions { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; }
.eg-lightbox.is-highlight .eg-lb-actions .button.light { min-height: 36px; padding: 0.3rem 0.75rem; font-size: 0.86rem; }
.eg-lb-photo { position: relative; display: grid; place-items: center; max-width: 100%; max-height: calc(100vh - 150px); }
.eg-lb-blur {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: blur(18px); transform: scale(1.08); opacity: 0.9;
}
.eg-lb-photo:has(.eg-lb-full[data-ready="1"]) .eg-lb-blur { opacity: 0; }
.eg-lightbox.is-highlight .eg-lb-full {
  position: relative; width: auto; height: auto;
  max-width: 100%; max-height: calc(100vh - 150px);
  object-fit: contain; background: transparent;
}
.eg-lb-nav:disabled { opacity: 0.28; }
@media (max-width: 720px) {
  .eg-lightbox.is-highlight .eg-lb-nav { display: inline-flex; width: 40px; height: 40px; }
  .eg-lightbox.is-highlight .eg-lb-nav.prev { left: 0.4rem; }
  .eg-lightbox.is-highlight .eg-lb-nav.next { right: 0.4rem; }
}
.eg-lb-stage.is-zoomed { overflow: auto; align-items: start; }
.eg-lb-stage.is-zoomed img { max-height: none; max-width: none; cursor: zoom-out; }
.eg-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 999px; border: 1px solid rgba(247, 243, 238, 0.22);
  background: rgba(247, 243, 238, 0.08); color: var(--paper);
}
.eg-lb-nav.prev { left: 1.25rem; }
.eg-lb-nav.next { right: 1.25rem; }
.eg-lb-foot { display: flex; justify-content: center; gap: 1.4rem; padding: 0.7rem 1rem 1rem; color: rgba(247, 243, 238, 0.55); font-size: 0.84rem; flex-wrap: wrap; }
.eg-lb-foot kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.45rem;
  margin-right: 0.3rem; padding: 0 0.35rem; border-radius: 6px;
  border: 1px solid rgba(247, 243, 238, 0.25); color: rgba(247, 243, 238, 0.85);
  font: 500 0.75rem var(--sans);
}
.eg-lb-menu { right: 3.2rem; top: 2.6rem; background: var(--paper); color: var(--ink); }
.eg-lb-wait { color: rgba(247, 243, 238, 0.7); }
body.eg-open { overflow: hidden; }

.is-edited.is-page-drag .eg-addbar { background: color-mix(in srgb, var(--blush) 35%, var(--paper)); }

@media (max-width: 720px) {
  .is-edited .vault-actions .button.outline { display: none; }
  .is-edited .rail { order: 1; }
  .eg-addbar .eg-addbar-copy span { display: none; }
  .eg-toolbar { top: 60px; gap: 0.5rem; }
  .eg-count { width: 100%; font-size: 0.9rem; }
  .eg-tools { width: 100%; justify-content: space-between; gap: 0.4rem; }
  .eg-sort { padding-left: 0.75rem; font-size: 0.86rem; }
  .eg-sort .lbl { display: none; }
  .eg-view.segment button span { display: none; }
  .eg-grid.is-mobile { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .eg-grid.is-mobile .eg-row { display: contents; }
  .eg-grid.is-mobile .eg-tile { aspect-ratio: 1 / 1; width: auto !important; height: auto !important; border-radius: 4px; box-shadow: none; }
  .eg-grid.is-mobile .eg-play { width: 32px; height: 32px; }
  .eg-grid.is-mobile .eg-play svg { width: 12px; height: 12px; }
  .eg-grid.is-mobile .eg-dur { left: auto; right: 0.3rem; top: auto; bottom: 0.3rem; font-size: 0.68rem; padding: 0 0.4rem; }
  .eg-lb-stage { padding: 0 0.6rem; }
  .eg-lb-nav { display: none; }
  .eg-lb-bar { padding: 0.7rem 0.8rem; gap: 0.5rem; }
  .eg-lb-actions .button.light span, .eg-lb-id h2 { font-size: 1rem; }
  .eg-selectbar { white-space: normal; flex-wrap: wrap; justify-content: center; border-radius: 18px; }
}
