// Name:            Comment
// Description:     Component to create nested comments
//
// Component:       `ui-comment`
//
// Sub-objects:     `ui-comment-body`
//                  `ui-comment-header`
//                  `ui-comment-title`
//                  `ui-comment-meta`
//                  `ui-comment-avatar`
//                  `ui-comment-list`
//
// Modifier:        `ui-comment-primary`
//
// ========================================================================


// Variables
// ========================================================================

@comment-header-margin-bottom:                  @global-margin;

@comment-title-font-size:                       @global-medium-font-size;
@comment-title-line-height:                     1.4;

@comment-meta-font-size:                        @global-small-font-size;
@comment-meta-line-height:                      1.4;
@comment-meta-color:                            @global-muted-color;

@comment-list-margin-top:                       @global-large-margin;
@comment-list-padding-left:                     30px;
@comment-list-padding-left-m:                   100px;


/* ========================================================================
   Component: Comment
 ========================================================================== */

.ui-comment {
    .hook-comment;
}


/* Sections
 ========================================================================== */

.ui-comment-body {
    overflow-wrap: break-word;
    word-wrap: break-word;
    .hook-comment-body;
}

.ui-comment-header {
    margin-bottom: @comment-header-margin-bottom;
    .hook-comment-header;
}

/*
 * Micro clearfix
 */

.ui-comment-body::before,
.ui-comment-body::after,
.ui-comment-header::before,
.ui-comment-header::after {
    content: "";
    display: table;
}

.ui-comment-body::after,
.ui-comment-header::after { clear: both; }

/*
 * Remove margin from the last-child
 */

.ui-comment-body > :last-child,
.ui-comment-header > :last-child { margin-bottom: 0; }


/* Title
 ========================================================================== */

.ui-comment-title {
    font-size: @comment-title-font-size;
    line-height: @comment-title-line-height;
    .hook-comment-title;
}


/* Meta
 ========================================================================== */

.ui-comment-meta {
    font-size: @comment-meta-font-size;
    line-height: @comment-meta-line-height;
    color: @comment-meta-color;
    .hook-comment-meta;
}


/* Avatar
 ========================================================================== */

.ui-comment-avatar {
    .hook-comment-avatar;
}


/* List
 ========================================================================== */

.ui-comment-list {
    padding: 0;
    list-style: none;
}

/* Adjacent siblings */
.ui-comment-list > :nth-child(n+2) {
    margin-top: @comment-list-margin-top;
    .hook-comment-list-adjacent;
}

/*
 * Sublists
 * Note: General sibling selector allows reply block between comment and sublist
 */

.ui-comment-list .ui-comment ~ ul {
    margin: @comment-list-margin-top 0 0 0;
    padding-left: @comment-list-padding-left;
    list-style: none;
    .hook-comment-list-sub;
}

/* Tablet and bigger */
@media (min-width: @breakpoint-medium) {

    .ui-comment-list .ui-comment ~ ul { padding-left: @comment-list-padding-left-m; }

}

/* Adjacent siblings */
.ui-comment-list .ui-comment ~ ul > :nth-child(n+2) {
    margin-top: @comment-list-margin-top;
    .hook-comment-list-sub-adjacent;
}


/* Style modifier
 ========================================================================== */

.ui-comment-primary {
    .hook-comment-primary;
}


// Hooks
// ========================================================================

.hook-comment-misc;

.hook-comment() {}
.hook-comment-body() {}
.hook-comment-header() {}
.hook-comment-title() {}
.hook-comment-meta() {}
.hook-comment-avatar() {}
.hook-comment-list-adjacent() {}
.hook-comment-list-sub() {}
.hook-comment-list-sub-adjacent() {}
.hook-comment-primary() {}
.hook-comment-misc() {}
