/* O briefing guiado (partials/briefing.php + assets/briefing.js). */

.bf { position: relative; z-index: 2; padding: 110px 0 120px; scroll-margin-top: 40px; }
.bf-anchor { position: absolute; top: 0; }
.bf-intro { max-width: 46rem; margin-bottom: 40px; }

/* os três caminhos */
.bf-tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.bf-tracks[hidden], .bf-form[hidden], .bf-done[hidden] { display: none !important; }
.bf-track {
    --mx: 50%; --my: 0%;
    position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 12px; text-align: left;
    padding: 30px 28px; border-radius: 22px; cursor: pointer; color: #fff; font: inherit;
    background: linear-gradient(180deg, rgba(14,27,46,.86), rgba(8,17,31,.92));
    border: 1px solid rgba(127,211,245,.18);
    transition: transform .35s cubic-bezier(.2,.8,.2,1), border-color .3s, box-shadow .35s, opacity .3s;
}
.bf-track::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; transition: opacity .3s;
    background: radial-gradient(380px circle at var(--mx) var(--my), rgba(27,168,230,.2), transparent 60%); }
.bf-track:hover { transform: translateY(-6px); border-color: rgba(127,211,245,.45); box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.bf-track:hover::before { opacity: 1; }
.bf-track strong { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.2; }
.bf-track > span:not(.bf-track-ic) { color: #a9b8cf; line-height: 1.6; font-size: .96rem; }
.bf-track em { margin-top: auto; padding-top: 8px; font-style: normal; display: inline-flex; align-items: center; gap: 8px; color: #7fd3f5; font-weight: 800; }
.bf-track-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #7fd3f5;
    background: linear-gradient(145deg, rgba(27,168,230,.26), rgba(21,112,239,.08)); border: 1px solid rgba(127,211,245,.3); }
.bf-track[aria-checked="true"] { border-color: #7fd3f5; box-shadow: 0 0 0 1px #7fd3f5, 0 30px 70px rgba(21,112,239,.25);
    background: linear-gradient(180deg, rgba(20,48,86,.92), rgba(8,17,31,.94)); }
.bf.has-track .bf-track[aria-checked="false"] { opacity: .55; }
.bf.has-track .bf-tracks { gap: 14px; }
.bf.has-track .bf-track { padding: 20px 22px; }
.bf.has-track .bf-track > span:not(.bf-track-ic) { display: none; }

/* passos + documento */
.bf-form { margin-top: 56px; }
.bf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.bf-steps { display: grid; gap: 0; counter-reset: bfstep; }
.bf-step {
    counter-increment: bfstep; min-height: 72vh; display: flex; flex-direction: column; justify-content: center; padding: 48px 0;
    opacity: .38; transform: scale(.985); transition: opacity .5s ease, transform .6s cubic-bezier(.2,.8,.2,1);
}
.bf-step.is-active, .bf-step:focus-within { opacity: 1; transform: none; }
.bf-step-k { display: inline-flex; align-items: center; gap: 10px; color: #7fd3f5; font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.bf-step-k::before { content: counter(bfstep, decimal-leading-zero); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid rgba(127,211,245,.4); background: rgba(27,168,230,.12); font-size: .8rem; letter-spacing: 0; color: #fff; }
.bf-step h3 { margin: 16px 0 8px; font-family: var(--font-display); font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.12; color: #fff; }
.bf-step > p.bf-lead { margin: 0 0 26px; color: #a9b8cf; font-size: 1.05rem; line-height: 1.65; max-width: 40rem; }
.bf-field { margin-bottom: 22px; }
.bf-field > label:not(.bf-drop), .bf-field > legend { display: block; margin-bottom: 10px; padding: 0; color: #dbe6f3; font-size: .92rem; font-weight: 800; }
.bf-field small { display: block; margin-top: 8px; color: #7e8eab; font-size: .84rem; }
fieldset.bf-field { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
.bf textarea { min-height: 160px; font-size: 1.02rem; line-height: 1.6; }
.bf input[type="text"], .bf input[type="email"], .bf input[type="tel"], .bf input[type="url"], .bf textarea {
    width: 100%; padding: 15px 16px; border-radius: 14px; color: #fff; background: rgba(6,14,26,.72);
    border: 1px solid rgba(127,211,245,.22); font: inherit; transition: border-color .2s, box-shadow .2s; }
.bf input:focus, .bf textarea:focus { outline: none; border-color: #7fd3f5; box-shadow: 0 0 0 4px rgba(27,168,230,.16); }
.bf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* escolhas: uma ou várias */
.bf-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.bf-chip { position: relative; }
.bf-chip input { position: absolute; opacity: 0; pointer-events: none; }
.bf-chip span {
    display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px; cursor: pointer; user-select: none;
    color: #cfdae8; font-weight: 700; font-size: .94rem; background: rgba(12,24,42,.7); border: 1px solid rgba(127,211,245,.22);
    transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.bf-chip span:hover { border-color: rgba(127,211,245,.55); color: #fff; }
.bf-chip input:checked + span { color: #fff; background: linear-gradient(135deg, rgba(21,112,239,.9), rgba(27,168,230,.9)); border-color: transparent; box-shadow: 0 8px 24px rgba(21,112,239,.3); }
.bf-chip input:checked + span::before { content: "✓"; font-weight: 900; }
.bf-chip input:focus-visible + span { outline: 2px solid #7fd3f5; outline-offset: 3px; }

/* prints */
.bf-field > .bf-drop, .bf-drop {
    display: grid; place-items: center; gap: 8px; padding: 34px 20px; text-align: center; border-radius: 18px; cursor: pointer;
    border: 1.5px dashed rgba(127,211,245,.4); background: rgba(27,168,230,.05); color: #cfdae8; transition: background .2s, border-color .2s;
}
.bf-drop:hover, .bf-drop.is-over { background: rgba(27,168,230,.12); border-color: #7fd3f5; }
.bf-drop strong { color: #fff; font-size: 1.02rem; }
.bf-drop span { color: #7e8eab; font-size: .88rem; }
.bf-drop svg { color: #7fd3f5; }
.bf-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.bf-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid rgba(127,211,245,.22); background: #0b1f3a; animation: bfIn .4s ease both; }
.bf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bf-thumb button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: rgba(8,21,39,.8); font-size: 16px; line-height: 1; }
.bf-thumb.is-uploading::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: linear-gradient(90deg, #7fd3f5, #1570ef); animation: bfBar 1s ease-in-out infinite; }
@keyframes bfBar { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes bfIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

.bf-next { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 10px; }
.bf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 12px;
    cursor: pointer; font: inherit; font-weight: 800; border: 1px solid transparent; color: #fff;
    background: linear-gradient(135deg, #1570ef, #1ba8e6); box-shadow: 0 12px 30px rgba(21,112,239,.35); transition: transform .2s, box-shadow .2s, opacity .2s;
}
.bf-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(21,112,239,.5); }
.bf-btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.bf-btn-ghost { background: transparent; box-shadow: none; border-color: rgba(255,255,255,.22); }
.bf-btn-ghost:hover { border-color: #7fd3f5; box-shadow: none; }
.bf-skip { color: #7e8eab; font-size: .88rem; background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.bf-note { margin: 14px 0 0; color: #7e8eab; font-size: .86rem; line-height: 1.55; max-width: 40rem; }
.bf-note a { color: #7fd3f5; }
.bf-msg { margin: 12px 0 0; font-weight: 700; font-size: .94rem; min-height: 1.4em; }
.bf-msg.ok { color: #4fd49a; }
.bf-msg.err { color: #ff8a80; }
.bf-honey { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }

/* o documento que se vai escrevendo */
.bf-doc {
    position: sticky; top: 90px; max-height: calc(100vh - 190px); overflow: auto; padding: 26px; border-radius: 22px;
    background: linear-gradient(180deg, rgba(16,32,56,.92), rgba(8,17,31,.95)); border: 1px solid rgba(127,211,245,.26);
    box-shadow: 0 30px 70px rgba(0,0,0,.4); scrollbar-width: thin;
}
.bf-doc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bf-doc-head strong { font-family: var(--font-display); font-size: 1.15rem; color: #fff; }
.bf-doc-head span { color: #7fd3f5; font-weight: 900; }
.bf-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); margin: 12px 0 18px; overflow: hidden; }
.bf-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #7fd3f5, #1570ef); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bf-doc-track { display: inline-flex; padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 800; color: #cdeeff; background: rgba(27,168,230,.14); border: 1px solid rgba(127,211,245,.3); }
.bf-doc dl { margin: 16px 0 0; display: grid; gap: 14px; }
.bf-doc dt { color: #7e8eab; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.bf-doc dd { margin: 4px 0 0; color: #e6eef8; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; animation: bfIn .4s ease both; }
.bf-doc dd.is-empty { color: #55657d; font-style: italic; }
.bf-doc-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bf-doc-thumbs img { width: 52px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(127,211,245,.25); }
.bf-saved { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); color: #a9b8cf; font-size: .84rem; line-height: 1.5; }
.bf-saved i { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; flex-shrink: 0; background: #4fd49a; box-shadow: 0 0 10px #4fd49a; }
.bf-saved.is-saving i { background: #f4c14a; box-shadow: 0 0 10px #f4c14a; }
.bf-saved button { background: none; border: 0; padding: 0; color: #7fd3f5; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.bf-doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.bf-doc-close { display: none; }

/* revisão e fim */
.bf-review { display: grid; gap: 14px; padding: 24px; border-radius: 18px; background: rgba(12,24,42,.7); border: 1px solid rgba(127,211,245,.2); }
.bf-review div { display: grid; gap: 4px; }
.bf-review b { color: #7e8eab; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.bf-review p { margin: 0; color: #e6eef8; white-space: pre-wrap; overflow-wrap: anywhere; }
.bf-done { max-width: 52rem; margin: 40px auto 0; padding: 48px 40px; border-radius: 26px; text-align: center;
    background: radial-gradient(80% 120% at 50% 0%, rgba(79,212,154,.18), transparent 70%), linear-gradient(180deg, rgba(16,38,74,.9), rgba(8,21,39,.95));
    border: 1px solid rgba(79,212,154,.35); }
.bf-done:focus { outline: none; }
.bf-done .ok { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; color: #08251a; background: #4fd49a; box-shadow: 0 0 40px rgba(79,212,154,.5); }
.bf-done h3 { font-family: var(--font-display); font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: 0 0 12px; color: #fff; }
.bf-done p { color: #cfdae8; max-width: 36rem; margin: 0 auto 10px; }
.bf-done ol { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; text-align: left; }
.bf-done li { padding: 18px; border-radius: 14px; background: rgba(12,24,42,.7); border: 1px solid rgba(127,211,245,.2); color: #a9b8cf; font-size: .92rem; }
.bf-done li b { display: block; color: #fff; margin-bottom: 4px; }

@media (max-width: 1080px) {
    .bf-layout { grid-template-columns: 1fr; }
    /* No telemóvel o documento é uma folha que sobe da barra de baixo. */
    .bf-doc { position: fixed; left: 10px; right: 10px; bottom: 82px; top: auto; z-index: 58; max-height: 70vh;
        transform: translateY(120%); opacity: 0; transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .3s; pointer-events: none; }
    .bf-doc.is-open { transform: none; opacity: 1; pointer-events: auto; }
    .bf-doc-close { display: inline-flex; }
}
@media (max-width: 760px) {
    .bf { padding: 80px 0 90px; }
    .bf-tracks { grid-template-columns: 1fr; }
    .bf-step { min-height: 0; padding: 40px 0; opacity: 1; transform: none; }
    .bf-row { grid-template-columns: 1fr; }
    .bf-done ol { grid-template-columns: 1fr; }
    .bf-done { padding: 36px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .bf-step, .bf-track, .bf-doc, .bf-bar i { transition: none; }
    .bf-thumb, .bf-doc dd { animation: none; }
}
