/* mentions: styles for this feature. Uses the tokens in /app.css. */

/* Mention links in posts, comments, lessons and the editor */
.rich a.mention, a.mention { display: inline; padding: 1px 3px; margin: 0 -3px; border-radius: 5px; background: var(--tint); color: var(--blue); font-weight: 700; line-height: inherit; text-decoration: none; transition: background-color var(--dur-1), color var(--dur-1); }
.rich a.mention:hover, a.mention:hover { background: var(--pale, #ccecff); color: var(--deep); text-decoration: none; }
.rich a.mention:focus-visible { outline: none; box-shadow: var(--focus); }
.rte-area a.mention { cursor: default; user-select: all; }

/* The member picker */
.mention-picker { position: fixed; z-index: 1000; width: 288px; max-height: 296px; overflow-y: auto; padding: 6px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-3); font-family: Lato, system-ui, sans-serif; font-size: 15px; line-height: 1.35; animation: mention-in var(--dur-1) var(--ease-out) both; overscroll-behavior: contain; }
.mention-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; line-height: 1.35; text-align: left; cursor: pointer; transition: background-color var(--dur-1); }
.mention-option .avatar { width: 30px; height: 30px; font-size: 12px; }
.mention-option span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--deep); }
.mention-option:hover { background: var(--sunken); }
.mention-option[aria-selected="true"] { background: var(--tint); box-shadow: inset 0 0 0 1px rgba(80, 148, 176, .28); }
.mention-empty { margin: 0; padding: 10px 12px; color: var(--muted); font-size: 14px; line-height: 1.4; }
@keyframes mention-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Comment composer: tools row with the photo button and the post button */
.composer.has-tools { gap: 10px; }
.composer-tools { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.composer-tools .btn { margin-left: auto; }
.composer.has-tools .composer-tools .btn { justify-self: auto; }
/* Editing a comment: Cancel and Save sit together on the right */
.composer-tools .btn + .btn { margin-left: 0; }
@media (max-width: 420px) { .edit-comment .ctool-hint { display: none; } }
.ctool { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; transition: background-color var(--dur-1), color var(--dur-1); }
.ctool:hover:not(:disabled) { background: var(--sunken); color: var(--blue); }
.ctool:focus-visible { outline: none; box-shadow: var(--focus); }
.ctool:disabled { opacity: .4; cursor: default; }
.ctool-hint { color: var(--ink-4, var(--muted)); font-size: 13px; line-height: 1.4; }

/* Photos waiting to be posted */
.cphotos { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cphoto { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); animation: mention-in var(--dur-2) var(--ease-out) both; }
.cphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cphoto.busy img { opacity: .55; filter: saturate(.6); }
.cphoto-spin { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .7); border-top-color: var(--blue); animation: cphoto-spin .8s linear infinite; }
.cphoto-x { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(9, 48, 77, .72); color: #fff; cursor: pointer; transition: background-color var(--dur-1), transform 100ms var(--ease-out); }
.cphoto-x:hover { background: var(--danger); }
.cphoto-x:active { transform: scale(.92); }
.cphoto-x:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, var(--focus); }
@keyframes cphoto-spin { to { transform: rotate(360deg); } }

/* Photos under a comment */
.comment-body:empty { display: none; }
.comment-photos { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px; max-width: 420px; margin: 10px 0 0 44px; }
.comment-photos.n1 { --cols: 1; max-width: 320px; }
.comment-photos.n3 { --cols: 3; }
.comment-photo { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); cursor: zoom-in; }
.comment-photos.n1 .comment-photo { aspect-ratio: 4 / 3; }
.comment-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-1); }
.comment-photo:hover img { transform: scale(1.03); }
.comment-photo:focus-visible { outline: none; box-shadow: var(--focus); }

/* Full-size photo viewer */
dialog.photo-lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(6, 22, 36, .92); color: #fff; animation: fade var(--dur-2) var(--ease-out) both; }
dialog.photo-lightbox::backdrop { background: transparent; }
.photo-lightbox figure { display: grid; place-items: center; width: 100%; height: 100%; margin: 0; padding: 56px 72px; box-sizing: border-box; }
.photo-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.lb-btn { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; transition: background-color var(--dur-1); }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(204, 236, 255, .6); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-family: Lato, system-ui, sans-serif; font-size: 14px; line-height: 1.4; color: rgba(255, 255, 255, .8); }

@media (max-width: 640px) {
  .comment-photos { margin-left: 0; max-width: none; }
  .comment-photos.n1 { max-width: 100%; }
  .ctool-hint { display: none; }
  .photo-lightbox figure { padding: 60px 12px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
}
