/* The Brief card atop Today and the Open Loops list it opens.
 *
 * Both read quietly, as the Profile does: the card is a few lines of text
 * under a headline. Its foot is the link to the Open Loops and stretches over
 * the whole card; a thread's own link and the card's one ellipsis sit above
 * that stretch. The list is text with one grey line under each entry. An open Loop's
 * only control is its ellipsis, shown on hover or focus where a pointer
 * hovers; faded and closed Loops fold into one line each.
 */

/* ---------------------------------------------------------------- the card */

.brief-card {
  margin: 0 0 1rem;
}

.brief-panel {
  position: relative;
  display: grid;
  gap: 0.45rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 2px var(--shadow-hair), 0 16px 40px var(--shadow-card);
  overflow-wrap: anywhere;
}

.brief-panel:hover {
  border-color: var(--border-firm);
}

.brief-panel:has(.brief-more:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--signal) 25%, transparent);
  outline-offset: 2px;
}

/* Room at the right of the eyebrow and headline for the ellipsis. */
.brief-eyebrow,
.brief-headline {
  padding-right: 2.25rem;
}

/* The card's one control, at its top right, above the stretched link. */
.brief-menu-toggle {
  position: absolute;
  z-index: 1;
  top: 0.75rem;
  right: 0.75rem;
  border-color: transparent;
  background: transparent;
}

.brief-eyebrow {
  margin: 0;
}

.brief-headline {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.45;
}

.brief-loops {
  display: grid;
  gap: 0.25rem;
  margin: 0.2rem 0 0;
  padding: 0 0 0 1.2rem;
  list-style: disc;
  font-size: 0.95rem;
  line-height: 1.6;
}

.brief-loop::marker {
  color: var(--ink-ghost);
}

/* A Profile thread: beneath the Loops, its own link to the Profile. */
.brief-threads {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0 0 0 1.2rem;
  list-style: circle;
  font-size: 0.92rem;
  line-height: 1.6;
}

.brief-thread::marker {
  color: var(--ink-ghost);
}

.brief-thread-link {
  position: relative;
  z-index: 1;
  color: var(--ink-muted);
  text-decoration: none;
}

.brief-thread-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Marked since the morning: still the Brief's line, read as settled. */
.brief-loop-closed {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.brief-line {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.brief-body,
.brief-observation,
.brief-nudge {
  color: var(--ink-muted);
}

/* A line marked 「不需要」: still there, faint, with a small tag. */
.brief-unneeded,
.brief-unneeded :is(.brief-thread-link, .brief-week-title, .brief-week-text, .brief-week-table th) {
  color: var(--ink-faint);
}

.brief-unneeded-tag {
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  vertical-align: 0.1em;
}

/* The week just closed: a hairline, a quiet title, its words, then label and
   value per row. */
.brief-week {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}

.brief-week-title {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brief-week-text {
  color: var(--ink-muted);
}

/* Capped so on a wide screen a value stays within reach of its label. */
.brief-week-table {
  max-width: 26rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.brief-week-table tbody tr {
  border-top: none;
}

.brief-week-table th,
.brief-week-table td {
  padding: 0.18rem 0;
  vertical-align: baseline;
}

.brief-week-table th {
  padding-right: 1rem;
  color: var(--ink-muted);
  font-size: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

/* A value and its "prev" stay one line; the label column takes what is left
   and wraps (a first-seen address is the long one). */
.brief-week-table td {
  text-align: right;
  white-space: nowrap;
}

.brief-week-previous {
  margin-left: 0.5rem;
  color: var(--ink-faint);
}

.brief-more {
  justify-self: start;
  margin: 0.2rem 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
}

/* The whole card opens the Open Loops. */
.brief-more::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
}

.brief-more:focus-visible {
  outline: none;
}

.brief-panel:hover .brief-more {
  color: var(--ink);
}

.brief-error {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------- the list */

#loops-status:empty {
  min-height: 0;
  margin: 0;
}

.loops-list {
  display: grid;
  gap: 1.1rem;
  max-width: 46rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.loops-list:empty {
  display: none;
}

/* Room at the right for Done and Wrong, which sit there out of flow, so a
   long text wraps beside them and never pushes them off. */
.loop {
  position: relative;
  display: grid;
  gap: 0.15rem;
}

.loop-actionable {
  min-height: 2.75rem;
  padding-right: 6.5rem;
}

.loop-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.loop-closed .loop-text {
  color: var(--ink-muted);
}

/* Flex items, so the line breaks only between its parts, never inside a time. */
.loop-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.4rem;
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.loop-meta > * {
  white-space: nowrap;
}

.loop-meta > * + *::before {
  content: "·";
  margin-right: 0.4rem;
  color: var(--ink-ghost);
}

.loop-when {
  color: inherit;
}

.loop-when:hover {
  color: var(--ink);
}

.loop-quote {
  margin: 0.15rem 0 0;
  padding-left: 0.65rem;
  border-left: 2px solid var(--border-firm);
  color: var(--ink-faint);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* Always on the face: marking is how a Loop closes. 44 px targets. */
.loop-marks {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.35rem;
}

.loop-mark {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-color: var(--border-pill);
  color: var(--ink-muted);
  background: var(--paper);
  font-size: 1rem;
  line-height: 1;
}

.loop-mark:hover:not(:disabled) {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 3%, var(--paper));
}

.loops-fold {
  max-width: 46rem;
  margin-top: 0.25rem;
}

.loops-fold[open] > summary {
  margin-bottom: 0.6rem;
}

.loops-fold-lead {
  margin: 0 0 0.8rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Beside the state word while a mark can be taken back: quiet, never a pill. */
.loop-undo {
  padding: 0;
  border: 0;
  color: var(--ink-muted);
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.loop-undo:hover:not(:disabled) {
  color: var(--ink);
}
