/* Metadata drawer (plan §33) — a focus-trapped dialog, full-width sheet on
 * mobile. Markup uses role="dialog" aria-modal="true"; JS (drawer.js) owns
 * focus trapping/return, this file only owns presentation.
 */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-drawer-overlay);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: var(--surf);
  border-left: 1px solid var(--brd2);
  z-index: var(--z-drawer);
  overflow-y: auto;
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  background: var(--surf);
  z-index: 1;
  gap: var(--space-3);
}

.drawer__title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.drawer__filename {
  font-size: var(--text-xs);
  color: var(--t4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer__close {
  background: var(--surf2);
  border: 1px solid var(--brd);
  color: var(--t3);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  flex-shrink: 0;
}

.drawer__close:hover {
  color: var(--text);
}

.drawer__body {
  padding: var(--space-4) var(--space-5);
}

/* Larger local-only image preview (Feature 2B) — same object-URL source as
   the file-row thumbnail, just bigger. No filesystem path is ever involved:
   this <img> src is always a blob: URL created client-side. */
.drawer__preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  background: var(--surf2);
  border: 1px solid var(--brd);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.drawer__preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}

.drawer__preview-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer__preview-meta {
  font-size: var(--text-xs);
  color: var(--t3);
  margin-bottom: var(--space-4);
}

.drawer__advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border: 1px solid var(--brd);
  border-radius: var(--radius-md);
  color: var(--t2);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.drawer__advanced-toggle:hover {
  color: var(--text);
  border-color: var(--brd2);
}

.metadata-group {
  margin-bottom: var(--space-4);
}

.metadata-group__title {
  font-size: 10px;
  font-weight: 700;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--space-2);
}

.metadata-group__list {
  display: flex;
  flex-direction: column;
}

.metadata-field {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--brd);
}

.metadata-field__label {
  font-size: var(--text-xs);
  color: var(--t3);
  flex-shrink: 0;
}

.metadata-field__value {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.metadata-field[data-sensitivity='sensitive'] .metadata-field__value {
  color: var(--err);
}

.metadata-field[data-sensitivity='notable'] .metadata-field__value {
  color: var(--warn);
}

.metadata-empty {
  text-align: center;
  color: var(--t4);
  font-size: var(--text-sm);
  padding: var(--space-5) 0;
}

.raw-tags {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--t3);
  background: var(--surf2);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .drawer {
    width: 100%;
  }
}
