/* =====================================================================
   Slice & Dice · Criador de Brasões (/brasao), Armorial (/armorial)
   e bloco do perfil. Só usa os tokens do brand.css (Pergaminho / Vela).
   ===================================================================== */

/* ---------------------------------------------------------- banner */
.brasao-banner {
    position: relative; overflow: hidden;
    background:
        radial-gradient(ellipse 60% 90% at 78% 55%, rgba(224, 178, 58, .16), transparent 70%),
        linear-gradient(180deg, rgba(20, 15, 11, .2), rgba(20, 15, 11, 0) 40%),
        #1E1915 url("/assets/brand/img/vellum-dark.jpg") repeat;
    background-size: auto, auto, 640px 640px;
    border-bottom: 3px double var(--rule);
    color: #E9DCC0;
}
.brasao-banner::after { /* soft vignette */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    box-shadow: inset 0 0 140px rgba(0, 0, 0, .55);
}
.brasao-banner-in {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center; gap: 2rem;
    padding-top: clamp(1.8rem, 4vw, 3.2rem); padding-bottom: clamp(1.6rem, 3.5vw, 2.8rem);
}
.bb-kicker {
    display: inline-block; font-variant: small-caps; letter-spacing: .14em; font-weight: 700; font-size: 1rem;
    color: #D2AE58; border-bottom: 1px solid rgba(210, 174, 88, .45); padding-bottom: .15rem; margin-bottom: .8rem;
}
.brasao-banner h1 {
    font-size: clamp(2.8rem, 6.4vw, 5.4rem); color: #F0E4C8; margin: 0 0 .7rem;
    text-shadow: 0 3px 24px rgba(0, 0, 0, .7);
}
.bb-lead { font-size: clamp(1.08rem, 1.5vw, 1.28rem); color: #CDBB98; font-style: italic; max-width: 36rem; }
.bb-acoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.brasao-banner .btn-outline-slice { color: #E9DCC0; box-shadow: inset 0 0 0 1px #8C7553; }
.brasao-banner .btn-outline-slice:hover { background: rgba(255, 255, 255, .06); color: #F2C26A; }
.bb-escudo { margin: 0; text-align: center; }
.bb-escudo img {
    width: min(100%, 460px); height: auto;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55));
}
.bb-escudo figcaption { font-size: .98rem; color: #B9A783; margin-top: .4rem; }

/* ---------------------------------------------------------- editor */
.brasao-sec { padding-top: clamp(1.5rem, 3vw, 2.5rem); padding-bottom: clamp(2rem, 4vw, 3.5rem); }
.brasao-origem { background: var(--card); border: 1px solid var(--rule); padding: .5rem .8rem; }
.brasao-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(1rem, 2.4vw, 2rem); align-items: start; }
.brasao-palco { position: sticky; top: 84px; }
.brasao-moldura {
    background: var(--card);
    border: 1px solid var(--rule);
    box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 5px var(--rule-soft), inset 0 0 60px var(--grime), 0 2px 0 var(--shadow);
    padding: clamp(.6rem, 2vw, 1.2rem);
}
.brasao-preview { width: 100%; aspect-ratio: 5 / 6; display: flex; align-items: center; justify-content: center; position: relative; outline: none; }
.brasao-preview svg { width: 100%; height: 100%; display: block; }
.brasao-preview:focus-visible { box-shadow: 0 0 0 2px var(--gold); }
.b-pv-arte { width: 100%; height: 100%; }
/* selection overlay: editor-only, never part of the exported image */
.b-pv-sel { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.b-pv-sel .b-sel-box { fill: none; stroke: #F2C26A; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .9)); }
.b-pv-sel .b-sel-lin { stroke: #F2C26A; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .9)); }
.b-pv-sel .b-sel-h { fill: #FBF3E2; stroke: #1A1410; }
.b-pv-sel .b-sel-rot { fill: #F2C26A; stroke: #1A1410; }
.b-pv-sel .b-sel-reg { fill: rgba(242, 194, 106, .12); stroke: #F2C26A; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, .8)); }
.brasao-preview.is-arrastando { cursor: grabbing; }
.brasao-acoes { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; align-items: center; }
.brasao-acoes .btn { white-space: nowrap; }
.brasao-acoes .btn:disabled { opacity: .45; }
.brasao-acoes .btn.is-busy { cursor: progress; }
.brasao-presets { width: auto; flex: 1 1 11rem; min-width: 10rem; }
.brasao-status { min-height: 1.4em; margin: .4rem 0 0; font-style: italic; color: var(--ink-soft); }
.brasao-status.is-ok { color: var(--success); }
.brasao-status.is-erro { color: var(--danger); }
.brasao-blazon {
    margin-top: .5rem; padding: .7rem .9rem; background: var(--card); border-left: 3px solid var(--rubric);
    box-shadow: inset 0 0 30px var(--grime);
}
.bz-rot { font-variant: small-caps; letter-spacing: .12em; font-weight: 700; color: var(--rubric); font-size: .95rem; }
.brasao-blazon p { font-style: italic; margin: .1rem 0 0; font-size: 1.12rem; line-height: 1.45; }
.brasao-avisos { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .98rem; color: var(--gold); }
.brasao-avisos:empty { display: none; }
.brasao-avisos li + li { margin-top: .2rem; }

/* form controls in the theme */
.pagina-brasao .form-select, .pagina-brasao .form-control {
    background-color: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 0; font-family: var(--font-text);
}
.pagina-brasao .form-select:focus, .pagina-brasao .form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 .15rem var(--sel); }

.brasao-abas {
    display: flex; flex-wrap: wrap; gap: 0 .1rem; border-bottom: 3px double var(--rule); margin-bottom: .9rem;
}
.b-aba {
    flex: 0 0 auto; background: transparent; border: 0; padding: .45rem .85rem; color: var(--ink-soft);
    font-family: var(--font-text); font-variant: small-caps; letter-spacing: .08em; font-weight: 700; font-size: 1.05rem;
    border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.b-aba:hover { color: var(--rubric); }
.b-aba.on { color: var(--rubric); border-bottom-color: var(--rubric); }

.b-grupo { margin-bottom: 1rem; }
.b-grupo[hidden], .b-check[hidden] { display: none; }
.b-rotulo { font-variant: small-caps; letter-spacing: .08em; font-weight: 700; color: var(--ink); margin-bottom: .35rem; font-size: 1.02rem; }
.b-dica { font-variant: normal; letter-spacing: 0; font-weight: 400; font-style: italic; color: var(--ink-soft); font-size: .92rem; margin-left: .3rem; }

.b-tints { display: flex; flex-wrap: wrap; gap: .35rem; }
.b-tint {
    display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .5rem .2rem .25rem;
    background: var(--card); border: 1px solid var(--rule-soft); color: var(--ink); font-size: .95rem; line-height: 1.2;
}
.b-tint:hover { border-color: var(--rule); }
.b-tint.on { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); }
.b-sw { width: 22px; height: 22px; border: 1px solid rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); flex: 0 0 auto; }
.b-tint[hidden] { display: none; }

.b-icones { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .4rem; }
.b-icones.b-cargas { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); max-height: 380px; overflow-y: auto; padding-right: .2rem; }
.b-ico {
    display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .35rem .2rem .3rem;
    background: var(--card); border: 1px solid var(--rule-soft); color: var(--ink); font-size: .82rem; line-height: 1.15; text-align: center;
}
.b-ico:hover { border-color: var(--rule); color: var(--rubric); }
.b-ico.on { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); background: var(--card-alt); }
.b-ico-img { display: block; width: 46px; height: 54px; }
.b-cargas .b-ico-img { width: 50px; height: 50px; }
.b-formas .b-ico-img { color: var(--ink); }
.b-ico-img svg { width: 100%; height: 100%; display: block; }
.b-ico-n { display: block; max-width: 100%; overflow-wrap: anywhere; }

.b-acab { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.b-acab-b {
    text-align: left; background: var(--card); border: 1px solid var(--rule-soft); color: var(--ink); padding: .5rem .65rem; line-height: 1.25;
}
.b-acab-b strong { display: block; font-variant: small-caps; letter-spacing: .06em; }
.b-acab-b small { color: var(--ink-soft); font-size: .88rem; }
.b-acab-b:hover { border-color: var(--rule); }
.b-acab-b.on { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); background: var(--card-alt); }

.b-check { display: flex; align-items: center; gap: .45rem; margin-bottom: .8rem; cursor: pointer; }
.b-check .form-check-input { margin: 0; border-radius: 0; border-color: var(--rule); background-color: var(--card); }
.b-check .form-check-input:checked { background-color: var(--rubric); border-color: var(--rubric); }

.b-sugestoes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.b-chip { background: transparent; border: 1px dashed var(--rule); color: var(--ink-soft); font-size: .9rem; padding: .1rem .5rem; font-style: italic; }
.b-chip:hover { color: var(--rubric); border-color: var(--rubric); }

.brasao-creditos { margin-top: 2rem; font-size: .95rem; color: var(--ink-soft); }
.brasao-creditos summary { cursor: pointer; font-variant: small-caps; letter-spacing: .08em; font-weight: 700; color: var(--ink); }
.brasao-creditos ul { columns: 2 22rem; padding-left: 1.1rem; margin-top: .5rem; }
.brasao-creditos li { break-inside: avoid; margin-bottom: .2rem; }

/* camadas, quartéis, faixas, atitudes */
.b-segs { display: flex; flex-wrap: wrap; gap: .3rem; }
.b-seg {
    background: var(--card); border: 1px solid var(--rule-soft); color: var(--ink); padding: .25rem .7rem; font-size: .98rem;
    font-variant: small-caps; letter-spacing: .05em; min-height: 36px;
}
.b-seg:hover { border-color: var(--rule); color: var(--rubric); }
.b-seg.on { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); background: var(--card-alt); color: var(--rubric); }
.b-quartos { border-left: 3px solid var(--rule-soft); padding-left: .75rem; margin-bottom: 1rem; }
.b-quartos[hidden] { display: none; }
.b-acoes-q { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .3rem 0 .6rem; }
.b-acoes-q .b-check { margin: 0 .4rem 0 0; }
.b-nota { font-size: .92rem; font-style: italic; color: var(--ink-soft); margin: .2rem 0 .8rem; }
.b-nota[hidden] { display: none; }

.b-camadas { border: 1px solid var(--rule-soft); background: var(--card); max-height: 260px; overflow-y: auto; }
.b-camadas-h { font-variant: small-caps; letter-spacing: .08em; font-size: .9rem; color: var(--ink-soft); padding: .25rem .5rem .1rem; border-top: 1px solid var(--rule-soft); }
.b-camadas-h:first-child { border-top: 0; }
.b-camadas .b-nota { padding: .4rem .6rem; margin: 0; }
.b-camada { display: flex; align-items: center; gap: .15rem; padding: 0 .25rem; border-left: 3px solid transparent; }
.b-camada.on { background: var(--card-alt); border-left-color: var(--rubric); }
.b-camada-sel { flex: 1 1 auto; display: flex; align-items: center; gap: .45rem; background: none; border: 0; color: var(--ink); text-align: left; padding: .2rem .2rem; min-width: 0; min-height: 40px; }
.b-camada-sel:hover { color: var(--rubric); }
.b-camada-ico { width: 30px; height: 30px; flex: 0 0 auto; }
.b-camada-ico svg { width: 100%; height: 100%; display: block; }
.b-camada-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.b-camada-n small { color: var(--ink-soft); }
.b-camada-a { background: none; border: 0; color: var(--ink-soft); width: 34px; height: 34px; flex: 0 0 auto; }
.b-camada-a:hover { color: var(--rubric); }

.b-filtros { display: flex; flex-wrap: wrap; gap: .3rem; margin: .2rem 0 .45rem; }
.b-filtro { font-style: normal; }
.b-filtro.on { color: var(--rubric); border-color: var(--rubric); border-style: solid; }
.b-dica-f { margin: 0 0 .2rem; display: block; }
.b-ico[hidden] { display: none; }
.b-ico-p { display: block; color: var(--ink-soft); font-size: .74rem; }
.b-cargas .b-ico-n { font-size: .8rem; overflow-wrap: normal; word-break: normal; -webkit-hyphens: auto; hyphens: auto; }

.b-selbox { border: 1px solid var(--rule); background: var(--card); box-shadow: inset 0 0 30px var(--grime); padding: .6rem .75rem .2rem; margin-bottom: 1rem; }
.b-selbox[hidden] { display: none; }
.b-selbox-t { font-weight: 700; color: var(--rubric); margin-bottom: .5rem; }
.b-selbox-t small { font-weight: 400; color: var(--ink-soft); }
.b-poses { display: flex; flex-wrap: wrap; gap: .35rem; }
.b-pose { width: 86px; }
.b-pose .b-ico-img { width: 52px; height: 52px; }
.b-geo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem 1rem; }
.b-faixa { margin-bottom: .55rem; }
.b-faixa[hidden] { display: none; }
.b-faixa label { display: block; font-size: .95rem; color: var(--ink); margin-bottom: .1rem; }
.b-faixa-in { display: flex; align-items: center; gap: .45rem; }
.b-faixa-in .form-range { flex: 1 1 auto; min-width: 0; accent-color: var(--rubric); }
.b-faixa-in .form-control { width: 4.6rem; flex: 0 0 auto; padding: .15rem .35rem; }
.b-faixa-u { color: var(--ink-soft); font-size: .9rem; width: 1.4rem; }

/* ---------------------------------------------------------- armorial */
.armorial-intro { max-width: 46rem; }
.armorial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.armorial-card {
    display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--rule); color: var(--ink);
    box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 5px var(--rule-soft), inset 0 0 36px var(--grime), 0 2px 0 var(--shadow);
    padding: .9rem .9rem 1rem; text-decoration: none;
}
.armorial-card:hover { border-color: var(--rubric); color: var(--ink); }
.armorial-card .ac-img { aspect-ratio: 5 / 6; display: flex; align-items: center; justify-content: center; }
.armorial-card img { max-width: 100%; max-height: 100%; height: auto; filter: drop-shadow(0 6px 10px var(--shadow)); }
.armorial-card h3 { font-size: 1.6rem; margin: .5rem 0 .1rem; text-align: center; }
.armorial-card:hover h3 { color: var(--rubric); }
.armorial-card .ac-user { text-align: center; color: var(--ink-soft); font-size: .95rem; }
.armorial-card .ac-blazon { font-style: italic; font-size: .98rem; line-height: 1.35; margin: .5rem 0 0; color: var(--ink-soft); }
.armorial-vazio { text-align: center; padding: 2.5rem 1rem; }

