/* ============================================================================
   COMPONENT: documents — team file library rows (folder / file).
   ========================================================================== */

@layer components {
  .documents-crumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }

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

  .documents-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    min-block-size: var(--touch-target);
  }
  .documents-list > li + li { border-block-start: var(--border-width) solid var(--color-border); }

  .documents-row__main {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1 1 12rem;
    min-inline-size: 0;
    color: inherit;
    text-decoration: none;
  }
  .documents-row__body { display: flex; flex-direction: column; min-inline-size: 0; }
  .documents-row__title { font-weight: var(--weight-semibold); overflow-wrap: anywhere; }

  .documents-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xs);
    margin-inline-start: auto;
  }
  .documents-row__action {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--touch-target);
    padding-inline: var(--space-sm);
    background: none;
    border: 0;
    color: var(--accent);
    font: inherit;
    font-weight: var(--weight-medium);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
  }
  .documents-row__action:hover { color: var(--accent-hover); }
  .documents-row__action:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

  .documents-actions { margin-block-start: var(--space-md); }

  /* In-app preview: keep Close in the toolbar so a homescreen PWA can leave. */
  .document-preview {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }

  .document-preview__toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
  }

  .document-preview__heading { min-inline-size: 0; flex: 1 1 auto; }
  .document-preview__title {
    margin: 0;
    flex: 1 1 auto;
    min-inline-size: 0;
    font-size: var(--text-lg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .document-preview__stage {
    background: var(--surface-sunken);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .document-preview__image {
    display: block;
    max-inline-size: 100%;
    max-block-size: 60vh;
    margin-inline: auto;
  }

  .document-preview__frame {
    display: block;
    inline-size: 100%;
    block-size: 60vh;
    border: 0;
    background: var(--surface);
  }

  .document-preview__download { margin: 0; }

  .document-preview-sheet {
    max-block-size: 92dvh;
  }
  .document-preview-sheet .sheet__body {
    min-block-size: 0;
    overflow: auto;
  }
  .document-preview-sheet .document-preview__title {
    font-size: var(--text-md);
  }
}
