/* ═══════════════════════════════════════════════════════
   EMERGY AI OPS: AI Daily Brief widget, v1
   Uses the v7 tokens from site.css. Every class is prefixed brief-.
   ═══════════════════════════════════════════════════════ */

/* ── Launcher (desktop: right-edge tab) ── */
.brief-launcher {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    z-index: 90;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    padding: 16px 11px 18px;
    background: var(--panel-solid);
    border: 1px solid var(--line-strong); border-right: 0;
    border-radius: 12px 0 0 12px;
    color: var(--sky);
    font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase;
    cursor: pointer;
    box-shadow: -10px 0 30px rgba(5, 10, 20, 0.5);
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, padding 0.25s ease, opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}
.brief-launcher:hover, .brief-launcher:focus-visible {
    background: var(--bg-3); color: var(--text); padding-right: 15px;
    box-shadow: -10px 0 34px rgba(56, 189, 248, 0.18);
}
.brief-launcher:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.brief-launcher-label { line-height: 1; white-space: nowrap; }
.brief-l-desk { writing-mode: vertical-rl; transform: rotate(180deg); }
.brief-l-mob { display: none; }
.brief-launcher-mark { position: relative; width: 16px; height: 16px; flex: none; }
.brief-launcher-mark svg { width: 16px; height: 16px; display: block; }
.brief-launcher-dot {
    position: absolute; top: -3px; right: -4px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--mint); box-shadow: 0 0 0 0 rgba(52, 211, 184, 0.55);
    animation: brief-pulse 2.4s infinite; display: none;
}
.brief-launcher.has-new .brief-launcher-dot { display: block; }
.brief-launcher.is-hidden { display: none; }

@keyframes brief-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 184, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(52, 211, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 184, 0); }
}

/* ── Overlay + panel ── */
.brief-overlay {
    position: fixed; inset: 0; z-index: 240;
    background: rgba(5, 10, 20, 0.55);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.26s ease;
}
.brief-overlay.is-open { opacity: 1; }
.brief-overlay[hidden], .brief-panel[hidden] { display: none; }

.brief-panel {
    margin: 0; padding: 0;
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 250;
    width: min(420px, 100vw);
    display: flex; flex-direction: column;
    background:
        radial-gradient(120% 38% at 100% 0%, rgba(56, 189, 248, 0.09), transparent 62%),
        var(--bg-2);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
    color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.65;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.brief-panel.is-open { transform: none; }

/* Header */
.brief-head { flex: none; padding: 18px 20px 16px; border-bottom: 1px solid var(--line-soft); background: rgba(7, 16, 30, 0.88); }
.brief-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brief-eyebrow {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sky);
}
.brief-eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: brief-pulse-cyan 2.4s infinite; }
@keyframes brief-pulse-cyan {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}
.brief-close {
    width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; border: 1px solid var(--line); background: rgba(5, 10, 20, 0.4);
    color: var(--muted); cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease;
}
.brief-close:hover { color: var(--text); border-color: var(--line-strong); }
.brief-close svg { width: 16px; height: 16px; }
.brief-close:focus-visible, .brief-back:focus-visible, .brief-share:focus-visible, .brief-retry:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.brief-head-main { margin-top: 12px; }
.brief-title { font-family: var(--grotesk); font-size: 23px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; color: var(--text); outline: none; }
.brief-title .grad {
    background: linear-gradient(92deg, #FFFFFF 0%, var(--sky) 55%, var(--cyan) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brief-meta { margin-top: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }

.brief-back {
    display: none; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0 12px 0 0;
    background: none; border: 0; cursor: pointer;
    font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sky);
}
.brief-back:hover { color: var(--text); }
.brief-panel.is-detail .brief-back { display: inline-flex; }
.brief-panel.is-detail .brief-head-main { display: none; }

/* Body */
.brief-body {
    flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 4px 20px 30px; outline: none;
    scrollbar-width: thin; scrollbar-color: rgba(94, 196, 255, 0.25) transparent;
}
.brief-group-h {
    display: flex; align-items: center; gap: 10px; margin: 22px 0 12px;
    font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
}
.brief-group-h strong { color: var(--muted); font-weight: 500; }
.brief-group-h::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.brief-note { font-size: 14px; color: var(--muted); padding: 14px 16px; border: 1px dashed var(--line); border-radius: 14px; margin-bottom: 12px; }

/* Card */
.brief-card {
    display: block; width: 100%; text-align: left; margin: 0 0 12px; padding: 16px 16px 14px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    color: inherit; font: inherit; cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.brief-card:hover { border-color: var(--line-strong); background: rgba(14, 31, 55, 0.88); transform: translateY(-1px); }
.brief-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.brief-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brief-chip {
    display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 100px;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.3;
    color: var(--sky); border: 1px solid var(--line-strong); background: rgba(56, 189, 248, 0.06);
}
.brief-when { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.brief-when.is-new { color: var(--mint); }
.brief-when.is-new::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px rgba(52, 211, 184, 0.7); }
.brief-when.is-tip { color: var(--sky); }
.brief-card-title { display: block; margin-top: 12px; font-family: var(--grotesk); font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; color: var(--text); }
.brief-card-sum {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--muted);
}
.brief-card-more { display: inline-flex; gap: 6px; margin-top: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }

/* Detail ("bubble") */
.brief-detail { padding-top: 18px; animation: brief-in 0.24s ease; }
@keyframes brief-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.brief-d-title { margin-top: 14px; font-family: var(--grotesk); font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.012em; color: var(--text); }
.brief-sec-h { margin: 22px 0 7px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cyan); }
.brief-sec-p { font-size: 15px; line-height: 1.7; color: var(--text); }
.brief-sec-p.is-soft { color: var(--muted); }
.brief-start { margin-top: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(56, 189, 248, 0.05); }
.brief-watch { padding: 2px 0 2px 14px; border-left: 2px solid var(--amber); }
.brief-watch .brief-sec-h { color: var(--amber); }
.brief-reported { margin-top: 14px; font-size: 13px; color: var(--amber); }

