/* buys.css - «Покупки»: the folding card, importance scale, rows */

  /* importance 1 не срочно .. 4 срочно: rows, header dots and the add-row
     pill all take their color from --imp */
  [data-imp="1"] { --imp: var(--g-green); }
  [data-imp="2"] { --imp: var(--g-yellow); }
  [data-imp="3"] { --imp: var(--g-orange); }
  [data-imp="4"] { --imp: var(--g-red); }
  :root { --imp-off: color-mix(in srgb, var(--text-tertiary) 32%, transparent); }

  /* ---------- Card: the header is the switch ---------- */

  .card.buy-card { padding: 0; }

  .buy-h { font: inherit; }

  .buy-head {
    appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 29px 20px 29px 28px;
    border-radius: 20px;
    cursor: pointer;
    transition: padding-bottom 0.35s var(--ease-out);
    touch-action: manipulation;
  }
  .buy-head:focus-visible { outline-offset: -3px; }
  /* the title sits at the same inset as the other cards' titles and stays
     put; unfolded, the add row starts where it does in the other cards */
  .buy-card.open .buy-head { padding-bottom: 9px; }

  .buy-dots {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.25s;
  }
  .buy-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--imp);
  }
  /* unfolded, the list itself shows the colors */
  .buy-card.open .buy-dots { opacity: 0; }

  .buy-head .section-count { margin-left: 0; padding-left: 0; }

  .buy-chev {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: background 0.15s, color 0.15s;
  }
  .buy-chev svg { transition: transform 0.3s var(--spring); }
  .buy-head:hover .buy-chev { background: var(--btn-hover); color: var(--text); }
  .buy-card.open .buy-chev svg { transform: rotate(90deg); }

  /* the body folds to zero height; hidden content leaves the tab order and
     the accessibility tree once the fold has finished */
  .buy-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s var(--ease-out);
  }
  .buy-card.open .buy-body { grid-template-rows: 1fr; }
  .buy-inner {
    min-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: visibility 0s linear 0.35s;
  }
  .buy-card.open .buy-inner { visibility: visible; transition-delay: 0s; }
  /* the card's bottom padding, as content so it folds away with the rest */
  .buy-inner::after { content: ""; display: block; height: 10px; }

  /* ---------- Importance scale ---------- */

  .imp-meter {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
  }
  .imp-meter i {
    width: 4px;
    border-radius: 1.5px;
    background: var(--imp-off);
    transition: background 0.2s;
  }
  .imp-meter i:nth-child(1) { height: 5px; }
  .imp-meter i:nth-child(2) { height: 8px; }
  .imp-meter i:nth-child(3) { height: 11px; }
  .imp-meter i:nth-child(4) { height: 14px; }
  [data-imp="1"] .imp-meter i:nth-child(-n+1),
  [data-imp="2"] .imp-meter i:nth-child(-n+2),
  [data-imp="3"] .imp-meter i:nth-child(-n+3),
  [data-imp="4"] .imp-meter i:nth-child(-n+4) { background: var(--imp); }

  .imp-meter.bump { animation: imp-bump 0.32s var(--spring); }
  @keyframes imp-bump {
    0% { transform: scale(1); }
    40% { transform: scale(0.82); }
    100% { transform: scale(1); }
  }

  .buy-pick { min-width: 40px; }

  /* ---------- Rows ---------- */

  /* the ring carries the importance color, lightly tinted inside; once
     bought it fills like every other checkbox in the app */
  .buy-row .check { color: var(--imp); }
  .buy-row .c-ring { fill: color-mix(in srgb, var(--imp) 13%, transparent); }
  .buy-row.done .c-ring { fill: none; }
  /* the hidden white tick must not show through the tint */
  .buy-row:not(.done) .c-mark { opacity: 0; }
  /* with a mouse, the tick previews in the row's color */
  @media (hover: hover) {
    .buy-row:not(.done) .check:hover .c-mark {
      stroke: var(--imp);
      stroke-dashoffset: 0;
      opacity: 0.7;
    }
  }

  .buy-imp {
    appearance: none;
    border: none;
    background: transparent;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s var(--spring), opacity 0.2s;
    touch-action: manipulation;
  }
  .buy-imp::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
  .buy-imp:hover { background: var(--btn-hover); }
  .buy-imp:active { transform: scale(0.9); }
  .buy-row.done .buy-imp { opacity: 0.35; }

  .buy-row .edit-input { margin-right: 4px; }

  @media (max-width: 480px) {
    .buy-head { padding: 23px 12px 23px 20px; border-radius: 18px; }
    .buy-card.open .buy-head { padding-bottom: 9px; }
  }
