/*
 * The MEDIA TILE: a coloured body under one glyph, with the filename and the
 * type in a footer. Its ink is the file type's own colour, which the component
 * passes in as `--lotics-media-card-ink` — so a theme that moves the family
 * moves the card.
 *
 * A row-sized tile drops the footer entirely: at 40px there is no room for a
 * name, and the row holding it already says one.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  /* THE MEDIA TILE — a coloured body under a glyph, with the filename and the
     type in a footer. Its ink is the file type's own colour, passed in. */
  .lotics-media-card {
    /* The type chip's own micro-typography: an 8px stamp inside a footer has no
       rung on the ramp to take. Its CORNER does — every badge in the kit is on
       the control rung, and at 12px tall that rung clamps to half the box. */
    --lotics-media-card-type-size: 8px;
    --lotics-media-card-type-tracking: 0.3px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: var(--lotics-media-card-size, 100%);
    height: var(--lotics-media-card-size, 100%);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--lotics-radius-control);
    background-color: var(--card);
    overflow: hidden;
    appearance: none;
    cursor: default;
  }

  .lotics-media-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: transparent;
    pointer-events: none;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  .lotics-media-card:hover::after {
    background-color: var(--lotics-scrim-hover);
  }

  .lotics-media-card:active::after {
    background-color: var(--lotics-scrim-press);
  }

  .lotics-media-card:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  /* A row-sized media tile is a coloured chip: no footer fits, so the glyph
     alone carries the type and a quick dim reads as the press. */
  .lotics-media-card[data-compact] {
    align-items: center;
    justify-content: center;
    border: 0 solid var(--border);
    border-radius: calc(var(--lotics-radius-control) - var(--lotics-space-2));
    background-color: var(--lotics-media-card-ink);
    --lotics-icon-color: var(--lotics-white);
  }

  .lotics-media-card[data-compact]::after {
    content: none;
  }

  .lotics-media-card[data-compact]:active {
    opacity: 0.85;
  }

  .lotics-media-card__body {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    min-height: 0;
    background-color: var(--lotics-media-card-ink);
    --lotics-icon-color: var(--lotics-white);
  }

  .lotics-media-card__backdrop {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: var(--lotics-media-card-backdrop);
    height: var(--lotics-media-card-backdrop);
    border-radius: var(--lotics-radius-full);
    background-color: color-mix(in srgb, var(--lotics-white) 22%, transparent);
  }

  .lotics-media-card__footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--lotics-space-2);
    padding-inline: var(--lotics-space-8);
    padding-block: var(--lotics-space-6);
    border-top: 1px solid var(--border);
    background-color: var(--muted);
  }

  .lotics-media-card__type {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding-inline: var(--lotics-space-4);
    padding-block: var(--lotics-space-2);
    border-radius: var(--lotics-radius-control);
    background-color: var(--lotics-media-card-ink);
    font-family: var(--font-sans);
    font-size: var(--lotics-media-card-type-size);
    line-height: normal;
    letter-spacing: var(--lotics-media-card-type-tracking);
    font-weight: var(--lotics-weight-semibold);
    color: var(--lotics-white);
  }
}
