/* Feed row: one deal in the list. */

@layer components {
  .deal-row {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.75rem var(--inline-space);
    background: var(--color-canvas);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);

    /* Pill styling/sizing is shared in votes.css; the row only lifts the control
       above its stretched title link. */
    .vote {
      position: relative;
      z-index: 1;
    }

    &.deal-row--expired {
      opacity: 0.72;

      .deal-row__price {
        color: var(--color-text-muted);
      }
    }
  }

  .deal-row__top {
    display: flex;
    gap: var(--inline-space);
  }

  .deal-row__thumb {
    inline-size: 4rem;
    block-size: 4rem;
    flex: none;
    object-fit: contain;
    padding: 0.25rem 0.4ch;
    border-radius: var(--radius-sm);
    background: var(--color-canvas);
    border: 1px solid var(--color-border-subtle);
  }

  .deal-row__body {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .deal-row__price {
    font-size: var(--text-medium);
    color: var(--color-ink);
  }

  .deal-row__was {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-x-small);
    text-decoration: line-through;
    color: var(--color-text-muted);
  }

  .deal-row__disc {
    font-family: var(--font-mono);
    font-size: var(--text-x-small);
    font-weight: 700;
    color: var(--color-up);
  }

  .deal-row__title {
    margin-block: 0.125rem;

    a {
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      overflow: hidden;
      font-size: var(--text-normal);
      font-weight: 600;
      line-height: var(--leading-snug);
      color: var(--color-ink);

      @media (any-hover: hover) {
        &:hover {
          color: var(--color-primary-press);
          text-decoration: none;
        }
      }
    }
  }

  /* Stretch the title link over the whole row so the entire card opens the deal.
     Interactive controls in the action row sit above it via z-index. */
  .deal-row__link::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  .deal-row__meta {
    display: flex;
    align-items: center;
    gap: var(--inline-space-half);
    flex-wrap: wrap;
    font-size: var(--text-x-small);
    color: var(--color-text-muted);
  }

  .deal-row__retailer {
    font-weight: 600;
    color: var(--color-text-subtle);
  }

  .deal-row__expiry {
    font-weight: 600;
    color: var(--color-primary-press);
  }

  .deal-row__flag {
    font-family: var(--font-mono);
    font-size: var(--text-x-small);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-down);
    border: 1px solid var(--color-down);
    border-radius: var(--radius-xs);
    padding: 0 0.4ch;
  }

  /* Bottom action row (modern Reddit): vote pill + comments + share, reactions
     pushed to the right. Each interactive control rises above the stretched link. */
  .deal-row__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75ch;
  }

  .deal-row__action {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.4ch;
    padding: 0.375rem 0.75ch;
    border-radius: var(--radius-sm);
    font-size: var(--text-x-small);
    font-weight: 600;
    color: var(--color-text-subtle);

    @media (any-hover: hover) {
      &:hover {
        background: var(--tint-ink-10);
        color: var(--color-ink);
        text-decoration: none;
      }
    }

    .icon {
      font-size: var(--text-small);
    }
  }

  /* Fallback when a deal has no image (deals_helper); rendered in the row + hero
     thumbnail slots, which set their own size. */
  .thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-x-small);
    font-weight: 700;
    color: var(--color-text-muted);
    background: linear-gradient(135deg, var(--color-thumb-from), var(--color-thumb-to));
  }
}
