/*
 * 참여(engagement) 모듈 겉모습 — 앱 `ka-app` engagement_theme.dart 에 해당한다.
 *
 * 값을 변수로 빼 두는 이유: 참여 UI 안쪽은 어디서든 같지만 그것이 놓이는 면은 기능이
 * 정하기 때문이다. 캘린더가 이 모듈을 쓰게 될 때 자기 색을 입히는 자리가 여기다 —
 * `.eng-root` 를 감싼 쪽에서 변수만 덮어쓰면 된다.
 */
.eng-root {
    --eng-accent:        #5E76E6;
    --eng-text:          #212529;
    --eng-text-muted:    #868e96;
    --eng-text-faint:    #999;
    --eng-border:        #ededed;
    --eng-border-strong: #a9a9a9;
    --eng-surface:       #fff;
    --eng-surface-sunk:  rgba(240, 240, 240, 0.3);
    --eng-radius:        3px;

    /* 앱과 같은 크기 — 뿌리 34, 답글 28. 메달은 사진의 46%. */
    --eng-avatar:        34px;
    --eng-medal:         16px;
    --eng-indent:        39px;   /* 답글을 사진 너비만큼 들여쓴다 (34 + 5) */
}

/* ── 입력창 ─────────────────────────────────────────────── */
.eng-compose {
    border: solid 1px var(--eng-border-strong);
    border-radius: var(--eng-radius);
}

.eng-compose textarea,
.eng-modal textarea {
    width: 100%;
    min-height: 60px;
    border: none;
    background: none;
    resize: none;
    font-size: 15px;
    color: var(--eng-text);
}

.eng-compose textarea:focus,
.eng-modal textarea:focus {
    outline: none;
    box-shadow: none;
}

.eng-compose-foot {
    border-top: solid 1px var(--eng-border);
}

.eng-count {
    font-size: 13px;
    color: var(--eng-text-faint);
}

.eng-submit {
    background-color: var(--eng-accent);
    color: #fff;
    opacity: .7;
}

.eng-submit:not(:disabled):hover,
.eng-submit.is-active {
    opacity: 1;
    color: #fff;
}

.eng-submit:disabled {
    cursor: default;
}

/* 로그인 전 입력창 — 눌리는 자리로 보이되 글은 못 쓰게 한다. */
.eng-compose.is-locked {
    cursor: pointer;
}

.eng-compose.is-locked textarea {
    pointer-events: none;
    background: none;
}

/* ── 퀵 이모지 ──────────────────────────────────────────── */
/*
 * 좁은 화면에서는 이모지가 줄을 넘어 잘린다. 끝을 흐리게 해 더 있다는 것을 알린다 —
 * 잘린 자리가 딱 떨어져 보이면 그것이 전부인 줄 안다.
 *
 * 켜고 끄는 것은 engagement-comments.js 의 `v-eng-fade` 가 한다. 끝에 닿으면 그쪽을
 * 끄므로, 다 본 뒤에도 마지막 이모지가 흐린 채로 남지 않는다.
 */
.eng-emoji-wrap {
    position: relative;
}

.eng-emoji-wrap::before,
.eng-emoji-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;   /* 흐림 위로도 이모지가 눌려야 한다 */
    opacity: 0;
    transition: opacity .15s ease;
}

.eng-emoji-wrap::before {
    left: 0;
    background: linear-gradient(to right, var(--eng-surface), transparent);
}

.eng-emoji-wrap::after {
    right: 0;
    background: linear-gradient(to left, var(--eng-surface), transparent);
}

.eng-emoji-wrap.has-more-left::before,
.eng-emoji-wrap.has-more-right::after {
    opacity: 1;
}

.eng-emoji-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.eng-emoji-row::-webkit-scrollbar {
    display: none;
}

.eng-emoji {
    flex: 0 0 auto;
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    padding: 4px 5px;
    cursor: pointer;
    border-radius: var(--eng-radius);
}

.eng-emoji:hover {
    background: var(--eng-surface-sunk);
}

/* ── 목록 ───────────────────────────────────────────────── */
.eng-item {
    display: flex;
    padding: 15px 0 10px;
    border-bottom: 1px solid var(--eng-border);
}

.eng-avatar {
    position: relative;
    flex: 0 0 var(--eng-avatar);
    width: var(--eng-avatar);
    height: var(--eng-avatar);
    margin-right: 5px;
}

.eng-avatar > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: #f1f3f5;
}

.eng-body {
    width: calc(100% - var(--eng-avatar) - 5px);
    padding-left: 8px;
}