.armorial-card .ac-rpg { text-align: center; color: var(--rubric); font-size: .9rem; font-variant: small-caps; letter-spacing: .05em; }

/* ---------------------------------------------------------- perfil: fileira com os brasões dos personagens */
.brasao-perfil { margin-top: 1rem; text-align: center; }
.brasao-perfil h6 { font-variant: small-caps; letter-spacing: .1em; color: var(--rubric); margin-bottom: .5rem; }
.bp-fila { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem .5rem; }
.bp-item { display: flex; flex-direction: column; align-items: center; width: 84px; color: var(--ink); text-decoration: none; font-size: .85rem; line-height: 1.15; }
.bp-item img { width: 72px; height: 86px; object-fit: contain; filter: drop-shadow(0 3px 5px var(--shadow)); transition: transform .15s; }
.bp-item span { margin-top: .2rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-item:hover { color: var(--rubric); }
.bp-item:hover img { transform: translateY(-2px); }

/* ---------------------------------------------------------- página do personagem */
.brasao-personagem { display: flex; gap: 1.1rem; align-items: center; margin: 0 0 1.2rem; }
.brasao-personagem h6 { font-variant: small-caps; letter-spacing: .1em; color: var(--rubric); margin-bottom: .4rem; }
.bpe-img { flex: 0 0 auto; display: block; }
.bpe-img img { width: 150px; height: auto; display: block; filter: drop-shadow(0 6px 10px var(--shadow)); }
.bpe-txt { min-width: 0; }
.bpe-blazon { font-style: italic; font-size: 1rem; line-height: 1.4; color: var(--ink-soft); margin: 0 0 .6rem; }

/* ---------------------------------------------------------- criador: personagem escolhido + seletor */
.brasao-alvo { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem 1.5rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--rule-soft); }
.ba-quem { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.ba-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ba-rot { font-variant: small-caps; letter-spacing: .1em; color: var(--ink-soft); font-size: .9rem; }
.ba-nome { font-size: 1.5rem; overflow-wrap: anywhere; }
.ba-nome a { color: var(--ink); text-decoration: none; }
.ba-nome a:hover { color: var(--rubric); }
.ba-meta { color: var(--ink-soft); font-size: .92rem; font-style: italic; }
.ba-meta:empty { display: none; }
.ba-sel { min-width: min(100%, 17rem); }
.ba-sel-rot { display: block; font-variant: small-caps; letter-spacing: .08em; font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.ba-sel-in { display: flex; gap: .4rem; }
.ba-sel-in .form-select { flex: 1 1 auto; min-width: 0; }
.brasao-sem { margin-bottom: 1rem; }

/* ---------------------------------------------------------- criador: cor do contorno */
.b-tint-auto .b-sw { background: linear-gradient(135deg, #1A1410 50%, #B9B0A0 50%); }
.b-cor-livre { position: relative; cursor: pointer; }
.b-cor-livre input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.b-cor-livre .b-sw { background: conic-gradient(#d33, #dd3, #3d3, #3dd, #33d, #d3d, #d33); }
.b-cor-livre:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ---------------------------------------------------------- responsivo */
@media (max-width: 991.98px) {
    .brasao-grid { grid-template-columns: minmax(0, 1fr); }
    /* the preview stays pinned under the navbar while the controls scroll, so charges can be dragged and tuned together */
    .brasao-palco { display: contents; }
    .brasao-moldura { order: 1; position: sticky; top: 62px; z-index: 20; padding: .35rem; }
    .brasao-acoes { order: 2; }
    .brasao-acoes-fim { order: 3; margin-top: 0; }
    .brasao-status { order: 4; }
    .brasao-painel { order: 5; }
    .brasao-blazon { order: 6; }
    .brasao-preview { max-width: 520px; max-height: 40vh; margin: 0 auto; }
}
@media (max-width: 767.98px) {
    .brasao-banner-in { grid-template-columns: minmax(0, 1fr); text-align: center; gap: 1rem; }
    .bb-escudo { order: -1; }
    .bb-escudo img { width: min(70%, 300px); }
    .bb-lead { margin-left: auto; margin-right: auto; }
    .bb-acoes { justify-content: center; }
    .b-acab { grid-template-columns: minmax(0, 1fr); }
    .b-tn { display: none; }
    .b-tint { padding: .2rem; }
    .b-sw { width: 30px; height: 30px; }
    .b-geo { grid-template-columns: minmax(0, 1fr); }
    .b-pose { width: 76px; }
    .b-icones.b-cargas { max-height: 260px; }
    .b-camadas { max-height: 200px; }
    .brasao-alvo { align-items: stretch; }
    .ba-sel { width: 100%; }
    .brasao-personagem { flex-direction: column; text-align: center; }
    .brasao-personagem .d-flex { justify-content: center; }
}
.pagina-brasao .form-range::-webkit-slider-thumb { background: var(--rubric); }
.pagina-brasao .form-range::-moz-range-thumb { background: var(--rubric); }
.pagina-brasao .form-range::-webkit-slider-runnable-track { background: var(--rule-soft); }
.pagina-brasao .form-range::-moz-range-track { background: var(--rule-soft); }
.pagina-brasao .form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 .2rem var(--sel); }
