/*   CSS FILE HEADER #
 *
 *   File:         [chat.css]
 *   Author(s):    ['Pedro H.F Matias']
 *   Date:         ['20.10.2026']
 *   Version:      ['0.2.0']
 *   Description:  ['The drawer of the chat of the game session (apps/comum/chat.js): a papyrus scroll with a brass edge on the right side of the screen, a leather tab with the counter of unread messages. Self-contained (the Mesa does not load tema.css): own fonts and colors. Desktop only. 0.2.0: whispers, rolls, @mentions, reactions, the dice of the drawer, images the master reveals (and the screen that shows them) and the line of the soundscape of the scene.']
 */

@font-face { font-family: 'Cinzel'; src: url('fontes/cinzel-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fontes/cormorant-garamond-latin-500-normal.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fontes/cormorant-garamond-latin-500-italic.woff2') format('woff2'); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fontes/cormorant-garamond-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

.chat-gaveta {
    --ch-tinta: #2f2013; --ch-tinta-2: #5c4629; --ch-ouro: #a47a22; --ch-ouro-claro: #f3d98e; --ch-vermelho: #9c2b22;
    --ch-largura: min(360px, calc(100vw - 56px));
    position: fixed; top: 96px; bottom: 24px; right: 0; z-index: 940;
    display: flex; align-items: flex-start;
    transform: translateX(var(--ch-largura));
    transition: transform .32s cubic-bezier(.2, .8, .25, 1);
    font: 500 17px/1.3 'Cormorant Garamond', Georgia, serif; color: var(--ch-tinta); color-scheme: light;
    pointer-events: none;
}
.chat-gaveta[hidden] { display: none; }
.chat-gaveta.aberta { transform: none; }

/* the leather tab on the edge of the screen */
.chat-aba {
    pointer-events: auto; position: relative; margin-top: 40px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 9px 14px; border: 1px solid #8a6420; border-right: 0; border-radius: 8px 0 0 8px;
    background: linear-gradient(90deg, #3b2313, #5a3a1f 55%, #3b2313); color: var(--ch-ouro-claro);
    box-shadow: -4px 4px 12px rgba(0, 0, 0, .45), inset 1px 0 0 rgba(255, 220, 170, .2);
    font: 600 13px/1 'Cinzel', Georgia, serif; letter-spacing: .12em; cursor: pointer;
}
.chat-aba:hover { background: linear-gradient(90deg, #4a2d18, #6b4626 55%, #4a2d18); }
.chat-aba:focus-visible { outline: 2px solid var(--ch-ouro-claro); outline-offset: 2px; }
.chat-aba-texto { writing-mode: vertical-rl; transform: rotate(180deg); text-transform: uppercase; }
.chat-contador {
    min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, #e2574a, #8e1b14); color: #fff6e0;
    font: 700 13px/1 'Cormorant Garamond', Georgia, serif; font-variant-numeric: lining-nums;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.chat-contador[hidden] { display: none; }

/* the papyrus */
.chat-painel {
    pointer-events: auto; width: var(--ch-largura); height: 100%;
    display: flex; flex-direction: column;
    background: url('img/grao.webp') 0 0 / 256px, url('img/papiro.webp') 0 0 / 1600px,
        radial-gradient(ellipse at 30% 40%, transparent 50%, rgba(90, 55, 15, .2) 100%), #e9dab3;
    border-left: 3px solid #8a6420; box-shadow: -10px 0 28px rgba(0, 0, 0, .5), inset 1px 0 0 rgba(255, 240, 200, .5);
}
.chat-gaveta:not(.aberta) .chat-painel { visibility: hidden; transition: visibility 0s .32s; }
.chat-topo { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid rgba(92, 62, 28, .35); }
.chat-topo > div { flex: 1; min-width: 0; }
.chat-titulo { margin: 0; font: 600 17px/1.2 'Cinzel', Georgia, serif; letter-spacing: .03em; color: var(--ch-tinta); }
.chat-sub { margin: 2px 0 0; font-style: italic; font-size: 15px; color: var(--ch-tinta-2); font-variant-numeric: lining-nums; }
.chat-fechar { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ch-tinta-2); cursor: pointer; padding: 0 4px; }
.chat-fechar:hover { color: var(--ch-tinta); }
.chat-gaveta.encerrada .chat-titulo { color: var(--ch-tinta-2); }

.chat-lista {
    flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 8px 16px;
    scrollbar-width: thin; scrollbar-color: rgba(58, 36, 20, .45) transparent;
}
.chat-msg { position: relative; padding: 7px 0 8px; border-bottom: 1px dashed rgba(58, 36, 20, .3); }
.chat-msg:last-child { border-bottom: 0; }
.chat-cab { display: flex; align-items: baseline; gap: 5px; font-size: 15px; color: var(--ch-tinta-2); }
.chat-cab b { font-weight: 700; color: var(--ch-tinta); }
.chat-msg.minha .chat-cab b { color: #6e1e16; }
.chat-pers { font-style: italic; }
.chat-cab time { margin-left: auto; font-size: 13px; color: #7a5c3a; font-variant-numeric: lining-nums; white-space: nowrap; }
.chat-apagar {
    border: 0; background: none; padding: 0 0 0 4px; cursor: pointer;
    font: italic 13px/1 'Cormorant Garamond', Georgia, serif; color: var(--ch-vermelho); text-decoration: underline; text-underline-offset: 2px;
    opacity: 0; transition: opacity .15s;
}
.chat-msg:hover .chat-apagar, .chat-apagar:focus-visible { opacity: 1; }
.chat-texto { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
.chat-apagada { font-style: italic; color: #8a7254; }
.chat-vazio { padding: 14px 0; font-style: italic; color: var(--ch-tinta-2); }

.chat-form { padding: 10px 16px 14px; border-top: 1px solid rgba(92, 62, 28, .35); }
.chat-form[hidden] { display: none; }
.chat-campo {
    width: 100%; box-sizing: border-box; resize: vertical; min-height: 54px; max-height: 40vh; padding: 7px 9px;
    border: 1px solid rgba(92, 62, 28, .48); border-radius: 4px; background: rgba(255, 250, 235, .55); color: var(--ch-tinta);
    font: 500 17px/1.3 'Cormorant Garamond', Georgia, serif;
}
.chat-campo:focus { outline: 2px solid rgba(164, 122, 34, .6); outline-offset: 1px; }
.chat-campo:disabled { background: rgba(120, 86, 40, .08); font-style: italic; }
.chat-pe { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.chat-nota { flex: 1; font-size: 14px; font-style: italic; color: var(--ch-tinta-2); font-variant-numeric: lining-nums; }
.chat-nota.erro { color: var(--ch-vermelho); font-style: normal; }
.chat-enviar {
    padding: .35em 1.1em; border-radius: 4px; border: 1px solid #8a6420; cursor: pointer;
    background: linear-gradient(180deg, #f4dc8f 0%, #d6ac4a 45%, #b0832a 100%); color: #2a1a06;
    font: 600 13px/1.2 'Cinzel', Georgia, serif; letter-spacing: .04em;
    box-shadow: inset 0 1px 0 rgba(255, 250, 220, .7), 0 2px 6px rgba(60, 35, 5, .25);
}
.chat-enviar:hover { background: linear-gradient(180deg, #fbe7a6 0%, #e0b955 45%, #bb8e31 100%); }
.chat-enviar:disabled { opacity: .55; cursor: default; }

/* 0.2.0: the counter calls with a mention (@n, the tab glows) */
.chat-contador.mencao { background: radial-gradient(circle at 35% 30%, #f3d98e, #a47a22); color: #2a1a06; }
.chat-aba.chamando { animation: chat-chama 1.6s ease-in-out infinite; }
@keyframes chat-chama { 50% { box-shadow: -4px 4px 12px rgba(0, 0, 0, .45), 0 0 18px 3px rgba(243, 217, 142, .7); } }

/* whispers, mentions, the line of the soundscape */
.chat-msg.sussurro { margin: 0 -8px; padding-left: 8px; padding-right: 8px; background: rgba(76, 52, 110, .09); border-left: 2px solid rgba(96, 62, 140, .55); }
.chat-sussurro { font-size: 13px; font-style: italic; color: #5b3d86; letter-spacing: .02em; }
.chat-msg.mencao { margin: 0 -8px; padding-left: 8px; padding-right: 8px; background: rgba(243, 200, 90, .22); border-left: 2px solid var(--ch-ouro); }
.chat-arroba { font-weight: 700; color: #6e4a0e; }
.chat-sistema { display: flex; align-items: baseline; gap: 6px; padding: 6px 0; font-size: 15px; font-style: italic; color: var(--ch-tinta-2); }
.chat-sistema b { font-style: normal; color: var(--ch-tinta); }
.chat-sistema time { margin-left: auto; font-size: 13px; font-style: normal; color: #7a5c3a; font-variant-numeric: lining-nums; }

/* a roll: dice as little bone tiles, the total in gold */
.chat-rolagem { margin-top: 4px; padding: 6px 9px 7px; border: 1px solid rgba(92, 62, 28, .4); border-radius: 5px; background: rgba(255, 248, 228, .55); }
.chat-rolagem.critico { border-color: var(--ch-ouro); box-shadow: 0 0 10px rgba(212, 166, 60, .55); }
.chat-rol-titulo { font-weight: 700; font-size: 16px; }
.chat-rol-titulo small { font-weight: 500; font-style: italic; font-size: 14px; color: var(--ch-tinta-2); font-variant-numeric: lining-nums; }
.chat-rol-linha { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.chat-rol-dados { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chat-dado {
    min-width: 24px; height: 24px; padding: 0 3px; box-sizing: border-box; display: inline-grid; place-items: center; border-radius: 5px;
    background: linear-gradient(180deg, #fbf3dc, #e2d2a8); border: 1px solid #a88c5c; box-shadow: 0 1px 2px rgba(60, 35, 5, .3);
    font: 700 15px/1 'Cormorant Garamond', Georgia, serif; font-variant-numeric: lining-nums; color: var(--ch-tinta);
}
.chat-dado.moeda { padding: 0 6px; font-size: 13px; font-style: italic; border-radius: 12px; background: linear-gradient(180deg, #f4dc8f, #c99a3c); }
.chat-dado.max { border-color: var(--ch-ouro); color: #6e4a0e; box-shadow: 0 0 6px rgba(212, 166, 60, .6); }
.chat-dado.min { color: var(--ch-vermelho); }
.chat-rol-bonus { font-weight: 700; color: var(--ch-tinta-2); font-variant-numeric: lining-nums; }
.chat-rol-total {
    min-width: 40px; padding: 2px 8px; border-radius: 4px; text-align: center;
    background: linear-gradient(180deg, #f4dc8f 0%, #d6ac4a 45%, #b0832a 100%); color: #2a1a06; border: 1px solid #8a6420;
    font: 700 21px/1.1 'Cormorant Garamond', Georgia, serif; font-variant-numeric: lining-nums;
}
.chat-rol-detalhe { margin-top: 3px; font-size: 14px; font-style: italic; color: var(--ch-tinta-2); }
.chat-rol-critico { margin-top: 3px; font: 600 12px/1 'Cinzel', Georgia, serif; letter-spacing: .08em; color: #8a5a0c; text-transform: uppercase; }

/* an image the master revealed */
.chat-imagem { display: block; margin-top: 5px; padding: 0; border: 1px solid #8a6420; border-radius: 4px; background: #2a1a0e; cursor: zoom-in; max-width: 100%; }
.chat-imagem img { display: block; max-width: 100%; max-height: 200px; object-fit: contain; border-radius: 3px; }
.chat-legenda { margin: 3px 0 0; font-style: italic; font-size: 15px; color: var(--ch-tinta-2); }

/* reactions: the chips stay, the row of emojis shows on hover */
.chat-reacoes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.chat-reacoes:not(:has(.chat-reacao)) { margin-top: 0; }
.chat-reacao {
    display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 11px;
    border: 1px solid rgba(92, 62, 28, .35); background: rgba(255, 250, 235, .6); color: var(--ch-tinta);
    font: 600 14px/1.3 'Cormorant Garamond', Georgia, serif; font-variant-numeric: lining-nums; cursor: pointer;
}
span.chat-reacao { cursor: default; }
.chat-reacao.minha { border-color: var(--ch-ouro); background: rgba(243, 217, 142, .55); }
.chat-reagir {
    position: absolute; right: 0; bottom: -10px; z-index: 1; display: inline-flex; gap: 1px; padding: 1px 4px;
    border: 1px solid rgba(92, 62, 28, .35); border-radius: 12px; background: #f5ead0; box-shadow: 0 2px 6px rgba(40, 20, 5, .25);
    opacity: 0; pointer-events: none; transition: opacity .15s;
}
.chat-msg:hover .chat-reagir, .chat-reagir:focus-within { opacity: 1; pointer-events: auto; }
.chat-reagir button { border: 0; background: none; padding: 0 2px; font-size: 15px; line-height: 1.2; cursor: pointer; filter: saturate(.8); }
.chat-reagir button:hover { transform: scale(1.25); filter: none; }

/* the tools of the form: dice, image, Para, suggestions of @ */
.chat-ferramentas { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.chat-dados { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.chat-dados button, .chat-revelar {
    padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(92, 62, 28, .5); cursor: pointer;
    background: linear-gradient(180deg, #fbf3dc, #e2d2a8); color: var(--ch-tinta);
    font: 700 13px/1.2 'Cormorant Garamond', Georgia, serif; font-variant-numeric: lining-nums;
}
.chat-dados button:hover, .chat-revelar:hover { border-color: var(--ch-ouro); }
.chat-dados button:disabled { opacity: .5; cursor: default; }
.chat-revelar { font: 600 12px/1.2 'Cinzel', Georgia, serif; letter-spacing: .04em; }
.chat-revelar[hidden] { display: none; }
.chat-para-linha { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; font-style: italic; color: var(--ch-tinta-2); }
.chat-para-linha label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.chat-para {
    flex: 1; min-width: 0; padding: 2px 4px; border: 1px solid rgba(92, 62, 28, .48); border-radius: 4px; background: rgba(255, 250, 235, .55);
    color: var(--ch-tinta); font: 500 15px/1.2 'Cormorant Garamond', Georgia, serif;
}
.chat-form.sussurrando .chat-campo { border-color: rgba(96, 62, 140, .7); background: rgba(232, 222, 245, .6); }
.chat-form.sussurrando .chat-para { color: #5b3d86; font-weight: 700; }
.chat-campo-caixa { position: relative; }
.chat-sugestoes {
    position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 4px; padding: 3px; list-style: none; z-index: 2;
    background: #f5ead0; border: 1px solid #8a6420; border-radius: 4px; box-shadow: 0 -4px 14px rgba(40, 20, 5, .3);
}
.chat-sugestoes[hidden] { display: none; }
.chat-sugestoes button { width: 100%; text-align: left; border: 0; background: none; padding: 3px 7px; border-radius: 3px; cursor: pointer; font: 600 16px/1.2 'Cormorant Garamond', Georgia, serif; color: var(--ch-tinta); }
.chat-sugestoes small { font-weight: 500; font-style: italic; color: var(--ch-tinta-2); }
.chat-sugestoes [aria-selected="true"] button, .chat-sugestoes button:hover { background: rgba(243, 217, 142, .7); }

/* the screen that shows a revealed image */
.chat-revelacao { position: fixed; inset: 0; z-index: 990; display: grid; place-items: center; background: rgba(12, 6, 2, .82); backdrop-filter: blur(2px); }
.chat-revelacao[hidden] { display: none; }
.chat-revelacao figure { margin: 0; max-width: min(92vw, 1200px); display: flex; flex-direction: column; align-items: center; gap: 10px; animation: chat-revela .5s cubic-bezier(.2, .8, .25, 1); }
.chat-revelacao img { max-width: 100%; max-height: 76vh; border: 3px solid #8a6420; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .7); background: #2a1a0e; }
.chat-revelacao figcaption { font: italic 500 20px/1.3 'Cormorant Garamond', Georgia, serif; color: #f3e5c0; text-align: center; }
.chat-revelacao-cab { margin: 0; font: 600 15px/1 'Cinzel', Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #f3d98e; }
@keyframes chat-revela { from { opacity: 0; transform: scale(.94); } }

/* the chat of an ended session read again on the Mesa (same lines, inside the scroll dialog) */
.chat-reler { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 55vh; overflow-y: auto; }
.chat-reler .chat-apagar { display: none; }

@media (prefers-reduced-motion: reduce) { .chat-gaveta { transition: none; } .chat-aba.chamando, .chat-revelacao figure { animation: none; } }
body[data-animacao="desligado"] .chat-gaveta { transition: none; }
body[data-animacao="desligado"] .chat-aba.chamando, body[data-animacao="desligado"] .chat-revelacao figure { animation: none; }
