/* edet-goals.css — the writing-goal control, folded UP into the chrome row
   (it used to be a full-width strip at the bottom of the editor). Three states
   via data-state: empty (a compact "+ Goal" prompt), active (two slim progress
   meters), editing (an inline popover with number inputs). Tokens from
   site.css :root. */

.dr-goal-bar {
    position: relative;            /* anchor for the editing popover */
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    white-space: nowrap;
}

/* which child shows per state */
.dr-goal-empty,
.dr-goal-view,
.dr-goal-edit { display: none; }
.dr-goal-bar[data-state="empty"] .dr-goal-empty { display: inline-flex; }
.dr-goal-bar[data-state="active"] .dr-goal-view { display: flex; }
.dr-goal-bar[data-state="editing"] .dr-goal-edit { display: flex; }
/* while editing, keep the meters visible behind the popover for context */
.dr-goal-bar[data-state="editing"] .dr-goal-view { display: flex; }

.dr-goal-empty {
    align-items: center;
    background: transparent;
    border: none;
    color: var(--fg-muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 0;
}
.dr-goal-empty:hover { color: var(--accent); }

.dr-goal-view { align-items: center; gap: 0.85rem; }
.dr-goal-item { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; min-width: 0; }
.dr-goal-item[data-on="false"] { opacity: 0.4; }
.dr-goal-item-label { color: var(--fg-muted); flex-shrink: 0; }
.dr-goal-track {
    flex: 0 0 auto;
    width: 46px;
    height: 5px;
    background: var(--bg-raised);
    border-radius: 999px;
    overflow: hidden;
}
.dr-goal-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 999px;
    transition: width var(--dur-med) var(--ease-smooth);
}
.dr-goal-val { color: var(--fg-dim); flex-shrink: 0; white-space: nowrap; }

/* editing → a small popover hanging below the chip, not a full-width strip */
.dr-goal-edit {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem;
    background: var(--bg-elevated);
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    animation: dr-context-pop var(--dur-fast) var(--ease-smooth) both;
}
.dr-goal-edit-field { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--fg-muted); }
.dr-goal-input {
    width: 5rem;
    height: 24px;
    background: var(--bg-raised);
    color: var(--fg);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    padding: 0 0.4rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    outline: none;
}
.dr-goal-input:focus { border-color: var(--rule-hot); }
.dr-goal-edit .dr-btn { height: var(--control-h-compact); font-size: var(--text-xs); }

/* celebration flash when a goal is reached (tint the dot's neighbourhood) */
.dr-goal-bar.dr-goal-hit .dr-goal-track { animation: dr-goal-flash var(--dur-slow) var(--ease-quick); }
@keyframes dr-goal-flash {
    0%   { background: var(--bg-raised); }
    30%  { background: var(--accent-muted); }
    100% { background: var(--bg-raised); }
}
