/* ============================================================
   Entry cards (respondtolawrance round 13, 2026-11-17, option C of
   .automation/planning/entryseparators/options.html).

   A box that holds several entries of the same kind shows each one as a
   card that opens with a heading row. Transfers, Extra Withdrawals and
   One-Time Benefits (a name the member types): its number, its name in
   the card-title size, and a one-line summary. 72(t) series, Health Care
   arrangements, added Deferred Compensation plans and the Pensions box's
   pensions (a title of their own): the same card and band, the title in
   the card-title size (.entry-card-heading). Lawrence ("older eyes") could not tell where one
   entry ended and the next began: the outline was the lightest grey the
   app has and the name was the smallest text on the card.

   js/app/contentboxes/_shared/entryCard.js (window.EntryCard) builds the
   heading row; this file is the ONE home of the look. An entry is marked
   four ways that do not depend on colour: the number, the band, an
   outline of 3:1 or better against the card, and an 18px gap.
   Both colours are mixes of the text and card tokens, so every theme
   keeps the contrast. Sentinel: __tests__/ui-density/entry-cards.test.js
   ============================================================ */

/* .content-box-body in the selector outranks the boxes' own older card rules
   (.hc-box .hc-card, .pbx-row); the border is !important because quiet boxes
   clears .pbx-row's top line with a stronger selector. */
.content-box-body .entry-card {
    --entry-card-line: color-mix(in srgb, var(--ui-text-primaryText) 50%, var(--ui-backgrounds-cardBg));
    --entry-card-band: color-mix(in srgb, var(--ui-text-primaryText) 5%, var(--ui-backgrounds-cardBg));
    border: 1px solid var(--entry-card-line) !important;
    border-radius: 12px;
    margin: 0 0 18px;
    padding: 0 12px 12px;
    background: var(--ui-backgrounds-cardBg);
}

/* The heading row bleeds to the card's edges. No overflow clip on the card:
   the dropdowns inside a card open past its edge. */
.content-box-body .entry-card > .entry-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 -12px 10px;
    padding: 9px 12px;
    background: var(--entry-card-band);
    border-bottom: 1px solid var(--ui-borders-borderDefault);
    border-radius: 11px 11px 0 0;
}

.entry-card-num {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ui-backgrounds-cardBg);
    background: color-mix(in srgb, var(--ui-text-primaryText) 70%, var(--ui-backgrounds-cardBg));
}

.entry-card-title {
    flex: 1;
    min-width: 0;
}

/* The name is still typed in place; it is the card's title, so it takes the
   card-title size (16px), never the small text it had. */
.entry-card-head input.entry-card-name {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 3px 9px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    background: transparent;
}

.entry-card-sum {
    padding: 2px 9px 0;
    line-height: 1.35;
    color: var(--ui-text-secondaryText);
    overflow-wrap: anywhere;
}
.entry-card-sum[hidden] { display: none; }

/* A card with a title of its own instead of a typed name. !important: quiet
   boxes sizes .content-section-title and the boxes' own title classes. */
body .content-box .content-box-body .entry-card-head .entry-card-heading {
    flex: 1;
    min-width: 0;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.3;
    color: var(--ui-text-primaryText);
}

/* The icon remove button reads on the band. */
.entry-card-head > button:has(> i):not(.entry-card-toggle) {
    background: var(--ui-backgrounds-cardBg) !important;
}

/* ------------------------------------------------------------
   Folding (option F): in a list of two or more, only the entry being
   edited is open; the others rest as their heading row. A card alone in
   its list (.is-single) is always open and has no fold control.
   The card is folded by class only, AFTER it is built: its rows keep the
   inline display the box gave them (boxes read those).
   ------------------------------------------------------------ */
.entry-card-toggle {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: -4px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ui-text-secondaryText);
    cursor: pointer;
}
.entry-card-toggle i { transition: transform 0.15s ease; }
.entry-card:not(.is-folded) .entry-card-toggle i { transform: rotate(90deg); }
.entry-card.is-single .entry-card-toggle { display: none; }

.entry-card-edit,
.entry-card-flag { display: none; }

/* The open card of a list: a heavier outline in the link colour, plus the
   turned chevron and its fields (never colour alone). */
.content-box-body .entry-card:not(.is-folded):not(.is-single) {
    border-color: var(--ui-text-linkText) !important;
    box-shadow: 0 0 0 1px var(--ui-text-linkText);
}

.content-box-body .entry-card.is-folded {
    margin-bottom: 10px;
    padding-bottom: 0 !important;
}
.content-box-body .entry-card.is-folded > :not(.entry-card-head) { display: none !important; }
.content-box-body .entry-card.is-folded > .entry-card-head {
    min-height: 56px;
    margin-bottom: 0;
    border-bottom: 0;
    border-radius: 11px;
    background: var(--ui-backgrounds-cardBg);
    cursor: pointer;
}
.content-box-body .entry-card.is-folded > .entry-card-head:hover { background: var(--entry-card-band); }
/* The row is the switch: the name and the remove button are out of reach until the card is open. */
.entry-card.is-folded .entry-card-head input.entry-card-name {
    pointer-events: none;
    border-color: transparent !important;
}
.entry-card.is-folded .entry-card-head > button:not(.entry-card-toggle) { display: none; }
.entry-card.is-folded .entry-card-edit {
    display: block;
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--ui-text-linkText);
}
.entry-card.is-folded.has-alert .entry-card-flag {
    display: block;
    padding: 2px 9px 0;
    font-weight: 600;
    color: var(--ui-text-primaryText);
}
.entry-card-flag i { color: var(--color-semantic-warning); }