.eng-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--eng-text);
}

.eng-time {
    font-size: 11px;
    color: var(--eng-text-faint);
}

/*
 * 등급 메달 — 프로필 사진 오른쪽 아래.
 *
 * 원 밖으로 조금 나가야 사진을 덜 가린다. 테두리를 흰 그림자로 두르는 이유는 어두운
 * 프로필 사진 위에서 메달이 묻히기 때문이다. (앱 _GradeMark 와 같은 규칙)
 *
 * badge_url 이 주소면 그림을, 아니면 글자 그대로 그린다 — 뱃지 이미지를 만들기 전에도
 * 이모지 한 자로 운영할 수 있다.
 */
.eng-grade {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--eng-medal);
    height: var(--eng-medal);
    border-radius: 50%;
    background: var(--eng-surface);
    box-shadow: 0 0 0 1.5px var(--eng-surface);
    font-size: calc(var(--eng-medal) * 0.66);
    line-height: 1;
    overflow: hidden;
}

.eng-grade > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.eng-text {
    font-weight: 400;
    font-size: 15px;
    line-height: 1.5;
    color: var(--eng-text);
    white-space: pre-line;
    word-wrap: break-word;
    text-align: justify;
}

/* 접힌 상태 — 네 줄까지만 보인다. 넘치는지는 JS 가 실제 높이로 판단한다. */
.eng-text.is-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.eng-text.is-deleted {
    color: var(--eng-text-muted);
    font-style: italic;
}

.eng-more {
    color: var(--eng-text-faint);
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
}

.eng-meta {
    display: flex;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
}

.eng-meta-btn {
    cursor: pointer;
    color: var(--eng-text);
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
}

.eng-like {
    display: flex;
    align-items: center;
    margin-left: auto;
    cursor: pointer;
    color: var(--eng-text);
}

.eng-like.is-on {
    color: var(--eng-accent);
}

.eng-like img {
    width: 12px;
    height: 12px;
    margin: 0 1px;
}

/*
 * 댓글에 붙은 그림 — 앱에서 올린 것을 보여 준다(웹은 올리지 못한다).
 *
 * 한 장이면 원본 비율 그대로, 여러 장이면 정사각 타일을 옆으로 늘어놓는다. 비율이
 * 제각각인 그림을 나란히 두려면 칸을 고르게 맞춰야 줄이 들쭉날쭉해지지 않는다 —
 * 원본 비율은 눌러서 크게 볼 때 지킨다. (앱 _MediaStrip 과 같은 규칙)
 */
.eng-media {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.eng-media::-webkit-scrollbar {
    display: none;
}

.eng-media-item {
    flex: 0 0 auto;
    display: block;
    width: 148px;
    height: 148px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--eng-surface-sunk);
}

.eng-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 한 장뿐이면 자르지 않는다 — 자를 이유가 줄맞춤인데, 맞출 상대가 없다. */
.eng-media.is-single .eng-media-item {
    width: auto;
    height: auto;
    max-width: min(100%, 320px);
    max-height: 320px;
}

.eng-media.is-single .eng-media-item img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
}

/* ── 답글 ───────────────────────────────────────────────── */
.eng-replies {
    background-color: var(--eng-surface-sunk);
}

.eng-reply {
    display: flex;
    padding-left: var(--eng-indent);
}

/* 답글은 사진과 메달을 한 치수 줄인다 — 뿌리와 같은 크기면 어느 쪽이 답인지 흐려진다. */
.eng-reply .eng-item {
    --eng-avatar: 28px;
    --eng-medal:  13px;
}

.eng-reply-to {
    color: var(--eng-accent);
    font-weight: 500;
}

/* ── 더보기·빈 상태 ─────────────────────────────────────── */
.eng-more-row {
    text-align: center;
    padding: 8px 0;
}

.eng-more-row a {
    color: var(--eng-text);
    cursor: pointer;
}

.eng-empty {
    text-align: center;
    padding: 28px 0;
    font-size: 16px;
    color: var(--eng-text-muted);
}

/* ── 신고 사유 ──────────────────────────────────────────── */
.eng-reason {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    padding: 13px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--eng-text);
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--eng-border);
}

.eng-reason:last-of-type {
    border-bottom: none;
}

.eng-reason:hover {
    background: var(--eng-surface-sunk);
}

.eng-reason i {
    margin-left: auto;
    color: var(--eng-text-muted);
}

.eng-reason-note {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--eng-text-muted);
    text-align: center;
}
