/* -- Credential Item (website · Company) ----------------------------------
   Presents one certification or accreditation with verification details - the seal, the issuer, the validity and a link to verify it. */

@layer components {
  /* every box in the block measures border-box - the same on any page */
  :where(.mk-credential-item, .mk-credential-item *, .mk-credential-item ::before, .mk-credential-item ::after) {
    box-sizing: border-box;
  }

  .mk-credential-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem 1rem;
    align-items: start;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--card);
    color: var(--card-foreground);
  }
  .mk-credential-item-seal {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, oklch(0.95 0.06 85), oklch(0.82 0.12 80));
    color: oklch(0.42 0.1 70);
    box-shadow:
      0 0 0 3px var(--card),
      0 0 0 4px oklch(0.82 0.12 80);

    & svg {
      width: 1.375rem;
      height: 1.375rem;
    }
  }
  .mk-credential-item-body {
    display: grid;
    gap: 0.125rem;
  }
  .mk-credential-item-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
  }
  .mk-credential-item-issuer {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
  }
  .mk-credential-item-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0.625rem 0 0;

    & div {
      display: grid;
    }
    & dt {
      color: var(--muted-foreground);
      font-size: 0.75rem;
    }
    & dd {
      margin: 0;
      font-size: 0.875rem;
      font-weight: 500;
    }
    & code {
      font-family: var(--font-mono);
      font-size: 0.8125rem;
    }
  }
  .mk-credential-item-verify {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    width: fit-content;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;

    & svg {
      width: 1rem;
      height: 1rem;
    }
    &:hover {
      text-decoration: underline;
      text-underline-offset: 3px;
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
      border-radius: var(--radius-sm);
    }
  }

  .mk-credential-item[data-variant="compact"] {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 0.875rem 1rem;

    & .mk-credential-item-seal {
      width: 2.25rem;
      height: 2.25rem;
      & svg {
        width: 1rem;
        height: 1rem;
      }
    }
    & .mk-credential-item-dates {
      display: none;
    }
    & .mk-credential-item-verify {
      grid-column: 3;
    }
  }

  /* -- Accessibility ------------------------------------------- */
  @media (forced-colors: active) {
    .mk-credential-item {
      border-color: CanvasText;
    }
    .mk-credential-item-seal {
      forced-color-adjust: none;
    }
  }
}