.brief-sources { list-style: none; margin: 0; padding: 0; }
.brief-src {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 8px; padding: 11px 14px; min-height: 44px;
    border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(5, 10, 20, 0.35);
    color: var(--text); text-decoration: none; font-size: 14px; line-height: 1.4;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.brief-src:hover { border-color: var(--line-strong); background: rgba(56, 189, 248, 0.05); }
.brief-src:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.brief-src-pub { font-weight: 600; }
.brief-src-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.brief-src-meta b { color: var(--cyan); font-weight: 400; margin-left: 6px; }

.brief-share {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-top: 8px; padding: 0 14px;
    border-radius: 10px; border: 1px solid var(--line); background: none; cursor: pointer;
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.brief-share:hover { color: var(--text); border-color: var(--line-strong); }
.brief-share svg { width: 14px; height: 14px; }

.brief-cta {
    margin-top: 26px; padding: 18px; border-radius: 16px; border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(46, 99, 231, 0.13), rgba(12, 26, 46, 0.55));
}
.brief-cta-lead { font-family: var(--grotesk); font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--text); }
.brief-cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.brief-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px;
    border-radius: var(--radius-btn); font-family: var(--sans); font-size: 14px; font-weight: 600; text-decoration: none;
    color: var(--sky); border: 1px solid var(--line-strong); background: rgba(56, 189, 248, 0.04);
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.brief-btn:hover { border-color: var(--cyan); background: rgba(56, 189, 248, 0.09); }
.brief-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.brief-btn--primary { grid-column: 1 / -1; color: #fff; border-color: rgba(139, 213, 255, 0.28); background: linear-gradient(120deg, var(--blue), #2457D6); }
.brief-btn--primary:hover { background: linear-gradient(120deg, var(--blue-bright), var(--blue)); box-shadow: 0 8px 26px rgba(46, 99, 231, 0.35); }
.brief-btn--wa { color: #9EEBCB; border-color: rgba(52, 211, 184, 0.35); background: rgba(52, 211, 184, 0.06); }
.brief-btn--wa:hover { border-color: var(--mint); background: rgba(52, 211, 184, 0.12); }
.brief-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* Footer, states */
.brief-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 12.5px; line-height: 1.6; color: var(--dim); }
.brief-foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.brief-foot-links a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.brief-foot-links a:hover { color: var(--sky); }
.brief-skel {
    height: 132px; margin-bottom: 12px; border-radius: 16px; border: 1px solid var(--line-soft);
    background: linear-gradient(90deg, rgba(12, 26, 46, 0.6) 0%, rgba(22, 42, 70, 0.85) 50%, rgba(12, 26, 46, 0.6) 100%);
    background-size: 200% 100%; animation: brief-shimmer 1.4s linear infinite;
}
@keyframes brief-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.brief-retry { margin-top: 10px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: none; color: var(--sky); cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.brief-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Homepage Insights: two buttons side by side */
.insights-more { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
button.btn-ghost { cursor: pointer; font: inherit; font-family: var(--sans); font-size: 14px; font-weight: 500; }

/* ── Phones and narrow screens ── */
@media (max-width: 768px) {
    .brief-launcher {
        top: auto; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: none;
        flex-direction: row; gap: 9px; min-height: 46px; padding: 0 17px;
        border: 1px solid var(--line-strong); border-radius: 100px;
        font-size: 11.5px; letter-spacing: 0.14em;
        background: rgba(12, 26, 46, 0.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    }
    .brief-launcher:hover, .brief-launcher:focus-visible { padding-right: 17px; }
    .brief-l-desk { display: none; }
    .brief-l-mob { display: inline; }
    .brief-launcher.is-tucked, .brief-launcher.is-menu { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px); }

    .brief-panel {
        width: 100%; height: 100vh; height: 100dvh; top: auto; bottom: 0;
        border-left: 0; box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform: translateY(100%);
    }
    .brief-head { padding: 14px 16px 14px; }
    .brief-title { font-size: 21px; }
    .brief-body { padding: 0 16px 34px; }
    .brief-d-title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    .brief-launcher, .brief-panel, .brief-overlay, .brief-card { transition: none; }
    .brief-detail { animation: none; }
    .brief-launcher-dot, .brief-eyebrow-dot, .brief-skel { animation: none; }
}
